Mercurial > hg > graal-jvmci-8
changeset 15477:fd18fa50a8e0
TruffleDSL: NodeCodeGenerator: avoid referencing BaseNode class in factory
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 02 May 2014 15:49:46 +0200 |
parents | 97ee50d15882 |
children | dd95dff835f9 |
files | graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java |
diffstat | 1 files changed, 9 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Fri May 02 15:49:22 2014 +0200 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Fri May 02 15:49:46 2014 +0200 @@ -867,7 +867,7 @@ if (found == null) { body.startThrow().startNew(getContext().getType(UnsupportedOperationException.class)).end().end(); } else { - body.startReturn().startCall(nodeSpecializationClassName(found), CREATE_SPECIALIZATION_NAME).startGroup().cast(baseClassName(node)).string(THIS_NODE_LOCAL_VAR_NAME).end().end().end(); + body.startReturn().startCall(nodeSpecializationClassName(found), CREATE_SPECIALIZATION_NAME).startGroup().string(THIS_NODE_LOCAL_VAR_NAME).end().end().end(); } return method; } @@ -1739,7 +1739,7 @@ } else { replaceCall.startCall("replace"); } - replaceCall.startGroup().startCall(className, CREATE_SPECIALIZATION_NAME).string(source); + replaceCall.startGroup().cast(baseClassName(current.getNode())).startCall(className, CREATE_SPECIALIZATION_NAME).string(source); for (ActualParameter param : current.getSignatureParameters()) { NodeChildData child = param.getSpecification().getExecution().getChild(); List<TypeData> types = child.getNodeData().getTypeSystem().lookupSourceTypes(param.getTypeSystemType()); @@ -2556,7 +2556,7 @@ // skip copy constructor - not used continue; } - clazz.add(createConstructorFactoryMethod(nodeGen.asType(), specialization, constructor)); + clazz.add(createConstructorFactoryMethod(specialization, constructor)); } } } @@ -2929,16 +2929,16 @@ CodeVariableElement[] parameters = new CodeVariableElement[implicitTypeParams.size() + 1]; int i = 0; String baseName = "current"; - parameters[i++] = new CodeVariableElement(baseType, baseName); + parameters[i++] = new CodeVariableElement(specialization.getNode().getNodeType(), baseName); for (ActualParameter implicitTypeParam : implicitTypeParams) { parameters[i++] = new CodeVariableElement(getContext().getType(Class.class), implicitTypeName(implicitTypeParam)); } - CodeExecutableElement method = new CodeExecutableElement(modifiers(STATIC), baseType, CREATE_SPECIALIZATION_NAME, parameters); + CodeExecutableElement method = new CodeExecutableElement(modifiers(STATIC), specialization.getNode().getNodeType(), CREATE_SPECIALIZATION_NAME, parameters); assert specialization != null; CodeTreeBuilder builder = method.createBuilder(); builder.startReturn(); builder.startNew(getElement().asType()); - builder.string(baseName); + builder.startGroup().cast(baseType, CodeTreeBuilder.singleString(baseName)).end(); for (ActualParameter param : implicitTypeParams) { builder.string(implicitTypeName(param)); } @@ -2946,9 +2946,10 @@ return method; } - protected CodeExecutableElement createConstructorFactoryMethod(TypeMirror baseType, SpecializationData specialization, ExecutableElement constructor) { + protected CodeExecutableElement createConstructorFactoryMethod(SpecializationData specialization, ExecutableElement constructor) { List<? extends VariableElement> parameters = constructor.getParameters(); - CodeExecutableElement method = new CodeExecutableElement(modifiers(STATIC), baseType, CREATE_SPECIALIZATION_NAME, parameters.toArray(new CodeVariableElement[parameters.size()])); + CodeExecutableElement method = new CodeExecutableElement(modifiers(STATIC), specialization.getNode().getNodeType(), CREATE_SPECIALIZATION_NAME, + parameters.toArray(new CodeVariableElement[parameters.size()])); assert specialization != null; CodeTreeBuilder builder = method.createBuilder(); builder.startReturn();