changeset 23039:af898ba7cfda

Temporarily disable GraphPE for SWITCH bytecode interpreter partial evaluation test.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 20 Nov 2015 01:58:05 +0100
parents 71bb0eb7b094
children 78e6ba51f14b
files graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java
diffstat 2 files changed, 24 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java	Fri Nov 20 00:44:28 2015 +0100
+++ b/graal/com.oracle.graal.truffle.test/src/com/oracle/graal/truffle/test/BytecodeInterpreterPartialEvaluationTest.java	Fri Nov 20 01:58:05 2015 +0100
@@ -24,12 +24,16 @@
 
 import java.util.Random;
 
+import jdk.vm.ci.options.OptionValue;
+import jdk.vm.ci.options.OptionValue.OverrideScope;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import com.oracle.graal.truffle.PartialEvaluator;
 import com.oracle.truffle.api.CompilerAsserts;
 import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
@@ -159,37 +163,24 @@
 
                     case Bytecode.SWITCH:
                         trace("%d (%d): SWITCH", bci, topOfStack);
-                        {
-                            int switchValue = getInt(frame, topOfStack--);
-                            byte switchTargetCount = bytecodes[bci + 1];
-                            int i = 0;
-                            while (true) {
-                                CompilerAsserts.partialEvaluationConstant(i);
-                                if (switchValue == i) {
-                                    CompilerAsserts.partialEvaluationConstant(i);
-                                    CompilerAsserts.partialEvaluationConstant(bci);
-                                    bci = bytecodes[bci + i + 2];
-                                    // Need this seemingly useless condition here for two reasons:
-                                    // 1. Bytecode analysis will consider the current block as
-                                    // being within the inner loop.
-                                    // 2. The if body will be an empty block that directly
-                                    // jumps to the begin of the outer loop.
-                                    if (i != -1) {
-                                        continue outer;
-                                    }
-                                }
-
-                                CompilerAsserts.partialEvaluationConstant(switchTargetCount);
-                                CompilerAsserts.partialEvaluationConstant(i);
-                                i = i + 1;
-                                if (i == switchTargetCount) {
-                                    break;
+                        int switchValue = getInt(frame, topOfStack--);
+                        value = bytecodes[bci + 1];
+                        for (int i = 0; i < value; ++i) {
+                            if (switchValue == i) {
+                                bci = bytecodes[bci + i + 2];
+                                // Need this seemingly useless condition here for two reasons:
+                                // 1. Bytecode analysis will consider the current block as
+                                // being within the inner loop.
+                                // 2. The if body will be an empty block that directly
+                                // jumps to the begin of the outer loop.
+                                if (i != -1) {
+                                    continue outer;
                                 }
                             }
-                            // Continue with the code after the switch.
-                            bci += switchTargetCount + 1;
-                            continue;
                         }
+                        // Continue with the code after the switch.
+                        bci += value + 1;
+                        continue;
 
                     case Bytecode.POP:
                         trace("%d (%d): POP", bci, topOfStack);
@@ -609,6 +600,8 @@
         /* 13: */42,
         /* 14: */Bytecode.RETURN};
         Program program = new Program("simpleSwitchProgram", bytecodes, 0, 3);
-        assertPartialEvalEqualsAndRunsCorrect(program);
+        try (OverrideScope s = OptionValue.override(PartialEvaluator.GraphPE, false)) {
+            assertPartialEvalEqualsAndRunsCorrect(program);
+        }
     }
 }
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Fri Nov 20 00:44:28 2015 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java	Fri Nov 20 01:58:05 2015 +0100
@@ -42,7 +42,7 @@
 import jdk.vm.ci.meta.ResolvedJavaType;
 import jdk.vm.ci.options.Option;
 import jdk.vm.ci.options.OptionType;
-import jdk.vm.ci.options.StableOptionValue;
+import jdk.vm.ci.options.OptionValue;
 import jdk.vm.ci.service.Services;
 
 import com.oracle.graal.api.replacements.SnippetReflectionProvider;
@@ -102,7 +102,7 @@
 public class PartialEvaluator {
 
     @Option(help = "New partial evaluation on Graal graphs", type = OptionType.Expert)//
-    public static final StableOptionValue<Boolean> GraphPE = new StableOptionValue<>(true);
+    public static final OptionValue<Boolean> GraphPE = new OptionValue<>(true);
 
     protected final Providers providers;
     protected final Architecture architecture;