changeset 7793:8b48c8ebdff4

Merge
author Christian Humer <christian.humer@gmail.com>
date Fri, 15 Feb 2013 16:48:22 +0100
parents 39d4a79568b6 (current diff) fe1187115167 (diff)
children b891ec348f8a
files
diffstat 29 files changed, 426 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/README_GRAAL.txt	Fri Feb 15 11:53:04 2013 +0100
+++ b/README_GRAAL.txt	Fri Feb 15 16:48:22 2013 +0100
@@ -40,7 +40,7 @@
 Other Build Configurations
 --------------------------
 
-By default the build commands above create a HotSpot binary where the Graal
+By default the build commands above create a HotSpot binary where Graal
 is the only compiler. This binary is the Graal VM binary and identifies as
 such with the -version option:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DisassemblerProvider.java	Fri Feb 15 16:48:22 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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.api.code;
+
+/**
+ * Interface providing capability for disassembling machine code.
+ */
+public interface DisassemblerProvider {
+
+    /**
+     * Gets a textual disassembly of some given installed code.
+     */
+    String disassemble(InstalledCode code);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/BytecodeDisassemblerProvider.java	Fri Feb 15 16:48:22 2013 +0100
@@ -0,0 +1,34 @@
+/*
+ * 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.api.meta;
+
+/**
+ * Interface providing capability for disassembling bytecode.
+ */
+public interface BytecodeDisassemblerProvider {
+
+    /**
+     * Gets a textual disassembly of the bytecode for a given method.
+     */
+    String disassemble(ResolvedJavaMethod method);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Local.java	Fri Feb 15 16:48:22 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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.api.meta;
+
+public interface Local {
+
+    int getStartBCI();
+
+    int getEndBCI();
+
+    int getSlot();
+
+    String getName();
+
+    ResolvedJavaType getType();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LocalVariableTable.java	Fri Feb 15 16:48:22 2013 +0100
@@ -0,0 +1,32 @@
+/*
+ * 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.api.meta;
+
+public interface LocalVariableTable {
+
+    Local[] getLocals();
+
+    Local[] getLocalsAt(int bci);
+
+    Local getLocal(int slot, int bci);
+}
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Fri Feb 15 16:48:22 2013 +0100
@@ -170,4 +170,10 @@
      * Returns the LineNumberTable of this method.
      */
     LineNumberTable getLineNumberTable();
+
+    /**
+     * Returns the localvariable table of this method.
+     */
+    LocalVariableTable getLocalVariableTable();
+
 }
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Feb 15 16:48:22 2013 +0100
@@ -317,7 +317,7 @@
     }
 
     public void flog(Register dest, Register value, boolean base10) {
-        assert value.spillSlotSize == dest.spillSlotSize;
+        assert dest.isFpu() && value.isFpu();
 
         Address tmp = new Address(Kind.Double, AMD64.RSP);
         if (base10) {
@@ -325,13 +325,13 @@
         } else {
             fldln2();
         }
-        subq(AMD64.rsp, value.spillSlotSize);
+        subq(AMD64.rsp, 8);
         movsd(tmp, value);
         fld(tmp);
         fyl2x();
         fstp(tmp);
         movsd(dest, tmp);
-        addq(AMD64.rsp, dest.spillSlotSize);
+        addq(AMD64.rsp, 8);
     }
 
     public void fsin(Register dest, Register value) {
@@ -347,10 +347,10 @@
     }
 
     private void ftrig(Register dest, Register value, char op) {
-        assert value.spillSlotSize == dest.spillSlotSize;
+        assert dest.isFpu() && value.isFpu();
 
         Address tmp = new Address(Kind.Double, AMD64.RSP);
-        subq(AMD64.rsp, value.spillSlotSize);
+        subq(AMD64.rsp, 8);
         movsd(tmp, value);
         fld(tmp);
         if (op == 's') {
@@ -365,7 +365,7 @@
         }
         fstp(tmp);
         movsd(dest, tmp);
-        addq(AMD64.rsp, dest.spillSlotSize);
+        addq(AMD64.rsp, 8);
     }
 
     /**
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Fri Feb 15 16:48:22 2013 +0100
@@ -226,7 +226,7 @@
     public static final int INVOKESPECIAL        = 183; // 0xB7
     public static final int INVOKESTATIC         = 184; // 0xB8
     public static final int INVOKEINTERFACE      = 185; // 0xB9
-    public static final int XXXUNUSEDXXX         = 186; // 0xBA
+    public static final int INVOKEDYNAMIC        = 186; // 0xBA
     public static final int NEW                  = 187; // 0xBB
     public static final int NEWARRAY             = 188; // 0xBC
     public static final int ANEWARRAY            = 189; // 0xBD
@@ -552,7 +552,7 @@
         def(INVOKESPECIAL       , "invokespecial"   , "bjj"  , 5, TRAP | INVOKE);
         def(INVOKESTATIC        , "invokestatic"    , "bjj"  , 5, TRAP | INVOKE);
         def(INVOKEINTERFACE     , "invokeinterface" , "bjja_", 7, TRAP | INVOKE);
-        def(XXXUNUSEDXXX        , "xxxunusedxxx"    , ""     , 0);
+        def(INVOKEDYNAMIC       , "invokedynamic"   , "bjjjj", 7, TRAP | INVOKE);
         def(NEW                 , "new"             , "bii"  , 6, TRAP);
         def(NEWARRAY            , "newarray"        , "bc"   , 6, TRAP);
         def(ANEWARRAY           , "anewarray"       , "bii"  , 6, TRAP);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Feb 15 16:48:22 2013 +0100
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.hotspot;
 
-import static com.oracle.graal.graph.FieldIntrospection.*;
+import static com.oracle.graal.graph.UnsafeAccess.*;
 
 import java.lang.reflect.*;
 import java.util.*;
@@ -261,6 +261,9 @@
         if (clazz == GraalCodeCacheProvider.class || clazz == CodeCacheProvider.class || clazz == MetaAccessProvider.class || clazz == SnippetProvider.class) {
             return (T) getRuntime();
         }
+        if (clazz == DisassemblerProvider.class || clazz == BytecodeDisassemblerProvider.class) {
+            return (T) getRuntime();
+        }
         if (clazz == GraalCompiler.class) {
             return (T) getCompiler();
         }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Feb 15 16:48:22 2013 +0100
@@ -191,6 +191,8 @@
 
     String disassembleNative(byte[] code, long address);
 
+    String disassembleNMethod(long nmethod);
+
     StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
 
     Object executeCompiledMethod(long metaspaceMethod, long nmethod, Object arg1, Object arg2, Object arg3);
@@ -205,5 +207,7 @@
 
     long[] getLineNumberTable(HotSpotResolvedJavaMethod method);
 
+    Local[] getLocalVariableTable(HotSpotResolvedJavaMethod method);
+
     String getFileName(HotSpotResolvedJavaType method);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java	Fri Feb 15 16:48:22 2013 +0100
@@ -126,6 +126,9 @@
     public native String disassembleNative(byte[] code, long address);
 
     @Override
+    public native String disassembleNMethod(long nmethod);
+
+    @Override
     public native StackTraceElement getStackTraceElement(long metaspaceMethod, int bci);
 
     @Override
@@ -147,5 +150,8 @@
     public native long[] getLineNumberTable(HotSpotResolvedJavaMethod method);
 
     @Override
+    public native Local[] getLocalVariableTable(HotSpotResolvedJavaMethod method);
+
+    @Override
     public native String getFileName(HotSpotResolvedJavaType method);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Feb 15 16:48:22 2013 +0100
@@ -26,6 +26,7 @@
 import java.io.*;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 
 /**
@@ -77,4 +78,6 @@
     Constant createConstantDouble(double value);
 
     Constant createConstantObject(Object object);
+
+    LocalImpl createLocalImpl(String name, String type, HotSpotResolvedObjectType holder, int bciStart, int bciEnd, int slot);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Feb 15 16:48:22 2013 +0100
@@ -40,6 +40,7 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.debug.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.java.*;
@@ -608,6 +609,11 @@
         return Constant.forObject(object);
     }
 
+    @Override
+    public LocalImpl createLocalImpl(String name, String type, HotSpotResolvedObjectType holder, int bciStart, int bciEnd, int slot) {
+        return new LocalImpl(name, type, holder, bciStart, bciEnd, slot);
+    }
+
     public PhasePlan createPhasePlan(OptimisticOptimizations optimisticOpts, boolean onStackReplacement) {
         PhasePlan phasePlan = new PhasePlan();
         phasePlan.addPhase(PhasePosition.AFTER_PARSING, new GraphBuilderPhase(graalRuntime.getRuntime(), GraphBuilderConfiguration.getDefault(), optimisticOpts));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LocalImpl.java	Fri Feb 15 16:48:22 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.hotspot.debug;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.meta.*;
+
+public class LocalImpl implements Local {
+
+    private final String name;
+    private final int bciStart;
+    private final int bciEnd;
+    private final int slot;
+    private final ResolvedJavaType resolvedType;
+
+    public LocalImpl(String name, String type, HotSpotResolvedObjectType holder, int bciStart, int bciEnd, int slot) {
+        this.name = name;
+        this.bciStart = bciStart;
+        this.bciEnd = bciEnd;
+        this.slot = slot;
+        JavaType t = HotSpotGraalRuntime.getInstance().lookupType(type, holder, true);
+        if (t instanceof ResolvedJavaType) {
+            this.resolvedType = (ResolvedJavaType) HotSpotGraalRuntime.getInstance().lookupType(type, holder, false);
+        } else {
+            throw new AssertionError(t.getClass() + " is not a ResolvedJavaType");
+        }
+    }
+
+    @Override
+    public int getStartBCI() {
+        return bciStart;
+    }
+
+    @Override
+    public int getEndBCI() {
+        return bciEnd;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public ResolvedJavaType getType() {
+        return resolvedType;
+    }
+
+    @Override
+    public int getSlot() {
+        return slot;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LocalVariableTableImpl.java	Fri Feb 15 16:48:22 2013 +0100
@@ -0,0 +1,68 @@
+/*
+ * 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.debug;
+
+import java.util.*;
+
+import com.oracle.graal.api.meta.*;
+
+public class LocalVariableTableImpl implements LocalVariableTable {
+
+    private final Local[] locals;
+
+    public LocalVariableTableImpl(Local[] locals) {
+        this.locals = locals;
+    }
+
+    @Override
+    public Local getLocal(int slot, int bci) {
+        Local result = null;
+        for (Local local : locals) {
+            if (local.getSlot() == slot && local.getStartBCI() <= bci && local.getEndBCI() >= bci) {
+                if (result == null) {
+                    result = local;
+                } else {
+                    throw new IllegalStateException("Locals overlap!");
+                }
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public Local[] getLocals() {
+        return locals;
+    }
+
+    @Override
+    public Local[] getLocalsAt(int bci) {
+        List<Local> result = new ArrayList<>();
+        for (Local l : locals) {
+            if (l.getStartBCI() <= bci && bci <= l.getEndBCI()) {
+                result.add(l);
+            }
+        }
+        return result.toArray(new Local[result.size()]);
+    }
+
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Fri Feb 15 16:48:22 2013 +0100
@@ -38,7 +38,7 @@
     private static final long serialVersionUID = 156632908220561612L;
 
     private final HotSpotResolvedJavaMethod method;
-    private long nmethod;
+    long nmethod;
 
     public HotSpotInstalledCode(HotSpotResolvedJavaMethod method) {
         this.method = method;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri Feb 15 16:48:22 2013 +0100
@@ -308,6 +308,12 @@
         return new LineNumberTableImpl(line, bci);
     }
 
+    @Override
+    public LocalVariableTable getLocalVariableTable() {
+        Local[] locals = HotSpotGraalRuntime.getInstance().getCompilerToVM().getLocalVariableTable(this);
+        return new LocalVariableTableImpl(locals);
+    }
+
     /**
      * Returns the offset of this method into the v-table. If the holder is not initialized, returns
      * -1
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Feb 15 16:48:22 2013 +0100
@@ -59,6 +59,7 @@
 import com.oracle.graal.hotspot.phases.*;
 import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.hotspot.stubs.*;
+import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.extended.*;
@@ -74,7 +75,7 @@
 /**
  * HotSpot implementation of {@link GraalCodeCacheProvider}.
  */
-public abstract class HotSpotRuntime implements GraalCodeCacheProvider, SnippetProvider {
+public abstract class HotSpotRuntime implements GraalCodeCacheProvider, SnippetProvider, DisassemblerProvider, BytecodeDisassemblerProvider {
 
     public final HotSpotVMConfig config;
 
@@ -951,4 +952,16 @@
     public TargetDescription getTarget() {
         return graalRuntime.getTarget();
     }
+
+    public String disassemble(InstalledCode code) {
+        if (code.isValid()) {
+            long nmethod = ((HotSpotInstalledCode) code).nmethod;
+            return graalRuntime.getCompilerToVM().disassembleNMethod(nmethod);
+        }
+        return "";
+    }
+
+    public String disassemble(ResolvedJavaMethod method) {
+        return new BytecodeDisassembler().disassemble(method);
+    }
 }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Fri Feb 15 16:48:22 2013 +0100
@@ -345,7 +345,8 @@
                 case INVOKEINTERFACE:
                 case INVOKESPECIAL:
                 case INVOKESTATIC:
-                case INVOKEVIRTUAL: {
+                case INVOKEVIRTUAL:
+                case INVOKEDYNAMIC: {
                     current = null;
                     addSuccessor(bci, makeBlock(stream.nextBCI()));
                     ExceptionDispatchBlock handler = handleExceptions(bci);
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Fri Feb 15 16:48:22 2013 +0100
@@ -185,6 +185,9 @@
                 }
             }
         }
+        if (result.isEmpty()) {
+            result.add("Top Scope");
+        }
         return result;
     }
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java	Fri Feb 15 11:53:04 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java	Fri Feb 15 16:48:22 2013 +0100
@@ -59,6 +59,10 @@
         }
     }
 
