changeset 8362:5981ea5996e8

Merge.
author Christian Humer <christian.humer@gmail.com>
date Tue, 19 Mar 2013 11:35:25 +0100
parents 676fa31bd3f0 (current diff) fa5a670a1682 (diff)
children 25691fcb505a b8666670daf5 a3ce41332d76
files graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/RegisterNode.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java
diffstat 167 files changed, 1619 insertions(+), 1211 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue Mar 19 11:30:58 2013 +0100
+++ b/.hgignore	Tue Mar 19 11:35:25 2013 +0100
@@ -61,6 +61,8 @@
 .DS_Store
 javadoc/
 .idea/
+^cscope.out
+^tags
 syntax: glob
 *.bgv
 core.*
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Tue Mar 19 11:35:25 2013 +0100
@@ -37,12 +37,10 @@
      * 
      * @param method a method to which the executable code is begin added
      * @param compResult the compilation result to be added
-     * @param info the object into which details of the installed code will be written. Ignored if
-     *            null, otherwise the info is written to index 0 of this array.
      * @return a reference to the compiled and ready-to-run code or null if the code installation
      *         failed
      */
-    InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info);
+    InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult);
 
     /**
      * Returns the size in bytes for locking information on the stack.
@@ -50,13 +48,16 @@
     int getSizeOfLockData();
 
     /**
-     * Returns a disassembly of the given installed code.
+     * Returns a disassembly of some compiled code.
      * 
-     * @param code the code that should be disassembled
+     * @param compResult some compiled code
+     * @param installedCode the result of installing the code in {@code compResult} or null if the
+     *            code has not yet been installed
+     * 
      * @return a disassembly. This will be of length 0 if the runtime does not support
      *         disassembling.
      */
-    String disassemble(CodeInfo code, CompilationResult tm);
+    String disassemble(CompilationResult compResult, InstalledCode installedCode);
 
     /**
      * Gets the register configuration to use when compiling a given method.
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java	Tue Mar 19 11:30:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2012, 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.api.code;
-
-import com.oracle.graal.api.meta.*;
-
-/**
- * Represents some code installed in the code cache of the runtime. This encapsulated details are
- * only for informational purposes. At any time, the runtime may invalidate the underlying code
- * (e.g. due to deopt etc).
- */
-public interface CodeInfo {
-
-    /**
-     * Returns the start address of this installed code.
-     */
-    long getStart();
-
-    /**
-     * Returns a copy of this installed code.
-     */
-    byte[] getCode();
-
-    /**
-     * Returns the method (if any) from which this installed code was compiled.
-     */
-    ResolvedJavaMethod getMethod();
-}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -39,11 +39,22 @@
     }
 
     /**
-     * Returns the method to which the compiled code belongs.
+     * Returns the method (if any) to which the installed code belongs.
      */
     ResolvedJavaMethod getMethod();
 
     /**
+     * Returns the start address of this installed code if it is {@linkplain #isValid() valid}, 0
+     * otherwise.
+     */
+    long getStart();
+
+    /**
+     * Returns a copy of this installed code if it is {@linkplain #isValid() valid}, null otherwise.
+     */
+    byte[] getCode();
+
+    /**
      * @return true if the code represented by this object is still valid, false otherwise (may
      *         happen due to deopt, etc.)
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Tue Mar 19 11:35:25 2013 +0100
@@ -44,8 +44,6 @@
      */
     Register getFrameRegister();
 
-    Register getScratchRegister();
-
     /**
      * Gets the calling convention describing how arguments are passed.
      * 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/package-info.java	Tue Mar 19 11:35:25 2013 +0100
@@ -23,7 +23,7 @@
 /**
  * Package that defines the interface between a Java application that wants to install code and the runtime.
  * The runtime provides in implementation of the {@link com.oracle.graal.api.code.CodeCacheProvider} interface.
- * The method {@link com.oracle.graal.api.code.CodeCacheProvider#addMethod(com.oracle.graal.api.meta.ResolvedJavaMethod, CompilationResult, CodeInfo[])}
+ * The method {@link com.oracle.graal.api.code.CodeCacheProvider#addMethod(com.oracle.graal.api.meta.ResolvedJavaMethod, CompilationResult)}
  * can be used to install code for a given method.
  */
 package com.oracle.graal.api.code;
--- a/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.asm.test/src/com/oracle/graal/asm/test/AssemblerTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -54,7 +54,7 @@
         Buffer codeBuffer = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc);
         compResult.setTargetCode(codeBuffer.close(true), codeBuffer.position());
 
-        InstalledCode code = codeCache.addMethod(method, compResult, null);
+        InstalledCode code = codeCache.addMethod(method, compResult);
 
         DisassemblerProvider dis = Graal.getRuntime().getCapability(DisassemblerProvider.class);
         if (dis != null) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.amd64.test/src/com/oracle/graal/compiler/amd64/test/AMD64FrameOmissionTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,121 @@
+/*
+ * 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.compiler.amd64.test;
+
+import static com.oracle.graal.amd64.AMD64.*;
+
+import java.lang.reflect.*;
+
+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.asm.amd64.*;
+import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.phases.*;
+
+/**
+ * Ensures that frame omission works in cases where it is expected to.
+ */
+public class AMD64FrameOmissionTest extends GraalCompilerTest {
+
+    interface CodeGenerator {
+
+        void generateCode(AMD64Assembler asm);
+    }
+
+    public static void test1snippet() {
+        return;
+    }
+
+    @Test
+    public void test1() {
+        testHelper("test1snippet", new CodeGenerator() {
+
+            @Override
+            public void generateCode(AMD64Assembler asm) {
+                asm.ret(0);
+            }
+        });
+    }
+
+    public static int test2snippet(int x) {
+        return x + 5;
+    }
+
+    @Test
+    public void test2() {
+        testHelper("test2snippet", new CodeGenerator() {
+
+            @Override
+            public void generateCode(AMD64Assembler asm) {
+                asm.addl(rsi, 5);
+                asm.movl(rax, rsi);
+                asm.ret(0);
+            }
+        });
+    }
+
+    public static double test3snippet(double x) {
+        return 42.0D / x;
+    }
+
+    @Test
+    public void test3() {
+        testHelper("test3snippet", new CodeGenerator() {
+
+            @Override
+            public void generateCode(AMD64Assembler asm) {
+                asm.movsd(xmm1, new AMD64Address(rip, -40));
+                asm.divsd(xmm1, xmm0);
+                asm.movapd(xmm0, xmm1);
+                asm.ret(0);
+            }
+        });
+    }
+
+    private void testHelper(String name, CodeGenerator gen) {
+        Method method = getMethod(name);
+        ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        InstalledCode installedCode = getCode(javaMethod, parse(method));
+
+        CodeCacheProvider codeCache = Graal.getRequiredCapability(CodeCacheProvider.class);
+        TargetDescription target = codeCache.getTarget();
+        RegisterConfig registerConfig = codeCache.lookupRegisterConfig();
+        AMD64Assembler asm = new AMD64Assembler(target, registerConfig);
+
+        gen.generateCode(asm);
+        for (int i = 0; i < GraalOptions.MethodEndBreakpointGuards; ++i) {
+            asm.int3();
+        }
+        while ((asm.codeBuffer.position() % 8) != 0) {
+            asm.hlt();
+        }
+
+        byte[] expectedCode = asm.codeBuffer.close(true);
+        byte[] actualCode = installedCode.getCode();
+
+        Assert.assertArrayEquals(expectedCode, actualCode);
+    }
+}
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Tue Mar 19 11:35:25 2013 +0100
@@ -50,8 +50,6 @@
 import com.oracle.graal.lir.amd64.AMD64Arithmetic.DivRemOp;
 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary1Op;
 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary2Op;
-import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp;
-import com.oracle.graal.lir.amd64.AMD64Call.IndirectCallOp;
 import com.oracle.graal.lir.amd64.AMD64Compare.CompareOp;
 import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp;
 import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp;
@@ -780,25 +778,13 @@
     }
 
     @Override
-    protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
-        append(new DirectCallOp(callTarget.target(), result, parameters, temps, callState));
-    }
+    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
 
-    @Override
-    protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) {
-        // The current register allocator cannot handle variables at call sites, need a fixed
-        // register.
-        Value targetAddress = AMD64.rax.asValue();
-        emitMove(targetAddress, operand(callTarget.computedAddress()));
-        append(new IndirectCallOp(callTarget.target(), result, parameters, temps, targetAddress, callState));
-    }
-
-    @Override
-    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info) {
-        if (isConstant(targetAddress)) {
-            append(new DirectCallOp(callTarget, result, arguments, temps, info));
+        long maxOffset = callTarget.getMaxCallTargetOffset();
+        if (maxOffset != (int) maxOffset) {
+            append(new AMD64Call.DirectFarRuntimeCallOp(this, callTarget, result, arguments, temps, info));
         } else {
-            append(new IndirectCallOp(callTarget, result, arguments, temps, targetAddress, info));
+            append(new AMD64Call.DirectNearRuntimeCallOp(callTarget, result, arguments, temps, info));
         }
     }
 
--- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXLIRGenerator.java	Tue Mar 19 11:35:25 2013 +0100
@@ -369,7 +369,7 @@
     }
 
     @Override
-    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info) {
+    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
         throw new InternalError("NYI");
     }
 
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java	Tue Mar 19 11:35:25 2013 +0100
@@ -112,7 +112,7 @@
     }
 
     @Override
-    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info) {
+    protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
         // SPARC: Auto-generated method stub
 
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,199 +0,0 @@
-/*
- * 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.compiler.test;
-
-import java.lang.reflect.*;
-
-import org.junit.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.code.InstalledCode.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.java.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.phases.*;
-import com.oracle.graal.phases.common.*;
-
-/**
- * In the following tests, the usages of local variable "a" are replaced with the integer constant
- * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the
- * graph of the method that just has a "return 1" statement in it.
- */
-public class CompiledMethodTest extends GraalCompilerTest {
-
-    public static Object testMethod(Object arg1, Object arg2, Object arg3) {
-        return arg1 + " " + arg2 + " " + arg3;
-    }
-
-    Object f1;
-
-    public Object testMethodVirtual(Object arg1, Object arg2, Object arg3) {
-        return f1 + " " + arg1 + " " + arg2 + " " + arg3;
-    }
-
-    @Test
-    public void test1() {
-        Method method = getMethod("testMethod");
-        final StructuredGraph graph = parse(method);
-        new CanonicalizerPhase(runtime(), new Assumptions(false)).apply(graph);
-        new DeadCodeEliminationPhase().apply(graph);
-
-        for (Node node : graph.getNodes()) {
-            if (node instanceof ConstantNode) {
-                ConstantNode constant = (ConstantNode) node;
-                if (constant.kind() == Kind.Object && " ".equals(constant.value.asObject())) {
-                    graph.replaceFloating(constant, ConstantNode.forObject("-", runtime, graph));
-                }
-            }
-        }
-
-        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
-        try {
-            Object result = compiledMethod.execute("1", "2", "3");
-            Assert.assertEquals("1-2-3", result);
-        } catch (MethodInvalidatedException t) {
-            Assert.fail("method invalidated");
-        }
-    }
-
-    @Test
-    public void test3() {
-        Method method = getMethod("testMethod");
-        final StructuredGraph graph = parse(method);
-        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
-        try {
-            Object result = compiledMethod.executeVarargs("1", "2", "3");
-            Assert.assertEquals("1 2 3", result);
-        } catch (MethodInvalidatedException t) {
-            Assert.fail("method invalidated");
-        }
-    }
-
-    @Test
-    public void test4() {
-        Method method = getMethod("testMethodVirtual");
-        final StructuredGraph graph = parse(method);
-        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
-        try {
-            f1 = "0";
-            Object result = compiledMethod.executeVarargs(this, "1", "2", "3");
-            Assert.assertEquals("0 1 2 3", result);
-        } catch (MethodInvalidatedException t) {
-            Assert.fail("method invalidated");
-        }
-    }
-
-    @Test
-    public void test2() throws NoSuchMethodException, SecurityException {
-        Method method = CompilableObjectImpl.class.getDeclaredMethod("executeHelper", ObjectCompiler.class, String.class);
-        ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
-        StructuredGraph graph = new StructuredGraph(javaMethod);
-        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.NONE).apply(graph);
-        new CanonicalizerPhase(runtime, new Assumptions(false)).apply(graph);
-        new DeadCodeEliminationPhase().apply(graph);
-
-        for (Node node : graph.getNodes()) {
-            if (node instanceof ConstantNode) {
-                ConstantNode constant = (ConstantNode) node;
-                if (constant.kind() == Kind.Object && "1 ".equals(constant.value.asObject())) {
-                    graph.replaceFloating(constant, ConstantNode.forObject("1-", runtime, graph));
-                }
-            }
-        }
-
-        InstalledCode compiledMethod = getCode(javaMethod, graph);
-        final CompilableObject compilableObject = new CompilableObjectImpl(0);
-
-        Object result;
-        result = compilableObject.execute(new ObjectCompilerImpl(compiledMethod), "3");
-        Assert.assertEquals("1-3", result);
-    }
-
-    public abstract class CompilableObject {
-
-        private CompiledObject compiledObject;
-        private final int compileThreshold;
-        private int counter;
-
-        public CompilableObject(int compileThreshold) {
-            this.compileThreshold = compileThreshold;
-        }
-
-        public final Object execute(ObjectCompiler compiler, String args) {
-            if (counter++ < compileThreshold || compiler == null) {
-                return executeHelper(compiler, args);
-            } else {
-                compiledObject = compiler.compile(this);
-                return compiledObject.execute(compiler, args);
-            }
-        }
-
-        protected abstract Object executeHelper(ObjectCompiler context, String args);
-    }
-
-    private final class CompilableObjectImpl extends CompilableObject {
-
-        private CompilableObjectImpl(int compileThreshold) {
-            super(compileThreshold);
-        }
-
-        @Override
-        protected Object executeHelper(ObjectCompiler compiler, String args) {
-            return "1 " + args;
-        }
-    }
-
-    public interface CompiledObject {
-
-        Object execute(ObjectCompiler context, String args);
-    }
-
-    public interface ObjectCompiler {
-
-        CompiledObject compile(CompilableObject node);
-    }
-
-    private final class ObjectCompilerImpl implements ObjectCompiler {
-
-        private final InstalledCode compiledMethod;
-
-        private ObjectCompilerImpl(InstalledCode compiledMethod) {
-            this.compiledMethod = compiledMethod;
-        }
-
-        @Override
-        public CompiledObject compile(final CompilableObject node) {
-            return new CompiledObject() {
-
-                @Override
-                public Object execute(ObjectCompiler compiler, String args) {
-                    return compiledMethod.execute(node, compiler, args);
-                }
-            };
-        }
-    }
-}
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -413,12 +413,12 @@
 
             @Override
             public InstalledCode call() throws Exception {
-                final CodeInfo[] info = Debug.isDumpEnabled() ? new CodeInfo[1] : null;
-                InstalledCode installedMethod = runtime.addMethod(method, compResult, info);
-                if (info != null) {
-                    Debug.dump(new Object[]{compResult, info[0]}, "After code installation");
+                InstalledCode installedCode = runtime.addMethod(method, compResult);
+                if (Debug.isDumpEnabled()) {
+                    Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
                 }
-                return installedMethod;
+
+                return installedCode;
             }
         });
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -54,7 +54,7 @@
         return 1;
     }
 
