changeset 9994:f90fc8987779

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Tue, 11 Jun 2013 13:12:57 +0200
parents 053b837d0d7d (current diff) 81f8a7461d63 (diff)
children 3754bb5aab2f
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java src/share/vm/graal/graalCompilerToVM.cpp
diffstat 47 files changed, 708 insertions(+), 488 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaMethod.java	Tue Jun 11 13:12:57 2013 +0200
@@ -132,6 +132,18 @@
     }
 
     @Test
+    public void isSyntheticTest() {
+        for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
+        }
+        for (Map.Entry<Constructor, ResolvedJavaMethod> e : constructors.entrySet()) {
+            ResolvedJavaMethod m = e.getValue();
+            assertEquals(e.getKey().isSynthetic(), m.isSynthetic());
+        }
+    }
+
+    @Test
     public void canBeStaticallyBoundTest() {
         for (Map.Entry<Method, ResolvedJavaMethod> e : methods.entrySet()) {
             ResolvedJavaMethod m = e.getValue();
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java	Tue Jun 11 13:12:57 2013 +0200
@@ -45,6 +45,11 @@
     boolean isInternal();
 
     /**
+     * Determines if this field is a synthetic field as defined by the Java Language Specification.
+     */
+    boolean isSynthetic();
+
+    /**
      * Gets the constant value of this field for a given object, if available.
      * 
      * @param receiver object from which this field's value is to be read. This value is ignored if
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Tue Jun 11 13:12:57 2013 +0200
@@ -80,6 +80,12 @@
     int getModifiers();
 
     /**
+     * Determines if this method is a synthetic method as defined by the Java Language
+     * Specification.
+     */
+    boolean isSynthetic();
+
+    /**
      * Checks whether this method is a class initializer.
      * 
      * @return {@code true} if the method is a class initializer
--- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/PTXTestBase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -39,6 +39,7 @@
 import com.oracle.graal.phases.OptimisticOptimizations;
 import com.oracle.graal.phases.PhasePlan;
 import com.oracle.graal.phases.PhasePlan.PhasePosition;
+import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.ptx.PTX;
 
 public abstract class PTXTestBase extends GraalCompilerTest {
@@ -57,8 +58,14 @@
         phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase());
         new PTXPhase().apply(graph);
         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
+        /*
+         * Use Suites.createDefaultSuites() instead of GraalCompilerTest.suites. The
+         * GraalCompilerTest.suites variable contains the Suites for the HotSpotRuntime. This code
+         * will not run on hotspot, so it should use the plain Graal default suites, without hotspot
+         * specific phases.
+         */
         CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), ptxBackend, target, null, phasePlan, OptimisticOptimizations.NONE,
-                        new SpeculationLog());
+                        new SpeculationLog(), Suites.createDefaultSuites());
         return result;
     }
 
--- a/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.sparc.test/src/com/oracle/graal/compiler/sparc/test/SPARCTestBase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -55,9 +55,8 @@
         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.NONE);
         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
-        CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(),
-                                                              sparcBackend, target, null, phasePlan, OptimisticOptimizations.NONE,
-                                                              new SpeculationLog());
+        CompilationResult result = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, graalRuntime().getReplacements(), sparcBackend, target, null, phasePlan,
+                        OptimisticOptimizations.NONE, new SpeculationLog(), suites);
         return result;
     }
 
@@ -66,4 +65,3 @@
     }
 
 }
-
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -48,9 +48,9 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.PhasePlan.PhasePosition;
 import com.oracle.graal.phases.schedule.*;