+    public boolean isDefault() {
+        return false;
+    }
+
     @Override
     public List<TypeMirror> getThrownTypes() {
         return throwables;
--- a/mx/commands.py	Fri Feb 15 11:53:04 2013 +0100
+++ b/mx/commands.py	Fri Feb 15 16:48:22 2013 +0100
@@ -1152,7 +1152,7 @@
     mx.add_argument('--jacoco', help='instruments com.oracle.* classes using JaCoCo', default='off', choices=['off', 'on', 'append'])
 
     if (_vmSourcesAvailable):
-        mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)')
+        mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client', 'server0'], help='the VM to build/run (default: graal)')
         mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM')
         mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM')
         mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM')
@@ -1169,7 +1169,7 @@
     mx.commands.update(commands)
 
 def mx_post_parse_cmd_line(opts):
-    version = mx.java().version
+    version = mx.java().version.split('-')[0]
     parts = version.split('.')
     assert len(parts) >= 2
     assert parts[0] == '1'
--- a/mxtool/mx.py	Fri Feb 15 11:53:04 2013 +0100
+++ b/mxtool/mx.py	Fri Feb 15 16:48:22 2013 +0100
@@ -1168,7 +1168,7 @@
         javaClass = join(myDir, 'URLConnectionDownload.class')
         if not exists(javaClass) or getmtime(javaClass) < getmtime(javaSource):
             subprocess.check_call([java().javac, '-d', myDir, javaSource])
