Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java @ 14042:2864cb92fa9a
TruffleDSL: retire NodeFactory#createNodeGeneric
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Wed, 26 Feb 2014 15:34:59 +0100 |
parents | 28479abd1a69 |
children | 3ea5f337cc0d |
comparison
equal
deleted
inserted
replaced
14041:67d2c95bfa43 | 14042:2864cb92fa9a |
---|---|
537 } | 537 } |
538 | 538 |
539 TypeMirror nodeFactory = Utils.getDeclaredType(Utils.fromTypeMirror(getContext().getType(NodeFactory.class)), node.getNodeType()); | 539 TypeMirror nodeFactory = Utils.getDeclaredType(Utils.fromTypeMirror(getContext().getType(NodeFactory.class)), node.getNodeType()); |
540 clazz.getImplements().add(nodeFactory); | 540 clazz.getImplements().add(nodeFactory); |
541 clazz.add(createCreateNodeMethod(node)); | 541 clazz.add(createCreateNodeMethod(node)); |
542 clazz.add(createCreateNodeGenericMethod(node)); | |
543 clazz.add(createGetNodeClassMethod(node)); | 542 clazz.add(createGetNodeClassMethod(node)); |
544 clazz.add(createGetNodeSignaturesMethod()); | 543 clazz.add(createGetNodeSignaturesMethod()); |
545 clazz.add(createGetChildrenSignatureMethod(node)); | 544 clazz.add(createGetChildrenSignatureMethod(node)); |
546 clazz.add(createGetInstanceMethod(node, createVisibility)); | 545 clazz.add(createGetInstanceMethod(node, createVisibility)); |
547 clazz.add(createInstanceConstant(node, clazz.asType())); | 546 clazz.add(createInstanceConstant(node, clazz.asType())); |
704 builder.startElseBlock(); | 703 builder.startElseBlock(); |
705 builder.startThrow().startNew(getContext().getType(IllegalArgumentException.class)); | 704 builder.startThrow().startNew(getContext().getType(IllegalArgumentException.class)); |
706 builder.doubleQuote("Invalid create signature."); | 705 builder.doubleQuote("Invalid create signature."); |
707 builder.end().end(); | 706 builder.end().end(); |
708 builder.end(); // else block | 707 builder.end(); // else block |
709 return method; | |
710 } | |
711 | |
712 private CodeExecutableElement createCreateNodeGenericMethod(NodeData node) { | |
713 CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), node.getNodeType(), "createNodeGeneric"); | |
714 CodeVariableElement nodeParam = new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME); | |
715 method.addParameter(nodeParam); | |
716 | |
717 CodeTreeBuilder builder = method.createBuilder(); | |
718 if (!node.needsRewrites(getContext())) { | |
719 builder.startThrow().startNew(getContext().getType(UnsupportedOperationException.class)).doubleQuote("No specialized version.").end().end(); | |
720 } else { | |
721 builder.startReturn().startCall("createGeneric"); | |
722 builder.string(THIS_NODE_LOCAL_VAR_NAME); | |
723 builder.end().end(); | |
724 } | |
725 return method; | 708 return method; |
726 } | 709 } |
727 | 710 |
728 private ExecutableElement createGetInstanceMethod(NodeData node, Modifier visibility) { | 711 private ExecutableElement createGetInstanceMethod(NodeData node, Modifier visibility) { |
729 TypeElement nodeFactoryType = Utils.fromTypeMirror(getContext().getType(NodeFactory.class)); | 712 TypeElement nodeFactoryType = Utils.fromTypeMirror(getContext().getType(NodeFactory.class)); |