+import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.test.*;
-import com.oracle.graal.hotspot.phases.WriteBarrierAdditionPhase;
 
 /**
  * Base class for Graal compiler unit tests.
@@ -76,11 +76,13 @@
     protected final GraalCodeCacheProvider runtime;
     protected final Replacements replacements;
     protected final Backend backend;
+    protected final Suites suites;
 
     public GraalCompilerTest() {
         this.replacements = Graal.getRequiredCapability(Replacements.class);
         this.runtime = Graal.getRequiredCapability(GraalCodeCacheProvider.class);
         this.backend = Graal.getRequiredCapability(Backend.class);
+        this.suites = Graal.getRequiredCapability(SuitesProvider.class).createSuites();
     }
 
     @BeforeClass
@@ -430,11 +432,10 @@
                 final StructuredGraph graphCopy = graph.copy();
                 GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL);
                 phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
-                phasePlan.addPhase(PhasePosition.LOW_LEVEL, new WriteBarrierAdditionPhase());
                 editPhasePlan(method, graph, phasePlan);
                 CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
                 final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL,
-                                new SpeculationLog());
+                                new SpeculationLog(), suites);
                 if (printCompilation) {
                     TTY.println(String.format("@%-6d Graal %-70s %-45s %-50s | %4dms %5dB", id, "", "", "", System.currentTimeMillis() - start, compResult.getTargetCodeSize()));
                 }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/InfopointReasonTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -60,7 +60,7 @@
         final StructuredGraph graph = parse(method);
         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
         final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(),
-                        OptimisticOptimizations.ALL, new SpeculationLog());
+                        OptimisticOptimizations.ALL, new SpeculationLog(), suites);
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
             if (sp instanceof Call) {
@@ -82,7 +82,7 @@
         assertTrue(graphLineSPs > 0);
         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
         final CompilationResult cr = GraalCompiler.compileGraph(graph, cc, graph.method(), runtime, replacements, backend, runtime.getTarget(), null, getDefaultPhasePlan(true),
-                        OptimisticOptimizations.ALL, new SpeculationLog());
+                        OptimisticOptimizations.ALL, new SpeculationLog(), suites);
         int lineSPs = 0;
         for (Infopoint sp : cr.getInfopoints()) {
             assertNotNull(sp.reason);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/backend/AllocatorTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -119,7 +119,7 @@
 
             @Override
             public LIR call() {
-                return GraalCompiler.emitHIR(runtime, backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog());
+                return GraalCompiler.emitHIR(runtime, backend.target, graph, replacements, assumptions, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog(), suites);
             }
         });
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -89,6 +89,6 @@
     private void processMethod(final String snippet) {
         graph = parse(snippet);
         HighTierContext context = new HighTierContext(runtime(), new Assumptions(false), replacements);
-        new IterativeInliningPhase(replacements, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new CanonicalizerPhase(true)).apply(graph, context);
+        new IterativeInliningPhase(null, getDefaultPhasePlan(), OptimisticOptimizations.ALL, new CanonicalizerPhase(true)).apply(graph, context);
     }
 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Tue Jun 11 13:12:57 2013 +0200
@@ -75,7 +75,7 @@
      */
     public static CompilationResult compileGraph(final StructuredGraph graph, final CallingConvention cc, final ResolvedJavaMethod installedCodeOwner, final GraalCodeCacheProvider runtime,
                     final Replacements replacements, final Backend backend, final TargetDescription target, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts,
-                    final SpeculationLog speculationLog) {
+                    final SpeculationLog speculationLog, final Suites suites) {
         final CompilationResult compilationResult = new CompilationResult();
         Debug.scope("GraalCompiler", new Object[]{graph, runtime}, new Runnable() {
 
@@ -84,7 +84,7 @@
                 final LIR lir = Debug.scope("FrontEnd", new Callable<LIR>() {
 
                     public LIR call() {
-                        return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog);
+                        return emitHIR(runtime, target, graph, replacements, assumptions, cache, plan, optimisticOpts, speculationLog, suites);
                     }
                 });
                 final LIRGenerator lirGen = Debug.scope("BackEnd", lir, new Callable<LIRGenerator>() {
@@ -124,7 +124,7 @@
      * @param target
      */
     public static LIR emitHIR(GraalCodeCacheProvider runtime, TargetDescription target, final StructuredGraph graph, Replacements replacements, Assumptions assumptions, GraphCache cache,
-                    PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog) {
+                    PhasePlan plan, OptimisticOptimizations optimisticOpts, final SpeculationLog speculationLog, final Suites suites) {
 
         if (speculationLog != null) {
             speculationLog.snapshot();
@@ -150,7 +150,7 @@
 
         if (Inline.getValue() && !plan.isPhaseDisabled(InliningPhase.class)) {
             if (IterativeInlining.getValue()) {
-                new IterativeInliningPhase(replacements, cache, plan, optimisticOpts, canonicalizer).apply(graph, highTierContext);
+                new IterativeInliningPhase(cache, plan, optimisticOpts, canonicalizer).apply(graph, highTierContext);
             } else {
                 new InliningPhase(runtime, null, replacements, assumptions, cache, plan, optimisticOpts).apply(graph);
                 new DeadCodeEliminationPhase().apply(graph);
@@ -164,15 +164,13 @@
         TypeProfileProxyNode.cleanFromGraph(graph);
 
         plan.runPhases(PhasePosition.HIGH_LEVEL, graph);
-        Suites.DEFAULT.getHighTier().apply(graph, highTierContext);
+        suites.getHighTier().apply(graph, highTierContext);
 
         MidTierContext midTierContext = new MidTierContext(runtime, assumptions, replacements, target, optimisticOpts);
-        Suites.DEFAULT.getMidTier().apply(graph, midTierContext);
-
-        plan.runPhases(PhasePosition.LOW_LEVEL, graph);
+        suites.getMidTier().apply(graph, midTierContext);
 
         LowTierContext lowTierContext = new LowTierContext(runtime, assumptions, replacements, target);
-        Suites.DEFAULT.getLowTier().apply(graph, lowTierContext);
+        suites.getLowTier().apply(graph, lowTierContext);
 
         // we do not want to store statistics about OSR compilations because it may prevent inlining
         boolean isOSRCompilation = graph.start() instanceof OSRStartNode;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Jun 11 13:12:57 2013 +0200
@@ -46,7 +46,6 @@
 import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.nodes.cfg.*;
-import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.util.*;
 
 /**
@@ -1578,7 +1577,7 @@
                     // check for duplicate edges between the same blocks (can happen with switch
                     // blocks)
                     if (!alreadyResolved.get(toBlock.getLinearScanNumber())) {
-                        if (GraalOptions.TraceLinearScanLevel.getValue() >= 3) {
+                        if (TraceLinearScanLevel.getValue() >= 3) {
                             TTY.println(" processing edge between B%d and B%d", fromBlock.getId(), toBlock.getId());
                         }
                         alreadyResolved.set(toBlock.getLinearScanNumber());
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Tue Jun 11 13:12:57 2013 +0200
@@ -48,10 +48,10 @@
 import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp;
 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapCompressedOp;
 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp;
-import com.oracle.graal.lir.amd64.AMD64Move.LoadCompressedOop;
+import com.oracle.graal.lir.amd64.AMD64Move.LoadCompressedPointer;
 import com.oracle.graal.lir.amd64.AMD64Move.LoadOp;
 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp;
-import com.oracle.graal.lir.amd64.AMD64Move.StoreCompressedOop;
+import com.oracle.graal.lir.amd64.AMD64Move.StoreCompressedPointer;
 import com.oracle.graal.lir.amd64.AMD64Move.StoreConstantOp;
 import com.oracle.graal.lir.amd64.AMD64Move.StoreOp;
 import com.oracle.graal.nodes.*;
@@ -410,9 +410,8 @@
         Variable result = newVariable(kind);
         assert access == null || access instanceof HeapAccess;
         if (runtime().config.useCompressedOops && isCompressCandidate(access)) {
-            assert kind == Kind.Object;
             Variable scratch = newVariable(Kind.Long);
-            append(new LoadCompressedOop(kind, result, scratch, loadAddress, access != null ? state(access) : null, runtime().config.narrowOopBase, runtime().config.narrowOopShift,
+            append(new LoadCompressedPointer(kind, result, scratch, loadAddress, access != null ? state(access) : null, runtime().config.narrowOopBase, runtime().config.narrowOopShift,
                             runtime().config.logMinObjAlignment));
         } else {
             append(new LoadOp(kind, result, loadAddress, access != null ? state(access) : null));
@@ -433,9 +432,8 @@
         }
         Variable input = load(inputVal);
         if (runtime().config.useCompressedOops && isCompressCandidate(access)) {
-            assert kind == Kind.Object;
             Variable scratch = newVariable(Kind.Long);
-            append(new StoreCompressedOop(kind, storeAddress, input, scratch, state, runtime().config.narrowOopBase, runtime().config.narrowOopShift, runtime().config.logMinObjAlignment));
+            append(new StoreCompressedPointer(kind, storeAddress, input, scratch, state, runtime().config.narrowOopBase, runtime().config.narrowOopShift, runtime().config.logMinObjAlignment));
         } else {
             append(new StoreOp(kind, storeAddress, input, state));
         }
@@ -463,7 +461,6 @@
         RegisterValue raxRes = AMD64.rax.asValue(kind);
         emitMove(raxRes, expected);
         if (runtime().config.useCompressedOops && node.compress()) {
-            assert kind == Kind.Object;
             Variable scratch = newVariable(Kind.Long);
             append(new CompareAndSwapCompressedOp(raxRes, address, raxRes, newValue, scratch, runtime().config.narrowOopBase, runtime().config.narrowOopShift, runtime().config.logMinObjAlignment));
         } else {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -23,6 +23,7 @@
 package com.oracle.graal.hotspot.test;
 
 import static com.oracle.graal.api.code.CodeUtil.*;
+import static com.oracle.graal.phases.GraalOptions.*;
 
 import org.junit.*;
 
@@ -31,7 +32,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.*;
 import com.oracle.graal.compiler.test.*;
-import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.extended.*;
@@ -74,20 +74,19 @@
         StructuredGraph graph = parse(test);
         ResolvedJavaMethod method = graph.method();
 
-        boolean originalSetting = GraalOptions.OptCanonicalizeReads.getValue();
-        GraalOptions.OptCanonicalizeReads.setValue(!compileAOT);
+        boolean originalSetting = OptCanonicalizeReads.getValue();
+        OptCanonicalizeReads.setValue(!compileAOT);
         PhasePlan phasePlan = new PhasePlan();
         final StructuredGraph graphCopy = graph.copy();
         GraphBuilderPhase graphBuilderPhase = new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getDefault(), OptimisticOptimizations.ALL);
         phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
-        phasePlan.addPhase(PhasePosition.LOW_LEVEL, new WriteBarrierAdditionPhase());
         editPhasePlan(method, graph, phasePlan);
         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
         final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, backend, runtime().getTarget(), null, phasePlan, OptimisticOptimizations.ALL,
-                        new SpeculationLog());
+                        new SpeculationLog(), suites);
         addMethod(method, compResult, graphCopy);
 
-        GraalOptions.OptCanonicalizeReads.setValue(originalSetting);
+        OptCanonicalizeReads.setValue(originalSetting);
 
         return graph;
     }
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompileTheWorldTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -22,11 +22,12 @@
  */
 package com.oracle.graal.hotspot.test;
 
+import static com.oracle.graal.phases.GraalOptions.*;
+
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.hotspot.*;
-import com.oracle.graal.phases.*;
 
 /**
  * Tests {@link CompileTheWorld} functionality.
@@ -35,11 +36,11 @@
 
     @Test
     public void testRtJar() throws Throwable {
-        boolean originalSetting = GraalOptions.ExitVMOnException.getValue();
+        boolean originalSetting = ExitVMOnException.getValue();
         // Compile a couple classes in rt.jar
         String file = System.getProperty("java.home") + "/lib/rt.jar";
         new CompileTheWorld(file, 1, 5).compile();
-        GraalOptions.ExitVMOnException.setValue(originalSetting);
+        ExitVMOnException.setValue(originalSetting);
     }
 
 }
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/CompressedOopTest.java	Tue Jun 11 13:12:57 2013 +0200
@@ -29,7 +29,6 @@
 
 import org.junit.*;
 
-import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.api.runtime.*;
 import com.oracle.graal.compiler.test.*;
@@ -39,141 +38,172 @@
  * The following tests perform object/array equality and assignments in various ways. The selected
  * cases have been the problematic ones while implementing the Compressed Oops support.
  */
-
 public class CompressedOopTest extends GraalCompilerTest {
 
     private final MetaAccessProvider metaAccessProvider;
-    Object[] argsToBind;
 
     public CompressedOopTest() {
         this.metaAccessProvider = Graal.getRequiredCapability(MetaAccessProvider.class);
     }
 
+    private HotSpotInstalledCode getInstalledCode(String name) throws Exception {
+        final Method method = CompressedOopTest.class.getMethod(name, Object.class, Object.class, Object.class);
+        final HotSpotResolvedJavaMethod javaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(method);
+        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(javaMethod, parse(method));
+        return installedBenchmarkCode;
+    }
+
     @Test
-    public void test() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("fieldTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        final Method benchmarkMethod = CompressedOopTest.class.getMethod("benchmark", HotSpotInstalledCode.class, Object.class, Object.class, Object.class);
-        final ResolvedJavaMethod benchmarkJavaMethod = metaAccessProvider.lookupJavaMethod(benchmarkMethod);
-        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(benchmarkJavaMethod, parse(benchmarkMethod));
+    public void test() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("fieldTest");
         Container c1 = new Container();
-        Assert.assertEquals(c1.b, installedBenchmarkCode.executeVarargs(argsToBind[0], c1, c1, c1));
+        Assert.assertEquals(c1.b, installedBenchmarkCode.executeVarargs(c1, c1, c1));
+    }
+
+    public static Object fieldTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
+        ((Container) c1).a = ((Container) c1).b;
+        return ((Container) c1).a;
     }
 
     @Test
-    public void test1() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("arrayTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        final Method benchmarkMethod = CompressedOopTest.class.getMethod("benchmark", HotSpotInstalledCode.class, Object.class, Object.class, Object.class);
-        final ResolvedJavaMethod benchmarkJavaMethod = metaAccessProvider.lookupJavaMethod(benchmarkMethod);
-        final HotSpotInstalledCode installedBenchmarkCode = (HotSpotInstalledCode) getCode(benchmarkJavaMethod, parse(benchmarkMethod));
+    public void test1() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("arrayTest");
         ArrayContainer ac = new ArrayContainer();
-        Assert.assertEquals(ac.a[9], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 0, 9));
-        Assert.assertEquals(ac.a[8], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 1, 8));
-        Assert.assertEquals(ac.a[7], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 2, 7));
-        Assert.assertEquals(ac.a[6], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 3, 6));
-        Assert.assertEquals(ac.a[5], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 4, 5));
-        Assert.assertEquals(ac.a[4], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 5, 4));
-        Assert.assertEquals(ac.a[3], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 6, 3));
-        Assert.assertEquals(ac.a[2], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 7, 2));
-        Assert.assertEquals(ac.a[1], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 8, 1));
-        Assert.assertEquals(ac.a[0], installedBenchmarkCode.executeVarargs(argsToBind[0], ac.a, 9, 0));
+        Assert.assertEquals(ac.a[9], installedBenchmarkCode.executeVarargs(ac.a, 0, 9));
+        Assert.assertEquals(ac.a[8], installedBenchmarkCode.executeVarargs(ac.a, 1, 8));
+        Assert.assertEquals(ac.a[7], installedBenchmarkCode.executeVarargs(ac.a, 2, 7));
+        Assert.assertEquals(ac.a[6], installedBenchmarkCode.executeVarargs(ac.a, 3, 6));
+        Assert.assertEquals(ac.a[5], installedBenchmarkCode.executeVarargs(ac.a, 4, 5));
+        Assert.assertEquals(ac.a[4], installedBenchmarkCode.executeVarargs(ac.a, 5, 4));
+        Assert.assertEquals(ac.a[3], installedBenchmarkCode.executeVarargs(ac.a, 6, 3));
+        Assert.assertEquals(ac.a[2], installedBenchmarkCode.executeVarargs(ac.a, 7, 2));
+        Assert.assertEquals(ac.a[1], installedBenchmarkCode.executeVarargs(ac.a, 8, 1));
+        Assert.assertEquals(ac.a[0], installedBenchmarkCode.executeVarargs(ac.a, 9, 0));
+    }
+
+    public static Object arrayTest(Object c1, Object c2, Object c3) {
+        Object[] array = (Object[]) c1;
+        int initialIndex = ((Integer) c2).intValue();
+        int replacingIndex = ((Integer) c3).intValue();
+        array[initialIndex] = array[replacingIndex];
+        return array[initialIndex];
     }
 
     @Test
-    public void test2() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("arrayCopyTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test2() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("arrayCopyTest");
         ArrayContainer source = new ArrayContainer();
         ArrayContainer destination = new ArrayContainer();
         Assert.assertEquals(source.a.length, destination.a.length);
         Assert.assertFalse(Arrays.equals(source.a, destination.a));
-        fooCode.execute(source.a, destination.a, source.a);
+        installedBenchmarkCode.execute(source.a, destination.a, source.a);
         Assert.assertArrayEquals(source.a, destination.a);
     }
 