-        if run([java().java, '-cp', myDir, 'URLConnectionDownload', path] + urls) == 0:
+        if run([java().java, '-cp', myDir, 'URLConnectionDownload', path] + urls, nonZeroIsFatal=False) == 0:
             return
 
     def url_open(url):
@@ -1436,7 +1436,8 @@
                          '-cp', cp, '-g', '-enableJavadoc',
                          '-d', outputDir] + javacArgs
                 jdtProperties = join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs')
-                if not exists(jdtProperties):
+                rootJdtProperties = join(p.suite.dir, 'mx', 'eclipse-settings', 'org.eclipse.jdt.core.prefs')
+                if not exists(jdtProperties) or os.path.getmtime(jdtProperties) < os.path.getmtime(rootJdtProperties):
                     # Try to fix a missing properties file by running eclipseinit
                     eclipseinit([], buildProcessorJars=False)
                 if not exists(jdtProperties):
--- a/src/share/vm/classfile/systemDictionary.hpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/classfile/systemDictionary.hpp	Fri Feb 15 16:48:22 2013 +0100
@@ -193,6 +193,7 @@
   do_klass(HotSpotResolvedJavaField_klass,        com_oracle_graal_hotspot_meta_HotSpotResolvedJavaField,       Opt) \
   do_klass(HotSpotResolvedJavaMethod_klass,       com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod,      Opt) \
   do_klass(HotSpotResolvedObjectType_klass,       com_oracle_graal_hotspot_meta_HotSpotResolvedObjectType,      Opt) \