-    @Test(expected = AssertionError.class)
+    @Test
     public void test1() {
         test("test1Snippet");
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/CompiledMethodTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,201 @@
+/*
+ * 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.compiler.test.deopt;
+
+import java.lang.reflect.*;
+
+import org.junit.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.InstalledCode.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.java.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.phases.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.test.*;
+
+/**
+ * In the following tests, the usages of local variable "a" are replaced with the integer constant
+ * 0. Then canonicalization is applied and it is verified that the resulting graph is equal to the
+ * graph of the method that just has a "return 1" statement in it.
+ */
+public class CompiledMethodTest extends GraalCompilerTest {
+
+    public static Object testMethod(Object arg1, Object arg2, Object arg3) {
+        return arg1 + " " + arg2 + " " + arg3;
+    }
+
+    Object f1;
+
+    public Object testMethodVirtual(Object arg1, Object arg2, Object arg3) {
+        return f1 + " " + arg1 + " " + arg2 + " " + arg3;
+    }
+
+    @LongTest
+    public void test1() {
+        Method method = getMethod("testMethod");
+        final StructuredGraph graph = parse(method);
+        new CanonicalizerPhase(runtime(), new Assumptions(false)).apply(graph);
+        new DeadCodeEliminationPhase().apply(graph);
+
+        for (Node node : graph.getNodes()) {
+            if (node instanceof ConstantNode) {
+                ConstantNode constant = (ConstantNode) node;
+                if (constant.kind() == Kind.Object && " ".equals(constant.value.asObject())) {
+                    graph.replaceFloating(constant, ConstantNode.forObject("-", runtime, graph));
+                }
+            }
+        }
+
+        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        try {
+            Object result = compiledMethod.execute("1", "2", "3");
+            Assert.assertEquals("1-2-3", result);
+        } catch (MethodInvalidatedException t) {
+            Assert.fail("method invalidated");
+        }
+    }
+
+    @LongTest
+    public void test3() {
+        Method method = getMethod("testMethod");
+        final StructuredGraph graph = parse(method);
+        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        try {
+            Object result = compiledMethod.executeVarargs("1", "2", "3");
+            Assert.assertEquals("1 2 3", result);
+        } catch (MethodInvalidatedException t) {
+            Assert.fail("method invalidated");
+        }
+    }
+
+    @LongTest
+    public void test4() {
+        Method method = getMethod("testMethodVirtual");
+        final StructuredGraph graph = parse(method);
+        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        try {
+            f1 = "0";
+            Object result = compiledMethod.executeVarargs(this, "1", "2", "3");
+            Assert.assertEquals("0 1 2 3", result);
+        } catch (MethodInvalidatedException t) {
+            Assert.fail("method invalidated");
+        }
+    }
+
+    @LongTest
+    public void test2() throws NoSuchMethodException, SecurityException {
+        Method method = CompilableObjectImpl.class.getDeclaredMethod("executeHelper", ObjectCompiler.class, String.class);
+        ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        StructuredGraph graph = new StructuredGraph(javaMethod);
+        new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getEagerDefault(), OptimisticOptimizations.NONE).apply(graph);
+        new CanonicalizerPhase(runtime, new Assumptions(false)).apply(graph);
+        new DeadCodeEliminationPhase().apply(graph);
+
+        for (Node node : graph.getNodes()) {
+            if (node instanceof ConstantNode) {
+                ConstantNode constant = (ConstantNode) node;
+                if (constant.kind() == Kind.Object && "1 ".equals(constant.value.asObject())) {
+                    graph.replaceFloating(constant, ConstantNode.forObject("1-", runtime, graph));
+                }
+            }
+        }
+
+        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        final CompilableObject compilableObject = new CompilableObjectImpl(0);
+
+        Object result;
+        result = compilableObject.execute(new ObjectCompilerImpl(compiledMethod), "3");
+        Assert.assertEquals("1-3", result);
+    }
+
+    public abstract class CompilableObject {
+
+        private CompiledObject compiledObject;
+        private final int compileThreshold;
+        private int counter;
+
+        public CompilableObject(int compileThreshold) {
+            this.compileThreshold = compileThreshold;
+        }
+
+        public final Object execute(ObjectCompiler compiler, String args) {
+            if (counter++ < compileThreshold || compiler == null) {
+                return executeHelper(compiler, args);
+            } else {
+                compiledObject = compiler.compile(this);
+                return compiledObject.execute(compiler, args);
+            }
+        }
+
+        protected abstract Object executeHelper(ObjectCompiler context, String args);
+    }
+
+    private final class CompilableObjectImpl extends CompilableObject {
+
+        private CompilableObjectImpl(int compileThreshold) {
+            super(compileThreshold);
+        }
+
+        @Override
+        protected Object executeHelper(ObjectCompiler compiler, String args) {
+            return "1 " + args;
+        }
+    }
+
+    public interface CompiledObject {
+
+        Object execute(ObjectCompiler context, String args);
+    }
+
+    public interface ObjectCompiler {
+
+        CompiledObject compile(CompilableObject node);
+    }
+
+    private final class ObjectCompilerImpl implements ObjectCompiler {
+
+        private final InstalledCode compiledMethod;
+
+        private ObjectCompilerImpl(InstalledCode compiledMethod) {
+            this.compiledMethod = compiledMethod;
+        }
+
+        @Override
+        public CompiledObject compile(final CompilableObject node) {
+            return new CompiledObject() {
+
+                @Override
+                public Object execute(ObjectCompiler compiler, String args) {
+                    return compiledMethod.execute(node, compiler, args);
+                }
+            };
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/deopt/SynchronizedMethodDeoptimizationTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,74 @@
+/*
+ * 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.compiler.test.deopt;
+
+import java.lang.reflect.*;
+
+import org.junit.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.code.InstalledCode.MethodInvalidatedException;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.nodes.*;
+
+/**
+ * In the following tests, we try to deoptimize out of synchronized methods.
+ */
+public class SynchronizedMethodDeoptimizationTest extends GraalCompilerTest {
+
+    public static final int N = 15000;
+
+    public static synchronized Object testMethodSynchronized(Object o) {
+        if (o == null) {
+            return null;
+        }
+        return o;
+    }
+
+    @Test
+    public void test1() {
+        Method method = getMethod("testMethodSynchronized");
+        String testString = "test";
+        for (int i = 0; i < N; ++i) {
+            Assert.assertEquals(testString, testMethodSynchronized(testString));
+        }
+        final StructuredGraph graph = parseProfiled(method);
+        final ResolvedJavaMethod javaMethod = runtime.lookupJavaMethod(method);
+        InstalledCode compiledMethod = getCode(javaMethod, graph);
+        try {
+            Object result = compiledMethod.executeVarargs(testString);
+            Assert.assertEquals(testString, result);
+        } catch (MethodInvalidatedException t) {
+            Assert.fail("method invalidated");
+        }
+
+        try {
+            Object result = compiledMethod.executeVarargs(new Object[]{null});
+            Assert.assertEquals(null, result);
+            Assert.assertFalse(compiledMethod.isValid());
+        } catch (MethodInvalidatedException t) {
+            Assert.fail("method invalidated");
+        }
+    }
+}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Tue Mar 19 11:35:25 2013 +0100
@@ -1051,8 +1051,7 @@
     static RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op) {
         if (op instanceof MoveOp) {
             MoveOp move = (MoveOp) op;
-            if (isStackSlot(move.getInput()) && move.getInput().getKind() != Kind.Object) {
-                // method argument (condition must be equal to handleMethodArguments)
+            if (optimizeMethodArgument(move.getInput())) {
                 return RegisterPriority.None;
             }
         }
@@ -1073,6 +1072,10 @@
         return RegisterPriority.MustHaveRegister;
     }
 
+    private static boolean optimizeMethodArgument(Value value) {
+        return isStackSlot(value) && asStackSlot(value).isInCallerFrame() && (GraalOptions.IncomingMethodArgumentsGCSafe || value.getKind() != Kind.Object);
+    }
+
     /**
      * Optimizes moves related to incoming stack based arguments. The interval for the destination
      * of such moves is assigned the stack slot (which is in the caller's frame) as its spill slot.
@@ -1080,8 +1083,8 @@
     void handleMethodArguments(LIRInstruction op) {
         if (op instanceof MoveOp) {
             MoveOp move = (MoveOp) op;
-            if (isStackSlot(move.getInput()) && move.getInput().getKind() != Kind.Object) {
-                StackSlot slot = (StackSlot) move.getInput();
+            if (optimizeMethodArgument(move.getInput())) {
+                StackSlot slot = asStackSlot(move.getInput());
                 if (GraalOptions.DetailedAsserts) {
                     assert op.id() > 0 : "invalid id";
                     assert blockForId(op.id()).getPredecessorCount() == 0 : "move from stack must be in first block";
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Tue Mar 19 11:35:25 2013 +0100
@@ -135,7 +135,7 @@
                 throw new BailoutException("unbalanced monitors: found monitor for unknown frame (%d != %d) at %s", lockDataSlots.size(), numLocks, state);
             }
         }
-        assert state.bci >= 0 || state.bci == FrameState.BEFORE_BCI;
+        assert state.bci >= 0 || state.bci == FrameState.BEFORE_BCI : "bci == " + state.bci;
         return new BytecodeFrame(caller, state.method(), state.bci, state.rethrowException(), state.duringCall(), values, numLocals, numStack, numLocks);
     }
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Tue Mar 19 11:35:25 2013 +0100
@@ -467,7 +467,7 @@
             }
         }
 
-        append(new ParametersOp(params));
+        emitIncomingValues(params);
 
         for (LocalNode local : graph.getNodes(LocalNode.class)) {
             Value param = params[local.index()];
@@ -476,6 +476,10 @@
         }
     }
 
+    public void emitIncomingValues(Value[] params) {
+        append(new ParametersOp(params));
+    }
+
     /**
      * Increases the number of currently locked monitors and makes sure that a lock data slot is
      * available for the new lock.
@@ -675,7 +679,7 @@
 
     protected abstract void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState);
 
-    protected abstract void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info);
+    protected abstract void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, LIRFrameState info);
 
     protected static Value toStackKind(Value value) {
         if (value.getKind().getStackKind() != value.getKind()) {
@@ -723,7 +727,7 @@
             emitMove(loc, arg);
             argLocations[i] = loc;
         }
-        emitCall(callTarget, cc.getReturn(), argLocations, cc.getTemporaries(), Constant.forLong(0), info);
+        emitCall(callTarget, cc.getReturn(), argLocations, cc.getTemporaries(), info);
 
         if (isLegal(cc.getReturn())) {
             return emitMove(cc.getReturn());
@@ -758,7 +762,7 @@
             info = state();
         }
 
-        emitCall(call, resultOperand, args, cc.getTemporaries(), Constant.forLong(0), info);
+        emitCall(call, resultOperand, args, cc.getTemporaries(), info);
 
         if (isLegal(resultOperand)) {
             setResult(x, emitMove(resultOperand));
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Tue Mar 19 11:35:25 2013 +0100
@@ -324,10 +324,8 @@
         };
     }
 
-    private static class PlaceHolderNode extends Node {
-    }
-
-    private static final PlaceHolderNode PLACE_HOLDER = new PlaceHolderNode();
+    private static final Node PLACE_HOLDER = new Node() {
+    };
 
     private class TypedNodeIterator<T extends IterableNodeType> implements Iterator<T> {
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DeoptimizeOp.java	Tue Mar 19 11:35:25 2013 +0100
@@ -26,8 +26,9 @@
 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.asm.amd64.*;
+import com.oracle.graal.hotspot.*;
 import com.oracle.graal.lir.*;
-import com.oracle.graal.lir.LIRInstruction.Opcode;
+import com.oracle.graal.lir.LIRInstruction.*;
 import com.oracle.graal.lir.amd64.*;
 import com.oracle.graal.lir.asm.*;
 
@@ -48,8 +49,9 @@
 
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-        Register scratch = tasm.frameMap.registerConfig.getScratchRegister();
-        masm.movl(scratch, tasm.runtime.encodeDeoptActionAndReason(action, reason));
-        AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), info);
+        HotSpotGraalRuntime runtime = HotSpotGraalRuntime.getInstance();
+        Register thread = runtime.getRuntime().threadRegister();
+        masm.movl(new AMD64Address(thread, runtime.getConfig().pendingDeoptimizationOffset), tasm.runtime.encodeDeoptActionAndReason(action, reason));
+        AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), null, false, info);
     }
 }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Tue Mar 19 11:35:25 2013 +0100
@@ -190,10 +190,9 @@
         boolean frameOmitted = tasm.frameContext == null;
         if (!frameOmitted) {
             tasm.recordMark(Marks.MARK_EXCEPTION_HANDLER_ENTRY);
-            AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(EXCEPTION_HANDLER), null);
-
+            AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(EXCEPTION_HANDLER), null, false, null);
             tasm.recordMark(Marks.MARK_DEOPT_HANDLER_ENTRY);
-            AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(DEOPT_HANDLER), null);
+            AMD64Call.directCall(tasm, asm, runtime().lookupRuntimeCall(DEOPT_HANDLER), null, false, null);
         } else {
             // No need to emit the stubs for entries back into the method since
             // it has no calls that can cause such "return" entries
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Tue Mar 19 11:35:25 2013 +0100
@@ -76,7 +76,7 @@
 
     private static Register[] initAllocatable() {
         Register[] allocatable = {
-                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9, /* r10, */r11, r12, r13, r14, /*r15, */
+                        rax, rbx, rcx, rdx, /*rsp,*/ rbp, rsi, rdi, r8, r9,  r10, r11, r12, r13, r14, /*r15, */
                         xmm0, xmm1, xmm2,  xmm3,  xmm4,  xmm5,  xmm6,  xmm7,
                         xmm8, xmm9, xmm10, xmm11, xmm12, xmm13, xmm14, xmm15
                     };
@@ -210,11 +210,6 @@
     }
 
     @Override
-    public Register getScratchRegister() {
-        return r10;
-    }
-
-    @Override
     public Register getFrameRegister() {
         return rsp;
     }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotUnwindOp.java	Tue Mar 19 11:35:25 2013 +0100
@@ -70,6 +70,6 @@
 
         // Pass the address of the RBP slot in RBP itself
         masm.leaq(rbp, rbpSlot);
-        AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(UNWIND_EXCEPTION), null);
+        AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(UNWIND_EXCEPTION), AMD64.r10, false, null);
     }
 }
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectStaticCallOp.java	Tue Mar 19 11:35:25 2013 +0100
@@ -46,7 +46,7 @@
     private final Constant metaspaceMethod;
     private final InvokeKind invokeKind;
 
