# HG changeset patch # User Christian Humer # Date 1382954811 -3600 # Node ID ba6593e52d2299073e5712c5f9bfe4a42b6ecf7b # Parent 595f01abb887ab0e4ff5ee5df51ffb141eeb0a2c Truffle-DSL: fixed additional wrong @SlowPath usage on generic. (GRAAL-490 #resolve) diff -r 595f01abb887 -r ba6593e52d22 graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SlowPathTest.java --- a/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SlowPathTest.java Sun Oct 27 19:59:00 2013 +0100 +++ b/graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/SlowPathTest.java Mon Oct 28 11:06:51 2013 +0100 @@ -28,6 +28,7 @@ import com.oracle.truffle.api.dsl.*; import com.oracle.truffle.api.dsl.test.SlowPathTestFactory.SlowPathOnGeneric0Factory; import com.oracle.truffle.api.dsl.test.SlowPathTestFactory.SlowPathOnGeneric1Factory; +import com.oracle.truffle.api.dsl.test.SlowPathTestFactory.SlowPathOnGeneric2Factory; import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode; import com.oracle.truffle.api.frame.*; import com.oracle.truffle.api.nodes.*; @@ -69,4 +70,27 @@ } + @Test + public void testSlowPathOnGeneric2() throws NoSuchMethodException, SecurityException { + Node node = SlowPathOnGeneric2Factory.create(null); + Assert.assertNull(node.getClass().getSuperclass().getDeclaredMethod("executeGeneric0", VirtualFrame.class, Object.class).getAnnotation(SlowPath.class)); + } + + @NodeChild + abstract static class SlowPathOnGeneric2 extends ValueNode { + + @Specialization(order = 0) + @SuppressWarnings("unused") + Object doObject0(int value0) { + throw new AssertionError(); + } + + @Specialization(order = 1) + @SuppressWarnings("unused") + Object doObject1(VirtualFrame frame, String value0) { + throw new AssertionError(); + } + + } + } diff -r 595f01abb887 -r ba6593e52d22 graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Sun Oct 27 19:59:00 2013 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeCodeGenerator.java Mon Oct 28 11:06:51 2013 +0100 @@ -1377,10 +1377,10 @@ TypeMirror genericReturnType = node.getGenericSpecialization().getReturnType().getType(); CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED), genericReturnType, EXECUTE_GENERIC_NAME); - if (!node.getGenericSpecialization().hasFrame(getContext())) { + if (!node.needsFrame(getContext())) { method.getAnnotationMirrors().add(new CodeAnnotationMirror(getContext().getTruffleTypes().getSlowPath())); } - addInternalValueParameters(method, node.getGenericSpecialization(), node.needsFrame(), false); + addInternalValueParameters(method, node.getGenericSpecialization(), node.needsFrame(getContext()), false); final CodeTreeBuilder builder = method.createBuilder(); builder.tree(createExecuteTree(builder, node.getGenericSpecialization(), group, false, new CodeBlock() { @@ -1803,7 +1803,7 @@ } if (current.isGeneric()) { builder.startReturn().tree(replace).string(".").startCall(EXECUTE_GENERIC_NAME); - addInternalValueParameterNames(builder, source, current, null, current.getNode().needsFrame(), true, null); + addInternalValueParameterNames(builder, source, current, null, current.getNode().needsFrame(getContext()), true, null); builder.end().end(); } else if (current.getMethod() == null) { if (replaceCall != null) { @@ -2968,7 +2968,7 @@ emitEncounteredSynthetic(builder, specialization); } else if (specialization.isGeneric()) { returnBuilder.startCall("super", EXECUTE_GENERIC_NAME); - addInternalValueParameterNames(returnBuilder, specialization, specialization, null, node.needsFrame(), true, null); + addInternalValueParameterNames(returnBuilder, specialization, specialization, null, node.needsFrame(getContext()), true, null); returnBuilder.end(); } else { returnBuilder.tree(createTemplateMethodCall(returnBuilder, null, specialization, specialization, null)); diff -r 595f01abb887 -r ba6593e52d22 graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java --- a/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java Sun Oct 27 19:59:00 2013 +0100 +++ b/graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/node/NodeData.java Mon Oct 28 11:06:51 2013 +0100 @@ -78,12 +78,12 @@ this.assumptions = splitSource.assumptions; } - public boolean needsFrame() { + public boolean needsFrame(ProcessorContext context) { for (SpecializationData specialization : specializations) { if (!specialization.isReachable()) { continue; } - if (specialization.findParameter("frameValue") != null) { + if (specialization.hasFrame(context)) { return true; } }