+  do_klass(LocalImpl_klass,                       com_oracle_graal_hotspot_debug_LocalImpl,                     Opt) \
   /* graal.api.code */                                                                                               \
   do_klass(Assumptions_klass,                     com_oracle_graal_api_code_Assumptions,                        Opt) \
   do_klass(Assumptions_ConcreteMethod_klass,      com_oracle_graal_api_code_Assumptions_ConcreteMethod,         Opt) \
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Feb 15 16:48:22 2013 +0100
@@ -303,6 +303,7 @@
   template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaField,   "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField")        \
   template(com_oracle_graal_hotspot_meta_HotSpotResolvedJavaMethod,  "com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod")       \
   template(com_oracle_graal_hotspot_meta_HotSpotResolvedObjectType,  "com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType")       \
+  template(com_oracle_graal_hotspot_debug_LocalImpl,                 "com/oracle/graal/hotspot/debug/LocalImpl")                      \
   AMD64_ONLY(template(com_oracle_graal_hotspot_amd64_AMD64HotSpotGraalRuntime,"com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime"))\
   /* graal.api.meta */                                                                                                                \
   template(com_oracle_graal_api_meta_Constant,                       "com/oracle/graal/api/meta/Constant")                            \
@@ -354,6 +355,8 @@
   template(createResolvedJavaType_signature,      "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/Class;ZI)Lcom/oracle/graal/api/meta/ResolvedJavaType;") \
   template(createPrimitiveJavaType_name,          "createPrimitiveJavaType")                                                          \
   template(createPrimitiveJavaType_signature,     "(I)Lcom/oracle/graal/api/meta/JavaType;")                                          \
