Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java @ 18754:59bf50cc5a32
Truffle-DSL: implemented @GenerateNodeFactory to enable generation of factories. Factory generation is now disabled by default.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 29 Dec 2014 23:38:25 +0100 |
parents | 6ee7afea175a |
children | a665483c3881 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java Mon Dec 29 23:38:21 2014 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/NodeData.java Mon Dec 29 23:38:25 2014 +0100 @@ -52,9 +52,10 @@ private Map<Integer, List<ExecutableTypeData>> executableTypes; private final NodeExecutionData thisExecution; + private final boolean generateFactory; public NodeData(ProcessorContext context, TypeElement type, String shortName, TypeSystemData typeSystem, List<NodeChildData> children, List<NodeExecutionData> executions, - List<NodeFieldData> fields, List<String> assumptions) { + List<NodeFieldData> fields, List<String> assumptions, boolean generateFactory) { super(context, type, null, null); this.nodeId = type.getSimpleName().toString(); this.shortName = shortName; @@ -65,10 +66,15 @@ this.assumptions = assumptions; this.thisExecution = new NodeExecutionData(new NodeChildData(null, null, "this", getNodeType(), getNodeType(), null, Cardinality.ONE), -1, false); this.thisExecution.getChild().setNode(this); + this.generateFactory = generateFactory; } public NodeData(ProcessorContext context, TypeElement type) { - this(context, type, null, null, null, null, null, null); + this(context, type, null, null, null, null, null, null, false); + } + + public boolean isGenerateFactory() { + return generateFactory; } public NodeExecutionData getThisExecution() { @@ -231,13 +237,13 @@ return null; } - public List<NodeData> getNodeDeclaringChildren() { + public List<NodeData> getNodesWithFactories() { List<NodeData> nodeChildren = new ArrayList<>(); for (NodeData child : getEnclosingNodes()) { - if (child.needsFactory()) { + if (child.needsFactory() && child.isGenerateFactory()) { nodeChildren.add(child); } - nodeChildren.addAll(child.getNodeDeclaringChildren()); + nodeChildren.addAll(child.getNodesWithFactories()); } return nodeChildren; }