+    public static void arrayCopyTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
+        Object[] source = (Object[]) c1;
+        Object[] destination = (Object[]) c2;
+        System.arraycopy(source, 0, destination, 0, source.length);
+    }
+
     @Test
-    public void test3() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("compareAndSwapTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test3() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("compareAndSwapTest");
         Object initial = new Object();
         Object replacement = new Object();
         AtomicReference<Object> cas = new AtomicReference<>();
         Assert.assertEquals(cas.get(), null);
-        fooCode.execute(cas, null, initial);
+        installedBenchmarkCode.execute(cas, null, initial);
         Assert.assertEquals(cas.get(), initial);
-        fooCode.execute(cas, initial, replacement);
+        installedBenchmarkCode.execute(cas, initial, replacement);
         Assert.assertEquals(cas.get(), replacement);
     }
 
+    @SuppressWarnings("unchecked")
+    public static void compareAndSwapTest(Object c1, Object c2, Object c3) throws ClassCastException {
+        AtomicReference<Object> cas = (AtomicReference<Object>) c1;
+        cas.compareAndSet(c2, c3);
+    }
+
     @Test
-    public void test4() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("charArrayCopyTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test4() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("charArrayCopyTest");
         StringContainer1 source1 = new StringContainer1();
         StringContainer2 source2 = new StringContainer2();
         char[] result = new char[source1.value.length + source2.value.length];
-        fooCode.execute(source1.value, source2.value, result);
+        installedBenchmarkCode.execute(source1.value, source2.value, result);
         Assert.assertArrayEquals(new char[]{'T', 'e', 's', 't', ' ', 'S', 't', 'r', 'i', 'n', 'g'}, result);
     }
 
+    public static char[] charArrayCopyTest(Object c1, Object c2, Object c3) {
+        char[] source1 = (char[]) c1;
+        char[] source2 = (char[]) c2;
+        char[] result = (char[]) c3;
+        for (int i = 0; i < source1.length; i++) {
+            result[i] = source1[i];
+        }
+
+        for (int i = 0; i < source2.length; i++) {
+            result[source1.length + i] = source2[i];
+        }
+        return result;
+    }
+
     @Test
-    public void test5() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("charContainerArrayCopyTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test5() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("charContainerArrayCopyTest");
         StringContainer1 source1 = new StringContainer1();
         StringContainer2 source2 = new StringContainer2();
         char[] result = new char[source1.value.length + source2.value.length];
-        fooCode.execute(source1, source2, result);
+        installedBenchmarkCode.execute(source1, source2, result);
         Assert.assertArrayEquals(new char[]{'T', 'e', 's', 't', ' ', 'S', 't', 'r', 'i', 'n', 'g'}, result);
     }
 
+    public static char[] charContainerArrayCopyTest(Object c1, Object c2, Object c3) {
+        char[] source1 = ((StringContainer1) c1).value;
+        char[] source2 = ((StringContainer2) c2).value;
+        char[] result = (char[]) c3;
+        for (int i = 0; i < source1.length; i++) {
+            result[i] = source1[i];
+        }
+        for (int i = 0; i < source2.length; i++) {
+            result[source1.length + i] = source2[i];
+        }
+        return result;
+    }
+
     @Test
-    public void test6() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("stringCopyTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test6() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringCopyTest");
         String a = new String("Test ");
         String b = new String("String");
-        String c = (String) fooCode.execute(a, b, null);
+        String c = (String) installedBenchmarkCode.execute(a, b, null);
         Assert.assertTrue(c.equals("Test String"));
     }
 
+    public static String stringCopyTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
+        String source = (String) c1;
+        String destination = (String) c2;
+        return source + destination;
+    }
+
     @Test
-    public void test7() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("queueTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test7() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("queueTest");
         ArrayDeque<Object> q = new ArrayDeque<>();
         Object[] objects = new Object[512];
         for (int i = 0; i < objects.length; i++) {
             objects[i] = new Object();
         }
-
         int j = 0;
         while (j < objects.length) {
-            fooCode.execute(q, objects[j], null);
+            installedBenchmarkCode.execute(q, objects[j], null);
             j++;
         }
 
         System.gc();
         Assert.assertTrue(q.size() == objects.length);
         Assert.assertTrue(!q.isEmpty());
-
         j = 0;
         while (j < objects.length) {
             Assert.assertTrue(objects[j] == q.remove());
@@ -184,18 +214,20 @@
         Assert.assertTrue(q.isEmpty());
     }
 
+    @SuppressWarnings("unchecked")
+    public static void queueTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
+        ArrayDeque<Object> queue = (ArrayDeque<Object>) c1;
+        queue.add(c2);
+    }
+
     @Test
-    public void test8() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("unmodListTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
+    public void test8() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("unmodListTest");
         List<Object> list = new ArrayList<>();
         for (int i = 0; i < 512; i++) {
             list.add(new Object());
         }
-
-        Object[] array = (Object[]) fooCode.execute(list, null, null);
+        Object[] array = (Object[]) installedBenchmarkCode.execute(list, null, null);
         Assert.assertTrue(list.size() == array.length);
         int i = 0;
         for (Object obj : list) {
@@ -204,134 +236,6 @@
         }
     }
 
-    @Test
-    public void test9() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("unmodListTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        List<Object> list = new ArrayList<>();
-        Object[] array = (Object[]) fooCode.execute(list, null, null);
-        Assert.assertTrue(list.size() == array.length);
-    }
-
-    public void test10() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("constantTest", Object.class, Object.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        Container c = new Container();
-        Assert.assertFalse((boolean) fooCode.execute(c, null, null));
-    }
-
-    @Test
-    public void test11() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("stringEqualsTest", String.class, String.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        String s1 = new String("Test");
-        String s2 = new String("Test");
-        boolean result = ((Boolean) (fooCode.execute(s1, s2, null))).booleanValue();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void test12() throws NoSuchMethodException, SecurityException, InvalidInstalledCodeException {
-        final Method fooMethod = CompressedOopTest.class.getMethod("stringConstantEqualsTest", String.class, String.class, Object.class);
-        final HotSpotResolvedJavaMethod fooJavaMethod = (HotSpotResolvedJavaMethod) metaAccessProvider.lookupJavaMethod(fooMethod);
-        final HotSpotInstalledCode fooCode = (HotSpotInstalledCode) getCode(fooJavaMethod, parse(fooMethod));
-        argsToBind = new Object[]{fooCode};
-        String s1 = new String("Test");
-        boolean result = ((Boolean) (fooCode.execute(s1, null, null))).booleanValue();
-        Assert.assertTrue(result);
-    }
-
-    public static Object benchmark(HotSpotInstalledCode code, Object o1, Object o2, Object o3) throws InvalidInstalledCodeException {
-        return code.execute(o1, o2, o3);
-    }
-
-    public static Object fieldTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
-        ((Container) c1).a = ((Container) c1).b;
-        return ((Container) c1).a;
-    }
-
-    public static Object arrayTest(Object c1, Object c2, Object c3) {
-        Object[] array = (Object[]) c1;
-        int initialIndex = ((Integer) c2).intValue();
-        int replacingIndex = ((Integer) c3).intValue();
-        array[initialIndex] = array[replacingIndex];
-        return array[initialIndex];
-    }
-
-    public static void arrayCopyTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
-        Object[] source = (Object[]) c1;
-        Object[] destination = (Object[]) c2;
-        System.arraycopy(source, 0, destination, 0, source.length);
-    }
-
-    public static String stringCopyTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
-        String source = (String) c1;
-        String destination = (String) c2;
-        return source + destination;
-    }
-
-    public static char[] charArrayCopyTest(Object c1, Object c2, Object c3) {
-        char[] source1 = (char[]) c1;
-        char[] source2 = (char[]) c2;
-        char[] result = (char[]) c3;
-
-        for (int i = 0; i < source1.length; i++) {
-            result[i] = source1[i];
-        }
-
-        for (int i = 0; i < source2.length; i++) {
-            result[source1.length + i] = source2[i];
-        }
-        return result;
-    }
-
-    public static char[] charContainerArrayCopyTest(Object c1, Object c2, Object c3) {
-        char[] source1 = ((StringContainer1) c1).value;
-        char[] source2 = ((StringContainer2) c2).value;
-        char[] result = (char[]) c3;
-
-        for (int i = 0; i < source1.length; i++) {
-            result[i] = source1[i];
-        }
-
-        for (int i = 0; i < source2.length; i++) {
-            result[source1.length + i] = source2[i];
-        }
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    public static void compareAndSwapTest(Object c1, Object c2, Object c3) throws ClassCastException {
-        AtomicReference<Object> cas = (AtomicReference<Object>) c1;
-        cas.compareAndSet(c2, c3);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static HashMap<Object, Object> hashMapCloneTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
-        HashMap<Object, Object> map = (HashMap<Object, Object>) c1;
-        return (HashMap<Object, Object>) map.clone();
-    }
-
-    @SuppressWarnings("unchecked")
-    public static void hashMapCopyTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
-        HashMap<Object, Object> map = (HashMap<Object, Object>) c1;
-        HashMap<Object, Object> map1 = (HashMap<Object, Object>) c2;
-        map.clear();
-        map.putAll(map1);
-    }
-
-    @SuppressWarnings("unchecked")
-    public static void queueTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
-        ArrayDeque<Object> queue = (ArrayDeque<Object>) c1;
-        queue.add(c2);
-    }
-
     @SuppressWarnings("unchecked")
     public static Object[] unmodListTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
         List<Object> queue = (ArrayList<Object>) c1;
@@ -339,83 +243,114 @@
         return result;
     }
 
+    @Test
+    public void test9() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("unmodListTest");
+        List<Object> list = new ArrayList<>();
+        Object[] array = (Object[]) installedBenchmarkCode.execute(list, null, null);
+        Assert.assertTrue(list.size() == array.length);
+    }
+
+    public void test10() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("constantTest");
+        Container c = new Container();
+        Assert.assertFalse((boolean) installedBenchmarkCode.execute(c, null, null));
+    }
+
     public static Boolean constantTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
         ConstantContainer container = (ConstantContainer) c1;
         return container.a.equals(container.b);
     }
 
