comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/generator/NodeCodeGenerator.java @ 19282:ae81dd154fb6

Truffle-DSL: remove old DSL layout; Make new layout the default.
author Christian Humer <christian.humer@gmail.com>
date Thu, 22 Jan 2015 20:44:24 +0100
parents 4ce856e65728
children 833e088ee7d3
comparison
equal deleted inserted replaced
19281:92880b0f7fed 19282:ae81dd154fb6
120 120
121 return container; 121 return container;
122 } 122 }
123 123
124 private static String getAccessorClassName(NodeData node) { 124 private static String getAccessorClassName(NodeData node) {
125 return node.isGenerateFactory() ? NodeFactoryFactory.factoryClassName(node) : NodeBaseFactory.baseClassName(node); 125 return node.isGenerateFactory() ? NodeFactoryFactory.factoryClassName(node) : NodeGenFactory.nodeTypeName(node);
126 } 126 }
127 127
128 private static List<CodeTypeElement> generateNodes(ProcessorContext context, NodeData node) { 128 private static List<CodeTypeElement> generateNodes(ProcessorContext context, NodeData node) {
129 if (!node.needsFactory()) { 129 if (!node.needsFactory()) {
130 return Collections.emptyList(); 130 return Collections.emptyList();
131 } 131 }
132 if (node.getTypeSystem().getOptions().useNewLayout()) { 132 return Arrays.asList(new NodeGenFactory(context, node).create());
133 return Arrays.asList(new NodeGenFactory(context, node).create());
134 } else {
135 return generateNodesOld(context, node);
136 }
137 }
138
139 private static List<CodeTypeElement> generateNodesOld(ProcessorContext context, NodeData node) {
140 List<CodeTypeElement> nodeTypes = new ArrayList<>();
141 SpecializationData generic = node.getGenericSpecialization() == null ? node.getSpecializations().get(0) : node.getGenericSpecialization();
142 CodeTypeElement baseNode = new NodeBaseFactory(context, node, generic).create();
143 nodeTypes.add(baseNode);
144
145 for (SpecializationData specialization : node.getSpecializations()) {
146 if (!specialization.isReachable() || specialization.isFallback()) {
147 continue;
148 }
149 if (specialization.isPolymorphic() && node.isPolymorphic(context)) {
150 nodeTypes.add(new PolymorphicNodeFactory(context, node, specialization, baseNode).create());
151 continue;
152 }
153
154 nodeTypes.add(new SpecializedNodeFactory(context, node, specialization, baseNode).create());
155 }
156 return nodeTypes;
157 } 133 }
158 134
159 private static ExecutableElement createGetFactories(ProcessorContext context, NodeData node) { 135 private static ExecutableElement createGetFactories(ProcessorContext context, NodeData node) {
160 List<NodeData> factoryList = node.getNodesWithFactories(); 136 List<NodeData> factoryList = node.getNodesWithFactories();
161 if (node.needsFactory() && node.isGenerateFactory()) { 137 if (node.needsFactory() && node.isGenerateFactory()) {