changeset 4610:717589e14dbd

Merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 14 Feb 2012 11:28:57 +0100
parents 597bc897257d (diff) a3d74cb39baa (current diff)
children d8a09bbba79a
files
diffstat 19 files changed, 172 insertions(+), 118 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/BoxingEliminationPhase.java	Tue Feb 14 11:28:57 2012 +0100
@@ -57,7 +57,7 @@
     private void tryEliminate(StructuredGraph graph, UnboxNode unboxNode, Map<PhiNode, PhiNode> phiReplacements) {
         ValueNode unboxedValue = unboxedValue(unboxNode.source(), unboxNode.destinationKind(), phiReplacements);
         if (unboxedValue != null) {
-            assert unboxedValue.kind() == unboxNode.destinationKind();
+            assert unboxedValue.kind() == unboxNode.kind();
             unboxNode.replaceAtUsages(unboxedValue);
             graph.removeFixed(unboxNode);
         }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/InliningPhase.java	Tue Feb 14 11:28:57 2012 +0100
@@ -88,7 +88,7 @@
                     try {
                         info.inline(graph, runtime, this);
                         Debug.log("inlining %f: %s", info.weight, info);
-                        Debug.dump(graph, "after inlining %s", info);
+                        Debug.dump(graph, "after %s", info);
                         // get the new nodes here, the canonicalizer phase will reset the mark
                         newNodes = graph.getNewNodes();
                         if (GraalOptions.OptCanonicalizer) {
--- a/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java	Tue Feb 14 11:28:57 2012 +0100
@@ -156,7 +156,7 @@
         }
     }
 
-    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, final List<DebugDumpHandler> dumpHandlers) {
+    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, final Collection<? extends DebugDumpHandler> dumpHandlers) {
         return new DebugConfig() {
 
             @Override
--- a/graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64Move.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.lir.amd64/src/com/oracle/max/graal/lir/amd64/AMD64Move.java	Tue Feb 14 11:28:57 2012 +0100
@@ -296,7 +296,7 @@
         if (input.equals(result)) {
             return;
         }
-        switch (result.kind) {
+        switch (input.kind) {
             case Jsr:
             case Int:    masm.movl(asRegister(result),    asRegister(input)); break;
             case Long:   masm.movq(asRegister(result),    asRegister(input)); break;
@@ -308,7 +308,7 @@
     }
 
     private static void reg2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        switch (result.kind) {
+        switch (input.kind) {
             case Jsr:
             case Int:    masm.movl(tasm.asAddress(result),   asRegister(input)); break;
             case Long:   masm.movq(tasm.asAddress(result),   asRegister(input)); break;
@@ -320,7 +320,7 @@
     }
 
     private static void stack2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiValue input) {
-        switch (result.kind) {
+        switch (input.kind) {
             case Jsr:
             case Int:    masm.movl(asRegister(result),    tasm.asAddress(input)); break;
             case Long:   masm.movq(asRegister(result),    tasm.asAddress(input)); break;
@@ -331,48 +331,51 @@
         }
     }
 
-    private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
-        switch (result.kind) {
+    private static void const2reg(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant input) {
+        // Note: we use the kind of the input operand (and not the kind of the result operand) because they don't match
+        // in all cases. For example, an object constant can be loaded to a long register when unsafe casts occurred (e.g.,
+        // for a write barrier where arithmetic operations are then performed on the pointer).
+        switch (input.kind.stackKind()) {
             case Jsr:
             case Int:
                 // Do not optimize with an XOR as this instruction may be between
                 // a CMP and a Jcc in which case the XOR will modify the condition
                 // flags and interfere with the Jcc.
-                masm.movl(asRegister(result), tasm.asIntConst(c));
+                masm.movl(asRegister(result), tasm.asIntConst(input));
                 break;
             case Long:
                 // Do not optimize with an XOR as this instruction may be between
                 // a CMP and a Jcc in which case the XOR will modify the condition
                 // flags and interfere with the Jcc.
-                masm.movq(asRegister(result), c.asLong());
+                masm.movq(asRegister(result), input.asLong());
                 break;
             case Float:
                 // This is *not* the same as 'constant == 0.0f' in the case where constant is -0.0f
-                if (Float.floatToRawIntBits(c.asFloat()) == Float.floatToRawIntBits(0.0f)) {
+                if (Float.floatToRawIntBits(input.asFloat()) == Float.floatToRawIntBits(0.0f)) {
                     masm.xorps(asFloatReg(result), asFloatReg(result));
                 } else {
-                    masm.movflt(asFloatReg(result), tasm.asFloatConstRef(c));
+                    masm.movflt(asFloatReg(result), tasm.asFloatConstRef(input));
                 }
                 break;
             case Double:
                 // This is *not* the same as 'constant == 0.0d' in the case where constant is -0.0d
-                if (Double.doubleToRawLongBits(c.asDouble()) == Double.doubleToRawLongBits(0.0d)) {
+                if (Double.doubleToRawLongBits(input.asDouble()) == Double.doubleToRawLongBits(0.0d)) {
                     masm.xorpd(asDoubleReg(result), asDoubleReg(result));
                 } else {
-                    masm.movdbl(asDoubleReg(result), tasm.asDoubleConstRef(c));
+                    masm.movdbl(asDoubleReg(result), tasm.asDoubleConstRef(input));
                 }
                 break;
             case Object:
                 // Do not optimize with an XOR as this instruction may be between
                 // a CMP and a Jcc in which case the XOR will modify the condition
                 // flags and interfere with the Jcc.
-                if (c.isNull()) {
+                if (input.isNull()) {
                     masm.movq(asRegister(result), 0x0L);
                 } else if (tasm.target.inlineObjects) {
-                    tasm.recordDataReferenceInCode(c, 0);
+                    tasm.recordDataReferenceInCode(input, 0);
                     masm.movq(asRegister(result), 0xDEADDEADDEADDEADL);
                 } else {
-                    masm.movq(asRegister(result), tasm.recordDataReferenceInCode(c, 0));
+                    masm.movq(asRegister(result), tasm.recordDataReferenceInCode(input, 0));
                 }
                 break;
             default:
@@ -380,15 +383,15 @@
         }
     }
 
-    private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant c) {
-        switch (result.kind) {
+    private static void const2stack(TargetMethodAssembler tasm, AMD64MacroAssembler masm, CiValue result, CiConstant input) {
+        switch (input.kind.stackKind()) {
             case Jsr:
-            case Int:    masm.movl(tasm.asAddress(result), c.asInt()); break;
-            case Long:   masm.movlong(tasm.asAddress(result), c.asLong()); break;
-            case Float:  masm.movl(tasm.asAddress(result), floatToRawIntBits(c.asFloat())); break;
-            case Double: masm.movlong(tasm.asAddress(result), doubleToRawLongBits(c.asDouble())); break;
+            case Int:    masm.movl(tasm.asAddress(result), input.asInt()); break;
+            case Long:   masm.movlong(tasm.asAddress(result), input.asLong()); break;
+            case Float:  masm.movl(tasm.asAddress(result), floatToRawIntBits(input.asFloat())); break;
+            case Double: masm.movlong(tasm.asAddress(result), doubleToRawLongBits(input.asDouble())); break;
             case Object:
-                if (c.isNull()) {
+                if (input.isNull()) {
                     masm.movlong(tasm.asAddress(result), 0L);
                 } else {
                     throw GraalInternalError.shouldNotReachHere("Non-null object constants must be in register");
--- a/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.nodes/src/com/oracle/max/graal/nodes/extended/UnboxNode.java	Tue Feb 14 11:28:57 2012 +0100
@@ -34,10 +34,12 @@
 public final class UnboxNode extends FixedWithNextNode implements Node.IterableNodeType, Canonicalizable {
 
     @Input private ValueNode source;
+    @Data private CiKind destinationKind;
 
     public UnboxNode(CiKind kind, ValueNode source) {
         super(StampFactory.forKind(kind));
         this.source = source;
+        this.destinationKind = kind;
         assert kind != CiKind.Object : "can only unbox to primitive";
         assert source.kind() == CiKind.Object : "can only unbox objects";
     }
@@ -47,7 +49,7 @@
     }
 
     public CiKind destinationKind() {
-        return this.kind();
+        return destinationKind;
     }
 
     public void expand(BoxingMethodPool pool) {
@@ -63,7 +65,7 @@
             CiConstant constant = source.asConstant();
             Object o = constant.asObject();
             if (o != null) {
-                switch (kind()) {
+                switch (destinationKind) {
                     case Boolean:
                         return ConstantNode.forBoolean((Boolean) o, graph());
                     case Byte:
@@ -81,7 +83,7 @@
                     case Double:
                         return ConstantNode.forDouble((Long) o, graph());
                     default:
-                        assert false;
+                        ValueUtil.shouldNotReachHere();
                 }
             }
         }
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/CFGPrinterObserver.java	Tue Feb 14 11:28:57 2012 +0100
@@ -27,6 +27,7 @@
 
 import com.oracle.max.cri.ci.*;
 import com.oracle.max.cri.ri.*;
+import com.oracle.max.criutils.*;
 import com.oracle.max.graal.alloc.util.*;
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.alloc.*;
@@ -80,6 +81,7 @@
             } catch (FileNotFoundException e) {
                 throw new InternalError("Could not open " + file.getAbsolutePath());
             }
+            TTY.println("CFGPrinter: Output to file %s", file);
         }
 
         RiRuntime runtime = cfgPrinter.runtime;
@@ -92,6 +94,7 @@
             cfgPrinter.lir = null;
             cfgPrinter.lirGenerator = null;
             schedule = null;
+            TTY.println("CFGPrinter: Dumping method %s", method);
 
         } else if (object instanceof BciBlockMapping) {
             BciBlockMapping blockMap = (BciBlockMapping) object;
--- a/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.printer/src/com/oracle/max/graal/printer/IdealGraphPrinterDumpHandler.java	Tue Feb 14 11:28:57 2012 +0100
@@ -70,7 +70,6 @@
             } else {
                 initializeNetworkPrinter();
             }
-            printer.begin();
         }
     }
 
@@ -78,8 +77,9 @@
         try {
             FileOutputStream stream = new FileOutputStream(fileName);
             printer = new IdealGraphPrinter(stream);
+            printer.begin();
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            printer = null;
         }
     }
 
@@ -88,9 +88,11 @@
             Socket socket = new Socket(host, port);
             BufferedOutputStream stream = new BufferedOutputStream(socket.getOutputStream(), 0x4000);
             printer = new IdealGraphPrinter(stream);
+            printer.begin();
             TTY.println("Connected to the IGV on port %d", port);
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            TTY.println("Could not connect to the IGV on port %d: %s", port, e);
+            printer = null;
         }
     }
 
@@ -100,7 +102,7 @@
             ensureInitialized();
             final Graph graph = (Graph) object;
 
-            if (printer.isValid()) {
+            if (printer != null && printer.isValid()) {
                 // Get all current RiResolvedMethod instances in the context.
                 List<String> inlineContext = getInlineContext();
                 Debug.contextSnapshot(RiResolvedMethod.class);
@@ -140,9 +142,6 @@
 
                     }
                 });
-            } else {
-                TTY.println("Fatal error: Printer invalid!");
-                System.exit(-1);
             }
         }
     }
--- a/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Mon Feb 13 16:04:59 2012 +0100
+++ b/graal/com.oracle.max.graal.tests/src/com/oracle/max/graal/compiler/tests/BoxingEliminationTest.java	Tue Feb 14 11:28:57 2012 +0100
@@ -41,20 +41,24 @@
  * graph of the method that just has a "return 1" statement in it.
  */
 public class BoxingEliminationTest extends GraphTest {
-
+    private static final Short s = 2;
     private static final String REFERENCE_SNIPPET = "referenceSnippet";
 
     @SuppressWarnings("all")
-    public static int referenceSnippet(int a) {
+    public static short referenceSnippet(short a) {
         return 1;
     }
 
-    public static Integer boxedInteger() {
+    public static Short boxedShort() {
         return 1;
     }
 
     public static Object boxedObject() {
-        return 1;
+        return (short) 1;
+    }
+
+    public static Short constantBoxedShort() {
+        return s;
     }
 
     @Test
@@ -63,8 +67,8 @@
     }
 
     @SuppressWarnings("all")
-    public static int test1Snippet(int a) {
-        return boxedInteger();
+    public static short test1Snippet(short a) {
+        return boxedShort();
     }
 
     @Test
@@ -73,8 +77,8 @@
     }
 
     @SuppressWarnings("all")
-    public static int test2Snippet(int a) {
-        return (Integer) boxedObject();
+    public static short test2Snippet(short a) {
+        return (Short) boxedObject();
     }
     @Test
     public void test3() {
@@ -82,39 +86,54 @@
     }
 
     @SuppressWarnings("all")
-    public static int test3Snippet(int a) {
-        int b = boxedInteger();
+    public static short test3Snippet(short a) {
+        short b = boxedShort();
         if (b < 0) {
-            b = boxedInteger();
+            b = boxedShort();
         }
         return b;
     }
 
-    private void test(String snippet) {
-        StructuredGraph graph = parse(snippet);
-        BoxingMethodPool pool = new BoxingMethodPool(runtime());
-        IdentifyBoxingPhase identifyBoxingPhase = new IdentifyBoxingPhase(pool);
-        PhasePlan phasePlan = getDefaultPhasePlan();
-        phasePlan.addPhase(PhasePosition.AFTER_PARSING, identifyBoxingPhase);
-        identifyBoxingPhase.apply(graph);
-        LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
-        ConstantNode constant = ConstantNode.forInt(0, graph);
-        for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
-            n.replaceFirstInput(local, constant);
-        }
-        Collection<Invoke> hints = new ArrayList<>();
-        for (Invoke invoke : graph.getInvokes()) {
-            hints.add(invoke);
-        }
-        new InliningPhase(null, runtime(), hints, null, phasePlan).apply(graph);
-        new CanonicalizerPhase(null, runtime(), null).apply(graph);
-        Debug.dump(graph, "Graph");
-        new BoxingEliminationPhase().apply(graph);
-        Debug.dump(graph, "Graph");
-        new ExpandBoxingNodesPhase(pool).apply(graph);
-        new CanonicalizerPhase(null, runtime(), null).apply(graph);
-        new DeadCodeEliminationPhase().apply(graph);
-        StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET);
-        assertEquals(referenceGraph, graph);
+    @Test
+    public void test4() {
+        test("test4Snippet");
+    }
+
+    @SuppressWarnings("all")
+    public static short test4Snippet(short a) {
+        return constantBoxedShort();
+    }
+
+    private void test(final String snippet) {
+        Debug.scope("BoxingEliminationTest", new DebugDumpScope(snippet), new Runnable() {
+            @Override
+            public void run() {
+                StructuredGraph graph = parse(snippet);
+                BoxingMethodPool pool = new BoxingMethodPool(runtime());
+                IdentifyBoxingPhase identifyBoxingPhase = new IdentifyBoxingPhase(pool);
+                PhasePlan phasePlan = getDefaultPhasePlan();
+                phasePlan.addPhase(PhasePosition.AFTER_PARSING, identifyBoxingPhase);
+                identifyBoxingPhase.apply(graph);
+                LocalNode local = graph.getNodes(LocalNode.class).iterator().next();
+                ConstantNode constant = ConstantNode.forShort((short) 0, graph);
+                for (Node n : local.usages().filter(isNotA(FrameState.class)).snapshot()) {
+                    n.replaceFirstInput(local, constant);
+                }
+                Collection<Invoke> hints = new ArrayList<>();
+                for (Invoke invoke : graph.getInvokes()) {
+                    hints.add(invoke);
+                }
+                new InliningPhase(null, runtime(), hints, null, phasePlan).apply(graph);
+                new CanonicalizerPhase(null, runtime(), null).apply(graph);
+                Debug.dump(graph, "Graph");
+                new BoxingEliminationPhase().apply(graph);
+                Debug.dump(graph, "Graph");
+                new ExpandBoxingNodesPhase(pool).apply(graph);
+                new CanonicalizerPhase(null, runtime(), null).apply(graph);
+                new DeadCodeEliminationPhase().apply(graph);
+                StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET);
+                assertEquals(referenceGraph, graph);
+            }
+        });
     }
 }
--- a/hotspot/.project	Mon Feb 13 16:04:59 2012 +0100
+++ b/hotspot/.project	Tue Feb 14 11:28:57 2012 +0100
@@ -96,6 +96,11 @@
 			<locationURI>PARENT-1-PROJECT_LOC/build/linux/linux_amd64_graal/generated</locationURI>
 		</link>
 		<link>
+			<name>make</name>
+			<type>2</type>
+			<locationURI>WORKSPACE_LOC/make</locationURI>
+		</link>
+		<link>
 			<name>os</name>
 			<type>2</type>
 			<locationURI>PARENT-1-PROJECT_LOC/src/os/linux</locationURI>
--- a/mx/commands.py	Mon Feb 13 16:04:59 2012 +0100
+++ b/mx/commands.py	Tue Feb 14 11:28:57 2012 +0100
@@ -26,7 +26,7 @@
 #
 # ----------------------------------------------------------------------------------------------------
 
-import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, StringIO
+import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing
 from os.path import join, exists, dirname, basename
 from argparse import ArgumentParser, REMAINDER
 import mx
@@ -274,35 +274,25 @@
     """
     Get the JDK into which Graal is installed, creating it first if necessary.
     """
-    jdk = join(_graal_home, 'jdk' + mx.java().version)
+    jdk = join(_graal_home, 'jdk' + mx.java().version, build)
     jdkContents = ['bin', 'db', 'include', 'jre', 'lib']
     if mx.get_os() != 'windows':
         jdkContents.append('man')
-    if not exists(jdk):
-        srcJdk = mx.java().jdk
-        mx.log('Creating ' + jdk + ' from ' + srcJdk)
-        os.mkdir(jdk)
-        for d in jdkContents:
-            src = join(srcJdk, d)
-            dst = join(jdk, d)
-            if not exists(src):
-                mx.abort('Host JDK directory is missing: ' + src)
-            shutil.copytree(src, dst)
-    
-    if build == 'product':
-        return jdk
-    elif build in ['debug', 'fastdebug']:
-        res = join(jdk, build)
-        if not exists(res):
-            if not create:
-                mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'') 
-            mx.log('Creating ' + res)
-            os.mkdir(res)
+    if create:
+        if not exists(jdk):
+            srcJdk = mx.java().jdk
+            mx.log('Creating ' + jdk + ' from ' + srcJdk)
+            os.makedirs(jdk)
             for d in jdkContents:
-                shutil.copytree(join(jdk, d), join(res, d))
-        return res
+                src = join(srcJdk, d)
+                dst = join(jdk, d)
+                if not exists(src):
+                    mx.abort('Host JDK directory is missing: ' + src)
+                shutil.copytree(src, dst)
     else:
-        mx.abort('Unknown build type: ' + build)
+        if not exists(jdk):
+            mx.abort('The ' + build + ' VM has not been created - run \'mx clean; mx make ' + build + '\'')
+    return jdk 
 
 # run a command in the windows SDK Debug Shell
 def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo={}):
@@ -342,7 +332,7 @@
         log.close()
     return ret
     
-def build(args):
+def build(args, vm=None):
     """build the VM binary
     
     The global '--vm' option selects which VM to build. This command also
@@ -360,7 +350,9 @@
     if len(builds) == 0:
         builds = ['product']
 
-    vm = _vm
+    if vm is None:
+        vm = _vm
+        
     if vm == 'server':
         buildSuffix = ''
     elif vm == 'client':
@@ -370,7 +362,7 @@
         buildSuffix = 'graal'
         
     for build in builds:
-        jdk = _jdk(build, True)
+        jdk = _jdk(build, create=True)
             
         vmDir = join(jdk, 'jre', 'lib', 'amd64', vm)
         if not exists(vmDir):
@@ -400,14 +392,20 @@
                 mx.log('Error building project')
                 return 
         else:
+            cpus = multiprocessing.cpu_count()
             if build == 'debug':
                 build = 'jvmg'
             env = os.environ
             env.setdefault('ARCH_DATA_MODEL', '64')
             env.setdefault('LANG', 'C')
-            env.setdefault('HOTSPOT_BUILD_JOBS', '3')
+            env.setdefault('HOTSPOT_BUILD_JOBS', str(cpus))
             env['ALT_BOOTDIR'] = jdk
             env.setdefault('INSTALL', 'y')
+            
+            # Clear these 2 variables as having them set can cause very confusing build problems
+            env.pop('LD_LIBRARY_PATH', None)
+            env.pop('CLASSPATH', None)
+            
             mx.run([mx.gmake_cmd(), build + buildSuffix], cwd=join(_graal_home, 'make'), err=filterXusage)
         
         jvmCfg = join(jdk, 'jre', 'lib', 'amd64', 'jvm.cfg')
@@ -449,7 +447,7 @@
 # Table of unit tests.
 # Keys are project names, values are package name lists.
 # All source files in the given (project,package) pairs are scanned for lines
-# containing '@Test'. These are then detemrined to be the classes defining
+# containing '@Test'. These are then determined to be the classes defining
 # unit tests.
 _unittests = {
     'com.oracle.max.graal.tests': ['com.oracle.max.graal.compiler.tests'],
@@ -558,11 +556,18 @@
         mx.run(['ant', '-f', join(_graal_home, 'visualizer', 'build.xml'), '-q', 'clean', 'build'])
         tasks.append(t.stop())
 
+        # Prevent Graal modifications from breaking the standard client build
+        for v in ['client', 'server']:
+            for vmbuild in ['product', 'debug']:
+                t = Task('BuildHotSpot' + v.title() + ':' + vmbuild)
+                build(['--no-java', vmbuild], vm=v)
+                tasks.append(t.stop())
+
         for vmbuild in ['fastdebug', 'product']:
             global _vmbuild
             _vmbuild = vmbuild
             
-            t = Task('BuildHotSpot:' + vmbuild)
+            t = Task('BuildHotSpotGraal:' + vmbuild)
             build(['--no-java', vmbuild])
             tasks.append(t.stop())
             
--- a/src/cpu/x86/vm/c2_globals_x86.hpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/cpu/x86/vm/c2_globals_x86.hpp	Tue Feb 14 11:28:57 2012 +0100
@@ -39,7 +39,6 @@
 define_pd_global(bool, PreferInterpreterNativeStubs, false);
 define_pd_global(bool, ProfileTraps,                 true);
 define_pd_global(bool, UseOnStackReplacement,        true);
-define_pd_global(intx, TypeProfileWidth,             2   );
 #ifdef CC_INTERP
 define_pd_global(bool, ProfileInterpreter,           false);
 #else
--- a/src/share/vm/c1/c1_IR.hpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/c1/c1_IR.hpp	Tue Feb 14 11:28:57 2012 +0100
@@ -237,7 +237,8 @@
     // reexecute allowed only for the topmost frame
     bool reexecute = topmost ? should_reexecute() : false;
     bool return_oop = false; // This flag will be ignored since it used only for C2 with escape analysis.
-    recorder->describe_scope(pc_offset, (methodOop)scope()->method()->get_oop(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
+    methodHandle null_mh;
+    recorder->describe_scope(pc_offset, null_mh, scope()->method(), bci(), reexecute, false, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   }
 };
 
--- a/src/share/vm/c1/c1_LIRAssembler.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/c1/c1_LIRAssembler.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -405,7 +405,8 @@
     if (s == NULL)  break;
     IRScope* scope = s->scope();
     //Always pass false for reexecute since these ScopeDescs are never used for deopt
-    debug_info->describe_scope(pc_offset, (methodOop)scope->method()->get_oop(), s->bci(), false/*reexecute*/, false/*rethrow_exception*/);
+    methodHandle null_mh;
+    debug_info->describe_scope(pc_offset, null_mh, scope->method(), s->bci(), false/*reexecute*/);
   }
 
   debug_info->end_non_safepoint(pc_offset);
--- a/src/share/vm/ci/ciMethod.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/ci/ciMethod.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -97,12 +97,11 @@
   ciEnv *env = CURRENT_ENV;
   if (env->jvmti_can_hotswap_or_post_breakpoint() && can_be_compiled()) {
     // 6328518 check hotswap conditions under the right lock.
-    // TODO(tw): Check if we need that.
-    //MutexLocker locker(Compile_lock);
-    //if (Dependencies::check_evol_method(h_m()) != NULL) {
-    //  _is_c1_compilable = false;
-    //  _is_c2_compilable = false;
-    //}
+    MutexLocker locker(Compile_lock);
+    if (Dependencies::check_evol_method(h_m()) != NULL) {
+      _is_c1_compilable = false;
+      _is_c2_compilable = false;
+    }
   } else {
     CHECK_UNHANDLED_OOPS_ONLY(Thread::current()->clear_unhandled_oops());
   }
--- a/src/share/vm/code/debugInfoRec.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/code/debugInfoRec.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -280,7 +280,8 @@
 // must call add_safepoint before: it sets PcDesc and this routine uses
 // the last PcDesc set
 void DebugInformationRecorder::describe_scope(int         pc_offset,
-                                              methodHandle   method,
+                                              methodHandle methodH,
+                                              ciMethod*   method,
                                               int         bci,
                                               bool        reexecute,
                                               bool        rethrow_exception,
@@ -307,13 +308,24 @@
   stream()->write_int(sender_stream_offset);
 
   // serialize scope
-  jobject method_enc = JNIHandles::make_local(Thread::current(), method());
+  jobject method_enc;
+  if (method != NULL) {
+    method_enc = method->constant_encoding();
+  } else if (methodH.not_null()) {
+    method_enc = JNIHandles::make_local(Thread::current(), methodH());
+  } else {
+    method_enc = NULL;
+  }
   stream()->write_int(oop_recorder()->find_index(method_enc));
   stream()->write_bci(bci);
   assert(method == NULL ||
          (method->is_native() && bci == 0) ||
          (!method->is_native() && 0 <= bci && bci < method->code_size()) ||
          bci == -1, "illegal bci");
+  assert(methodH.is_null() ||
+         (methodH->is_native() && bci == 0) ||
+         (!methodH->is_native() && 0 <= bci && bci < methodH->code_size()) ||
+         bci == -1, "illegal bci");
 
   // serialize the locals/expressions/monitors
   stream()->write_int((intptr_t) locals);
--- a/src/share/vm/code/debugInfoRec.hpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/code/debugInfoRec.hpp	Tue Feb 14 11:28:57 2012 +0100
@@ -98,7 +98,8 @@
   // by add_non_safepoint, and the locals, expressions, and monitors
   // must all be null.
   void describe_scope(int         pc_offset,
-                      methodHandle   method,
+                      methodHandle methodH,
+                      ciMethod*   method,
                       int         bci,
                       bool        reexecute,
                       bool        rethrow_exception = false,
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -536,9 +536,9 @@
       throw_exception = true;
     }
 
-    _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token);
+    _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token);
   } else {
-    _debug_recorder->describe_scope(pc_offset, method, bci, reexecute, false, false, false, NULL, NULL, NULL);
+    _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, false, false, false, NULL, NULL, NULL);
   }
 }
 
--- a/src/share/vm/opto/output.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/opto/output.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -944,7 +944,9 @@
     assert(jvms->bci() >= InvocationEntryBci && jvms->bci() <= 0x10000, "must be a valid or entry BCI");
     assert(!jvms->should_reexecute() || depth == max_depth, "reexecute allowed only for the youngest");
     // Now we can describe the scope.
-    debug_info()->describe_scope(safepoint_pc_offset, (methodOop)scope_method->get_oop(), jvms->bci(), jvms->should_reexecute(), is_method_handle_invoke, return_oop, locvals, expvals, monvals);
+    methodHandle null_mh;
+    bool rethrow_exception = false;
+    debug_info()->describe_scope(safepoint_pc_offset, null_mh, scope_method, jvms->bci(), jvms->should_reexecute(), rethrow_exception, is_method_handle_invoke, return_oop, locvals, expvals, monvals);
   } // End jvms loop
 
   // Mark the end of the scope set.
@@ -1027,7 +1029,8 @@
     JVMState* jvms = youngest_jvms->of_depth(depth);
     ciMethod* method = jvms->has_method() ? jvms->method() : NULL;
     assert(!jvms->should_reexecute() || depth==max_depth, "reexecute allowed only for the youngest");
-    debug_info->describe_scope(pc_offset, (methodOop)method->get_oop(), jvms->bci(), jvms->should_reexecute());
+    methodHandle null_mh;
+    debug_info->describe_scope(pc_offset, null_mh, method, jvms->bci(), jvms->should_reexecute());
   }
 
   // Mark the end of the scope set.
--- a/src/share/vm/shark/sharkCacheDecache.cpp	Mon Feb 13 16:04:59 2012 +0100
+++ b/src/share/vm/shark/sharkCacheDecache.cpp	Tue Feb 14 11:28:57 2012 +0100
@@ -151,8 +151,10 @@
 
 void SharkDecacher::end_frame() {
   // Record the scope
+  methodHandle null_mh;
   debug_info()->describe_scope(
     pc_offset(),
+    null_mh,
     target(),
     bci(),
     true,