-    public static Boolean stringEqualsTest(String c1, String c2, @SuppressWarnings("unused") Object c3) {
-        return c1.equals(c2);
+    @Test
+    public void test11() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringEqualsTest");
+        String s1 = new String("Test");
+        String s2 = new String("Test");
+        boolean result = ((Boolean) (installedBenchmarkCode.execute(s1, s2, null))).booleanValue();
+        Assert.assertTrue(result);
+    }
+
+    public static Boolean stringEqualsTest(Object c1, Object c2, @SuppressWarnings("unused") Object c3) {
+        return ((String) c1).equals(c2);
+    }
+
+    @Test
+    public void test12() throws Exception {
+        HotSpotInstalledCode installedBenchmarkCode = getInstalledCode("stringConstantEqualsTest");
+        String s1 = new String("Test");
+        boolean result = ((Boolean) (installedBenchmarkCode.execute(s1, null, null))).booleanValue();
+        Assert.assertTrue(result);
+    }
+
+    public static Boolean stringConstantEqualsTest(Object c1, @SuppressWarnings("unused") Object c2, @SuppressWarnings("unused") Object c3) {
+        return "Test".equals(c1);
+    }
+
+    static class Container {
+
+        public Object a = new Object();
+        public Object b = new Object();
+    }
+
+    static class ArrayContainer {
+
+        public Object[] a = new Object[10];
+
+        public ArrayContainer() {
+            for (int i = 0; i < 10; i++) {
+                a[i] = new Object();
+            }
+        }
     }
 
-    public static Boolean stringConstantEqualsTest(String c1, @SuppressWarnings("unused") String c2, @SuppressWarnings("unused") Object c3) {
-        return "Test".equals(c1);
+    static class HashMapContainer {
+
+        public HashMap<Object, Object> a = new HashMap<>();
+
+        public HashMapContainer() {
+            for (int i = 0; i < 10; i++) {
+                a.put(new Object(), new Object());
+            }
+        }
+    }
+
+    static class StringContainer1 {
+
+        public char[] value = new char[5];
+
+        public StringContainer1() {
+            value[0] = 'T';
+            value[1] = 'e';
+            value[2] = 's';
+            value[3] = 't';
+            value[4] = ' ';
+
+        }
+    }
+
+    static class StringContainer2 {
+
+        public char[] value = new char[6];
+
+        public StringContainer2() {
+            value[0] = 'S';
+            value[1] = 't';
+            value[2] = 'r';
+            value[3] = 'i';
+            value[4] = 'n';
+            value[5] = 'g';
+        }
+    }
+
+    static class ConstantContainer {
+
+        public final Object a = new Object();
+        public final Object b = new Object();
+
+        public ConstantContainer() {
+
+        }
     }
 
 }
-
-class Container {
-
-    public Object a = new Object();
-    public Object b = new Object();
-}
-
-class ArrayContainer {
-
-    public Object[] a = new Object[10];
-
-    public ArrayContainer() {
-        for (int i = 0; i < 10; i++) {
-            a[i] = new Object();
-        }
-    }
-}
-
-class HashMapContainer {
-
-    public HashMap<Object, Object> a = new HashMap<>();
-
-    public HashMapContainer() {
-        for (int i = 0; i < 10; i++) {
-            a.put(new Object(), new Object());
-        }
-    }
-}
-
-class StringContainer1 {
-
-    public char[] value = new char[5];
-
-    public StringContainer1() {
-        value[0] = 'T';
-        value[1] = 'e';
-        value[2] = 's';
-        value[3] = 't';
-        value[4] = ' ';
-
-    }
-}
-
-class StringContainer2 {
-
-    public char[] value = new char[6];
-
-    public StringContainer2() {
-        value[0] = 'S';
-        value[1] = 't';
-        value[2] = 'r';
-        value[3] = 'i';
-        value[4] = 'n';
-        value[5] = 'g';
-    }
-}
-
-class ConstantContainer {
-
-    public final Object a = new Object();
-    public final Object b = new Object();
-
-    public ConstantContainer() {
-
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Jun 11 13:12:57 2013 +0200
@@ -41,6 +41,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.graal.phases.tiers.*;
 
 public final class CompilationTask implements Runnable, Comparable<CompilationTask> {
 
@@ -57,6 +58,7 @@
 
     private final HotSpotGraalRuntime graalRuntime;
     private final PhasePlan plan;
+    private final SuitesProvider suitesProvider;
     private final OptimisticOptimizations optimisticOpts;
     private final HotSpotResolvedJavaMethod method;
     private final int entryBCI;
@@ -72,6 +74,7 @@
     private CompilationTask(HotSpotGraalRuntime graalRuntime, PhasePlan plan, OptimisticOptimizations optimisticOpts, HotSpotResolvedJavaMethod method, int entryBCI, int id, int priority) {
         this.graalRuntime = graalRuntime;
         this.plan = plan;
+        this.suitesProvider = graalRuntime.getCapability(SuitesProvider.class);
         this.method = method;
         this.optimisticOpts = optimisticOpts;
         this.entryBCI = entryBCI;
@@ -165,7 +168,7 @@
                         HotSpotRuntime runtime = graalRuntime.getRuntime();
                         CallingConvention cc = getCallingConvention(runtime, Type.JavaCallee, graph.method(), false);
                         return GraalCompiler.compileGraph(graph, cc, method, runtime, replacements, graalRuntime.getBackend(), graalRuntime.getTarget(), graalRuntime.getCache(), plan, optimisticOpts,
-                                        method.getSpeculationLog());
+                                        method.getSpeculationLog(), suitesProvider.getDefaultSuites());
                     }
                 });
             } finally {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Tue Jun 11 13:12:57 2013 +0200
@@ -38,6 +38,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.options.*;
 import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.tiers.*;
 
 //import static com.oracle.graal.phases.GraalOptions.*;
 
@@ -318,7 +319,7 @@
         if (clazz == GraalCodeCacheProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class) {
             return (T) getRuntime();
         }
-        if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class) {
+        if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class || clazz == SuitesProvider.class) {
             return (T) getRuntime();
         }
         if (clazz == HotSpotRuntime.class) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Tue Jun 11 13:12:57 2013 +0200
@@ -48,7 +48,7 @@
         ServiceLoader<Options> sl = ServiceLoader.loadInstalled(Options.class);
         for (Options opts : sl) {
             for (OptionDescriptor desc : opts) {
-                if (desc.getClass().getName().startsWith("com.oracle.graal")) {
+                if (isHotSpotOption(desc)) {
                     String name = desc.getName();
                     OptionDescriptor existing = options.put(name, desc);
                     assert existing == null : "Option named \"" + name + "\" has multiple definitions: " + existing.getLocation() + " and " + desc.getLocation();
@@ -58,6 +58,13 @@
     }
 
     /**
+     * Determines if a given option is a HotSpot command line option.
+     */
+    public static boolean isHotSpotOption(OptionDescriptor desc) {
+        return desc.getClass().getName().startsWith("com.oracle.graal");
+    }
+
+    /**
      * Loads default option value overrides from a {@code graal.options} file if it exists. Each
      * line in this file starts with {@code "#"} and is ignored or must have the format of a Graal
      * command line option without the leading {@code "-G:"} prefix. These option value are set
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Tue Jun 11 13:12:57 2013 +0200
@@ -168,6 +168,8 @@
 
     HotSpotResolvedJavaField[] getInstanceFields(HotSpotResolvedObjectType klass);
 
+    HotSpotResolvedJavaMethod[] getMethods(HotSpotResolvedObjectType klass);
+
     boolean hasFinalizableSubclass(HotSpotResolvedObjectType klass);
 
     /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Tue Jun 11 13:12:57 2013 +0200
@@ -124,6 +124,9 @@
     public native HotSpotResolvedJavaField[] getInstanceFields(HotSpotResolvedObjectType klass);
 
     @Override
+    public native HotSpotResolvedJavaMethod[] getMethods(HotSpotResolvedObjectType klass);
+
+    @Override
     public native int getCompiledCodeSize(long metaspaceMethod);
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Tue Jun 11 13:12:57 2013 +0200
@@ -183,6 +183,8 @@
             DebugEnvironment.initialize(log);
         }
 
+        assert VerifyHotSpotOptionsPhase.checkOptions();
+
         // Install intrinsics.
         final HotSpotRuntime runtime = graalRuntime.getCapability(HotSpotRuntime.class);
         final Replacements replacements = graalRuntime.getCapability(Replacements.class);
@@ -772,11 +774,6 @@
         if (onStackReplacement) {
             phasePlan.addPhase(PhasePosition.AFTER_PARSING, new OnStackReplacementPhase());
         }
-        phasePlan.addPhase(PhasePosition.LOW_LEVEL, new WriteBarrierAdditionPhase());
-        if (VerifyPhases.getValue()) {
-            phasePlan.addPhase(PhasePosition.LOW_LEVEL, new WriteBarrierVerificationPhase());
-
-        }
         return phasePlan;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java	Tue Jun 11 13:12:57 2013 +0200
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import static com.oracle.graal.phases.GraalOptions.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Tue Jun 11 13:12:57 2013 +0200
@@ -160,6 +160,15 @@
     }
 
     @Override
+    public boolean isSynthetic() {
+        Field javaField = toJava();
+        if (javaField != null) {
+            return javaField.isSynthetic();
+        }
+        return false;
+    }
+
+    @Override
     public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
         Field javaField = toJava();
         if (javaField != null) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Tue Jun 11 13:12:57 2013 +0200
@@ -332,6 +332,29 @@
     }
 
     @Override
+    public boolean isSynthetic() {
+        if (isConstructor()) {
+            Constructor<?> javaConstructor = toJavaConstructor();
+            return javaConstructor == null ? false : javaConstructor.isSynthetic();
+        }
+
+        // Cannot use toJava() as it ignores the return type
+        HotSpotSignature sig = getSignature();
+        JavaType[] sigTypes = MetaUtil.signatureToTypes(sig, null);
+        HotSpotRuntime runtime = graalRuntime().getRuntime();
+        for (Method method : holder.mirror().getDeclaredMethods()) {
+            if (method.getName().equals(name)) {
+                if (runtime.lookupJavaType(method.getReturnType()).equals(sig.getReturnType(holder))) {
+                    if (matches(runtime, sigTypes, method.getParameterTypes())) {
+                        return method.isSynthetic();
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    @Override
     public Type[] getGenericParameterTypes() {
         if (isConstructor()) {
             Constructor javaConstructor = toJavaConstructor();
@@ -351,6 +374,18 @@
         return result;
     }
 
+    private static boolean matches(HotSpotRuntime runtime, JavaType[] sigTypes, Class<?>[] parameterTypes) {
+        if (parameterTypes.length == sigTypes.length) {
+            for (int i = 0; i < parameterTypes.length; i++) {
+                if (!runtime.lookupJavaType(parameterTypes[i]).equals(sigTypes[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        return false;
+    }
+
     private Method toJava() {
         try {
             return holder.mirror().getDeclaredMethod(name, signatureToTypes());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Tue Jun 11 13:12:57 2013 +0200
@@ -541,6 +541,15 @@
         return result;
     }
 
+    /**
+     * Gets all methods and constructors declared by this class, including the {@code <clinit>}
+     * method if there is one. The latter is not made accessible via standard Java reflection.
+     */
+    public ResolvedJavaMethod[] getMethods() {
+        HotSpotResolvedJavaMethod[] methods = graalRuntime().getCompilerToVM().getMethods(this);
+        return methods;
+    }
+
     @Override
     public Constant newArray(int length) {
         return Constant.forObject(Array.newInstance(javaMirror, length));
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Jun 11 13:12:57 2013 +0200
@@ -73,6 +73,7 @@
 import com.oracle.graal.hotspot.bridge.*;
 import com.oracle.graal.hotspot.bridge.CompilerToVM.CodeInstallResult;
 import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.hotspot.replacements.*;
 import com.oracle.graal.hotspot.stubs.*;
 import com.oracle.graal.java.*;
@@ -86,6 +87,7 @@
 import com.oracle.graal.nodes.spi.Lowerable.LoweringType;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.printer.*;
 import com.oracle.graal.replacements.*;
 import com.oracle.graal.word.*;
@@ -93,7 +95,7 @@
 /**
  * HotSpot implementation of {@link GraalCodeCacheProvider}.
  */
-public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider {
+public abstract class HotSpotRuntime implements GraalCodeCacheProvider, DisassemblerProvider, BytecodeDisassemblerProvider, SuitesProvider {
 
     public static final ForeignCallDescriptor OSR_MIGRATION_END = new ForeignCallDescriptor("OSR_migration_end", void.class, long.class);
     public static final ForeignCallDescriptor IDENTITY_HASHCODE = new ForeignCallDescriptor("identity_hashcode", int.class, Object.class);
@@ -104,6 +106,7 @@
 
     protected final RegisterConfig regConfig;
     protected final HotSpotGraalRuntime graalRuntime;
+    private final Suites defaultSuites;
 
     private CheckCastSnippets.Templates checkcastSnippets;
     private InstanceOfSnippets.Templates instanceofSnippets;
@@ -179,6 +182,7 @@
         this.config = c;
         this.graalRuntime = graalRuntime;
         regConfig = createRegisterConfig();
+        defaultSuites = createSuites();
     }
 
     protected abstract RegisterConfig createRegisterConfig();
@@ -529,8 +533,7 @@
             HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) loadField.field();
             ValueNode object = loadField.isStatic() ? ConstantNode.forObject(field.getDeclaringClass().mirror(), this, graph) : loadField.object();
             assert loadField.kind() != Kind.Illegal;
-            ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp(), WriteBarrierType.NONE,
-                            (loadField.kind() == Kind.Object && !field.getName().equals("classMirrorOffset"))));
+            ReadNode memoryRead = graph.add(new ReadNode(object, createFieldLocation(graph, field), loadField.stamp(), WriteBarrierType.NONE, (loadField.kind() == Kind.Object)));
             tool.createNullCheckGuard(memoryRead, object);
 
             graph.replaceFixedWithFixed(loadField, memoryRead);
@@ -613,7 +616,10 @@
             UnsafeLoadNode load = (UnsafeLoadNode) n;
             assert load.kind() != Kind.Illegal;
             IndexedLocationNode location = IndexedLocationNode.create(ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, 1);
-            ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), WriteBarrierType.NONE, (!load.object().isNullConstant() && load.accessKind() == Kind.Object)));
+            // Unsafe Accesses to the metaspace or to any
+            // absolute address do not perform uncompression.
+            boolean compress = (!load.object().isNullConstant() && load.accessKind() == Kind.Object);
+            ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp(), WriteBarrierType.NONE, compress));
             // An unsafe read must not floating outside its block as may float above an explicit
             // null check on its object.
             memoryRead.setGuard(AbstractBeginNode.prevBegin(load));