+  template(createLocalImpl_name,                  "createLocalImpl")                                                                  \
+  template(createLocalImpl_signature,             "(Ljava/lang/String;Ljava/lang/String;Lcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;III)Lcom/oracle/graal/hotspot/debug/LocalImpl;") \
   template(createConstant_name,                   "createConstant")                                                                   \
   template(createConstant_signature,              "(Lcom/oracle/graal/api/meta/Kind;J)Lcom/oracle/graal/api/meta/Constant;")          \
   template(createConstantFloat_name,              "createConstantFloat")                                                              \
@@ -371,7 +374,7 @@
   template(forObject_name,                        "forObject")                                                                        \
   template(callbackInternal_name,                 "callbackInternal")                                                                 \
   template(callback_signature,                    "(Ljava/lang/Object;)Ljava/lang/Object;")                                           \
-  template(MethodInvalidatedException,            "com/oracle/graal/api/code/CompilationResult$MethodInvalidatedException")               \
+  template(MethodInvalidatedException,            "com/oracle/graal/api/code/InstalledCode$MethodInvalidatedException")               \
   /* graal.api.interpreter */                                                                                                         \
   template(com_oracle_graal_api_interpreter_Interpreter,             "com/oracle/graal/api/interpreter/Interpreter")                  \
   template(interpreter_execute_name,              "execute")                                                                          \
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Feb 15 16:48:22 2013 +0100
@@ -844,6 +844,21 @@
   return JNIHandles::make_local(result());
 C2V_END
 
+C2V_VMENTRY(jobject, disassembleNMethod, (JNIEnv *jniEnv, jobject, jlong metaspace_nmethod))
+  ResourceMark rm;
+  HandleMark hm;
+
+  nmethod* nm = (nmethod*) (address) metaspace_nmethod;
+  if (nm == NULL || !nm->is_alive()) {
+    return NULL;
+  }
+  stringStream(st);
+  Disassembler::decode(nm, &st);
+
+  Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
+  return JNIHandles::make_local(result());
+C2V_END
+
 C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv *env, jobject, jlong metaspace_method, int bci))
   ResourceMark rm;
   HandleMark hm;
@@ -977,6 +992,38 @@
   return result;
 C2V_END
 
