Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/template/ClassElementFactory.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 | 79041ab43660 |
children |
comparison
equal
deleted
inserted
replaced
16754:55fd5be68a52 | 16755:bd28da642eea |
---|---|
30 import javax.lang.model.element.*; | 30 import javax.lang.model.element.*; |
31 import javax.lang.model.type.*; | 31 import javax.lang.model.type.*; |
32 import javax.lang.model.util.*; | 32 import javax.lang.model.util.*; |
33 | 33 |
34 import com.oracle.truffle.api.dsl.*; | 34 import com.oracle.truffle.api.dsl.*; |
35 import com.oracle.truffle.dsl.processor.*; | |
36 import com.oracle.truffle.dsl.processor.ast.*; | 35 import com.oracle.truffle.dsl.processor.ast.*; |
37 | 36 |
38 public abstract class ClassElementFactory<M> extends CodeElementFactory<M> { | 37 public abstract class ClassElementFactory<M> extends CodeElementFactory<M> { |
39 | |
40 public ClassElementFactory(ProcessorContext context) { | |
41 super(context); | |
42 } | |
43 | 38 |
44 @Override | 39 @Override |
45 protected abstract CodeTypeElement create(M m); | 40 protected abstract CodeTypeElement create(M m); |
46 | 41 |
47 @Override | 42 @Override |
73 method.addParameter(new CodeVariableElement(field.asType(), fieldName)); | 68 method.addParameter(new CodeVariableElement(field.asType(), fieldName)); |
74 builder.startStatement(); | 69 builder.startStatement(); |
75 builder.string("this."); | 70 builder.string("this."); |
76 builder.string(fieldName); | 71 builder.string(fieldName); |
77 builder.string(" = "); | 72 builder.string(" = "); |
78 if (isAssignable(getContext(), field.asType(), getContext().getTruffleTypes().getNode())) { | 73 if (isAssignable(field.asType(), getContext().getTruffleTypes().getNode())) { |
79 builder.string("adoptChild(").string(fieldName).string(")"); | 74 builder.string("adoptChild(").string(fieldName).string(")"); |
80 } else { | 75 } else { |
81 builder.string(fieldName); | 76 builder.string(fieldName); |
82 } | 77 } |
83 builder.end(); // statement | 78 builder.end(); // statement |