-    AMD64HotspotDirectStaticCallOp(InvokeTarget target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, Constant metaspaceMethod) {
+    AMD64HotspotDirectStaticCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind, Constant metaspaceMethod) {
         super(target, result, parameters, temps, state);
         assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special;
         this.metaspaceMethod = metaspaceMethod;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotspotDirectVirtualCallOp.java	Tue Mar 19 11:35:25 2013 +0100
@@ -47,7 +47,7 @@
 
     private final InvokeKind invokeKind;
 
-    AMD64HotspotDirectVirtualCallOp(InvokeTarget target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind) {
+    AMD64HotspotDirectVirtualCallOp(ResolvedJavaMethod target, Value result, Value[] parameters, Value[] temps, LIRFrameState state, InvokeKind invokeKind) {
         super(target, result, parameters, temps, state);
         this.invokeKind = invokeKind;
         assert invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual;
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -52,8 +52,7 @@
                         Invoke invoke = (Invoke) node;
                         Assert.assertTrue(invoke.callTarget() instanceof DirectCallTargetNode);
                         AbstractCallTargetNode directCall = (AbstractCallTargetNode) invoke.callTarget();
-                        Assert.assertTrue(directCall.target() instanceof JavaMethod);
-                        JavaMethod callee = (JavaMethod) directCall.target();
+                        JavaMethod callee = directCall.target();
                         Assert.assertTrue(callee.getName().equals("<init>"));
                         Assert.assertTrue(runtime.lookupJavaType(ArrayIndexOutOfBoundsException.class).equals(callee.getDeclaringClass()) ||
                                         runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass()));
@@ -65,7 +64,7 @@
                     if (node instanceof Invoke) {
                         Invoke invoke = (Invoke) node;
                         AbstractCallTargetNode directCall = (AbstractCallTargetNode) invoke.callTarget();
-                        JavaMethod callee = (JavaMethod) directCall.target();
+                        JavaMethod callee = directCall.target();
                         if (callee.getDeclaringClass().equals(runtime.lookupJavaType(System.class)) && callee.getName().equals("arraycopy")) {
                             found = true;
                         } else {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Tue Mar 19 11:35:25 2013 +0100
@@ -177,15 +177,14 @@
         stats.finish(method);
     }
 
-    private void installMethod(final CompilationResult tm) {
+    private void installMethod(final CompilationResult compResult) {
         Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getRuntime(), method}, new Runnable() {
 
             @Override
             public void run() {
-                final CodeInfo[] info = Debug.isDumpEnabled() ? new CodeInfo[1] : null;
-                graalRuntime.getRuntime().installMethod(method, entryBCI, tm, info);
-                if (info != null) {
-                    Debug.dump(new Object[]{tm, info[0]}, "After code installation");
+                HotSpotInstalledCode installedCode = graalRuntime.getRuntime().installMethod(method, entryBCI, compResult);
+                if (Debug.isDumpEnabled()) {
+                    Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
                 }
             }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotSnippetInstaller.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotSnippetInstaller.java	Tue Mar 19 11:35:25 2013 +0100
@@ -42,7 +42,7 @@
     }
 
     @Override
-    protected void installMethodSubstitution(Method originalMethod, Method substituteMethod) {
+    protected void installMethodSubstitution(Member originalMethod, Method substituteMethod) {
         if (substituteMethod.getDeclaringClass() == IntegerSubstitutions.class || substituteMethod.getDeclaringClass() == LongSubstitutions.class) {
             if (substituteMethod.getName().equals("bitCount")) {
                 if (!config.usePopCountInstruction) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue Mar 19 11:35:25 2013 +0100
@@ -169,6 +169,11 @@
     public int uninitializedIdentityHashCodeValue;
 
     /**
+     * Offset of the pending deoptimization field.
+     */
+    public int pendingDeoptimizationOffset;
+
+    /**
      * Mark word right shift to get identity hash code.
      */
     public int identityHashCodeShift;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Tue Mar 19 11:35:25 2013 +0100
@@ -149,11 +149,9 @@
      * @param compResult the result of a compilation
      * @param code if not null, then the code is installed as the non-default compiled code for the
      *            associated method and the details of the installation are written to this object
-     * @param info additional information about the installation are written to this object if it is
-     *            not null
      * @return the outcome of the installation as a {@link CodeInstallResult}.
      */
-    CodeInstallResult installCode(HotSpotCompilationResult compResult, HotSpotInstalledCode code, HotSpotCodeInfo info, SpeculationLog cache);
+    CodeInstallResult installCode(HotSpotCompilationResult compResult, HotSpotInstalledCode code, SpeculationLog cache);
 
     void initializeConfiguration(HotSpotVMConfig config);
 
@@ -190,9 +188,14 @@
 
     long getMaxCallTargetOffset(long stub);
 
-    String disassembleNative(byte[] code, long address);
+    String disassembleNMethod(long nmethod);
 
-    String disassembleNMethod(long nmethod);
+    /**
+     * Gets a copy of the machine code for an nmethod.
+     * 
+     * @return the machine code for {@code nmethod} if it is valid, null otherwise
+     */
+    byte[] getCode(long nmethod);
 
     StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
 
@@ -204,8 +207,6 @@
 
     long[] getDeoptedLeafGraphIds();
 
-    String decodePC(long pc);
-
     long[] getLineNumberTable(HotSpotResolvedJavaMethod method);
 
     Local[] getLocalVariableTable(HotSpotResolvedJavaMethod method);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Tue Mar 19 11:35:25 2013 +0100
@@ -35,11 +35,11 @@
  */
 public class CompilerToVMImpl implements CompilerToVM {
 
-    private native int installCode0(HotSpotCompilationResult comp, HotSpotInstalledCode code, HotSpotCodeInfo info, boolean[] triggeredDeoptimizations);
+    private native int installCode0(HotSpotCompilationResult comp, HotSpotInstalledCode code, boolean[] triggeredDeoptimizations);
 
     @Override
-    public CodeInstallResult installCode(HotSpotCompilationResult comp, HotSpotInstalledCode code, HotSpotCodeInfo info, SpeculationLog speculationLog) {
-        return CodeInstallResult.values()[installCode0(comp, code, info, (speculationLog == null) ? null : speculationLog.getRawMap())];
+    public CodeInstallResult installCode(HotSpotCompilationResult comp, HotSpotInstalledCode code, SpeculationLog speculationLog) {
+        return CodeInstallResult.values()[installCode0(comp, code, (speculationLog == null) ? null : speculationLog.getRawMap())];
     }
 
     @Override
@@ -124,10 +124,10 @@
     public native long getMaxCallTargetOffset(long stub);
 
     @Override
-    public native String disassembleNative(byte[] code, long address);
+    public native String disassembleNMethod(long nmethod);
 
     @Override
-    public native String disassembleNMethod(long nmethod);
+    public native byte[] getCode(long nmethod);
 
     @Override
     public native StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
@@ -145,9 +145,6 @@
     public native long[] getDeoptedLeafGraphIds();
 
     @Override
-    public native String decodePC(long pc);
-
-    @Override
     public native long[] getLineNumberTable(HotSpotResolvedJavaMethod method);
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeInfo.java	Tue Mar 19 11:30:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * 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.meta;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.hotspot.*;
-
-/**
- * Implementation of {@link CodeInfo} for HotSpot.
- */
-public class HotSpotCodeInfo extends CompilerObject implements CodeInfo {
-
-    private static final long serialVersionUID = -6766490427732498354L;
-
-    private long start;
-    private byte[] code;
-    public final CompilationResult targetMethod;
-    private HotSpotResolvedJavaMethod method;
-
-    public HotSpotCodeInfo(CompilationResult targetMethod, HotSpotResolvedJavaMethod method) {
-        assert targetMethod != null;
-        this.method = method;
-        this.targetMethod = targetMethod;
-    }
-
-    @Override
-    public long getStart() {
-        return start;
-    }
-
-    @Override
-    public byte[] getCode() {
-        return code;
-    }
-
-    @Override
-    public String toString() {
-        int size = code == null ? 0 : code.length;
-        return "installed code @[" + Long.toHexString(start) + "-" + Long.toHexString(start + size) + "]";
-
-    }
-
-    @Override
-    public ResolvedJavaMethod getMethod() {
-        return method;
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -40,6 +40,7 @@
     private final HotSpotResolvedJavaMethod method;
     private final boolean isDefault;
     long nmethod;
+    long start;
 
     public HotSpotInstalledCode(HotSpotResolvedJavaMethod method, boolean isDefault) {
         this.method = method;
@@ -93,4 +94,14 @@
         assert checkArgs(args);
         return HotSpotGraalRuntime.getInstance().getCompilerToVM().executeCompiledMethodVarargs(method.metaspaceMethod, nmethod, args);
     }
+
+    @Override
+    public long getStart() {
+        return isValid() ? start : 0;
+    }
+
+    @Override
+    public byte[] getCode() {
+        return HotSpotGraalRuntime.getInstance().getCompilerToVM().getCode(nmethod);
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue Mar 19 11:35:25 2013 +0100
@@ -380,16 +380,17 @@
     public abstract Register stackPointerRegister();
 
     @Override
-    public String disassemble(CodeInfo info, CompilationResult tm) {
-        byte[] code = info.getCode();
+    public String disassemble(CompilationResult compResult, InstalledCode installedCode) {
+        byte[] code = installedCode == null ? Arrays.copyOf(compResult.getTargetCode(), compResult.getTargetCodeSize()) : installedCode.getCode();
+        long start = installedCode == null ? 0L : installedCode.getStart();
         TargetDescription target = graalRuntime.getTarget();
-        HexCodeFile hcf = new HexCodeFile(code, info.getStart(), target.arch.getName(), target.wordSize * 8);
-        if (tm != null) {
-            HexCodeFile.addAnnotations(hcf, tm.getAnnotations());
-            addExceptionHandlersComment(tm, hcf);
+        HexCodeFile hcf = new HexCodeFile(code, start, target.arch.getName(), target.wordSize * 8);
+        if (compResult != null) {
+            HexCodeFile.addAnnotations(hcf, compResult.getAnnotations());
+            addExceptionHandlersComment(compResult, hcf);
             Register fp = regConfig.getFrameRegister();
             RefMapFormatter slotFormatter = new RefMapFormatter(target.arch, target.wordSize, fp, 0);
-            for (Safepoint safepoint : tm.getSafepoints()) {
+            for (Safepoint safepoint : compResult.getSafepoints()) {
                 if (safepoint instanceof Call) {
                     Call call = (Call) safepoint;
                     if (call.debugInfo != null) {
@@ -403,10 +404,10 @@
                     addOperandComment(hcf, safepoint.pcOffset, "{safepoint}");
                 }
             }
-            for (DataPatch site : tm.getDataReferences()) {
+            for (DataPatch site : compResult.getDataReferences()) {
                 hcf.addOperandComment(site.pcOffset, "{" + site.constant + "}");
             }
-            for (Mark mark : tm.getMarks()) {
+            for (Mark mark : compResult.getMarks()) {
                 hcf.addComment(mark.pcOffset, getMarkName(mark));
             }
         }
@@ -739,6 +740,8 @@
         } else if (n instanceof IntegerDivNode || n instanceof IntegerRemNode || n instanceof UnsignedDivNode || n instanceof UnsignedRemNode) {
             // Nothing to do for division nodes. The HotSpot signal handler catches divisions by
             // zero and the MIN_VALUE / -1 cases.
+        } else if (n instanceof UnwindNode || n instanceof ExceptionObjectNode) {
+            // Nothing to do, using direct LIR lowering for these nodes.
         } else {
             assert false : "Node implementing Lowerable not handled: " + n;
             throw GraalInternalError.shouldNotReachHere();
@@ -806,27 +809,17 @@
         return graalRuntime.getCompilerToVM().getJavaField(reflectionField);
     }
 
-    private static HotSpotCodeInfo makeInfo(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info) {
-        HotSpotCodeInfo hsInfo = null;
-        if (info != null && info.length > 0) {
-            hsInfo = new HotSpotCodeInfo(compResult, (HotSpotResolvedJavaMethod) method);
-            info[0] = hsInfo;
-        }
-        return hsInfo;
-    }
-
-    public void installMethod(HotSpotResolvedJavaMethod method, int entryBCI, CompilationResult compResult, CodeInfo[] info) {
-        HotSpotCodeInfo hsInfo = makeInfo(method, compResult, info);
-        HotSpotInstalledCode code = new HotSpotInstalledCode(method, true);
-        graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(method, entryBCI, compResult), code, hsInfo, method.getSpeculationLog());
+    public HotSpotInstalledCode installMethod(HotSpotResolvedJavaMethod method, int entryBCI, CompilationResult compResult) {
+        HotSpotInstalledCode installedCode = new HotSpotInstalledCode(method, true);
+        graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(method, entryBCI, compResult), installedCode, method.getSpeculationLog());
+        return installedCode;
     }
 
     @Override
-    public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult, CodeInfo[] info) {
-        HotSpotCodeInfo hsInfo = makeInfo(method, compResult, info);
+    public InstalledCode addMethod(ResolvedJavaMethod method, CompilationResult compResult) {
         HotSpotResolvedJavaMethod hotspotMethod = (HotSpotResolvedJavaMethod) method;
         HotSpotInstalledCode code = new HotSpotInstalledCode(hotspotMethod, false);
-        CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(hotspotMethod, -1, compResult), code, hsInfo, null);
+        CodeInstallResult result = graalRuntime.getCompilerToVM().installCode(new HotSpotCompilationResult(hotspotMethod, -1, compResult), code, null);
         if (result != CodeInstallResult.OK) {
             return null;
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotDirectCallTargetNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -34,7 +34,7 @@
 
     private final InvokeKind invokeKind;
 
-    public HotSpotDirectCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, InvokeTarget target, Type callType, InvokeKind invokeKind) {
+    public HotSpotDirectCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, Type callType, InvokeKind invokeKind) {
         super(arguments, returnStamp, signature, target, callType);
         this.invokeKind = invokeKind;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotIndirectCallTargetNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -33,7 +33,8 @@
 
     @Input private ValueNode metaspaceMethod;
 
-    public HotSpotIndirectCallTargetNode(ValueNode metaspaceMethod, ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, InvokeTarget target, Type callType) {
+    public HotSpotIndirectCallTargetNode(ValueNode metaspaceMethod, ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target,
+                    Type callType) {
         super(computedAddress, arguments, returnStamp, signature, target, callType);
         this.metaspaceMethod = metaspaceMethod;
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/RegisterNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2012, 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.nodes;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.type.*;
-
-/**
- * Access the value of a specific register.
- */
-@NodeInfo(nameTemplate = "Register %{p#register}")
-public final class RegisterNode extends FixedWithNextNode implements LIRLowerable {
-
-    private final Register register;
-
-    public RegisterNode(Register register, Kind kind) {
-        super(StampFactory.forKind(kind));
-        this.register = register;
-    }
-
-    public RegisterNode(Register register) {
-        super(StampFactory.object());
-        this.register = register;
-    }
-
-    @Override
-    public void generate(LIRGeneratorTool generator) {
-        Value result;
-        if (generator.attributes(register).isAllocatable()) {
-            // The register allocator would prefer us not to tie up an allocatable
-            // register for the complete lifetime of this node.
-            result = generator.newVariable(kind());
-            generator.emitMove(result, register.asValue(kind()));
-        } else {
-            result = register.asValue(kind());
-        }
-        generator.setResult(this, result);
-    }
-
-    @Override
-    public String toString(Verbosity verbosity) {
-        if (verbosity == Verbosity.Name) {
-            return super.toString(Verbosity.Name) + "%" + register;
-        } else {
-            return super.toString(verbosity);
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Tue Mar 19 11:35:25 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.snippets.Snippet.Fold;
+import com.oracle.graal.snippets.nodes.*;
 import com.oracle.graal.word.*;
 
 //JaCoCo Exclude
@@ -338,22 +339,22 @@
      * Gets the value of the stack pointer register as a Word.
      */
     public static Word stackPointer() {
-        return HotSpotSnippetUtils.registerAsWord(stackPointerRegister());
+        return HotSpotSnippetUtils.registerAsWord(stackPointerRegister(), true, false);
     }
 
     /**
      * Gets the value of the thread register as a Word.
      */
     public static Word thread() {
-        return HotSpotSnippetUtils.registerAsWord(threadRegister());
+        return HotSpotSnippetUtils.registerAsWord(threadRegister(), true, false);
     }
 
     public static Word loadWordFromObject(Object object, int offset) {
         return loadWordFromObjectIntrinsic(object, 0, offset, wordKind());
     }
 
-    @NodeIntrinsic(value = RegisterNode.class, setStampFromReturnType = true)
-    public static native Word registerAsWord(@ConstantNodeParameter Register register);
+    @NodeIntrinsic(value = ReadRegisterNode.class, setStampFromReturnType = true)
+    public static native Word registerAsWord(@ConstantNodeParameter Register register, @ConstantNodeParameter boolean directUse, @ConstantNodeParameter boolean incoming);
 
     @NodeIntrinsic(value = UnsafeLoadNode.class, setStampFromReturnType = true)
     private static native Word loadWordFromObjectIntrinsic(Object object, @ConstantNodeParameter int displacement, long offset, @ConstantNodeParameter Kind wordKind);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Tue Mar 19 11:35:25 2013 +0100
@@ -121,22 +121,21 @@
         final CompilationResult compResult = GraalCompiler.compileMethod(runtime(), backend, runtime().getTarget(), stubMethod, graph, null, phasePlan, OptimisticOptimizations.ALL,
                         new SpeculationLog());
 
-        final CodeInfo[] info = new CodeInfo[1];
         stubCode = Debug.scope("CodeInstall", new Object[]{runtime(), stubMethod}, new Callable<InstalledCode>() {
 
             @Override
             public InstalledCode call() {
-                InstalledCode installedCode = runtime().addMethod(stubMethod, compResult, info);
+                InstalledCode installedCode = runtime().addMethod(stubMethod, compResult);
                 assert installedCode != null : "error installing stub " + stubMethod;
                 if (Debug.isDumpEnabled()) {
-                    Debug.dump(new Object[]{compResult, info[0]}, "After code installation");
+                    Debug.dump(new Object[]{compResult, installedCode}, "After code installation");
                 }
                 return installedCode;
             }
         });
 
         assert stubCode != null : "error installing stub " + stubMethod;
-        linkage.setAddress(info[0].getStart());
+        linkage.setAddress(stubCode.getStart());
     }
 
     /**
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Tue Mar 19 11:35:25 2013 +0100
@@ -962,7 +962,7 @@
         }
     }
 
-    private void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) {
+    protected void emitExplicitExceptions(ValueNode receiver, ValueNode outOfBoundsIndex) {
         assert receiver != null;
         if (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE) {
             return;
@@ -1568,9 +1568,8 @@
         ValueNode x = returnKind == Kind.Void ? null : frameState.pop(returnKind);
         assert frameState.stackSize() == 0;
 
-        // TODO (gdub) remove this when FloatingRead can handle this case
         if (Modifier.isSynchronized(method.getModifiers())) {
-            append(currentGraph.add(new ValueAnchorNode(x)));
+            append(currentGraph.add(new ValueAnchorNode(true, x)));
             assert !frameState.rethrowException();
         }
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_NPE_07.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_NPE_07.java	Tue Mar 19 11:35:25 2013 +0100
@@ -23,12 +23,11 @@
 
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
-
 public class Catch_NPE_07 extends JTTTest {
 
     @SuppressWarnings("serial")
@@ -62,12 +61,12 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_Two02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_Two02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -49,17 +49,17 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 3);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_Two03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Catch_Two03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -56,17 +56,17 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_InNested.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_InNested.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Throw_InNested extends JTTTest {
 
@@ -48,12 +48,12 @@
         return i;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Throw_Synchronized01 extends JTTTest {
 
@@ -38,12 +38,12 @@
         throw new Exception();
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Throw_Synchronized02 extends JTTTest {
 
@@ -36,12 +36,12 @@
         throw new Exception();
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Throw_Synchronized03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.except;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Throw_Synchronized03 extends JTTTest {
 
@@ -41,12 +41,12 @@
         throw new Exception();
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_allocate01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_allocate01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -37,27 +37,27 @@
         return sum;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 80);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field04.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_field04.java	Tue Mar 19 11:35:25 2013 +0100
@@ -23,8 +23,8 @@
 // Checkstyle: stop
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -55,12 +55,12 @@
         return (int) (b + c + s + i + l + f + d);
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 40);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1000);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_invoke01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_invoke01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -104,12 +104,12 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 40);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 80);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_life.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_life.java	Tue Mar 19 11:35:25 2013 +0100
@@ -25,8 +25,8 @@
 
 import java.util.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -107,7 +107,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_nest02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_nest02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -23,8 +23,8 @@
 // Checkstyle: stop
 package com.oracle.graal.jtt.hotpath;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -48,7 +48,7 @@
         return sum;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 15);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.jtt.hotspot;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /**
- * @test
+ * @LongTest
  * @bug 6196102
  * @summary Integer seems to be greater than Integer.MAX_VALUE
  * 
@@ -48,7 +48,7 @@
         return "ok";
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6850611.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6850611.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.hotspot;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 //@formatter:off
 
@@ -50,7 +50,7 @@
         return 95;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/EnumMap02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/EnumMap02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -43,17 +43,17 @@
         A, B, C
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.io.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -56,7 +56,7 @@
         System.out.println(test(10000));
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 10000);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 import sun.misc.*;
 
@@ -55,7 +55,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/ClassLoader_loadClass01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/ClassLoader_loadClass01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.net.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -43,22 +43,22 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_Literal01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_Literal01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Class_Literal01 extends JTTTest {
 
@@ -45,27 +45,27 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_asSubclass01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_asSubclass01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Class_asSubclass01 extends JTTTest {
 
@@ -53,27 +53,27 @@
         return i;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_cast01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_cast01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Class_cast01 extends JTTTest {
 
@@ -57,27 +57,27 @@
         return i;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Class_forName01 extends JTTTest {
 
@@ -45,27 +45,27 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Class_forName02 extends JTTTest {
 
@@ -51,27 +51,27 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.net.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -56,32 +56,32 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName04.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName04.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -48,32 +48,32 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName05.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_forName05.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.net.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -41,17 +41,17 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,12 +22,11 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
-
 public final class Class_getInterfaces01 extends JTTTest {
 
     public static String test(int i) {
@@ -82,27 +81,27 @@
 
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Object_getClass01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Object_getClass01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Object_getClass01 extends JTTTest {
 
@@ -49,27 +49,27 @@
         return null;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Object_toString01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Object_toString01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Object_toString01 extends JTTTest {
 
@@ -47,17 +47,17 @@
         return string;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/String_intern02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/String_intern02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -33,17 +33,17 @@
         return ("id" + i).intern() == ("id" + i).intern();
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/String_intern03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/String_intern03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.lang;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -33,17 +33,17 @@
         return ("id" + i).intern().equals("id" + i);
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopParseLong.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopParseLong.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.loop;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class LoopParseLong extends JTTTest {
 
@@ -79,7 +79,7 @@
         return negative ? result : -result;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "7", 10);
         runTest("test", "-100", 10);
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopSwitch01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopSwitch01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.loop;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -58,7 +58,7 @@
         return "" + ('a' + count);
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/BigObjectParams02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/BigObjectParams02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.micro;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -33,7 +33,7 @@
         return p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/Matrix01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/Matrix01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.micro;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -155,32 +155,32 @@
         ((Matrix[]) array)[val % array.length] = new Matrix(number);
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/ReferenceMap01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/ReferenceMap01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.micro;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -57,7 +57,7 @@
         return Integer.valueOf(foo(new String[]{"asdf"}));
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/StrangeFrames.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/StrangeFrames.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.micro;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -58,7 +58,7 @@
         Object c = b;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.util.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -117,22 +117,22 @@
         return c2 ? 1 : 0;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 10);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 20);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 40);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/NCE_FlowSensitive05.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/NCE_FlowSensitive05.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.optimize;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -40,7 +40,7 @@
         return (String) arg;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", (Object) null);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/VN_InstanceOf02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/VN_InstanceOf02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.optimize;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  * Tests value numbering of instanceof operations.
@@ -76,17 +76,17 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getField01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getField01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -37,22 +37,22 @@
         return Class_getField01.class.getField(input).getName();
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "test");
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", "field");
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", "field2");
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", "field3");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getField02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getField02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -42,27 +42,27 @@
         public String field4;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "test");
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", "field");
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", "field2");
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", "field3");
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", "field4");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getMethod01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getMethod01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -39,17 +39,17 @@
         field = args[0];
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "test");
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", "main");
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", "xx");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getMethod02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_getMethod02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -52,37 +52,37 @@
         field = args[0];
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_newInstance03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Class_newInstance03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Class_newInstance03 extends JTTTest {
 
@@ -45,27 +45,27 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -59,47 +59,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -61,47 +61,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -89,47 +89,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get04.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_get04.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -61,47 +61,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_getType01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_getType01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -59,47 +59,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -67,47 +67,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -69,47 +69,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Field_set03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -69,47 +69,47 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
 
-    @Test
+    @LongTest
     public void run6() throws Throwable {
         runTest("test", 6);
     }
 
-    @Test
+    @LongTest
     public void run7() throws Throwable {
         runTest("test", 7);
     }
 
-    @Test
+    @LongTest
     public void run8() throws Throwable {
         runTest("test", 8);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_except01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_except01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -56,27 +56,27 @@
         return arg.length;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_main01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_main01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -44,12 +44,12 @@
         field = args[0];
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "test1");
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", "test2");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_main03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Invoke_main03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
 
 import java.lang.reflect.*;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -48,12 +48,12 @@
         field = args[0];
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", "test1");
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", "test2");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Method_getParameterTypes01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Method_getParameterTypes01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -51,22 +51,22 @@
     public void method3(int arg1, Object arg2) {
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Method_getReturnType01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Method_getReturnType01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.reflect;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -51,22 +51,22 @@
     public void method3() {
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Monitor_contended01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Monitor_contended01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Monitor_contended01 extends JTTTest implements Runnable {
 
@@ -71,7 +71,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Monitor_notowner01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Monitor_notowner01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Monitor_notowner01 extends JTTTest {
 
@@ -62,7 +62,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Object_wait01 extends JTTTest implements Runnable {
 
@@ -57,22 +57,22 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 15);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Object_wait02 extends JTTTest implements Runnable {
 
@@ -57,17 +57,17 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Object_wait03 extends JTTTest implements Runnable {
 
@@ -63,17 +63,17 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait04.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Object_wait04.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Object_wait04 extends JTTTest implements Runnable {
 
@@ -67,32 +67,32 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
 
-    @Test
+    @LongTest
     public void run5() throws Throwable {
         runTest("test", 5);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/ThreadLocal03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/ThreadLocal03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -59,22 +59,22 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_getState02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_getState02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Thread_getState02 extends JTTTest {
 
@@ -33,7 +33,7 @@
         return new Thread().getState() == Thread.State.NEW;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -26,8 +26,8 @@
 
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 //Test all, mainly monitors
 public class Thread_isInterrupted02 extends JTTTest {
@@ -85,12 +85,12 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0, 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1, 500);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -68,7 +68,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted04.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted04.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -66,7 +66,7 @@
 
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted05.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_isInterrupted05.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 /*
  */
@@ -66,7 +66,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Thread_join01 extends JTTTest implements Runnable {
 
@@ -43,7 +43,7 @@
         cont = false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -27,8 +27,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Thread_join02 extends JTTTest implements Runnable {
 
@@ -50,7 +50,7 @@
         cont = false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join03.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_join03.java	Tue Mar 19 11:35:25 2013 +0100
@@ -27,8 +27,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Thread_join03 extends JTTTest implements Runnable {
 
@@ -47,7 +47,7 @@
         cont = false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test");
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_new01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_new01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Thread_new01 extends JTTTest {
 
@@ -45,27 +45,27 @@
         return false;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_new02.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_new02.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public class Thread_new02 extends JTTTest implements Runnable {
 
@@ -51,27 +51,27 @@
         // do nothing.
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 0);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 1);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 2);
     }
 
-    @Test
+    @LongTest
     public void run3() throws Throwable {
         runTest("test", 3);
     }
 
-    @Test
+    @LongTest
     public void run4() throws Throwable {
         runTest("test", 4);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_sleep01.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/threads/Thread_sleep01.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,8 +24,8 @@
  */
 package com.oracle.graal.jtt.threads;
 
+import com.oracle.graal.test.*;
 import com.oracle.graal.jtt.*;
-import org.junit.*;
 
 public final class Thread_sleep01 extends JTTTest {
 
@@ -35,17 +35,17 @@
         return System.currentTimeMillis() - before >= i;
     }
 
-    @Test
+    @LongTest
     public void run0() throws Throwable {
         runTest("test", 10);
     }
 
-    @Test
+    @LongTest
     public void run1() throws Throwable {
         runTest("test", 20);
     }
 
-    @Test
+    @LongTest
     public void run2() throws Throwable {
         runTest("test", 100);
     }
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Tue Mar 19 11:35:25 2013 +0100
@@ -31,6 +31,7 @@
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.LIRInstruction.Opcode;
 import com.oracle.graal.lir.asm.*;
+import com.oracle.graal.nodes.spi.*;
 
 public class AMD64Call {
 
@@ -42,9 +43,9 @@
         @Temp protected Value[] temps;
         @State protected LIRFrameState state;
 
-        protected final InvokeTarget callTarget;
+        protected final ResolvedJavaMethod callTarget;
 
-        public DirectCallOp(InvokeTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) {
+        public DirectCallOp(ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) {
             this.callTarget = callTarget;
             this.result = result;
             this.parameters = parameters;
@@ -55,18 +56,59 @@
 
         @Override
         public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            emitAlignmentForDirectCall(tasm, masm);
-            directCall(tasm, masm, callTarget, state);
+            directCall(tasm, masm, callTarget, null, true, state);
+        }
+    }
+
+    @Opcode("CALL_NEAR_RUNTIME")
+    public static class DirectNearRuntimeCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+
+        @Def({REG, ILLEGAL}) protected Value result;
+        @Use({REG, STACK}) protected Value[] parameters;
+        @Temp protected Value[] temps;
+        @State protected LIRFrameState state;
+
+        protected final RuntimeCallTarget callTarget;
+
+        public DirectNearRuntimeCallOp(RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) {
+            this.callTarget = callTarget;
+            this.result = result;
+            this.parameters = parameters;
+            this.state = state;
+            this.temps = temps;
+            assert temps != null;
         }
 
-        protected void emitAlignmentForDirectCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-            // make sure that the displacement word of the call ends up word aligned
-            int offset = masm.codeBuffer.position();
-            offset += tasm.target.arch.getMachineCodeCallDisplacementOffset();
-            int modulus = tasm.target.wordSize;
-            if (offset % modulus != 0) {
-                masm.nop(modulus - offset % modulus);
-            }
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            directCall(tasm, masm, callTarget, null, false, state);
+        }
+    }
+
+    @Opcode("CALL_FAR_RUNTIME")
+    public static class DirectFarRuntimeCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+
+        @Def({REG, ILLEGAL}) protected Value result;
+        @Use({REG, STACK}) protected Value[] parameters;
+        @Temp protected Value[] temps;
+        @State protected LIRFrameState state;
+        @Temp({REG}) protected AllocatableValue callTemp;
+
+        protected final RuntimeCallTarget callTarget;
+
+        public DirectFarRuntimeCallOp(LIRGeneratorTool gen, RuntimeCallTarget callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) {
+            this.callTarget = callTarget;
+            this.result = result;
+            this.parameters = parameters;
+            this.state = state;
+            this.temps = temps;
+            assert temps != null;
+            callTemp = gen.newVariable(Kind.Long);
+        }
+
+        @Override
+        public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+            directCall(tasm, masm, callTarget, ((RegisterValue) callTemp).getRegister(), false, state);
         }
     }
 
@@ -103,20 +145,16 @@
         }
     }
 
-    public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, InvokeTarget callTarget, LIRFrameState info) {
+    public static void directCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm, InvokeTarget callTarget, Register scratch, boolean align, LIRFrameState info) {
+        if (align) {
+            emitAlignmentForDirectCall(tasm, masm);
+        }
         int before = masm.codeBuffer.position();
-        if (callTarget instanceof RuntimeCallTarget) {
-            long maxOffset = ((RuntimeCallTarget) callTarget).getMaxCallTargetOffset();
-            if (maxOffset != (int) maxOffset) {
-                // offset might not fit a 32-bit immediate, generate an
-                // indirect call with a 64-bit immediate
-                Register scratch = tasm.frameMap.registerConfig.getScratchRegister();
-                masm.movq(scratch, 0L);
-                masm.call(scratch);
-            } else {
-                masm.call();
-            }
-
+        if (scratch != null) {
+            // offset might not fit a 32-bit immediate, generate an
+            // indirect call with a 64-bit immediate
+            masm.movq(scratch, 0L);
+            masm.call(scratch);
         } else {
             masm.call();
         }
@@ -126,6 +164,16 @@
         masm.ensureUniquePC();
     }
 
+    protected static void emitAlignmentForDirectCall(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
+        // make sure that the displacement word of the call ends up word aligned
+        int offset = masm.codeBuffer.position();
+        offset += tasm.target.arch.getMachineCodeCallDisplacementOffset();
+        int modulus = tasm.target.wordSize;
+        if (offset % modulus != 0) {
+            masm.nop(modulus - offset % modulus);
+        }
+    }
+
     public static void directJmp(TargetMethodAssembler tasm, AMD64MacroAssembler masm, InvokeTarget target) {
         int before = masm.codeBuffer.position();
         masm.jmp(0, true);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java	Tue Mar 19 11:35:25 2013 +0100
@@ -32,39 +32,13 @@
  * reference of block B from block A only via the tuple (A, successor-index-of-B), i.e., indirectly
  * by storing the index into the successor list of A. Note that therefore it is not allowed to
  * reorder the successor list!
- * 
- * Labels of out-of-line stubs can be referenced directly, therefore it is also possible to
- * construct a LabelRef for a Label directly via {@link #forLabel}.
  */
 public abstract class LabelRef {
 
     public abstract Label label();
 
     /**
-     * Returns a new reference to a statically defined label.
-     * 
-     * @param label The label that is always returned.
-     * @return The newly created label reference.
-     */
-    public static LabelRef forLabel(final Label label) {
-        return new LabelRef() {
-
-            @Override
-            public Label label() {
-                return label;
-            }
-
-            @Override
-            public String toString() {
-                return label.toString();
-            }
-        };
-    }
-
-    /**
-     * Returns a new reference to a successor of the given block. This allows to reference the given
-     * successor even when the successor list is modified between the creation of the reference and
-     * the call to {@link #forLabel(Label)}.
+     * Returns a new reference to a successor of the given block.
      * 
      * @param block The base block that contains the successor list.
      * @param suxIndex The index of the successor.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractCallTargetNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractCallTargetNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -32,10 +32,10 @@
 
     private final Stamp returnStamp;
     private final JavaType[] signature;
-    private final InvokeTarget target;
+    private final ResolvedJavaMethod target;
     private final CallingConvention.Type callType;
 
-    public AbstractCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, InvokeTarget target, CallingConvention.Type callType) {
+    public AbstractCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType) {
         super(arguments);
         this.returnStamp = returnStamp;
         this.signature = signature;
@@ -52,7 +52,7 @@
         return signature;
     }
 
-    public InvokeTarget target() {
+    public ResolvedJavaMethod target() {
         return target;
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DirectCallTargetNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -30,18 +30,12 @@
 
 public class DirectCallTargetNode extends AbstractCallTargetNode {
 
-    public DirectCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, InvokeTarget target, CallingConvention.Type callType) {
+    public DirectCallTargetNode(List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType) {
         super(arguments, returnStamp, signature, target, callType);
     }
 
     @Override
     public String targetName() {
-        if (target() instanceof JavaMethod) {
-            return "Direct#" + ((JavaMethod) target()).getName();
-        } else if (target() != null) {
-            return "Direct#" + target().getClass().getSimpleName();
-        } else {
-            return "Direct#null";
-        }
+        return "Direct#" + ((JavaMethod) target()).getName();
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -95,15 +95,9 @@
         if (condition() instanceof LogicConstantNode) {
             LogicConstantNode c = (LogicConstantNode) condition();
             if (c.getValue() != negated) {
-                if (!dependencies().isEmpty()) {
-                    for (Node usage : usages()) {
-                        if (usage instanceof ValueNode) {
-                            ((ValueNode) usage).dependencies().addAll(dependencies());
-                        }
-                    }
+                if (dependencies().size() == 1) {
+                    return dependencies().get(0);
                 }
-                this.replaceAtUsages(null);
-                return null;
             }
         }
         return this;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IndirectCallTargetNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -32,7 +32,7 @@
 
     @Input protected ValueNode computedAddress;
 
-    public IndirectCallTargetNode(ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, InvokeTarget target, CallingConvention.Type callType) {
+    public IndirectCallTargetNode(ValueNode computedAddress, List<ValueNode> arguments, Stamp returnStamp, JavaType[] signature, ResolvedJavaMethod target, CallingConvention.Type callType) {
         super(arguments, returnStamp, signature, target, callType);
         this.computedAddress = computedAddress;
     }
@@ -43,12 +43,6 @@
 
     @Override
     public String targetName() {
-        if (target() instanceof JavaMethod) {
-            return "Indirect#" + ((JavaMethod) target()).getName();
-        } else if (target() != null) {
-            return "Indirect#" + target().getClass().getSimpleName();
-        } else {
-            return "Indirect#null";
-        }
+        return "Indirect#" + ((JavaMethod) target()).getName();
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -200,6 +200,7 @@
     public ValueNode singleValue() {
         ValueNode differentValue = null;
         for (ValueNode n : values()) {
+            assert n != null : "Must have input value!";
             if (n != this) {
                 if (differentValue == null) {
                     differentValue = n;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -31,7 +31,7 @@
  * Unwind takes an exception object, destroys the current stack frame and passes the exception
  * object to the system's exception dispatch code.
  */
-public final class UnwindNode extends FixedNode implements LIRLowerable, Node.IterableNodeType {
+public final class UnwindNode extends FixedNode implements Lowerable, LIRLowerable, Node.IterableNodeType {
 
     @Input private ValueNode exception;
 
@@ -49,4 +49,9 @@
     public void generate(LIRGeneratorTool gen) {
         gen.emitUnwind(gen.operand(exception()));
     }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        tool.getRuntime().lower(this, tool);
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -28,7 +28,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
-import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
@@ -38,9 +37,16 @@
 public final class ValueAnchorNode extends FixedWithNextNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Virtualizable {
 
     public ValueAnchorNode(ValueNode... values) {
+        this(false, values);
+    }
+
+    public ValueAnchorNode(boolean permanent, ValueNode... values) {
         super(StampFactory.dependency(), values);
+        this.permanent = permanent;
     }
 
+    private final boolean permanent;
+
     @Override
     public void generate(LIRGeneratorTool gen) {
         // Nothing to emit, since this node is used for structural purposes only.
@@ -54,6 +60,9 @@
 
     @Override
     public ValueNode canonical(CanonicalizerTool tool) {
+        if (permanent) {
+            return this;
+        }
         if (this.predecessor() instanceof ValueAnchorNode) {
             ValueAnchorNode previousAnchor = (ValueAnchorNode) this.predecessor();
             if (previousAnchor.usages().isEmpty()) { // avoid creating cycles
@@ -88,12 +97,8 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        // don't process this node if it is anchoring the return value
-        if (next() instanceof MonitorExitNode) {
-            MonitorExitNode monitorExit = (MonitorExitNode) next();
-            if (monitorExit.stateAfter() != null && monitorExit.stateAfter().bci == FrameState.AFTER_BCI && monitorExit.next() instanceof ReturnNode) {
-                return;
-            }
+        if (permanent) {
+            return;
         }
         for (ValueNode node : dependencies().nonNull().and(isNotA(BeginNode.class))) {
             State state = tool.getObjectState(node);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -32,7 +32,7 @@
  * The {@code ExceptionObject} instruction represents the incoming exception object to an exception
  * handler.
  */
-public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint {
+public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, Lowerable, LIRLowerable, MemoryCheckpoint {
 
     /**
      * Constructs a new ExceptionObject instruction.
@@ -52,6 +52,11 @@
     }
 
     @Override
+    public void lower(LoweringTool tool) {
+        tool.getRuntime().lower(this, tool);
+    }
+
+    @Override
     public boolean verify() {
         assertTrue(stateAfter() != null, "an exception handler needs a frame state");
         return super.verify();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java	Tue Mar 19 11:30:58 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2012, 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.common;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.util.*;
-import com.oracle.graal.phases.*;
-
-public class ConvertUnreachedToGuardPhase extends Phase {
-
-    private OptimisticOptimizations opt;
-
-    public ConvertUnreachedToGuardPhase(OptimisticOptimizations opt) {
-        this.opt = opt;
-    }
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        if (!opt.removeNeverExecutedCode()) {
-            return;
-        }
-        for (Node node : graph.getNodes()) {
-            if (node instanceof IfNode) {
-                IfNode ifNode = (IfNode) node;
-                BeginNode insertGuard = null;
-                BeginNode delete = null;
-                boolean inverted = false;
-                if (ifNode.probability(ifNode.trueSuccessor()) == 0) {
-                    insertGuard = ifNode.falseSuccessor();
-                    delete = ifNode.trueSuccessor();
-                    inverted = true;
-                } else if (ifNode.probability(ifNode.falseSuccessor()) == 0) {
-                    insertGuard = ifNode.trueSuccessor();
-                    delete = ifNode.falseSuccessor();
-                }
-                if (insertGuard != null) {
-                    GuardNode guard = graph.unique(new GuardNode(ifNode.condition(), BeginNode.prevBegin(ifNode), DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile,
-                                    inverted));
-                    graph.addBeforeFixed(ifNode, graph.add(new ValueAnchorNode(guard)));
-                    GraphUtil.killCFG(delete);
-                    graph.removeSplit(ifNode, inverted ? ifNode.falseSuccessor() : ifNode.trueSuccessor());
-                }
-            }
-        }
-
-    }
-
-}
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Tue Mar 19 11:35:25 2013 +0100
@@ -185,7 +185,7 @@
     public static boolean SupportJsrBytecodes                = true;
 
     public static boolean OptAssumptions                     = true;
-    public static boolean OptConvertDeoptsToGuards           = ____;
+    public static boolean OptConvertDeoptsToGuards           = true;
     public static boolean OptReadElimination                 = true;
     public static boolean OptCanonicalizer                   = true;
     public static boolean OptScheduleOutOfLoops              = true;
@@ -212,6 +212,12 @@
     public static boolean IntrinsifyAESMethods               = true;
 
     /**
+     * Method arguments that are passed on the stack can be optimized by the register allocator to avoid spilling 
+     * and reloading. However, this requires that the runtime visits method arguments during stack walking.  
+     */
+    public static boolean IncomingMethodArgumentsGCSafe      = true;
+
+    /**
      * Counts the various paths taken through snippets.
      */
     public static boolean SnippetCounters = false;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Tue Mar 19 11:35:25 2013 +0100
@@ -134,16 +134,23 @@
     private BlockMap<List<ScheduledNode>> blockToNodesMap;
     private final Map<FloatingNode, List<FixedNode>> phantomUsages = new IdentityHashMap<>();
     private final Map<FixedNode, List<FloatingNode>> phantomInputs = new IdentityHashMap<>();
+    private final SchedulingStrategy selectedStrategy;
+
+    public SchedulePhase() {
+        this(GraalOptions.OptScheduleOutOfLoops ? SchedulingStrategy.LATEST_OUT_OF_LOOPS : SchedulingStrategy.LATEST);
+    }
+
+    public SchedulePhase(SchedulingStrategy strategy) {
+        this.selectedStrategy = strategy;
+    }
 
     @Override
     protected void run(StructuredGraph graph) {
-        SchedulingStrategy strategy = GraalOptions.OptScheduleOutOfLoops ? SchedulingStrategy.LATEST_OUT_OF_LOOPS : SchedulingStrategy.LATEST;
-
         cfg = ControlFlowGraph.compute(graph, true, true, true, false);
         earliestCache = graph.createNodeMap();
         blockToNodesMap = new BlockMap<>(cfg);
 
-        if (GraalOptions.MemoryAwareScheduling && graph.getNodes(FloatingReadNode.class).isNotEmpty()) {
+        if (GraalOptions.MemoryAwareScheduling && selectedStrategy != SchedulingStrategy.EARLIEST && graph.getNodes(FloatingReadNode.class).isNotEmpty()) {
 
             assignBlockToNodes(graph, SchedulingStrategy.EARLIEST);
             sortNodesWithinBlocks(graph, SchedulingStrategy.EARLIEST);
@@ -155,8 +162,8 @@
             blockToNodesMap = new BlockMap<>(cfg);
         }
 
-        assignBlockToNodes(graph, strategy);
-        sortNodesWithinBlocks(graph, strategy);
+        assignBlockToNodes(graph, selectedStrategy);
+        sortNodesWithinBlocks(graph, selectedStrategy);
     }
 
     /**
@@ -243,7 +250,8 @@
                     // schedule at the latest position possible in the outermost loop possible
                     Block earliestBlock = earliestBlock(node);
                     block = scheduleOutOfLoops(node, block, earliestBlock);
-                    assert earliestBlock.dominates(block) : "Graph can not be scheduled : inconsistent for " + node + " (" + earliestBlock + " needs to dominate " + block + ")";
+                    assert earliestBlock.dominates(block) : "Graph cannot be scheduled : inconsistent for " + node + ", " + node.usages().count() + " usages, (" + earliestBlock +
+                                    " needs to dominate " + block + ")";
                 }
                 break;
             default:
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Tue Mar 19 11:35:25 2013 +0100
@@ -151,32 +151,11 @@
             cfgPrinter.printCFG(message, Arrays.asList(cfgPrinter.cfg.getBlocks()));
 
         } else if (object instanceof CompilationResult) {
-            final CompilationResult tm = (CompilationResult) object;
-            final byte[] code = Arrays.copyOf(tm.getTargetCode(), tm.getTargetCodeSize());
-            CodeInfo info = new CodeInfo() {
-
-                public ResolvedJavaMethod getMethod() {
-                    return curMethod;
-                }
-
-                public long getStart() {
-                    return 0L;
-                }
-
-                public byte[] getCode() {
-                    return code;
-                }
-
-                @Override
-                public String toString() {
-                    int size = code == null ? 0 : code.length;
-                    return getMethod() + " installed code; length = " + size;
-                }
-            };
-            cfgPrinter.printMachineCode(runtime.disassemble(info, tm), message);
-        } else if (isCompilationResultAndCodeInfo(object)) {
+            final CompilationResult compResult = (CompilationResult) object;
+            cfgPrinter.printMachineCode(runtime.disassemble(compResult, null), message);
+        } else if (isCompilationResultAndInstalledCode(object)) {
             Object[] tuple = (Object[]) object;
-            cfgPrinter.printMachineCode(runtime.disassemble((CodeInfo) tuple[1], (CompilationResult) tuple[0]), message);
+            cfgPrinter.printMachineCode(runtime.disassemble((CompilationResult) tuple[0], (InstalledCode) tuple[1]), message);
         } else if (object instanceof Interval[]) {
             cfgPrinter.printIntervals(message, (Interval[]) object);
 
@@ -189,10 +168,10 @@
         cfgPrinter.flush();
     }
 
-    private static boolean isCompilationResultAndCodeInfo(Object object) {
+    private static boolean isCompilationResultAndInstalledCode(Object object) {
         if (object instanceof Object[]) {
             Object[] tuple = (Object[]) object;
-            if (tuple.length == 2 && tuple[0] instanceof CompilationResult && tuple[1] instanceof CodeInfo) {
+            if (tuple.length == 2 && tuple[0] instanceof CompilationResult && tuple[1] instanceof InstalledCode) {
                 return true;
             }
         }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,9 +22,9 @@
  */
 package com.oracle.graal.snippets;
 
-import org.junit.*;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 
@@ -42,7 +42,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test1() {
         test("asNumber", profile(), 111);
         test("asNumber", profile(Integer.class), 111);
@@ -52,7 +52,7 @@
         test("asNumberExt", profile(Long.class, Short.class), 111);
     }
 
-    @Test
+    @LongTest
     public void test2() {
         test("asString", profile(), "111");
         test("asString", profile(String.class), "111");
@@ -68,27 +68,27 @@
         test("asStringExt", profile(String.class), "111");
     }
 
-    @Test
+    @LongTest
     public void test3() {
         test("asNumber", profile(), "111");
     }
 
-    @Test
+    @LongTest
     public void test4() {
         test("asString", profile(String.class), 111);
     }
 
-    @Test
+    @LongTest
     public void test5() {
         test("asNumberExt", profile(), "111");
     }
 
-    @Test
+    @LongTest
     public void test6() {
         test("asStringExt", profile(String.class), 111);
     }
 
-    @Test
+    @LongTest
     public void test7() {
         Throwable throwable = new Exception();
         test("asThrowable", profile(), throwable);
@@ -96,12 +96,12 @@
         test("asThrowable", profile(Exception.class, Error.class), throwable);
     }
 
-    @Test
+    @LongTest
     public void test8() {
         test("arrayStore", new Object[100], "111");
     }
 
-    @Test
+    @LongTest
     public void test8_1() {
         test("arrayFill", new Object[100], "111");
     }
@@ -198,7 +198,7 @@
         return (Cloneable) o;
     }
 
-    @Test
+    @LongTest
     public void test9() {
         Object o = new Depth13();
         test("asDepth12", profile(), o);
@@ -206,7 +206,7 @@
         test("asDepth12", profile(Depth13.class, Depth14.class), o);
     }
 
-    @Test
+    @LongTest
     public void test10() {
         Object o = new Depth13[3][];
         test("asDepth12Arr", o);
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfDynamicTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfDynamicTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -22,8 +22,7 @@
  */
 package com.oracle.graal.snippets;
 
-import org.junit.*;
-
+import com.oracle.graal.test.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.nodes.java.*;
 
@@ -36,7 +35,7 @@
         return value;
     }
 
-    @Test
+    @LongTest
     public void test100() {
         final Object nul = null;
         test("isStringDynamic", nul);
@@ -44,7 +43,7 @@
         test("isStringDynamic", Object.class);
     }
 
-    @Test
+    @LongTest
     public void test101() {
         final Object nul = null;
         test("isStringIntDynamic", nul);
@@ -52,7 +51,7 @@
         test("isStringIntDynamic", Object.class);
     }
 
-    @Test
+    @LongTest
     public void test103() {
         test("isInstanceDynamic", String.class, null);
         test("isInstanceDynamic", String.class, "object");
@@ -62,7 +61,7 @@
         test("isInstanceDynamic", int.class, Object.class);
     }
 
-    @Test
+    @LongTest
     public void test104() {
         test("isInstanceIntDynamic", String.class, null);
         test("isInstanceIntDynamic", String.class, "object");
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,12 +24,12 @@
 
 import java.util.*;
 
-import org.junit.*;
 
 import com.oracle.graal.api.code.CompilationResult.Call;
 import com.oracle.graal.api.code.CompilationResult.Mark;
 import com.oracle.graal.api.code.CompilationResult.Site;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.phases.*;
@@ -57,7 +57,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test1() {
         test("isString", profile(), "object");
         test("isString", profile(String.class), "object");
@@ -66,7 +66,7 @@
         test("isString", profile(String.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test2() {
         test("isStringInt", profile(), "object");
         test("isStringInt", profile(String.class), "object");
@@ -75,7 +75,7 @@
         test("isStringInt", profile(String.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test2_1() {
         test("isStringIntComplex", profile(), "object");
         test("isStringIntComplex", profile(String.class), "object");
@@ -84,7 +84,7 @@
         test("isStringIntComplex", profile(String.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test3() {
         Throwable throwable = new Exception();
         test("isThrowable", profile(), throwable);
@@ -96,7 +96,7 @@
         test("isThrowable", profile(Exception.class, Error.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test3_1() {
         onlyFirstIsException(new Exception(), new Error());
         test("onlyFirstIsException", profile(), new Exception(), new Error());
@@ -105,7 +105,7 @@
         test("onlyFirstIsException", profile(), new Error(), new Error());
     }
 
-    @Test
+    @LongTest
     public void test4() {
         Throwable throwable = new Exception();
         test("isThrowableInt", profile(), throwable);
@@ -117,7 +117,7 @@
         test("isThrowableInt", profile(Exception.class, Error.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test5() {
         Map map = new HashMap<>();
         test("isMap", profile(), map);
@@ -129,7 +129,7 @@
         test("isMap", profile(TreeMap.class, HashMap.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test6() {
         Map map = new HashMap<>();
         test("isMapInt", profile(), map);
@@ -141,7 +141,7 @@
         test("isMapInt", profile(TreeMap.class, HashMap.class), Object.class);
     }
 
-    @Test
+    @LongTest
     public void test7() {
         Object o = new Depth13();
         test("isDepth12", profile(), o);
@@ -154,7 +154,7 @@
         test("isDepth12", profile(Depth13.class, Depth14.class), o);
     }
 
-    @Test
+    @LongTest
     public void test8() {
         Object o = new Depth13();
         test("isDepth12Int", profile(), o);
@@ -260,7 +260,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test9() {
         MyCall callAt63 = new MyCall(63);
         MyMark markAt63 = new MyMark(63);
@@ -277,7 +277,7 @@
         return s1.offset - s2.offset;
     }
 
-    @Test
+    @LongTest
     public void test10() {
         Mark[] noMarks = {};
         Call callAt63 = new Call(null, 63, 5, true, null);
@@ -302,7 +302,7 @@
      * The test exists in this source file as the transformation was originally motivated by the
      * need to remove use of special JumpNodes in the {@code InstanceOfSnippets}.
      */
-    @Test
+    @LongTest
     public void test_removeIntermediateMaterialization() {
         List<String> list = Arrays.asList("1", "2", "3", "4");
         test("removeIntermediateMaterialization", profile(), list, "2", "yes", "no");
@@ -357,7 +357,7 @@
         return o instanceof D[];
     }
 
-    @Test
+    @LongTest
     public void testArray() {
         Object aArray = new A[10];
         test("isArrayOfA", aArray);
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -25,6 +25,7 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.test.*;
 
 /**
  * Tests the implementation of {@code [A]NEWARRAY}.
@@ -57,7 +58,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test1() {
         for (String type : new String[]{"Byte", "Char", "Short", "Int", "Float", "Long", "Double", "String"}) {
             test("new" + type + "Array7");
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -27,6 +27,7 @@
 import org.junit.*;
 
 import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.test.*;
 
 /**
  * Tests the implementation of {@code NEW}.
@@ -56,12 +57,12 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test1() {
         test("newObject");
     }
 
-    @Test
+    @LongTest
     public void test2() {
         test("newObjectTwice");
     }
@@ -70,37 +71,37 @@
         return new Object();
     }
 
-    @Test
+    @LongTest
     public void test3() {
         test("newObjectLoop", 100);
     }
 
-    @Test
+    @LongTest
     public void test4() {
         test("newBigObject");
     }
 
-    @Test
+    @LongTest
     public void test5() {
         test("newSomeObject");
     }
 
-    @Test
+    @LongTest
     public void test6() {
         test("newEmptyString");
     }
 
-    @Test
+    @LongTest
     public void test7() {
         test("newString", "value");
     }
 
-    @Test
+    @LongTest
     public void test8() {
         test("newHashMap", 31);
     }
 
-    @Test
+    @LongTest
     public void test9() {
         test("newRegression", true);
     }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -25,11 +25,10 @@
 import java.lang.reflect.*;
 import java.util.*;
 
-import org.junit.*;
-
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
+import com.oracle.graal.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 
@@ -87,7 +86,7 @@
     Class bottomClass;
     int[] dimensions;
 
-    @Test
+    @LongTest
     public void test1() {
         for (Class clazz : new Class[]{byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) {
             bottomClass = clazz;
@@ -118,7 +117,7 @@
         return new Object[10][9][8];
     }
 
-    @Test
+    @LongTest
     public void test2() {
         test("newMultiArrayException");
     }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -24,12 +24,11 @@
 
 import java.lang.reflect.*;
 
-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.*;
+import com.oracle.graal.test.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.snippets.Snippet.SnippetInliningPolicy;
 import com.oracle.graal.word.*;
@@ -54,7 +53,7 @@
         return installer.makeGraph(resolvedMethod, inliningPolicy.get());
     }
 
-    @Test
+    @LongTest
     public void construction() {
         long[] words = new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1, -1L, 0L, 1L, Long.MAX_VALUE - 1, Long.MAX_VALUE, Integer.MAX_VALUE - 1L, Integer.MAX_VALUE, Integer.MAX_VALUE + 1L,
                         Integer.MIN_VALUE - 1L, Integer.MIN_VALUE, Integer.MIN_VALUE + 1L};
@@ -66,7 +65,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test_arithmetic() {
         long[] words = new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1, -1L, 0L, 1L, Long.MAX_VALUE - 1, Long.MAX_VALUE, Integer.MAX_VALUE - 1L, Integer.MAX_VALUE, Integer.MAX_VALUE + 1L,
                         Integer.MIN_VALUE - 1L, Integer.MIN_VALUE, Integer.MIN_VALUE + 1L};
@@ -103,7 +102,7 @@
         }
     }
 
-    @Test
+    @LongTest
     public void test_compare() {
         long[] words = new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1, -1L, 0L, 1L, Long.MAX_VALUE - 1, Long.MAX_VALUE};
         for (long word1 : words) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java	Tue Mar 19 11:35:25 2013 +0100
@@ -125,13 +125,13 @@
                 }
                 String originalName = originalName(substituteMethod, methodSubstitution.value());
                 Class[] originalParameters = originalParameters(substituteMethod, methodSubstitution.signature(), methodSubstitution.isStatic());
-                Method originalMethod = originalMethod(classSubstitution, originalName, originalParameters);
+                Member originalMethod = originalMethod(classSubstitution, originalName, originalParameters);
                 installMethodSubstitution(originalMethod, substituteMethod);
             }
             if (macroSubstitution != null) {
                 String originalName = originalName(substituteMethod, macroSubstitution.value());
                 Class[] originalParameters = originalParameters(substituteMethod, macroSubstitution.signature(), macroSubstitution.isStatic());
-                Method originalMethod = originalMethod(classSubstitution, originalName, originalParameters);
+                Member originalMethod = originalMethod(classSubstitution, originalName, originalParameters);
                 installMacroSubstitution(originalMethod, macroSubstitution.macro());
             }
         }
@@ -145,17 +145,26 @@
     /**
      * Installs a method substitution.
      * 
-     * @param originalMethod a method being substituted
+     * @param originalMethod a method or constructor being substituted
      * @param substituteMethod the substitute method
      */
-    protected void installMethodSubstitution(Method originalMethod, Method substituteMethod) {
+    protected void installMethodSubstitution(Member originalMethod, Method substituteMethod) {
         substitute = runtime.lookupJavaMethod(substituteMethod);
-        original = runtime.lookupJavaMethod(originalMethod);
+        if (originalMethod instanceof Method) {
+            original = runtime.lookupJavaMethod((Method) originalMethod);
+        } else {
+            original = runtime.lookupJavaConstructor((Constructor) originalMethod);
+        }
         try {
-            Debug.log("substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute));
+            Debug.log("inlinable substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute));
             StructuredGraph graph = makeGraph(substitute, inliningPolicy(substitute));
             Object oldValue = original.getCompilerStorage().put(Graph.class, graph);
             assert oldValue == null;
+
+            Debug.log("compilable substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute));
+            graph = makeGraph(substitute, inliningPolicy(substitute));
+            oldValue = original.getCompilerStorage().put(MethodSubstitution.class, graph);
+            assert oldValue == null;
         } finally {
             substitute = null;
             original = null;
@@ -166,11 +175,16 @@
     /**
      * Installs a macro substitution.
      * 
-     * @param originalMethod a method being substituted
+     * @param originalMethod a method or constructor being substituted
      * @param macro the substitute macro node class
      */
-    protected void installMacroSubstitution(Method originalMethod, Class<? extends FixedWithNextNode> macro) {
-        ResolvedJavaMethod originalJavaMethod = runtime.lookupJavaMethod(originalMethod);
+    protected void installMacroSubstitution(Member originalMethod, Class<? extends FixedWithNextNode> macro) {
+        ResolvedJavaMethod originalJavaMethod;
+        if (originalMethod instanceof Method) {
+            originalJavaMethod = runtime.lookupJavaMethod((Method) originalMethod);
+        } else {
+            originalJavaMethod = runtime.lookupJavaConstructor((Constructor) originalMethod);
+        }
         Object oldValue = originalJavaMethod.getCompilerStorage().put(Node.class, macro);
         assert oldValue == null;
     }
@@ -360,13 +374,17 @@
         return parameters;
     }
 
-    private static Method originalMethod(ClassSubstitution classSubstitution, String name, Class[] parameters) {
+    private static Member originalMethod(ClassSubstitution classSubstitution, String name, Class[] parameters) {
         Class<?> originalClass = classSubstitution.value();
         if (originalClass == ClassSubstitution.class) {
             originalClass = resolveType(classSubstitution.className());
         }
         try {
-            return originalClass.getDeclaredMethod(name, parameters);
+            if (name.equals("<init>")) {
+                return originalClass.getDeclaredConstructor(parameters);
+            } else {
+                return originalClass.getDeclaredMethod(name, parameters);
+            }
         } catch (NoSuchMethodException | SecurityException e) {
             throw new GraalInternalError(e);
         }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Tue Mar 19 11:35:25 2013 +0100
@@ -560,7 +560,7 @@
      * @param args the arguments to be bound to the flattened positional parameters of the snippet
      * @return the map of duplicated nodes (original -> duplicate)
      */
-    public Map<Node, Node> instantiate(MetaAccessProvider runtime, FixedWithNextNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) {
+    public Map<Node, Node> instantiate(MetaAccessProvider runtime, FixedNode replacee, UsageReplacer replacer, SnippetTemplate.Arguments args) {
 
         // Inline the snippet nodes, replacing parameters with the given args in the process
         String name = snippet.name == null ? "{copy}" : snippet.name + "{copy}";
@@ -575,8 +575,12 @@
         // Re-wire the control flow graph around the replacee
         FixedNode firstCFGNodeDuplicate = (FixedNode) duplicates.get(firstCFGNode);
         replacee.replaceAtPredecessor(firstCFGNodeDuplicate);
-        FixedNode next = replacee.next();
-        replacee.setNext(null);
+        FixedNode next = null;
+        if (replacee instanceof FixedWithNextNode) {
+            FixedWithNextNode fwn = (FixedWithNextNode) replacee;
+            next = fwn.next();
+            fwn.setNext(null);
+        }
 
         if (replacee instanceof StateSplit) {
             for (StateSplit sideEffectNode : sideEffectNodes) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReadRegisterNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2012, 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.snippets.nodes;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.compiler.gen.*;
+import com.oracle.graal.compiler.target.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.type.*;
+
+/**
+ * Access the value of a specific register.
+ */
+@NodeInfo(nameTemplate = "ReadRegister %{p#register}")
+public final class ReadRegisterNode extends FixedWithNextNode implements LIRGenLowerable {
+
+    /**
+     * The fixed register to access.
+     */
+    private final Register register;
+
+    /**
+     * When true, subsequent uses of this node use the fixed register; when false, the value is
+     * moved into a new virtual register so that the fixed register is not seen by uses.
+     */
+    private final boolean directUse;
+
+    /**
+     * When true, this node is also an implicit definition of the value for the register allocator,
+     * i.e., the register is an implicit incoming value; when false, the register must be defined in
+     * the same method or must be an register excluded from register allocation.
+     */
+    private final boolean incoming;
+
+    public ReadRegisterNode(Register register, Kind kind, boolean directUse, boolean incoming) {
+        super(StampFactory.forKind(kind));
+        this.register = register;
+        this.directUse = directUse;
+        this.incoming = incoming;
+    }
+
+    /**
+     * Constructor to be used by node intrinsics where the stamp is inferred from the intrinsic
+     * definition.
+     */
+    public ReadRegisterNode(Register register, boolean directUse, boolean incoming) {
+        super(StampFactory.forNodeIntrinsic());
+        this.register = register;
+        this.directUse = directUse;
+        this.incoming = incoming;
+    }
+
+    @Override
+    public void generate(LIRGenerator generator) {
+        Value result = register.asValue(kind());
+        if (incoming) {
+            generator.emitIncomingValues(new Value[]{result});
+        }
+        if (!directUse) {
+            result = generator.emitMove(result);
+        }
+        generator.setResult(this, result);
+    }
+
+    @Override
+    public String toString(Verbosity verbosity) {
+        if (verbosity == Verbosity.Name) {
+            return super.toString(Verbosity.Name) + "%" + register;
+        } else {
+            return super.toString(verbosity);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/WriteRegisterNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013, 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.snippets.nodes;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
+
+/**
+ * Changes the value of a specific register.
+ */
+@NodeInfo(nameTemplate = "WriteRegister %{p#register}")
+public final class WriteRegisterNode extends FixedWithNextNode implements LIRLowerable {
+
+    /**
+     * The fixed register to access.
+     */
+    private final Register register;
+
+    /**
+     * The new value assigned to the register.
+     */
+    @Input private ValueNode value;
+
+    public WriteRegisterNode(Register register, ValueNode value) {
+        super(StampFactory.forVoid());
+        this.register = register;
+        this.value = value;
+    }
+
+    @Override
+    public void generate(LIRGeneratorTool generator) {
+        Value val = generator.operand(value);
+        generator.emitMove(val, register.asValue(val.getKind()));
+    }
+
+    @Override
+    public String toString(Verbosity verbosity) {
+        if (verbosity == Verbosity.Name) {
+            return super.toString(Verbosity.Name) + "%" + register;
+        } else {
+            return super.toString(verbosity);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalLongUnitTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * 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.test;
+
+import java.util.*;
+
+import org.junit.*;
+import org.junit.runners.*;
+import org.junit.runners.model.*;
+
+public class GraalLongUnitTest extends BlockJUnit4ClassRunner {
+
+    public GraalLongUnitTest(Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    @Override
+    protected List<FrameworkMethod> computeTestMethods() {
+        List<FrameworkMethod> methods = new ArrayList<>(5);
+        methods.addAll(getTestClass().getAnnotatedMethods(Test.class));
+        methods.addAll(getTestClass().getAnnotatedMethods(LongTest.class));
+        return methods;
+    }
+}
--- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -25,12 +25,14 @@
 import java.lang.reflect.*;
 
 import org.junit.*;
+import org.junit.runner.*;
 
 /**
  * Base class for Graal tests.
  * <p>
  * This contains common utility methods that are used in multiple test projects.
  */
+@RunWith(GraalLongUnitTest.class)
 public class GraalTest {
 
     protected Method getMethod(String methodName) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.test/src/com/oracle/graal/test/LongTest.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,43 @@
+/*
+ * 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.test;
+
+import java.lang.annotation.*;
+
+/* copy of org.junit.Test */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD})
+public @interface LongTest {
+
+    static final class None extends Throwable {
+
+        private static final long serialVersionUID = 1L;
+
+        private None() {
+        }
+    }
+
+    Class<? extends Throwable> expected() default None.class;
+
+    long timeout() default 0L;
+}
--- a/mx/commands.py	Tue Mar 19 11:30:58 2013 +0100
+++ b/mx/commands.py	Tue Mar 19 11:35:25 2013 +0100
@@ -719,7 +719,7 @@
     matches = lambda line : len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0
     return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses)
 
-def _run_tests(args, harness):
+def _run_tests(args, harness, annotations):
     pos = [a for a in args if a[0] != '-' and a[0] != '@' ]
     neg = [a[1:] for a in args if a[0] == '-']
     vmArgs = [a[1:] for a in args if a[0] == '@']
@@ -730,29 +730,52 @@
                 return True
         return False
 
+    classes = []
     for p in mx.projects():
-        classes = _find_classes_with_annotations(p, None, ['@Test'])
+        classes += _find_classes_with_annotations(p, None, annotations)
 
         if len(pos) != 0:
             classes = [c for c in classes if containsAny(c, pos)]
         if len(neg) != 0:
             classes = [c for c in classes if not containsAny(c, neg)]
 
-        if len(classes) != 0:
-            mx.log('running tests in ' + p.name)
-            harness(p, vmArgs, classes)
+    projectscp = mx.classpath([pcp.name for pcp in mx.projects()])
+
+    if len(classes) != 0:
+        harness(projectscp, vmArgs, classes)
+
+def _unittest(args, annotations):
+    def harness(projectscp, vmArgs, classes):
+        prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
+        vm(prefixArgs + vmArgs + ['-cp', projectscp, 'org.junit.runner.JUnitCore'] + classes)
+    _run_tests(args, harness, annotations)
 
 def unittest(args):
-    """run the JUnit tests
+    """run the JUnit tests (all testcases)
 
     If filters are supplied, only tests whose fully qualified name
     include a filter as a substring are run. Negative filters are
     those with a '-' prefix. VM args should have a @ prefix."""
 
-    def harness(p, vmArgs, classes):
-        prefixArgs = ['-XX:-BootstrapGraal', '-esa', '-ea']
-        vm(prefixArgs + vmArgs + ['-cp', mx.classpath(p.name), 'org.junit.runner.JUnitCore'] + classes)
-    _run_tests(args, harness)
+    _unittest(args, ['@Test', '@LongTest'])
+
+def shortunittest(args):
+    """run the JUnit tests (short testcases only)
+
+    If filters are supplied, only tests whose fully qualified name
+    include a filter as a substring are run. Negative filters are
+    those with a '-' prefix. VM args should have a @ prefix."""
+
+    _unittest(args, ['@Test'])
+
+def longunittest(args):
+    """run the JUnit tests (long testcases only)
+
+    If filters are supplied, only tests whose fully qualified name
+    include a filter as a substring are run. Negative filters are
+    those with a '-' prefix. VM args should have a @ prefix."""
+
+    _unittest(args, ['@LongTest'])
 
 def buildvms(args):
     """build one or more VMs in various configurations"""
@@ -872,7 +895,7 @@
         t = Task('BootstrapWithRegisterPressure:product')
         vm(['-G:RegisterPressure=rbx,r11,r14,xmm3,xmm11,xmm14', '-esa', '-version'])
         tasks.append(t.stop())
-        
+
         originalVm = _vm
         _vm = 'server' # hosted mode
         t = Task('UnitTests:hosted-product')
@@ -1193,6 +1216,8 @@
         'gv' : [gv, ''],
         'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'],
         'unittest' : [unittest, '[filters...]'],
+        'longunittest' : [longunittest, '[filters...]'],
+        'shortunittest' : [shortunittest, '[filters...]'],
         'jacocoreport' : [jacocoreport, '[output directory]'],
         'site' : [site, '[-options]'],
         'vm': [vm, '[-options] class [args...]'],
--- a/mx/projects	Tue Mar 19 11:30:58 2013 +0100
+++ b/mx/projects	Tue Mar 19 11:35:25 2013 +0100
@@ -248,7 +248,7 @@
 # graal.compiler.amd64.test
 project@com.oracle.graal.compiler.amd64.test@subDir=graal
 project@com.oracle.graal.compiler.amd64.test@sourceDirs=src
-project@com.oracle.graal.compiler.amd64.test@dependencies=com.oracle.graal.compiler.test
+project@com.oracle.graal.compiler.amd64.test@dependencies=com.oracle.graal.compiler.test,com.oracle.graal.asm.amd64
 project@com.oracle.graal.compiler.amd64.test@checkstyle=com.oracle.graal.graph
 project@com.oracle.graal.compiler.amd64.test@javaCompliance=1.7
 
--- a/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Tue Mar 19 11:35:25 2013 +0100
@@ -30,6 +30,8 @@
 //
   friend class AbstractInterpreterGenerator;
 
+  address generate_deopt_entry_for(TosState state, int step);
+
  private:
 
   address generate_normal_entry(bool synchronized);
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -3408,8 +3408,8 @@
   __ jmp(cont);
 
   int implicit_exception_uncommon_trap_offset = __ pc() - start;
+  // pc where the exception happened is in ScratchA
   __ pushptr(Address(r15_thread, in_bytes(JavaThread::ScratchA_offset())));
-  __ movptr(rscratch1, Address(r15_thread, in_bytes(JavaThread::ScratchB_offset())));
 
   int uncommon_trap_offset = __ pc() - start;
 
@@ -3418,8 +3418,8 @@
   // fetch_unroll_info needs to call last_java_frame()
   __ set_last_Java_frame(noreg, noreg, NULL);
 
-  assert(r10 == rscratch1, "scratch register should be r10");
-  __ movl(c_rarg1, Address(rsp, RegisterSaver::r10_offset_in_bytes()));
+  __ movl(c_rarg1, Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())));
+  __ movl(Address(r15_thread, in_bytes(ThreadShadow::pending_deoptimization_offset())), 0);
 
   __ movl(r14, (int32_t)Deoptimization::Unpack_reexecute);
   __ mov(c_rarg0, r15_thread);
--- a/src/cpu/x86/vm/templateInterpreter_x86.hpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/cpu/x86/vm/templateInterpreter_x86.hpp	Tue Mar 19 11:35:25 2013 +0100
@@ -34,7 +34,7 @@
   // Run with +PrintInterpreter to get the VM to print out the size.
   // Max size with JVMTI
 #ifdef AMD64
-  const static int InterpreterCodeSize = 200 * 1024;
+  const static int InterpreterCodeSize = 220 * 1024;
 #else
   const static int InterpreterCodeSize = 168 * 1024;
 #endif // AMD64
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -204,13 +204,26 @@
 }
 
 
-address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
+address InterpreterGenerator::generate_deopt_entry_for(TosState state,
                                                                int step) {
   address entry = __ pc();
   // NULL last_sp until next java call
   __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
   __ restore_bcp();
   __ restore_locals();
+  // Check if we need to take lock at entry of synchronized method.
+  {
+    Label L;
+    __ cmpb(Address(r15_thread, Thread::pending_monitorenter_offset()), 0);
+    __ jcc(Assembler::zero, L);
+    // Clear flag.
+    __ movb(Address(r15_thread, Thread::pending_monitorenter_offset()), 0);
+    // Satisfy calling convention for lock_method().
+    __ get_method(rbx);
+    // Take lock.
+    lock_method();
+    __ bind(L);
+  }
   // handle exceptions
   {
     Label L;
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/GraphNode.java	Tue Mar 19 11:35:25 2013 +0100
@@ -23,8 +23,10 @@
  */
 package com.sun.hotspot.igv.coordinator;
 
+import com.sun.hotspot.igv.coordinator.actions.CloneGraphAction;
 import com.sun.hotspot.igv.coordinator.actions.DiffGraphAction;
 import com.sun.hotspot.igv.coordinator.actions.DiffGraphCookie;
+import com.sun.hotspot.igv.coordinator.actions.GraphCloneCookie;
 import com.sun.hotspot.igv.coordinator.actions.GraphOpenCookie;
 import com.sun.hotspot.igv.coordinator.actions.GraphRemoveCookie;
 import com.sun.hotspot.igv.data.InputGraph;
@@ -72,6 +74,9 @@
 
         // Action for diffing to the current graph
         content.add(new DiffGraphCookie(graph));
+
+        // Action for cloning to the current graph
+        content.add(new GraphCloneCookie(viewer, graph));
     }
 
     @Override
@@ -97,7 +102,7 @@
 
     @Override
     public Action[] getActions(boolean b) {
-        return new Action[]{(Action) DiffGraphAction.findObject(DiffGraphAction.class, true), (Action) OpenAction.findObject(OpenAction.class, true)};
+        return new Action[]{(Action) DiffGraphAction.findObject(DiffGraphAction.class, true), (Action) CloneGraphAction.findObject(CloneGraphAction.class, true), (Action) OpenAction.findObject(OpenAction.class, true)};
     }
 
     @Override
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/CloneGraphAction.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,89 @@
+/*
+ * 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.sun.hotspot.igv.coordinator.actions;
+
+import org.openide.nodes.Node;
+import org.openide.util.HelpCtx;
+import org.openide.util.actions.CookieAction;
+
+/**
+ *
+ * @author Thomas Wuerthinger
+ */
+public final class CloneGraphAction extends CookieAction {
+
+    @Override
+    protected void performAction(Node[] activatedNodes) {
+        GraphCloneCookie c = activatedNodes[0].getCookie(GraphCloneCookie.class);
+        assert c != null;
+        c.openClone();
+    }
+
+    @Override
+    protected int mode() {
+        return CookieAction.MODE_EXACTLY_ONE;
+    }
+
+    @Override
+    protected boolean enable(Node[] activatedNodes) {
+        boolean b = super.enable(activatedNodes);
+        if (b) {
+            assert activatedNodes.length == 1;
+            GraphCloneCookie c = activatedNodes[0].getCookie(GraphCloneCookie.class);
+            assert c != null;
+            return true;
+        }
+
+        return false;
+    }
+
+    @Override
+    public String getName() {
+        return "Open clone";
+    }
+
+    @Override
+    protected Class<?>[] cookieClasses() {
+        return new Class<?>[]{
+            GraphCloneCookie.class
+        };
+    }
+
+    @Override
+    protected String iconResource() {
+        return "com/sun/hotspot/igv/coordinator/images/graph.png";
+    }
+
+    @Override
+    public HelpCtx getHelpCtx() {
+        return HelpCtx.DEFAULT_HELP;
+    }
+
+    @Override
+    protected boolean asynchronous() {
+        return false;
+    }
+}
+
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/DiffGraphCookie.java	Tue Mar 19 11:35:25 2013 +0100
@@ -60,7 +60,7 @@
         final GraphViewer viewer = Lookup.getDefault().lookup(GraphViewer.class);
         if (viewer != null) {
             InputGraph diffGraph = Difference.createDiffGraph(other, graph);
-            viewer.view(diffGraph);
+            viewer.view(diffGraph, true);
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphCloneCookie.java	Tue Mar 19 11:35:25 2013 +0100
@@ -0,0 +1,43 @@
+/*
+ * 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.sun.hotspot.igv.coordinator.actions;
+
+import com.sun.hotspot.igv.data.InputGraph;
+import com.sun.hotspot.igv.data.services.GraphViewer;
+import org.openide.nodes.Node;
+
+public class GraphCloneCookie implements Node.Cookie {
+
+    private final GraphViewer viewer;
+    private final InputGraph graph;
+
+    public GraphCloneCookie(GraphViewer viewer, InputGraph graph) {
+        this.viewer = viewer;
+        this.graph = graph;
+    }
+
+    public void openClone() {
+        viewer.view(graph, true);
+    }
+}
--- a/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Coordinator/src/com/sun/hotspot/igv/coordinator/actions/GraphOpenCookie.java	Tue Mar 19 11:35:25 2013 +0100
@@ -39,6 +39,6 @@
 
     @Override
     public void open() {
-        viewer.view(graph);
+        viewer.view(graph, false);
     }
 }
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GraphViewer.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/services/GraphViewer.java	Tue Mar 19 11:35:25 2013 +0100
@@ -31,5 +31,5 @@
  */
 public interface GraphViewer {
 
-    public void view(InputGraph graph);
+    public void view(InputGraph graph, boolean clone);
 }
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/DiagramViewModel.java	Tue Mar 19 11:35:25 2013 +0100
@@ -70,6 +70,10 @@
         result.setData(this);
         return result;
     }
+    
+    public Group getGroup() {
+        return group;
+    }
 
     public void setData(DiagramViewModel newModel) {
         super.setData(newModel);
--- a/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/GraphViewerImplementation.java	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/tools/IdealGraphVisualizer/View/src/com/sun/hotspot/igv/view/GraphViewerImplementation.java	Tue Mar 19 11:35:25 2013 +0100
@@ -27,6 +27,9 @@
 import com.sun.hotspot.igv.data.services.GraphViewer;
 import com.sun.hotspot.igv.graph.Diagram;
 import com.sun.hotspot.igv.settings.Settings;
+import org.openide.windows.Mode;
+import org.openide.windows.TopComponent;
+import org.openide.windows.WindowManager;
 
 /**
  *
@@ -35,7 +38,24 @@
 public class GraphViewerImplementation implements GraphViewer {
 
     @Override
-    public void view(InputGraph graph) {
+    public void view(InputGraph graph, boolean clone) {
+        
+        if (!clone) {
+            WindowManager manager = WindowManager.getDefault();
+            for (Mode m : manager.getModes()) {
+                for (TopComponent t : manager.getOpenedTopComponents(m)) {
+                    if (t instanceof EditorTopComponent) {
+                        EditorTopComponent etc = (EditorTopComponent) t;
+                        if (etc.getModel().getGroup().getGraphs().contains(graph)) {
+                            etc.getModel().selectGraph(graph);
+                            t.requestActive();
+                            return;
+                        }
+                    }
+                }
+            }
+        }
+        
         Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
         EditorTopComponent tc = new EditorTopComponent(diagram);
         tc.open();
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -662,6 +662,9 @@
   assert((Klass::_lh_array_tag_obj_value & Klass::_lh_array_tag_type_value & 0x80000000) != 0, "obj_array and type_array must have first bit set");
   set_int("arrayKlassComponentMirrorOffset", in_bytes(ArrayKlass::component_mirror_offset()));
   
+
+  set_int("pendingDeoptimizationOffset", in_bytes(ThreadShadow::pending_deoptimization_offset()));
+
   set_int("metaspaceArrayLengthOffset", Array<Klass*>::length_offset_in_bytes());
   set_int("metaspaceArrayBaseOffset", Array<Klass*>::base_offset_in_bytes());
   set_int("methodDataOopDataOffset", in_bytes(MethodData::data_offset()));
@@ -791,7 +794,7 @@
 
 C2V_END
 
-C2V_VMENTRY(jint, installCode0, (JNIEnv *jniEnv, jobject, jobject compResult, jobject installed_code, jobject info, jobject triggered_deoptimizations))
+C2V_VMENTRY(jint, installCode0, (JNIEnv *jniEnv, jobject, jobject compResult, jobject installed_code, jobject triggered_deoptimizations))
   ResourceMark rm;
   HandleMark hm;
   Handle compResultHandle = JNIHandles::resolve(compResult);
@@ -805,36 +808,29 @@
   if (result != GraalEnv::ok) {
     assert(nm == NULL, "should be");
   } else {
-    if (info != NULL) {
-      arrayOop codeCopy = oopFactory::new_byteArray(nm->code_size(), CHECK_0);
-      memcpy(codeCopy->base(T_BYTE), nm->code_begin(), nm->code_size());
-      HotSpotCodeInfo::set_code(info, codeCopy);
-      HotSpotCodeInfo::set_start(info, (jlong) nm->code_begin());
-    }
-
     if (!installed_code_handle.is_null()) {
       assert(installed_code_handle->is_a(HotSpotInstalledCode::klass()), "wrong type");
       HotSpotInstalledCode::set_nmethod(installed_code_handle, (jlong) nm);
       HotSpotInstalledCode::set_method(installed_code_handle, HotSpotCompilationResult::method(compResult));
+      HotSpotInstalledCode::set_start(installed_code_handle, (jlong) nm->code_begin());
       assert(nm == NULL || !installed_code_handle->is_scavengable() || nm->on_scavenge_root_list(), "nm should be scavengable if installed_code is scavengable");
     }
   }
   return result;
 C2V_END
 
-C2V_VMENTRY(jobject, disassembleNative, (JNIEnv *jniEnv, jobject, jbyteArray code, jlong start_address))
+C2V_VMENTRY(jobject, getCode, (JNIEnv *jniEnv, jobject,  jlong metaspace_nmethod))
   ResourceMark rm;
   HandleMark hm;
 
-  stringStream(st);
-  arrayOop code_oop = (arrayOop) JNIHandles::resolve(code);
-  int len = code_oop->length();
-  address begin = (address) code_oop->base(T_BYTE);
-  address end = begin + len;
-  Disassembler::decode(begin, end, &st);
-
-  Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
-  return JNIHandles::make_local(result());
+  nmethod* nm = (nmethod*) (address) metaspace_nmethod;
+  if (nm == NULL || !nm->is_alive()) {
+    return NULL;
+  }
+  int length = nm->code_size();
+  arrayOop codeCopy = oopFactory::new_byteArray(length, CHECK_0);
+  memcpy(codeCopy->base(T_BYTE), nm->code_begin(), length);
+  return JNIHandles::make_local(codeCopy);
 C2V_END
 
 C2V_VMENTRY(jobject, disassembleNMethod, (JNIEnv *jniEnv, jobject, jlong metaspace_nmethod))
@@ -939,28 +935,7 @@
   return JNIHandles::make_local(array);
 C2V_END
 
-C2V_VMENTRY(jobject, decodePC, (JNIEnv *, jobject, jlong pc))
-  stringStream(st);
-  CodeBlob* blob = CodeCache::find_blob_unsafe((void*) pc);
-  if (blob == NULL) {
-    st.print("[unidentified pc]");
-  } else {
-    st.print(blob->name());
-
-    nmethod* nm = blob->as_nmethod_or_null();
-    if (nm != NULL && nm->method() != NULL) {
-      st.print(" %s.", nm->method()->method_holder()->external_name());
-      nm->method()->name()->print_symbol_on(&st);
-      st.print("  @ %d", pc - (jlong) nm->entry_point());
-    }
-  }
-  Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
-  return JNIHandles::make_local(result());
-C2V_END
-
 C2V_ENTRY(jlongArray, getLineNumberTable, (JNIEnv *env, jobject, jobject hotspot_method))
-// XXX: Attention: it seEms that the line number table of a method just contains lines that are important, means that
-// empty lines are left out or lines that can't have a breakpoint on it; eg int a; or try {
   Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method));
   if (!method->has_linenumber_table()) {
     return NULL;
@@ -1061,7 +1036,6 @@
 #define HS_CONFIG             "Lcom/oracle/graal/hotspot/HotSpotVMConfig;"
 #define HS_METHOD             "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;"
 #define HS_INSTALLED_CODE     "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;"
-#define HS_CODE_INFO          "Lcom/oracle/graal/hotspot/meta/HotSpotCodeInfo;"
 #define METHOD_DATA           "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;"
 #define METASPACE_METHOD      "J"
 #define METASPACE_METHOD_DATA "J"
@@ -1097,13 +1071,12 @@
   {CC"getMetaspaceConstructor",       CC"("REFLECT_CONSTRUCTOR"["HS_RESOLVED_TYPE")"METASPACE_METHOD,   FN_PTR(getMetaspaceConstructor)},
   {CC"getJavaField",                  CC"("REFLECT_FIELD")"HS_RESOLVED_FIELD,                           FN_PTR(getJavaField)},
   {CC"initializeConfiguration",       CC"("HS_CONFIG")V",                                               FN_PTR(initializeConfiguration)},
-  {CC"installCode0",                  CC"("HS_COMP_RESULT HS_INSTALLED_CODE HS_CODE_INFO"[Z)I",         FN_PTR(installCode0)},
-  {CC"disassembleNative",             CC"([BJ)"STRING,                                                  FN_PTR(disassembleNative)},
+  {CC"installCode0",                  CC"("HS_COMP_RESULT HS_INSTALLED_CODE"[Z)I",                      FN_PTR(installCode0)},
+  {CC"getCode",                       CC"(J)[B",                                                        FN_PTR(getCode)},
   {CC"disassembleNMethod",            CC"(J)"STRING,                                                    FN_PTR(disassembleNMethod)},
   {CC"executeCompiledMethod",         CC"("METASPACE_METHOD NMETHOD OBJECT OBJECT OBJECT")"OBJECT,      FN_PTR(executeCompiledMethod)},
   {CC"executeCompiledMethodVarargs",  CC"("METASPACE_METHOD NMETHOD "["OBJECT")"OBJECT,                 FN_PTR(executeCompiledMethodVarargs)},
   {CC"getDeoptedLeafGraphIds",        CC"()[J",                                                         FN_PTR(getDeoptedLeafGraphIds)},
-  {CC"decodePC",                      CC"(J)"STRING,                                                    FN_PTR(decodePC)},
   {CC"getLineNumberTable",            CC"("HS_RESOLVED_METHOD")[J",                                     FN_PTR(getLineNumberTable)},
   {CC"getLocalVariableTable",         CC"("HS_RESOLVED_METHOD")["LOCAL,                                 FN_PTR(getLocalVariableTable)},
   {CC"getFileName",                   CC"("HS_RESOLVED_JAVA_TYPE")"STRING,                              FN_PTR(getFileName)},
--- a/src/share/vm/graal/graalJavaAccess.hpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Tue Mar 19 11:35:25 2013 +0100
@@ -75,12 +75,9 @@
   start_class(HotSpotInstalledCode)                                                                                                                            \
     long_field(HotSpotInstalledCode, nmethod)                                                                                                                  \
     oop_field(HotSpotInstalledCode, method, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;")                                                       \
+    long_field(HotSpotInstalledCode, start)                                                                                                                    \
     boolean_field(HotSpotInstalledCode, isDefault)                                                                                                             \
   end_class                                                                                                                                                    \
-  start_class(HotSpotCodeInfo)                                                                                                                                 \
-    long_field(HotSpotCodeInfo, start)                                                                                                                         \
-    oop_field(HotSpotCodeInfo, code, "[B")                                                                                                                     \
-  end_class                                                                                                                                                    \
   start_class(HotSpotCompilationResult)                                                                                                                        \
     oop_field(HotSpotCompilationResult, comp, "Lcom/oracle/graal/api/code/CompilationResult;")                                                                 \
     oop_field(HotSpotCompilationResult, method, "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;")                                                   \
--- a/src/share/vm/interpreter/templateInterpreter.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/interpreter/templateInterpreter.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -180,7 +180,7 @@
 #endif // !PRODUCT
 EntryPoint TemplateInterpreter::_return_entry[TemplateInterpreter::number_of_return_entries];
 EntryPoint TemplateInterpreter::_earlyret_entry;
-EntryPoint TemplateInterpreter::_deopt_entry [TemplateInterpreter::number_of_deopt_entries ];
+EntryPoint TemplateInterpreter::_deopt_entry[TemplateInterpreter::number_of_deopt_entries ];
 EntryPoint TemplateInterpreter::_continuation_entry;
 EntryPoint TemplateInterpreter::_safept_entry;
 
@@ -272,15 +272,15 @@
     for (int i = 0; i < Interpreter::number_of_deopt_entries; i++) {
       Interpreter::_deopt_entry[i] =
         EntryPoint(
-          generate_deopt_entry_for(itos, i),
-          generate_deopt_entry_for(itos, i),
-          generate_deopt_entry_for(itos, i),
-          generate_deopt_entry_for(atos, i),
-          generate_deopt_entry_for(itos, i),
-          generate_deopt_entry_for(ltos, i),
-          generate_deopt_entry_for(ftos, i),
-          generate_deopt_entry_for(dtos, i),
-          generate_deopt_entry_for(vtos, i)
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(itos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(itos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(itos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(atos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(itos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(ltos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(ftos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(dtos, i),
+          ((InterpreterGenerator*)this)->generate_deopt_entry_for(vtos, i)
         );
     }
   }
--- a/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/interpreter/templateInterpreterGenerator.hpp	Tue Mar 19 11:35:25 2013 +0100
@@ -55,7 +55,6 @@
   address generate_continuation_for(TosState state);
   address generate_return_entry_for(TosState state, int step);
   address generate_earlyret_entry_for(TosState state);
-  address generate_deopt_entry_for(TosState state, int step);
   address generate_safept_entry_for(TosState state, address runtime_entry);
   void    generate_throw_exception();
 
--- a/src/share/vm/runtime/deoptimization.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -1316,6 +1316,10 @@
 
     methodHandle    trap_method = trap_scope->method();
     int             trap_bci    = trap_scope->bci();
+    if (trap_bci == SynchronizationEntryBCI) {
+      trap_bci = 0;
+      Thread::current()->set_pending_monitorenter(true);
+    }
     Bytecodes::Code trap_bc     = trap_method->java_code_at(trap_bci);
 
     if (trap_scope->rethrow_exception()) {
--- a/src/share/vm/runtime/sharedRuntime.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -774,7 +774,7 @@
 address SharedRuntime::deoptimize_for_implicit_exception(JavaThread* thread, address pc, nmethod* nm, int deopt_reason) {
   assert(deopt_reason > Deoptimization::Reason_none && deopt_reason < Deoptimization::Reason_LIMIT, "invalid deopt reason");
   thread->_ScratchA = (intptr_t)pc;
-  thread->_ScratchB = Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret);
+  thread->set_pending_deoptimization(Deoptimization::make_trap_request((Deoptimization::DeoptReason)deopt_reason, Deoptimization::Action_reinterpret));
   return (SharedRuntime::deopt_blob()->implicit_exception_uncommon_trap());
 }
 #endif
--- a/src/share/vm/runtime/vframeArray.cpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/runtime/vframeArray.cpp	Tue Mar 19 11:35:25 2013 +0100
@@ -286,7 +286,7 @@
 
   _frame.patch_pc(thread, pc);
 
-  assert (!method()->is_synchronized() || locks > 0, "synchronized methods must have monitors");
+  assert (!method()->is_synchronized() || locks > 0 || raw_bci() == SynchronizationEntryBCI, "synchronized methods must have monitors");
 
   BasicObjectLock* top = iframe()->interpreter_frame_monitor_begin();
   for (int index = 0; index < locks; index++) {
--- a/src/share/vm/utilities/exceptions.hpp	Tue Mar 19 11:30:58 2013 +0100
+++ b/src/share/vm/utilities/exceptions.hpp	Tue Mar 19 11:35:25 2013 +0100
@@ -61,6 +61,8 @@
   friend class VMStructs;
 
  protected:
+  int _pending_deoptimization;
+  bool _pending_monitorenter;
   oop  _pending_exception;                       // Thread has gc actions.
   const char* _exception_file;                   // file information for exception (debugging only)
   int         _exception_line;                   // line information for exception (debugging only)
@@ -76,12 +78,19 @@
 
  public:
   oop  pending_exception() const                 { return _pending_exception; }
+  int  pending_deoptimization() const            { return _pending_deoptimization; }
   bool has_pending_exception() const             { return _pending_exception != NULL; }
   const char* exception_file() const             { return _exception_file; }
   int  exception_line() const                    { return _exception_line; }
+  bool has_pending_monitorenter() const          { return _pending_monitorenter; }
 
   // Code generation support
+  static ByteSize pending_deoptimization_offset() { return byte_offset_of(ThreadShadow, _pending_deoptimization); }
   static ByteSize pending_exception_offset()     { return byte_offset_of(ThreadShadow, _pending_exception); }
+  static ByteSize pending_monitorenter_offset()  { return byte_offset_of(ThreadShadow, _pending_monitorenter); }
+
+  void set_pending_monitorenter(bool b)          { _pending_monitorenter = b; }
+  void set_pending_deoptimization(int reason)    { _pending_deoptimization = reason; }
 
   // use THROW whenever possible!
   void set_pending_exception(oop exception, const char* file, int line);
@@ -90,7 +99,7 @@
   void clear_pending_exception();
 
   ThreadShadow() : _pending_exception(NULL),
-                   _exception_file(NULL), _exception_line(0) {}
+                   _exception_file(NULL), _exception_line(0), _pending_monitorenter(false), _pending_deoptimization(-1) {}
 };