Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/TruffleProcessor.java @ 16755:bd28da642eea
Truffle-DSL: Several new features implemented:
Implementation of a new code generation layout which shares code between generated nodes.
Declaration order of specializations is now used as specialization order.
Specializations do no longer perform fallthrough on respecialization, they now always respecialize from the first specialization.
Implemented support for contains relations between specializations.
Improved reachability error messages.
Preliminary support for @Implies.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:53:05 +0200 |
parents | 288c23143d47 |
children | 23415229349b |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/TruffleProcessor.java Mon Aug 11 15:53:05 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/TruffleProcessor.java Mon Aug 11 15:53:05 2014 +0200 @@ -42,7 +42,6 @@ @SupportedSourceVersion(SourceVersion.RELEASE_7) public class TruffleProcessor extends AbstractProcessor implements ProcessCallback { - private ProcessorContext context; private List<AnnotationProcessor<?>> generators; private RoundEnvironment round; @@ -60,6 +59,7 @@ // TODO run verifications that other annotations are not processed out of scope of the // operation or typelattice. try { + ProcessorContext.setThreadLocalInstance(new ProcessorContext(processingEnv, this)); for (AnnotationProcessor<?> generator : getGenerators()) { AbstractParser<?> parser = generator.getParser(); if (parser.getAnnotationType() != null) { @@ -82,6 +82,7 @@ } } finally { + ProcessorContext.setThreadLocalInstance(null); this.round = null; } } @@ -96,7 +97,7 @@ private static void handleThrowable(AnnotationProcessor<?> generator, Throwable t, Element e) { String message = "Uncaught error in " + generator.getClass().getSimpleName() + " while processing " + e; - generator.getContext().getEnvironment().getMessager().printMessage(Kind.ERROR, message + ": " + Utils.printException(t), e); + ProcessorContext.getInstance().getEnvironment().getMessager().printMessage(Kind.ERROR, message + ": " + Utils.printException(t), e); } @Override @@ -127,19 +128,12 @@ private List<AnnotationProcessor<?>> getGenerators() { if (generators == null && processingEnv != null) { generators = new ArrayList<>(); - generators.add(new AnnotationProcessor<>(getContext(), new TypeSystemParser(getContext()), new TypeSystemCodeGenerator(getContext()))); - generators.add(new AnnotationProcessor<>(getContext(), new NodeParser(getContext()), new NodeCodeGenerator(getContext()))); + generators.add(new AnnotationProcessor<>(new TypeSystemParser(), new TypeSystemCodeGenerator())); + generators.add(new AnnotationProcessor<>(new NodeParser(), new NodeCodeGenerator())); } return generators; } - private ProcessorContext getContext() { - if (context == null) { - context = new ProcessorContext(processingEnv, this); - } - return context; - } - @Override public synchronized void init(ProcessingEnvironment env) { this.processingEnv = env;