@@ -1059,4 +1065,19 @@
     public String disassemble(ResolvedJavaMethod method) {
         return new BytecodeDisassembler().disassemble(method);
     }
+
+    public Suites getDefaultSuites() {
+        return defaultSuites;
+    }
+
+    public Suites createSuites() {
+        Suites ret = Suites.createDefaultSuites();
+
+        ret.getMidTier().addPhase(new WriteBarrierAdditionPhase());
+        if (VerifyPhases.getValue()) {
+            ret.getMidTier().addPhase(new WriteBarrierVerificationPhase());
+        }
+
+        return ret;
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/VerifyHotSpotOptionsPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.oracle.graal.hotspot.phases;
+
+import static com.oracle.graal.api.meta.MetaUtil.*;
+import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
+import static java.lang.reflect.Modifier.*;
+
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.java.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.util.*;
+import com.oracle.graal.options.*;
+import com.oracle.graal.phases.*;
+
+/**
+ * Verifies that a class that declares one or more HotSpot {@linkplain OptionValue options} has a
+ * class initializer that only initializes the option(s). This sanity check prevents an option being
+ * read to initialize some global state before it is parsed on the command line. The latter occurs
+ * if an option declaring class has a class initializer that reads options or triggers other class
+ * initializers that read options.
+ */
+public class VerifyHotSpotOptionsPhase extends Phase {
+
+    public static boolean checkOptions() {
+        HotSpotRuntime runtime = graalRuntime().getRuntime();
+        ServiceLoader<Options> sl = ServiceLoader.loadInstalled(Options.class);
+        Set<HotSpotResolvedObjectType> checked = new HashSet<>();
+        for (Options opts : sl) {
+            for (OptionDescriptor desc : opts) {
+                if (HotSpotOptions.isHotSpotOption(desc)) {
+                    HotSpotResolvedObjectType holder = (HotSpotResolvedObjectType) runtime.lookupJavaType(desc.getDeclaringClass());
+                    if (!checked.contains(holder)) {
+                        checked.add(holder);
+                        for (ResolvedJavaMethod method : holder.getMethods()) {
+                            if (method.isClassInitializer()) {
+                                StructuredGraph graph = new StructuredGraph(method);
+                                new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.ALL).apply(graph);
+                                new VerifyHotSpotOptionsPhase(holder, runtime).apply(graph);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    private final HotSpotRuntime runtime;
+    private final ResolvedJavaType declaringClass;
+    private final ResolvedJavaType optionValueType;
+    private final Set<ResolvedJavaType> boxingTypes;
+
+    public VerifyHotSpotOptionsPhase(ResolvedJavaType declaringClass, HotSpotRuntime runtime) {
+        this.runtime = runtime;
+        this.declaringClass = declaringClass;
+        this.optionValueType = runtime.lookupJavaType(OptionValue.class);
+        this.boxingTypes = new HashSet<>();
+        for (Class c : new Class[]{Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Float.class, Long.class, Double.class}) {
+            this.boxingTypes.add(runtime.lookupJavaType(c));
+        }
+    }
+
+    /**
+     * Checks whether a given method is allowed to be called.
+     */
+    private boolean checkInvokeTarget(ResolvedJavaMethod method) {
+        ResolvedJavaType holder = method.getDeclaringClass();
+        if (method.isConstructor()) {
+            if (optionValueType.isAssignableFrom(holder)) {
+                return true;
+            }
+        } else if (boxingTypes.contains(holder)) {
+            return method.getName().equals("valueOf");
+        } else if (method.getDeclaringClass() == runtime.lookupJavaType(Class.class)) {
+            return method.getName().equals("desiredAssertionStatus");
+        } else if (method.getDeclaringClass().equals(declaringClass)) {
+            return (method.getName().equals("$jacocoInit"));
+        }
+        return false;
+    }
+
+    @Override
+    protected void run(StructuredGraph graph) {
+        for (ValueNode node : graph.getNodes().filter(ValueNode.class)) {
+            if (node instanceof StoreFieldNode) {
+                HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) ((StoreFieldNode) node).field();
+                verify(field.getDeclaringClass() == declaringClass, node, "store to field " + format("%H.%n", field));
+                verify(isStatic(field.getModifiers()), node, "store to field " + format("%H.%n", field));
+                if (optionValueType.isAssignableFrom((ResolvedJavaType) field.getType())) {
+                    verify(isFinal(field.getModifiers()), node, "option field " + format("%H.%n", field) + " not final");
+                } else {
+                    verify((field.isSynthetic()), node, "store to non-synthetic field " + format("%H.%n", field));
+                }
+            } else if (node instanceof Invoke) {
+                Invoke invoke = (Invoke) node;
+                MethodCallTargetNode callTarget = (MethodCallTargetNode) invoke.callTarget();
+                ResolvedJavaMethod targetMethod = callTarget.targetMethod();
+                verify(checkInvokeTarget(targetMethod), node, "invocation of " + format("%H.%n(%p)", targetMethod));
+            }
+        }
+    }
+
+    private void verify(boolean condition, Node node, String message) {
+        if (!condition) {
+            error(node, message);
+        }
+    }
+
+    private void error(Node node, String message) {
+        String loc = GraphUtil.approxSourceLocation(node);
+        throw new GraalInternalError(String.format("HotSpot option declarer %s contains code pattern implying action other than initialization of an option:%n    %s%n    %s",
+                        toJavaName(declaringClass), loc, message));
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Tue Jun 11 13:12:57 2013 +0200
@@ -156,7 +156,7 @@
                     phasePlan.addPhase(PhasePosition.AFTER_PARSING, graphBuilderPhase);
                     CallingConvention cc = linkage.getCallingConvention();
                     final CompilationResult compResult = GraalCompiler.compileGraph(graph, cc, getInstalledCodeOwner(), runtime, replacements, backend, runtime.getTarget(), null, phasePlan,
-                                    OptimisticOptimizations.ALL, new SpeculationLog());
+                                    OptimisticOptimizations.ALL, new SpeculationLog(), runtime.getDefaultSuites());
 
                     assert destroyedRegisters != null;
                     code = Debug.scope("CodeInstall", new Callable<InstalledCode>() {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Tue Jun 11 13:12:57 2013 +0200
@@ -117,33 +117,28 @@
         }
     }
 
-    public static class LoadCompressedOop extends LoadOp {
+    public static class LoadCompressedPointer extends LoadOp {
 
         private long narrowOopBase;
         private int narrowOopShift;
         private int logMinObjAlignment;
         @Temp({REG}) private AllocatableValue scratch;
 
-        public LoadCompressedOop(Kind kind, AllocatableValue result, AllocatableValue scratch, AMD64AddressValue address, LIRFrameState state, long narrowOopBase, int narrowOopShift,
+        public LoadCompressedPointer(Kind kind, AllocatableValue result, AllocatableValue scratch, AMD64AddressValue address, LIRFrameState state, long narrowOopBase, int narrowOopShift,
                         int logMinObjAlignment) {
             super(kind, result, address, state);
             this.narrowOopBase = narrowOopBase;
             this.narrowOopShift = narrowOopShift;
             this.logMinObjAlignment = logMinObjAlignment;
             this.scratch = scratch;
+            assert kind == Kind.Object;
         }
 
         @Override
         public void emitMemAccess(AMD64MacroAssembler masm) {
-            switch (kind) {
-                case Object:
-                    Register resRegister = asRegister(result);
-                    masm.movl(resRegister, address.toAddress());
-                    decodeOop(masm, resRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
-                    break;
-                default:
-                    throw GraalInternalError.shouldNotReachHere();
-            }
+            Register resRegister = asRegister(result);
+            masm.movl(resRegister, address.toAddress());
+            decodePointer(masm, resRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
         }
     }
 
@@ -190,7 +185,7 @@
         }
     }
 
-    public static class StoreCompressedOop extends AMD64LIRInstruction {
+    public static class StoreCompressedPointer extends AMD64LIRInstruction {
 
         protected final Kind kind;
         private long narrowOopBase;
@@ -201,7 +196,7 @@
         @Alive({COMPOSITE}) protected AMD64AddressValue address;
         @State protected LIRFrameState state;
 
-        public StoreCompressedOop(Kind kind, AMD64AddressValue address, AllocatableValue input, AllocatableValue scratch, LIRFrameState state, long narrowOopBase, int narrowOopShift,
+        public StoreCompressedPointer(Kind kind, AMD64AddressValue address, AllocatableValue input, AllocatableValue scratch, LIRFrameState state, long narrowOopBase, int narrowOopShift,
                         int logMinObjAlignment) {
             this.narrowOopBase = narrowOopBase;
             this.narrowOopShift = narrowOopShift;
@@ -211,27 +206,17 @@
             this.address = address;
             this.state = state;
             this.input = input;
+            assert kind == Kind.Object;
         }
 
         @Override
         public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            emitMemAccess(tasm, masm);
-        }
-
-        public void emitMemAccess(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            switch (kind) {
-                case Object:
-                    masm.movq(asRegister(scratch), asRegister(input));
-                    encodeOop(masm, asRegister(scratch), narrowOopBase, narrowOopShift, logMinObjAlignment);
-                    if (state != null) {
-                        tasm.recordImplicitException(masm.codeBuffer.position(), state);
-                    }
-                    masm.movl(address.toAddress(), asRegister(scratch));
-                    // masm.movq(asRegister(scratch), 0xDEADBEEF);
-                    break;
-                default:
-                    throw GraalInternalError.shouldNotReachHere();
+            masm.movq(asRegister(scratch), asRegister(input));
+            encodePointer(masm, asRegister(scratch), narrowOopBase, narrowOopShift, logMinObjAlignment);
+            if (state != null) {
+                tasm.recordImplicitException(masm.codeBuffer.position(), state);
             }
+            masm.movl(address.toAddress(), asRegister(scratch));
         }
     }
 
@@ -438,6 +423,7 @@
             this.address = address;
             this.cmpValue = cmpValue;
             this.newValue = newValue;
+            assert cmpValue.getKind() == Kind.Object;
         }
 
         @Override
@@ -658,44 +644,44 @@
     protected static void compareAndSwapCompressed(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue,
                     AllocatableValue newValue, AllocatableValue scratch, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
         assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax;
-
-        switch (cmpValue.getKind()) {
-            case Object:
-                final Register scratchRegister = asRegister(scratch);
-                final Register cmpRegister = asRegister(cmpValue);
-                final Register newRegister = asRegister(newValue);
-                encodeOop(masm, cmpRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
-                masm.movq(scratchRegister, newRegister);
-                encodeOop(masm, scratchRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
-                if (tasm.target.isMP) {
-                    masm.lock();
-                }
-                masm.cmpxchgl(scratchRegister, address.toAddress());
-                break;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
+        final Register scratchRegister = asRegister(scratch);
+        final Register cmpRegister = asRegister(cmpValue);
+        final Register newRegister = asRegister(newValue);
+        encodePointer(masm, cmpRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
+        masm.movq(scratchRegister, newRegister);
+        encodePointer(masm, scratchRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
+        if (tasm.target.isMP) {
+            masm.lock();
         }
+        masm.cmpxchgl(scratchRegister, address.toAddress());
     }
 
-    private static void encodeOop(AMD64MacroAssembler masm, Register scratchRegister, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
+    private static void encodePointer(AMD64MacroAssembler masm, Register scratchRegister, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
+        // If the narrowOopBase is zero, the uncompressed address has to be shifted right
+        // in order to be compressed.
         if (narrowOopBase == 0) {
             if (narrowOopShift != 0) {
                 assert logMinObjAlignment == narrowOopShift : "Encode algorithm is wrong";
                 masm.shrq(scratchRegister, logMinObjAlignment);
             }
         } else {
+            // Otherwise the narrow heap base, which resides always in register 12, is subtracted
+            // followed by right shift.
             masm.subq(scratchRegister, AMD64.r12);
             masm.shrq(scratchRegister, logMinObjAlignment);
         }
     }
 
-    private static void decodeOop(AMD64MacroAssembler masm, Register resRegister, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
+    private static void decodePointer(AMD64MacroAssembler masm, Register resRegister, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
+        // If the narrowOopBase is zero, the compressed address has to be shifted left
+        // in order to be uncompressed.
         if (narrowOopBase == 0) {
             if (narrowOopShift != 0) {
                 assert logMinObjAlignment == narrowOopShift : "Decode algorithm is wrong";
                 masm.shlq(resRegister, logMinObjAlignment);
             }
         } else {
+            // Otherwise the narrow heap base is added to the shifted address.
             masm.shlq(resRegister, logMinObjAlignment);
             masm.addq(resRegister, AMD64.r12);
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java	Tue Jun 11 13:12:57 2013 +0200
@@ -37,7 +37,6 @@
 
     @Input private ValueNode value;
     @Input(notDataflow = true) private FrameState stateAfter;
-    private final WriteBarrierType barrierType;
 
     public FrameState stateAfter() {
         return stateAfter;
@@ -60,7 +59,6 @@
     public WriteNode(ValueNode object, ValueNode value, ValueNode location, WriteBarrierType barrierType, boolean compress) {
         super(object, location, StampFactory.forVoid(), barrierType, compress);
         this.value = value;
-        this.barrierType = barrierType;
     }
 
     @Override
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionDescriptor.java	Tue Jun 11 13:12:57 2013 +0200
@@ -32,14 +32,16 @@
     protected final Class type;
     protected final String help;
     protected final OptionValue<?> option;
-    protected final String location;
+    protected final Class<?> declaringClass;
+    protected final String fieldName;
 
-    public OptionDescriptor(String name, Class type, String help, String location, OptionValue<?> option) {
+    public OptionDescriptor(String name, Class type, String help, Class<?> declaringClass, String fieldName, OptionValue<?> option) {
         this.name = name;
         this.type = type;
         this.help = help;
         this.option = option;
-        this.location = location;
+        this.declaringClass = declaringClass;
+        this.fieldName = fieldName;
     }
 
     /**
@@ -71,11 +73,18 @@
         return option;
     }
 
+    public Class<?> getDeclaringClass() {
+        return declaringClass;
+    }
+
+    public String getFieldName() {
+        return fieldName;
+    }
+
     /**
      * Gets a description of the location where this option is stored.
      */
     public String getLocation() {
-        return location;
-
+        return getDeclaringClass().getName() + "." + getFieldName();
     }
 }
--- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java	Tue Jun 11 13:12:57 2013 +0200
@@ -123,9 +123,9 @@
 
     private void createFiles(OptionsInfo info) {
         String pkg = ((PackageElement) info.topDeclaringType.getEnclosingElement()).getQualifiedName().toString();
-        Name declaringClass = info.topDeclaringType.getSimpleName();
+        Name topDeclaringClass = info.topDeclaringType.getSimpleName();
 
-        String optionsClassName = declaringClass + "_" + Options.class.getSimpleName();
+        String optionsClassName = topDeclaringClass + "_" + Options.class.getSimpleName();
         Element[] originatingElements = info.originatingElements.toArray(new Element[info.originatingElements.size()]);
 
         Filer filer = processingEnv.getFiler();
@@ -133,7 +133,7 @@
 
             out.println("// CheckStyle: stop header check");
             out.println("// GENERATED CONTENT - DO NOT EDIT");
-            out.println("// Source: " + declaringClass + ".java");
+            out.println("// Source: " + topDeclaringClass + ".java");
             out.println("package " + pkg + ";");
             out.println("");
             out.println("import java.util.*;");
@@ -141,8 +141,9 @@
             out.println("");
             out.println("public class " + optionsClassName + " implements " + Options.class.getSimpleName() + " {");
             out.println("    @Override");
-            out.println("    public Iterator<" + OptionDescriptor.class.getSimpleName() + "> iterator() {");
-            out.println("        List<" + OptionDescriptor.class.getSimpleName() + "> options = Arrays.asList(");
+            String desc = OptionDescriptor.class.getSimpleName();
+            out.println("    public Iterator<" + desc + "> iterator() {");
+            out.println("        List<" + desc + "> options = Arrays.asList(");
 
             boolean needPrivateFieldAccessor = false;
             int i = 0;
@@ -157,9 +158,10 @@
                 String name = option.name;
                 String type = option.type;
                 String help = option.help;
-                String location = pkg + "." + option.declaringClass + "." + option.field.getSimpleName();
+                String declaringClass = option.declaringClass;
+                Name fieldName = option.field.getSimpleName();
                 String comma = i == info.options.size() - 1 ? "" : ",";
-                out.printf("            new %s(\"%s\", %s.class, \"%s\", \"%s\", %s)%s\n", OptionDescriptor.class.getSimpleName(), name, type, help, location, optionValue, comma);
+                out.printf("            new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma);
                 i++;
             }
             out.println("        );");
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -119,7 +119,7 @@
             if (newNodesMark > 0) {
                 workList.addAll(graph.getNewNodes(newNodesMark));
             }
-            tool = new Tool(workList, runtime, assumptions, canonicalizeReads);
+            tool = new Tool();
             processWorkSet(graph);
         }
 
@@ -309,19 +309,7 @@
             }
         }
 
-        private static final class Tool implements SimplifierTool {
-
-            private final NodeWorkList nodeWorkSet;
-            private final MetaAccessProvider runtime;
-            private final Assumptions assumptions;
-            private final boolean canonicalizeReads;
-
-            public Tool(NodeWorkList nodeWorkSet, MetaAccessProvider runtime, Assumptions assumptions, boolean canonicalizeReads) {
-                this.nodeWorkSet = nodeWorkSet;
-                this.runtime = runtime;
-                this.assumptions = assumptions;
-                this.canonicalizeReads = canonicalizeReads;
-            }
+        private final class Tool implements SimplifierTool {
 
             @Override
             public void deleteBranch(FixedNode branch) {
@@ -345,7 +333,7 @@
 
             @Override
             public void addToWorkList(Node node) {
-                nodeWorkSet.addAgain(node);
+                workList.addAgain(node);
             }
 
             @Override
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IncrementalCanonicalizerPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IncrementalCanonicalizerPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.phases.common;
 
+import static com.oracle.graal.phases.GraalOptions.*;
+
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer;
@@ -43,6 +45,6 @@
     protected void run(StructuredGraph graph, C context) {
         int mark = graph.getMark();
         super.run(graph, context);
-        new CanonicalizerPhase.Instance(context.getRuntime(), context.getAssumptions(), GraalOptions.OptCanonicalizeReads.getValue(), mark, customCanonicalizer).apply(graph);
+        new CanonicalizerPhase.Instance(context.getRuntime(), context.getAssumptions(), OptCanonicalizeReads.getValue(), mark, customCanonicalizer).apply(graph);
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -23,6 +23,7 @@
 package com.oracle.graal.phases.common;
 
 import static com.oracle.graal.phases.GraalOptions.*;
+import static com.oracle.graal.phases.common.InliningPhase.Options.*;
 
 import java.util.*;
 import java.util.concurrent.*;
@@ -48,10 +49,13 @@
 
 public class InliningPhase extends Phase {
 
-    // @formatter:off
-    @Option(help = "Unconditionally inline intrinsics")
-    public static final OptionValue<Boolean> AlwaysInlineIntrinsics = new OptionValue<>(false);
-    // @formatter:on
+    static class Options {
+
+        // @formatter:off
+        @Option(help = "Unconditionally inline intrinsics")
+        public static final OptionValue<Boolean> AlwaysInlineIntrinsics = new OptionValue<>(false);
+        // @formatter:on
+    }
 
     private final PhasePlan plan;
     private final MetaAccessProvider runtime;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Tue Jun 11 13:12:57 2013 +0200
@@ -1183,7 +1183,7 @@
                 ArrayList<ResolvedJavaMethod> newConcreteMethods = new ArrayList<>();
                 ArrayList<Double> newConcreteMethodsProbabilities = new ArrayList<>();
                 for (int i = 0; i < concreteMethods.size(); ++i) {
-                    if (concreteMethodsProbabilities.get(i) >= GraalOptions.MegamorphicInliningMinMethodProbability.getValue()) {
+                    if (concreteMethodsProbabilities.get(i) >= MegamorphicInliningMinMethodProbability.getValue()) {
                         newConcreteMethods.add(concreteMethods.get(i));
                         newConcreteMethodsProbabilities.add(concreteMethodsProbabilities.get(i));
                     }
@@ -1256,7 +1256,7 @@
     private static boolean checkTargetConditions(InliningData data, Replacements replacements, Invoke invoke, ResolvedJavaMethod method, OptimisticOptimizations optimisticOpts) {
         if (method == null) {
             return logNotInlinedMethodAndReturnFalse(invoke, data.inliningDepth(), method, "the method is not resolved");
-        } else if (Modifier.isNative(method.getModifiers()) && (!GraalOptions.Intrinsify.getValue() || !InliningUtil.canIntrinsify(replacements, method))) {
+        } else if (Modifier.isNative(method.getModifiers()) && (!Intrinsify.getValue() || !InliningUtil.canIntrinsify(replacements, method))) {
             return logNotInlinedMethodAndReturnFalse(invoke, data.inliningDepth(), method, "it is a non-intrinsic native method");
         } else if (Modifier.isAbstract(method.getModifiers())) {
             return logNotInlinedMethodAndReturnFalse(invoke, data.inliningDepth(), method, "it is an abstract method");
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.phases.common;
 
+import static com.oracle.graal.phases.GraalOptions.*;
+
 import java.util.*;
 
 import com.oracle.graal.graph.Graph.NodeChangedListener;
@@ -44,7 +46,7 @@
             if (canonicalizationRoots.isEmpty()) {
                 break;
             }
-            new CanonicalizerPhase.Instance(context.getRuntime(), context.getAssumptions(), GraalOptions.OptCanonicalizeReads.getValue(), canonicalizationRoots, null).apply(graph);
+            new CanonicalizerPhase.Instance(context.getRuntime(), context.getAssumptions(), OptCanonicalizeReads.getValue(), canonicalizationRoots, null).apply(graph);
             canonicalizationRoots.clear();
         }
     }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -300,7 +300,7 @@
                     phi.setMerge(mergeAfter);
                 }
             }
-            new CanonicalizerPhase.Instance(phaseContext.getRuntime(), phaseContext.getAssumptions(), GraalOptions.OptCanonicalizeReads.getValue(), graph.getNewNodes(startMark), null).apply(graph);
+            new CanonicalizerPhase.Instance(phaseContext.getRuntime(), phaseContext.getAssumptions(), OptCanonicalizeReads.getValue(), graph.getNewNodes(startMark), null).apply(graph);
             Debug.dump(graph, "After tail duplication at %s", merge);
         }
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java	Tue Jun 11 13:12:57 2013 +0200
@@ -50,8 +50,7 @@
      */
     public static enum PhasePosition {
         AFTER_PARSING,
-        HIGH_LEVEL,
-        LOW_LEVEL
+        HIGH_LEVEL
     }
     // @formatter:on
 
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/Suites.java	Tue Jun 11 13:12:57 2013 +0200
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.phases.tiers;
 
+import static com.oracle.graal.phases.tiers.Suites.Options.*;
+
 import java.util.*;
 
 import com.oracle.graal.graph.*;
@@ -30,12 +32,13 @@
 
 public final class Suites {
 
-    // @formatter:off
-    @Option(help = "The compiler configuration to use")
-    private static final OptionValue<String> CompilerConfiguration = new OptionValue<>("basic");
-    // @formatter:on
+    static class Options {
 
-    public static final Suites DEFAULT;
+        // @formatter:off
+        @Option(help = "The compiler configuration to use")
+        static final OptionValue<String> CompilerConfiguration = new OptionValue<>("basic");
+        // @formatter:on
+    }
 
     private final PhaseSuite<HighTierContext> highTier;
     private final PhaseSuite<MidTierContext> midTier;
@@ -64,8 +67,6 @@
             }
             configurations.put(name.toLowerCase(), config);
         }
-
-        DEFAULT = createDefaultSuites();
     }
 
     private Suites(CompilerConfiguration config) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/SuitesProvider.java	Tue Jun 11 13:12:57 2013 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.phases.tiers;
+
+public interface SuitesProvider {
+
+    /**
+     * Get the default phase suites of this compiler.
+     */
+    Suites getDefaultSuites();
+
+    /**
+     * Create a new set of phase suites. Initially, the suites are the same as the
+     * {@link #getDefaultSuites default} suites.
+     */
+    Suites createSuites();
+}
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/IterativeInliningPhase.java	Tue Jun 11 13:12:57 2013 +0200
@@ -38,13 +38,11 @@
 
     private final PhasePlan plan;
 
-    private final Replacements replacements;
     private final GraphCache cache;
     private final OptimisticOptimizations optimisticOpts;
     private final CanonicalizerPhase canonicalizer;
 
-    public IterativeInliningPhase(Replacements replacements, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, CanonicalizerPhase canonicalizer) {
-        this.replacements = replacements;
+    public IterativeInliningPhase(GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts, CanonicalizerPhase canonicalizer) {
         this.cache = cache;
         this.plan = plan;
         this.optimisticOpts = optimisticOpts;
@@ -77,7 +75,7 @@
 
                     Map<Invoke, Double> hints = PEAInliningHints.getValue() ? PartialEscapePhase.getHints(graph) : null;
 
-                    InliningPhase inlining = new InliningPhase(context.getRuntime(), hints, replacements, context.getAssumptions(), cache, plan, optimisticOpts);
+                    InliningPhase inlining = new InliningPhase(context.getRuntime(), hints, context.getReplacements(), context.getAssumptions(), cache, plan, optimisticOpts);
                     inlining.setMaxMethodsPerInlining(simple ? 1 : Integer.MAX_VALUE);
                     inlining.apply(graph);
                     progress |= inlining.getInliningCount() > 0;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/SourceSection.java	Tue Jun 11 13:10:25 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/SourceSection.java	Tue Jun 11 13:12:57 2013 +0200
@@ -23,7 +23,7 @@
 package com.oracle.truffle.api;
 
 /**
- * Represents a section in the source code of a guest language program.
+ * Represents a contiguous text section within the source code of a guest language program.
  */
 public class SourceSection {
 
@@ -35,13 +35,26 @@
     private final int charLength;
 
     /**
-     * Creates a new object representing a section in the source code of a guest language program.
+     * Creates a new object representing a contiguous text section within the source code of a guest
+     * language program.
+     * <p>
+     * The starting location of the section is specified using two different coordinate:
+     * <ul>
+     * <li><b>(row, column)</b>: rows and columns are 1-based, so the first character in a source
+     * file is at position {@code (1,1)}.</li>
+     * <li><b>character index</b>: 0-based offset of the character from the beginning of the source,
+     * so the first character in a file is at index {@code 0}.</li>
+     * </ul>
+     * The <b>newline</b> that terminates each line counts as a single character for the purpose of
+     * a character index. The (row,column) coordinates of a newline character should never appear in
+     * a text section.
+     * <p>
      * 
-     * @param source object representing the source program this is should be a section of
+     * @param source object representing the complete source program that contains this section
      * @param identifier an identifier used when printing the section
-     * @param startLine the index of the start line of the section
-     * @param startColumn the index of the start column of the section
-     * @param charIndex the index of the first character of the section
+     * @param startLine the 1-based number of the start line of the section
+     * @param startColumn the 1-based number of the start column of the section
+     * @param charIndex the 0-based index of the first character of the section
      * @param charLength the length of the section in number of characters
      */
     public SourceSection(Source source, String identifier, int startLine, int startColumn, int charIndex, int charLength) {
@@ -54,7 +67,7 @@
     }
 
     /**
-     * Returns the source object representing the source program this is a section of.
+     * Returns the object representing the source program that contains this section.
      * 
      * @return the source object
      */
@@ -63,38 +76,42 @@
     }
 
     /**
-     * Returns the index of the start line of this source section (inclusive).
+     * Returns 1-based line number of the first character in this source section (inclusive).
      * 
-     * @return the start line
+     * @return the starting line number
      */
     public final int getStartLine() {
         return startLine;
     }
 
     /**
-     * Returns the index of the start column of this source section (inclusive).
+     * Returns the 1-based column number of the first character in this source section (inclusive).
      * 
-     * @return the start column
+     * @return the starting column number
      */
     public final int getStartColumn() {
         return startColumn;
     }
 
     /**
-     * Returns the index of the first character of this section. All characters of the source can be
-     * retrieved via the {@link Source#getCode()} method.
+     * Returns the 0-based index of the first character in this source section.
+     * <p>
+     * The complete text of the source that contains this section can be retrieved via
+     * {@link Source#getCode()}.
      * 
-     * @return the character index
+     * @return the starting character index
      */
     public final int getCharIndex() {
         return charIndex;
     }
 
     /**
-     * Returns the length of this section in characters. All characters of the source can be
-     * retrieved via the {@link Source#getCode()} method.
+     * Returns the length of this source section in characters.
+     * <p>
+     * The complete text of the source that contains this section can be retrieved via
+     * {@link Source#getCode()}.
      * 
-     * @return the character length
+     * @return the number of characters in the section
      */
     public final int getCharLength() {
         return charLength;
@@ -110,7 +127,7 @@
     }
 
     /**
-     * Returns the code represented by this code section.
+     * Returns text of the code represented by this source section.
      * 
      * @return the code as a String object
      */
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Tue Jun 11 13:10:25 2013 +0200
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Tue Jun 11 13:12:57 2013 +0200
@@ -269,12 +269,7 @@
     arrayOop values = (arrayOop) VirtualObject::values(value);
     for (jint i = 0; i < values->length(); i++) {
       ScopeValue* cur_second = NULL;
-      oop object;
-      if(UseCompressedOops) {
-        object=oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]);
-      } else {
-        object=((oop*) (values->base(T_OBJECT)))[i];
-      }
+      oop object = ((objArrayOop) (values))->obj_at(i);
       ScopeValue* value = get_hotspot_value(object, total_frame_size, objects, cur_second, oop_recorder);
 
       if (isLongArray && cur_second == NULL) {
@@ -456,13 +451,8 @@
   memcpy(_instructions->start(), _code->base(T_BYTE), _code_size);
   _instructions->set_end(_instructions->start() + _code_size);
 
-  oop site;
   for (int i = 0; i < _sites->length(); i++) {
-    if(UseCompressedOops) {
-      site=oopDesc::decode_heap_oop(((narrowOop*) _sites->base(T_OBJECT))[i]);
-    } else {
-      site=((oop*) (_sites->base(T_OBJECT)))[i];
-    }
+    oop site=((objArrayOop) (_sites))->obj_at(i);
     jint pc_offset = CompilationResult_Site::pcOffset(site);
 
     if (site->is_a(CompilationResult_Call::klass())) {
@@ -492,13 +482,8 @@
 
 #ifndef PRODUCT
   if (_comments != NULL) {
-    oop comment;
     for (int i = 0; i < _comments->length(); i++) {
-      if(UseCompressedOops) {
-        comment=oopDesc::decode_heap_oop(((narrowOop*) _comments->base(T_OBJECT))[i]);
-      } else {
-        comment=((oop*) (_comments->base(T_OBJECT)))[i];
-      }
+      oop comment=((objArrayOop) (_comments))->obj_at(i);
       assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
       jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
       char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
@@ -558,14 +543,8 @@
   GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers);
 
   if (_exception_handlers != NULL) {
-    oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT);
     for (int i = 0; i < _exception_handlers->length(); i++) {
-      oop exc;
-      if(UseCompressedOops) {
-        exc=oopDesc::decode_heap_oop(((narrowOop*) _exception_handlers->base(T_OBJECT))[i]);
-      } else {
-        exc=((oop*) (_exception_handlers->base(T_OBJECT)))[i];
-      }
+      oop exc=((objArrayOop) (_exception_handlers))->obj_at(i);
       jint pc_offset = CompilationResult_Site::pcOffset(exc);
       jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc);
 
@@ -637,12 +616,7 @@
 
   for (jint i = 0; i < values->length(); i++) {
     ScopeValue* second = NULL;
-    oop value;
-    if(UseCompressedOops) {
-      value=oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]);
-    } else {
-      value = ((oop*) values->base(T_OBJECT))[i];
-    }
+    oop value=((objArrayOop) (values))->obj_at(i);
     if (i < local_count) {
       ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder);
       if (second != NULL) {
@@ -661,11 +635,7 @@
     if (second != NULL) {
       i++;
       assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL");
-      if(UseCompressedOops) {
-        assert(oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
-      } else {
-        assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
-      }
+      assert(((objArrayOop) (values))->obj_at(i) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
     }
   }
 
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Tue Jun 11 13:10:25 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Tue Jun 11 13:12:57 2013 +0200
@@ -591,11 +591,11 @@
 
   for (AllFieldStream fs(k()); !fs.done(); fs.next()) {
     if (!fs.access_flags().is_static()) {
-      Handle type = GraalCompiler::get_JavaTypeFromSignature(fs.signature(), k, Thread::current());
+      Handle type = GraalCompiler::get_JavaTypeFromSignature(fs.signature(), k, THREAD);
       int flags = fs.access_flags().as_int();
       bool internal = fs.access_flags().is_internal();
-      Handle name = java_lang_String::create_from_symbol(fs.name(), Thread::current());
-      Handle field = VMToCompiler::createJavaField(JNIHandles::resolve(klass), name, type, fs.offset(), flags, internal, Thread::current());
+      Handle name = java_lang_String::create_from_symbol(fs.name(), THREAD);
+      Handle field = VMToCompiler::createJavaField(JNIHandles::resolve(klass), name, type, fs.offset(), flags, internal, THREAD);
       fields.append(field());
     }
   }
@@ -603,7 +603,28 @@
   for (int i = 0; i < fields.length(); ++i) {
     field_array->obj_at_put(i, fields.at(i)());
   }
-  return JNIHandles::make_local(field_array());
+  return JNIHandles::make_local(THREAD, field_array());
+C2V_END
+
+C2V_VMENTRY(jobject, getMethods, (JNIEnv *, jobject, jobject klass))
+  ResourceMark rm;
+
+  instanceKlassHandle k(THREAD, java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(klass)));
+  Array<Method*>* methods = k->methods();
+  int methods_length = methods->length();
+
+  // Allocate result
+  objArrayOop r = oopFactory::new_objArray(SystemDictionary::HotSpotResolvedJavaMethod_klass(), methods_length, CHECK_NULL);
+  objArrayHandle result (THREAD, r);
+
+  for (int i = 0; i < methods_length; i++) {
+    methodHandle method(THREAD, methods->at(i));
+    Handle holder = JNIHandles::resolve(klass);
+    oop m = VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD);
+    result->obj_at_put(i, m);
+  }
+
+  return JNIHandles::make_local(THREAD, result());
 C2V_END
 
 C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv *env, jobject, jlong addr))
@@ -1207,6 +1228,7 @@
   {CC"lookupFieldInPool",             CC"("HS_RESOLVED_TYPE"IB)"FIELD,                                  FN_PTR(lookupFieldInPool)},
   {CC"resolveMethod",                 CC"("HS_RESOLVED_TYPE STRING STRING")"METHOD,                     FN_PTR(resolveMethod)},
   {CC"getInstanceFields",             CC"("HS_RESOLVED_TYPE")["HS_RESOLVED_FIELD,                       FN_PTR(getInstanceFields)},
+  {CC"getMethods",                    CC"("HS_RESOLVED_TYPE")["HS_RESOLVED_METHOD,                      FN_PTR(getMethods)},
   {CC"isTypeInitialized",             CC"("HS_RESOLVED_TYPE")Z",                                        FN_PTR(isTypeInitialized)},
   {CC"hasFinalizableSubclass",        CC"("HS_RESOLVED_TYPE")Z",                                        FN_PTR(hasFinalizableSubclass)},
   {CC"initializeType",                CC"("HS_RESOLVED_TYPE")V",                                        FN_PTR(initializeType)},
--- a/src/share/vm/graal/graalCompilerToVM.hpp	Tue Jun 11 13:10:25 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.hpp	Tue Jun 11 13:12:57 2013 +0200
@@ -54,12 +54,7 @@
 
   oop next_arg(BasicType expectedType) {
     assert(_index < _args->length(), "out of bounds");
-    oop arg;
-    if(UseCompressedOops) {
-      arg = oopDesc::decode_heap_oop(((narrowOop*) _args->base(T_OBJECT))[_index++]);
-    } else {
-      arg = ((oop*) _args->base(T_OBJECT))[_index++];
-    }
+    oop arg=((objArrayOop) (_args))->obj_at(_index++);
     assert(expectedType == T_OBJECT || java_lang_boxing_object::is_instance(arg, expectedType), "arg type mismatch");
     return arg;
   }
--- a/src/share/vm/prims/unsafe.cpp	Tue Jun 11 13:10:25 2013 +0200
+++ b/src/share/vm/prims/unsafe.cpp	Tue Jun 11 13:12:57 2013 +0200
@@ -188,6 +188,8 @@
 #define GET_OOP_FIELD(obj, offset, v) \
    oop p = JNIHandles::resolve(obj); \
    oop v; \
+   /* Uncompression is not performed to unsafeAccess with null object.
+    * This concerns accesses to the metaspace such as the classMirrorOffset which is not compressed.*/ \
    if (UseCompressedOops && p!=NULL && offset>=oopDesc::header_size()) { \
      narrowOop n = *(narrowOop*)index_oop_from_field_offset_long(p, offset); \
      v = oopDesc::decode_heap_oop(n); \