+C2V_VMENTRY(jobject, getLocalVariableTable, (JNIEnv *, jobject, jobject hotspot_method))
+  ResourceMark rm;
+
+  Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method));
+  if(!method->has_localvariable_table()) {
+    return NULL;
+  }
+  int localvariable_table_length = method->localvariable_table_length();
+
+  objArrayHandle local_array = oopFactory::new_objArray(SystemDictionary::LocalImpl_klass(), localvariable_table_length, CHECK_NULL);
+  LocalVariableTableElement* table = method->localvariable_table_start();
+  for (int i = 0; i < localvariable_table_length; i++) {
+    u2 start_bci = table[i].start_bci;
+    u4 end_bci = (u4)(start_bci + table[i].length);
+    u2 nameCPIdx = table[i].name_cp_index;
+    u2 typeCPIdx = table[i].descriptor_cp_index;
+    u2 slot = table[i].slot;
+
+    char* name = method->constants()->string_at_noresolve(nameCPIdx);
+    Handle nameHandle = java_lang_String::create_from_str(name, CHECK_NULL);
+
+    char* typeInfo = method->constants()->string_at_noresolve(typeCPIdx);
+    Handle typeHandle = java_lang_String::create_from_str(typeInfo, CHECK_NULL);
+
+    Handle holderHandle = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0);
+    Handle local = VMToCompiler::createLocal(nameHandle, typeHandle, (int) start_bci, (int) end_bci, (int) slot, holderHandle, Thread::current());
+    local_array->obj_at_put(i, local());
+  }
+
+  return JNIHandles::make_local(local_array());
+C2V_END
+
 
 C2V_VMENTRY(jobject, getFileName, (JNIEnv *, jobject, jobject klass))
   ResourceMark rm;
@@ -1001,6 +1048,7 @@
 #define CONSTANT_POOL         "Lcom/oracle/graal/api/meta/ConstantPool;"
 #define CONSTANT              "Lcom/oracle/graal/api/meta/Constant;"
 #define KIND                  "Lcom/oracle/graal/api/meta/Kind;"
+#define LOCAL                  "Lcom/oracle/graal/api/meta/Local;"
 #define RUNTIME_CALL          "Lcom/oracle/graal/api/code/RuntimeCall;"
 #define EXCEPTION_HANDLERS    "[Lcom/oracle/graal/api/meta/ExceptionHandler;"
 #define REFLECT_METHOD        "Ljava/lang/reflect/Method;"
@@ -1056,11 +1104,13 @@
   {CC"initializeConfiguration",       CC"("HS_CONFIG")V",                                               FN_PTR(initializeConfiguration)},
   {CC"installCode0",                  CC"("HS_COMP_RESULT HS_INSTALLED_CODE HS_CODE_INFO")I",           FN_PTR(installCode0)},
   {CC"disassembleNative",             CC"([BJ)"STRING,                                                  FN_PTR(disassembleNative)},
+  {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/graalVMToCompiler.cpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.cpp	Fri Feb 15 16:48:22 2013 +0100
@@ -267,3 +267,19 @@
   return (oop) result.get_jobject();
 }
 
+oop VMToCompiler::createLocal(Handle name, Handle typeInfo, int bci_start, int bci_end, int slot, Handle holder, TRAPS) {
+  JavaValue result(T_OBJECT);
+  JavaCallArguments args;
+  args.push_oop(instance());
+  args.push_oop(name);
+  args.push_oop(typeInfo);
+  args.push_oop(holder);
+  args.push_int(bci_start);
+  args.push_int(bci_end);
+  args.push_int(slot);
+  JavaCalls::call_interface(&result, vmToCompilerKlass(), vmSymbols::createLocalImpl_name(), vmSymbols::createLocalImpl_signature(), &args, THREAD);
+  check_pending_exception("Error while calling createConstantFloat");
+  return (oop) result.get_jobject();
+
+}
+
--- a/src/share/vm/graal/graalVMToCompiler.hpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/graal/graalVMToCompiler.hpp	Fri Feb 15 16:48:22 2013 +0100
@@ -94,6 +94,9 @@
 
   // public abstract Constant createConstantObject(long vmId);
   static oop createConstantObject(Handle object, TRAPS);
+
+  // public abstract Local createLocal(String name, int bci_start, int bci_end);
+  static oop createLocal(Handle name, Handle type, int bci_start, int bci_end, int slot, Handle holder, TRAPS);
 };
 
 inline void check_pending_exception(const char* message, bool dump_core = false) {
--- a/src/share/vm/runtime/globals.hpp	Fri Feb 15 11:53:04 2013 +0100
+++ b/src/share/vm/runtime/globals.hpp	Fri Feb 15 16:48:22 2013 +0100
@@ -3588,7 +3588,7 @@
   product(uintx, SharedDummyBlockSize, 0,                                   \
           "Size of dummy block used to shift heap addresses (in bytes)")    \
                                                                             \
-  diagnostic(bool, EnableInvokeDynamic, false,                              \
+  diagnostic(bool, EnableInvokeDynamic, true,                               \
           "support JSR 292 (method handles, invokedynamic, "                \
           "anonymous classes")                                              \
                                                                             \