changeset 7685:7d66682cc901

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Fri, 01 Feb 2013 17:06:26 +0100
parents bbf97d6688d3 (current diff) 175fbf5a692c (diff)
children 149092d59dd0
files graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/EscapeAnalyzable.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/Operation.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/GenericParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationCodeGenerator.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationData.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationFieldData.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationMethodParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/ShortCircuitData.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/ShortCircuitParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationData.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationGuardData.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationListenerParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationParser.java graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationThrowsData.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/AddOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/BigIntegerLiteral.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/IfOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/IntegerLiteral.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/LessThanOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/LogicalAndOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/MulOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/ReadLocalOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/StringLiteral.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/TimeOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/WriteLocalOp.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/tools/GraphPrinter.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/FrameSlotNode.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/TypedNode.java graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/Types.java
diffstat 1135 files changed, 22217 insertions(+), 15559 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Feb 01 16:57:40 2013 +0100
+++ b/.hgignore	Fri Feb 01 17:06:26 2013 +0100
@@ -20,6 +20,7 @@
 ~$
 .gdb_history
 \.csv$
+\.iml$
 \.swp$
 \.class$
 \.log$
@@ -59,6 +60,7 @@
 ^.hgtip
 .DS_Store
 javadoc/
+.idea/
 syntax: glob
 *.bgv
 core.*
--- a/.hgtags	Fri Feb 01 16:57:40 2013 +0100
+++ b/.hgtags	Fri Feb 01 17:06:26 2013 +0100
@@ -299,3 +299,15 @@
 b61d9c88b759d1594b8af1655598e8fa00393672 hs25-b11
 25bdce771bb3a7ae9825261a284d292cda700122 jdk8-b67
 a35a72dd2e1255239d31f796f9f693e49b36bc9f hs25-b12
+121aa71316af6cd877bf455e775fa3fdbcdd4b65 jdk8-b68
+b6c9c0109a608eedbb6b868d260952990e3c91fe hs25-b13
+cb8a4e04bc8c104de8a2f67463c7e31232bf8d68 jdk8-b69
+990bbd393c239d95310ccc38094e57923bbf1d4a hs25-b14
+e94068d4ff52849c8aa0786a53a59b63d1312a39 jdk8-b70
+0847210f85480bf3848dc90bc2ab23c0a4791b55 jdk8-b71
+d5cb5830f570d1304ea4b196dde672a291b55f29 jdk8-b72
+1e129851479e4f5df439109fca2c7be1f1613522 hs25-b15
+11619f33cd683c2f1d6ef72f1c6ff3dacf5a9f1c jdk8-b73
+70c89bd6b895a10d25ca70e08093c09ff2005fda hs25-b16
+1a3e54283c54aaa8b3437813e8507fbdc966e5b6 jdk8-b74
+b4391649e91ea8d37f66317a03d6d2573a93d10d hs25-b17
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciArrayKlass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciField.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciInstance.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciMetadata.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjArrayKlass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciObject.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciObjectFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciSymbol.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciTypeArrayKlass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/classfile/ClassLoaderData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintTable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/BitData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Fri Feb 01 17:06:26 2013 +0100
@@ -69,6 +69,8 @@
     signatureIndex             = new CIntField(type.getCIntegerField("_signature_index"), 0);
     idnum                      = new CIntField(type.getCIntegerField("_method_idnum"), 0);
     maxStack                   = new CIntField(type.getCIntegerField("_max_stack"), 0);
+    maxLocals                  = new CIntField(type.getCIntegerField("_max_locals"), 0);
+    sizeOfParameters           = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
 
     // start of byte code
     bytecodeOffset = type.getSize();
@@ -96,6 +98,8 @@
   private static CIntField signatureIndex;
   private static CIntField idnum;
   private static CIntField maxStack;
+  private static CIntField maxLocals;
+  private static CIntField sizeOfParameters;
 
   // start of bytecode
   private static long bytecodeOffset;
@@ -151,6 +155,14 @@
     return maxStack.getValue(this);
   }
 
+  public long getMaxLocals() {
+    return maxLocals.getValue(this);
+  }
+
+  public long getSizeOfParameters() {
+    return sizeOfParameters.getValue(this);
+  }
+
   public Symbol getName() {
     return getMethod().getName();
   }
@@ -247,6 +259,8 @@
       visitor.doCInt(signatureIndex, true);
       visitor.doCInt(codeSize, true);
       visitor.doCInt(maxStack, true);
+      visitor.doCInt(maxLocals, true);
+      visitor.doCInt(sizeOfParameters, true);
     }
 
   // Accessors
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -52,6 +52,9 @@
   private static int LOW_OFFSET;
   private static int HIGH_OFFSET;
   private static int FIELD_SLOTS;
+  private static short FIELDINFO_TAG_SIZE;
+  private static short FIELDINFO_TAG_MASK;
+  private static short FIELDINFO_TAG_OFFSET;
 
   // ClassState constants
   private static int CLASS_STATE_ALLOCATED;
@@ -96,9 +99,13 @@
     NAME_INDEX_OFFSET              = db.lookupIntConstant("FieldInfo::name_index_offset").intValue();
     SIGNATURE_INDEX_OFFSET         = db.lookupIntConstant("FieldInfo::signature_index_offset").intValue();
     INITVAL_INDEX_OFFSET           = db.lookupIntConstant("FieldInfo::initval_index_offset").intValue();
-    LOW_OFFSET                     = db.lookupIntConstant("FieldInfo::low_offset").intValue();
-    HIGH_OFFSET                    = db.lookupIntConstant("FieldInfo::high_offset").intValue();
+    LOW_OFFSET                     = db.lookupIntConstant("FieldInfo::low_packed_offset").intValue();
+    HIGH_OFFSET                    = db.lookupIntConstant("FieldInfo::high_packed_offset").intValue();
     FIELD_SLOTS                    = db.lookupIntConstant("FieldInfo::field_slots").intValue();
+    FIELDINFO_TAG_SIZE             = db.lookupIntConstant("FIELDINFO_TAG_SIZE").shortValue();
+    FIELDINFO_TAG_MASK             = db.lookupIntConstant("FIELDINFO_TAG_MASK").shortValue();
+    FIELDINFO_TAG_OFFSET           = db.lookupIntConstant("FIELDINFO_TAG_OFFSET").shortValue();
+
     // read ClassState constants
     CLASS_STATE_ALLOCATED = db.lookupIntConstant("InstanceKlass::allocated").intValue();
     CLASS_STATE_LOADED = db.lookupIntConstant("InstanceKlass::loaded").intValue();
@@ -314,8 +321,12 @@
 
   public int getFieldOffset(int index) {
     U2Array fields = getFields();
-    return VM.getVM().buildIntFromShorts(fields.at(index * FIELD_SLOTS + LOW_OFFSET),
-                                         fields.at(index * FIELD_SLOTS + HIGH_OFFSET));
+    short lo = fields.at(index * FIELD_SLOTS + LOW_OFFSET);
+    short hi = fields.at(index * FIELD_SLOTS + HIGH_OFFSET);
+    if ((lo & FIELDINFO_TAG_MASK) == FIELDINFO_TAG_OFFSET) {
+      return VM.getVM().buildIntFromShorts(lo, hi) >> FIELDINFO_TAG_SIZE;
+    }
+    throw new RuntimeException("should not reach here");
   }
 
   // Accessors for declared fields
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Fri Feb 01 17:06:26 2013 +0100
@@ -50,8 +50,6 @@
     constMethod                = type.getAddressField("_constMethod");
     methodData                 = type.getAddressField("_method_data");
     methodSize                 = new CIntField(type.getCIntegerField("_method_size"), 0);
-    maxLocals                  = new CIntField(type.getCIntegerField("_max_locals"), 0);
-    sizeOfParameters           = new CIntField(type.getCIntegerField("_size_of_parameters"), 0);
     accessFlags                = new CIntField(type.getCIntegerField("_access_flags"), 0);
     code                       = type.getAddressField("_code");
     vtableIndex                = new CIntField(type.getCIntegerField("_vtable_index"), 0);
@@ -83,8 +81,6 @@
   private static AddressField  constMethod;
   private static AddressField  methodData;
   private static CIntField methodSize;
-  private static CIntField maxLocals;
-  private static CIntField sizeOfParameters;
   private static CIntField accessFlags;
   private static CIntField vtableIndex;
   private static CIntField invocationCounter;
@@ -134,8 +130,8 @@
   /** WARNING: this is in words, not useful in this system; use getObjectSize() instead */
   public long         getMethodSize()                 { return                methodSize.getValue(this);        }
   public long         getMaxStack()                   { return                getConstMethod().getMaxStack();   }
-  public long         getMaxLocals()                  { return                maxLocals.getValue(this);         }
-  public long         getSizeOfParameters()           { return                sizeOfParameters.getValue(this);  }
+  public long         getMaxLocals()                  { return                getConstMethod().getMaxLocals();         }
+  public long         getSizeOfParameters()           { return                getConstMethod().getSizeOfParameters();  }
   public long         getNameIndex()                  { return                getConstMethod().getNameIndex();  }
   public long         getSignatureIndex()             { return            getConstMethod().getSignatureIndex(); }
   public long         getGenericSignatureIndex()      { return     getConstMethod().getGenericSignatureIndex(); }
@@ -282,8 +278,6 @@
 
   public void iterateFields(MetadataVisitor visitor) {
       visitor.doCInt(methodSize, true);
-      visitor.doCInt(maxLocals, true);
-      visitor.doCInt(sizeOfParameters, true);
       visitor.doCInt(accessFlags, true);
     }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ProfileData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/RetData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Block_Array.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Block_List.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/CallDynamicJavaNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/CallJavaNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/CallNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/CallRuntimeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/CallStaticJavaNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/HaltNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/LoopNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallJavaNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallRuntimeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachCallStaticJavaNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachIfNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachReturnNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MachSafePointNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/MultiNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Node.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Node_Array.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Node_List.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Phase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseRegAlloc.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/PhiNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/ProjNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/RegionNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/RootNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/SafePointNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/opto/TypeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/prims/JvmtiExport.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/GenericGrowableArray.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/GrowableArray.java	Fri Feb 01 17:06:26 2013 +0100
@@ -16,9 +16,9 @@
  * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * 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.
  *
  */
 
--- a/agent/src/share/native/sadis.c	Fri Feb 01 16:57:40 2013 +0100
+++ b/agent/src/share/native/sadis.c	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012, Oracle and/or its affiliates. All Rights Reserved.
+ * 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
--- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,173 +28,237 @@
 import com.oracle.graal.nodes.cfg.*;
 
 /**
- * Computes an ordering of the block that can be used by the linear scan register allocator
- * and the machine code generator.
+ * Computes an ordering of the block that can be used by the linear scan register allocator and the
+ * machine code generator. The machine code generation order will start with the first block and
+ * produce a straight sequence always following the most likely successor. Then it will continue
+ * with the most likely path that was left out during this process. The process iteratively
+ * continues until all blocks are scheduled. Additionally, it is guaranteed that all blocks of a
+ * loop are scheduled before any block following the loop is scheduled.
+ * 
+ * The machine code generator order includes reordering of loop headers such that the backward jump
+ * is a conditional jump if there is only one loop end block. Additionally, the target of loop
+ * backward jumps are always marked as aligned. Aligning the target of conditional jumps does not
+ * bring a measurable benefit and is therefore avoided to keep the code size small.
+ * 
+ * The linear scan register allocator order has an additional mechanism that prevents merge nodes
+ * from being scheduled if there is at least one highly likely predecessor still unscheduled. This
+ * increases the probability that the merge node and the corresponding predecessor are more closely
+ * together in the schedule thus decreasing the probability for inserted phi moves. Also, the
+ * algorithm sets the linear scan order number of the block that corresponds to its index in the
+ * linear scan order.
  */
 public final class ComputeBlockOrder {
-    private List<Block> linearScanOrder;
-    private List<Block> codeEmittingOrder;
+
+    /**
+     * The initial capacities of the worklists used for iteratively finding the block order.
+     */
+    private static final int INITIAL_WORKLIST_CAPACITY = 10;
+
+    /**
+     * Divisor used for degrading the probability of the current path versus unscheduled paths at a
+     * merge node when calculating the linear scan order. A high value means that predecessors of
+     * merge nodes are more likely to be scheduled before the merge node.
+     */
+    private static final int PENALTY_VERSUS_UNSCHEDULED = 10;
+
+    /**
+     * Computes the block order used for the linear scan register allocator.
+     * 
+     * @return sorted list of blocks
+     */
+    public static List<Block> computeLinearScanOrder(int blockCount, Block startBlock) {
+        List<Block> order = new ArrayList<>();
+        BitSet visitedBlocks = new BitSet(blockCount);
+        PriorityQueue<Block> worklist = initializeWorklist(startBlock, visitedBlocks);
+        computeLinearScanOrder(order, worklist, visitedBlocks);
+        assert checkOrder(order, blockCount);
+        return order;
+    }
+
+    /**
+     * Computes the block order used for code emission.
+     * 
+     * @return sorted list of blocks
+     */
+    public static List<Block> computeCodeEmittingOrder(int blockCount, Block startBlock) {
+        List<Block> order = new ArrayList<>();
+        BitSet visitedBlocks = new BitSet(blockCount);
+        PriorityQueue<Block> worklist = initializeWorklist(startBlock, visitedBlocks);
+        computeCodeEmittingOrder(order, worklist, visitedBlocks);
+        assert checkOrder(order, blockCount);
+        return order;
+    }
+
+    /**
+     * Iteratively adds paths to the code emission block order.
+     */
+    private static void computeCodeEmittingOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
+        while (!worklist.isEmpty()) {
+            Block nextImportantPath = worklist.poll();
+            addPathToCodeEmittingOrder(nextImportantPath, order, worklist, visitedBlocks);
+        }
+    }
+
+    /**
+     * Iteratively adds paths to the linear scan block order.
+     */
+    private static void computeLinearScanOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
+        while (!worklist.isEmpty()) {
+            Block nextImportantPath = worklist.poll();
+            addPathToLinearScanOrder(nextImportantPath, order, worklist, visitedBlocks);
+        }
+    }
+
+    /**
+     * Initializes the priority queue used for the work list of blocks and adds the start block.
+     */
+    private static PriorityQueue<Block> initializeWorklist(Block startBlock, BitSet visitedBlocks) {
+        PriorityQueue<Block> result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, blockComparator);
+        result.add(startBlock);
+        visitedBlocks.set(startBlock.getId());
+        return result;
+    }
+
+    /**
+     * Add a linear path to the linear scan order greedily following the most likely successor.
+     */
+    private static void addPathToLinearScanOrder(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
+        block.setLinearScanNumber(order.size());
+        order.add(block);
+        Block mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks);
+        enqueueSuccessors(block, worklist, visitedBlocks);
+        if (mostLikelySuccessor != null) {
+            if (!mostLikelySuccessor.isLoopHeader() && mostLikelySuccessor.getPredecessorCount() > 1) {
+                // We are at a merge. Check probabilities of predecessors that are not yet
+                // scheduled.
+                double unscheduledSum = 0.0;
+                for (Block pred : mostLikelySuccessor.getPredecessors()) {
+                    if (!visitedBlocks.get(pred.getId())) {
+                        unscheduledSum += pred.getBeginNode().probability();
+                    }
+                }
+
+                if (unscheduledSum > block.getProbability() / PENALTY_VERSUS_UNSCHEDULED) {
+                    // Add this merge only after at least one additional predecessor gets scheduled.
+                    visitedBlocks.clear(mostLikelySuccessor.getId());
+                    return;
+                }
+            }
+            addPathToLinearScanOrder(mostLikelySuccessor, order, worklist, visitedBlocks);
+        }
+    }
 
-    private Comparator<Block> blockComparator = new Comparator<Block>() {
+    /**
+     * Add a linear path to the code emission order greedily following the most likely successor.
+     */
+    private static void addPathToCodeEmittingOrder(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
+
+        // Skip loop headers if there is only a single loop end block to make the backward jump be a
+        // conditional jump.
+        if (!skipLoopHeader(block)) {
+
+            // Align unskipped loop headers as they are the target of the backward jump.
+            if (block.isLoopHeader()) {
+                block.setAlign(true);
+            }
+            addBlock(block, order);
+        }
+
+        Loop loop = block.getLoop();
+        if (block.isLoopEnd() && skipLoopHeader(loop.header)) {
+
+            // This is the only loop end of a skipped loop header. Add the header immediately
+            // afterwards.
+            addBlock(loop.header, order);
+
+            // Make sure the loop successors of the loop header are aligned as they are the target
+            // of the backward jump.
+            for (Block successor : loop.header.getSuccessors()) {
+                if (successor.getLoopDepth() == block.getLoopDepth()) {
+                    successor.setAlign(true);
+                }
+            }
+        }
+
+        Block mostLikelySuccessor = findAndMarkMostLikelySuccessor(block, visitedBlocks);
+        enqueueSuccessors(block, worklist, visitedBlocks);
+        if (mostLikelySuccessor != null) {
+            addPathToCodeEmittingOrder(mostLikelySuccessor, order, worklist, visitedBlocks);
+        }
+    }
+
+    /**
+     * Adds a block to the ordering.
+     */
+    private static void addBlock(Block header, List<Block> order) {
+        assert !order.contains(header) : "Cannot insert block twice";
+        order.add(header);
+    }
+
+    /**
+     * Find the highest likely unvisited successor block of a given block.
+     */
+    private static Block findAndMarkMostLikelySuccessor(Block block, BitSet visitedBlocks) {
+        Block result = null;
+        for (Block successor : block.getSuccessors()) {
+            assert successor.getProbability() >= 0.0 : "Probabilities must be positive";
+            if (!visitedBlocks.get(successor.getId()) && successor.getLoopDepth() >= block.getLoopDepth() && (result == null || successor.getProbability() >= result.getProbability())) {
+                result = successor;
+            }
+        }
+        if (result != null) {
+            visitedBlocks.set(result.getId());
+        }
+        return result;
+    }
+
+    /**
+     * Add successor blocks into the given work list if they are not already marked as visited.
+     */
+    private static void enqueueSuccessors(Block block, PriorityQueue<Block> worklist, BitSet visitedBlocks) {
+        for (Block successor : block.getSuccessors()) {
+            if (!visitedBlocks.get(successor.getId())) {
+                visitedBlocks.set(successor.getId());
+                worklist.add(successor);
+            }
+        }
+    }
+
+    /**
+     * Skip the loop header block if the loop consists of more than one block and it has only a
+     * single loop end block.
+     */
+    private static boolean skipLoopHeader(Block block) {
+        return (block.isLoopHeader() && !block.isLoopEnd() && block.getLoop().loopBegin().loopEnds().count() == 1);
+    }
+
+    /**
+     * Checks that the ordering contains the expected number of blocks.
+     */
+    private static boolean checkOrder(List<Block> order, int expectedBlockCount) {
+        assert order.size() == expectedBlockCount : String.format("Number of blocks in ordering (%d) does not match expected block count (%d)", order.size(), expectedBlockCount);
+        return true;
+    }
+
+    /**
+     * Comparator for sorting blocks based on loop depth and probability.
+     */
+    private static Comparator<Block> blockComparator = new Comparator<Block>() {
+
         @Override
-        public int compare(Block o1, Block o2) {
+        public int compare(Block a, Block b) {
             // Loop blocks before any loop exit block.
-            int diff = o2.getLoopDepth() - o1.getLoopDepth();
+            int diff = b.getLoopDepth() - a.getLoopDepth();
             if (diff != 0) {
                 return diff;
             }
 
             // Blocks with high probability before blocks with low probability.
-            if (o1.getBeginNode().probability() > o2.getBeginNode().probability()) {
+            if (a.getProbability() > b.getProbability()) {
                 return -1;
             } else {
                 return 1;
             }
-        }};
-
-    public ComputeBlockOrder(int maxBlockId, @SuppressWarnings("unused") int loopCount, Block startBlock, @SuppressWarnings("unused") boolean reorderLoops) {
-
-        List<Block> newLinearScanOrder = new ArrayList<>();
-        List<Block> order = new ArrayList<>();
-        PriorityQueue<Block> worklist = new PriorityQueue<>(10, blockComparator);
-        BitSet orderedBlocks = new BitSet(maxBlockId);
-        orderedBlocks.set(startBlock.getId());
-        worklist.add(startBlock);
-        computeCodeEmittingOrder(order, worklist, orderedBlocks);
-        codeEmittingOrder = order;
-
-        orderedBlocks.clear();
-        orderedBlocks.set(startBlock.getId());
-        worklist.add(startBlock);
-        computeNewLinearScanOrder(newLinearScanOrder, worklist, orderedBlocks);
-
-        assert order.size() == newLinearScanOrder.size() : codeEmittingOrder.size() + " vs " + newLinearScanOrder.size();
-        linearScanOrder = newLinearScanOrder;
-    }
-
-    private void computeCodeEmittingOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet orderedBlocks) {
-        while (!worklist.isEmpty()) {
-            Block nextImportantPath = worklist.poll();
-            addImportantPath(nextImportantPath, order, worklist, orderedBlocks);
         }
-    }
-
-    private void computeNewLinearScanOrder(List<Block> order, PriorityQueue<Block> worklist, BitSet orderedBlocks) {
-        while (!worklist.isEmpty()) {
-            Block nextImportantPath = worklist.poll();
-            addImportantLinearScanOrderPath(nextImportantPath, order, worklist, orderedBlocks);
-        }
-    }
-
-    private void addImportantLinearScanOrderPath(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet orderedBlocks) {
-        order.add(block);
-
-        Block bestSucc = null;
-        double bestSuccProb = 0;
-
-        for (Block succ : block.getSuccessors()) {
-            if (!orderedBlocks.get(succ.getId()) && succ.getLoopDepth() >= block.getLoopDepth()) {
-                double curProb = succ.getBeginNode().probability();
-                if (curProb >= bestSuccProb) {
-                    bestSuccProb = curProb;
-                    bestSucc = succ;
-                }
-                assert curProb >= 0 : curProb;
-            }
-        }
-
-        for (Block succ : block.getSuccessors()) {
-            if (!orderedBlocks.get(succ.getId())) {
-                if (succ != bestSucc) {
-                    orderedBlocks.set(succ.getId());
-                    worklist.add(succ);
-                }
-            }
-        }
-
-        if (bestSucc != null) {
-            if (!bestSucc.isLoopHeader() && bestSucc.getPredecessors().size() > 1) {
-                // We are at a merge. Check probabilities of predecessors that are not yet scheduled.
-                double unscheduledSum = 0.0;
-                double scheduledSum = 0.0;
-                for (Block pred : bestSucc.getPredecessors()) {
-                    if (!orderedBlocks.get(pred.getId())) {
-                        unscheduledSum += pred.getBeginNode().probability();
-                    } else {
-                        scheduledSum += pred.getBeginNode().probability();
-                    }
-                }
-
-                if (unscheduledSum > 0.0 && unscheduledSum > scheduledSum / 10) {
-                    return;
-                }
-            }
-            orderedBlocks.set(bestSucc.getId());
-            addImportantLinearScanOrderPath(bestSucc, order, worklist, orderedBlocks);
-        }
-    }
-
-    private void addImportantPath(Block block, List<Block> order, PriorityQueue<Block> worklist, BitSet orderedBlocks) {
-        if (!skipLoopHeader(block)) {
-            if (block.isLoopHeader()) {
-                block.align = true;
-            }
-            order.add(block);
-        }
-        if (block.isLoopEnd() && skipLoopHeader(block.getLoop().header)) {
-            order.add(block.getLoop().header);
-            for (Block succ : block.getLoop().header.getSuccessors()) {
-                if (succ.getLoopDepth() == block.getLoopDepth()) {
-                    succ.align = true;
-                }
-            }
-        }
-        Block bestSucc = null;
-        double bestSuccProb = 0;
-
-        for (Block succ : block.getSuccessors()) {
-            if (!orderedBlocks.get(succ.getId()) && succ.getLoopDepth() >= block.getLoopDepth()) {
-                double curProb = succ.getBeginNode().probability();
-                if (curProb >= bestSuccProb) {
-                    bestSuccProb = curProb;
-                    bestSucc = succ;
-                }
-                assert curProb >= 0 : curProb;
-            }
-        }
-
-        for (Block succ : block.getSuccessors()) {
-            if (!orderedBlocks.get(succ.getId())) {
-                if (succ != bestSucc) {
-                    orderedBlocks.set(succ.getId());
-                    worklist.add(succ);
-                }
-            }
-        }
-
-        if (bestSucc != null) {
-            orderedBlocks.set(bestSucc.getId());
-            addImportantPath(bestSucc, order, worklist, orderedBlocks);
-        }
-    }
-
-    private static boolean skipLoopHeader(Block bestSucc) {
-        return (bestSucc.isLoopHeader() && !bestSucc.isLoopEnd() && bestSucc.getLoop().loopBegin().loopEnds().count() == 1);
-    }
-
-    /**
-     * Returns the block order used for the linear scan register allocator.
-     * @return list of sorted blocks
-     */
-    public List<Block> linearScanOrder() {
-        return linearScanOrder;
-    }
-
-    /**
-     * Returns the block order used for machine code generation.
-     * @return list of sorted blocks2222
-     */
-    public List<Block> codeEmittingOrder() {
-        return codeEmittingOrder;
-    }
+    };
 }
--- a/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.amd64/src/com/oracle/graal/amd64/AMD64.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,8 @@
  */
 public class AMD64 extends Architecture {
 
+    // @formatter:off
+
     // General purpose CPU registers
     public static final Register rax = new Register(0, 0, 8, "rax", CPU, RegisterFlag.Byte);
     public static final Register rcx = new Register(1, 1, 8, "rcx", CPU, RegisterFlag.Byte);
@@ -114,4 +116,5 @@
               r15.encoding + 1,
               8);
     }
+    // @formatter:on
 }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Address.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,15 +27,17 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents an address in target machine memory, specified via some combination of a base register, an index register,
- * a displacement and a scale. Note that the base and index registers may be a variable that will get a register assigned
- * later by the register allocator.
+ * Represents an address in target machine memory, specified via some combination of a base
+ * register, an index register, a displacement and a scale. Note that the base and index registers
+ * may be a variable that will get a register assigned later by the register allocator.
  */
 public final class Address extends Value {
+
     private static final long serialVersionUID = -1003772042519945089L;
 
     /**
-     * A sentinel value used as a place holder in an instruction stream for an address that will be patched.
+     * A sentinel value used as a place holder in an instruction stream for an address that will be
+     * patched.
      */
     public static final Address Placeholder = new Address(Kind.Illegal, Value.ILLEGAL);
 
@@ -46,7 +48,7 @@
 
     /**
      * Creates an {@link Address} with given base register, no scaling and no displacement.
-     *
+     * 
      * @param kind the kind of the value being addressed
      * @param base the base register
      */
@@ -56,7 +58,7 @@
 
     /**
      * Creates an {@link Address} with given base register, no scaling and a given displacement.
-     *
+     * 
      * @param kind the kind of the value being addressed
      * @param base the base register
      * @param displacement the displacement
@@ -68,7 +70,7 @@
     /**
      * Creates an {@link Address} with given base and index registers, scaling and displacement.
      * This is the most general constructor.
-     *
+     * 
      * @param kind the kind of the value being addressed
      * @param base the base register
      * @param index the index register
@@ -90,10 +92,7 @@
      * A scaling factor used in complex addressing modes such as those supported by x86 platforms.
      */
     public enum Scale {
-        Times1(1, 0),
-        Times2(2, 1),
-        Times4(4, 2),
-        Times8(8, 3);
+        Times1(1, 0), Times2(2, 1), Times4(4, 2), Times8(8, 3);
 
         private Scale(int value, int log2) {
             this.value = value;
@@ -112,11 +111,16 @@
 
         public static Scale fromInt(int scale) {
             switch (scale) {
-                case 1:  return Times1;
-                case 2:  return Times2;
-                case 4:  return Times4;
-                case 8:  return Times8;
-                default: throw new IllegalArgumentException(String.valueOf(scale));
+                case 1:
+                    return Times1;
+                case 2:
+                    return Times2;
+                case 4:
+                    return Times4;
+                case 8:
+                    return Times8;
+                default:
+                    throw new IllegalArgumentException(String.valueOf(scale));
             }
         }
     }
@@ -151,7 +155,8 @@
     public boolean equals(Object obj) {
         if (obj instanceof Address) {
             Address addr = (Address) obj;
-            return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase()) && getScale() == addr.getScale() && getIndex().equals(addr.getIndex());
+            return getKind() == addr.getKind() && getDisplacement() == addr.getDisplacement() && getBase().equals(addr.getBase()) && getScale() == addr.getScale() &&
+                            getIndex().equals(addr.getIndex());
         }
         return false;
     }
@@ -162,8 +167,8 @@
     }
 
     /**
-     * @return Base register that defines the start of the address computation.
-     * If not present, is denoted by {@link Value#ILLEGAL}.
+     * @return Base register that defines the start of the address computation. If not present, is
+     *         denoted by {@link Value#ILLEGAL}.
      */
     public Value getBase() {
         return base;
@@ -174,8 +179,8 @@
     }
 
     /**
-     * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to {@link #base}.
-     * If not present, is denoted by {@link Value#ILLEGAL}.
+     * @return Index register, the value of which (possibly scaled by {@link #scale}) is added to
+     *         {@link #base}. If not present, is denoted by {@link Value#ILLEGAL}.
      */
     public Value getIndex() {
         return index;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Architecture.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,9 @@
 
 import com.oracle.graal.api.code.Register.*;
 
-
 /**
- * Represents a CPU architecture, including information such as its endianness, CPU
- * registers, word width, etc.
+ * Represents a CPU architecture, including information such as its endianness, CPU registers, word
+ * width, etc.
  */
 public abstract class Architecture {
 
@@ -37,18 +36,19 @@
      * The endianness of the architecture.
      */
     public static enum ByteOrder {
-        LittleEndian,
-        BigEndian
+        LittleEndian, BigEndian
     }
 
     /**
-     * The number of bits required in a bit map covering all the registers that may store references.
-     * The bit position of a register in the map is the register's {@linkplain Register#number number}.
+     * The number of bits required in a bit map covering all the registers that may store
+     * references. The bit position of a register in the map is the register's
+     * {@linkplain Register#number number}.
      */
     private final int registerReferenceMapBitCount;
 
     /**
-     * Represents the natural size of words (typically registers and pointers) of this architecture, in bytes.
+     * Represents the natural size of words (typically registers and pointers) of this architecture,
+     * in bytes.
      */
     private final int wordSize;
 
@@ -69,8 +69,8 @@
     private final ByteOrder byteOrder;
 
     /**
-     * Mask of the barrier constants denoting the barriers that
-     * are not required to be explicitly inserted under this architecture.
+     * Mask of the barrier constants denoting the barriers that are not required to be explicitly
+     * inserted under this architecture.
      */
     private final int implicitMemoryBarriers;
 
@@ -80,8 +80,8 @@
     private final int machineCodeCallDisplacementOffset;
 
     /**
-     * The size of the return address pushed to the stack by a call instruction.
-     * A value of 0 denotes that call linkage uses registers instead (e.g. SPARC).
+     * The size of the return address pushed to the stack by a call instruction. A value of 0
+     * denotes that call linkage uses registers instead (e.g. SPARC).
      */
     private final int returnAddressSize;
 
@@ -89,7 +89,7 @@
 
     /**
      * Gets the register for a given {@linkplain Register#encoding encoding} and type.
-     *
+     * 
      * @param encoding a register value as used in a machine instruction
      * @param type the type of the register
      */
@@ -101,13 +101,7 @@
         return reg;
     }
 
-    protected Architecture(String name,
-                    int wordSize,
-                    ByteOrder byteOrder,
-                    Register[] registers,
-                    int implicitMemoryBarriers,
-                    int nativeCallDisplacementOffset,
-                    int registerReferenceMapBitCount,
+    protected Architecture(String name, int wordSize, ByteOrder byteOrder, Register[] registers, int implicitMemoryBarriers, int nativeCallDisplacementOffset, int registerReferenceMapBitCount,
                     int returnAddressSize) {
         this.name = name;
         this.registers = registers;
@@ -133,6 +127,7 @@
 
     /**
      * Converts this architecture to a string.
+     * 
      * @return the string representation of this architecture
      */
     @Override
@@ -145,7 +140,8 @@
     }
 
     /**
-     * Gets the natural size of words (typically registers and pointers) of this architecture, in bytes.
+     * Gets the natural size of words (typically registers and pointers) of this architecture, in
+     * bytes.
      */
     public int getWordSize() {
         return wordSize;
@@ -159,8 +155,8 @@
     }
 
     /**
-     * Gets an array of all available registers on this architecture. The index of each register in this
-     * array is equal to its {@linkplain Register#number number}.
+     * Gets an array of all available registers on this architecture. The index of each register in
+     * this array is equal to its {@linkplain Register#number number}.
      */
     public Register[] getRegisters() {
         return registers.clone();
@@ -171,16 +167,16 @@
     }
 
     /**
-     * Gets a mask of the barrier constants denoting the barriers that
-     * are not required to be explicitly inserted under this architecture.
+     * Gets a mask of the barrier constants denoting the barriers that are not required to be
+     * explicitly inserted under this architecture.
      */
     public int getImplicitMemoryBarriers() {
         return implicitMemoryBarriers;
     }
 
     /**
-     * Gets the size of the return address pushed to the stack by a call instruction.
-     * A value of 0 denotes that call linkage uses registers instead.
+     * Gets the size of the return address pushed to the stack by a call instruction. A value of 0
+     * denotes that call linkage uses registers instead.
      */
     public int getReturnAddressSize() {
         return returnAddressSize;
@@ -194,8 +190,9 @@
     }
 
     /**
-     * Determines the barriers in a given barrier mask that are explicitly required on this architecture.
-     *
+     * Determines the barriers in a given barrier mask that are explicitly required on this
+     * architecture.
+     * 
      * @param barriers a mask of the barrier constants
      * @return the value of {@code barriers} minus the barriers unnecessary on this architecture
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -99,8 +99,8 @@
         private static final long serialVersionUID = -7636746737947390059L;
 
         /**
-         * A virtual (or interface) method whose unique implementation for the receiver type
-         * in {@link #context} is {@link #impl}.
+         * A virtual (or interface) method whose unique implementation for the receiver type in
+         * {@link #context} is {@link #impl}.
          */
         public final ResolvedJavaMethod method;
 
@@ -182,7 +182,8 @@
     }
 
     /**
-     * Array with the assumptions. This field is directly accessed from C++ code in the Graal/HotSpot implementation.
+     * Array with the assumptions. This field is directly accessed from C++ code in the
+     * Graal/HotSpot implementation.
      */
     private Assumption[] list;
     private boolean useOptimisticAssumptions;
@@ -194,6 +195,7 @@
 
     /**
      * Returns whether any assumptions have been registered.
+     * 
      * @return {@code true} if at least one assumption has been registered, {@code false} otherwise.
      */
     public boolean isEmpty() {
@@ -207,16 +209,20 @@
     @Override
     public Iterator<Assumption> iterator() {
         return new Iterator<Assumptions.Assumption>() {
+
             int index;
+
             public void remove() {
                 throw new UnsupportedOperationException();
             }
+
             public Assumption next() {
                 if (index >= count) {
                     throw new NoSuchElementException();
                 }
                 return list[index++];
             }
+
             public boolean hasNext() {
                 return index < count;
             }
@@ -225,18 +231,20 @@
 
     /**
      * Records an assumption that the specified type has no finalizable subclasses.
-     *
+     * 
      * @param receiverType the type that is assumed to have no finalizable subclasses
-     * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise
+     * @return {@code true} if the assumption was recorded and can be assumed; {@code false}
+     *         otherwise
      */
     public boolean recordNoFinalizableSubclassAssumption(ResolvedJavaType receiverType) {
-        // TODO (thomaswue): Record that assumption correctly.
         assert useOptimisticAssumptions;
         return false;
     }
 
     /**
-     * Records that {@code subtype} is the only concrete subtype in the class hierarchy below {@code context}.
+     * Records that {@code subtype} is the only concrete subtype in the class hierarchy below
+     * {@code context}.
+     * 
      * @param context the root of the subtree of the class hierarchy that this assumptions is about
      * @param subtype the one concrete subtype
      */
@@ -248,7 +256,7 @@
     /**
      * Records that {@code impl} is the only possible concrete target for a virtual call to
      * {@code method} with a receiver of type {@code context}.
-     *
+     * 
      * @param method a method that is the target of a virtual call
      * @param context the receiver type of a call to {@code method}
      * @param impl the concrete method that is the only possible target for the virtual call
@@ -260,7 +268,7 @@
 
     /**
      * Records that {@code method} was used during the compilation.
-     *
+     * 
      * @param method a method whose contents were used
      */
     public void recordMethodContents(ResolvedJavaMethod method) {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BailoutException.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,9 +25,9 @@
 import java.util.*;
 
 /**
- * Exception thrown when the compiler refuses to compile a method because of problems with the method.
- * e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is <i>not</i>
- * meant to indicate problems with the compiler itself.
+ * Exception thrown when the compiler refuses to compile a method because of problems with the
+ * method. e.g. bytecode wouldn't verify, too big, JSR/ret too complicated, etc. This exception is
+ * <i>not</i> meant to indicate problems with the compiler itself.
  */
 public class BailoutException extends RuntimeException {
 
@@ -35,7 +35,7 @@
 
     /**
      * Creates a new {@link BailoutException}.
-     *
+     * 
      * @param reason a message indicating the reason
      */
     public BailoutException(String reason) {
@@ -44,7 +44,7 @@
 
     /**
      * Creates a new {@link BailoutException}.
-     *
+     * 
      * @param args parameters to the formatter
      */
     public BailoutException(String format, Object... args) {
@@ -53,7 +53,7 @@
 
     /**
      * Creates a new {@link BailoutException} due to an internal exception being thrown.
-     *
+     * 
      * @param reason a message indicating the reason
      * @param cause the throwable that was the cause of the bailout
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,26 +27,43 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents the Java bytecode frame state(s) at a given position
- * including {@link Value locations} where to find the local variables,
- * operand stack values and locked objects of the bytecode frame(s).
+ * Represents the Java bytecode frame state(s) at a given position including {@link Value locations}
+ * where to find the local variables, operand stack values and locked objects of the bytecode
+ * frame(s).
  */
 public class BytecodeFrame extends BytecodePosition implements Serializable {
+
     private static final long serialVersionUID = -345025397165977565L;
 
     /**
-     * An array of values representing how to reconstruct the state of the Java frame.
-     * This is array is partitioned as follows:
+     * An array of values representing how to reconstruct the state of the Java frame. This is array
+     * is partitioned as follows:
      * <p>
      * <table border="1" cellpadding="5" frame="void", rules="all">
-     * <tr><th>Start index (inclusive)</th><th>End index (exclusive)</th><th>Description</th></tr>
-     * <tr><td>0</td>                   <td>numLocals</td>           <td>Local variables</td></tr>
-     * <tr><td>numLocals</td>           <td>numLocals + numStack</td><td>Operand stack</td></tr>
-     * <tr><td>numLocals + numStack</td><td>values.length</td>       <td>Locked objects</td></tr>
+     * <tr>
+     * <th>Start index (inclusive)</th>
+     * <th>End index (exclusive)</th>
+     * <th>Description</th>
+     * </tr>
+     * <tr>
+     * <td>0</td>
+     * <td>numLocals</td>
+     * <td>Local variables</td>
+     * </tr>
+     * <tr>
+     * <td>numLocals</td>
+     * <td>numLocals + numStack</td>
+     * <td>Operand stack</td>
+     * </tr>
+     * <tr>
+     * <td>numLocals + numStack</td>
+     * <td>values.length</td>
+     * <td>Locked objects</td>
+     * </tr>
      * </table>
      * <p>
-     * Note that the number of locals and the number of stack slots may be smaller than the
-     * maximum number of locals and stack slots as specified in the compiled method.
+     * Note that the number of locals and the number of stack slots may be smaller than the maximum
+     * number of locals and stack slots as specified in the compiled method.
      */
     public final Value[] values;
 
@@ -66,8 +83,10 @@
     public final int numLocks;
 
     /**
-     * In case this frame state belongs to a deoptimization, the leafGraphId will contain the StructuredGraph.graphId() of the graph that originally introduced this deoptimization point.
-     * This id is later on used by the runtime system to evict graphs from the graph cache when deoptimizations originating from them have been hit.
+     * In case this frame state belongs to a deoptimization, the leafGraphId will contain the
+     * StructuredGraph.graphId() of the graph that originally introduced this deoptimization point.
+     * This id is later on used by the runtime system to evict graphs from the graph cache when
+     * deoptimizations originating from them have been hit.
      */
     public final long leafGraphId;
 
@@ -77,17 +96,19 @@
 
     /**
      * Creates a new frame object.
-     *
+     * 
      * @param caller the caller frame (which may be {@code null})
      * @param method the method
      * @param bci a BCI within the method
-     * @param rethrowException specifies if the VM should re-throw the pending exception when deopt'ing using this frame
+     * @param rethrowException specifies if the VM should re-throw the pending exception when
+     *            deopt'ing using this frame
      * @param values the frame state {@link #values}
      * @param numLocals the number of local variables
      * @param numStack the depth of the stack
      * @param numLocks the number of locked objects
      */
-    public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks, long leafGraphId) {
+    public BytecodeFrame(BytecodeFrame caller, ResolvedJavaMethod method, int bci, boolean rethrowException, boolean duringCall, Value[] values, int numLocals, int numStack, int numLocks,
+                    long leafGraphId) {
         super(caller, method, bci);
         assert values != null;
         this.rethrowException = rethrowException;
@@ -102,6 +123,7 @@
 
     /**
      * Gets the value representing the specified local variable.
+     * 
      * @param i the local variable index
      * @return the value that can be used to reconstruct the local's current value
      */
@@ -111,6 +133,7 @@
 
     /**
      * Gets the value representing the specified stack slot.
+     * 
      * @param i the stack index
      * @return the value that can be used to reconstruct the stack slot's current value
      */
@@ -120,6 +143,7 @@
 
     /**
      * Gets the value representing the specified lock.
+     * 
      * @param i the lock index
      * @return the value that can be used to reconstruct the lock's current value
      */
@@ -129,7 +153,7 @@
 
     /**
      * Gets the caller of this frame.
-     *
+     * 
      * @return {@code null} if this frame has no caller
      */
     public BytecodeFrame caller() {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodePosition.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,10 +27,10 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents a code position, that is, a chain of inlined methods with bytecode
- * locations, that is communicated from the compiler to the runtime system. A code position
- * can be used by the runtime system to reconstruct a source-level stack trace
- * for exceptions and to create {@linkplain BytecodeFrame frames} for deoptimization.
+ * Represents a code position, that is, a chain of inlined methods with bytecode locations, that is
+ * communicated from the compiler to the runtime system. A code position can be used by the runtime
+ * system to reconstruct a source-level stack trace for exceptions and to create
+ * {@linkplain BytecodeFrame frames} for deoptimization.
  */
 public abstract class BytecodePosition implements Serializable {
 
@@ -42,7 +42,7 @@
 
     /**
      * Constructs a new object representing a given parent/caller, a given method, and a given BCI.
-     *
+     * 
      * @param caller the parent position
      * @param method the method
      * @param bci a BCI within the method
@@ -56,6 +56,7 @@
 
     /**
      * Converts this code position to a string representation.
+     * 
      * @return a string representation of this code position
      */
     @Override
@@ -89,9 +90,9 @@
     }
 
     /**
-     * @return The location within the method, as a bytecode index. The constant
-     * {@code -1} may be used to indicate the location is unknown, for example
-     * within code synthesized by the compiler.
+     * @return The location within the method, as a bytecode index. The constant {@code -1} may be
+     *         used to indicate the location is unknown, for example within code synthesized by the
+     *         compiler.
      */
     public int getBCI() {
         return bci;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CalleeSaveLayout.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,13 +24,11 @@
 
 import java.util.*;
 
-
 /**
- * The callee save area (CSA) is a contiguous space in a stack frame
- * used to save (and restore) the values of the caller's registers.
- * This class describes the layout of a CSA in terms of its
- * {@linkplain #size size}, {@linkplain #slotSize slot size} and
- * the {@linkplain #registers callee save registers} covered by the CSA.
+ * The callee save area (CSA) is a contiguous space in a stack frame used to save (and restore) the
+ * values of the caller's registers. This class describes the layout of a CSA in terms of its
+ * {@linkplain #size size}, {@linkplain #slotSize slot size} and the {@linkplain #registers callee
+ * save registers} covered by the CSA.
  */
 public class CalleeSaveLayout {
 
@@ -57,16 +55,18 @@
     public final Register[] registers;
 
     /**
-     * The offset from the frame pointer to the CSA. If this is not known, then this field
-     * will have the value {@link Integer#MAX_VALUE}.
+     * The offset from the frame pointer to the CSA. If this is not known, then this field will have
+     * the value {@link Integer#MAX_VALUE}.
      */
     public final int frameOffsetToCSA;
 
     /**
      * Creates a CSA layout.
-     *
-     * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be computed from {@code registers}.
-     * @param slotSize the size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the CSA
+     * 
+     * @param size size (in bytes) of the CSA. If this is {@code -1}, then the CSA size will be
+     *            computed from {@code registers}.
+     * @param slotSize the size (in bytes) of an {@linkplain #registerAt(int) indexable} slot in the
+     *            CSA
      * @param registers the registers that can be saved in the CSA
      */
     public CalleeSaveLayout(int frameOffsetToCSA, int size, int slotSize, Register... registers) {
@@ -109,7 +109,7 @@
 
     /**
      * Gets the offset of a given register in the CSA.
-     *
+     * 
      * @return the offset (in bytes) of {@code reg} in the CSA
      * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
      */
@@ -119,7 +119,7 @@
 
     /**
      * Gets the index of a given register in the CSA.
-     *
+     * 
      * @return the index of {@code reg} in the CSA
      * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
      */
@@ -132,7 +132,7 @@
 
     /**
      * Gets the offset of a given register in the CSA.
-     *
+     * 
      * @return the offset (in bytes) of {@code reg} in the CSA
      * @throws IllegalArgumentException if {@code reg} does not have a slot in the CSA
      */
@@ -142,7 +142,7 @@
 
     /**
      * Determines if the CSA includes a slot for a given register.
-     *
+     * 
      * @param reg the register to test
      * @return true if the CSA contains a slot for {@code reg}
      */
@@ -152,10 +152,10 @@
 
     /**
      * Gets the register whose slot in the CSA is at a given index.
-     *
+     * 
      * @param index an index of a slot in the CSA
-     * @return the register whose slot in the CSA is at  {@code index} or {@code null} if {@code index} does not denote a
-     *         slot in the CSA aligned with a register
+     * @return the register whose slot in the CSA is at {@code index} or {@code null} if
+     *         {@code index} does not denote a slot in the CSA aligned with a register
      */
     public Register registerAt(int index) {
         if (index < 0 || index >= indexToReg.length) {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,9 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 /**
- * A calling convention describes the locations in which the arguments for a call are placed,
- * the location in which the return value is placed if the call is not void and any
+ * A calling convention describes the locations in which the arguments for a call are placed, the
+ * location in which the return value is placed if the call is not void and any
  * {@linkplain #getTemporaries() extra} locations used (and killed) by the call.
  */
 public class CallingConvention {
@@ -49,13 +48,14 @@
         JavaCallee(false),
 
         /**
-         * A request for the outgoing argument locations at a call site to the runtime (which may be Java or native code).
+         * A request for the outgoing argument locations at a call site to the runtime (which may be
+         * Java or native code).
          */
         RuntimeCall(true),
 
         /**
-         * A request for the outgoing argument locations at a call site to
-         * external native code that complies with the platform ABI.
+         * A request for the outgoing argument locations at a call site to external native code that
+         * complies with the platform ABI.
          */
         NativeCall(true);
 
@@ -90,9 +90,11 @@
 
     /**
      * Creates a description of the registers and stack locations used by a call.
-     *
-     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call
-     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void call
+     * 
+     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of
+     *            the call
+     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
+     *            call
      * @param argumentLocations the ordered locations in which the arguments are placed
      */
     public CallingConvention(int stackSize, Value returnLocation, Value... argumentLocations) {
@@ -101,10 +103,13 @@
 
     /**
      * Creates a description of the registers and stack locations used by a call.
-     *
-     * @param temporaryLocations the locations used (and killed) by the call in addition to {@code arguments}
-     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call
-     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void call
+     * 
+     * @param temporaryLocations the locations used (and killed) by the call in addition to
+     *            {@code arguments}
+     * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of
+     *            the call
+     * @param returnLocation the location for the return value or {@link Value#ILLEGAL} if a void
+     *            call
      * @param argumentLocations the ordered locations in which the arguments are placed
      */
     public CallingConvention(Value[] temporaryLocations, int stackSize, Value returnLocation, Value... argumentLocations) {
@@ -147,7 +152,8 @@
     }
 
     /**
-     * Gets the locations used (and killed) by the call apart from the {@linkplain #getArgument(int) arguments}.
+     * Gets the locations used (and killed) by the call apart from the
+     * {@linkplain #getArgument(int) arguments}.
      */
     public Value[] getTemporaries() {
         if (temporaryLocations.length == 0) {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeCacheProvider.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,14 +32,15 @@
 public interface CodeCacheProvider extends MetaAccessProvider {
 
     /**
-     * Adds the given compilation result as an implementation of the given method without making it the default
-     * implementation.
-     *
+     * Adds the given compilation result as an implementation of the given method without making it
+     * the default implementation.
+     * 
      * @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
+     * @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);
 
@@ -50,30 +51,31 @@
 
     /**
      * Returns a disassembly of the given installed code.
-     *
+     * 
      * @param code the code that should be disassembled
-     * @return a disassembly. This will be of length 0 if the runtime does not support disassembling.
+     * @return a disassembly. This will be of length 0 if the runtime does not support
+     *         disassembling.
      */
     String disassemble(CodeInfo code, CompilationResult tm);
 
     /**
      * Gets the register configuration to use when compiling a given method.
-     *
+     * 
      * @param method the top level method of a compilation
      */
     RegisterConfig lookupRegisterConfig(ResolvedJavaMethod method);
 
     /**
      * Custom area on the stack of each compiled method that the VM can use for its own purposes.
-     *
+     * 
      * @return the size of the custom area in bytes
      */
     int getCustomStackAreaSize();
 
     /**
-     * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all cases, even when
-     * the compiled method has no regular call instructions.
-     *
+     * Minimum size of the stack area reserved for outgoing parameters. This area is reserved in all
+     * cases, even when the compiled method has no regular call instructions.
+     * 
      * @return the minimum size of the outgoing parameter area in bytes
      */
     int getMinimumOutgoingSize();
@@ -90,15 +92,15 @@
 
     /**
      * Encodes a deoptimization action and a deoptimization reason in an integer value.
-     *
+     * 
      * @return the encoded value as an integer
      */
     int encodeDeoptActionAndReason(DeoptimizationAction action, DeoptimizationReason reason);
 
     /**
-     * Determines if a {@link DataPatch} should be created for a given {@linkplain Constant#getPrimitiveAnnotation() annotated}
-     * primitive constant that part of a {@link CompilationResult}. A data patch is always
-     * created for an object constant.
+     * Determines if a {@link DataPatch} should be created for a given
+     * {@linkplain Constant#getPrimitiveAnnotation() annotated} primitive constant that part of a
+     * {@link CompilationResult}. A data patch is always created for an object constant.
      */
     boolean needsDataPatch(Constant constant);
 }
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,9 +25,9 @@
 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).
+ * 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 {
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CodeUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,8 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.code} and its clients.
+ * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.code} and its
+ * clients.
  */
 public class CodeUtil {
 
@@ -46,7 +47,7 @@
 
     /**
      * Checks whether the specified integer is a power of two.
-     *
+     * 
      * @param val the value to check
      * @return {@code true} if the value is a power of two; {@code false} otherwise
      */
@@ -56,7 +57,7 @@
 
     /**
      * Checks whether the specified long is a power of two.
-     *
+     * 
      * @param val the value to check
      * @return {@code true} if the value is a power of two; {@code false} otherwise
      */
@@ -65,9 +66,9 @@
     }
 
     /**
-     * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4}
-     * )
-     *
+     * Computes the log (base 2) of the specified integer, rounding down. (E.g {@code log2(8) = 3},
+     * {@code log2(21) = 4} )
+     * 
      * @param val the value
      * @return the log base 2 of the value
      */
@@ -77,8 +78,9 @@
     }
 
     /**
-     * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3}, {@code log2(21) = 4})
-     *
+     * Computes the log (base 2) of the specified long, rounding down. (E.g {@code log2(8) = 3},
+     * {@code log2(21) = 4})
+     * 
      * @param val the value
      * @return the log base 2 of the value
      */
@@ -89,7 +91,7 @@
 
     /**
      * Formats the values in a frame as a tabulated string.
-     *
+     * 
      * @param frame
      * @return the values in {@code frame} as a tabulated string
      */
@@ -127,8 +129,9 @@
     }
 
     /**
-     * Formats a given table as a string. The value of each cell is produced by {@link String#valueOf(Object)}.
-     *
+     * Formats a given table as a string. The value of each cell is produced by
+     * {@link String#valueOf(Object)}.
+     * 
      * @param cells the cells of the table in row-major order
      * @param cols the number of columns per row
      * @param lpad the number of space padding inserted before each formatted cell value
@@ -176,7 +179,7 @@
 
     /**
      * Appends a formatted code position to a {@link StringBuilder}.
-     *
+     * 
      * @param sb the {@link StringBuilder} to append to
      * @param pos the code position to format and append to {@code sb}
      * @return the value of {@code sb}
@@ -192,7 +195,7 @@
 
     /**
      * Appends a formatted frame to a {@link StringBuilder}.
-     *
+     * 
      * @param sb the {@link StringBuilder} to append to
      * @param frame the frame to format and append to {@code sb}
      * @return the value of {@code sb}
@@ -243,8 +246,8 @@
         private final Register[] registers;
 
         /**
-         * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding to bit 0 in the frame
-         * reference map.
+         * The offset (in bytes) from the slot pointed to by {@link #fp} to the slot corresponding
+         * to bit 0 in the frame reference map.
          */
         public final int refMapToFPOffset;
 
@@ -272,7 +275,7 @@
 
     /**
      * Appends a formatted debug info to a {@link StringBuilder}.
-     *
+     * 
      * @param sb the {@link StringBuilder} to append to
      * @param info the debug info to format and append to {@code sb}
      * @return the value of {@code sb}
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents the output from compiling a method, including the compiled machine code, associated data and references,
- * relocation information, deoptimization information, etc.
+ * Represents the output from compiling a method, including the compiled machine code, associated
+ * data and references, relocation information, deoptimization information, etc.
  */
 public class CompilationResult implements Serializable {
 
@@ -39,6 +39,7 @@
      * Represents a code position with associated additional information.
      */
     public abstract static class Site implements Serializable {
+
         private static final long serialVersionUID = -8214214947651979102L;
         /**
          * The position (or offset) of this site with respect to the start of the target method.
@@ -54,6 +55,7 @@
      * Represents a safepoint with associated debug info.
      */
     public static class Safepoint extends Site implements Comparable<Safepoint> {
+
         private static final long serialVersionUID = 2479806696381720162L;
         public final DebugInfo debugInfo;
 
@@ -86,6 +88,7 @@
      * Represents a call in the code.
      */
     public static final class Call extends Safepoint {
+
         private static final long serialVersionUID = 1440741241631046954L;
 
         /**
@@ -99,9 +102,9 @@
         public final int size;
 
         /**
-         * Specifies if this call is direct or indirect. A direct call has an immediate operand encoding
-         * the absolute or relative (to the call itself) address of the target. An indirect call has a
-         * register or memory operand specifying the target address of the call.
+         * Specifies if this call is direct or indirect. A direct call has an immediate operand
+         * encoding the absolute or relative (to the call itself) address of the target. An indirect
+         * call has a register or memory operand specifying the target address of the call.
          */
         public final boolean direct;
 
@@ -132,6 +135,7 @@
      * Represents a reference to data from the code. The associated data can be any constant.
      */
     public static final class DataPatch extends Site {
+
         private static final long serialVersionUID = 5771730331604867476L;
         public final Constant constant;
         public final int alignment;
@@ -155,10 +159,12 @@
     }
 
     /**
-     * Provides extra information about instructions or data at specific positions in {@link CompilationResult#getTargetCode()}.
-     * This is optional information that can be used to enhance a disassembly of the code.
+     * Provides extra information about instructions or data at specific positions in
+     * {@link CompilationResult#getTargetCode()}. This is optional information that can be used to
+     * enhance a disassembly of the code.
      */
     public abstract static class CodeAnnotation implements Serializable {
+
         private static final long serialVersionUID = -7903959680749520748L;
         public final int position;
 
@@ -171,11 +177,13 @@
      * A string comment about one or more instructions at a specific position in the code.
      */
     public static final class CodeComment extends CodeAnnotation {
+
         /**
          *
          */
         private static final long serialVersionUID = 6802287188701961401L;
         public final String value;
+
         public CodeComment(int position, String comment) {
             super(position);
             this.value = comment;
@@ -191,8 +199,10 @@
      * Labels some inline data in the code.
      */
     public static final class InlineData extends CodeAnnotation {
+
         private static final long serialVersionUID = 305997507263827108L;
         public final int size;
+
         public InlineData(int position, int size) {
             super(position);
             this.size = size;
@@ -205,13 +215,16 @@
     }
 
     /**
-     * Describes a table of signed offsets embedded in the code. The offsets are relative to the starting
-     * address of the table. This type of table maybe generated when translating a multi-way branch
-     * based on a key value from a dense value set (e.g. the {@code tableswitch} JVM instruction).
-     *
-     * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high} inclusive.
+     * Describes a table of signed offsets embedded in the code. The offsets are relative to the
+     * starting address of the table. This type of table maybe generated when translating a
+     * multi-way branch based on a key value from a dense value set (e.g. the {@code tableswitch}
+     * JVM instruction).
+     * 
+     * The table is indexed by the contiguous range of integers from {@link #low} to {@link #high}
+     * inclusive.
      */
     public static final class JumpTable extends CodeAnnotation {
+
         private static final long serialVersionUID = 2222194398353801831L;
 
         /**
@@ -243,11 +256,12 @@
     }
 
     /**
-     * Describes a table of key and offset pairs. The offset in each table entry is relative to the address of
-     * the table. This type of table maybe generated when translating a multi-way branch
+     * Describes a table of key and offset pairs. The offset in each table entry is relative to the
+     * address of the table. This type of table maybe generated when translating a multi-way branch
      * based on a key value from a sparse value set (e.g. the {@code lookupswitch} JVM instruction).
      */
     public static final class LookupTable extends CodeAnnotation {
+
         private static final long serialVersionUID = 8367952567559116160L;
 
         /**
@@ -279,10 +293,11 @@
     }
 
     /**
-     * Represents exception handler information for a specific code position. It includes the catch code position as
-     * well as the caught exception type.
+     * Represents exception handler information for a specific code position. It includes the catch
+     * code position as well as the caught exception type.
      */
     public static final class ExceptionHandler extends Site {
+
         private static final long serialVersionUID = 4897339464722665281L;
         public final int handlerPos;
 
@@ -298,10 +313,11 @@
     }
 
     /**
-     * Represents a mark in the machine code that can be used by the runtime for its own purposes. A mark
-     * can reference other marks.
+     * Represents a mark in the machine code that can be used by the runtime for its own purposes. A
+     * mark can reference other marks.
      */
     public static final class Mark extends Site {
+
         private static final long serialVersionUID = 3612943150662354844L;
         public final Object id;
         public final Mark[] references;
@@ -358,9 +374,9 @@
     }
 
     /**
-     * Sets the frame size in bytes. Does not include the return address pushed onto the
-     * stack, if any.
-     *
+     * Sets the frame size in bytes. Does not include the return address pushed onto the stack, if
+     * any.
+     * 
      * @param size the size of the frame in bytes
      */
     public void setFrameSize(int size) {
@@ -369,7 +385,7 @@
 
     /**
      * Sets the machine that has been generated by the compiler.
-     *
+     * 
      * @param code the machine code generated
      * @param size the size of the machine code
      */
@@ -380,7 +396,7 @@
 
     /**
      * Sets the info on callee-saved registers used by this method.
-     *
+     * 
      * @param csl the register-saving info.
      */
     public void setCalleeSaveLayout(CalleeSaveLayout csl) {
@@ -388,11 +404,13 @@
     }
 
     /**
-     * Records a reference to the data section in the code section (e.g. to load an integer or floating point constant).
-     *
+     * Records a reference to the data section in the code section (e.g. to load an integer or
+     * floating point constant).
+     * 
      * @param codePos the position in the code where the data reference occurs
      * @param data the data that is referenced
-     * @param alignment the alignment requirement of the data or 0 if there is no alignment requirement
+     * @param alignment the alignment requirement of the data or 0 if there is no alignment
+     *            requirement
      * @param inlined specifies if the data is encoded inline or is loaded from a separate data area
      */
     public void recordDataReference(int codePos, Constant data, int alignment, boolean inlined) {
@@ -402,7 +420,7 @@
 
     /**
      * Records a call in the code array.
-     *
+     * 
      * @param codePos the position of the call in the code array
      * @param size the size of the call instruction
      * @param target the {@link CodeCacheProvider#lookupCallTarget(Object) target} being called
@@ -416,9 +434,9 @@
 
     /**
      * Records an exception handler for this method.
-     *
-     * @param codePos  the position in the code that is covered by the handler
-     * @param handlerPos    the position of the handler
+     * 
+     * @param codePos the position in the code that is covered by the handler
+     * @param handlerPos the position of the handler
      */
     public void recordExceptionHandler(int codePos, int handlerPos) {
         getExceptionHandlers().add(new ExceptionHandler(codePos, handlerPos));
@@ -426,7 +444,7 @@
 
     /**
      * Records a safepoint in the code array.
-     *
+     * 
      * @param codePos the position of the safepoint in the code array
      * @param debugInfo the debug info for the safepoint
      */
@@ -445,7 +463,7 @@
 
     /**
      * Records an instruction mark within this method.
-     *
+     * 
      * @param codePos the position in the code that is covered by the handler
      * @param id the identifier for this mark
      * @param references an array of other marks that this mark references
@@ -457,9 +475,10 @@
     }
 
     /**
-     * Allows a method to specify the offset of the epilogue that restores the callee saved registers. Must be called
-     * iff the method is a callee saved method and stores callee registers on the stack.
-     *
+     * Allows a method to specify the offset of the epilogue that restores the callee saved
+     * registers. Must be called iff the method is a callee saved method and stores callee registers
+     * on the stack.
+     * 
      * @param registerRestoreEpilogueOffset the offset in the machine code where the epilogue begins
      */
     public void setRegisterRestoreEpilogueOffset(int registerRestoreEpilogueOffset) {
@@ -469,7 +488,7 @@
 
     /**
      * The frame size of the method in bytes.
-     *
+     * 
      * @return the frame size
      */
     public int getFrameSize() {
@@ -478,8 +497,8 @@
     }
 
     /**
-     * @return the code offset of the start of the epilogue that restores all callee saved registers, or -1 if this is
-     *         not a callee saved method
+     * @return the code offset of the start of the epilogue that restores all callee saved
+     *         registers, or -1 if this is not a callee saved method
      */
     public int getRegisterRestoreEpilogueOffset() {
         return registerRestoreEpilogueOffset;
@@ -487,6 +506,7 @@
 
     /**
      * Offset in bytes for the custom stack area (relative to sp).
+     * 
      * @return the offset in bytes
      */
     public int getCustomStackAreaOffset() {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import java.util.*;
 
 /**
- * Represents the debugging information for a particular place in the code,
- * which includes the code position, a reference map, and deoptimization information.
+ * Represents the debugging information for a particular place in the code, which includes the code
+ * position, a reference map, and deoptimization information.
  */
 public class DebugInfo implements Serializable {
 
@@ -39,8 +39,9 @@
 
     /**
      * Creates a new {@link DebugInfo} from the given values.
-     *
-     * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame frame} info
+     * 
+     * @param codePos the {@linkplain BytecodePosition code position} or {@linkplain BytecodeFrame
+     *            frame} info
      * @param registerRefMap the register map
      * @param frameRefMap the reference map for {@code frame}, which may be {@code null}
      */
@@ -71,10 +72,9 @@
         return getFrameRefMap() != null && getFrameRefMap().size() > 0;
     }
 
-
     /**
      * Gets the deoptimization information for each inlined frame (if available).
-     *
+     * 
      * @return {@code null} if no frame de-opt info is {@linkplain #hasFrame() available}
      */
     public BytecodeFrame frame() {
@@ -90,25 +90,26 @@
     }
 
     /**
-     * @return The code position (including all inlined methods) of this debug info.
-     * If this is a {@link BytecodeFrame} instance, then it is also the deoptimization information for each inlined frame.
+     * @return The code position (including all inlined methods) of this debug info. If this is a
+     *         {@link BytecodeFrame} instance, then it is also the deoptimization information for
+     *         each inlined frame.
      */
     public BytecodePosition getBytecodePosition() {
         return bytecodePosition;
     }
 
     /**
-     * @return The reference map for the registers at this point. The reference map is <i>packed</i> in that
-     * for bit {@code k} in byte {@code n}, it refers to the register whose
-     * {@linkplain Register#number number} is {@code (k + n * 8)}.
+     * @return The reference map for the registers at this point. The reference map is <i>packed</i>
+     *         in that for bit {@code k} in byte {@code n}, it refers to the register whose
+     *         {@linkplain Register#number number} is {@code (k + n * 8)}.
      */
     public BitSet getRegisterRefMap() {
         return registerRefMap;
     }
 
     /**
-     * @return The reference map for the stack frame at this point. A set bit at {@code k} in the map
-     * represents stack slot number {@code k}.
+     * @return The reference map for the stack frame at this point. A set bit at {@code k} in the
+     *         map represents stack slot number {@code k}.
      */
     public BitSet getFrameRefMap() {
         return frameRefMap;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DeoptimizationAction.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DeoptimizationAction.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,19 +23,20 @@
 package com.oracle.graal.api.code;
 
 /**
- * Specifies the action that should be taken by the runtime in case a certain deoptimization is triggered.
+ * Specifies the action that should be taken by the runtime in case a certain deoptimization is
+ * triggered.
  */
 public enum DeoptimizationAction {
     /**
-     * Do not invalidate the machine code.
-     * This is typically used when deoptimizing at a point where it's highly likely
-     * nothing will change the likelihood of the deoptimization happening again.
+     * Do not invalidate the machine code. This is typically used when deoptimizing at a point where
+     * it's highly likely nothing will change the likelihood of the deoptimization happening again.
      * For example, a compiled array allocation where the size is negative.
      */
     None,
 
     /**
-     * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is triggered too often.
+     * Do not invalidate the machine code, but schedule a recompilation if this deoptimization is
+     * triggered too often.
      */
     RecompileIfTooManyDeopts,
 
@@ -45,10 +46,9 @@
     InvalidateReprofile,
 
     /**
-     * Invalidate the machine code and immediately schedule a recompilation.
-     * This is typically used when deoptimizing to resolve an unresolved symbol in
-     * which case extra profiling is not required to determine that the deoptimization
-     * will not re-occur.
+     * Invalidate the machine code and immediately schedule a recompilation. This is typically used
+     * when deoptimizing to resolve an unresolved symbol in which case extra profiling is not
+     * required to determine that the deoptimization will not re-occur.
      */
     InvalidateRecompile,
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/InstalledCode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents a compiled instance of a method. It may have been invalidated or removed in the meantime.
+ * Represents a compiled instance of a method. It may have been invalidated or removed in the
+ * meantime.
  */
 public interface InstalledCode {
 
@@ -43,12 +44,14 @@
     ResolvedJavaMethod getMethod();
 
     /**
-     * @return true if the code represented by this object is still valid, false otherwise (may happen due to deopt, etc.)
+     * @return true if the code represented by this object is still valid, false otherwise (may
+     *         happen due to deopt, etc.)
      */
     boolean isValid();
 
     /**
      * Executes the installed code with three object arguments.
+     * 
      * @param arg1 the first argument
      * @param arg2 the second argument
      * @param arg3 the third argument
@@ -58,6 +61,7 @@
 
     /**
      * Executes the installed code with a variable number of arguments.
+     * 
      * @param args the array of object arguments
      * @return the value returned by the executed code
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MemoryBarriers.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,20 +24,22 @@
 
 /**
  * Constants and intrinsic definition for memory barriers.
- *
- * The documentation for each constant is taken from Doug Lea's
- * <a href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler Writers</a>.
+ * 
+ * The documentation for each constant is taken from Doug Lea's <a
+ * href="http://gee.cs.oswego.edu/dl/jmm/cookbook.html">The JSR-133 Cookbook for Compiler
+ * Writers</a>.
  * <p>
- * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory Model
- * with respect to volatile field accesses. Their values are explained by this
- * comment from templateTable_i486.cpp in the HotSpot source code:
+ * The {@code JMM_*} constants capture the memory barriers necessary to implement the Java Memory
+ * Model with respect to volatile field accesses. Their values are explained by this comment from
+ * templateTable_i486.cpp in the HotSpot source code:
+ * 
  * <pre>
  * Volatile variables demand their effects be made known to all CPU's in
  * order.  Store buffers on most chips allow reads & writes to reorder; the
  * JMM's ReadAfterWrite.java test fails in -Xint mode without some kind of
  * memory barrier (i.e., it's not sufficient that the interpreter does not
  * reorder volatile references, the hardware also must not reorder them).
- *
+ * 
  * According to the new Java Memory Model (JMM):
  * (1) All volatiles are serialized wrt to each other.
  * ALSO reads & writes act as acquire & release, so:
@@ -48,7 +50,7 @@
  * that happen BEFORE the write float down to after the write.  It's OK for
  * non-volatile memory refs that happen after the volatile write to float up
  * before it.
- *
+ * 
  * We only put in barriers around volatile refs (they are expensive), not
  * _between_ memory refs (which would require us to track the flavor of the
  * previous memory refs).  Requirements (2) and (3) require some barriers
@@ -61,40 +63,45 @@
 public class MemoryBarriers {
 
     /**
-     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded before data accessed
-     * by {@code Load2} and all subsequent load instructions are loaded. In general, explicit {@code LoadLoad}
-     * barriers are needed on processors that perform speculative loads and/or out-of-order processing in which
-     * waiting load instructions can bypass waiting stores. On processors that guarantee to always preserve load
-     * ordering, these barriers amount to no-ops.
+     * The sequence {@code Load1; LoadLoad; Load2} ensures that {@code Load1}'s data are loaded
+     * before data accessed by {@code Load2} and all subsequent load instructions are loaded. In
+     * general, explicit {@code LoadLoad} barriers are needed on processors that perform speculative
+     * loads and/or out-of-order processing in which waiting load instructions can bypass waiting
+     * stores. On processors that guarantee to always preserve load ordering, these barriers amount
+     * to no-ops.
      */
-    public static final int LOAD_LOAD   = 0x0001;
+    public static final int LOAD_LOAD = 0x0001;
 
     /**
-     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded before all data
-     * associated with {@code Store2} and subsequent store instructions are flushed. {@code LoadStore} barriers are
-     * needed only on those out-of-order processors in which waiting store instructions can bypass loads.
+     * The sequence {@code Load1; LoadStore; Store2} ensures that {@code Load1}'s data are loaded
+     * before all data associated with {@code Store2} and subsequent store instructions are flushed.
+     * {@code LoadStore} barriers are needed only on those out-of-order processors in which waiting
+     * store instructions can bypass loads.
      */
-    public static final int LOAD_STORE  = 0x0002;
+    public static final int LOAD_STORE = 0x0002;
 
     /**
-     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made visible to other
-     * processors (i.e., flushed to main memory) before data accessed by {@code Load2} and all subsequent load
-     * instructions are loaded. {@code StoreLoad} barriers protect against a subsequent load incorrectly using
-     * {@code Store1}'s data value rather than that from a more recent store to the same location performed by a
-     * different processor. Because of this, on the processors discussed below, a {@code StoreLoad} is strictly
-     * necessary only for separating stores from subsequent loads of the same location(s) as were stored before the
-     * barrier. {@code StoreLoad} barriers are needed on nearly all recent multiprocessors, and are usually the most
-     * expensive kind. Part of the reason they are expensive is that they must disable mechanisms that ordinarily
-     * bypass cache to satisfy loads from write-buffers. This might be implemented by letting the buffer fully
-     * flush, among other possible stalls.
+     * The sequence {@code Store1; StoreLoad; Load2} ensures that {@code Store1}'s data are made
+     * visible to other processors (i.e., flushed to main memory) before data accessed by
+     * {@code Load2} and all subsequent load instructions are loaded. {@code StoreLoad} barriers
+     * protect against a subsequent load incorrectly using {@code Store1}'s data value rather than
+     * that from a more recent store to the same location performed by a different processor.
+     * Because of this, on the processors discussed below, a {@code StoreLoad} is strictly necessary
+     * only for separating stores from subsequent loads of the same location(s) as were stored
+     * before the barrier. {@code StoreLoad} barriers are needed on nearly all recent
+     * multiprocessors, and are usually the most expensive kind. Part of the reason they are
+     * expensive is that they must disable mechanisms that ordinarily bypass cache to satisfy loads
+     * from write-buffers. This might be implemented by letting the buffer fully flush, among other
+     * possible stalls.
      */
-    public static final int STORE_LOAD  = 0x0004;
+    public static final int STORE_LOAD = 0x0004;
 
     /**
-     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are visible to other
-     * processors (i.e., flushed to memory) before the data associated with {@code Store2} and all subsequent store
-     * instructions. In general, {@code StoreStore} barriers are needed on processors that do not otherwise
-     * guarantee strict ordering of flushes from write buffers and/or caches to other processors or main memory.
+     * The sequence {@code Store1; StoreStore; Store2} ensures that {@code Store1}'s data are
+     * visible to other processors (i.e., flushed to memory) before the data associated with
+     * {@code Store2} and all subsequent store instructions. In general, {@code StoreStore} barriers
+     * are needed on processors that do not otherwise guarantee strict ordering of flushes from
+     * write buffers and/or caches to other processors or main memory.
      */
     public static final int STORE_STORE = 0x0008;
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MonitorValue.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/MonitorValue.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
  * Represents lock information in the debug information.
  */
 public final class MonitorValue extends Value {
+
     private static final long serialVersionUID = 8241681800464483691L;
 
     private Value owner;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,16 +40,16 @@
     public static final Register None = new Register(-1, -1, 0, "noreg");
 
     /**
-     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments
-     * are addressed relative to this register.
+     * Frame pointer of the current method. All spill slots and outgoing stack-based arguments are
+     * addressed relative to this register.
      */
     public static final Register Frame = new Register(-2, -2, 0, "framereg", RegisterFlag.CPU);
 
     public static final Register CallerFrame = new Register(-3, -3, 0, "callerframereg", RegisterFlag.CPU);
 
     /**
-     * The identifier for this register that is unique across all the registers in a {@link Architecture}.
-     * A valid register has {@code number > 0}.
+     * The identifier for this register that is unique across all the registers in a
+     * {@link Architecture}. A valid register has {@code number > 0}.
      */
     public final int number;
 
@@ -59,8 +59,8 @@
     public final String name;
 
     /**
-     * The actual encoding in a target machine instruction for this register, which may or
-     * may not be the same as {@link #number}.
+     * The actual encoding in a target machine instruction for this register, which may or may not
+     * be the same as {@link #number}.
      */
     public final int encoding;
 
@@ -75,14 +75,14 @@
     private final int flags;
 
     /**
-     * An array of {@link RegisterValue} objects, for this register, with one entry
-     * per {@link Kind}, indexed by {@link Kind#ordinal}.
+     * An array of {@link RegisterValue} objects, for this register, with one entry per {@link Kind}
+     * , indexed by {@link Kind#ordinal}.
      */
     private final RegisterValue[] values;
 
     /**
      * Attributes that characterize a register in a useful way.
-     *
+     * 
      */
     public enum RegisterFlag {
         /**
@@ -105,7 +105,7 @@
 
     /**
      * Creates a {@link Register} instance.
-     *
+     * 
      * @param number unique identifier for the register
      * @param encoding the target machine encoding for the register
      * @param spillSlotSize the size of the stack slot used to spill the value of the register
@@ -139,6 +139,7 @@
 
     /**
      * Gets this register as a {@linkplain RegisterValue value} with a specified kind.
+     * 
      * @param kind the specified kind
      * @return the {@link RegisterValue}
      */
@@ -148,6 +149,7 @@
 
     /**
      * Gets this register as a {@linkplain RegisterValue value} with no particular kind.
+     * 
      * @return a {@link RegisterValue} with {@link Kind#Illegal} kind.
      */
     public RegisterValue asValue() {
@@ -156,6 +158,7 @@
 
     /**
      * Determines if this is a valid register.
+     * 
      * @return {@code true} iff this register is valid
      */
     public boolean isValid() {
@@ -178,6 +181,7 @@
 
     /**
      * Determines if this register has the {@link RegisterFlag#Byte} attribute set.
+     * 
      * @return {@code true} iff this register has the {@link RegisterFlag#Byte} attribute set.
      */
     public boolean isByte() {
@@ -186,10 +190,10 @@
 
     /**
      * Categorizes a set of registers by {@link RegisterFlag}.
-     *
+     * 
      * @param registers a list of registers to be categorized
-     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the flag is
-     *         {@linkplain #isSet(RegisterFlag) set}
+     * @return a map from each {@link RegisterFlag} constant to the list of registers for which the
+     *         flag is {@linkplain #isSet(RegisterFlag) set}
      */
     public static EnumMap<RegisterFlag, Register[]> categorize(Register[] registers) {
         EnumMap<RegisterFlag, Register[]> result = new EnumMap<>(RegisterFlag.class);
@@ -207,7 +211,7 @@
 
     /**
      * Gets the maximum register {@linkplain #number number} in a given set of registers.
-     *
+     * 
      * @param registers the set of registers to process
      * @return the maximum register number for any register in {@code registers}
      */
@@ -223,7 +227,7 @@
 
     /**
      * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers.
-     *
+     * 
      * @param registers the set of registers to process
      * @return the maximum register encoding for any register in {@code registers}
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterAttributes.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,11 +25,12 @@
 import java.util.*;
 
 /**
- * A collection of register attributes. The specific attribute values for a register may be
- * local to a compilation context. For example, a {@link RegisterConfig} in use during
- * a compilation will determine which registers are callee saved.
+ * A collection of register attributes. The specific attribute values for a register may be local to
+ * a compilation context. For example, a {@link RegisterConfig} in use during a compilation will
+ * determine which registers are callee saved.
  */
 public class RegisterAttributes {
+
     private final boolean callerSave;
     private final boolean calleeSave;
     private final boolean allocatable;
@@ -46,21 +47,19 @@
      * Creates a map from register {@linkplain Register#number numbers} to register
      * {@linkplain RegisterAttributes attributes} for a given register configuration and set of
      * registers.
-     *
+     * 
      * @param registerConfig a register configuration
      * @param registers a set of registers
-     * @return an array whose length is the max register number in {@code registers} plus 1. An element at index i holds
-     *         the attributes of the register whose number is i.
+     * @return an array whose length is the max register number in {@code registers} plus 1. An
+     *         element at index i holds the attributes of the register whose number is i.
      */
     public static RegisterAttributes[] createMap(RegisterConfig registerConfig, Register[] registers) {
         RegisterAttributes[] map = new RegisterAttributes[registers.length];
         for (Register reg : registers) {
             if (reg != null) {
                 CalleeSaveLayout csl = registerConfig.getCalleeSaveLayout();
-                RegisterAttributes attr = new RegisterAttributes(
-                                Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
-                                csl == null ? false : Arrays.asList(csl.registers).contains(reg),
-                                Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
+                RegisterAttributes attr = new RegisterAttributes(Arrays.asList(registerConfig.getCallerSaveRegisters()).contains(reg),
+                                csl == null ? false : Arrays.asList(csl.registers).contains(reg), Arrays.asList(registerConfig.getAllocatableRegisters()).contains(reg));
                 if (map.length <= reg.number) {
                     map = Arrays.copyOf(map, reg.number + 1);
                 }
@@ -83,14 +82,16 @@
     }
 
     /**
-     * @return Denotes a register whose value preservation (if required) across a call is the responsibility of the callee.
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the callee.
      */
     public boolean isCalleeSave() {
         return calleeSave;
     }
 
     /**
-     * @return Denotes a register whose value preservation (if required) across a call is the responsibility of the caller.
+     * @return Denotes a register whose value preservation (if required) across a call is the
+     *         responsibility of the caller.
      */
     public boolean isCallerSave() {
         return callerSave;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterConfig.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,8 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * A register configuration binds roles and {@linkplain RegisterAttributes attributes}
- * to physical registers.
+ * A register configuration binds roles and {@linkplain RegisterAttributes attributes} to physical
+ * registers.
  */
 public interface RegisterConfig {
 
@@ -48,7 +48,7 @@
 
     /**
      * Gets the calling convention describing how arguments are passed.
-     *
+     * 
      * @param type the type of calling convention being requested
      * @param returnType the return type (can be null for methods returning {@code void})
      * @param parameterTypes the types of the arguments of the call
@@ -58,13 +58,14 @@
     CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly);
 
     /**
-     * Gets the ordered set of registers that are can be used to pass parameters
-     * according to a given calling convention.
-     *
+     * Gets the ordered set of registers that are can be used to pass parameters according to a
+     * given calling convention.
+     * 
      * @param type the type of calling convention
      * @param flag specifies whether registers for {@linkplain RegisterFlag#CPU integral} or
-     *             {@linkplain RegisterFlag#FPU floating point} parameters are being requested
-     * @return the ordered set of registers that may be used to pass parameters in a call conforming to {@code type}
+     *            {@linkplain RegisterFlag#FPU floating point} parameters are being requested
+     * @return the ordered set of registers that may be used to pass parameters in a call conforming
+     *         to {@code type}
      */
     Register[] getCallingConventionRegisters(Type type, RegisterFlag flag);
 
@@ -75,11 +76,13 @@
 
     /**
      * Gets the set of registers that can be used by the register allocator,
-     * {@linkplain Register#categorize(Register[]) categorized} by register {@linkplain RegisterFlag flags}.
-     *
-     * @return a map from each {@link RegisterFlag} constant to the list of {@linkplain #getAllocatableRegisters()
-     *         allocatable} registers for which the flag is set
-     *
+     * {@linkplain Register#categorize(Register[]) categorized} by register
+     * {@linkplain RegisterFlag flags}.
+     * 
+     * @return a map from each {@link RegisterFlag} constant to the list of
+     *         {@linkplain #getAllocatableRegisters() allocatable} registers for which the flag is
+     *         set
+     * 
      */
     EnumMap<RegisterFlag, Register[]> getCategorizedAllocatableRegisters();
 
@@ -90,7 +93,7 @@
 
     /**
      * Gets the layout of the callee save area of this register configuration.
-     *
+     * 
      * @return {@code null} if there is no callee save area
      */
     CalleeSaveLayout getCalleeSaveLayout();
@@ -98,15 +101,16 @@
     /**
      * Gets a map from register {@linkplain Register#number numbers} to register
      * {@linkplain RegisterAttributes attributes} for this register configuration.
-     *
-     * @return an array where an element at index i holds the attributes of the register whose number is i
+     * 
+     * @return an array where an element at index i holds the attributes of the register whose
+     *         number is i
      * @see Register#categorize(Register[])
      */
     RegisterAttributes[] getAttributesMap();
 
     /**
      * Gets the register corresponding to a runtime-defined role.
-     *
+     * 
      * @param id the identifier of a runtime-defined register role
      * @return the register playing the role specified by {@code id}
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RegisterValue.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,11 +25,13 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@link
- * RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use {@link Register#asValue(Kind)} to
- * retrieve the canonical {@link RegisterValue} instance for a given (register,kind) pair.
+ * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance
+ * of {@link RegisterValue} for each ({@link Register}, {@link Kind}) pair. Use
+ * {@link Register#asValue(Kind)} to retrieve the canonical {@link RegisterValue} instance for a
+ * given (register,kind) pair.
  */
 public final class RegisterValue extends Value {
+
     private static final long serialVersionUID = 7999341472196897163L;
 
     private final Register reg;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCallTarget.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/RuntimeCallTarget.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,8 @@
 import java.util.*;
 
 /**
- * The name, signature and calling convention of a call from compiled code to the runtime.
- * The target of such a call may be a leaf stub or a call into the runtime code proper.
+ * The name, signature and calling convention of a call from compiled code to the runtime. The
+ * target of such a call may be a leaf stub or a call into the runtime code proper.
  */
 public interface RuntimeCallTarget {
 
@@ -34,6 +34,7 @@
      * The name and signature of a runtime call.
      */
     public static class Descriptor {
+
         private final String name;
         private final boolean hasSideEffect;
         private final Class resultType;
@@ -54,9 +55,8 @@
         }
 
         /**
-         * Determines if this call changes state visible to other threads.
-         * Such calls denote boundaries across which deoptimization
-         * points cannot be moved.
+         * Determines if this call changes state visible to other threads. Such calls denote
+         * boundaries across which deoptimization points cannot be moved.
          */
         public boolean hasSideEffect() {
             return hasSideEffect;
@@ -105,8 +105,9 @@
     CallingConvention getCallingConvention();
 
     /**
-     * Returns the maximum absolute offset of PC relative call to this stub from any position in the code cache or -1
-     * when not applicable. Intended for determining the required size of address/offset fields.
+     * Returns the maximum absolute offset of PC relative call to this stub from any position in the
+     * code cache or -1 when not applicable. Intended for determining the required size of
+     * address/offset fields.
      */
     long getMaxCallTargetOffset();
 
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/StackSlot.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,23 +27,24 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame
- * or an incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}.
+ * Represents a compiler spill slot or an outgoing stack-based argument in a method's frame or an
+ * incoming stack-based argument in a method's {@linkplain #isInCallerFrame() caller's frame}.
  */
 public final class StackSlot extends Value {
+
     private static final long serialVersionUID = -7725071921307318433L;
 
     private final int offset;
     private final boolean addFrameSize;
 
     /**
-     * Gets a {@link StackSlot} instance representing a stack slot at a given index
-     * holding a value of a given kind.
-     *
+     * Gets a {@link StackSlot} instance representing a stack slot at a given index holding a value
+     * of a given kind.
+     * 
      * @param kind The kind of the value stored in the stack slot.
      * @param offset The offset of the stack slot (in bytes)
-     * @param addFrameSize Specifies if the offset is relative to the stack pointer,
-     *        or the beginning of the frame (stack pointer + total frame size).
+     * @param addFrameSize Specifies if the offset is relative to the stack pointer, or the
+     *            beginning of the frame (stack pointer + total frame size).
      */
     public static StackSlot get(Kind kind, int offset, boolean addFrameSize) {
         assert kind.getStackKind() == kind;
@@ -71,7 +72,8 @@
     }
 
     /**
-     * Private constructor to enforce use of {@link #get(Kind, int, boolean)} so that a cache can be used.
+     * Private constructor to enforce use of {@link #get(Kind, int, boolean)} so that a cache can be
+     * used.
      */
     private StackSlot(Kind kind, int offset, boolean addFrameSize) {
         super(kind);
@@ -81,6 +83,7 @@
 
     /**
      * Gets the offset of this stack slot, relative to the stack pointer.
+     * 
      * @return The offset of this slot (in bytes).
      */
     public int getOffset(int totalFrameSize) {
@@ -152,7 +155,6 @@
         return this;
     }
 
-
     private static final int CACHE_GRANULARITY = 8;
     private static final int SPILL_CACHE_PER_KIND_SIZE = 100;
     private static final int PARAM_CACHE_PER_KIND_SIZE = 10;
@@ -163,7 +165,7 @@
 
     private static StackSlot[][] makeCache(int cachePerKindSize, int sign, boolean addFrameSize) {
         StackSlot[][] cache = new StackSlot[Kind.values().length][];
-        for (Kind kind : new Kind[] {Illegal, Int, Long, Float, Double, Object, Jsr}) {
+        for (Kind kind : new Kind[]{Illegal, Int, Long, Float, Double, Object, Jsr}) {
             StackSlot[] slots = new StackSlot[cachePerKindSize];
             for (int i = 0; i < cachePerKindSize; i++) {
                 slots[i] = new StackSlot(kind, sign * i * CACHE_GRANULARITY, addFrameSize);
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TargetDescription.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,12 +24,12 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 /**
- * Represents the target machine for a compiler, including the CPU architecture, the size of pointers and references,
- * alignment of stacks, caches, etc.
+ * Represents the target machine for a compiler, including the CPU architecture, the size of
+ * pointers and references, alignment of stacks, caches, etc.
  */
 public class TargetDescription {
+
     public final Architecture arch;
 
     /**
@@ -58,8 +58,10 @@
     public final Kind wordKind;
 
     /**
-     * The stack alignment requirement of the platform. For example,
-     * from Appendix D of <a href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures Optimization Reference Manual</a>:
+     * The stack alignment requirement of the platform. For example, from Appendix D of <a
+     * href="http://www.intel.com/Assets/PDF/manual/248966.pdf">Intel 64 and IA-32 Architectures
+     * Optimization Reference Manual</a>:
+     * 
      * <pre>
      *     "It is important to ensure that the stack frame is aligned to a
      *      16-byte boundary upon function entry to keep local __m128 data,
@@ -80,35 +82,31 @@
     public final int cacheAlignment;
 
     /**
-     * Specifies how {@code long} and {@code double} constants are to be stored
-     * in {@linkplain BytecodeFrame frames}. This is useful for VMs such as HotSpot
-     * where convention the interpreter uses is that the second local
-     * holds the first raw word of the native long or double representation.
-     * This is actually reasonable, since locals and stack arrays
-     * grow downwards in all implementations.
-     * If, on some machine, the interpreter's Java locals or stack
+     * Maximum constant displacement at which a memory access can no longer be an implicit null
+     * check.
+     */
+    public final int implicitNullCheckLimit;
+
+    /**
+     * Specifies how {@code long} and {@code double} constants are to be stored in
+     * {@linkplain BytecodeFrame frames}. This is useful for VMs such as HotSpot where convention
+     * the interpreter uses is that the second local holds the first raw word of the native long or
+     * double representation. This is actually reasonable, since locals and stack arrays grow
+     * downwards in all implementations. If, on some machine, the interpreter's Java locals or stack
      * were to grow upwards, the embedded doubles would be word-swapped.)
      */
     public final boolean debugInfoDoubleWordsInSecondSlot;
 
-    public TargetDescription(Architecture arch,
-             boolean isMP,
-             int stackAlignment,
-             int pageSize,
-             int cacheAlignment,
-             boolean inlineObjects,
-             boolean debugInfoDoubleWordsInSecondSlot) {
+    public TargetDescription(Architecture arch, boolean isMP, int stackAlignment, int stackBias, int implicitNullCheckLimit, int pageSize, int cacheAlignment, boolean inlineObjects,
+                    boolean debugInfoDoubleWordsInSecondSlot) {
         this.arch = arch;
         this.pageSize = pageSize;
         this.isMP = isMP;
         this.wordSize = arch.getWordSize();
-        if (wordSize == 8) {
-            this.wordKind = Kind.Long;
-        } else {
-            this.wordKind = Kind.Int;
-        }
+        this.wordKind = Kind.fromWordSize(wordSize);
         this.stackAlignment = stackAlignment;
-        this.stackBias = 0; // TODO: configure with param once SPARC port exists
+        this.stackBias = stackBias;
+        this.implicitNullCheckLimit = implicitNullCheckLimit;
         this.cacheAlignment = cacheAlignment;
         this.inlineObjects = inlineObjects;
         this.debugInfoDoubleWordsInSecondSlot = debugInfoDoubleWordsInSecondSlot;
@@ -116,31 +114,43 @@
 
     /**
      * Gets the size in bytes of the specified kind for this target.
-     *
+     * 
      * @param kind the kind for which to get the size
      * @return the size in bytes of {@code kind}
      */
     public int sizeInBytes(Kind kind) {
         // Checkstyle: stop
         switch (kind) {
-            case Boolean: return 1;
-            case Byte: return 1;
-            case Char: return 2;
-            case Short: return 2;
-            case Int: return 4;
-            case Long: return 8;
-            case Float: return 4;
-            case Double: return 8;
-            case Object: return wordSize;
-            case Jsr: return 4;
-            default: return 0;
+            case Boolean:
+                return 1;
+            case Byte:
+                return 1;
+            case Char:
+                return 2;
+            case Short:
+                return 2;
+            case Int:
+                return 4;
+            case Long:
+                return 8;
+            case Float:
+                return 4;
+            case Double:
+                return 8;
+            case Object:
+                return wordSize;
+            case Jsr:
+                return 4;
+            default:
+                return 0;
         }
         // Checkstyle: resume
     }
 
     /**
-     * Aligns the given frame size (without return instruction pointer) to the stack
-     * alignment size and return the aligned size (without return instruction pointer).
+     * Aligns the given frame size (without return instruction pointer) to the stack alignment size
+     * and return the aligned size (without return instruction pointer).
+     * 
      * @param frameSize the initial frame size to be aligned
      * @return the aligned frame size
      */
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/TypeCheckHints.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.api.meta.JavaTypeProfile.ProfiledType;
 
 /**
- * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof)
- * based on the target type of the check and any profiling information available for the instruction.
+ * Utility for deriving hint types for a type check instruction (e.g. checkcast or instanceof) based
+ * on the target type of the check and any profiling information available for the instruction.
  */
 public class TypeCheckHints {
 
@@ -40,7 +40,8 @@
 
     /**
      * If true, then {@link #types} contains the only possible type that could pass the type check
-     * because the target of the type check is a final class or has been speculated to be a final class.
+     * because the target of the type check is a final class or has been speculated to be a final
+     * class.
      */
     public final boolean exact;
 
@@ -51,22 +52,24 @@
 
     /**
      * Derives hint information for use when generating the code for a type check instruction.
-     *
+     * 
      * @param type the target type of the type check
      * @param profile the profiling information available for the instruction (if any)
-     * @param assumptions the object in which speculations are recorded. This is null if speculations are not supported.
-     * @param minHintHitProbability if the probability that the type check will hit one the profiled types (up to
-     *            {@code maxHints}) is below this value, then {@link #types} will be null
+     * @param assumptions the object in which speculations are recorded. This is null if
+     *            speculations are not supported.
+     * @param minHintHitProbability if the probability that the type check will hit one the profiled
+     *            types (up to {@code maxHints}) is below this value, then {@link #types} will be
+     *            null
      * @param maxHints the maximum length of {@link #types}
      */
     public TypeCheckHints(ResolvedJavaType type, JavaTypeProfile profile, Assumptions assumptions, double minHintHitProbability, int maxHints) {
         if (type != null && canHaveSubtype(type)) {
-            types = new ResolvedJavaType[] {type};
+            types = new ResolvedJavaType[]{type};
             exact = true;
         } else {
             ResolvedJavaType uniqueSubtype = type == null ? null : type.findUniqueConcreteSubtype();
             if (uniqueSubtype != null) {
-                types = new ResolvedJavaType[] {uniqueSubtype};
+                types = new ResolvedJavaType[]{uniqueSubtype};
                 if (assumptions.useOptimisticAssumptions()) {
                     assumptions.recordConcreteSubtype(type, uniqueSubtype);
                     exact = true;
@@ -107,9 +110,9 @@
     }
 
     /**
-     * Determines if a given type can have subtypes other than itself. This analysis is purely static; no
-     * assumptions are made.
-     *
+     * Determines if a given type can have subtypes other than itself. This analysis is purely
+     * static; no assumptions are made.
+     * 
      * @return true if {@code type} has no subtype(s)
      */
     public static boolean canHaveSubtype(ResolvedJavaType type) {
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,11 +27,11 @@
 //JaCoCo Exclude
 
 /**
- * Utilities for unsigned comparisons.
- * All methods have correct, but slow, standard Java implementations so that
- * they can be used with compilers not supporting the intrinsics.
+ * Utilities for unsigned comparisons. All methods have correct, but slow, standard Java
+ * implementations so that they can be used with compilers not supporting the intrinsics.
  */
 public class UnsignedMath {
+
     private static final long MASK = 0xffffffffL;
 
     /**
@@ -122,4 +122,3 @@
         return unsigned >= 0 ? BigInteger.valueOf(unsigned) : BigInteger.valueOf(unsigned & 0x7fffffffffffffffL).setBit(63);
     }
 }
-
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/ValueUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
  * Utility class for working with the {@link Value} class and its subclasses.
  */
 public final class ValueUtil {
+
     public static boolean isIllegal(Value value) {
         assert value != null;
         return value == Value.ILLEGAL;
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,9 +28,11 @@
 
 /**
  * An instance of this class represents an object whose allocation was removed by escape analysis.
- * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the object.
+ * The information stored in the {@link VirtualObject} is used during deoptimization to recreate the
+ * object.
  */
 public final class VirtualObject extends Value {
+
     private static final long serialVersionUID = -2907197776426346021L;
 
     private final ResolvedJavaType type;
@@ -38,17 +40,18 @@
     private final int id;
 
     /**
-     * Creates a new {@link VirtualObject} for the given type, with the given fields.
-     * If {@code type} is an instance class then {@code values} provides the values for the fields
-     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}.
-     * If {@code type} is an array then the length of the values array determines
-     * the reallocated array length.
-     *
-     * @param type the type of the object whose allocation was removed during compilation. This can be either an
-     *            instance of an array type.
-     * @param values an array containing all the values to be stored into the object when it is recreated
-     * @param id a unique id that identifies the object within the debug information for one position in the compiled
-     *            code.
+     * Creates a new {@link VirtualObject} for the given type, with the given fields. If
+     * {@code type} is an instance class then {@code values} provides the values for the fields
+     * returned by {@link ResolvedJavaType#getInstanceFields(boolean) getInstanceFields(true)}. If
+     * {@code type} is an array then the length of the values array determines the reallocated array
+     * length.
+     * 
+     * @param type the type of the object whose allocation was removed during compilation. This can
+     *            be either an instance of an array type.
+     * @param values an array containing all the values to be stored into the object when it is
+     *            recreated
+     * @param id a unique id that identifies the object within the debug information for one
+     *            position in the compiled code.
      * @return a new {@link VirtualObject} instance.
      */
     public static VirtualObject get(ResolvedJavaType type, Value[] values, int id) {
@@ -90,7 +93,8 @@
     }
 
     /**
-     * Returns the type of the object whose allocation was removed during compilation. This can be either an instance of an array type.
+     * Returns the type of the object whose allocation was removed during compilation. This can be
+     * either an instance of an array type.
      */
     public ResolvedJavaType getType() {
         return type;
@@ -104,7 +108,8 @@
     }
 
     /**
-     * Returns the unique id that identifies the object within the debug information for one position in the compiled code.
+     * Returns the unique id that identifies the object within the debug information for one
+     * position in the compiled code.
      */
     public int getId() {
         return id;
@@ -133,8 +138,9 @@
 
     /**
      * Overwrites the current set of values with a new one.
-     *
-     * @param values an array containing all the values to be stored into the object when it is recreated.
+     * 
+     * @param values an array containing all the values to be stored into the object when it is
+     *            recreated.
      */
     public void setValues(Value[] values) {
         assert checkValues(type, values);
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/Interpreter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,8 @@
 import com.oracle.graal.api.meta.*;
 
 public interface Interpreter extends VirtualMachineComponent {
+
     boolean initialize(String args);
+
     Object execute(ResolvedJavaMethod method, Object... arguments) throws Throwable;
 }
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/RuntimeInterpreterInterface.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,10 +25,9 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Please note: The parameters of the interface are currently in reversed order
- * since it was derived from the java ByteCodeInterpreter implementation. There
- * it was simpler to use the parameters in reversed order since they are popped from
- * the stack in reversed order.
+ * Please note: The parameters of the interface are currently in reversed order since it was derived
+ * from the java ByteCodeInterpreter implementation. There it was simpler to use the parameters in
+ * reversed order since they are popped from the stack in reversed order.
  */
 public interface RuntimeInterpreterInterface {
 
--- a/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.interpreter/src/com/oracle/graal/api/interpreter/VirtualMachineComponent.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.api.interpreter;
 
+public interface VirtualMachineComponent {
 
-public interface VirtualMachineComponent {
     void setOption(String name, String value);
 }
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java	Fri Feb 01 17:06:26 2013 +0100
@@ -66,7 +66,7 @@
     public static final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
 
     public static synchronized Class<?> getArrayClass(Class componentType) {
-        Class< ? > arrayClass = arrayClasses.get(componentType);
+        Class<?> arrayClass = arrayClasses.get(componentType);
         if (arrayClass == null) {
             arrayClass = Array.newInstance(componentType, 0).getClass();
             arrayClasses.put(componentType, arrayClass);
@@ -108,35 +108,9 @@
     }
 
     static {
-        Class[] initialClasses = {
-                        void.class,
-                        boolean.class,
-                        byte.class,
-                        short.class,
-                        char.class,
-                        int.class,
-                        float.class,
-                        long.class,
-                        double.class,
-                        Object.class,
-                        Class.class,
-                        ClassLoader.class,
-                        String.class,
-                        Serializable.class,
-                        Cloneable.class,
-                        Test.class,
-                        TestMetaAccessProvider.class,
-                        List.class,
-                        Collection.class,
-                        Map.class,
-                        Queue.class,
-                        HashMap.class,
-                        LinkedHashMap.class,
-                        IdentityHashMap.class,
-                        AbstractCollection.class,
-                        AbstractList.class,
-                        ArrayList.class
-        };
+        Class[] initialClasses = {void.class, boolean.class, byte.class, short.class, char.class, int.class, float.class, long.class, double.class, Object.class, Class.class, ClassLoader.class,
+                        String.class, Serializable.class, Cloneable.class, Test.class, TestMetaAccessProvider.class, List.class, Collection.class, Map.class, Queue.class, HashMap.class,
+                        LinkedHashMap.class, IdentityHashMap.class, AbstractCollection.class, AbstractList.class, ArrayList.class};
         for (Class c : initialClasses) {
             addClass(c);
         }
--- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestResolvedJavaType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -71,7 +71,6 @@
         }
     }
 
-
     @Test
     public void isInstanceClassTest() {
         for (Class c : classes) {
@@ -126,7 +125,7 @@
         for (Constant c : constants) {
             if (c.getKind() == Kind.Object && !c.isNull()) {
                 Object o = c.asObject();
-                Class< ? extends Object> cls = o.getClass();
+                Class<? extends Object> cls = o.getClass();
                 while (cls != null) {
                     ResolvedJavaType type = runtime.lookupJavaType(cls);
                     boolean expected = cls.isInstance(o);
@@ -216,14 +215,14 @@
             Class<?> c1 = c1Initial;
             Class<?> c2 = c2Initial;
             while (true) {
-              if (c1.isAssignableFrom(c2)) {
-                  return c1;
-              }
-              if (c2.isAssignableFrom(c1)) {
-                  return c2;
-              }
-              c1 = getSupertype(c1);
-              c2 = getSupertype(c2);
+                if (c1.isAssignableFrom(c2)) {
+                    return c1;
+                }
+                if (c2.isAssignableFrom(c1)) {
+                    return c2;
+                }
+                c1 = getSupertype(c1);
+                c2 = getSupertype(c2);
             }
         }
     }
@@ -249,13 +248,26 @@
         }
     }
 
-    private static class Base {}
-    abstract static class Abstract1 extends Base {}
-    interface Interface1 {}
-    static class Concrete1 extends Abstract1 {}
-    static class Concrete2 extends Abstract1 implements Interface1 {}
-    static class Concrete3 extends Concrete2 {}
-    abstract static class Abstract4 extends Concrete3 {}
+    private static class Base {
+    }
+
+    abstract static class Abstract1 extends Base {
+    }
+
+    interface Interface1 {
+    }
+
+    static class Concrete1 extends Abstract1 {
+    }
+
+    static class Concrete2 extends Abstract1 implements Interface1 {
+    }
+
+    static class Concrete3 extends Concrete2 {
+    }
+
+    abstract static class Abstract4 extends Concrete3 {
+    }
 
     static void checkConcreteSubtype(ResolvedJavaType type, Class expected) {
         ResolvedJavaType subtype = type.findUniqueConcreteSubtype();
@@ -337,6 +349,7 @@
     }
 
     static class Declarations {
+
         final Method implementation;
         final Set<Method> declarations;
 
@@ -347,7 +360,8 @@
     }
 
     /**
-     * See <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.5">Method overriding</a>.
+     * See <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-5.html#jvms-5.4.5">Method
+     * overriding</a>.
      */
     static boolean isOverriderOf(Method impl, Method m) {
         if (!isPrivate(m.getModifiers()) && !isFinal(m.getModifiers())) {
@@ -371,6 +385,7 @@
     static final Map<Class, VTable> vtables = new HashMap<>();
 
     static class VTable {
+
         final Map<NameAndSignature, Method> methods = new HashMap<>();
     }
 
@@ -386,7 +401,7 @@
                 if (!isStatic(m.getModifiers()) && !isPrivate(m.getModifiers())) {
                     Method overridden = vtable.methods.put(new NameAndSignature(m), m);
                     if (overridden != null) {
-                        //System.out.println(m + " overrides " + overridden);
+                        // System.out.println(m + " overrides " + overridden);
                     }
                 }
             }
@@ -460,9 +475,8 @@
     }
 
     public static boolean fieldsEqual(Field f, ResolvedJavaField rjf) {
-        return rjf.getDeclaringClass().equals(runtime.lookupJavaType(f.getDeclaringClass())) &&
-               rjf.getName().equals(f.getName()) &&
-               rjf.getType().resolve(rjf.getDeclaringClass()).equals(runtime.lookupJavaType(f.getType()));
+        return rjf.getDeclaringClass().equals(runtime.lookupJavaType(f.getDeclaringClass())) && rjf.getName().equals(f.getName()) &&
+                        rjf.getType().resolve(rjf.getDeclaringClass()).equals(runtime.lookupJavaType(f.getType()));
     }
 
     public static ResolvedJavaField lookupField(ResolvedJavaField[] fields, Field key) {
@@ -499,7 +513,7 @@
     public void getInstanceFieldsTest() {
         for (Class c : classes) {
             ResolvedJavaType type = runtime.lookupJavaType(c);
-            for (boolean includeSuperclasses : new boolean[] {true, false}) {
+            for (boolean includeSuperclasses : new boolean[]{true, false}) {
                 Set<Field> expected = getInstanceFields(c, includeSuperclasses);
                 ResolvedJavaField[] actual = type.getInstanceFields(includeSuperclasses);
                 for (Field f : expected) {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,9 +23,10 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a constant (boxed) value, such as an integer, floating point number, or object reference, within the
- * compiler and across the compiler/runtime interface. Exports a set of {@code Constant} instances that represent
- * frequently used constant values, such as {@link #NULL_OBJECT}.
+ * Represents a constant (boxed) value, such as an integer, floating point number, or object
+ * reference, within the compiler and across the compiler/runtime interface. Exports a set of
+ * {@code Constant} instances that represent frequently used constant values, such as
+ * {@link #NULL_OBJECT}.
  */
 public final class Constant extends Value {
 
@@ -69,9 +70,10 @@
     private final Object object;
 
     /**
-     * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For {@code float} and
-     * {@code double} values, this value is the result of {@link Float#floatToRawIntBits(float)} and
-     * {@link Double#doubleToRawLongBits(double)} respectively.
+     * The boxed primitive value as a {@code long}. This is ignored iff {@code kind.isObject()}. For
+     * {@code float} and {@code double} values, this value is the result of
+     * {@link Float#floatToRawIntBits(float)} and {@link Double#doubleToRawLongBits(double)}
+     * respectively.
      */
     private final long primitive;
 
@@ -83,7 +85,7 @@
 
     /**
      * Checks whether this constant is non-null.
-     *
+     * 
      * @return {@code true} if this constant is a primitive, or an object constant that is not null
      */
     public boolean isNonNull() {
@@ -92,7 +94,7 @@
 
     /**
      * Checks whether this constant is null.
-     *
+     * 
      * @return {@code true} if this constant is the null constant
      */
     public boolean isNull() {
@@ -101,7 +103,7 @@
 
     /**
      * Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
-     *
+     * 
      * @return {@code true} if this constant is the default value for its kind
      */
     public boolean isDefaultForKind() {
@@ -119,7 +121,7 @@
 
     /**
      * Returns the value of this constant as a boxed Java value.
-     *
+     * 
      * @return the value of this constant
      */
     public Object asBoxedValue() {
@@ -160,9 +162,9 @@
     }
 
     /**
-     * Returns the primitive int value this constant represents. The constant must have a {@link Kind#getStackKind()} of
-     * {@link Kind#Int}, or kind {@link Kind#Jsr}.
-     *
+     * Returns the primitive int value this constant represents. The constant must have a
+     * {@link Kind#getStackKind()} of {@link Kind#Int}, or kind {@link Kind#Jsr}.
+     * 
      * @return the constant value
      */
     public int asInt() {
@@ -171,8 +173,9 @@
     }
 
     /**
-     * Returns the primitive boolean value this constant represents. The constant must have kind {@link Kind#Boolean}.
-     *
+     * Returns the primitive boolean value this constant represents. The constant must have kind
+     * {@link Kind#Boolean}.
+     * 
      * @return the constant value
      */
     public boolean asBoolean() {
@@ -181,9 +184,10 @@
     }
 
     /**
-     * Returns the primitive long value this constant represents. The constant must have kind {@link Kind#Long}, a
-     * {@link Kind#getStackKind()} of {@link Kind#Int}, or kind {@link Kind#Jsr}.
-     *
+     * Returns the primitive long value this constant represents. The constant must have kind
+     * {@link Kind#Long}, a {@link Kind#getStackKind()} of {@link Kind#Int}, or kind
+     * {@link Kind#Jsr}.
+     * 
      * @return the constant value
      */
     public long asLong() {
@@ -192,8 +196,9 @@
     }
 
     /**
-     * Returns the primitive float value this constant represents. The constant must have kind {@link Kind#Float}.
-     *
+     * Returns the primitive float value this constant represents. The constant must have kind
+     * {@link Kind#Float}.
+     * 
      * @return the constant value
      */
     public float asFloat() {
@@ -202,8 +207,9 @@
     }
 
     /**
-     * Returns the primitive double value this constant represents. The constant must have kind {@link Kind#Double}.
-     *
+     * Returns the primitive double value this constant represents. The constant must have kind
+     * {@link Kind#Double}.
+     * 
      * @return the constant value
      */
     public double asDouble() {
@@ -212,8 +218,9 @@
     }
 
     /**
-     * Returns the object reference this constant represents. The constant must have kind {@link Kind#Object}.
-     *
+     * Returns the object reference this constant represents. The constant must have kind
+     * {@link Kind#Object}.
+     * 
      * @return the constant value
      */
     public Object asObject() {
@@ -223,7 +230,7 @@
 
     /**
      * Gets the annotation (if any) associated with this constant.
-     *
+     * 
      * @return null if this constant is not primitive or has no annotation
      */
     public Object getPrimitiveAnnotation() {
@@ -232,7 +239,7 @@
 
     /**
      * Computes the hashcode of this constant.
-     *
+     * 
      * @return a suitable hashcode for this constant
      */
     @Override
@@ -244,9 +251,10 @@
     }
 
     /**
-     * Checks whether this constant equals another object. This is only true if the other object is a constant that has
-     * the same {@linkplain #getKind() kind}, value and {@link #getPrimitiveAnnotation() annotation}.
-     *
+     * Checks whether this constant equals another object. This is only true if the other object is
+     * a constant that has the same {@linkplain #getKind() kind}, value and
+     * {@link #getPrimitiveAnnotation() annotation}.
+     * 
      * @param o the object to compare equality
      * @return {@code true} if this constant is equivalent to the specified object
      */
@@ -257,7 +265,7 @@
 
     /**
      * Creates a boxed double constant.
-     *
+     * 
      * @param d the double value to box
      * @return a boxed copy of {@code value}
      */
@@ -273,7 +281,7 @@
 
     /**
      * Creates a boxed float constant.
-     *
+     * 
      * @param f the float value to box
      * @return a boxed copy of {@code value}
      */
@@ -292,7 +300,7 @@
 
     /**
      * Creates a boxed long constant.
-     *
+     * 
      * @param i the long value to box
      * @return a boxed copy of {@code value}
      */
@@ -302,7 +310,7 @@
 
     /**
      * Creates a boxed integer constant.
-     *
+     * 
      * @param i the integer value to box
      * @return a boxed copy of {@code value}
      */
@@ -318,7 +326,7 @@
 
     /**
      * Creates a boxed byte constant.
-     *
+     * 
      * @param i the byte value to box
      * @return a boxed copy of {@code value}
      */
@@ -328,7 +336,7 @@
 
     /**
      * Creates a boxed boolean constant.
-     *
+     * 
      * @param i the boolean value to box
      * @return a boxed copy of {@code value}
      */
@@ -338,7 +346,7 @@
 
     /**
      * Creates a boxed char constant.
-     *
+     * 
      * @param i the char value to box
      * @return a boxed copy of {@code value}
      */
@@ -348,7 +356,7 @@
 
     /**
      * Creates a boxed short constant.
-     *
+     * 
      * @param i the short value to box
      * @return a boxed copy of {@code value}
      */
@@ -358,7 +366,7 @@
 
     /**
      * Creates a boxed address (jsr/ret address) constant.
-     *
+     * 
      * @param i the address value to box
      * @return a boxed copy of {@code value}
      */
@@ -368,7 +376,7 @@
 
     /**
      * Creates a boxed object constant.
-     *
+     * 
      * @param o the object value to box
      * @return a boxed copy of {@code value}
      */
@@ -380,10 +388,10 @@
     }
 
     /**
-     * Creates an annotated int or long constant. An annotation enables a client to associate some extra semantic or
-     * debugging information with a primitive. An annotated primitive constant is never {@linkplain #equals(Object)
-     * equal} to a non-annotated constant.
-     *
+     * Creates an annotated int or long constant. An annotation enables a client to associate some
+     * extra semantic or debugging information with a primitive. An annotated primitive constant is
+     * never {@linkplain #equals(Object) equal} to a non-annotated constant.
+     * 
      * @param kind the type of this constant
      * @param i the value of this constant
      * @param annotation an arbitrary non-null object
@@ -400,9 +408,9 @@
     }
 
     /**
-     * Creates a boxed constant for the given kind from an Object. The object needs to be of the Java boxed type
-     * corresponding to the kind.
-     *
+     * Creates a boxed constant for the given kind from an Object. The object needs to be of the
+     * Java boxed type corresponding to the kind.
+     * 
      * @param kind the kind of the constant to create
      * @param value the Java boxed value: a {@link Byte} instance for {@link Kind#Byte}, etc.
      * @return the boxed copy of {@code value}
@@ -436,7 +444,7 @@
      * Returns a constant with the default value for the given kind.
      */
     public static Constant defaultForKind(Kind kind) {
-        switch(kind) {
+        switch (kind) {
             case Boolean:
                 return FALSE;
             case Byte:
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ConstantPool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,58 +23,63 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents the runtime representation of the constant pool that is used by the compiler when parsing bytecode.
- * Provides methods to look up a constant pool entry without performing resolution. They are used during compilation.
+ * Represents the runtime representation of the constant pool that is used by the compiler when
+ * parsing bytecode. Provides methods to look up a constant pool entry without performing
+ * resolution. They are used during compilation.
  */
 public interface ConstantPool {
 
     /**
-     * Ensures that the type referenced by the specified constant pool entry is loaded and initialized. This can be
-     * used to compile time resolve a type. It works for field, method, or type constant pool entries.
-     *
+     * Ensures that the type referenced by the specified constant pool entry is loaded and
+     * initialized. This can be used to compile time resolve a type. It works for field, method, or
+     * type constant pool entries.
+     * 
      * @param cpi the index of the constant pool entry that references the type
      * @param opcode the opcode of the instruction that references the type
      */
     void loadReferencedType(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the field is already resolved. Should any of these checks fail, an
-     * unresolved field reference is returned.
-     *
+     * Looks up a reference to a field. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the field is already resolved. Should
+     * any of these checks fail, an unresolved field reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the field at {@code cpi} in this pool
      * @throws ClassFormatError if the entry at {@code cpi} is not a field
      */
     JavaField lookupField(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the method is already resolved. Should any of these checks fail, an
-     * unresolved method reference is returned.
-     *
+     * Looks up a reference to a method. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the method is already resolved. Should
+     * any of these checks fail, an unresolved method reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the method at {@code cpi} in this pool
      * @throws ClassFormatError if the entry at {@code cpi} is not a method
      */
     JavaMethod lookupMethod(int cpi, int opcode);
 
     /**
-     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks specific to the
-     * bytecode it denotes are performed if the type is already resolved. Should any of these checks fail, an unresolved
-     * type reference is returned.
-     *
+     * Looks up a reference to a type. If {@code opcode} is non-negative, then resolution checks
+     * specific to the bytecode it denotes are performed if the type is already resolved. Should any
+     * of these checks fail, an unresolved type reference is returned.
+     * 
      * @param cpi the constant pool index
-     * @param opcode the opcode of the instruction for which the lookup is being performed or {@code -1}
+     * @param opcode the opcode of the instruction for which the lookup is being performed or
+     *            {@code -1}
      * @return a reference to the compiler interface type
      */
     JavaType lookupType(int cpi, int opcode);
 
     /**
      * Looks up a method signature.
-     *
+     * 
      * @param cpi the constant pool index
      * @return the method signature at index {@code cpi} in this constant pool
      */
@@ -82,9 +87,10 @@
 
     /**
      * Looks up a constant at the specified index.
-     *
+     * 
      * @param cpi the constant pool index
-     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool entry
+     * @return the {@code Constant} or {@code JavaType} instance representing the constant pool
+     *         entry
      */
     Object lookupConstant(int cpi);
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DefaultProfilingInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,7 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * An implementation of {@link ProfilingInfo} that can used in the absence of real profile information.
+ * An implementation of {@link ProfilingInfo} that can used in the absence of real profile
+ * information.
  */
 public final class DefaultProfilingInfo implements ProfilingInfo {
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/DeoptimizationReason.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 /**
  * Enumeration of reasons for why a deoptimization is happening.
  */
+// @formatter:off
 public enum DeoptimizationReason {
     None,
     NullCheckException,
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -72,7 +72,8 @@
     }
 
     /**
-     * Returns the index into the constant pool representing the type of exception caught by this handler.
+     * Returns the index into the constant pool representing the type of exception caught by this
+     * handler.
      */
     public int catchTypeCPI() {
         return catchTypeCPI;
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaField.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like methods and types, are
- * resolved through {@link ConstantPool constant pools}.
+ * Represents a reference to a Java field, either resolved or unresolved fields. Fields, like
+ * methods and types, are resolved through {@link ConstantPool constant pools}.
  */
 public interface JavaField {
 
@@ -39,12 +39,14 @@
     JavaType getType();
 
     /**
-     * Returns the kind of this field. This is the same as calling {@link #getType}.{@link JavaType#getKind getKind}.
+     * Returns the kind of this field. This is the same as calling {@link #getType}.
+     * {@link JavaType#getKind getKind}.
      */
     Kind getKind();
 
     /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this field.
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * field.
      */
     JavaType getDeclaringClass();
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaMethod.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and types, are resolved
- * through {@link ConstantPool constant pools}.
+ * Represents a reference to a Java method, either resolved or unresolved. Methods, like fields and
+ * types, are resolved through {@link ConstantPool constant pools}.
  */
 public interface JavaMethod {
 
@@ -34,7 +34,8 @@
     String getName();
 
     /**
-     * Returns the {@link JavaType} object representing the class or interface that declares this method.
+     * Returns the {@link JavaType} object representing the class or interface that declares this
+     * method.
      */
     JavaType getDeclaringClass();
 
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,12 +23,14 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and arrays thereof.
+ * Represents a resolved or unresolved type. Types include primitives, objects, {@code void}, and
+ * arrays thereof.
  */
 public interface JavaType {
 
     /**
-     * Returns the name of this type in internal form. The following are examples of strings returned by this method:
+     * Returns the name of this type in internal form. The following are examples of strings
+     * returned by this method:
      * 
      * <pre>
      *     "Ljava/lang/Object;"
@@ -39,8 +41,8 @@
     String getName();
 
     /**
-     * For array types, gets the type of the components, or {@code null} if this is not an array type. This method is
-     * analogous to {@link Class#getComponentType()}.
+     * For array types, gets the type of the components, or {@code null} if this is not an array
+     * type. This method is analogous to {@link Class#getComponentType()}.
      */
     JavaType getComponentType();
 
@@ -55,8 +57,8 @@
     Kind getKind();
 
     /**
-     * Resolved this type and returns a {@link ResolvedJavaType}. If this type is already a {@link ResolvedJavaType}, it
-     * returns this type.
+     * Resolved this type and returns a {@link ResolvedJavaType}. If this type is already a
+     * {@link ResolvedJavaType}, it returns this type.
      * 
      * @param accessingClass the class that requests resolving this type
      * @return the resolved Java type
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/JavaTypeProfile.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,17 +25,17 @@
 import java.io.*;
 
 /**
- * This profile object represents the type profile at a specific BCI. The precision of the supplied values may vary, but
- * a runtime that provides this information should be aware that it will be used to guide performance-critical decisions
- * like speculative inlining, etc.
+ * This profile object represents the type profile at a specific BCI. The precision of the supplied
+ * values may vary, but a runtime that provides this information should be aware that it will be
+ * used to guide performance-critical decisions like speculative inlining, etc.
  */
 public final class JavaTypeProfile implements Serializable {
 
     private static final long serialVersionUID = -6877016333706838441L;
 
     /**
-     * A profiled type that has a probability. Profiled types are naturally sorted in descending order of their
-     * probabilities.
+     * A profiled type that has a probability. Profiled types are naturally sorted in descending
+     * order of their probabilities.
      */
     public static final class ProfiledType implements Comparable<ProfiledType>, Serializable {
 
@@ -60,7 +60,7 @@
 
         /**
          * Returns the estimated probability of {@link #getType()}.
-         *
+         * 
          * @return double value >= 0.0 and <= 1.0
          */
         public double getProbability() {
@@ -82,7 +82,8 @@
     private final ProfiledType[] ptypes;
 
     /**
-     * Determines if an array of profiled types are sorted in descending order of their probabilities.
+     * Determines if an array of profiled types are sorted in descending order of their
+     * probabilities.
      */
     private static boolean isSorted(ProfiledType[] ptypes) {
         for (int i = 1; i < ptypes.length; i++) {
@@ -100,8 +101,9 @@
     }
 
     /**
-     * Returns the estimated probability of all types that could not be recorded due to profiling limitations.
-     *
+     * Returns the estimated probability of all types that could not be recorded due to profiling
+     * limitations.
+     * 
      * @return double value >= 0.0 and <= 1.0
      */
     public double getNotRecordedProbability() {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Kind.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,9 +25,9 @@
 import java.lang.reflect.*;
 
 /**
- * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example, {@link Kind#Int}
- * for {@code int} and {@link Kind#Object} for all object types. A kind has a single character short name, a Java name,
- * and a set of flags further describing its behavior.
+ * Denotes the basic kinds of types in CRI, including the all the Java primitive types, for example,
+ * {@link Kind#Int} for {@code int} and {@link Kind#Object} for all object types. A kind has a
+ * single character short name, a Java name, and a set of flags further describing its behavior.
  */
 public enum Kind {
     /** The primitive boolean kind, represented as an int on the stack. */
@@ -98,9 +98,10 @@
 
     /**
      * Checks whether this type is a Java primitive type.
-     *
-     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char}, {@link #Short}, {@link #Int},
-     *         {@link #Long}, {@link #Float}, {@link #Double}, or {@link #Void}.
+     * 
+     * @return {@code true} if this is {@link #Boolean}, {@link #Byte}, {@link #Char},
+     *         {@link #Short}, {@link #Int}, {@link #Long}, {@link #Float}, {@link #Double}, or
+     *         {@link #Void}.
      */
     public boolean isPrimitive() {
         return primitiveJavaClass != null;
@@ -108,7 +109,7 @@
 
     /**
      * Returns the kind that represents this kind when on the Java operand stack.
-     *
+     * 
      * @return the kind used on the operand stack
      */
     public Kind getStackKind() {
@@ -120,7 +121,7 @@
 
     /**
      * Returns the kind corresponding to the Java type string.
-     *
+     * 
      * @param typeString the Java type string
      * @return the kind
      */
@@ -134,8 +135,23 @@
     }
 
     /**
+     * Returns the kind of a word given the size of a word in bytes.
+     * 
+     * @param wordSizeInBytes the size of a word in bytes
+     * @return the kind representing a word value
+     */
+    public static Kind fromWordSize(int wordSizeInBytes) {
+        if (wordSizeInBytes == 8) {
+            return Kind.Long;
+        } else {
+            assert wordSizeInBytes == 4 : "Unsupported word size!";
+            return Kind.Int;
+        }
+    }
+
+    /**
      * Returns the kind from the character describing a primitive or void.
-     *
+     * 
      * @param ch the character
      * @return the kind
      */
@@ -165,11 +181,11 @@
 
     /**
      * Returns the Kind representing the given Java class.
-     *
+     * 
      * @param klass the class
      * @return the kind
      */
-    public static Kind fromJavaClass(Class< ? > klass) {
+    public static Kind fromJavaClass(Class<?> klass) {
         if (klass == Boolean.primitiveJavaClass) {
             return Boolean;
         } else if (klass == Byte.primitiveJavaClass) {
@@ -195,19 +211,19 @@
 
     /**
      * Returns the Java class representing this kind.
-     *
+     * 
      * @return the Java class
      */
-    public Class< ? > toJavaClass() {
+    public Class<?> toJavaClass() {
         return primitiveJavaClass;
     }
 
     /**
      * Returns the Java class for instances of boxed values of this kind.
-     *
+     * 
      * @return the Java class
      */
-    public Class< ? > toBoxedJavaClass() {
+    public Class<?> toBoxedJavaClass() {
         return boxedJavaClass;
     }
 
@@ -220,15 +236,15 @@
     }
 
     /**
-     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with their
-     * {@link Object#toString()} value.
+     * Marker interface for types that should be {@linkplain Kind#format(Object) formatted} with
+     * their {@link Object#toString()} value.
      */
     public interface FormatWithToString {
     }
 
     /**
      * Gets a formatted string for a given value of this kind.
-     *
+     * 
      * @param value a value of this kind
      * @return a formatted string for {@code value} based on this kind
      */
@@ -248,8 +264,8 @@
                     return "JavaType:" + MetaUtil.toJavaName((JavaType) value);
                 } else if (value instanceof Enum || value instanceof FormatWithToString || value instanceof Number) {
                     return MetaUtil.getSimpleName(value.getClass(), true) + ":" + String.valueOf(value);
-                } else if (value instanceof Class< ? >) {
-                    return "Class:" + ((Class< ? >) value).getName();
+                } else if (value instanceof Class<?>) {
+                    return "Class:" + ((Class<?>) value).getName();
                 } else if (value.getClass().isArray()) {
                     return formatArray(value);
                 } else {
@@ -264,7 +280,7 @@
     private static final int MAX_FORMAT_ARRAY_LENGTH = 5;
 
     private static String formatArray(Object array) {
-        Class< ? > componentType = array.getClass().getComponentType();
+        Class<?> componentType = array.getClass().getComponentType();
         assert componentType != null;
         int arrayLength = Array.getLength(array);
         StringBuilder buf = new StringBuilder(MetaUtil.getSimpleName(componentType, true)).append('[').append(arrayLength).append("]{");
@@ -289,7 +305,7 @@
 
     /**
      * The minimum value that can be represented as a value of this kind.
-     *
+     * 
      * @return the minimum value
      */
     public long getMinValue() {
@@ -314,7 +330,7 @@
 
     /**
      * The maximum value that can be represented as a value of this kind.
-     *
+     * 
      * @return the maximum value
      */
     public long getMaxValue() {
@@ -339,7 +355,7 @@
 
     /**
      * Number of bits that are necessary to represent a value of this kind.
-     *
+     * 
      * @return the number of bits
      */
     public int getBitCount() {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/LineNumberTable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,9 +22,11 @@
  */
 package com.oracle.graal.api.meta;
 
+public interface LineNumberTable {
 
-public interface LineNumberTable {
     int[] getLineNumberEntries();
+
     int[] getBciEntries();
+
     int getLineNumber(int bci);
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,11 +31,11 @@
 
     /**
      * Returns the resolved Java type representing a given Java class.
-     *
+     * 
      * @param clazz the Java class object
      * @return the resolved Java type object
      */
-    ResolvedJavaType lookupJavaType(Class< ? > clazz);
+    ResolvedJavaType lookupJavaType(Class<?> clazz);
 
     /**
      * Provides the {@link ResolvedJavaMethod} for a {@link Method} obtained via reflection.
@@ -54,32 +54,33 @@
 
     /**
      * Returns the resolved Java type of the given {@link Constant} object.
-     *
+     * 
      * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
      */
     ResolvedJavaType lookupJavaType(Constant constant);
 
     /**
-     * Parses a <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
-     * descriptor</a> into a {@link Signature}. The behavior of this method is undefined if
-     * the method descriptor is not well formed.
+     * Parses a <a
+     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
+     * descriptor</a> into a {@link Signature}. The behavior of this method is undefined if the
+     * method descriptor is not well formed.
      */
     Signature parseMethodDescriptor(String methodDescriptor);
 
     /**
-     * Compares two constants for equality.
-     * This is used instead of {@link Constant#equals(Object)} in case the runtime
-     * has an interpretation for object equality other than {@code x.asObject() == y.asObject()}.
-     * For primitive constants, this is equivalent to calling {@code x.equals(y)}.
-     * The equality relationship is symmetric.
-     *
-     * @return {@code true} if the two parameters represent the same runtime object, {@code false} otherwise
+     * Compares two constants for equality. This is used instead of {@link Constant#equals(Object)}
+     * in case the runtime has an interpretation for object equality other than
+     * {@code x.asObject() == y.asObject()}. For primitive constants, this is equivalent to calling
+     * {@code x.equals(y)}. The equality relationship is symmetric.
+     * 
+     * @return {@code true} if the two parameters represent the same runtime object, {@code false}
+     *         otherwise
      */
     boolean constantEquals(Constant x, Constant y);
 
     /**
      * Returns the length of an array that is wrapped in a {@link Constant} object.
-     *
+     * 
      * @throws IllegalArgumentException if {@code array} is not an array
      */
     int lookupArrayLength(Constant array);
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,8 @@
 import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen;
 
 /**
- * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its clients.
+ * Miscellaneous collection of utility methods used by {@code com.oracle.graal.api.meta} and its
+ * clients.
  */
 public class MetaUtil {
 
@@ -58,9 +59,10 @@
 
     /**
      * Gets the {@link Class} mirror for a given resolved type.
-     *
+     * 
      * @param type the type for which the Java mirror is requested
-     * @param loader class loader from which the class must be loaded (null means use the class loader of the {@link MetaUtil} class)
+     * @param loader class loader from which the class must be loaded (null means use the class
+     *            loader of the {@link MetaUtil} class)
      * @return the mirror for {@code type}
      * @throws NoClassDefFoundError if the mirror is not available
      */
@@ -89,9 +91,10 @@
 
     /**
      * Gets the {@link Class} mirror for a given resolved type.
-     *
+     * 
      * @param type the type for which the Java mirror is requested
-     * @param loader class loader from which the class must be loaded (null means use the class loader of the {@link MetaUtil} class)
+     * @param loader class loader from which the class must be loaded (null means use the class
+     *            loader of the {@link MetaUtil} class)
      * @return the mirror for {@code type} or null if it is not available
      */
     public static Class getMirror(ResolvedJavaType type, ClassLoader loader) {
@@ -103,10 +106,9 @@
     }
 
     /**
-     * Gets the elemental type for a given type.
-     * The elemental type of an array type is the corresponding zero dimensional (e.g.,
-     * the elemental type of {@code int[][][]} is {@code int}). A non-array type is its
-     * own elemental type.
+     * Gets the elemental type for a given type. The elemental type of an array type is the
+     * corresponding zero dimensional (e.g., the elemental type of {@code int[][][]} is {@code int}
+     * ). A non-array type is its own elemental type.
      */
     public static ResolvedJavaType getElementalType(ResolvedJavaType type) {
         ResolvedJavaType t = type;
@@ -117,21 +119,21 @@
     }
 
     /**
-     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for anonymous and local
-     * classes.
-     *
+     * Extends the functionality of {@link Class#getSimpleName()} to include a non-empty string for
+     * anonymous and local classes.
+     * 
      * @param clazz the class for which the simple name is being requested
-     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s) of the enclosing
-     *            class/classes of {@code clazz} (if any). This option is ignored if {@code clazz} denotes an anonymous
-     *            or local class.
+     * @param withEnclosingClass specifies if the returned name should be qualified with the name(s)
+     *            of the enclosing class/classes of {@code clazz} (if any). This option is ignored
+     *            if {@code clazz} denotes an anonymous or local class.
      * @return the simple name
      */
-    public static String getSimpleName(Class< ? > clazz, boolean withEnclosingClass) {
+    public static String getSimpleName(Class<?> clazz, boolean withEnclosingClass) {
         final String simpleName = clazz.getSimpleName();
         if (simpleName.length() != 0) {
             if (withEnclosingClass) {
                 String prefix = "";
-                Class< ? > enclosingClass = clazz;
+                Class<?> enclosingClass = clazz;
                 while ((enclosingClass = enclosingClass.getEnclosingClass()) != null) {
                     prefix = prefix + enclosingClass.getSimpleName() + ".";
                 }
@@ -153,9 +155,9 @@
     }
 
     /**
-     * Converts a given type to its Java programming language name. The following are examples of strings returned by
-     * this method:
-     *
+     * Converts a given type to its Java programming language name. The following are examples of
+     * strings returned by this method:
+     * 
      * <pre>
      *     qualified == true:
      *         java.lang.Object
@@ -166,9 +168,10 @@
      *         int
      *         boolean[][]
      * </pre>
-     *
+     * 
      * @param type the type to be converted to a Java name
-     * @param qualified specifies if the package prefix of the type should be included in the returned name
+     * @param qualified specifies if the package prefix of the type should be included in the
+     *            returned name
      * @return the Java name corresponding to {@code type}
      */
     public static String toJavaName(JavaType type, boolean qualified) {
@@ -180,15 +183,15 @@
     }
 
     /**
-     * Converts a given type to its Java programming language name. The following are examples of strings returned by
-     * this method:
-     *
+     * Converts a given type to its Java programming language name. The following are examples of
+     * strings returned by this method:
+     * 
      * <pre>
      *      java.lang.Object
      *      int
      *      boolean[][]
      * </pre>
-     *
+     * 
      * @param type the type to be converted to a Java name
      * @return the Java name corresponding to {@code type}
      */
@@ -220,11 +223,12 @@
     }
 
     /**
-     * Gets a string for a given method formatted according to a given format specification. A format specification is
-     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
-     * the method that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
-     * accepted specifiers and the method attributes they denote are described below:
-     *
+     * Gets a string for a given method formatted according to a given format specification. A
+     * format specification is composed of characters that are to be copied verbatim to the result
+     * and specifiers that denote an attribute of the method that is to be copied to the result. A
+     * specifier is a single character preceded by a '%' character. The accepted specifiers and the
+     * method attributes they denote are described below:
+     * 
      * <pre>
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -238,7 +242,7 @@
      *     'f'       | Indicator if method is unresolved, static or virtual | "unresolved" "static" "virtual"
      *     '%'       | A '%' character                                      | "%"
      * </pre>
-     *
+     * 
      * @param format a format specification
      * @param method the method to be formatted
      * @return the result of formatting this method according to {@code format}
@@ -313,11 +317,12 @@
     }
 
     /**
-     * Gets a string for a given field formatted according to a given format specification. A format specification is
-     * composed of characters that are to be copied verbatim to the result and specifiers that denote an attribute of
-     * the field that is to be copied to the result. A specifier is a single character preceded by a '%' character. The
-     * accepted specifiers and the field attributes they denote are described below:
-     *
+     * Gets a string for a given field formatted according to a given format specification. A format
+     * specification is composed of characters that are to be copied verbatim to the result and
+     * specifiers that denote an attribute of the field that is to be copied to the result. A
+     * specifier is a single character preceded by a '%' character. The accepted specifiers and the
+     * field attributes they denote are described below:
+     * 
      * <pre>
      *     Specifier | Description                                          | Example(s)
      *     ----------+------------------------------------------------------------------------------------------
@@ -329,7 +334,7 @@
      *     'f'       | Indicator if field is unresolved, static or instance | "unresolved" "static" "instance"
      *     '%'       | A '%' character                                      | "%"
      * </pre>
-     *
+     * 
      * @param format a format specification
      * @param field the field to be formatted
      * @return the result of formatting this field according to {@code format}
@@ -387,10 +392,11 @@
 
     /**
      * Gets the annotations of a particular type for the formal parameters of a given method.
-     *
+     * 
      * @param annotationClass the Class object corresponding to the annotation type
      * @param method the method for which a parameter annotations are being requested
-     * @return the annotation of type {@code annotationClass} (if any) for each formal parameter present
+     * @return the annotation of type {@code annotationClass} (if any) for each formal parameter
+     *         present
      */
     public static <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass, ResolvedJavaMethod method) {
         Annotation[][] parameterAnnotations = method.getParameterAnnotations();
@@ -408,12 +414,14 @@
 
     /**
      * Gets the annotation of a particular type for a formal parameter of a given method.
-     *
+     * 
      * @param annotationClass the Class object corresponding to the annotation type
      * @param parameterIndex the index of a formal parameter of {@code method}
      * @param method the method for which a parameter annotation is being requested
-     * @return the annotation of type {@code annotationClass} for the formal parameter present, else null
-     * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal parameter
+     * @return the annotation of type {@code annotationClass} for the formal parameter present, else
+     *         null
+     * @throws IndexOutOfBoundsException if {@code parameterIndex} does not denote a formal
+     *             parameter
      */
     public static <T extends Annotation> T getParameterAnnotation(Class<T> annotationClass, int parameterIndex, ResolvedJavaMethod method) {
         if (parameterIndex >= 0) {
@@ -428,8 +436,9 @@
     }
 
     /**
-     * Convenient shortcut for calling {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to
-     * supply a a {@link StringBuilder} instance and convert the result to a string.
+     * Convenient shortcut for calling
+     * {@link #appendLocation(StringBuilder, ResolvedJavaMethod, int)} without having to supply a a
+     * {@link StringBuilder} instance and convert the result to a string.
      */
     public static String toLocation(ResolvedJavaMethod method, int bci) {
         return appendLocation(new StringBuilder(), method, bci).toString();
@@ -437,22 +446,22 @@
 
     /**
      * Appends a string representation of a location specified by a given method and bci to a given
-     * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative line number is
-     * {@linkplain ResolvedJavaMethod#asStackTraceElement(int) available} for the given method, then the string returned
-     * is the {@link StackTraceElement#toString()} value of the stack trace element, suffixed by the bci location. For
-     * example:
-     *
+     * {@link StringBuilder}. If a stack trace element with a non-null file name and non-negative
+     * line number is {@linkplain ResolvedJavaMethod#asStackTraceElement(int) available} for the
+     * given method, then the string returned is the {@link StackTraceElement#toString()} value of
+     * the stack trace element, suffixed by the bci location. For example:
+     * 
      * <pre>
      *     java.lang.String.valueOf(String.java:2930) [bci: 12]
      * </pre>
-     *
-     * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)} with the format
-     * string {@code "%H.%n(%p)"}, suffixed by the bci location. For example:
-     *
+     * 
+     * Otherwise, the string returned is the value of applying {@link #format(String, JavaMethod)}
+     * with the format string {@code "%H.%n(%p)"}, suffixed by the bci location. For example:
+     * 
      * <pre>
      *     java.lang.String.valueOf(int) [bci: 12]
      * </pre>
-     *
+     * 
      * @param sb
      * @param method
      * @param bci
@@ -495,7 +504,7 @@
 
     /**
      * Formats some profiling information associated as a string.
-     *
+     * 
      * @param info the profiling info to format
      * @param method an optional method that augments the profile string returned
      * @param sep the separator to use for each separate profile record
@@ -511,14 +520,14 @@
             }
 
             if (info.getBranchTakenProbability(i) != -1) {
-                buf.append(String.format("branchProbability@%d: %.3f%s", i, info.getBranchTakenProbability(i), sep));
+                buf.append(String.format("branchProbability@%d: %.6f%s", i, info.getBranchTakenProbability(i), sep));
             }
 
             double[] switchProbabilities = info.getSwitchProbabilities(i);
             if (switchProbabilities != null) {
                 buf.append(String.format("switchProbabilities@%d:", i));
                 for (int j = 0; j < switchProbabilities.length; j++) {
-                    buf.append(String.format(" %.3f", switchProbabilities[j]));
+                    buf.append(String.format(" %.6f", switchProbabilities[j]));
                 }
                 buf.append(sep);
             }
@@ -534,9 +543,13 @@
                     buf.append(String.format("types@%d:", i));
                     for (int j = 0; j < ptypes.length; j++) {
                         ProfiledType ptype = ptypes[j];
-                        buf.append(String.format(" %.3f (%s)%s", ptype.getProbability(), ptype.getType(), sep));
+                        buf.append(String.format(" %.6f (%s)%s", ptype.getProbability(), ptype.getType(), sep));
                     }
-                    buf.append(String.format(" %.3f <not recorded>%s", typeProfile.getNotRecordedProbability(), sep));
+                    if (typeProfile.getNotRecordedProbability() != 0) {
+                        buf.append(String.format(" %.6f <other types>%s", typeProfile.getNotRecordedProbability(), sep));
+                    } else {
+                        buf.append(String.format(" <no other types>%s", sep));
+                    }
                 }
             }
         }
@@ -562,7 +575,7 @@
 
     /**
      * Converts a Java source-language class name into the internal form.
-     *
+     * 
      * @param className the class name
      * @return the internal name form of the class name
      */
@@ -605,8 +618,8 @@
     }
 
     /**
-     * Prepends the String {@code indentation} to every line in String {@code lines}, including a possibly non-empty
-     * line following the final newline.
+     * Prepends the String {@code indentation} to every line in String {@code lines}, including a
+     * possibly non-empty line following the final newline.
      */
     public static String indent(String lines, String indentation) {
         if (lines.length() == 0) {
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ProfilingInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,9 +23,10 @@
 package com.oracle.graal.api.meta;
 
 /**
- * Provides access to the profiling information of one specific method. Every accessor method returns the information
- * that is available at the time of invocation. If a method is invoked multiple times, it may return significantly
- * different results for every invocation as the profiling information may be changed by other Java threads at any time.
+ * Provides access to the profiling information of one specific method. Every accessor method
+ * returns the information that is available at the time of invocation. If a method is invoked
+ * multiple times, it may return significantly different results for every invocation as the
+ * profiling information may be changed by other Java threads at any time.
  */
 public interface ProfilingInfo {
 
@@ -47,50 +48,50 @@
 
     /**
      * Returns an estimate of how often the branch at the given byte code was taken.
-     *
-     * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if this information is
-     *         not available.
+     * 
+     * @return The estimated probability, with 0.0 meaning never and 1.0 meaning always, or -1 if
+     *         this information is not available.
      */
     double getBranchTakenProbability(int bci);
 
     /**
-     * Returns an estimate of how often the switch cases are taken at the given BCI. The default case is stored as the
-     * last entry.
-     *
-     * @return A double value that contains the estimated probabilities, with 0.0 meaning never and 1.0 meaning always,
-     *         or -1 if this information is not available.
+     * Returns an estimate of how often the switch cases are taken at the given BCI. The default
+     * case is stored as the last entry.
+     * 
+     * @return A double value that contains the estimated probabilities, with 0.0 meaning never and
+     *         1.0 meaning always, or -1 if this information is not available.
      */
     double[] getSwitchProbabilities(int bci);
 
     /**
      * Returns the TypeProfile for the given BCI.
-     *
+     * 
      * @return Returns an JavaTypeProfile object, or null if not available.
      */
     JavaTypeProfile getTypeProfile(int bci);
 
     /**
      * Returns information if the given BCI did ever throw an exception.
-     *
+     * 
      * @return {@link ExceptionSeen#TRUE} if the instruction has thrown an exception at least once,
-     *         {@link ExceptionSeen#FALSE} if it never threw an exception, and {@link ExceptionSeen#NOT_SUPPORTED} if
-     *         this information was not recorded.
+     *         {@link ExceptionSeen#FALSE} if it never threw an exception, and
+     *         {@link ExceptionSeen#NOT_SUPPORTED} if this information was not recorded.
      */
     ExceptionSeen getExceptionSeen(int bci);
 
     /**
-     * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts to each other, as
-     * the returned value highly depends on the time of invocation.
-     *
+     * Returns an estimate how often the current BCI was executed. Avoid comparing execution counts
+     * to each other, as the returned value highly depends on the time of invocation.
+     * 
      * @return the estimated execution count or -1 if not available.
      */
     int getExecutionCount(int bci);
 
     /**
-     * Returns how frequently a method was deoptimized for the given deoptimization reason. This only indicates how
-     * often the method did fall back to the interpreter for the execution and does not indicate how often it was
-     * recompiled.
-     *
+     * Returns how frequently a method was deoptimized for the given deoptimization reason. This
+     * only indicates how often the method did fall back to the interpreter for the execution and
+     * does not indicate how often it was recompiled.
+     * 
      * @param reason the reason for which the number of deoptimizations should be queried
      * @return the number of times the compiled method deoptimized for the given reason.
      */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaField.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,52 +26,57 @@
 import java.lang.reflect.*;
 
 /**
- * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved through
- * {@link ConstantPool constant pools}.
+ * Represents a reference to a resolved Java field. Fields, like methods and types, are resolved
+ * through {@link ConstantPool constant pools}.
  */
 public interface ResolvedJavaField extends JavaField {
 
     /**
-     * Returns the Java language modifiers for this field, as an integer. The {@link Modifier} class should be used to
-     * decode the modifiers. Only the {@linkplain Modifier#fieldModifiers() field flags} specified in the JVM
-     * specification will be included in the returned mask.
+     * Returns the Java language modifiers for this field, as an integer. The {@link Modifier} class
+     * should be used to decode the modifiers. Only the {@linkplain Modifier#fieldModifiers() field
+     * flags} specified in the JVM specification will be included in the returned mask.
      */
     int getModifiers();
 
     /**
-     * Determines if this field was injected by the VM. Such a field, for example, is not derived from a class file.
+     * Determines if this field was injected by the VM. Such a field, for example, is not derived
+     * from a class file.
      */
     boolean isInternal();
 
     /**
      * Gets the constant value of this field for a given object, if available.
-     *
-     * @param receiver object from which this field's value is to be read. This value is ignored if this field is
-     *            static.
-     * @return the constant value of this field or {@code null} if the constant value is not available
+     * 
+     * @param receiver object from which this field's value is to be read. This value is ignored if
+     *            this field is static.
+     * @return the constant value of this field or {@code null} if the constant value is not
+     *         available
      */
     Constant readConstantValue(Constant receiver);
 
     /**
      * Gets the current value of this field for a given object, if available.
-     *
-     * @param receiver object from which this field's value is to be read. This value is ignored if this field is
-     *            static.
-     * @return the value of this field or {@code null} if the value is not available (e.g., because the field holder is
-     *         not yet initialized).
+     * 
+     * @param receiver object from which this field's value is to be read. This value is ignored if
+     *            this field is static.
+     * @return the value of this field or {@code null} if the value is not available (e.g., because
+     *         the field holder is not yet initialized).
      */
     Constant readValue(Constant receiver);
 
     /**
-     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this field.
+     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
+     * this field.
      */
     ResolvedJavaType getDeclaringClass();
 
     /**
-     * Returns the annotation for the specified type of this field, if such an annotation is present.
-     *
+     * Returns the annotation for the specified type of this field, if such an annotation is
+     * present.
+     * 
      * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this field, else {@code null}
+     * @return this element's annotation for the specified annotation type if present on this field,
+     *         else {@code null}
      */
     <T extends Annotation> T getAnnotation(Class<T> annotationClass);
 }
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,43 +28,44 @@
 import java.util.*;
 
 /**
- * Represents a resolved Java method. Methods, like fields and types, are resolved through {@link ConstantPool constant
- * pools}.
+ * Represents a resolved Java method. Methods, like fields and types, are resolved through
+ * {@link ConstantPool constant pools}.
  */
 public interface ResolvedJavaMethod extends JavaMethod {
 
     /**
-     * Returns the bytecodes of this method, if the method has code. The returned byte array does not contain
-     * breakpoints or non-Java bytecodes.
-     *
+     * Returns the bytecodes of this method, if the method has code. The returned byte array does
+     * not contain breakpoints or non-Java bytecodes.
+     * 
      * @return the bytecodes of the method, or {@code null} if none is available
      */
     byte[] getCode();
 
     /**
-     * Returns the size of the bytecodes of this method, if the method has code. This is equivalent to
-     * {@link #getCode()}. {@code length} if the method has code.
-     *
+     * Returns the size of the bytecodes of this method, if the method has code. This is equivalent
+     * to {@link #getCode()}. {@code length} if the method has code.
+     * 
      * @return the size of the bytecodes in bytes, or 0 if no bytecodes is available
      */
     int getCodeSize();
 
     /**
      * Returns the size of the compiled machine code of this method.
-     *
+     * 
      * @return the size of the compiled machine code in bytes, or 0 if no compiled code exists.
      */
     int getCompiledCodeSize();
 
     /**
      * Returns an estimate how complex it is to compile this method.
-     *
+     * 
      * @return A value >= 0, where higher means more complex.
      */
     int getCompilationComplexity();
 
     /**
-     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares this method.
+     * Returns the {@link ResolvedJavaType} object representing the class or interface that declares
+     * this method.
      */
     ResolvedJavaType getDeclaringClass();
 
@@ -79,30 +80,31 @@
     int getMaxStackSize();
 
     /**
-     * Returns the Java language modifiers for this method, as an integer. The {@link Modifier} class should be used to
-     * decode the modifiers. Only the {@linkplain Modifier#methodModifiers() method flags} specified in the JVM
-     * specification will be included in the returned mask.
+     * Returns the Java language modifiers for this method, as an integer. The {@link Modifier}
+     * class should be used to decode the modifiers. Only the
+     * {@linkplain Modifier#methodModifiers() method flags} specified in the JVM specification will
+     * be included in the returned mask.
      */
     int getModifiers();
 
     /**
      * Checks whether this method is a class initializer.
-     *
+     * 
      * @return {@code true} if the method is a class initializer
      */
     boolean isClassInitializer();
 
     /**
      * Checks whether this method is a constructor.
-     *
+     * 
      * @return {@code true} if the method is a constructor
      */
     boolean isConstructor();
 
     /**
-     * Checks whether this method can be statically bound (usually, that means it is final or private or static, but not
-     * abstract).
-     *
+     * Checks whether this method can be statically bound (usually, that means it is final or
+     * private or static, but not abstract).
+     * 
      * @return {@code true} if this method can be statically bound
      */
     boolean canBeStaticallyBound();
@@ -123,7 +125,8 @@
     ProfilingInfo getProfilingInfo();
 
     /**
-     * Returns a map that the compiler can use to store objects that should survive the current compilation.
+     * Returns a map that the compiler can use to store objects that should survive the current
+     * compilation.
      */
     Map<Object, Object> getCompilerStorage();
 
@@ -133,25 +136,27 @@
     ConstantPool getConstantPool();
 
     /**
-     * Returns the annotation for the specified type of this method, if such an annotation is present.
-     *
+     * Returns the annotation for the specified type of this method, if such an annotation is
+     * present.
+     * 
      * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this method, else {@code null}
+     * @return this element's annotation for the specified annotation type if present on this
+     *         method, else {@code null}
      */
     <T extends Annotation> T getAnnotation(Class<T> annotationClass);
 
     /**
-     * Returns an array of arrays that represent the annotations on the formal parameters, in declaration order, of this
-     * method.
-     *
+     * Returns an array of arrays that represent the annotations on the formal parameters, in
+     * declaration order, of this method.
+     * 
      * @see Method#getParameterAnnotations()
      */
     Annotation[][] getParameterAnnotations();
 
     /**
-     * Returns an array of {@link Type} objects that represent the formal parameter types, in declaration order, of this
-     * method.
-     *
+     * Returns an array of {@link Type} objects that represent the formal parameter types, in
+     * declaration order, of this method.
+     * 
      * @see Method#getGenericParameterTypes()
      */
     Type[] getGenericParameterTypes();
@@ -161,7 +166,6 @@
      */
     boolean canBeInlined();
 
-
     /**
      * Returns the LineNumberTable of this method.
      */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,15 +26,16 @@
 import java.lang.reflect.*;
 
 /**
- * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays thereof. Types, like
- * fields and methods, are resolved through {@link ConstantPool constant pools}.
+ * Represents a resolved Java types. Types include primitives, objects, {@code void}, and arrays
+ * thereof. Types, like fields and methods, are resolved through {@link ConstantPool constant pools}
+ * .
  */
 public interface ResolvedJavaType extends JavaType {
 
     /**
-     * Represents each of the several different parts of the runtime representation of a type which compiled code may
-     * need to reference individually. These may or may not be different objects or data structures, depending on the
-     * runtime system.
+     * Represents each of the several different parts of the runtime representation of a type which
+     * compiled code may need to reference individually. These may or may not be different objects
+     * or data structures, depending on the runtime system.
      */
     public enum Representation {
         /**
@@ -43,15 +44,16 @@
         JavaClass,
 
         /**
-         * The runtime representation of the "hub" of this type--that is, the closest part of the type representation
-         * which is typically stored in the object header.
+         * The runtime representation of the "hub" of this type--that is, the closest part of the
+         * type representation which is typically stored in the object header.
          */
         ObjectHub
     }
 
     /**
-     * Gets the encoding of (that is, a constant representing the value of) the specified part of this type.
-     *
+     * Gets the encoding of (that is, a constant representing the value of) the specified part of
+     * this type.
+     * 
      * @param r the part of this type
      * @return a constant representing a reference to the specified part of this type
      */
@@ -59,57 +61,58 @@
 
     /**
      * Checks whether this type has a finalizer method.
-     *
+     * 
      * @return {@code true} if this class has a finalizer
      */
     boolean hasFinalizer();
 
     /**
-     * Checks whether this type has any finalizable subclasses so far. Any decisions based on this information require
-     * the registration of a dependency, since this information may change.
-     *
+     * Checks whether this type has any finalizable subclasses so far. Any decisions based on this
+     * information require the registration of a dependency, since this information may change.
+     * 
      * @return {@code true} if this class has any subclasses with finalizers
      */
     boolean hasFinalizableSubclass();
 
     /**
      * Checks whether this type is an interface.
-     *
+     * 
      * @return {@code true} if this type is an interface
      */
     boolean isInterface();
 
     /**
      * Checks whether this type is an instance class.
-     *
+     * 
      * @return {@code true} if this type is an instance class
      */
     boolean isInstanceClass();
 
     /**
      * Checks whether this type is an array class.
-     *
+     * 
      * @return {@code true} if this type is an array class
      */
     boolean isArray();
 
     /**
      * Checks whether this type is primitive.
-     *
+     * 
      * @return {@code true} if this type is primitive
      */
     boolean isPrimitive();
 
     /**
-     * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class should be used to
-     * decode the modifiers. Only the flags specified in the JVM specification will be included in the returned mask.
-     * This method is identical to {@link Class#getModifiers()} in terms of the value return for this type.
+     * Returns the Java language modifiers for this type, as an integer. The {@link Modifier} class
+     * should be used to decode the modifiers. Only the flags specified in the JVM specification
+     * will be included in the returned mask. This method is identical to
+     * {@link Class#getModifiers()} in terms of the value return for this type.
      */
     int getModifiers();
 
     /**
      * Checks whether this type is initialized.
-     *
+     * 
      * @return {@code true} if this type is initialized
      */
     boolean isInitialized();
@@ -120,68 +123,68 @@
     void initialize();
 
     /**
-     * Determines if this type is either the same as, or is a superclass or superinterface of, the type represented by
-     * the specified parameter. This method is identical to {@link Class#isAssignableFrom(Class)} in terms of the value
-     * return for this type.
+     * Determines if this type is either the same as, or is a superclass or superinterface of, the
+     * type represented by the specified parameter. This method is identical to
+     * {@link Class#isAssignableFrom(Class)} in terms of the value return for this type.
      */
     boolean isAssignableFrom(ResolvedJavaType other);
 
     /**
      * Checks whether the specified object is an instance of this type.
-     *
+     * 
      * @param obj the object to test
      * @return {@code true} if the object is an instance of this type
      */
     boolean isInstance(Constant obj);
 
     /**
-     * Returns this type if it is an exact type otherwise returns null.
-     * This type is exact if it is void, primitive, final, or an array of a final or primitive type.
-     *
+     * Returns this type if it is an exact type otherwise returns null. This type is exact if it is
+     * void, primitive, final, or an array of a final or primitive type.
+     * 
      * @return this type if it is exact; {@code null} otherwise
      */
     ResolvedJavaType asExactType();
 
     /**
-     * Gets the super class of this type.
-     * If this type represents either the {@code Object} class, a primitive type, or void, then
-     * null is returned.  If this object represents an array class or an interface then the
-     * type object representing the {@code Object} class is returned.
+     * Gets the super class of this type. If this type represents either the {@code Object} class, a
+     * primitive type, or void, then null is returned. If this object represents an array class or
+     * an interface then the type object representing the {@code Object} class is returned.
      */
     ResolvedJavaType getSuperclass();
 
     /**
-     * Gets the interfaces implemented or extended by this type. This method is analogous to {@link Class#getInterfaces()}
-     * and as such, only returns the interfaces directly implemented or extended by this type.
+     * Gets the interfaces implemented or extended by this type. This method is analogous to
+     * {@link Class#getInterfaces()} and as such, only returns the interfaces directly implemented
+     * or extended by this type.
      */
     ResolvedJavaType[] getInterfaces();
 
     /**
-     * Walks the class hierarchy upwards and returns the least common class that is a superclass of both the current and
-     * the given type.
-     *
-     * @return the least common type that is a super type of both the current and the given type, or {@code null} if
-     *         primitive types are involved.
+     * Walks the class hierarchy upwards and returns the least common class that is a superclass of
+     * both the current and the given type.
+     * 
+     * @return the least common type that is a super type of both the current and the given type, or
+     *         {@code null} if primitive types are involved.
      */
     ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType);
 
     /**
      * Attempts to get a unique concrete subclass of this type.
      * <p>
-     * For an {@linkplain #isArray() array} type A, the unique concrete subclass is A if
-     * the {@linkplain MetaUtil#getElementalType(ResolvedJavaType) elemental} type of A
-     * is final (which includes primitive types). Otherwise {@code null} is returned for A.
+     * For an {@linkplain #isArray() array} type A, the unique concrete subclass is A if the
+     * {@linkplain MetaUtil#getElementalType(ResolvedJavaType) elemental} type of A is final (which
+     * includes primitive types). Otherwise {@code null} is returned for A.
      * <p>
      * For a non-array type T, the result is the unique concrete type in the current hierarchy of T.
      * <p>
-     * A runtime may decide not to manage or walk a large hierarchy and so the result is conservative.
-     * That is, a non-null result is guaranteed to be the unique concrete class in T's hierarchy
-     * <b>at the current point in time</b>
-     * but a null result does not necessarily imply that there is no unique concrete class in T's hierarchy.
+     * A runtime may decide not to manage or walk a large hierarchy and so the result is
+     * conservative. That is, a non-null result is guaranteed to be the unique concrete class in T's
+     * hierarchy <b>at the current point in time</b> but a null result does not necessarily imply
+     * that there is no unique concrete class in T's hierarchy.
      * <p>
-     * If the compiler uses the result of this method for its compilation, it must register an assumption because
-     * dynamic class loading can invalidate the result of this method.
-     *
+     * If the compiler uses the result of this method for its compilation, it must register an
+     * assumption because dynamic class loading can invalidate the result of this method.
+     * 
      * @return the unique concrete subclass for this type as described above
      */
     ResolvedJavaType findUniqueConcreteSubtype();
@@ -192,51 +195,55 @@
 
     /**
      * Resolves the method implementation for virtual dispatches on objects of this dynamic type.
-     *
+     * 
      * @param method the method to select the implementation of
      * @return the method implementation that would be selected at runtime
      */
     ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method);
 
     /**
-     * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is the only possible
-     * unique target for a virtual call on A(). Returns {@code null} if either no such concrete method or more than one
-     * such method exists. Returns the method A if A is a concrete method that is not overridden.
+     * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is
+     * the only possible unique target for a virtual call on A(). Returns {@code null} if either no
+     * such concrete method or more than one such method exists. Returns the method A if A is a
+     * concrete method that is not overridden.
      * <p>
-     * If the compiler uses the result of this method for its compilation, it must register an assumption because
-     * dynamic class loading can invalidate the result of this method.
-     *
+     * If the compiler uses the result of this method for its compilation, it must register an
+     * assumption because dynamic class loading can invalidate the result of this method.
+     * 
      * @param method the method A for which a unique concrete target is searched
-     * @return the unique concrete target or {@code null} if no such target exists or assumptions are not supported by
-     *         this runtime
+     * @return the unique concrete target or {@code null} if no such target exists or assumptions
+     *         are not supported by this runtime
      */
     ResolvedJavaMethod findUniqueConcreteMethod(ResolvedJavaMethod method);
 
     /**
-     * Returns the instance fields of this class, including {@linkplain ResolvedJavaField#isInternal() internal} fields.
-     * A zero-length array is returned for array and primitive types. The order of fields returned by this method is
-     * stable. That is, for a single JVM execution the same order is returned each time this method is called. It is
-     * also the "natural" order, which means that the JVM would expect the fields in this order if no specific order is
-     * given.
-     *
-     * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this type are included in
-     *            the result
+     * Returns the instance fields of this class, including
+     * {@linkplain ResolvedJavaField#isInternal() internal} fields. A zero-length array is returned
+     * for array and primitive types. The order of fields returned by this method is stable. That
+     * is, for a single JVM execution the same order is returned each time this method is called. It
+     * is also the "natural" order, which means that the JVM would expect the fields in this order
+     * if no specific order is given.
+     * 
+     * @param includeSuperclasses if true, then instance fields for the complete hierarchy of this
+     *            type are included in the result
      * @return an array of instance fields
      */
     ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses);
 
     /**
-     * Returns the annotation for the specified type of this class, if such an annotation is present.
-     *
+     * Returns the annotation for the specified type of this class, if such an annotation is
+     * present.
+     * 
      * @param annotationClass the Class object corresponding to the annotation type
-     * @return this element's annotation for the specified annotation type if present on this class, else {@code null}
+     * @return this element's annotation for the specified annotation type if present on this class,
+     *         else {@code null}
      */
     <T extends Annotation> T getAnnotation(Class<T> annotationClass);
 
     /**
-     * Returns the instance field of this class (or one of its super classes) at the given
-     * offset, or {@code null} if there is no such field.
-     *
+     * Returns the instance field of this class (or one of its super classes) at the given offset,
+     * or {@code null} if there is no such field.
+     * 
      * @param offset the offset of the field to look for
      * @return the field with the given offset, or {@code null} if there is no such field.
      */
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Signature.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,47 +24,50 @@
 
 /**
  * Represents a method signature provided by the runtime.
- *
- * @see <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">Method Descriptors</a>
+ * 
+ * @see <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">Method
+ *      Descriptors</a>
  */
 public interface Signature {
 
     /**
      * Returns the number of parameters in this signature, adding 1 for a receiver if requested.
-     *
+     * 
      * @param receiver true if 1 is to be added to the result for a receiver
      * @return the number of parameters; + 1 iff {@code receiver == true}
      */
     int getParameterCount(boolean receiver);
 
     /**
-     * Gets the parameter type at the specified position. This method returns a {@linkplain ResolvedJavaType resolved}
-     * type if possible but without triggering any class loading or resolution.
-     *
+     * Gets the parameter type at the specified position. This method returns a
+     * {@linkplain ResolvedJavaType resolved} type if possible but without triggering any class
+     * loading or resolution.
+     * 
      * @param index the index into the parameters, with {@code 0} indicating the first parameter
-     * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to
-     *            retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a
-     *            resolved type.
+     * @param accessingClass the context of the type lookup. If accessing class is provided, its
+     *            class loader is used to retrieve an existing resolved type. This value can be
+     *            {@code null} if the caller does not care for a resolved type.
      * @return the {@code index}'th parameter type
      */
     JavaType getParameterType(int index, ResolvedJavaType accessingClass);
 
     /**
-     * Gets the parameter kind at the specified position. This is the same as calling {@link #getParameterType}.
-     * {@link JavaType#getKind getKind}.
-     *
+     * Gets the parameter kind at the specified position. This is the same as calling
+     * {@link #getParameterType}. {@link JavaType#getKind getKind}.
+     * 
      * @param index the index into the parameters, with {@code 0} indicating the first parameter
      * @return the kind of the parameter at the specified position
      */
     Kind getParameterKind(int index);
 
     /**
-     * Gets the return type of this signature. This method will return a {@linkplain ResolvedJavaType resolved} type if
-     * possible but without triggering any class loading or resolution.
-     *
-     * @param accessingClass the context of the type lookup. If accessing class is provided, its class loader is used to
-     *            retrieve an existing resolved type. This value can be {@code null} if the caller does not care for a
-     *            resolved type.
+     * Gets the return type of this signature. This method will return a
+     * {@linkplain ResolvedJavaType resolved} type if possible but without triggering any class
+     * loading or resolution.
+     * 
+     * @param accessingClass the context of the type lookup. If accessing class is provided, its
+     *            class loader is used to retrieve an existing resolved type. This value can be
+     *            {@code null} if the caller does not care for a resolved type.
      * @return the return type
      */
     JavaType getReturnType(ResolvedJavaType accessingClass);
@@ -77,20 +80,24 @@
 
     /**
      * Gets the size, in Java slots, of the parameters to this signature.
-     *
-     * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to include the
-     *            receiver
+     * 
+     * @param withReceiver {@code true} if to add a slot for a receiver object; {@code false} not to
+     *            include the receiver
      * @return the size of the parameters in slots
      */
     int getParameterSlots(boolean withReceiver);
 
     /**
-     * Gets the <a href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
-     * descriptor</a> corresponding to this signature.
-     * For example:
-     *
-     * <pre>(ILjava/lang/String;D)V</pre>.
-     *
+     * Gets the <a
+     * href="http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.3">method
+     * descriptor</a> corresponding to this signature. For example:
+     * 
+     * <pre>
+     * (ILjava/lang/String;D)V
+     * </pre>
+     * 
+     * .
+     * 
      * @return the signature as a string
      */
     String getMethodDescriptor();
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,8 @@
 import java.io.*;
 
 /**
- * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind kind} and are
- * immutable.
+ * Abstract base class for values manipulated by the compiler. All values have a {@linkplain Kind
+ * kind} and are immutable.
  */
 public abstract class Value implements Serializable {
 
@@ -34,8 +34,7 @@
 
     public static final Value[] NONE = {};
 
-    @SuppressWarnings("serial")
-    public static final Value ILLEGAL = new Value(Kind.Illegal) {
+    @SuppressWarnings("serial") public static final Value ILLEGAL = new Value(Kind.Illegal) {
 
         @Override
         public String toString() {
@@ -55,8 +54,8 @@
     }
 
     /**
-     * Returns a String representation of the kind, which should be the end of all {@link #toString()} implementation of
-     * subclasses.
+     * Returns a String representation of the kind, which should be the end of all
+     * {@link #toString()} implementation of subclasses.
      */
     protected final String getKindSuffix() {
         return "|" + getKind().getTypeChar();
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,10 +37,12 @@
             runtime = initializeRuntime();
         } catch (UnsatisfiedLinkError e) {
             runtime = new GraalRuntime() {
+
                 @Override
                 public String getName() {
                     return "";
                 }
+
                 @Override
                 public <T> T getCapability(Class<T> clazz) {
                     return null;
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/GraalRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,8 +22,9 @@
  */
 package com.oracle.graal.api.runtime;
 
+public interface GraalRuntime {
 
-public interface GraalRuntime {
     String getName();
+
     <T> T getCapability(Class<T> clazz);
 }
--- a/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,6 @@
 
 import com.oracle.graal.api.runtime.*;
 
-
 public class GraalTest {
 
     @Test
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64AsmOptions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64AsmOptions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,10 +23,11 @@
 package com.oracle.graal.asm.amd64;
 
 public class AMD64AsmOptions {
-    public static int     Atomics                       = 0;
-    public static boolean UseNormalNop                  = false;
-    public static boolean UseAddressNop                 = true;
-    public static boolean UseIncDec                     = false;
-    public static boolean UseXmmLoadAndClearUpper       = true;
-    public static boolean UseXmmRegToRegMoveAll         = false;
+
+    public static int Atomics = 0;
+    public static boolean UseNormalNop = false;
+    public static boolean UseAddressNop = true;
+    public static boolean UseIncDec = false;
+    public static boolean UseXmmLoadAndClearUpper = true;
+    public static boolean UseXmmRegToRegMoveAll = false;
 }
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64Assembler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,8 +37,10 @@
  * This class implements an assembler that can encode most X86 instructions.
  */
 public class AMD64Assembler extends AbstractAssembler {
+
     /**
-     * The kind for pointers and raw registers.  Since we know we are 64 bit here, we can hardcode it.
+     * The kind for pointers and raw registers. Since we know we are 64 bit here, we can hardcode
+     * it.
      */
     private static final Kind Word = Kind.Long;
 
@@ -48,26 +50,9 @@
      * The x86 condition codes used for conditional jumps/moves.
      */
     public enum ConditionFlag {
-        zero(0x4, "|zero|"),
-        notZero(0x5, "|nzero|"),
-        equal(0x4, "="),
-        notEqual(0x5, "!="),
-        less(0xc, "<"),
-        lessEqual(0xe, "<="),
-        greater(0xf, ">"),
-        greaterEqual(0xd, ">="),
-        below(0x2, "|<|"),
-        belowEqual(0x6, "|<=|"),
-        above(0x7, "|>|"),
-        aboveEqual(0x3, "|>=|"),
-        overflow(0x0, "|of|"),
-        noOverflow(0x1, "|nof|"),
-        carrySet(0x2, "|carry|"),
-        carryClear(0x3, "|ncarry|"),
-        negative(0x8, "|neg|"),
-        positive(0x9, "|pos|"),
-        parity(0xa, "|par|"),
-        noParity(0xb, "|npar|");
+        zero(0x4, "|zero|"), notZero(0x5, "|nzero|"), equal(0x4, "="), notEqual(0x5, "!="), less(0xc, "<"), lessEqual(0xe, "<="), greater(0xf, ">"), greaterEqual(0xd, ">="), below(0x2, "|<|"), belowEqual(
+                        0x6, "|<=|"), above(0x7, "|>|"), aboveEqual(0x3, "|>=|"), overflow(0x0, "|of|"), noOverflow(0x1, "|nof|"), carrySet(0x2, "|carry|"), carryClear(0x3, "|ncarry|"), negative(0x8,
+                        "|neg|"), positive(0x9, "|pos|"), parity(0xa, "|par|"), noParity(0xb, "|npar|");
 
         public final int value;
         public final String operator;
@@ -78,27 +63,47 @@
         }
 
         public ConditionFlag negate() {
-            switch(this) {
-                case zero: return notZero;
-                case notZero: return zero;
-                case equal: return notEqual;
-                case notEqual: return equal;
-                case less: return greaterEqual;
-                case lessEqual: return greater;
-                case greater: return lessEqual;
-                case greaterEqual: return less;
-                case below: return aboveEqual;
-                case belowEqual: return above;
-                case above: return belowEqual;
-                case aboveEqual: return below;
-                case overflow: return noOverflow;
-                case noOverflow: return overflow;
-                case carrySet: return carryClear;
-                case carryClear: return carrySet;
-                case negative: return positive;
-                case positive: return negative;
-                case parity: return noParity;
-                case noParity: return parity;
+            switch (this) {
+                case zero:
+                    return notZero;
+                case notZero:
+                    return zero;
+                case equal:
+                    return notEqual;
+                case notEqual:
+                    return equal;
+                case less:
+                    return greaterEqual;
+                case lessEqual:
+                    return greater;
+                case greater:
+                    return lessEqual;
+                case greaterEqual:
+                    return less;
+                case below:
+                    return aboveEqual;
+                case belowEqual:
+                    return above;
+                case above:
+                    return belowEqual;
+                case aboveEqual:
+                    return below;
+                case overflow:
+                    return noOverflow;
+                case noOverflow:
+                    return overflow;
+                case carrySet:
+                    return carryClear;
+                case carryClear:
+                    return carrySet;
+                case negative:
+                    return positive;
+                case positive:
+                    return negative;
+                case parity:
+                    return noParity;
+                case noParity:
+                    return parity;
             }
             throw new IllegalArgumentException();
         }
@@ -108,6 +113,7 @@
      * Constants for X86 prefix bytes.
      */
     private static class Prefix {
+
         private static final int REX = 0x40;
         private static final int REXB = 0x41;
         private static final int REXX = 0x42;
@@ -133,10 +139,11 @@
 
     /**
      * Constructs an assembler for the AMD64 architecture.
-     *
+     * 
      * @param registerConfig the register configuration used to bind {@link Register#Frame} and
-     *            {@link Register#CallerFrame} to physical registers. This value can be null if this assembler
-     *            instance will not be used to assemble instructions using these logical registers.
+     *            {@link Register#CallerFrame} to physical registers. This value can be null if this
+     *            assembler instance will not be used to assemble instructions using these logical
+     *            registers.
      */
     public AMD64Assembler(TargetDescription target, RegisterConfig registerConfig) {
         super(target);
@@ -204,10 +211,11 @@
         if (base == Register.Frame) {
             assert frameRegister != null : "cannot use register " + Register.Frame + " in assembler with null register configuration";
             base = frameRegister;
-//        } else if (base == Register.CallerFrame) {
-//            assert frameRegister != null : "cannot use register " + Register.Frame + " in assembler with null register configuration";
-//            base = frameRegister;
-//            disp += targetMethod.frameSize() + 8;
+            // } else if (base == Register.CallerFrame) {
+            // assert frameRegister != null : "cannot use register " + Register.Frame +
+            // " in assembler with null register configuration";
+            // base = frameRegister;
+            // disp += targetMethod.frameSize() + 8;
         }
 
         // Encode the registers as needed in the fields they are used in
@@ -441,7 +449,6 @@
         emitByte(0xC0 | encode);
     }
 
-
     public final void bsrq(Register dst, Address src) {
         prefixq(src, dst);
         emitByte(0xBD);
@@ -455,7 +462,6 @@
         emitByte(0xC0 | encode);
     }
 
-
     public final void bsrl(Register dst, Address src) {
         prefix(src, dst);
         emitByte(0xBD);
@@ -1052,10 +1058,10 @@
     }
 
     /**
-     * New CPUs require use of movsd and movss to avoid partial register stall
-     * when loading from memory. But for old Opteron use movlpd instead of movsd.
-     * The selection is done in {@link AMD64MacroAssembler#movdbl(Register, Address)}
-     * and {@link AMD64MacroAssembler#movflt(Register, Register)}.
+     * New CPUs require use of movsd and movss to avoid partial register stall when loading from
+     * memory. But for old Opteron use movlpd instead of movsd. The selection is done in
+     * {@link AMD64MacroAssembler#movdbl(Register, Address)} and
+     * {@link AMD64MacroAssembler#movflt(Register, Register)}.
      */
     public final void movlpd(Register dst, Address src) {
         assert dst.isFpu();
@@ -1559,7 +1565,7 @@
         emitByte(0x0F);
         emitByte(0xB8);
         emitOperandHelper(dst, src);
-      }
+    }
 
     public final void popcntl(Register dst, Register src) {
         emitByte(0xF3);
@@ -1567,7 +1573,7 @@
         emitByte(0x0F);
         emitByte(0xB8);
         emitByte(0xC0 | encode);
-      }
+    }
 
     public final void popcntq(Register dst, Address src) {
         emitByte(0xF3);
@@ -2230,9 +2236,9 @@
     }
 
     /**
-     * Creates prefix and the encoding of the lower 6 bits of the ModRM-Byte. It emits an operand prefix. If the given
-     * operands exceed 3 bits, the 4th bit is encoded in the prefix.
-     *
+     * Creates prefix and the encoding of the lower 6 bits of the ModRM-Byte. It emits an operand
+     * prefix. If the given operands exceed 3 bits, the 4th bit is encoded in the prefix.
+     * 
      * @param regEncoding the encoding of the register part of the ModRM-Byte
      * @param rmEncoding the encoding of the r/m part of the ModRM-Byte
      * @return the lower 6 bits of the ModRM-Byte that should be emitted
@@ -2269,7 +2275,6 @@
         return isRegister(value) && asRegister(value).encoding >= MinEncodingNeedsRex;
     }
 
-
     private void prefix(Address adr) {
         if (needsRex(adr.getBase())) {
             if (needsRex(adr.getIndex())) {
@@ -2917,11 +2922,12 @@
     protected final void patchJumpTarget(int branch, int branchTarget) {
         int op = codeBuffer.getByte(branch);
         assert op == 0xE8 // call
-            || op == 0x00 // jump table entry
-            || op == 0xE9 // jmp
-            || op == 0xEB // short jmp
-            || (op & 0xF0) == 0x70 // short jcc
-            || op == 0x0F && (codeBuffer.getByte(branch + 1) & 0xF0) == 0x80 // jcc
+                        ||
+                        op == 0x00 // jump table entry
+                        || op == 0xE9 // jmp
+                        || op == 0xEB // short jmp
+                        || (op & 0xF0) == 0x70 // short jcc
+                        || op == 0x0F && (codeBuffer.getByte(branch + 1) & 0xF0) == 0x80 // jcc
         : "Invalid opcode at patch point branch=" + branch + ", branchTarget=" + branchTarget + ", op=" + op;
 
         if (op == 0x00) {
@@ -2979,9 +2985,9 @@
     }
 
     /**
-     * Emits a direct call instruction. Note that the actual call target is not specified, because all calls
-     * need patching anyway. Therefore, 0 is emitted as the call target, and the user is responsible
-     * to add the call address to the appropriate patching tables.
+     * Emits a direct call instruction. Note that the actual call target is not specified, because
+     * all calls need patching anyway. Therefore, 0 is emitted as the call target, and the user is
+     * responsible to add the call address to the appropriate patching tables.
      */
     public final void call() {
         emitByte(0xE8);
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/AMD64MacroAssembler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -56,7 +56,6 @@
 
     // 64 bit versions
 
-
     public void decrementq(Register reg, int value) {
         if (value == Integer.MIN_VALUE) {
             subq(reg, value);
@@ -304,8 +303,8 @@
     }
 
     /**
-     * Non-atomic write of a 64-bit constant to memory. Do not use
-     * if the address might be a volatile field!
+     * Non-atomic write of a 64-bit constant to memory. Do not use if the address might be a
+     * volatile field!
      */
     public void movlong(Address dst, long src) {
         Address high = new Address(dst.getKind(), dst.getBase(), dst.getIndex(), dst.getScale(), dst.getDisplacement() + 4);
@@ -370,8 +369,9 @@
     }
 
     /**
-     * Emit code to save a given set of callee save registers in the
-     * {@linkplain CalleeSaveLayout CSA} within the frame.
+     * Emit code to save a given set of callee save registers in the {@linkplain CalleeSaveLayout
+     * CSA} within the frame.
+     * 
      * @param csl the description of the CSA
      * @param frameToCSA offset from the frame pointer to the CSA
      */
--- a/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/X86InstructionDecoder.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm.amd64/src/com/oracle/graal/asm/amd64/X86InstructionDecoder.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.asm.amd64;
 
-
 public final class X86InstructionDecoder {
 
     private boolean targetIs64Bit;
@@ -98,7 +97,7 @@
             againAfterPrefix = false;
             switch (0xFF & code[ip++]) {
 
-                // These convenience macros generate groups of "case" labels for the switch.
+            // These convenience macros generate groups of "case" labels for the switch.
 
                 case Prefix.CSSegment:
                 case Prefix.SSSegment:
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AbstractAssembler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
  * The platform-independent base class for the assembler.
  */
 public abstract class AbstractAssembler {
+
     public final TargetDescription target;
     public final Buffer codeBuffer;
 
@@ -55,9 +56,9 @@
     protected abstract void patchJumpTarget(int branch, int jumpTarget);
 
     /**
-     * Emits instruction(s) that access an address specified by a given displacement from the stack pointer
-     * in the direction that the stack grows (which is down on most architectures).
-     *
+     * Emits instruction(s) that access an address specified by a given displacement from the stack
+     * pointer in the direction that the stack grows (which is down on most architectures).
+     * 
      * @param disp the displacement from the stack pointer at which the stack should be accessed
      */
     public abstract void bangStack(int disp);
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AsmOptions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/AsmOptions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,5 +23,6 @@
 package com.oracle.graal.asm;
 
 public class AsmOptions {
-    public static int     InitialCodeBufferSize         = 232;
+
+    public static int InitialCodeBufferSize = 232;
 }
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Buffer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,9 +25,11 @@
 import java.util.*;
 
 /**
- * Code buffer management for the assembler. Support for little endian and big endian architectures is implemented using subclasses.
+ * Code buffer management for the assembler. Support for little endian and big endian architectures
+ * is implemented using subclasses.
  */
 public abstract class Buffer {
+
     protected byte[] data;
     protected int position;
 
@@ -49,14 +51,11 @@
     }
 
     /**
-     * Closes this buffer. No extra data can be written to this buffer after
-     * this call.
-     *
-     * @param trimmedCopy
-     *            if {@code true}, then a copy of the underlying byte array up
-     *            to (but not including) {@code position()} is returned
-     * @return the data in this buffer or a trimmed copy if {@code trimmedCopy}
-     *         is {@code true}
+     * Closes this buffer. No extra data can be written to this buffer after this call.
+     * 
+     * @param trimmedCopy if {@code true}, then a copy of the underlying byte array up to (but not
+     *            including) {@code position()} is returned
+     * @return the data in this buffer or a trimmed copy if {@code trimmedCopy} is {@code true}
      */
     public byte[] close(boolean trimmedCopy) {
         byte[] result = trimmedCopy ? Arrays.copyOf(data, position()) : data;
@@ -70,13 +69,10 @@
 
     /**
      * Copies the data from this buffer into a given array.
-     *
-     * @param dst
-     *            the destination array
-     * @param off
-     *            starting position in {@code dst}
-     * @param len
-     *            number of bytes to copy
+     * 
+     * @param dst the destination array
+     * @param off starting position in {@code dst}
+     * @param len number of bytes to copy
      */
     public void copyInto(byte[] dst, int off, int len) {
         System.arraycopy(data, 0, dst, off, len);
@@ -133,6 +129,7 @@
     public abstract int getInt(int pos);
 
     public static final class BigEndian extends Buffer {
+
         @Override
         public int emitShort(int b, int pos) {
             assert NumUtil.isUShort(b);
@@ -171,22 +168,17 @@
 
         @Override
         public int getShort(int pos) {
-            return
-                (data[pos + 0] & 0xff) << 8 |
-                (data[pos + 1] & 0xff) << 0;
+            return (data[pos + 0] & 0xff) << 8 | (data[pos + 1] & 0xff) << 0;
         }
 
         @Override
         public int getInt(int pos) {
-            return
-                (data[pos + 0] & 0xff) << 24 |
-                (data[pos + 1] & 0xff) << 16 |
-                (data[pos + 2] & 0xff) << 8 |
-                (data[pos + 3] & 0xff) << 0;
+            return (data[pos + 0] & 0xff) << 24 | (data[pos + 1] & 0xff) << 16 | (data[pos + 2] & 0xff) << 8 | (data[pos + 3] & 0xff) << 0;
         }
     }
 
     public static final class LittleEndian extends Buffer {
+
         @Override
         public int emitShort(int b, int pos) {
             assert NumUtil.isUShort(b);
@@ -225,18 +217,12 @@
 
         @Override
         public int getShort(int pos) {
-            return
-                (data[pos + 1] & 0xff) << 8 |
-                (data[pos + 0] & 0xff) << 0;
+            return (data[pos + 1] & 0xff) << 8 | (data[pos + 0] & 0xff) << 0;
         }
 
         @Override
         public int getInt(int pos) {
-            return
-                (data[pos + 3] & 0xff) << 24 |
-                (data[pos + 2] & 0xff) << 16 |
-                (data[pos + 1] & 0xff) << 8 |
-                (data[pos + 0] & 0xff) << 0;
+            return (data[pos + 3] & 0xff) << 24 | (data[pos + 2] & 0xff) << 16 | (data[pos + 1] & 0xff) << 8 | (data[pos + 0] & 0xff) << 0;
         }
     }
 }
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Label.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/Label.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,17 +28,19 @@
  * This class represents a label within assembly code.
  */
 public final class Label {
+
     private int position = -1;
 
     /**
-     * References to instructions that jump to this unresolved label.
-     * These instructions need to be patched when the label is bound
-     * using the {@link #patchInstructions(AbstractAssembler)} method.
+     * References to instructions that jump to this unresolved label. These instructions need to be
+     * patched when the label is bound using the {@link #patchInstructions(AbstractAssembler)}
+     * method.
      */
     private ArrayList<Integer> patchPositions = new ArrayList<>(4);
 
     /**
      * Returns the position of this label in the code buffer.
+     * 
      * @return the position
      */
     public int position() {
@@ -51,6 +53,7 @@
 
     /**
      * Binds the label to the specified position.
+     * 
      * @param pos the position
      */
     protected void bind(int pos) {
--- a/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.asm/src/com/oracle/graal/asm/NumUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,61 +26,55 @@
  * A collection of static utility functions that check ranges of numbers.
  */
 public class NumUtil {
+
     public static boolean isShiftCount(int x) {
         return 0 <= x && x < 32;
     }
 
     /**
-     * Determines if a given {@code int} value is the range of unsigned byte
-     * values.
+     * Determines if a given {@code int} value is the range of unsigned byte values.
      */
     public static boolean isUByte(int x) {
         return (x & 0xff) == x;
     }
 
     /**
-     * Determines if a given {@code int} value is the range of signed byte
-     * values.
+     * Determines if a given {@code int} value is the range of signed byte values.
      */
     public static boolean isByte(int x) {
         return (byte) x == x;
     }
 
     /**
-     * Determines if a given {@code long} value is the range of unsigned byte
-     * values.
+     * Determines if a given {@code long} value is the range of unsigned byte values.
      */
     public static boolean isUByte(long x) {
         return (x & 0xffL) == x;
     }
 
     /**
-     * Determines if a given {@code long} value is the range of signed byte
-     * values.
+     * Determines if a given {@code long} value is the range of signed byte values.
      */
     public static boolean isByte(long l) {
         return (byte) l == l;
     }
 
     /**
-     * Determines if a given {@code long} value is the range of unsigned int
-     * values.
+     * Determines if a given {@code long} value is the range of unsigned int values.
      */
     public static boolean isUInt(long x) {
         return (x & 0xffffffffL) == x;
     }
 
     /**
-     * Determines if a given {@code long} value is the range of signed int
-     * values.
+     * Determines if a given {@code long} value is the range of signed int values.
      */
     public static boolean isInt(long l) {
         return (int) l == l;
     }
 
     /**
-     * Determines if a given {@code int} value is the range of signed short
-     * values.
+     * Determines if a given {@code int} value is the range of signed short values.
      */
     public static boolean isShort(int x) {
         return (short) x == x;
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeLookupSwitch.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
  * A utility for processing {@link Bytecodes#LOOKUPSWITCH} bytecodes.
  */
 public class BytecodeLookupSwitch extends BytecodeSwitch {
+
     private static final int OFFSET_TO_NUMBER_PAIRS = 4;
     private static final int OFFSET_TO_FIRST_PAIR_MATCH = 8;
     private static final int OFFSET_TO_FIRST_PAIR_OFFSET = 12;
@@ -33,6 +34,7 @@
 
     /**
      * Constructor for a {@link BytecodeStream}.
+     * 
      * @param stream the {@code BytecodeStream} containing the switch instruction
      * @param bci the index in the stream of the switch instruction
      */
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeStream.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,11 +22,10 @@
  */
 package com.oracle.graal.bytecode;
 
-
 /**
- * A utility class that makes iterating over bytecodes and reading operands
- * simpler and less error prone. For example, it handles the {@link Bytecodes#WIDE} instruction
- * and wide variants of instructions internally.
+ * A utility class that makes iterating over bytecodes and reading operands simpler and less error
+ * prone. For example, it handles the {@link Bytecodes#WIDE} instruction and wide variants of
+ * instructions internally.
  */
 public final class BytecodeStream {
 
@@ -37,6 +36,7 @@
 
     /**
      * Creates a new {@code BytecodeStream} for the specified bytecode.
+     * 
      * @param code the array of bytes that contains the bytecode
      */
     public BytecodeStream(byte[] code) {
@@ -54,6 +54,7 @@
 
     /**
      * Gets the next bytecode index (no side-effects).
+     * 
      * @return the next bytecode index
      */
     public int nextBCI() {
@@ -62,6 +63,7 @@
 
     /**
      * Gets the current bytecode index.
+     * 
      * @return the current bytecode index
      */
     public int currentBCI() {
@@ -70,6 +72,7 @@
 
     /**
      * Gets the bytecode index of the end of the code.
+     * 
      * @return the index of the end of the code
      */
     public int endBCI() {
@@ -77,9 +80,9 @@
     }
 
     /**
-     * Gets the current opcode. This method will never return the
-     * {@link Bytecodes#WIDE WIDE} opcode, but will instead
-     * return the opcode that is modified by the {@code WIDE} opcode.
+     * Gets the current opcode. This method will never return the {@link Bytecodes#WIDE WIDE}
+     * opcode, but will instead return the opcode that is modified by the {@code WIDE} opcode.
+     * 
      * @return the current opcode; {@link Bytecodes#END} if at or beyond the end of the code
      */
     public int currentBC() {
@@ -91,8 +94,9 @@
     }
 
     /**
-     * Reads the index of a local variable for one of the load or store instructions.
-     * The WIDE modifier is handled internally.
+     * Reads the index of a local variable for one of the load or store instructions. The WIDE
+     * modifier is handled internally.
+     * 
      * @return the index of the local variable
      */
     public int readLocalIndex() {
@@ -105,6 +109,7 @@
 
     /**
      * Read the delta for an {@link Bytecodes#IINC} bytecode.
+     * 
      * @return the delta for the {@code IINC}
      */
     public int readIncrement() {
@@ -117,6 +122,7 @@
 
     /**
      * Read the destination of a {@link Bytecodes#GOTO} or {@code IF} instructions.
+     * 
      * @return the destination bytecode index
      */
     public int readBranchDest() {
@@ -130,6 +136,7 @@
 
     /**
      * Read a signed 4-byte integer from the bytecode stream at the specified bytecode index.
+     * 
      * @param bci the bytecode index
      * @return the integer value
      */
@@ -140,6 +147,7 @@
 
     /**
      * Reads an unsigned, 1-byte value from the bytecode stream at the specified bytecode index.
+     * 
      * @param bci the bytecode index
      * @return the byte
      */
@@ -149,6 +157,7 @@
 
     /**
      * Reads a constant pool index for the current instruction.
+     * 
      * @return the constant pool index
      */
     public char readCPI() {
@@ -160,6 +169,7 @@
 
     /**
      * Reads a signed, 1-byte value for the current instruction (e.g. BIPUSH).
+     * 
      * @return the byte
      */
     public byte readByte() {
@@ -168,6 +178,7 @@
 
     /**
      * Reads a signed, 2-byte short for the current instruction (e.g. SIPUSH).
+     * 
      * @return the short value
      */
     public short readShort() {
@@ -175,9 +186,10 @@
     }
 
     /**
-     * Sets the bytecode index to the specified value.
-     * If {@code bci} is beyond the end of the array, {@link #currentBC} will return
-     * {@link Bytecodes#END} and other methods may throw {@link ArrayIndexOutOfBoundsException}.
+     * Sets the bytecode index to the specified value. If {@code bci} is beyond the end of the
+     * array, {@link #currentBC} will return {@link Bytecodes#END} and other methods may throw
+     * {@link ArrayIndexOutOfBoundsException}.
+     * 
      * @param bci the new bytecode index
      */
     public void setBCI(int bci) {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeSwitch.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,6 +27,7 @@
  * and {@link Bytecodes#TABLESWITCH} instructions.
  */
 public abstract class BytecodeSwitch {
+
     /**
      * The {@link BytecodeStream} containing the bytecode array.
      */
@@ -36,12 +37,14 @@
      */
     protected final int bci;
     /**
-     * Index of the start of the additional data for the switch instruction, aligned to a multiple of four from the method start.
+     * Index of the start of the additional data for the switch instruction, aligned to a multiple
+     * of four from the method start.
      */
     protected final int alignedBci;
 
     /**
      * Constructor for a {@link BytecodeStream}.
+     * 
      * @param stream the {@code BytecodeStream} containing the switch instruction
      * @param bci the index in the stream of the switch instruction
      */
@@ -53,6 +56,7 @@
 
     /**
      * Gets the current bytecode index.
+     * 
      * @return the current bytecode index
      */
     public int bci() {
@@ -61,6 +65,7 @@
 
     /**
      * Gets the index of the instruction denoted by the {@code i}'th switch target.
+     * 
      * @param i index of the switch target
      * @return the index of the instruction denoted by the {@code i}'th switch target
      */
@@ -70,6 +75,7 @@
 
     /**
      * Gets the index of the instruction for the default switch target.
+     * 
      * @return the index of the instruction for the default switch target
      */
     public int defaultTarget() {
@@ -78,6 +84,7 @@
 
     /**
      * Gets the offset from the start of the switch instruction to the default switch target.
+     * 
      * @return the offset to the default switch target
      */
     public int defaultOffset() {
@@ -86,6 +93,7 @@
 
     /**
      * Gets the key at {@code i}'th switch target index.
+     * 
      * @param i the switch target index
      * @return the key at {@code i}'th switch target index
      */
@@ -93,6 +101,7 @@
 
     /**
      * Gets the offset from the start of the switch instruction for the {@code i}'th switch target.
+     * 
      * @param i the switch target index
      * @return the offset to the {@code i}'th switch target
      */
@@ -100,12 +109,14 @@
 
     /**
      * Gets the number of switch targets.
+     * 
      * @return the number of switch targets
      */
     public abstract int numberOfCases();
 
     /**
      * Gets the total size in bytes of the switch instruction.
+     * 
      * @return the total size in bytes of the switch instruction
      */
     public abstract int size();
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/BytecodeTableSwitch.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
  * A utility for processing {@link Bytecodes#TABLESWITCH} bytecodes.
  */
 public class BytecodeTableSwitch extends BytecodeSwitch {
+
     private static final int OFFSET_TO_LOW_KEY = 4;
     private static final int OFFSET_TO_HIGH_KEY = 8;
     private static final int OFFSET_TO_FIRST_JUMP_OFFSET = 12;
@@ -33,6 +34,7 @@
 
     /**
      * Constructor for a {@link BytecodeStream}.
+     * 
      * @param stream the {@code BytecodeStream} containing the switch instruction
      * @param bci the index in the stream of the switch instruction
      */
@@ -42,6 +44,7 @@
 
     /**
      * Gets the low key of the table switch.
+     * 
      * @return the low key
      */
     public int lowKey() {
@@ -50,6 +53,7 @@
 
     /**
      * Gets the high key of the table switch.
+     * 
      * @return the high key
      */
     public int highKey() {
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytecodes.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,19 +27,19 @@
 import java.lang.reflect.*;
 
 /**
- * The definitions of the bytecodes that are valid input to the compiler and
- * related utility methods. This comprises two groups: the standard Java
- * bytecodes defined by <a href=
- * "http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html">
- * Java Virtual Machine Specification</a>, and a set of <i>extended</i>
- * bytecodes that support low-level programming, for example, memory barriers.
- *
- * The extended bytecodes are one or three bytes in size. The one-byte bytecodes
- * follow the values in the standard set, with no gap. The three-byte extended
- * bytecodes share a common first byte and carry additional instruction-specific
- * information in the second and third bytes.
+ * The definitions of the bytecodes that are valid input to the compiler and related utility
+ * methods. This comprises two groups: the standard Java bytecodes defined by <a href=
+ * "http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html"> Java Virtual
+ * Machine Specification</a>, and a set of <i>extended</i> bytecodes that support low-level
+ * programming, for example, memory barriers.
+ * 
+ * The extended bytecodes are one or three bytes in size. The one-byte bytecodes follow the values
+ * in the standard set, with no gap. The three-byte extended bytecodes share a common first byte and
+ * carry additional instruction-specific information in the second and third bytes.
  */
 public class Bytecodes {
+
+    // @formatter:off
     public static final int NOP                  =   0; // 0x00
     public static final int ACONST_NULL          =   1; // 0x01
     public static final int ICONST_M1            =   2; // 0x02
@@ -246,13 +246,15 @@
 
     public static final int ILLEGAL = 255;
     public static final int END = 256;
+    // @formatter:on
 
     /**
      * The last opcode defined by the JVM specification. To iterate over all JVM bytecodes:
+     * 
      * <pre>
-     *     for (int opcode = 0; opcode <= Bytecodes.LAST_JVM_OPCODE; ++opcode) {
-     *         //
-     *     }
+     * for (int opcode = 0; opcode &lt;= Bytecodes.LAST_JVM_OPCODE; ++opcode) {
+     *     //
+     * }
      * </pre>
      */
     public static final int LAST_JVM_OPCODE = JSR_W;
@@ -263,19 +265,21 @@
     static class Flags {
 
         /**
-         * Denotes an instruction that ends a basic block and does not let control flow fall through to its lexical successor.
+         * Denotes an instruction that ends a basic block and does not let control flow fall through
+         * to its lexical successor.
          */
         static final int STOP = 0x00000001;
 
         /**
-         * Denotes an instruction that ends a basic block and may let control flow fall through to its lexical successor.
-         * In practice this means it is a conditional branch.
+         * Denotes an instruction that ends a basic block and may let control flow fall through to
+         * its lexical successor. In practice this means it is a conditional branch.
          */
         static final int FALL_THROUGH = 0x00000002;
 
         /**
-         * Denotes an instruction that has a 2 or 4 byte operand that is an offset to another instruction in the same method.
-         * This does not include the {@link Bytecodes#TABLESWITCH} or {@link Bytecodes#LOOKUPSWITCH} instructions.
+         * Denotes an instruction that has a 2 or 4 byte operand that is an offset to another
+         * instruction in the same method. This does not include the {@link Bytecodes#TABLESWITCH}
+         * or {@link Bytecodes#LOOKUPSWITCH} instructions.
          */
         static final int BRANCH = 0x00000004;
 
@@ -292,7 +296,7 @@
         /**
          * Denotes an instruction that can cause a trap.
          */
-        static final int TRAP        = 0x00000080;
+        static final int TRAP = 0x00000080;
         /**
          * Denotes an instruction that is commutative.
          */
@@ -304,15 +308,15 @@
         /**
          * Denotes an instruction that loads an operand.
          */
-        static final int LOAD        = 0x00000400;
+        static final int LOAD = 0x00000400;
         /**
          * Denotes an instruction that stores an operand.
          */
-        static final int STORE       = 0x00000800;
+        static final int STORE = 0x00000800;
         /**
          * Denotes the 4 INVOKE* instructions.
          */
-        static final int INVOKE       = 0x00001000;
+        static final int INVOKE = 0x00001000;
     }
 
     // Performs a sanity check that none of the flags overlap.
@@ -335,27 +339,32 @@
     }
 
     /**
-     * An array that maps from a bytecode value to a {@link String} for the corresponding instruction mnemonic.
-     * This will include the root instruction for the three-byte extended instructions.
+     * An array that maps from a bytecode value to a {@link String} for the corresponding
+     * instruction mnemonic. This will include the root instruction for the three-byte extended
+     * instructions.
      */
     private static final String[] nameArray = new String[256];
 
     /**
-     * An array that maps from a bytecode value to the set of {@link Flags} for the corresponding instruction.
+     * An array that maps from a bytecode value to the set of {@link Flags} for the corresponding
+     * instruction.
      */
     private static final int[] flagsArray = new int[256];
 
     /**
-     * An array that maps from a bytecode value to the length in bytes for the corresponding instruction.
+     * An array that maps from a bytecode value to the length in bytes for the corresponding
+     * instruction.
      */
     private static final int[] lengthArray = new int[256];
 
     /**
-     * An array that maps from a bytecode value to the estimated complexity of the bytecode in terms of generated machine code.
+     * An array that maps from a bytecode value to the estimated complexity of the bytecode in terms
+     * of generated machine code.
      */
     private static final int[] compilationComplexityArray = new int[256];
 
     // Checkstyle: stop
+    // @formatter:off
     static {
         def(NOP                 , "nop"             , "b"    , 0);
         def(ACONST_NULL         , "aconst_null"     , "b"    , 0);
@@ -561,10 +570,12 @@
         def(JSR_W               , "jsr_w"           , "boooo", 0, STOP | BRANCH);
         def(BREAKPOINT          , "breakpoint"      , "b"    , 0, TRAP);
     }
+    // @formatter:on
     // Checkstyle: resume
 
     /**
      * Determines if an opcode is commutative.
+     * 
      * @param opcode the opcode to check
      * @return {@code true} iff commutative
      */
@@ -574,10 +585,11 @@
 
     /**
      * Gets the length of an instruction denoted by a given opcode.
-     *
+     * 
      * @param opcode an instruction opcode
-     * @return the length of the instruction denoted by {@code opcode}. If {@code opcode} is an illegal instruction or denotes a
-     *         variable length instruction (e.g. {@link #TABLESWITCH}), then 0 is returned.
+     * @return the length of the instruction denoted by {@code opcode}. If {@code opcode} is an
+     *         illegal instruction or denotes a variable length instruction (e.g.
+     *         {@link #TABLESWITCH}), then 0 is returned.
      */
     public static int lengthOf(int opcode) {
         return lengthArray[opcode & 0xff];
@@ -585,6 +597,7 @@
 
     /**
      * Gets the compilation complexity for a given opcode.
+     * 
      * @param opcode an opcode
      * @return a value >= 0
      */
@@ -594,9 +607,10 @@
 
     /**
      * Gets the lower-case mnemonic for a given opcode.
-     *
+     * 
      * @param opcode an opcode
-     * @return the mnemonic for {@code opcode} or {@code "<illegal opcode: " + opcode + ">"} if {@code opcode} is not a legal opcode
+     * @return the mnemonic for {@code opcode} or {@code "<illegal opcode: " + opcode + ">"} if
+     *         {@code opcode} is not a legal opcode
      */
     public static String nameOf(int opcode) throws IllegalArgumentException {
         String name = nameArray[opcode & 0xff];
@@ -608,8 +622,10 @@
 
     /**
      * Allocation-free version of {@linkplain #nameOf(int)}.
+     * 
      * @param opcode an opcode.
-     * @return the mnemonic for {@code opcode} or {@code "<illegal opcode>"} if {@code opcode} is not a legal opcode.
+     * @return the mnemonic for {@code opcode} or {@code "<illegal opcode>"} if {@code opcode} is
+     *         not a legal opcode.
      */
     public static String baseNameOf(int opcode) {
         String name = nameArray[opcode & 0xff];
@@ -621,7 +637,7 @@
 
     /**
      * Gets the opcode corresponding to a given mnemonic.
-     *
+     * 
      * @param name an opcode mnemonic
      * @return the opcode corresponding to {@code mnemonic}
      * @throws IllegalArgumentException if {@code name} does not denote a valid opcode
@@ -637,28 +653,31 @@
 
     /**
      * Determines if a given opcode denotes an instruction that can cause an implicit exception.
-     *
+     * 
      * @param opcode an opcode to test
-     * @return {@code true} iff {@code opcode} can cause an implicit exception, {@code false} otherwise
+     * @return {@code true} iff {@code opcode} can cause an implicit exception, {@code false}
+     *         otherwise
      */
     public static boolean canTrap(int opcode) {
         return (flagsArray[opcode & 0xff] & TRAP) != 0;
     }
 
     /**
-     * Determines if a given opcode denotes an instruction that loads a local variable to the operand stack.
-     *
+     * Determines if a given opcode denotes an instruction that loads a local variable to the
+     * operand stack.
+     * 
      * @param opcode an opcode to test
-     * @return {@code true} iff {@code opcode} loads a local variable to the operand stack, {@code false} otherwise
+     * @return {@code true} iff {@code opcode} loads a local variable to the operand stack,
+     *         {@code false} otherwise
      */
     public static boolean isLoad(int opcode) {
         return (flagsArray[opcode & 0xff] & LOAD) != 0;
     }
 
     /**
-     * Determines if a given opcode denotes an instruction that ends a basic block and does not let control flow fall
-     * through to its lexical successor.
-     *
+     * Determines if a given opcode denotes an instruction that ends a basic block and does not let
+     * control flow fall through to its lexical successor.
+     * 
      * @param opcode an opcode to test
      * @return {@code true} iff {@code opcode} properly ends a basic block
      */
@@ -669,9 +688,10 @@
     /**
      * Determines if a given opcode denotes an instruction that stores a value to a local variable
      * after popping it from the operand stack.
-     *
+     * 
      * @param opcode an opcode to test
-     * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise
+     * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false}
+     *         otherwise
      */
     public static boolean isInvoke(int opcode) {
         return (flagsArray[opcode & 0xff] & INVOKE) != 0;
@@ -680,9 +700,10 @@
     /**
      * Determines if a given opcode denotes an instruction that stores a value to a local variable
      * after popping it from the operand stack.
-     *
+     * 
      * @param opcode an opcode to test
-     * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false} otherwise
+     * @return {@code true} iff {@code opcode} stores a value to a local variable, {@code false}
+     *         otherwise
      */
     public static boolean isStore(int opcode) {
         return (flagsArray[opcode & 0xff] & STORE) != 0;
@@ -690,7 +711,7 @@
 
     /**
      * Determines if a given opcode is an instruction that delimits a basic block.
-     *
+     * 
      * @param opcode an opcode to test
      * @return {@code true} iff {@code opcode} delimits a basic block
      */
@@ -699,9 +720,10 @@
     }
 
     /**
-     * Determines if a given opcode is an instruction that has a 2 or 4 byte operand that is an offset to another
-     * instruction in the same method. This does not include the {@linkplain #TABLESWITCH switch} instructions.
-     *
+     * Determines if a given opcode is an instruction that has a 2 or 4 byte operand that is an
+     * offset to another instruction in the same method. This does not include the
+     * {@linkplain #TABLESWITCH switch} instructions.
+     * 
      * @param opcode an opcode to test
      * @return {@code true} iff {@code opcode} is a branch instruction with a single operand
      */
@@ -711,6 +733,7 @@
 
     /**
      * Determines if a given opcode denotes a conditional branch.
+     * 
      * @param opcode
      * @return {@code true} iff {@code opcode} is a conditional branch
      */
@@ -722,48 +745,59 @@
      * Gets the arithmetic operator name for a given opcode. If {@code opcode} does not denote an
      * arithmetic instruction, then the {@linkplain #nameOf(int) name} of the opcode is returned
      * instead.
-     *
+     * 
      * @param op an opcode
      * @return the arithmetic operator name
      */
     public static String operator(int op) {
         // Checkstyle: stop
         switch (op) {
-            // arithmetic ops
-            case IADD : // fall through
-            case LADD : // fall through
-            case FADD : // fall through
-            case DADD : return "+";
-            case ISUB : // fall through
-            case LSUB : // fall through
-            case FSUB : // fall through
-            case DSUB : return "-";
-            case IMUL : // fall through
-            case LMUL : // fall through
-            case FMUL : // fall through
-            case DMUL : return "*";
-            case IDIV : // fall through
-            case LDIV : // fall through
-            case FDIV : // fall through
-            case DDIV : return "/";
-            case IREM : // fall through
-            case LREM : // fall through
-            case FREM : // fall through
-            case DREM : return "%";
-            // shift ops
-            case ISHL : // fall through
-            case LSHL : return "<<";
-            case ISHR : // fall through
-            case LSHR : return ">>";
+        // arithmetic ops
+            case IADD: // fall through
+            case LADD: // fall through
+            case FADD: // fall through
+            case DADD:
+                return "+";
+            case ISUB: // fall through
+            case LSUB: // fall through
+            case FSUB: // fall through
+            case DSUB:
+                return "-";
+            case IMUL: // fall through
+            case LMUL: // fall through
+            case FMUL: // fall through
+            case DMUL:
+                return "*";
+            case IDIV: // fall through
+            case LDIV: // fall through
+            case FDIV: // fall through
+            case DDIV:
+                return "/";
+            case IREM: // fall through
+            case LREM: // fall through
+            case FREM: // fall through
+            case DREM:
+                return "%";
+                // shift ops
+            case ISHL: // fall through
+            case LSHL:
+                return "<<";
+            case ISHR: // fall through
+            case LSHR:
+                return ">>";
             case IUSHR: // fall through
-            case LUSHR: return ">>>";
-            // logic ops
-            case IAND : // fall through
-            case LAND : return "&";
-            case IOR  : // fall through
-            case LOR  : return "|";
-            case IXOR : // fall through
-            case LXOR : return "^";
+            case LUSHR:
+                return ">>>";
+                // logic ops
+            case IAND: // fall through
+            case LAND:
+                return "&";
+            case IOR: // fall through
+            case LOR:
+                return "|";
+            case IXOR: // fall through
+            case LXOR:
+                return "^";
         }
         // Checkstyle: resume
         return nameOf(op);
@@ -771,7 +805,7 @@
 
     /**
      * Defines a bytecode by entering it into the arrays that record its name, length and flags.
-     *
+     * 
      * @param name instruction name (should be lower case)
      * @param format encodes the length of the instruction
      */
@@ -781,7 +815,7 @@
 
     /**
      * Defines a bytecode by entering it into the arrays that record its name, length and flags.
-     *
+     * 
      * @param name instruction name (lower case)
      * @param format encodes the length of the instruction
      * @param flags the set of {@link Flags} associated with the instruction
--- a/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.bytecode/src/com/oracle/graal/bytecode/Bytes.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,10 @@
  * A collection of utility methods for dealing with bytes, particularly in byte arrays.
  */
 public class Bytes {
+
     /**
      * Gets a signed 1-byte value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @return the signed 1-byte value at index {@code bci} in array {@code data}
@@ -38,6 +40,7 @@
 
     /**
      * Gets a signed 2-byte big-endian value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @return the signed 2-byte, big-endian, value at index {@code bci} in array {@code data}
@@ -48,6 +51,7 @@
 
     /**
      * Gets an unsigned 1-byte value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @return the unsigned 1-byte value at index {@code bci} in array {@code data}
@@ -58,6 +62,7 @@
 
     /**
      * Gets an unsigned 2-byte big-endian value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @return the unsigned 2-byte, big-endian, value at index {@code bci} in array {@code data}
@@ -68,6 +73,7 @@
 
     /**
      * Gets a signed 4-byte big-endian value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @return the signed 4-byte, big-endian, value at index {@code bci} in array {@code data}
@@ -78,6 +84,7 @@
 
     /**
      * Gets either a signed 2-byte or a signed 4-byte big-endian value.
+     * 
      * @param data the array containing the data
      * @param bci the start index of the value to retrieve
      * @param fourByte if true, this method will return a 4-byte value
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64DeoptimizationStub.java	Fri Feb 01 17:06:26 2013 +0100
@@ -56,7 +56,6 @@
 
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
-        // TODO (cwimmer): we want to get rid of a generally reserved scratch register.
         Register scratch = tasm.frameMap.registerConfig.getScratchRegister();
 
         masm.bind(label);
@@ -64,12 +63,10 @@
             masm.nop();
             keepAlive.add(deoptInfo.toString());
             AMD64Move.move(tasm, masm, scratch.asValue(), Constant.forObject(deoptInfo));
-            // TODO Make this an explicit calling convention instead of using a scratch register
             AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(SET_DEOPT_INFO), info);
         }
 
         masm.movl(scratch, tasm.runtime.encodeDeoptActionAndReason(action, reason));
-        // TODO Make this an explicit calling convention instead of using a scratch register
         AMD64Call.directCall(tasm, masm, tasm.runtime.lookupRuntimeCall(DEOPTIMIZE), info);
         AMD64Call.shouldNotReachHere(tasm, masm);
     }
--- a/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -88,16 +88,11 @@
     private static final RegisterValue RCX_I = AMD64.rcx.asValue(Kind.Int);
 
     public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory {
+
         @Override
         public LIRInstruction createMove(Value result, Value input) {
             return new SpillMoveOp(result, input);
         }
-
-        @Override
-        public LIRInstruction createExchange(Value input1, Value input2) {
-            // TODO (cwimmer) implement XCHG operation for LIR
-            return null;
-        }
     }
 
     public AMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) {
@@ -118,19 +113,26 @@
     public boolean canStoreConstant(Constant c) {
         // there is no immediate move of 64-bit constants on Intel
         switch (c.getKind()) {
-            case Long:   return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c);
-            case Double: return false;
-            case Object: return c.isNull();
-            default:     return true;
+            case Long:
+                return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c);
+            case Double:
+                return false;
+            case Object:
+                return c.isNull();
+            default:
+                return true;
         }
     }
 
     @Override
     public boolean canInlineConstant(Constant c) {
         switch (c.getKind()) {
-            case Long:   return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c);
-            case Object: return c.isNull();
-            default:     return true;
+            case Long:
+                return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c);
+            case Object:
+                return c.isNull();
+            default:
+                return true;
         }
     }
 
@@ -167,12 +169,14 @@
             }
             if (isConstant(index)) {
                 long newDisplacement = displacement + asConstant(index).asLong() * scale;
-                // only use the constant index if the resulting displacement fits into a 32 bit offset
+                // only use the constant index if the resulting displacement fits into a 32 bit
+                // offset
                 if (NumUtil.isInt(newDisplacement)) {
                     displacement = (int) newDisplacement;
                     index = Value.ILLEGAL;
                 } else {
-                    // create a temporary variable for the index, the pointer load cannot handle a constant index
+                    // create a temporary variable for the index, the pointer load cannot handle a
+                    // constant index
                     Value newIndex = newVariable(Kind.Long);
                     emitMove(index, newIndex);
                     index = newIndex;
@@ -231,10 +235,15 @@
         switch (left.getKind().getStackKind()) {
             case Int:
             case Long:
-            case Object: append(new BranchOp(finalCondition, label, info)); break;
+            case Object:
+                append(new BranchOp(finalCondition, label, info));
+                break;
             case Float:
-            case Double: append(new FloatBranchOp(finalCondition, unorderedIsTrue, label, info)); break;
-            default: throw GraalInternalError.shouldNotReachHere("" + left.getKind());
+            case Double:
+                append(new FloatBranchOp(finalCondition, unorderedIsTrue, label, info));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere("" + left.getKind());
         }
     }
 
@@ -247,17 +256,22 @@
         switch (left.getKind().getStackKind()) {
             case Int:
             case Long:
-            case Object: append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); break;
+            case Object:
+                append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue)));
+                break;
             case Float:
-            case Double: append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue))); break;
+            case Double:
+                append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue)));
+                break;
 
         }
         return result;
     }
 
     /**
-     * This method emits the compare instruction, and may reorder the operands. It returns true if it did so.
-     *
+     * This method emits the compare instruction, and may reorder the operands. It returns true if
+     * it did so.
+     * 
      * @param a the left operand of the comparison
      * @param b the right operand of the comparison
      * @return true if the left and right operands were switched, false otherwise
@@ -277,12 +291,23 @@
         }
         switch (left.getKind().getStackKind()) {
             case Jsr:
-            case Int: append(new CompareOp(ICMP, left, right)); break;
-            case Long: append(new CompareOp(LCMP, left, right)); break;
-            case Object: append(new CompareOp(ACMP, left, right)); break;
-            case Float: append(new CompareOp(FCMP, left, right)); break;
-            case Double: append(new CompareOp(DCMP, left, right)); break;
-            default: throw GraalInternalError.shouldNotReachHere();
+            case Int:
+                append(new CompareOp(ICMP, left, right));
+                break;
+            case Long:
+                append(new CompareOp(LCMP, left, right));
+                break;
+            case Object:
+                append(new CompareOp(ACMP, left, right));
+                break;
+            case Float:
+                append(new CompareOp(FCMP, left, right));
+                break;
+            case Double:
+                append(new CompareOp(DCMP, left, right));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return mirrored;
     }
@@ -291,11 +316,20 @@
     public Variable emitNegate(Value input) {
         Variable result = newVariable(input.getKind());
         switch (input.getKind()) {
-            case Int:    append(new Op1Stack(INEG, result, input)); break;
-            case Long:   append(new Op1Stack(LNEG, result, input)); break;
-            case Float:  append(new Op2Reg(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000)))); break;
-            case Double: append(new Op2Reg(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); break;
-            default: throw GraalInternalError.shouldNotReachHere();
+            case Int:
+                append(new Op1Stack(INEG, result, input));
+                break;
+            case Long:
+                append(new Op1Stack(LNEG, result, input));
+                break;
+            case Float:
+                append(new Op2Reg(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000))));
+                break;
+            case Double:
+                append(new Op2Reg(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L))));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -303,12 +337,21 @@
     @Override
     public Variable emitAdd(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Stack(IADD, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Stack(LADD, result, a, loadNonConst(b))); break;
-            case Float:  append(new Op2Stack(FADD, result, a, loadNonConst(b))); break;
-            case Double: append(new Op2Stack(DADD, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Stack(IADD, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Stack(LADD, result, a, loadNonConst(b)));
+                break;
+            case Float:
+                append(new Op2Stack(FADD, result, a, loadNonConst(b)));
+                break;
+            case Double:
+                append(new Op2Stack(DADD, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -316,12 +359,21 @@
     @Override
     public Variable emitSub(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Stack(ISUB, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Stack(LSUB, result, a, loadNonConst(b))); break;
-            case Float:  append(new Op2Stack(FSUB, result, a, loadNonConst(b))); break;
-            case Double: append(new Op2Stack(DSUB, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Stack(ISUB, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Stack(LSUB, result, a, loadNonConst(b)));
+                break;
+            case Float:
+                append(new Op2Stack(FSUB, result, a, loadNonConst(b)));
+                break;
+            case Double:
+                append(new Op2Stack(DSUB, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -329,12 +381,21 @@
     @Override
     public Variable emitMul(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Reg(IMUL, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Reg(LMUL, result, a, loadNonConst(b))); break;
-            case Float:  append(new Op2Stack(FMUL, result, a, loadNonConst(b))); break;
-            case Double: append(new Op2Stack(DMUL, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Reg(IMUL, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Reg(LMUL, result, a, loadNonConst(b)));
+                break;
+            case Float:
+                append(new Op2Stack(FMUL, result, a, loadNonConst(b)));
+                break;
+            case Double:
+                append(new Op2Stack(DMUL, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -367,7 +428,7 @@
     }
 
     public Value[] emitIntegerDivRem(Value a, Value b) {
-        switch(a.getKind()) {
+        switch (a.getKind()) {
             case Int:
                 emitMove(a, RAX_I);
                 append(new DivRemOp(IDIVREM, RAX_I, load(b), state()));
@@ -383,7 +444,7 @@
 
     @Override
     public Value emitDiv(Value a, Value b) {
-        switch(a.getKind()) {
+        switch (a.getKind()) {
             case Int:
                 emitMove(a, RAX_I);
                 append(new DivOp(IDIV, RAX_I, RAX_I, load(b), state()));
@@ -409,7 +470,7 @@
 
     @Override
     public Value emitRem(Value a, Value b) {
-        switch(a.getKind()) {
+        switch (a.getKind()) {
             case Int:
                 emitMove(a, RAX_I);
                 append(new DivOp(IREM, RDX_I, RAX_I, load(b), state()));
@@ -433,7 +494,7 @@
 
     @Override
     public Variable emitUDiv(Value a, Value b) {
-        switch(a.getKind()) {
+        switch (a.getKind()) {
             case Int:
                 emitMove(a, RAX_I);
                 append(new DivOp(IUDIV, RAX_I, RAX_I, load(b), state()));
@@ -449,7 +510,7 @@
 
     @Override
     public Variable emitURem(Value a, Value b) {
-        switch(a.getKind()) {
+        switch (a.getKind()) {
             case Int:
                 emitMove(a, RAX_I);
                 append(new DivOp(IUREM, RDX_I, RAX_I, load(b), state()));
@@ -463,14 +524,18 @@
         }
     }
 
-
     @Override
     public Variable emitAnd(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Stack(IAND, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Stack(LAND, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Stack(IAND, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Stack(LAND, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -478,10 +543,15 @@
     @Override
     public Variable emitOr(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Stack(IOR, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Stack(LOR, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Stack(IOR, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Stack(LOR, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -489,22 +559,31 @@
     @Override
     public Variable emitXor(Value a, Value b) {
         Variable result = newVariable(a.getKind());
-        switch(a.getKind()) {
-            case Int:    append(new Op2Stack(IXOR, result, a, loadNonConst(b))); break;
-            case Long:   append(new Op2Stack(LXOR, result, a, loadNonConst(b))); break;
-            default:     throw GraalInternalError.shouldNotReachHere();
+        switch (a.getKind()) {
+            case Int:
+                append(new Op2Stack(IXOR, result, a, loadNonConst(b)));
+                break;
+            case Long:
+                append(new Op2Stack(LXOR, result, a, loadNonConst(b)));
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
 
-
     @Override
     public Variable emitShl(Value a, Value b) {
         Variable result = newVariable(a.getKind());
         switch (a.getKind()) {
-            case Int:    append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); break;
-            case Long:   append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); break;
-            default: GraalInternalError.shouldNotReachHere();
+            case Int:
+                append(new ShiftOp(ISHL, result, a, loadShiftCount(b)));
+                break;
+            case Long:
+                append(new ShiftOp(LSHL, result, a, loadShiftCount(b)));
+                break;
+            default:
+                GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -513,9 +592,14 @@
     public Variable emitShr(Value a, Value b) {
         Variable result = newVariable(a.getKind());
         switch (a.getKind()) {
-            case Int:    append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); break;
-            case Long:   append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); break;
-            default: GraalInternalError.shouldNotReachHere();
+            case Int:
+                append(new ShiftOp(ISHR, result, a, loadShiftCount(b)));
+                break;
+            case Long:
+                append(new ShiftOp(LSHR, result, a, loadShiftCount(b)));
+                break;
+            default:
+                GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -524,9 +608,14 @@
     public Variable emitUShr(Value a, Value b) {
         Variable result = newVariable(a.getKind());
         switch (a.getKind()) {
-            case Int:    append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); break;
-            case Long:   append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); break;
-            default: GraalInternalError.shouldNotReachHere();
+            case Int:
+                append(new ShiftOp(IUSHR, result, a, loadShiftCount(b)));
+                break;
+            case Long:
+                append(new ShiftOp(LUSHR, result, a, loadShiftCount(b)));
+                break;
+            default:
+                GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
@@ -540,42 +629,80 @@
         return RCX_I;
     }
 
-
     @Override
     public Variable emitConvert(ConvertNode.Op opcode, Value inputVal) {
         Variable input = load(inputVal);
         Variable result = newVariable(opcode.to);
         switch (opcode) {
-            case I2L: append(new Op1Reg(I2L, result, input)); break;
-            case L2I: append(new Op1Stack(L2I, result, input)); break;
-            case I2B: append(new Op1Stack(I2B, result, input)); break;
-            case I2C: append(new Op1Stack(I2C, result, input)); break;
-            case I2S: append(new Op1Stack(I2S, result, input)); break;
-            case F2D: append(new Op1Reg(F2D, result, input)); break;
-            case D2F: append(new Op1Reg(D2F, result, input)); break;
-            case I2F: append(new Op1Reg(I2F, result, input)); break;
-            case I2D: append(new Op1Reg(I2D, result, input)); break;
-            case F2I: append(new Op1Reg(F2I, result, input)); break;
-            case D2I: append(new Op1Reg(D2I, result, input)); break;
-            case L2F: append(new Op1Reg(L2F, result, input)); break;
-            case L2D: append(new Op1Reg(L2D, result, input)); break;
-            case F2L: append(new Op1Reg(F2L, result, input)); break;
-            case D2L: append(new Op1Reg(D2L, result, input)); break;
-            case MOV_I2F: append(new Op1Reg(MOV_I2F, result, input)); break;
-            case MOV_L2D: append(new Op1Reg(MOV_L2D, result, input)); break;
-            case MOV_F2I: append(new Op1Reg(MOV_F2I, result, input)); break;
-            case MOV_D2L: append(new Op1Reg(MOV_D2L, result, input)); break;
+            case I2L:
+                append(new Op1Reg(I2L, result, input));
+                break;
+            case L2I:
+                append(new Op1Stack(L2I, result, input));
+                break;
+            case I2B:
+                append(new Op1Stack(I2B, result, input));
+                break;
+            case I2C:
+                append(new Op1Stack(I2C, result, input));
+                break;
+            case I2S:
+                append(new Op1Stack(I2S, result, input));
+                break;
+            case F2D:
+                append(new Op1Reg(F2D, result, input));
+                break;
+            case D2F:
+                append(new Op1Reg(D2F, result, input));
+                break;
+            case I2F:
+                append(new Op1Reg(I2F, result, input));
+                break;
+            case I2D:
+                append(new Op1Reg(I2D, result, input));
+                break;
+            case F2I:
+                append(new Op1Reg(F2I, result, input));
+                break;
+            case D2I:
+                append(new Op1Reg(D2I, result, input));
+                break;
+            case L2F:
+                append(new Op1Reg(L2F, result, input));
+                break;
+            case L2D:
+                append(new Op1Reg(L2D, result, input));
+                break;
+            case F2L:
+                append(new Op1Reg(F2L, result, input));
+                break;
+            case D2L:
+                append(new Op1Reg(D2L, result, input));
+                break;
+            case MOV_I2F:
+                append(new Op1Reg(MOV_I2F, result, input));
+                break;
+            case MOV_L2D:
+                append(new Op1Reg(MOV_L2D, result, input));
+                break;
+            case MOV_F2I:
+                append(new Op1Reg(MOV_F2I, result, input));
+                break;
+            case MOV_D2L:
+                append(new Op1Reg(MOV_D2L, result, input));
+                break;
             case UNSIGNED_I2L:
-                // Instructions that move or generate 32-bit register values also set the upper 32 bits of the register to zero.
+                // Instructions that move or generate 32-bit register values also set the upper 32
+                // bits of the register to zero.
                 // Consequently, there is no need for a special zero-extension move.
                 emitMove(input, result);
                 break;
-            default: throw GraalInternalError.shouldNotReachHere();
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         return result;
     }
 
-
     @Override
     public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo) {
         LIRFrameState info = state();
@@ -583,7 +710,6 @@
         append(new BranchOp(ConditionFlag.overflow, stubEntry, info));
     }
 
-
     @Override
     public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo, long leafGraphId) {
         LIRFrameState info = state(leafGraphId);
@@ -606,7 +732,8 @@
 
     @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.
+        // The current register allocator cannot handle variables at call sites, need a fixed
+        // register.
         Value targetAddress = AMD64.rax.asValue();
         emitMove(operand(callTarget.computedAddress()), targetAddress);
         append(new IndirectCallOp(callTarget.target(), result, parameters, temps, targetAddress, callState));
@@ -686,7 +813,8 @@
 
     @Override
     protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) {
-        // Making a copy of the switch value is necessary because jump table destroys the input value
+        // Making a copy of the switch value is necessary because jump table destroys the input
+        // value
         if (key.getKind() == Kind.Int || key.getKind() == Kind.Long) {
             append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL));
         } else {
@@ -702,7 +830,8 @@
 
     @Override
     protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) {
-        // Making a copy of the switch value is necessary because jump table destroys the input value
+        // Making a copy of the switch value is necessary because jump table destroys the input
+        // value
         Variable tmp = emitMove(key);
         append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind)));
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,9 +35,9 @@
 import com.oracle.graal.phases.common.*;
 
 /**
- * In the following tests, the usages of local variable "a" are replaced with the integer constant 0. Then boxing
- * elimination 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.
+ * In the following tests, the usages of local variable "a" are replaced with the integer constant
+ * 0. Then boxing elimination 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 BoxingEliminationTest extends GraalCompilerTest {
 
@@ -111,6 +111,7 @@
 
     private void test(final String snippet, final String referenceSnippet) {
         Debug.scope("BoxingEliminationTest", new DebugDumpScope(snippet), new Runnable() {
+
             @Override
             public void run() {
                 StructuredGraph graph = parse(snippet);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CompiledMethodTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,9 +36,9 @@
 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.
+ * 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 {
 
@@ -47,6 +47,7 @@
     }
 
     Object f1;
+
     public Object testMethodVirtual(Object arg1, Object arg2, Object arg3) {
         return f1 + " " + arg1 + " " + arg2 + " " + arg3;
     }
@@ -167,10 +168,12 @@
     }
 
     public interface CompiledObject {
+
         Object execute(ObjectCompiler context, String args);
     }
 
     public interface ObjectCompiler {
+
         CompiledObject compile(CompilableObject node);
     }
 
@@ -185,6 +188,7 @@
         @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/ConditionTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ConditionTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,7 +31,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.calc.*;
 
-
 public class ConditionTest {
 
     @Test
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/DegeneratedLoopsTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 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
+ * 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 DegeneratedLoopsTest extends GraalCompilerTest {
@@ -49,6 +49,7 @@
     }
 
     private static class UnresolvedException extends RuntimeException {
+
         private static final long serialVersionUID = 5215434338750728440L;
 
         static {
@@ -76,6 +77,7 @@
 
     private void test(final String snippet) {
         Debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet), new Runnable() {
+
             public void run() {
                 StructuredGraph graph = parse(snippet);
                 Debug.dump(graph, "Graph");
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/FloatingReadTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 public class FloatingReadTest extends GraphScheduleTest {
 
     public static class Container {
+
         public int a;
     }
 
@@ -53,9 +54,10 @@
 
     private void test(final String snippet) {
         Debug.scope("FloatingReadTest", new DebugDumpScope(snippet), new Runnable() {
+
             public void run() {
                 StructuredGraph graph = parse(snippet);
-                new LoweringPhase(runtime(), new Assumptions(false)).apply(graph);
+                new LoweringPhase(null, runtime(), new Assumptions(false)).apply(graph);
                 new FloatingReadPhase().apply(graph);
 
                 ReturnNode returnNode = null;
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -57,9 +57,9 @@
  * <p>
  * See {@link InvokeHintsTest} as an example of a white box test.
  * <p>
- * Black box tests use the {@link #test(String, Object...)} or {@link #testN(int, String, Object...)}
- * to execute some method in the interpreter and compare its result against that produced
- * by a Graal compiled version of the method.
+ * Black box tests use the {@link #test(String, Object...)} or
+ * {@link #testN(int, String, Object...)} to execute some method in the interpreter and compare its
+ * result against that produced by a Graal compiled version of the method.
  * <p>
  * These tests will be run by the {@code mx unittest} command.
  */
@@ -139,7 +139,7 @@
 
     /**
      * Parses a Java method to produce a graph.
-     *
+     * 
      * @param methodName the name of the method in {@code this.getClass()} to be parsed
      */
     protected StructuredGraph parse(String methodName) {
@@ -202,6 +202,7 @@
         for (int i = 0; i < n; i++) {
             final int idx = i;
             Thread t = new Thread(i + ":" + name) {
+
                 @Override
                 public void run() {
                     try {
@@ -234,8 +235,10 @@
     }
 
     static class Result {
+
         final Object returnValue;
         final Throwable exception;
+
         public Result(Object returnValue, Throwable exception) {
             this.returnValue = returnValue;
             this.exception = exception;
@@ -257,7 +260,8 @@
     protected Result executeExpected(Method method, Object receiver, Object... args) {
         before();
         try {
-            // This gives us both the expected return value as well as ensuring that the method to be compiled is fully resolved
+            // This gives us both the expected return value as well as ensuring that the method to
+            // be compiled is fully resolved
             return new Result(referenceInvoke(method, receiver, args), null);
         } catch (InvocationTargetException e) {
             return new Result(null, e.getTargetException());
@@ -284,7 +288,7 @@
 
     /**
      * Prepends a non-null receiver argument to a given list or args.
-     *
+     * 
      * @param receiver the receiver argument to prepend if it is non-null
      */
     protected Object[] argsWithReceiver(Object receiver, Object... args) {
@@ -315,7 +319,8 @@
             Assert.assertTrue("expected " + expect.exception, actual.exception != null);
             Assert.assertEquals(expect.exception.getClass(), actual.exception.getClass());
         } else {
-            //System.out.println(name + "(" + Arrays.toString(args) + "): expected=" + expect.returnValue + ", actual=" + actual.returnValue);
+            // System.out.println(name + "(" + Arrays.toString(args) + "): expected=" +
+            // expect.returnValue + ", actual=" + actual.returnValue);
             assertEquals(expect.returnValue, actual.returnValue);
         }
     }
@@ -331,7 +336,7 @@
 
     /**
      * Can be overridden to modify the compilation phases applied for a test.
-     *
+     * 
      * @param method the method being compiled
      * @param graph the graph being compiled
      * @param phasePlan the phase plan to be edited
@@ -341,8 +346,9 @@
 
     /**
      * Gets installed code for a given method and graph, compiling it first if necessary.
-     *
-     * @param forceCompile specifies whether to ignore any previous code cached for the (method, key) pair
+     * 
+     * @param forceCompile specifies whether to ignore any previous code cached for the (method,
+     *            key) pair
      */
     protected InstalledCode getCode(final ResolvedJavaMethod method, final StructuredGraph graph, boolean forceCompile) {
         if (!forceCompile) {
@@ -351,7 +357,7 @@
                 if (cached.isValid()) {
                     return cached;
                 } else {
-                    //System.out.println(cached.getMethod() + " was invalidated");
+                    // System.out.println(cached.getMethod() + " was invalidated");
                 }
 
             }
@@ -360,6 +366,7 @@
         final int id = compilationId++;
 
         InstalledCode installedCode = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true), new Callable<InstalledCode>() {
+
             public InstalledCode call() throws Exception {
                 final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed();
                 if (printCompilation) {
@@ -386,13 +393,14 @@
 
     protected InstalledCode addMethod(final ResolvedJavaMethod method, final CompilationResult compResult) {
         assert graalCompiler != null;
-        return Debug.scope("CodeInstall", new Object[] {graalCompiler, method}, new Callable<InstalledCode>() {
+        return Debug.scope("CodeInstall", new Object[]{graalCompiler, method}, new Callable<InstalledCode>() {
+
             @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");
+                    Debug.dump(new Object[]{compResult, info[0]}, "After code installation");
                 }
                 return installedMethod;
             }
@@ -401,7 +409,7 @@
 
     /**
      * Parses a Java method to produce a graph.
-     *
+     * 
      * @param methodName the name of the method in {@code this.getClass()} to be parsed
      */
     protected StructuredGraph parseProfiled(String methodName) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphScheduleTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraphScheduleTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.phases.schedule.*;
 
 public class GraphScheduleTest extends GraalCompilerTest {
+
     protected void assertOrderedAfterSchedule(StructuredGraph graph, Node a, Node b) {
         SchedulePhase ibp = new SchedulePhase();
         ibp.apply(graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfBoxingEliminationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfBoxingEliminationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -73,6 +73,7 @@
 
     private void test(final String snippet) {
         Debug.scope("IfBoxingEliminationTest", new DebugDumpScope(snippet), new Runnable() {
+
             @Override
             public void run() {
                 StructuredGraph graph = parse(snippet);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/IfCanonicalizerTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,8 +33,8 @@
 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
+ * 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 IfCanonicalizerTest extends GraalCompilerTest {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/LoopUnswitchTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -47,7 +47,6 @@
         return sum;
     }
 
-
     public static int test1Snippet(int a) {
         int sum = 0;
         for (int i = 0; i < 1000; i++) {
@@ -62,28 +61,28 @@
 
     public static int referenceSnippet2(int a) {
         int sum = 0;
-        switch(a) {
-        case 0:
-            for (int i = 0; i < 1000; i++) {
-                sum += System.currentTimeMillis();
-            }
-            break;
-        case 1:
-            for (int i = 0; i < 1000; i++) {
-                sum += 1;
-                sum += 5;
-            }
-            break;
-        case 55:
-            for (int i = 0; i < 1000; i++) {
-                sum += 5;
-            }
-            break;
-        default:
-            for (int i = 0; i < 1000; i++) {
-                //nothing
-            }
-            break;
+        switch (a) {
+            case 0:
+                for (int i = 0; i < 1000; i++) {
+                    sum += System.currentTimeMillis();
+                }
+                break;
+            case 1:
+                for (int i = 0; i < 1000; i++) {
+                    sum += 1;
+                    sum += 5;
+                }
+                break;
+            case 55:
+                for (int i = 0; i < 1000; i++) {
+                    sum += 5;
+                }
+                break;
+            default:
+                for (int i = 0; i < 1000; i++) {
+                    // nothing
+                }
+                break;
         }
         return sum;
     }
@@ -91,7 +90,7 @@
     public static int test2Snippet(int a) {
         int sum = 0;
         for (int i = 0; i < 1000; i++) {
-            switch(a) {
+            switch (a) {
                 case 0:
                     sum += System.currentTimeMillis();
                     break;
@@ -102,7 +101,7 @@
                     sum += 5;
                     break;
                 default:
-                    //nothing
+                    // nothing
                     break;
             }
         }
@@ -137,6 +136,7 @@
         new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
         new CanonicalizerPhase(null, runtime(), assumptions).apply(referenceGraph);
         Debug.scope("Test", new DebugDumpScope("Test:" + snippet), new Runnable() {
+
             @Override
             public void run() {
                 assertEquals(referenceGraph, graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MonitorGraphTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,8 +37,8 @@
 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
+ * 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 MonitorGraphTest extends GraalCompilerTest {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ReassociateAndCanonicalTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
 import com.oracle.graal.phases.common.*;
 
 public class ReassociateAndCanonicalTest extends GraalCompilerTest {
+
     public static int rnd = (int) (Math.random() * 100);
 
     @Test
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ScalarTypeSystemTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,7 +30,8 @@
 import com.oracle.graal.phases.common.*;
 
 /**
- * In the following tests, the scalar type system of the compiler should be complete enough to see the relation between the different conditions.
+ * In the following tests, the scalar type system of the compiler should be complete enough to see
+ * the relation between the different conditions.
  */
 public class ScalarTypeSystemTest extends GraalCompilerTest {
 
@@ -164,7 +165,7 @@
         // No debug scope to reduce console noise for @Test(expected = ...) tests
         StructuredGraph graph = parse(snippet);
         Debug.dump(graph, "Graph");
-//        TypeSystemTest.outputGraph(graph);
+        // TypeSystemTest.outputGraph(graph);
         Assumptions assumptions = new Assumptions(false);
         new CanonicalizerPhase(null, runtime(), assumptions).apply(graph);
         new ConditionalEliminationPhase().apply(graph);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/StampCanonicalizerTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 import com.oracle.graal.phases.common.*;
 
 /**
- * This class tests some specific patterns the stamp system should be able to canonicalize away using
- * {@link IntegerStamp#mask()}.
+ * This class tests some specific patterns the stamp system should be able to canonicalize away
+ * using {@link IntegerStamp#mask()}.
  */
 public class StampCanonicalizerTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/TypeSystemTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,7 +39,8 @@
 import com.oracle.graal.phases.schedule.*;
 
 /**
- * In the following tests, the scalar type system of the compiler should be complete enough to see the relation between the different conditions.
+ * In the following tests, the scalar type system of the compiler should be complete enough to see
+ * the relation between the different conditions.
  */
 public class TypeSystemTest extends GraalCompilerTest {
 
@@ -205,13 +206,13 @@
     @Override
     protected void assertEquals(StructuredGraph expected, StructuredGraph graph) {
         if (expected.getNodeCount() != graph.getNodeCount()) {
-//            Debug.dump(expected, "Node count not matching - expected");
-//            Debug.dump(graph, "Node count not matching - actual");
-//            System.out.println("================ expected");
-//            outputGraph(expected);
-//            System.out.println("================ actual");
-//            outputGraph(graph);
-//            new IdealGraphPrinterDumpHandler().dump(graph, "asdf");
+            // Debug.dump(expected, "Node count not matching - expected");
+            // Debug.dump(graph, "Node count not matching - actual");
+            // System.out.println("================ expected");
+            // outputGraph(expected);
+            // System.out.println("================ actual");
+            // outputGraph(graph);
+            // new IdealGraphPrinterDumpHandler().dump(graph, "asdf");
             Assert.fail("Graphs do not have the same number of nodes: " + expected.getNodeCount() + " vs. " + graph.getNodeCount());
         }
     }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,8 +37,9 @@
 import com.oracle.graal.virtual.phases.ea.*;
 
 /**
- * In these test cases the probability of all invokes is set to a high value, such that an InliningPhase should inline them all.
- * After that, the EscapeAnalysisPhase is expected to remove all allocations and return the correct values.
+ * In these test cases the probability of all invokes is set to a high value, such that an
+ * InliningPhase should inline them all. After that, the EscapeAnalysisPhase is expected to remove
+ * all allocations and return the correct values.
  */
 public class EscapeAnalysisTest extends GraalCompilerTest {
 
@@ -99,7 +100,8 @@
     }
 
     /**
-     * This test case differs from the last one in that it requires inlining within a synchronized region.
+     * This test case differs from the last one in that it requires inlining within a synchronized
+     * region.
      */
     public static int testMonitor2Snippet() {
         Integer x = new Integer(0);
@@ -121,8 +123,10 @@
     }
 
     public static class TestObject {
+
         int x;
         int y;
+
         public TestObject(int x, int y) {
             this.x = x;
             this.y = y;
@@ -157,7 +161,9 @@
     }
 
     public static class TestObject2 {
+
         Object o;
+
         public TestObject2(Object o) {
             this.o = o;
         }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PartialEscapeAnalysisTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,9 +38,9 @@
 import com.oracle.graal.virtual.phases.ea.*;
 
 /**
- * In these test cases the probability of all invokes is set to a high value, such that an InliningPhase should inline
- * them all. After that, the PartialEscapeAnalysisPhase is expected to remove all allocations and return the correct
- * values.
+ * In these test cases the probability of all invokes is set to a high value, such that an
+ * InliningPhase should inline them all. After that, the PartialEscapeAnalysisPhase is expected to
+ * remove all allocations and return the correct values.
  */
 public class PartialEscapeAnalysisTest extends GraalCompilerTest {
 
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/inlining/InliningTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,6 +39,7 @@
 // TODO (chaeubl): add more test cases
 @SuppressWarnings("unused")
 public class InliningTest extends GraalCompilerTest {
+
     @Test
     public void testInvokeStaticInlining() {
         assertInlined(getGraph("invokeStaticSnippet"));
@@ -49,12 +50,12 @@
     public static Boolean invokeStaticSnippet(boolean value) {
         return Boolean.valueOf(value);
     }
+
     @SuppressWarnings("all")
     public static Boolean invokeStaticOnInstanceSnippet(Boolean obj, boolean value) {
         return obj.valueOf(value);
     }
 
-
     @Test
     public void testStaticBindableInlining() {
         assertInlined(getGraph("invokeConstructorSnippet"));
@@ -66,32 +67,25 @@
     public static Object invokeConstructorSnippet(int value) {
         return new SuperClass(value);
     }
+
     @SuppressWarnings("all")
     public static int invokeFinalMethodSnippet(SuperClass superClass, SubClassA subClassA, FinalSubClass finalSubClass) {
-        return superClass.publicFinalMethod() +
-               subClassA.publicFinalMethod() +
-               finalSubClass.publicFinalMethod() +
-               superClass.protectedFinalMethod() +
-               subClassA.protectedFinalMethod() +
-               finalSubClass.protectedFinalMethod();
+        return superClass.publicFinalMethod() + subClassA.publicFinalMethod() + finalSubClass.publicFinalMethod() + superClass.protectedFinalMethod() + subClassA.protectedFinalMethod() +
+                        finalSubClass.protectedFinalMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeMethodOnFinalClassSnippet(FinalSubClass finalSubClass) {
-        return finalSubClass.publicFinalMethod() +
-               finalSubClass.publicNotOverriddenMethod() +
-               finalSubClass.publicOverriddenMethod() +
-               finalSubClass.protectedFinalMethod() +
-               finalSubClass.protectedNotOverriddenMethod() +
-               finalSubClass.protectedOverriddenMethod();
+        return finalSubClass.publicFinalMethod() + finalSubClass.publicNotOverriddenMethod() + finalSubClass.publicOverriddenMethod() + finalSubClass.protectedFinalMethod() +
+                        finalSubClass.protectedNotOverriddenMethod() + finalSubClass.protectedOverriddenMethod();
     }
 
-
     @Test
     public void testClassHierarchyAnalysis() {
         assertInlined(getGraph("invokeLeafClassMethodSnippet"));
         assertInlined(getGraph("invokeConcreteMethodSnippet"));
         assertInlined(getGraph("invokeSingleImplementorInterfaceSnippet"));
-//        assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet"));
+        // assertInlined(getGraph("invokeConcreteInterfaceMethodSnippet"));
 
         assertNotInlined(getGraph("invokeOverriddenPublicMethodSnippet"));
         assertNotInlined(getGraph("invokeOverriddenProtectedMethodSnippet"));
@@ -100,32 +94,34 @@
 
     @SuppressWarnings("all")
     public static int invokeLeafClassMethodSnippet(SubClassA subClassA) {
-        return subClassA.publicFinalMethod() +
-               subClassA.publicNotOverriddenMethod() +
-               subClassA.publicOverriddenMethod();
+        return subClassA.publicFinalMethod() + subClassA.publicNotOverriddenMethod() + subClassA.publicOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeConcreteMethodSnippet(SuperClass superClass) {
-        return superClass.publicNotOverriddenMethod() +
-               superClass.protectedNotOverriddenMethod();
+        return superClass.publicNotOverriddenMethod() + superClass.protectedNotOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeSingleImplementorInterfaceSnippet(SingleImplementorInterface testInterface) {
-        return testInterface.publicNotOverriddenMethod() +
-               testInterface.publicOverriddenMethod();
+        return testInterface.publicNotOverriddenMethod() + testInterface.publicOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeConcreteInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) {
         return testInterface.publicNotOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeOverriddenInterfaceMethodSnippet(MultipleImplementorsInterface testInterface) {
         return testInterface.publicOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeOverriddenPublicMethodSnippet(SuperClass superClass) {
         return superClass.publicOverriddenMethod();
     }
+
     @SuppressWarnings("all")
     public static int invokeOverriddenProtectedMethodSnippet(SuperClass superClass) {
         return superClass.protectedOverriddenMethod();
@@ -133,6 +129,7 @@
 
     private StructuredGraph getGraph(final String snippet) {
         return Debug.scope("InliningTest", new DebugDumpScope(snippet), new Callable<StructuredGraph>() {
+
             @Override
             public StructuredGraph call() {
                 StructuredGraph graph = parse(snippet);
@@ -158,7 +155,7 @@
     }
 
     private static StructuredGraph assertNotInGraph(StructuredGraph graph, Class<?> clazz) {
-        for (Node node: graph.getNodes()) {
+        for (Node node : graph.getNodes()) {
             if (clazz.isInstance(node)) {
                 fail(node.toString());
             }
@@ -167,7 +164,7 @@
     }
 
     private static StructuredGraph assertInGraph(StructuredGraph graph, Class<?> clazz) {
-        for (Node node: graph.getNodes()) {
+        for (Node node : graph.getNodes()) {
             if (clazz.isInstance(node)) {
                 return graph;
             }
@@ -176,19 +173,23 @@
         return graph;
     }
 
-
     // some interfaces and classes for testing
     private interface MultipleImplementorsInterface {
+
         int publicNotOverriddenMethod();
+
         int publicOverriddenMethod();
     }
 
     private interface SingleImplementorInterface {
+
         int publicNotOverriddenMethod();
+
         int publicOverriddenMethod();
     }
 
     private static class SuperClass implements MultipleImplementorsInterface {
+
         protected int value;
 
         public SuperClass(int value) {
@@ -221,6 +222,7 @@
     }
 
     private static class SubClassA extends SuperClass implements SingleImplementorInterface {
+
         public SubClassA(int value) {
             super(value);
         }
@@ -237,6 +239,7 @@
     }
 
     private static class SubClassB extends SuperClass {
+
         public SubClassB(int value) {
             super(value);
         }
@@ -253,6 +256,7 @@
     }
 
     private static class SubClassC extends SuperClass {
+
         public SubClassC(int value) {
             super(value);
         }
@@ -269,6 +273,7 @@
     }
 
     private static final class FinalSubClass extends SuperClass {
+
         public FinalSubClass(int value) {
             super(value);
         }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/DebugFilter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,33 +30,56 @@
 import com.oracle.graal.phases.*;
 
 /**
- * Implements the filter specified by the {@link GraalOptions#Dump},
- * {@link GraalOptions#Log}, {@link GraalOptions#Meter} and {@link GraalOptions#Time}
- * options.
+ * Implements the filter specified by the {@link GraalOptions#Dump}, {@link GraalOptions#Log},
+ * {@link GraalOptions#Meter} and {@link GraalOptions#Time} options.
  * <p>
- * These options enable the associated debug facility if their filter
- * matches the {@linkplain DebugScope#getQualifiedName() name} of the
- * {@linkplain Debug#currentScope() current scope}.
+ * These options enable the associated debug facility if their filter matches the
+ * {@linkplain DebugScope#getQualifiedName() name} of the {@linkplain Debug#currentScope() current
+ * scope}.
  * <p>
- * A filter is a list of comma-separated terms. Each term is interpreted
- * as a glob pattern if it contains a "*" or "?" character. Otherwise, it is
- * interpreted as a substring. If a term starts with "~", then it is an
- * positive term. An input is matched by a filter if any of its positive
- * terms match the input (or it has no positive terms) AND none of its
- * negative terms match the input (or it has no negative terms).
+ * A filter is a list of comma-separated terms. Each term is interpreted as a glob pattern if it
+ * contains a "*" or "?" character. Otherwise, it is interpreted as a substring. If a term starts
+ * with "~", then it is an positive term. An input is matched by a filter if any of its positive
+ * terms match the input (or it has no positive terms) AND none of its negative terms match the
+ * input (or it has no negative terms).
  * <p>
  * Examples of filters include:
  * <p>
  * <ul>
- * <li><pre>""</pre>
+ * <li>
+ * 
+ * <pre>
+ * &quot;&quot;
+ * </pre>
+ * 
  * Matches any scope.</li>
- * <li><pre>"*"</pre>
+ * <li>
+ * 
+ * <pre>
+ * &quot;*&quot;
+ * </pre>
+ * 
  * Matches any scope.</li>
- * <li><pre>"CodeGen,CodeInstall"</pre>
+ * <li>
+ * 
+ * <pre>
+ * &quot;CodeGen,CodeInstall&quot;
+ * </pre>
+ * 
  * Matches a scope whose name contains "CodeGen" or "CodeInstall".</li>
- * <li><pre>"Code*"</pre>
+ * <li>
+ * 
+ * <pre>
+ * &quot;Code*&quot;
+ * </pre>
+ * 
  * Matches a scope whose name starts with "Code".</li>
- * <li><pre>"Code,~Dead"</pre>
+ * <li>
+ * 
+ * <pre>
+ * &quot;Code,&tilde;Dead&quot;
+ * </pre>
+ * 
  * Matches a scope whose name contains "Code" but does not contain "Dead".</li>
  * </ul>
  */
@@ -109,9 +132,9 @@
                 }
             }
         }
-//        if (match) {
-//            System.out.println(this + " matches " + input);
-//        }
+        // if (match) {
+        // System.out.println(this + " matches " + input);
+        // }
         return match;
     }
 
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -68,8 +68,7 @@
         this.backend = backend;
     }
 
-    public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, final GraphCache cache, final PhasePlan plan,
-                    final OptimisticOptimizations optimisticOpts) {
+    public CompilationResult compileMethod(final ResolvedJavaMethod method, final StructuredGraph graph, final GraphCache cache, final PhasePlan plan, final OptimisticOptimizations optimisticOpts) {
         assert (method.getModifiers() & Modifier.NATIVE) == 0 : "compiling native methods is not supported";
 
         return Debug.scope("GraalCompiler", new Object[]{graph, method, this}, new Callable<CompilationResult>() {
@@ -149,6 +148,9 @@
         if (GraalOptions.PartialEscapeAnalysis && !plan.isPhaseDisabled(PartialEscapeAnalysisPhase.class)) {
             new PartialEscapeAnalysisPhase(target, runtime, assumptions, true).apply(graph);
         }
+
+        new LockEliminationPhase().apply(graph);
+
         if (GraalOptions.OptLoopTransform) {
             new LoopTransformHighPhase().apply(graph);
             new LoopTransformLowPhase().apply(graph);
@@ -159,7 +161,7 @@
             new CanonicalizerPhase(target, runtime, assumptions).apply(graph);
         }
 
-        new LoweringPhase(runtime, assumptions).apply(graph);
+        new LoweringPhase(target, runtime, assumptions).apply(graph);
 
         if (GraalOptions.CullFrameStates) {
             new CullFrameStatesPhase().apply(graph);
@@ -207,7 +209,7 @@
         final Block[] blocks = schedule.getCFG().getBlocks();
         final Block startBlock = schedule.getCFG().getStartBlock();
         assert startBlock != null;
-        assert startBlock.numberOfPreds() == 0;
+        assert startBlock.getPredecessorCount() == 0;
 
         new ComputeProbabilityPhase().apply(graph);
 
@@ -215,14 +217,8 @@
 
             @Override
             public LIR call() {
-                ComputeBlockOrder clso = new ComputeBlockOrder(blocks.length, schedule.getCFG().getLoops().length, startBlock, GraalOptions.OptReorderLoops);
-                List<Block> linearScanOrder = clso.linearScanOrder();
-                List<Block> codeEmittingOrder = clso.codeEmittingOrder();
-
-                int z = 0;
-                for (Block b : linearScanOrder) {
-                    b.linearScanNumber = z++;
-                }
+                List<Block> codeEmittingOrder = ComputeBlockOrder.computeCodeEmittingOrder(blocks.length, startBlock);
+                List<Block> linearScanOrder = ComputeBlockOrder.computeLinearScanOrder(blocks.length, startBlock);
 
                 LIR lir = new LIR(schedule.getCFG(), schedule.getBlockToNodesMap(), linearScanOrder, codeEmittingOrder);
                 Debug.dump(lir, "After linear scan order");
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Fri Feb 01 17:06:26 2013 +0100
@@ -60,7 +60,7 @@
 
         // Report the filters that have been configured so the user can verify it's what they expect
         if (logFilter != null || meterFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
-            TTY.println(Thread.currentThread().getName() + ": " + toString());
+            // TTY.println(Thread.currentThread().getName() + ": " + toString());
         }
         this.dumpHandlers = dumpHandlers;
         this.output = output;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/MethodFilter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,31 +28,58 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * This class implements a method filter that can filter based on class name, method name and parameters.
- * The syntax for the source pattern that is passed to the constructor is as follows:
- *
+ * This class implements a method filter that can filter based on class name, method name and
+ * parameters. The syntax for the source pattern that is passed to the constructor is as follows:
+ * 
  * <pre>
  * SourcePattern = [ Class "." ] method [ "(" [ Parameter { ";" Parameter } ] ")" ] .
  * Parameter = Class | "int" | "long" | "float" | "double" | "short" | "char" | "boolean" .
  * Class = { package "." } class .
  * </pre>
- *
- *
- * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid filters are:
- *
+ * 
+ * 
+ * Glob pattern matching (*, ?) is allowed in all parts of the source pattern. Examples for valid
+ * filters are:
+ * 
  * <ul>
- * <li><pre>visit(Argument;BlockScope)</pre>
- * Matches all methods named "visit", with the first parameter of type "Argument", and the second parameter of type "BlockScope".
- * The packages of the parameter types are irrelevant.</li>
- * <li><pre>arraycopy(Object;;;;)</pre>
- * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more parameters of any type.
- * The packages of the parameter types are irrelevant.</li>
- * <li><pre>com.oracle.graal.compiler.graph.PostOrderNodeIterator.*</pre>
+ * <li>
+ * 
+ * <pre>
+ * visit(Argument;BlockScope)
+ * </pre>
+ * 
+ * Matches all methods named "visit", with the first parameter of type "Argument", and the second
+ * parameter of type "BlockScope". The packages of the parameter types are irrelevant.</li>
+ * <li>
+ * 
+ * <pre>
+ * arraycopy(Object;;;;)
+ * </pre>
+ * 
+ * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more
+ * parameters of any type. The packages of the parameter types are irrelevant.</li>
+ * <li>
+ * 
+ * <pre>
+ * com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
+ * </pre>
+ * 
  * Matches all methods in the class "com.oracle.graal.compiler.graph.PostOrderNodeIterator".</li>
- * <li><pre>*</pre>
+ * <li>
+ * 
+ * <pre>
+ * *
+ * </pre>
+ * 
  * Matches all methods in all classes</li>
- * <li><pre>com.oracle.graal.compiler.graph.*.visit</pre>
- * Matches all methods named "visit" in classes in the package "com.oracle.graal.compiler.graph".</pre>
+ * <li>
+ * 
+ * <pre>
+ * com.oracle.graal.compiler.graph.*.visit
+ * </pre>
+ * 
+ * Matches all methods named "visit" in classes in the package
+ * "com.oracle.graal.compiler.graph".</pre>
  * </ul>
  */
 public class MethodFilter {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Interval.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-
 import java.util.*;
 
 import com.oracle.graal.api.code.*;
@@ -45,8 +44,10 @@
      * A pair of intervals.
      */
     static final class Pair {
+
         public final Interval first;
         public final Interval second;
+
         public Pair(Interval first, Interval second) {
             this.first = first;
             this.second = second;
@@ -75,7 +76,7 @@
 
         /**
          * Gets the list for a specified binding.
-         *
+         * 
          * @param binding specifies the list to be returned
          * @return the list of intervals whose binding is {@code binding}
          */
@@ -89,7 +90,7 @@
 
         /**
          * Sets the list for a specified binding.
-         *
+         * 
          * @param binding specifies the list to be replaced
          * @param list a list of intervals whose binding is {@code binding}
          */
@@ -104,8 +105,9 @@
         }
 
         /**
-         * Adds an interval to a list sorted by {@linkplain Interval#currentFrom() current from} positions.
-         *
+         * Adds an interval to a list sorted by {@linkplain Interval#currentFrom() current from}
+         * positions.
+         * 
          * @param binding specifies the list to be updated
          * @param interval the interval to add
          */
@@ -132,7 +134,7 @@
         /**
          * Adds an interval to a list sorted by {@linkplain Interval#from() start} positions and
          * {@linkplain Interval#firstUsage(RegisterPriority) first usage} positions.
-         *
+         * 
          * @param binding specifies the list to be updated
          * @param interval the interval to add
          */
@@ -155,7 +157,7 @@
 
         /**
          * Removes an interval from a list.
-         *
+         * 
          * @param binding specifies the list to be updated
          * @param i the interval to remove
          */
@@ -177,10 +179,9 @@
     }
 
     /**
-     * Constants denoting the register usage priority for an interval.
-     * The constants are declared in increasing order of priority are
-     * are used to optimize spilling when multiple overlapping intervals
-     * compete for limited registers.
+     * Constants denoting the register usage priority for an interval. The constants are declared in
+     * increasing order of priority are are used to optimize spilling when multiple overlapping
+     * intervals compete for limited registers.
      */
     enum RegisterPriority {
         /**
@@ -221,8 +222,8 @@
     }
 
     /**
-     * Constants denoting whether an interval is bound to a specific register. This models
-     * platform dependencies on register usage for certain instructions.
+     * Constants denoting whether an interval is bound to a specific register. This models platform
+     * dependencies on register usage for certain instructions.
      */
     enum RegisterBinding {
         /**
@@ -249,7 +250,8 @@
         Unhandled,
 
         /**
-         * An interval that {@linkplain Interval#covers covers} {@code position} and has an assigned register.
+         * An interval that {@linkplain Interval#covers covers} {@code position} and has an assigned
+         * register.
          */
         Active,
 
@@ -276,8 +278,8 @@
 
         /**
          * One definition has already been found. Two consecutive definitions are treated as one
-         * (e.g. a consecutive move and add because of two-operand LIR form).
-         * The position of this definition is given by {@link Interval#spillDefinitionPos()}.
+         * (e.g. a consecutive move and add because of two-operand LIR form). The position of this
+         * definition is given by {@link Interval#spillDefinitionPos()}.
          */
         NoSpillStore,
 
@@ -287,8 +289,8 @@
         OneSpillStore,
 
         /**
-         * The interval should be stored immediately after its definition to prevent
-         * multiple redundant stores.
+         * The interval should be stored immediately after its definition to prevent multiple
+         * redundant stores.
          */
         StoreAtDefinition,
 
@@ -298,24 +300,25 @@
         StartInMemory,
 
         /**
-         * The interval has more than one definition (e.g. resulting from phi moves), so stores
-         * to memory are not optimized.
+         * The interval has more than one definition (e.g. resulting from phi moves), so stores to
+         * memory are not optimized.
          */
         NoOptimization
     }
 
     /**
-     * List of use positions. Each entry in the list records the use position and register
-     * priority associated with the use position. The entries in the list are in descending
-     * order of use position.
-     *
+     * List of use positions. Each entry in the list records the use position and register priority
+     * associated with the use position. The entries in the list are in descending order of use
+     * position.
+     * 
      */
     public static final class UsePosList {
+
         private IntList list;
 
         /**
          * Creates a use list.
-         *
+         * 
          * @param initialCapacity the initial capacity of the list in terms of entries
          */
         public UsePosList(int initialCapacity) {
@@ -327,12 +330,13 @@
         }
 
         /**
-         * Splits this list around a given position. All entries in this list with a use position greater or equal than
-         * {@code splitPos} are removed from this list and added to the returned list.
-         *
+         * Splits this list around a given position. All entries in this list with a use position
+         * greater or equal than {@code splitPos} are removed from this list and added to the
+         * returned list.
+         * 
          * @param splitPos the position for the split
-         * @return a use position list containing all entries removed from this list that have a use position greater or equal
-         *         than {@code splitPos}
+         * @return a use position list containing all entries removed from this list that have a use
+         *         position greater or equal than {@code splitPos}
          */
         public UsePosList splitAt(int splitPos) {
             int i = size() - 1;
@@ -351,7 +355,7 @@
 
         /**
          * Gets the use position at a specified index in this list.
-         *
+         * 
          * @param index the index of the entry for which the use position is returned
          * @return the use position of entry {@code index} in this list
          */
@@ -361,7 +365,7 @@
 
         /**
          * Gets the register priority for the use position at a specified index in this list.
-         *
+         * 
          * @param index the index of the entry for which the register priority is returned
          * @return the register priority of entry {@code index} in this list
          */
@@ -402,7 +406,8 @@
     }
 
     /**
-     * The {@linkplain RegisterValue register} or {@linkplain Variable variable} for this interval prior to register allocation.
+     * The {@linkplain RegisterValue register} or {@linkplain Variable variable} for this interval
+     * prior to register allocation.
      */
     public final Value operand;
 
@@ -412,7 +417,8 @@
     public final int operandNumber;
 
     /**
-     * The {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or {@linkplain Address address} assigned to this interval.
+     * The {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or
+     * {@linkplain Address address} assigned to this interval.
      */
     private Value location;
 
@@ -427,7 +433,8 @@
     private Kind kind;
 
     /**
-     * The head of the list of ranges describing this interval. This list is sorted by {@linkplain LIRInstruction#id instruction ids}.
+     * The head of the list of ranges describing this interval. This list is sorted by
+     * {@linkplain LIRInstruction#id instruction ids}.
      */
     private Range first;
 
@@ -454,12 +461,14 @@
     private int cachedTo; // cached value: to of last range (-1: not cached)
 
     /**
-     * The interval from which this one is derived. If this is a {@linkplain #isSplitParent() split parent}, it points to itself.
+     * The interval from which this one is derived. If this is a {@linkplain #isSplitParent() split
+     * parent}, it points to itself.
      */
     private Interval splitParent;
 
     /**
-     * List of all intervals that are split off from this interval. This is only used if this is a {@linkplain #isSplitParent() split parent}.
+     * List of all intervals that are split off from this interval. This is only used if this is a
+     * {@linkplain #isSplitParent() split parent}.
      */
     private List<Interval> splitChildren = Collections.emptyList();
 
@@ -469,7 +478,8 @@
     private Interval currentSplitChild;
 
     /**
-     * Specifies if move is inserted between currentSplitChild and this interval when interval gets active the first time.
+     * Specifies if move is inserted between currentSplitChild and this interval when interval gets
+     * active the first time.
      */
     private boolean insertMoveWhenActivated;
 
@@ -505,7 +515,8 @@
     }
 
     /**
-     * Gets the {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or {@linkplain Address address} assigned to this interval.
+     * Gets the {@linkplain RegisterValue register}, {@linkplain StackSlot spill slot} or
+     * {@linkplain Address address} assigned to this interval.
      */
     public Value location() {
         return location;
@@ -702,7 +713,7 @@
                 Interval i1 = splitChildren.get(i);
 
                 assert i1.splitParent() == this : "not a split child of this interval";
-                assert i1.kind()  == kind() : "must be equal for all split children";
+                assert i1.kind() == kind() : "must be equal for all split children";
                 assert i1.spillSlot() == spillSlot() : "must be equal for all split children";
 
                 for (int j = i + 1; j < splitChildren.size(); j++) {
@@ -768,7 +779,8 @@
                 Interval cur = splitChildren.get(i);
                 if (cur.from() <= opId && opId < cur.to() + toOffset) {
                     if (i > 0) {
-                        // exchange current split child to start of list (faster access for next call)
+                        // exchange current split child to start of list (faster access for next
+                        // call)
                         Util.atPutGrow(splitChildren, i, splitChildren.get(0), null);
                         Util.atPutGrow(splitChildren, 0, cur, null);
                     }
@@ -971,15 +983,15 @@
     }
 
     /**
-     * Splits this interval at a specified position and returns the remainder as a new <i>child</i> interval
-     * of this interval's {@linkplain #splitParent() parent} interval.
+     * Splits this interval at a specified position and returns the remainder as a new <i>child</i>
+     * interval of this interval's {@linkplain #splitParent() parent} interval.
      * <p>
-     * When an interval is split, a bi-directional link is established between the original <i>parent</i>
-     * interval and the <i>children</i> intervals that are split off this interval.
-     * When a split child is split again, the new created interval is a direct child
-     * of the original parent. That is, there is no tree of split children stored, just a flat list.
-     * All split children are spilled to the same {@linkplain #spillSlot spill slot}.
-     *
+     * When an interval is split, a bi-directional link is established between the original
+     * <i>parent</i> interval and the <i>children</i> intervals that are split off this interval.
+     * When a split child is split again, the new created interval is a direct child of the original
+     * parent. That is, there is no tree of split children stored, just a flat list. All split
+     * children are spilled to the same {@linkplain #spillSlot spill slot}.
+     * 
      * @param splitPos the position at which to split this interval
      * @param allocator the register allocator context
      * @return the child interval split off from this interval
@@ -1027,10 +1039,11 @@
     }
 
     /**
-     * Splits this interval at a specified position and returns
-     * the head as a new interval (this interval is the tail).
-     *
-     * Currently, only the first range can be split, and the new interval must not have split positions
+     * Splits this interval at a specified position and returns the head as a new interval (this
+     * interval is the tail).
+     * 
+     * Currently, only the first range can be split, and the new interval must not have split
+     * positions
      */
     Interval splitFromStart(int splitPos, LinearScan allocator) {
         assert isVariable(operand) : "cannot split fixed intervals";
@@ -1128,7 +1141,7 @@
 
     /**
      * Gets a single line string for logging the details of this interval to a log stream.
-     *
+     * 
      * @param allocator the register allocator context
      */
     public String logString(LinearScan allocator) {
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/IntervalWalker.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/IntervalWalker.java	Fri Feb 01 17:06:26 2013 +0100
@@ -66,9 +66,11 @@
 
     /**
      * Processes the {@linkplain #currentInterval} interval in an attempt to allocate a physical
-     * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active} intervals.
-     *
-     * @return {@code true} if a register was allocated to the {@linkplain #currentInterval} interval
+     * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active}
+     * intervals.
+     * 
+     * @return {@code true} if a register was allocated to the {@linkplain #currentInterval}
+     *         interval
      */
     boolean activateCurrent() {
         return true;
@@ -84,10 +86,12 @@
 
     /**
      * Creates a new interval walker.
-     *
+     * 
      * @param allocator the register allocator context
-     * @param unhandledFixed the list of unhandled {@linkplain RegisterBinding#Fixed fixed} intervals
-     * @param unhandledAny the list of unhandled {@linkplain RegisterBinding#Any non-fixed} intervals
+     * @param unhandledFixed the list of unhandled {@linkplain RegisterBinding#Fixed fixed}
+     *            intervals
+     * @param unhandledAny the list of unhandled {@linkplain RegisterBinding#Any non-fixed}
+     *            intervals
      */
     IntervalWalker(LinearScan allocator, Interval unhandledFixed, Interval unhandledAny) {
         this.allocator = allocator;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java	Fri Feb 01 17:06:26 2013 +0100
@@ -48,9 +48,10 @@
 import com.oracle.graal.phases.util.*;
 
 /**
- * An implementation of the linear scan register allocator algorithm described
- * in <a href="http://doi.acm.org/10.1145/1064979.1064998">"Optimized Interval Splitting in a Linear Scan Register Allocator"</a>
- * by Christian Wimmer and Hanspeter Moessenboeck.
+ * An implementation of the linear scan register allocator algorithm described in <a
+ * href="http://doi.acm.org/10.1145/1064979.1064998"
+ * >"Optimized Interval Splitting in a Linear Scan Register Allocator"</a> by Christian Wimmer and
+ * Hanspeter Moessenboeck.
  */
 public final class LinearScan {
 
@@ -65,32 +66,33 @@
     private static final int INITIAL_SPLIT_INTERVALS_CAPACITY = 32;
 
     public static class BlockData {
+
         /**
-         * Bit map specifying which operands are live upon entry to this block.
-         * These are values used in this block or any of its successors where such value are not defined
-         * in this block.
-         * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}.
+         * Bit map specifying which operands are live upon entry to this block. These are values
+         * used in this block or any of its successors where such value are not defined in this
+         * block. The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value)
+         * operand number}.
          */
         public BitSet liveIn;
 
         /**
-         * Bit map specifying which operands are live upon exit from this block.
-         * These are values used in a successor block that are either defined in this block or were live
-         * upon entry to this block.
-         * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}.
+         * Bit map specifying which operands are live upon exit from this block. These are values
+         * used in a successor block that are either defined in this block or were live upon entry
+         * to this block. The bit index of an operand is its
+         * {@linkplain LinearScan#operandNumber(Value) operand number}.
          */
         public BitSet liveOut;
 
         /**
-         * Bit map specifying which operands are used (before being defined) in this block.
-         * That is, these are the values that are live upon entry to the block.
-         * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}.
+         * Bit map specifying which operands are used (before being defined) in this block. That is,
+         * these are the values that are live upon entry to the block. The bit index of an operand
+         * is its {@linkplain LinearScan#operandNumber(Value) operand number}.
          */
         public BitSet liveGen;
 
         /**
-         * Bit map specifying which operands are defined/overwritten in this block.
-         * The bit index of an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}.
+         * Bit map specifying which operands are defined/overwritten in this block. The bit index of
+         * an operand is its {@linkplain LinearScan#operandNumber(Value) operand number}.
          */
         public BitSet liveKill;
     }
@@ -100,7 +102,7 @@
     /**
      * List of blocks in linear-scan order. This is only correct as long as the CFG does not change.
      */
-    final Block[] sortedBlocks;
+    final List<Block> sortedBlocks;
 
     /**
      * Map from {@linkplain #operandNumber(Value) operand numbers} to intervals.
@@ -113,7 +115,8 @@
     int intervalsSize;
 
     /**
-     * The index of the first entry in {@link #intervals} for a {@linkplain #createDerivedInterval(Interval) derived interval}.
+     * The index of the first entry in {@link #intervals} for a
+     * {@linkplain #createDerivedInterval(Interval) derived interval}.
      */
     int firstDerivedIntervalIndex = -1;
 
@@ -123,16 +126,16 @@
     Interval[] sortedIntervals;
 
     /**
-     * Map from an instruction {@linkplain LIRInstruction#id id} to the instruction.
-     * Entries should be retrieved with {@link #instructionForId(int)} as the id is
-     * not simply an index into this array.
+     * Map from an instruction {@linkplain LIRInstruction#id id} to the instruction. Entries should
+     * be retrieved with {@link #instructionForId(int)} as the id is not simply an index into this
+     * array.
      */
     LIRInstruction[] opIdToInstructionMap;
 
     /**
-     * Map from an instruction {@linkplain LIRInstruction#id id} to the {@linkplain
-     * Block block} containing the instruction. Entries should be retrieved with
-     * {@link #blockForId(int)} as the id is not simply an index into this array.
+     * Map from an instruction {@linkplain LIRInstruction#id id} to the {@linkplain Block block}
+     * containing the instruction. Entries should be retrieved with {@link #blockForId(int)} as the
+     * id is not simply an index into this array.
      */
     Block[] opIdToBlockMap;
 
@@ -153,14 +156,13 @@
      */
     private final int firstVariableNumber;
 
-
     public LinearScan(TargetDescription target, ResolvedJavaMethod method, LIR ir, LIRGenerator gen, FrameMap frameMap) {
         this.target = target;
         this.method = method;
         this.ir = ir;
         this.gen = gen;
         this.frameMap = frameMap;
-        this.sortedBlocks = ir.linearScanOrder().toArray(new Block[ir.linearScanOrder().size()]);
+        this.sortedBlocks = ir.linearScanOrder();
         this.registerAttributes = frameMap.registerConfig.getAttributesMap();
 
         this.registers = target.arch.getRegisters();
@@ -186,11 +188,10 @@
         return isVariable(value) || isRegister(value);
     }
 
-
     /**
-     * Converts an operand (variable or register) to an index in a flat address space covering all the
-     * {@linkplain Variable variables} and {@linkplain RegisterValue registers} being processed by this
-     * allocator.
+     * Converts an operand (variable or register) to an index in a flat address space covering all
+     * the {@linkplain Variable variables} and {@linkplain RegisterValue registers} being processed
+     * by this allocator.
      */
     private int operandNumber(Value operand) {
         if (isRegister(operand)) {
@@ -230,8 +231,8 @@
         return firstVariableNumber - 1;
     }
 
+    static final IntervalPredicate IS_PRECOLORED_INTERVAL = new IntervalPredicate() {
 
-    static final IntervalPredicate IS_PRECOLORED_INTERVAL = new IntervalPredicate() {
         @Override
         public boolean apply(Interval i) {
             return isRegister(i.operand);
@@ -239,6 +240,7 @@
     };
 
     static final IntervalPredicate IS_VARIABLE_INTERVAL = new IntervalPredicate() {
+
         @Override
         public boolean apply(Interval i) {
             return isVariable(i.operand);
@@ -246,14 +248,16 @@
     };
 
     static final IntervalPredicate IS_OOP_INTERVAL = new IntervalPredicate() {
+
         @Override
         public boolean apply(Interval i) {
-            return !isRegister(i.operand) && i.kind()  == Kind.Object;
+            return !isRegister(i.operand) && i.kind() == Kind.Object;
         }
     };
 
     /**
-     * Gets an object describing the attributes of a given register according to this register configuration.
+     * Gets an object describing the attributes of a given register according to this register
+     * configuration.
      */
     RegisterAttributes attributes(Register reg) {
         return registerAttributes[reg.number];
@@ -273,7 +277,7 @@
 
     /**
      * Creates a new interval.
-     *
+     * 
      * @param operand the operand for the interval
      * @return the created interval
      */
@@ -290,7 +294,7 @@
 
     /**
      * Creates an interval as a result of splitting or spilling another interval.
-     *
+     * 
      * @param source an interval being split of spilled
      * @return a new interval derived from {@code source}
      */
@@ -313,19 +317,17 @@
 
     // access to block list (sorted in linear scan order)
     int blockCount() {
-        assert sortedBlocks.length == ir.linearScanOrder().size() : "invalid cached block list";
-        return sortedBlocks.length;
+        return sortedBlocks.size();
     }
 
     Block blockAt(int index) {
-        assert sortedBlocks[index] == ir.linearScanOrder().get(index) : "invalid cached block list";
-        return sortedBlocks[index];
+        return sortedBlocks.get(index);
     }
 
     /**
-     * Gets the size of the {@link BlockData#liveIn} and {@link BlockData#liveOut} sets for a basic block. These sets do
-     * not include any operands allocated as a result of creating {@linkplain #createDerivedInterval(Interval) derived
-     * intervals}.
+     * Gets the size of the {@link BlockData#liveIn} and {@link BlockData#liveOut} sets for a basic
+     * block. These sets do not include any operands allocated as a result of creating
+     * {@linkplain #createDerivedInterval(Interval) derived intervals}.
      */
     int liveSetSize() {
         return firstDerivedIntervalIndex == -1 ? operandSize() : firstDerivedIntervalIndex;
@@ -354,8 +356,8 @@
     }
 
     /**
-     * Converts an {@linkplain LIRInstruction#id instruction id} to an instruction index.
-     * All LIR instructions in a method have an index one greater than their linear-scan order predecesor
+     * Converts an {@linkplain LIRInstruction#id instruction id} to an instruction index. All LIR
+     * instructions in a method have an index one greater than their linear-scan order predecesor
      * with the first instruction having an index of 0.
      */
     static int opIdToIndex(int opId) {
@@ -364,7 +366,7 @@
 
     /**
      * Retrieves the {@link LIRInstruction} based on its {@linkplain LIRInstruction#id id}.
-     *
+     * 
      * @param opId an instruction {@linkplain LIRInstruction#id id}
      * @return the instruction whose {@linkplain LIRInstruction#id} {@code == id}
      */
@@ -377,7 +379,7 @@
 
     /**
      * Gets the block containing a given instruction.
-     *
+     * 
      * @param opId an instruction {@linkplain LIRInstruction#id id}
      * @return the block containing the instruction denoted by {@code opId}
      */
@@ -396,9 +398,10 @@
 
     /**
      * Determines if an {@link LIRInstruction} destroys all caller saved registers.
-     *
+     * 
      * @param opId an instruction {@linkplain LIRInstruction#id id}
-     * @return {@code true} if the instruction denoted by {@code id} destroys all caller saved registers.
+     * @return {@code true} if the instruction denoted by {@code id} destroys all caller saved
+     *         registers.
      */
     boolean hasCall(int opId) {
         assert isEven(opId) : "opId not even";
@@ -478,10 +481,12 @@
     }
 
     abstract static class IntervalPredicate {
+
         abstract boolean apply(Interval i);
     }
 
     private static final IntervalPredicate mustStoreAtDefinition = new IntervalPredicate() {
+
         @Override
         public boolean apply(Interval i) {
             return i.isSplitParent() && i.spillState() == SpillState.StoreAtDefinition;
@@ -503,9 +508,7 @@
         }
 
         LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer();
-        int numBlocks = blockCount();
-        for (int i = 0; i < numBlocks; i++) {
-            Block block = blockAt(i);
+        for (Block block : sortedBlocks) {
             List<LIRInstruction> instructions = ir.lir(block);
             int numInst = instructions.size();
 
@@ -516,14 +519,16 @@
 
                 if (opId == -1) {
                     MoveOp move = (MoveOp) op;
-                    // remove move from register to stack if the stack slot is guaranteed to be correct.
+                    // remove move from register to stack if the stack slot is guaranteed to be
+                    // correct.
                     // only moves that have been inserted by LinearScan can be removed.
                     assert isVariable(move.getResult()) : "LinearScan inserts only moves to variables";
 
                     Interval curInterval = intervalFor(move.getResult());
 
                     if (!isRegister(curInterval.location()) && curInterval.alwaysInMemory()) {
-                        // move target is a stack slot that is always correct, so eliminate instruction
+                        // move target is a stack slot that is always correct, so eliminate
+                        // instruction
                         if (GraalOptions.TraceLinearScanLevel >= 4) {
                             TTY.println("eliminating move from interval %d to %d", operandNumber(move.getInput()), operandNumber(move.getResult()));
                         }
@@ -537,7 +542,8 @@
 
                     while (interval != Interval.EndMarker && interval.spillDefinitionPos() == opId) {
                         if (!insertionBuffer.initialized()) {
-                            // prepare insertion buffer (appended when all instructions of the block are processed)
+                            // prepare insertion buffer (appended when all instructions of the block
+                            // are processed)
                             insertionBuffer.init(instructions);
                         }
 
@@ -551,8 +557,7 @@
 
                         if (GraalOptions.TraceLinearScanLevel >= 4) {
                             StackSlot slot = interval.spillSlot();
-                            TTY.println("inserting move after definition of interval %d to stack slot %s at opId %d",
-                                            interval.operandNumber, slot, opId);
+                            TTY.println("inserting move after definition of interval %d to stack slot %s at opId %d", interval.operandNumber, slot, opId);
                         }
 
                         interval = interval.next;
@@ -592,10 +597,12 @@
     }
 
     /**
-     * Numbers all instructions in all blocks. The numbering follows the {@linkplain ComputeBlockOrder linear scan order}.
+     * Numbers all instructions in all blocks. The numbering follows the
+     * {@linkplain ComputeBlockOrder linear scan order}.
      */
     void numberInstructions() {
         ValueProcedure setVariableProc = new ValueProcedure() {
+
             @Override
             public Value doValue(Value value) {
                 if (isVariable(value)) {
@@ -610,10 +617,9 @@
         };
 
         // Assign IDs to LIR nodes and build a mapping, lirOps, from ID to LIRInstruction node.
-        int numBlocks = blockCount();
         int numInstructions = 0;
-        for (int i = 0; i < numBlocks; i++) {
-            numInstructions += ir.lir(blockAt(i)).size();
+        for (Block block : sortedBlocks) {
+            numInstructions += ir.lir(block).size();
         }
 
         // initialize with correct length
@@ -622,9 +628,7 @@
 
         int opId = 0;
         int index = 0;
-
-        for (int i = 0; i < numBlocks; i++) {
-            Block block = blockAt(i);
+        for (Block block : sortedBlocks) {
             blockData.put(block, new BlockData());
 
             List<LIRInstruction> instructions = ir.lir(block);
@@ -657,17 +661,16 @@
     }
 
     /**
-     * Computes local live sets (i.e. {@link BlockData#liveGen} and {@link BlockData#liveKill}) separately for each block.
+     * Computes local live sets (i.e. {@link BlockData#liveGen} and {@link BlockData#liveKill})
+     * separately for each block.
      */
     void computeLocalLiveSets() {
-        int numBlocks = blockCount();
         int liveSize = liveSetSize();
 
         intervalInLoop = new BitMap2D(operandSize(), numLoops());
 
         // iterate all blocks
-        for (int i = 0; i < numBlocks; i++) {
-            final Block block = blockAt(i);
+        for (final Block block : sortedBlocks) {
             final BitSet liveGen = new BitSet(liveSize);
             final BitSet liveKill = new BitSet(liveSize);
 
@@ -680,6 +683,7 @@
                 final LIRInstruction op = instructions.get(j);
 
                 ValueProcedure useProc = new ValueProcedure() {
+
                     @Override
                     protected Value doValue(Value operand) {
                         if (isVariable(operand)) {
@@ -702,6 +706,7 @@
                     }
                 };
                 ValueProcedure stateProc = new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand) {
                         int operandNum = operandNumber(operand);
@@ -715,6 +720,7 @@
                     }
                 };
                 ValueProcedure defProc = new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand) {
                         if (isVariable(operand)) {
@@ -737,7 +743,8 @@
 
                 op.forEachInput(useProc);
                 op.forEachAlive(useProc);
-                // Add uses of live locals from interpreter's point of view for proper debug information generation
+                // Add uses of live locals from interpreter's point of view for proper debug
+                // information generation
                 op.forEachState(stateProc);
                 op.forEachTemp(defProc);
                 op.forEachOutput(defProc);
@@ -780,8 +787,8 @@
     }
 
     /**
-     * Performs a backward dataflow analysis to compute global live sets (i.e. {@link BlockData#liveIn} and
-     * {@link BlockData#liveOut}) for each block.
+     * Performs a backward dataflow analysis to compute global live sets (i.e.
+     * {@link BlockData#liveIn} and {@link BlockData#liveOut}) for each block.
      */
     void computeGlobalLiveSets() {
         int numBlocks = blockCount();
@@ -802,14 +809,13 @@
                 changeOccurredInBlock = false;
 
                 // liveOut(block) is the union of liveIn(sux), for successors sux of block
-                int n = block.numberOfSux();
+                int n = block.getSuccessorCount();
                 if (n > 0) {
                     // block has successors
                     if (n > 0) {
                         liveOut.clear();
-                        liveOut.or(blockData.get(block.suxAt(0)).liveIn);
-                        for (int j = 1; j < n; j++) {
-                            liveOut.or(blockData.get(block.suxAt(j)).liveIn);
+                        for (Block successor : block.getSuccessors()) {
+                            liveOut.or(blockData.get(successor).liveIn);
                         }
                     } else {
                         liveOut.clear();
@@ -827,8 +833,10 @@
                 }
 
                 if (iterationCount == 0 || changeOccurredInBlock) {
-                    // liveIn(block) is the union of liveGen(block) with (liveOut(block) & !liveKill(block))
-                    // note: liveIn has to be computed only in first iteration or if liveOut has changed!
+                    // liveIn(block) is the union of liveGen(block) with (liveOut(block) &
+                    // !liveKill(block))
+                    // note: liveIn has to be computed only in first iteration or if liveOut has
+                    // changed!
                     BitSet liveIn = blockData.get(block).liveIn;
                     liveIn.clear();
                     liveIn.or(blockData.get(block).liveOut);
@@ -848,7 +856,7 @@
         } while (changeOccurred);
 
         if (GraalOptions.DetailedAsserts) {
-            verifyLiveness(numBlocks);
+            verifyLiveness();
         }
 
         // check that the liveIn set of the first block is empty
@@ -859,7 +867,7 @@
                 reportFailure(numBlocks);
             }
 
-            TTY.println("preds=" + startBlock.getPredecessors().size() + ", succs=" + startBlock.getSuccessors().size());
+            TTY.println("preds=" + startBlock.getPredecessorCount() + ", succs=" + startBlock.getSuccessorCount());
             TTY.println("startBlock-ID: " + startBlock.getId());
 
             // bailout of if this occurs in product mode.
@@ -873,7 +881,6 @@
         TTY.print("affected registers:");
         TTY.println(blockData.get(ir.cfg.getStartBlock()).liveIn.toString());
 
-
         // print some additional information to simplify debugging
         for (int operandNum = 0; operandNum < blockData.get(ir.cfg.getStartBlock()).liveIn.size(); operandNum++) {
             if (blockData.get(ir.cfg.getStartBlock()).liveIn.get(operandNum)) {
@@ -882,14 +889,14 @@
 
                 Deque<Block> definedIn = new ArrayDeque<>();
                 HashSet<Block> usedIn = new HashSet<>();
-                for (int j = 0; j < numBlocks; j++) {
-                    Block block = blockAt(j);
+                for (Block block : sortedBlocks) {
                     if (blockData.get(block).liveGen.get(operandNum)) {
                         usedIn.add(block);
                         TTY.println("  used in block B%d", block.getId());
                         for (LIRInstruction ins : ir.lir(block)) {
                             TTY.println(ins.id() + ": " + ins.toString());
                             ins.forEachState(new ValueProcedure() {
+
                                 @Override
                                 public Value doValue(Value liveStateOperand) {
                                     TTY.println("   operand=" + liveStateOperand);
@@ -918,7 +925,7 @@
                                 definedIn.add(successor);
                             }
                         } else {
-                            if (++hitCount[successor.getId()] == successor.getPredecessors().size()) {
+                            if (++hitCount[successor.getId()] == successor.getPredecessorCount()) {
                                 definedIn.add(successor);
                             }
                         }
@@ -933,11 +940,10 @@
         }
     }
 
-    private void verifyLiveness(int numBlocks) {
+    private void verifyLiveness() {
         // check that fixed intervals are not live at block boundaries
         // (live set must be empty at fixed intervals)
-        for (int i = 0; i < numBlocks; i++) {
-            Block block = blockAt(i);
+        for (Block block : sortedBlocks) {
             for (int j = 0; j <= maxRegisterNumber(); j++) {
                 assert !blockData.get(block).liveIn.get(j) : "liveIn  set of fixed register must be empty";
                 assert !blockData.get(block).liveOut.get(j) : "liveOut set of fixed register must be empty";
@@ -1050,7 +1056,6 @@
         changeSpillDefinitionPos(interval, defPos);
         if (registerPriority == RegisterPriority.None && interval.spillState().ordinal() <= SpillState.StartInMemory.ordinal()) {
             // detection of method-parameters and roundfp-results
-            // TODO: move this directly to position where use-kind is computed
             interval.setSpillState(SpillState.StartInMemory);
         }
     }
@@ -1072,7 +1077,8 @@
     }
 
     /**
-     * Determines the priority which with an instruction's input operand will be allocated a register.
+     * Determines the priority which with an instruction's input operand will be allocated a
+     * register.
      */
     static RegisterPriority registerPriorityOfInputOperand(EnumSet<OperandFlag> flags) {
         if (flags.contains(OperandFlag.STACK)) {
@@ -1083,10 +1089,8 @@
     }
 
     /**
-     * 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.
+     * 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.
      */
     void handleMethodArguments(LIRInstruction op) {
         if (op instanceof MoveOp) {
@@ -1095,7 +1099,7 @@
                 StackSlot slot = (StackSlot) move.getInput();
                 if (GraalOptions.DetailedAsserts) {
                     assert op.id() > 0 : "invalid id";
-                    assert blockForId(op.id()).numberOfPreds() == 0 : "move from stack must be in first block";
+                    assert blockForId(op.id()).getPredecessorCount() == 0 : "move from stack must be in first block";
                     assert isVariable(move.getResult()) : "result of move must be a variable";
 
                     if (GraalOptions.TraceLinearScanLevel >= 4) {
@@ -1114,6 +1118,7 @@
         if (flags.contains(OperandFlag.HINT) && isVariableOrRegister(targetValue)) {
 
             op.forEachRegisterHint(targetValue, mode, new ValueProcedure() {
+
                 @Override
                 protected Value doValue(Value registerHint) {
                     if (isVariableOrRegister(registerHint)) {
@@ -1191,6 +1196,7 @@
                 }
 
                 op.forEachOutput(new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                         if (isVariableOrRegister(operand)) {
@@ -1201,6 +1207,7 @@
                     }
                 });
                 op.forEachTemp(new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                         if (isVariableOrRegister(operand)) {
@@ -1211,6 +1218,7 @@
                     }
                 });
                 op.forEachAlive(new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                         if (isVariableOrRegister(operand)) {
@@ -1222,6 +1230,7 @@
                     }
                 });
                 op.forEachInput(new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                         if (isVariableOrRegister(operand)) {
@@ -1238,6 +1247,7 @@
                 // Treat these operands as temp values (if the live range is extended
                 // to a call site, the value would be in a register at the call otherwise)
                 op.forEachState(new ValueProcedure() {
+
                     @Override
                     public Value doValue(Value operand) {
                         addUse(operand, blockFrom, opId + 1, RegisterPriority.None, operand.getKind().getStackKind());
@@ -1484,7 +1494,7 @@
     }
 
     void resolveFindInsertPos(Block fromBlock, Block toBlock, MoveResolver moveResolver) {
-        if (fromBlock.numberOfSux() <= 1) {
+        if (fromBlock.getSuccessorCount() <= 1) {
             if (GraalOptions.TraceLinearScanLevel >= 4) {
                 TTY.println("inserting moves at end of fromBlock B%d", fromBlock.getId());
             }
@@ -1510,8 +1520,8 @@
                 // successor edges, blocks which are reached by switch statements
                 // may have be more than one predecessor but it will be guaranteed
                 // that all predecessors will be the same.
-                for (int i = 0; i < toBlock.numberOfPreds(); i++) {
-                    assert fromBlock == toBlock.predAt(i) : "all critical edges must be broken";
+                for (Block predecessor : toBlock.getPredecessors()) {
+                    assert fromBlock == predecessor : "all critical edges must be broken";
                 }
             }
 
@@ -1529,29 +1539,28 @@
         BitSet blockCompleted = new BitSet(numBlocks);
         BitSet alreadyResolved = new BitSet(numBlocks);
 
-        int i;
-        for (i = 0; i < numBlocks; i++) {
-            Block block = blockAt(i);
+        for (Block block : sortedBlocks) {
 
             // check if block has only one predecessor and only one successor
-            if (block.numberOfPreds() == 1 && block.numberOfSux() == 1) {
+            if (block.getPredecessorCount() == 1 && block.getSuccessorCount() == 1) {
                 List<LIRInstruction> instructions = ir.lir(block);
                 assert instructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
                 assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump";
 
                 // check if block is empty (only label and branch)
                 if (instructions.size() == 2) {
-                    Block pred = block.predAt(0);
-                    Block sux = block.suxAt(0);
+                    Block pred = block.getFirstPredecessor();
+                    Block sux = block.getFirstSuccessor();
 
                     // prevent optimization of two consecutive blocks
-                    if (!blockCompleted.get(pred.linearScanNumber) && !blockCompleted.get(sux.linearScanNumber)) {
+                    if (!blockCompleted.get(pred.getLinearScanNumber()) && !blockCompleted.get(sux.getLinearScanNumber())) {
                         if (GraalOptions.TraceLinearScanLevel >= 3) {
                             TTY.println(" optimizing empty block B%d (pred: B%d, sux: B%d)", block.getId(), pred.getId(), sux.getId());
                         }
-                        blockCompleted.set(block.linearScanNumber);
+                        blockCompleted.set(block.getLinearScanNumber());
 
-                        // directly resolve between pred and sux (without looking at the empty block between)
+                        // directly resolve between pred and sux (without looking at the empty block
+                        // between)
                         resolveCollectMappings(pred, sux, moveResolver);
                         if (moveResolver.hasMappings()) {
                             moveResolver.setInsertPosition(instructions, 1);
@@ -1562,22 +1571,20 @@
             }
         }
 
-        for (i = 0; i < numBlocks; i++) {
-            if (!blockCompleted.get(i)) {
-                Block fromBlock = blockAt(i);
+        for (Block fromBlock : sortedBlocks) {
+            if (!blockCompleted.get(fromBlock.getLinearScanNumber())) {
                 alreadyResolved.clear();
                 alreadyResolved.or(blockCompleted);
 
-                int numSux = fromBlock.numberOfSux();
-                for (int s = 0; s < numSux; s++) {
-                    Block toBlock = fromBlock.suxAt(s);
+                for (Block toBlock : fromBlock.getSuccessors()) {
 
-                    // check for duplicate edges between the same blocks (can happen with switch blocks)
-                    if (!alreadyResolved.get(toBlock.linearScanNumber)) {
+                    // check for duplicate edges between the same blocks (can happen with switch
+                    // blocks)
+                    if (!alreadyResolved.get(toBlock.getLinearScanNumber())) {
                         if (GraalOptions.TraceLinearScanLevel >= 3) {
                             TTY.println(" processing edge between B%d and B%d", fromBlock.getId(), toBlock.getId());
                         }
-                        alreadyResolved.set(toBlock.linearScanNumber);
+                        alreadyResolved.set(toBlock.getLinearScanNumber());
 
                         // collect all intervals that have been split between fromBlock and toBlock
                         resolveCollectMappings(fromBlock, toBlock, moveResolver);
@@ -1601,7 +1608,7 @@
 
     /**
      * Assigns the allocated location for an LIR instruction operand back into the instruction.
-     *
+     * 
      * @param operand an LIR instruction operand
      * @param opId the id of the LIR instruction using {@code operand}
      * @param mode the usage mode for {@code operand} by the instruction
@@ -1614,9 +1621,10 @@
         if (opId != -1) {
             if (GraalOptions.DetailedAsserts) {
                 Block block = blockForId(opId);
-                if (block.numberOfSux() <= 1 && opId == getLastLirInstructionId(block)) {
+                if (block.getSuccessorCount() <= 1 && opId == getLastLirInstructionId(block)) {
                     // check if spill moves could have been appended at the end of this block, but
-                    // before the branch instruction. So the split child information for this branch would
+                    // before the branch instruction. So the split child information for this branch
+                    // would
                     // be incorrect.
                     LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1);
                     if (instr instanceof StandardOp.JumpOp) {
@@ -1681,7 +1689,8 @@
                 frameMap.setReference(interval.location(), registerRefMap, frameRefMap);
 
                 // Spill optimization: when the stack value is guaranteed to be always correct,
-                // then it must be added to the oop map even if the interval is currently in a register
+                // then it must be added to the oop map even if the interval is currently in a
+                // register
                 if (interval.alwaysInMemory() && op.id() > interval.spillDefinitionPos() && !interval.location().equals(interval.spillSlot())) {
                     assert interval.spillDefinitionPos() > 0 : "position not set correctly";
                     assert interval.spillSlot() != null : "no spill slot assigned";
@@ -1696,35 +1705,37 @@
         return attributes(asRegister(operand)).isCallerSave();
     }
 
-
     private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) {
         BitSet registerRefMap = op.hasCall() ? null : frameMap.initRegisterRefMap();
         BitSet frameRefMap = frameMap.initFrameRefMap();
         computeOopMap(iw, op, registerRefMap, frameRefMap);
 
         info.forEachState(new ValueProcedure() {
+
             @Override
             public Value doValue(Value operand) {
                 int tempOpId = op.id();
                 OperandMode mode = OperandMode.USE;
                 Block block = blockForId(tempOpId);
-                if (block.numberOfSux() == 1 && tempOpId == getLastLirInstructionId(block)) {
+                if (block.getSuccessorCount() == 1 && tempOpId == getLastLirInstructionId(block)) {
                     // generating debug information for the last instruction of a block.
                     // if this instruction is a branch, spill moves are inserted before this branch
-                    // and so the wrong operand would be returned (spill moves at block boundaries are not
+                    // and so the wrong operand would be returned (spill moves at block boundaries
+                    // are not
                     // considered in the live ranges of intervals)
                     // Solution: use the first opId of the branch target block instead.
                     final LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1);
                     if (instr instanceof StandardOp.JumpOp) {
                         if (blockData.get(block).liveOut.get(operandNumber(operand))) {
-                            tempOpId = getFirstLirInstructionId(block.suxAt(0));
+                            tempOpId = getFirstLirInstructionId(block.getFirstSuccessor());
                             mode = OperandMode.DEF;
                         }
                     }
                 }
 
                 // Get current location of operand
-                // The operand must be live because debug information is considered when building the intervals
+                // The operand must be live because debug information is considered when building
+                // the intervals
                 // if the interval is not live, colorLirOperand will cause an assert on failure
                 Value result = colorLirOperand((Variable) operand, tempOpId, mode);
                 assert !hasCall(tempOpId) || isStackSlot(result) || !isCallerSave(result) : "cannot have caller-save register operands at calls";
@@ -1732,7 +1743,7 @@
             }
         });
 
-        info.finish(registerRefMap, frameRefMap, frameMap);
+        info.finish(registerRefMap, frameRefMap);
     }
 
     private void assignLocations(List<LIRInstruction> instructions, final IntervalWalker iw) {
@@ -1747,6 +1758,7 @@
             }
 
             ValueProcedure assignProc = new ValueProcedure() {
+
                 @Override
                 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                     if (isVariable(operand)) {
@@ -1763,6 +1775,7 @@
 
             // compute reference map and debug information
             op.forEachState(new StateProcedure() {
+
                 @Override
                 protected void doState(LIRFrameState state) {
                     computeDebugInfo(iw, op, state);
@@ -1815,6 +1828,7 @@
         });
 
         Debug.scope("ResolveDataFlow", new Runnable() {
+
             public void run() {
                 resolveDataFlow();
             }
@@ -1893,7 +1907,7 @@
         if (GraalOptions.TraceLinearScanLevel >= 2) {
             TTY.println(" verifying that no oops are in fixed intervals *");
         }
-        //verifyNoOopsInFixedIntervals();
+        // verifyNoOopsInFixedIntervals();
 
         if (GraalOptions.TraceLinearScanLevel >= 2) {
             TTY.println(" verifying that unpinned constants are not alive across block boundaries");
@@ -1934,7 +1948,7 @@
                 throw new GraalInternalError("");
             }
 
-            if (isVariable(i1.operand) && i1.kind()  == Kind.Illegal) {
+            if (isVariable(i1.operand) && i1.kind() == Kind.Illegal) {
                 TTY.println("Interval %d has no type assigned", i1.operandNumber);
                 TTY.println(i1.logString(this));
                 throw new GraalInternalError("");
@@ -1995,6 +2009,7 @@
     }
 
     class CheckProcedure extends ValueProcedure {
+
         boolean ok;
         Interval curInterval;
 
@@ -2021,9 +2036,7 @@
         otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1);
         IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals);
 
-        for (int i = 0; i < blockCount(); i++) {
-            Block block = blockAt(i);
-
+        for (Block block : sortedBlocks) {
             List<LIRInstruction> instructions = ir.lir(block);
 
             for (int j = 0; j < instructions.size(); j++) {
@@ -2059,10 +2072,7 @@
     }
 
     void verifyConstants() {
-        int numBlocks = blockCount();
-
-        for (int i = 0; i < numBlocks; i++) {
-            Block block = blockAt(i);
+        for (Block block : sortedBlocks) {
             BitSet liveAtEdge = blockData.get(block).liveIn;
 
             // visit all operands where the liveAtEdge bit is set
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java	Fri Feb 01 17:06:26 2013 +0100
@@ -57,7 +57,6 @@
 
     private MoveResolver moveResolver; // for ordering spill moves
 
-
     // accessors mapped to same functions in class LinearScan
     int blockCount() {
         return allocator.blockCount();
@@ -74,7 +73,8 @@
     LinearScanWalker(LinearScan allocator, Interval unhandledFixedFirst, Interval unhandledAnyFirst) {
         super(allocator, unhandledFixedFirst, unhandledAnyFirst);
 
-        // If all allocatable registers are caller saved, then no registers are live across a call site.
+        // If all allocatable registers are caller saved, then no registers are live across a call
+        // site.
         // The register allocator can save time not trying to find a register at a call site.
         HashSet<Register> registers = new HashSet<>(Arrays.asList(allocator.frameMap.registerConfig.getAllocatableRegisters()));
         registers.removeAll(Arrays.asList(allocator.frameMap.registerConfig.getCallerSaveRegisters()));
@@ -265,8 +265,8 @@
     }
 
     int findOptimalSplitPos(Block minBlock, Block maxBlock, int maxSplitPos) {
-        int fromBlockNr = minBlock.linearScanNumber;
-        int toBlockNr = maxBlock.linearScanNumber;
+        int fromBlockNr = minBlock.getLinearScanNumber();
+        int toBlockNr = maxBlock.getLinearScanNumber();
 
         assert 0 <= fromBlockNr && fromBlockNr < blockCount() : "out of range";
         assert 0 <= toBlockNr && toBlockNr < blockCount() : "out of range";
@@ -309,7 +309,8 @@
 
             // reason for using minSplitPos - 1: when the minimal split pos is exactly at the
             // beginning of a block, then minSplitPos is also a possible split position.
-            // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == minSplitPos
+            // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 ==
+            // minSplitPos
             Block minBlock = allocator.blockForId(minSplitPos - 1);
 
             // reason for using maxSplitPos - 1: otherwise there would be an assert on failure
@@ -318,7 +319,7 @@
             // block at this opId)
             Block maxBlock = allocator.blockForId(maxSplitPos - 1);
 
-            assert minBlock.linearScanNumber <= maxBlock.linearScanNumber : "invalid order";
+            assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order";
             if (minBlock == maxBlock) {
                 // split position cannot be moved to block boundary : so split as late as possible
                 if (GraalOptions.TraceLinearScanLevel >= 4) {
@@ -330,7 +331,8 @@
                 if (interval.hasHoleBetween(maxSplitPos - 1, maxSplitPos) && !allocator.isBlockBegin(maxSplitPos)) {
                     // Do not move split position if the interval has a hole before maxSplitPos.
                     // Intervals resulting from Phi-Functions have more than one definition (marked
-                    // as mustHaveRegister) with a hole before each definition. When the register is needed
+                    // as mustHaveRegister) with a hole before each definition. When the register is
+                    // needed
                     // for the second definition : an earlier reloading is unnecessary.
                     if (GraalOptions.TraceLinearScanLevel >= 4) {
                         TTY.println("      interval has hole just before maxSplitPos, so splitting at maxSplitPos");
@@ -344,7 +346,8 @@
                     }
 
                     if (doLoopOptimization) {
-                        // Loop optimization: if a loop-end marker is found between min- and max-position :
+                        // Loop optimization: if a loop-end marker is found between min- and
+                        // max-position :
                         // then split before this loop
                         int loopEndPos = interval.nextUsageExact(RegisterPriority.LiveAtLoopEnd, allocator.getLastLirInstructionId(minBlock) + 2);
                         if (GraalOptions.TraceLinearScanLevel >= 4) {
@@ -354,14 +357,17 @@
                         assert loopEndPos > minSplitPos : "invalid order";
                         if (loopEndPos < maxSplitPos) {
                             // loop-end marker found between min- and max-position
-                            // if it is not the end marker for the same loop as the min-position : then move
+                            // if it is not the end marker for the same loop as the min-position :
+                            // then move
                             // the max-position to this loop block.
-                            // Desired result: uses tagged as shouldHaveRegister inside a loop cause a reloading
+                            // Desired result: uses tagged as shouldHaveRegister inside a loop cause
+                            // a reloading
                             // of the interval (normally, only mustHaveRegister causes a reloading)
                             Block loopBlock = allocator.blockForId(loopEndPos);
 
                             if (GraalOptions.TraceLinearScanLevel >= 4) {
-                                TTY.println("      interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId());
+                                TTY.println("      interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(),
+                                                loopBlock.getId());
                             }
                             assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between";
 
@@ -428,7 +434,8 @@
             return;
         }
 
-        // must calculate this before the actual split is performed and before split position is moved to odd opId
+        // must calculate this before the actual split is performed and before split position is
+        // moved to odd opId
         boolean moveNecessary = !allocator.isBlockBegin(optimalSplitPos) && !interval.hasHoleBetween(optimalSplitPos - 1, optimalSplitPos);
 
         if (!allocator.isBlockBegin(optimalSplitPos)) {
@@ -460,10 +467,10 @@
         }
     }
 
-// split an interval at the optimal position between minSplitPos and
-// maxSplitPos in two parts:
-// 1) the left part has already a location assigned
-// 2) the right part is always on the stack and therefore ignored in further processing
+    // split an interval at the optimal position between minSplitPos and
+    // maxSplitPos in two parts:
+    // 1) the left part has already a location assigned
+    // 2) the right part is always on the stack and therefore ignored in further processing
 
     void splitForSpilling(Interval interval) {
         // calculate allowed range of splitting position
@@ -508,7 +515,8 @@
                         }
                         allocator.assignSpillSlot(parent);
                     } else {
-                        // do not go further back because the register is actually used by the interval
+                        // do not go further back because the register is actually used by the
+                        // interval
                         parent = null;
                     }
                 }
@@ -611,7 +619,8 @@
 
         // usePos contains the start of the next interval that has this register assigned
         // (either as a fixed register or a normal allocated register in the past)
-        // only intervals overlapping with cur are processed, non-overlapping invervals can be ignored safely
+        // only intervals overlapping with cur are processed, non-overlapping invervals can be
+        // ignored safely
         if (GraalOptions.TraceLinearScanLevel >= 4) {
             TTY.println("      state of registers:");
             for (Register register : availableRegs) {
@@ -701,7 +710,7 @@
         // collect current usage of registers
         initUseLists(false);
         spillExcludeActiveFixed();
-        //  spillBlockUnhandledFixed(cur);
+        // spillBlockUnhandledFixed(cur);
         assert unhandledLists.get(RegisterBinding.Fixed) == Interval.EndMarker : "must not have unhandled fixed intervals because all fixed intervals have a use at position 0";
         spillBlockInactiveFixed(interval);
         spillCollectActiveAny();
@@ -767,7 +776,7 @@
 
         interval.assignLocation(reg.asValue(interval.kind()));
         if (needSplit) {
-            // register not available for full interval :  so split it
+            // register not available for full interval : so split it
             splitWhenPartialRegisterAvailable(interval, splitPos);
         }
 
@@ -860,7 +869,8 @@
         assert endHint.firstUsage(RegisterPriority.MustHaveRegister) == endPos : "must have use position at begin of interval because of move";
 
         if (isRegister(beginHint.location())) {
-            // registerHint is not spilled at beginPos : so it would not be benefitial to immediately spill cur
+            // registerHint is not spilled at beginPos : so it would not be benefitial to
+            // immediately spill cur
             return;
         }
         assert registerHint.spillSlot() != null : "must be set when part of interval was spilled";
@@ -888,7 +898,8 @@
 
         final Value operand = interval.operand;
         if (interval.location() != null && isStackSlot(interval.location())) {
-            // activating an interval that has a stack slot assigned . split it at first use position
+            // activating an interval that has a stack slot assigned . split it at first use
+            // position
             // used for method parameters
             if (GraalOptions.TraceLinearScanLevel >= 4) {
                 TTY.println("      interval has spill slot assigned (method parameter) . split it before first use");
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/MoveResolver.java	Fri Feb 01 17:06:26 2013 +0100
@@ -161,8 +161,8 @@
     }
 
     /**
-     * Checks if the {@linkplain Interval#location() location} of {@code to} is not blocked
-     * or is only blocked by {@code from}.
+     * Checks if the {@linkplain Interval#location() location} of {@code to} is not blocked or is
+     * only blocked by {@code from}.
      */
     private boolean safeToProcessMove(Interval from, Interval to) {
         Value fromReg = from != null ? from.location() : null;
@@ -271,7 +271,8 @@
                 spillInterval.setKind(fromInterval.kind());
 
                 // add a dummy range because real position is difficult to calculate
-                // Note: this range is a special case when the integrity of the allocation is checked
+                // Note: this range is a special case when the integrity of the allocation is
+                // checked
                 spillInterval.addRange(1, 2);
 
                 // do not allocate a new spill slot for temporary interval, but
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Range.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/Range.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.compiler.alloc;
 
-
 /**
  * Represents a range of integers from a start (inclusive) to an end (exclusive.
  */
@@ -49,10 +48,9 @@
         return intersectsAt(r) != -1;
     }
 
-
     /**
      * Creates a new range.
-     *
+     * 
      * @param from the start of the range, inclusive
      * @param to the end of the range, exclusive
      * @param next link to the next range in a linked list
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java	Fri Feb 01 17:06:26 2013 +0100
@@ -118,8 +118,7 @@
         processOperations(allocator.ir.lir(block), inputState);
 
         // iterate all successors
-        for (int i = 0; i < block.numberOfSux(); i++) {
-            Block succ = block.suxAt(i);
+        for (Block succ : block.getSuccessors()) {
             processSuccessor(succ, inputState);
         }
     }
@@ -215,6 +214,7 @@
             }
 
             ValueProcedure useProc = new ValueProcedure() {
+
                 @Override
                 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                     if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) {
@@ -230,6 +230,7 @@
             };
 
             ValueProcedure defProc = new ValueProcedure() {
+
                 @Override
                 public Value doValue(Value operand, OperandMode mode, EnumSet<OperandFlag> flags) {
                     if (LinearScan.isVariableOrRegister(operand) && allocator.isProcessed(operand)) {
@@ -253,7 +254,8 @@
                 }
             }
             op.forEachAlive(useProc);
-            // set temp operands (some operations use temp operands also as output operands, so can't set them null)
+            // set temp operands (some operations use temp operands also as output operands, so
+            // can't set them null)
             op.forEachTemp(defProc);
             // set output operands
             op.forEachOutput(defProc);
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,17 +35,17 @@
 import com.oracle.graal.virtual.nodes.*;
 
 public class DebugInfoBuilder {
+
     private final NodeMap<Value> nodeOperands;
 
     public DebugInfoBuilder(NodeMap<Value> nodeOperands) {
         this.nodeOperands = nodeOperands;
     }
 
-
     private HashMap<VirtualObjectNode, VirtualObject> virtualObjects = new HashMap<>();
     private IdentityHashMap<VirtualObjectNode, EscapeObjectState> objectStates = new IdentityHashMap<>();
 
-    public LIRFrameState build(FrameState topState, List<StackSlot> lockData, List<StackSlot> pointerSlots, LabelRef exceptionEdge, long leafGraphId) {
+    public LIRFrameState build(FrameState topState, List<StackSlot> lockData, LabelRef exceptionEdge, long leafGraphId) {
         assert virtualObjects.size() == 0;
         assert objectStates.size() == 0;
 
@@ -70,7 +70,8 @@
         VirtualObject[] virtualObjectsArray = null;
         if (virtualObjects.size() != 0) {
             // fill in the VirtualObject values:
-            // during this process new VirtualObjects might be discovered, so repeat until no more changes occur.
+            // during this process new VirtualObjects might be discovered, so repeat until no more
+            // changes occur.
             boolean changed;
             do {
                 changed = false;
@@ -102,7 +103,7 @@
         }
         objectStates.clear();
 
-        return new LIRFrameState(frame, virtualObjectsArray, pointerSlots, exceptionEdge);
+        return new LIRFrameState(frame, virtualObjectsArray, exceptionEdge);
     }
 
     private BytecodeFrame computeFrameForState(FrameState state, List<StackSlot> lockDataSlots, long leafGraphId) {
@@ -118,7 +119,8 @@
             values[numLocals + i] = toValue(state.stackAt(i));
         }
         for (int i = 0; i < numLocks; i++) {
-            // frames are traversed from the outside in, so the locks for the current frame are at the end of the lockDataSlots list
+            // frames are traversed from the outside in, so the locks for the current frame are at
+            // the end of the lockDataSlots list
             StackSlot lockData = lockDataSlots.get(lockDataSlots.size() - numLocks + i);
             values[numLocals + numStack + i] = new MonitorValue(toValue(state.lockAt(i)), lockData, state.lockAt(i) instanceof VirtualObjectNode);
         }
@@ -146,6 +148,7 @@
                 throw new GraalInternalError("no mapping found for virtual object %s", obj);
             }
             if (state instanceof MaterializedObjectState) {
+                assert !(((MaterializedObjectState) state).materializedValue() instanceof VirtualObjectNode);
                 return toValue(((MaterializedObjectState) state).materializedValue());
             } else {
                 assert obj.entryCount() == 0 || state instanceof VirtualObjectState || obj instanceof BoxedVirtualObjectNode;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/InstructionPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * A utility for {@linkplain #printInstruction(ValueNode) printing}
- * a node as an expression or statement.
+ * A utility for {@linkplain #printInstruction(ValueNode) printing} a node as an expression or
+ * statement.
  */
 public class InstructionPrinter {
 
@@ -71,6 +71,7 @@
         /**
          * Prints this column's label to a given stream after padding the stream with '_' characters
          * until its {@linkplain LogStream#position() position} is equal to this column's position.
+         * 
          * @param out the print stream
          */
         public void printLabel(LogStream out) {
@@ -79,8 +80,9 @@
         }
 
         /**
-         * Prints space characters to a given stream until its {@linkplain LogStream#position() position}
-         * is equal to this column's position.
+         * Prints space characters to a given stream until its {@linkplain LogStream#position()
+         * position} is equal to this column's position.
+         * 
          * @param out the print stream
          */
         public void advance(LogStream out) {
@@ -99,7 +101,8 @@
     }
 
     /**
-     * Prints a header for the tabulated data printed by {@link #printInstructionListing(ValueNode)}.
+     * Prints a header for the tabulated data printed by {@link #printInstructionListing(ValueNode)}
+     * .
      */
     public void printInstructionListingHeader() {
         BCI.printLabel(out);
@@ -111,20 +114,15 @@
     }
 
     /**
-     * Prints an instruction listing on one line. The instruction listing is composed of the
-     * columns specified by {@link InstructionLineColumn}.
-     *
+     * Prints an instruction listing on one line. The instruction listing is composed of the columns
+     * specified by {@link InstructionLineColumn}.
+     * 
      * @param instruction the instruction to print
      */
     public void printInstructionListing(ValueNode instruction) {
         int indentation = out.indentationLevel();
-        out.fillTo(BCI.position + indentation, ' ').
-             print(0).
-             fillTo(USE.position + indentation, ' ').
-             print("0").
-             fillTo(VALUE.position + indentation, ' ').
-             print(ValueNodeUtil.valueString(instruction)).
-             fillTo(INSTRUCTION.position + indentation, ' ');
+        out.fillTo(BCI.position + indentation, ' ').print(0).fillTo(USE.position + indentation, ' ').print("0").fillTo(VALUE.position + indentation, ' ').print(ValueNodeUtil.valueString(instruction)).fillTo(
+                        INSTRUCTION.position + indentation, ' ');
         printInstruction(instruction);
         if (instruction instanceof StateSplit) {
             out.print("  [state: " + ((StateSplit) instruction).stateAfter() + "]");
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -44,7 +44,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.extended.*;
-import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.*;
@@ -54,6 +53,7 @@
  * This class traverses the HIR instructions and generates LIR instructions from them.
  */
 public abstract class LIRGenerator extends LIRGeneratorTool {
+
     protected final StructuredGraph graph;
     protected final CodeCacheProvider runtime;
     protected final TargetDescription target;
@@ -85,7 +85,8 @@
     private final BlockMap<Integer> blockLastLockCount;
 
     /**
-     * Contains the lock data slot for each lock depth (so these may be reused within a compiled method).
+     * Contains the lock data slot for each lock depth (so these may be reused within a compiled
+     * method).
      */
     private final ArrayList<StackSlot> lockDataSlots;
 
@@ -118,8 +119,9 @@
     }
 
     /**
-     * Returns the operand that has been previously initialized by {@link #setResult(ValueNode, Value)}
-     * with the result of an instruction.
+     * Returns the operand that has been previously initialized by
+     * {@link #setResult(ValueNode, Value)} with the result of an instruction.
+     * 
      * @param node A node that produces a result value.
      */
     @Override
@@ -141,6 +143,7 @@
 
     /**
      * Creates a new {@linkplain Variable variable}.
+     * 
      * @param kind The kind of the new variable.
      * @return a new variable
      */
@@ -168,9 +171,8 @@
 
     @Override
     public Value setResult(ValueNode x, Value operand) {
-        assert (isVariable(operand) && x.kind() == operand.getKind()) ||
-               (isRegister(operand) && !attributes(asRegister(operand)).isAllocatable()) ||
-               (isConstant(operand) && x.kind() == operand.getKind().getStackKind()) : operand.getKind() + " for node " + x;
+        assert (isVariable(operand) && x.kind() == operand.getKind()) || (isRegister(operand) && !attributes(asRegister(operand)).isAllocatable()) ||
+                        (isConstant(operand) && x.kind() == operand.getKind().getStackKind()) : operand.getKind() + " for node " + x;
         assert operand(x) == null : "operand cannot be set twice";
         assert operand != null && isLegal(operand) : "operand must be legal";
         assert operand.getKind().getStackKind() == x.kind() : operand.getKind().getStackKind() + " must match " + x.kind();
@@ -234,21 +236,22 @@
     }
 
     public LIRFrameState stateFor(FrameState state, long leafGraphId) {
-        return stateFor(state, null, null, leafGraphId);
+        return stateFor(state, null, leafGraphId);
     }
 
-    public LIRFrameState stateFor(FrameState state, List<StackSlot> pointerSlots, LabelRef exceptionEdge, long leafGraphId) {
+    public LIRFrameState stateFor(FrameState state, LabelRef exceptionEdge, long leafGraphId) {
         if (needOnlyOopMaps()) {
-            return new LIRFrameState(null, null, null, null);
+            return new LIRFrameState(null, null, null);
         }
-        return debugInfoBuilder.build(state, lockDataSlots.subList(0, currentLockCount), pointerSlots, exceptionEdge, leafGraphId);
+        return debugInfoBuilder.build(state, lockDataSlots.subList(0, currentLockCount), exceptionEdge, leafGraphId);
     }
 
     /**
      * Gets the ABI specific operand used to return a value of a given kind from a method.
-     *
+     * 
      * @param kind the kind of value being returned
-     * @return the operand representing the ABI defined location used return a value of kind {@code kind}
+     * @return the operand representing the ABI defined location used return a value of kind
+     *         {@code kind}
      */
     public Value resultOperandFor(Kind kind) {
         if (kind == Kind.Void) {
@@ -257,7 +260,6 @@
         return frameMap.registerConfig.getReturnRegister(kind).asValue(kind);
     }
 
-
     public void append(LIRInstruction op) {
         assert LIRVerifier.verify(op);
         if (GraalOptions.PrintIRWithLIR && !TTY.isSuppressed()) {
@@ -282,19 +284,19 @@
         assert lir.lir(block) == null : "LIR list already computed for this block";
         lir.setLir(block, new ArrayList<LIRInstruction>());
 
-        append(new LabelOp(new Label(), block.align));
+        append(new LabelOp(new Label(), block.isAligned()));
 
         if (GraalOptions.TraceLIRGeneratorLevel >= 1) {
             TTY.println("BEGIN Generating LIR for block B" + block.getId());
         }
 
         if (block == lir.cfg.getStartBlock()) {
-            assert block.getPredecessors().size() == 0;
+            assert block.getPredecessorCount() == 0;
             currentLockCount = 0;
             emitPrologue();
 
         } else {
-            assert block.getPredecessors().size() > 0;
+            assert block.getPredecessorCount() > 0;
 
             currentLockCount = -1;
             for (Block pred : block.getPredecessors()) {
@@ -357,7 +359,7 @@
                         if (nextInstr instanceof Access) {
                             Access access = (Access) nextInstr;
                             if (isNullNode.object() == access.object() && canBeNullCheck(access.location())) {
-                                //TTY.println("implicit null check");
+                                // TTY.println("implicit null check");
                                 access.setNullCheck(true);
                                 continue;
                             }
@@ -386,7 +388,8 @@
                         }
                     }
                 } else {
-                    // There can be cases in which the result of an instruction is already set before by other instructions.
+                    // There can be cases in which the result of an instruction is already set
+                    // before by other instructions.
                 }
             }
             if (stateAfter != null) {
@@ -400,7 +403,7 @@
                 }
             }
         }
-        if (block.numberOfSux() >= 1 && !endsWithJump(block)) {
+        if (block.getSuccessorCount() >= 1 && !endsWithJump(block)) {
             NodeClassIterable successors = block.getEndNode().successors();
             assert successors.isNotEmpty() : "should have at least one successor : " + block.getEndNode();
 
@@ -434,7 +437,7 @@
                     assert operand(v) != null : "Value " + v + " in " + fs + " is not ready!";
                 }
             }
-            fs =  fs.outerFrameState();
+            fs = fs.outerFrameState();
         }
         return true;
     }
@@ -463,9 +466,8 @@
         ((LIRLowerable) node).generate(this);
     }
 
-    private static boolean canBeNullCheck(LocationNode location) {
-        // TODO: Make this part of TargetDescription
-        return !(location instanceof IndexedLocationNode) && location.displacement() < 4096;
+    private boolean canBeNullCheck(LocationNode location) {
+        return !(location instanceof IndexedLocationNode) && location.displacement() < this.target().implicitNullCheckLimit;
     }
 
     protected CallingConvention createCallingConvention() {
@@ -496,7 +498,8 @@
     }
 
     /**
-     * Increases the number of currently locked monitors and makes sure that a lock data slot is available for the new lock.
+     * Increases the number of currently locked monitors and makes sure that a lock data slot is
+     * available for the new lock.
      */
     public void lock() {
         if (lockDataSlots.size() == currentLockCount) {
@@ -507,7 +510,7 @@
 
     /**
      * Decreases the number of currently locked monitors.
-     *
+     * 
      * @throws GraalInternalError if the number of currently locked monitors is already zero.
      */
     public void unlock() {
@@ -583,7 +586,7 @@
 
     @Override
     public void emitIf(IfNode x) {
-        emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()),  getLIRBlock(x.falseSuccessor()), null);
+        emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), null);
     }
 
     @Override
@@ -679,43 +682,11 @@
         return emitCMove(operand(compare.x()), operand(compare.y()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue);
     }
 
-
     public abstract void emitJump(LabelRef label, LIRFrameState info);
-    public abstract void emitBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info);
-    public abstract Variable emitCMove(Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue);
-
-    protected FrameState stateBeforeCallWithArguments(FrameState stateAfter, MethodCallTargetNode call, int bci) {
-        return stateAfter.duplicateModified(bci, stateAfter.rethrowException(), call.returnStamp().kind(), toJVMArgumentStack(call.targetMethod().getSignature(), call.isStatic(), call.arguments()));
-    }
-
-    private static ValueNode[] toJVMArgumentStack(Signature signature, boolean isStatic, NodeInputList<ValueNode> arguments) {
-        int slotCount = signature.getParameterSlots(!isStatic);
-        ValueNode[] stack = new ValueNode[slotCount];
-        int stackIndex = 0;
-        int argumentIndex = 0;
-        for (ValueNode arg : arguments) {
-            stack[stackIndex] = arg;
 
-            if (stackIndex == 0 && !isStatic) {
-                // Current argument is receiver.
-                stackIndex += stackSlots(Kind.Object);
-            } else {
-                stackIndex += stackSlots(signature.getParameterKind(argumentIndex));
-                argumentIndex++;
-            }
-        }
-        return stack;
-    }
+    public abstract void emitBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info);
 
-
-    public static int stackSlots(Kind kind) {
-        return isTwoSlot(kind) ? 2 : 1;
-    }
-
-    public static boolean isTwoSlot(Kind kind) {
-        assert kind != Kind.Void && kind != Kind.Illegal;
-        return kind == Kind.Long || kind == Kind.Double;
-    }
+    public abstract Variable emitCMove(Value leftVal, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue);
 
     @Override
     public void emitInvoke(Invoke x) {
@@ -727,7 +698,7 @@
 
         LIRFrameState callState = null;
         if (x.stateAfter() != null) {
-            callState = stateFor(x.stateDuring(), null, x instanceof InvokeWithExceptionNode ? getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()) : null, x.leafGraphId());
+            callState = stateFor(x.stateDuring(), x instanceof InvokeWithExceptionNode ? getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()) : null, x.leafGraphId());
         }
 
         Value result = cc.getReturn();
@@ -753,7 +724,8 @@
 
     private static Value toStackKind(Value value) {
         if (value.getKind().getStackKind() != value.getKind()) {
-            // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention.
+            // We only have stack-kinds in the LIR, so convert the operand kind for values from the
+            // calling convention.
             if (isRegister(value)) {
                 return asRegister(value).asValue(value.getKind().getStackKind());
             } else if (isStackSlot(value)) {
@@ -782,7 +754,6 @@
         return result;
     }
 
-
     protected abstract LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info, Object deoptInfo);
 
     @Override
@@ -819,22 +790,18 @@
         LIRFrameState info = null;
         FrameState stateAfter = x.stateAfter();
         if (stateAfter != null) {
-            // (cwimmer) I made the code that modifies the operand stack conditional. My scenario: runtime calls to, e.g.,
-            // CreateNullPointerException have no equivalent in the bytecodes, so there is no invoke bytecode.
-            // Therefore, the result of the runtime call was never pushed to the stack, and we cannot pop it here.
+            // (cwimmer) I made the code that modifies the operand stack conditional. My scenario:
+            // runtime calls to, e.g.,
+            // CreateNullPointerException have no equivalent in the bytecodes, so there is no invoke
+            // bytecode.
+            // Therefore, the result of the runtime call was never pushed to the stack, and we
+            // cannot pop it here.
             FrameState stateBeforeReturn = stateAfter;
-            if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == x) ||
-                (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == x)) {
-
+            if ((stateAfter.stackSize() > 0 && stateAfter.stackAt(stateAfter.stackSize() - 1) == x) || (stateAfter.stackSize() > 1 && stateAfter.stackAt(stateAfter.stackSize() - 2) == x)) {
                 stateBeforeReturn = stateAfter.duplicateModified(stateAfter.bci, stateAfter.rethrowException(), x.kind());
             }
-
-            // TODO is it correct here that the pointerSlots are not passed to the oop map generation?
             info = stateFor(stateBeforeReturn, -1);
         } else {
-            // Every runtime call needs an info
-            // TODO This is conservative. It's not needed for calls that are implemented purely in a stub
-            //       that does not trash any registers and does not call into the runtime.
             info = state();
         }
 
@@ -846,10 +813,12 @@
     }
 
     /**
-     * This method tries to create a switch implementation that is optimal for the given switch.
-     * It will either generate a sequential if/then/else cascade, a set of range tests or a table switch.
-     *
-     * If the given switch does not contain int keys, it will always create a sequential implementation.
+     * This method tries to create a switch implementation that is optimal for the given switch. It
+     * will either generate a sequential if/then/else cascade, a set of range tests or a table
+     * switch.
+     * 
+     * If the given switch does not contain int keys, it will always create a sequential
+     * implementation.
      */
     @Override
     public void emitSwitch(SwitchNode x) {
@@ -891,6 +860,7 @@
     private void emitSequentialSwitch(final SwitchNode x, Variable key, LabelRef defaultTarget) {
         int keyCount = x.keyCount();
         Integer[] indexes = Util.createSortedPermutation(keyCount, new Comparator<Integer>() {
+
             @Override
             public int compare(Integer o1, Integer o2) {
                 return x.keyProbability(o1) < x.keyProbability(o2) ? 1 : x.keyProbability(o1) > x.keyProbability(o2) ? -1 : 0;
@@ -906,7 +876,9 @@
     }
 
     protected abstract void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key);
+
     protected abstract void emitSwitchRanges(int[] lowKeys, int[] highKeys, LabelRef[] targets, LabelRef defaultTarget, Value key);
+
     protected abstract void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key);
 
     private static int switchRangeCount(SwitchNode x) {
@@ -967,14 +939,22 @@
     }
 
     public abstract void emitBitCount(Variable result, Value operand);
+
     public abstract void emitBitScanForward(Variable result, Value operand);
+
     public abstract void emitBitScanReverse(Variable result, Value operand);
 
     public abstract void emitMathAbs(Variable result, Variable input);
+
     public abstract void emitMathSqrt(Variable result, Variable input);
+
     public abstract void emitMathLog(Variable result, Variable input, boolean base10);
+
     public abstract void emitMathCos(Variable result, Variable input);
+
     public abstract void emitMathSin(Variable result, Variable input);
+
     public abstract void emitMathTan(Variable result, Variable input);
+
     public abstract void emitByteSwap(Variable result, Value operand);
 }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/PhiResolver.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,17 +33,18 @@
 
 /**
  * Converts {@link PhiNode} instructions into moves.
- *
+ * 
  * Resolves cycles:
+ * 
  * <pre>
- *
+ * 
  *  r1 := r2  becomes  temp := r1
  *  r2 := r1           r1 := r2
  *                     r2 := temp
  * </pre>
- *
+ * 
  * and orders moves:
- *
+ * 
  * <pre>
  *  r2 := r3  becomes  r1 := r2
  *  r1 := r2           r2 := r3
@@ -52,12 +53,14 @@
 public class PhiResolver {
 
     /**
-     * Tracks a data flow dependency between a source operand and any number of the destination operands.
+     * Tracks a data flow dependency between a source operand and any number of the destination
+     * operands.
      */
     static class PhiResolverNode {
 
         /**
-         * A source operand whose value flows into the {@linkplain #destinations destination} operands.
+         * A source operand whose value flows into the {@linkplain #destinations destination}
+         * operands.
          */
         final Value operand;
 
@@ -67,7 +70,8 @@
         final ArrayList<PhiResolverNode> destinations;
 
         /**
-         * Denotes if a move instruction has already been emitted to initialize the value of {@link #operand}.
+         * Denotes if a move instruction has already been emitted to initialize the value of
+         * {@link #operand}.
          */
         boolean assigned;
 
@@ -150,7 +154,7 @@
         PhiResolverNode srcNode = sourceNode(src);
         PhiResolverNode destNode = destinationNode(dest);
         srcNode.destinations.add(destNode);
-      }
+    }
 
     private PhiResolverNode createNode(Value operand, boolean source) {
         PhiResolverNode node;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,3 +25,4 @@
  * HIR instructions to LIR instructions for the backend.
  */
 package com.oracle.graal.compiler.gen;
+
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/Backend.java	Fri Feb 01 17:06:26 2013 +0100
@@ -57,8 +57,9 @@
 
     /**
      * Emits code to do stack overflow checking.
-     *
-     * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate the current frame
+     * 
+     * @param afterFrameInit specifies if the stack pointer has already been adjusted to allocate
+     *            the current frame
      */
     protected static void emitStackOverflowCheck(TargetMethodAssembler tasm, boolean afterFrameInit) {
         if (GraalOptions.StackShadowPages > 0) {
@@ -80,10 +81,10 @@
 
     /**
      * Emits the code for a given method. This includes any architecture/runtime specific
-     * prefix/suffix. A prefix typically contains the code for setting up the frame,
-     * spilling callee-save registers, stack overflow checking, handling multiple entry
-     * points etc. A suffix may contain out-of-line stubs and method end guard instructions.
-     *
+     * prefix/suffix. A prefix typically contains the code for setting up the frame, spilling
+     * callee-save registers, stack overflow checking, handling multiple entry points etc. A suffix
+     * may contain out-of-line stubs and method end guard instructions.
+     * 
      * @param method the method associated with {@code lir}
      * @param lir the LIR of {@code method}
      */
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenLowerable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/target/LIRGenLowerable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * An alternative to {@link LIRLowerable} for lowering that is tightly coupled
- * to {@link LIRGenerator} and {@link LIRInstruction}.
+ * An alternative to {@link LIRLowerable} for lowering that is tightly coupled to
+ * {@link LIRGenerator} and {@link LIRInstruction}.
  */
 public interface LIRGenLowerable {
 
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java	Fri Feb 01 17:06:26 2013 +0100
@@ -93,7 +93,7 @@
     }
 
     public static void scope(String name, Object context, Runnable runnable) {
-        scope(name, new Object[] {context}, runnable);
+        scope(name, new Object[]{context}, runnable);
     }
 
     public static void scope(String name, Object[] context, Runnable runnable) {
@@ -113,7 +113,7 @@
     }
 
     public static <T> T scope(String name, Object context, Callable<T> callable) {
-        return scope(name, new Object[] {context}, callable);
+        return scope(name, new Object[]{context}, callable);
     }
 
     public static <T> T scope(String name, Object[] context, Callable<T> callable) {
@@ -160,8 +160,8 @@
     }
 
     /**
-     * Searches the current debug scope, bottom up, for a context object that is an instance of a given type.
-     * The first such object found is returned.
+     * Searches the current debug scope, bottom up, for a context object that is an instance of a
+     * given type. The first such object found is returned.
      */
     @SuppressWarnings("unchecked")
     public static <T> T contextLookup(Class<T> clazz) {
@@ -189,7 +189,8 @@
         }
     }
 
-    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, final Collection<DebugDumpHandler> dumpHandlers, final PrintStream output) {
+    public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled,
+                    final Collection<DebugDumpHandler> dumpHandlers, final PrintStream output) {
         return new DebugConfig() {
 
             @Override
@@ -242,7 +243,7 @@
         public void increment() {
         }
 
-        public void add(int value) {
+        public void add(long value) {
         }
     };
 
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,25 +25,28 @@
 import java.io.*;
 import java.util.*;
 
+public interface DebugConfig {
 
-public interface DebugConfig {
     /**
-     * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope}.
-     *
+     * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope}
+     * .
+     * 
      * @see Debug#log(String, Object...)
      */
     boolean isLogEnabled();
 
     /**
-     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug scope}.
-     *
+     * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug
+     * scope}.
+     * 
      * @see Debug#metric(String)
      */
     boolean isMeterEnabled();
 
     /**
-     * Determines if dumping is enabled in the {@linkplain Debug#currentScope() current debug scope}.
-     *
+     * Determines if dumping is enabled in the {@linkplain Debug#currentScope() current debug scope}
+     * .
+     * 
      * @see Debug#dump(Object, String, Object...)
      */
     boolean isDumpEnabled();
@@ -55,7 +58,7 @@
 
     /**
      * Removes an object the context used by this configuration to do filtering.
-     *
+     * 
      * This should only removes extra context added by {@link #addToContext(Object)}.
      */
     void removeFromContext(Object o);
@@ -67,9 +70,9 @@
 
     /**
      * Handles notification of an exception occurring within a debug scope.
-     *
-     * @return the exception object that is to be propagated to parent scope. A value of {@code null} indicates that
-     *         {@code e} is to be propagated.
+     * 
+     * @return the exception object that is to be propagated to parent scope. A value of
+     *         {@code null} indicates that {@code e} is to be propagated.
      */
     RuntimeException interceptException(Throwable e);
 
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpHandler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 import java.io.*;
 
 public interface DebugDumpHandler extends Closeable {
+
     void dump(Object object, String message);
 
     @Override
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugDumpScope.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,9 +27,9 @@
     public final String name;
 
     /**
-     * Specifies if this scope decorates an inner scope.
-     * A hierarchical or tree representation of nested scopes may choose to represent
-     * a decorator scope at the same level as the scope it decorates.
+     * Specifies if this scope decorates an inner scope. A hierarchical or tree representation of
+     * nested scopes may choose to represent a decorator scope at the same level as the scope it
+     * decorates.
      */
     public final boolean decorator;
 
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugMetric.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,6 +23,8 @@
 package com.oracle.graal.debug;
 
 public interface DebugMetric {
+
     void increment();
-    void add(int value);
+
+    void add(long value);
 }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugTimer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,5 +25,6 @@
 import com.oracle.graal.debug.internal.*;
 
 public interface DebugTimer {
+
     TimerCloseable start();
 }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/LogStream.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,22 +26,22 @@
 
 /**
  * A utility for printing compiler debug and informational output to an output stream.
- *
+ * 
  * A {@link LogStream} instance maintains an internal buffer that is flushed to the underlying
- * output stream every time one of the {@code println} methods is invoked, or a newline character
- * ({@code '\n'}) is written.
- *
- * All of the {@code print} and {@code println} methods return the {code LogStream} instance
- * on which they were invoked. This allows chaining of these calls to mitigate use of String
+ * output stream every time one of the {@code println} methods is invoked, or a newline character (
+ * {@code '\n'}) is written.
+ * 
+ * All of the {@code print} and {@code println} methods return the {code LogStream} instance on
+ * which they were invoked. This allows chaining of these calls to mitigate use of String
  * concatenation by the caller.
- *
- * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level.
- * Each line of output written to this stream has {@code n} spaces prefixed to it where
- * {@code n} is the value that would be returned by {@link #indentationLevel()} when the first
- * character of a new line is written.
- *
- * A {@code LogStream} maintains a current {@linkplain #position() position} for the current
- * line being written. This position can be advanced to a specified position by
+ * 
+ * A {@code LogStream} maintains a current {@linkplain #indentationLevel() indentation} level. Each
+ * line of output written to this stream has {@code n} spaces prefixed to it where {@code n} is the
+ * value that would be returned by {@link #indentationLevel()} when the first character of a new
+ * line is written.
+ * 
+ * A {@code LogStream} maintains a current {@linkplain #position() position} for the current line
+ * being written. This position can be advanced to a specified position by
  * {@linkplain #fillTo(int, char) filling} this stream with a given character.
  */
 public class LogStream {
@@ -52,8 +52,10 @@
     public static final LogStream SINK = new LogStream();
 
     private static final PrintStream SINK_PS = new PrintStream(new OutputStream() {
+
         @Override
-        public void write(int b) throws IOException { }
+        public void write(int b) throws IOException {
+        }
     });
 
     private LogStream() {
@@ -85,7 +87,7 @@
 
     /**
      * Creates a new log stream.
-     *
+     * 
      * @param os the underlying output stream to which prints are sent
      */
     public LogStream(OutputStream os) {
@@ -94,8 +96,9 @@
     }
 
     /**
-     * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given {@link LogStream}.
-     *
+     * Creates a new log stream that shares the same {@linkplain #ps output stream} as a given
+     * {@link LogStream}.
+     * 
      * @param log a LogStream whose output stream is shared with this one
      */
     public LogStream(LogStream log) {
@@ -104,8 +107,8 @@
     }
 
     /**
-     * Prepends {@link #indentation} to the current output line until its write position is equal to the
-     * current {@linkplain #indentationLevel()} level.
+     * Prepends {@link #indentation} to the current output line until its write position is equal to
+     * the current {@linkplain #indentationLevel()} level.
      */
     private void indent() {
         if (ps != null) {
@@ -144,7 +147,7 @@
 
     /**
      * Gets the current column position of this log stream.
-     *
+     * 
      * @return the current column position of this log stream
      */
     public int position() {
@@ -154,7 +157,7 @@
 
     /**
      * Gets the current indentation level for this log stream.
-     *
+     * 
      * @return the current indentation level for this log stream.
      */
     public int indentationLevel() {
@@ -163,7 +166,7 @@
 
     /**
      * Adjusts the current indentation level of this log stream.
-     *
+     * 
      * @param delta
      */
     public void adjustIndentation(int delta) {
@@ -197,9 +200,9 @@
     }
 
     /**
-     * Advances this stream's {@linkplain #position() position} to a given position by
-     * repeatedly appending a given character as necessary.
-     *
+     * Advances this stream's {@linkplain #position() position} to a given position by repeatedly
+     * appending a given character as necessary.
+     * 
      * @param position the position to which this stream's position will be advanced
      * @param filler the character used to pad the stream
      */
@@ -215,7 +218,7 @@
 
     /**
      * Writes a boolean value to this stream as {@code "true"} or {@code "false"}.
-     *
+     * 
      * @param b the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -228,8 +231,9 @@
     }
 
     /**
-     * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * Writes a boolean value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     * 
      * @param b the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -244,7 +248,7 @@
 
     /**
      * Writes a character value to this stream.
-     *
+     * 
      * @param c the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -262,8 +266,9 @@
     }
 
     /**
-     * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * Writes a character value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     * 
      * @param c the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -278,7 +283,7 @@
 
     /**
      * Prints an int value.
-     *
+     * 
      * @param i the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -292,7 +297,7 @@
 
     /**
      * Writes an int value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * 
      * @param i the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -307,7 +312,7 @@
 
     /**
      * Writes a float value to this stream.
-     *
+     * 
      * @param f the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -320,8 +325,9 @@
     }
 
     /**
-     * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * Writes a float value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}
+     * .
+     * 
      * @param f the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -336,7 +342,7 @@
 
     /**
      * Writes a long value to this stream.
-     *
+     * 
      * @param l the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -350,7 +356,7 @@
 
     /**
      * Writes a long value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * 
      * @param l the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -365,7 +371,7 @@
 
     /**
      * Writes a double value to this stream.
-     *
+     * 
      * @param d the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -378,8 +384,9 @@
     }
 
     /**
-     * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * Writes a double value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     * 
      * @param d the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -393,10 +400,10 @@
     }
 
     /**
-     * Writes a {@code String} value to this stream. This method ensures that the {@linkplain #position() position}
-     * of this stream is updated correctly with respect to any {@linkplain #LINE_SEPARATOR line separators}
-     * present in {@code s}.
-     *
+     * Writes a {@code String} value to this stream. This method ensures that the
+     * {@linkplain #position() position} of this stream is updated correctly with respect to any
+     * {@linkplain #LINE_SEPARATOR line separators} present in {@code s}.
+     * 
      * @param s the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -427,8 +434,9 @@
     }
 
     /**
-     * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line separator}.
-     *
+     * Writes a {@code String} value to this stream followed by a {@linkplain #LINE_SEPARATOR line
+     * separator}.
+     * 
      * @param s the value to be printed
      * @return this {@link LogStream} instance
      */
@@ -442,7 +450,7 @@
 
     /**
      * Writes a formatted string to this stream.
-     *
+     * 
      * @param format a format string as described in {@link String#format(String, Object...)}
      * @param args the arguments to be formatted
      * @return this {@link LogStream} instance
@@ -456,7 +464,7 @@
 
     /**
      * Writes a {@linkplain #LINE_SEPARATOR line separator} to this stream.
-     *
+     * 
      * @return this {@code LogStream} instance
      */
     public LogStream println() {
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/TTY.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,9 @@
 import java.util.regex.*;
 
 /**
- * A collection of static methods for printing debug and informational output to a global {@link LogStream}.
- * The output can be (temporarily) suppressed per thread through use of a {@linkplain Filter filter}.
+ * A collection of static methods for printing debug and informational output to a global
+ * {@link LogStream}. The output can be (temporarily) suppressed per thread through use of a
+ * {@linkplain Filter filter}.
  */
 public class TTY {
 
@@ -37,20 +38,23 @@
      * Support for thread-local suppression of {@link TTY}.
      */
     public static class Filter {
+
         private LogStream previous;
         private final Thread thread = Thread.currentThread();
 
         /**
-         * Creates an object that will suppress {@link TTY} for the current thread if the given filter does not
-         * match the given object. To revert the suppression state to how it was
+         * Creates an object that will suppress {@link TTY} for the current thread if the given
+         * filter does not match the given object. To revert the suppression state to how it was
          * before this call, the {@link #remove()} method must be called on the suppression object.
-         *
-         * @param filter the pattern for matching. If {@code null}, then the match is successful. If it starts with "~",
-         *            then a regular expression {@linkplain Pattern#matches(String, CharSequence) match} is performed
-         *            where the regular expression is specified by {@code filter} without the "~" prefix. Otherwise, a
-         *            simple {@linkplain String#contains(CharSequence) substring} match is performed where {@code
-         *            filter} is the substring used.
-         * @param object an object whose {@linkplain Object#toString() string} value is matched against {@code filter}
+         * 
+         * @param filter the pattern for matching. If {@code null}, then the match is successful. If
+         *            it starts with "~", then a regular expression
+         *            {@linkplain Pattern#matches(String, CharSequence) match} is performed where
+         *            the regular expression is specified by {@code filter} without the "~" prefix.
+         *            Otherwise, a simple {@linkplain String#contains(CharSequence) substring} match
+         *            is performed where {@code filter} is the substring used.
+         * @param object an object whose {@linkplain Object#toString() string} value is matched
+         *            against {@code filter}
          */
         public Filter(String filter, Object object) {
             boolean suppressed = false;
@@ -69,9 +73,9 @@
         }
 
         /**
-         * Creates an object that will suppress {@link TTY} for the current thread.
-         * To revert the suppression state to how it was before this call, the
-         * {@link #remove()} method must be called on this filter object.
+         * Creates an object that will suppress {@link TTY} for the current thread. To revert the
+         * suppression state to how it was before this call, the {@link #remove()} method must be
+         * called on this filter object.
          */
         public Filter() {
             previous = out();
@@ -79,7 +83,8 @@
         }
 
         /**
-         * Reverts the suppression state of {@link TTY} to how it was before this object was constructed.
+         * Reverts the suppression state of {@link TTY} to how it was before this object was
+         * constructed.
          */
         public void remove() {
             assert thread == Thread.currentThread();
@@ -104,6 +109,7 @@
     }
 
     private static final ThreadLocal<LogStream> out = new ThreadLocal<LogStream>() {
+
         @Override
         protected LogStream initialValue() {
             return createLog();
@@ -116,8 +122,9 @@
 
     /**
      * Gets the thread-local log stream to which the static methods of this class send their output.
-     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink} depending
-     * on whether any suppression {@linkplain Filter filters} are in effect for the current thread.
+     * This will either be a global log stream or the global {@linkplain LogStream#SINK sink}
+     * depending on whether any suppression {@linkplain Filter filters} are in effect for the
+     * current thread.
      */
     public static LogStream out() {
         return out.get();
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java	Fri Feb 01 17:06:26 2013 +0100
@@ -215,7 +215,7 @@
                         return new RuntimeException("Exception while intercepting exception", t);
                     }
                 }
-            }, false, new Object[] {e});
+            }, false, new Object[]{e});
         }
         return null;
     }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,25 +22,9 @@
  */
 package com.oracle.graal.debug.internal;
 
-import java.util.*;
-
-public abstract class DebugValue {
+public abstract class DebugValue implements Comparable<DebugValue> {
 
-    public static final Comparator<DebugValue> ORDER_BY_NAME = new Comparator<DebugValue>() {
-        @Override
-        public int compare(DebugValue o1, DebugValue o2) {
-            // this keeps the "Runs" metric at the top of the list
-            if (o1.getName().equals("Runs")) {
-                return o2.getName().equals("Runs") ? 0 : -1;
-            }
-            if (o2.getName().equals("Runs")) {
-                return o1.getName().equals("Runs") ? 0 : 1;
-            }
-            return o1.getName().compareTo(o2.getName());
-        }
-    };
-
-    private String name;
+    private final String name;
     private int index;
 
     protected DebugValue(String name) {
@@ -64,11 +48,12 @@
         }
     }
 
-    protected void addToCurrentValue(long timeSpan) {
-        setCurrentValue(getCurrentValue() + timeSpan);
+    protected void addToCurrentValue(long value) {
+        setCurrentValue(getCurrentValue() + value);
     }
 
     public int getIndex() {
+        ensureInitialized();
         return index;
     }
 
@@ -76,5 +61,14 @@
         return name;
     }
 
+    public int compareTo(DebugValue o) {
+        return name.compareTo(o.name);
+    }
+
+    @Override
+    public String toString() {
+        return name + "@" + index;
+    }
+
     public abstract String toString(long value);
 }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/KeyRegistry.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 import java.util.*;
 
 public class KeyRegistry {
+
     private static int keyCount;
     private static Map<String, Integer> keyMap = new HashMap<>();
     private static List<DebugValue> debugValues = new ArrayList<>();
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MetricImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/MetricImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,7 +34,7 @@
         add(1);
     }
 
-    public void add(int value) {
+    public void add(long value) {
         if (Debug.isMeterEnabled()) {
             super.addToCurrentValue(value);
         }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerCloseable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerCloseable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,5 +23,6 @@
 package com.oracle.graal.debug.internal;
 
 public interface TimerCloseable extends AutoCloseable {
+
     void close();
 }
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/TimerImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,9 +27,11 @@
 import com.oracle.graal.debug.*;
 
 public final class TimerImpl extends DebugValue implements DebugTimer {
+
     private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
 
     public static final TimerCloseable VOID_CLOSEABLE = new TimerCloseable() {
+
         @Override
         public void close() {
         }
@@ -72,7 +74,8 @@
         return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10);
     }
 
-    private abstract class AbstractTimer  implements TimerCloseable {
+    private abstract class AbstractTimer implements TimerCloseable {
+
         private final long startTime;
         private final long previousValueToSubstract;
 
@@ -93,6 +96,7 @@
     }
 
     private final class SystemNanosTimer extends AbstractTimer {
+
         public SystemNanosTimer(long startTime, long previousValueToSubstract) {
             super(startTime, previousValueToSubstract);
         }
@@ -104,6 +108,7 @@
     }
 
     private final class CpuTimeTimer extends AbstractTimer {
+
         public CpuTimeTimer(long startTime, long previousValueToSubstract) {
             super(startTime, previousValueToSubstract);
         }
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNodeInterface.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TestNodeInterface.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.graph;
 
+public interface TestNodeInterface {
 
-public interface TestNodeInterface {
     String getName();
 }
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,21 +21,23 @@
  * questions.
  */
 package com.oracle.graal.graph;
+
 import static org.junit.Assert.*;
 
 import java.util.*;
 
 import org.junit.*;
 
-
-
 public class TypedNodeIteratorTest {
 
     private static class TestNode extends Node implements Node.IterableNodeType, TestNodeInterface {
+
         private final String name;
+
         public TestNode(String name) {
             this.name = name;
         }
+
         public String getName() {
             return name;
         }
--- a/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest2.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph.test/src/com/oracle/graal/graph/TypedNodeIteratorTest2.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,32 +26,37 @@
 
 import org.junit.*;
 
-
 public class TypedNodeIteratorTest2 {
 
     private static class NodeA extends Node implements TestNodeInterface {
+
         private final String name;
+
         public NodeA(String name) {
             this.name = name;
         }
+
         public String getName() {
             return name;
         }
     }
 
     private static class NodeB extends NodeA implements Node.IterableNodeType {
+
         public NodeB(String name) {
             super(name);
         }
     }
 
     private static class NodeC extends NodeB {
+
         public NodeC(String name) {
             super(name);
         }
     }
 
     private static class NodeD extends NodeC {
+
         public NodeD(String name) {
             super(name);
         }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FieldIntrospection.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/FieldIntrospection.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,6 +21,7 @@
  * questions.
  */
 package com.oracle.graal.graph;
+
 import java.lang.reflect.*;
 import java.util.*;
 import java.util.concurrent.*;
@@ -28,13 +29,16 @@
 public abstract class FieldIntrospection extends UnsafeAccess {
 
     /**
-     * Interface used by {@link #rescanAllFieldOffsets(CalcOffset)} to determine the offset (in bytes) of a field.
+     * Interface used by {@link #rescanAllFieldOffsets(CalcOffset)} to determine the offset (in
+     * bytes) of a field.
      */
     public interface CalcOffset {
+
         long getOffset(Field field);
     }
 
     public static class DefaultCalcOffset implements CalcOffset {
+
         @Override
         public long getOffset(Field field) {
             return unsafe.objectFieldOffset(field);
@@ -61,6 +65,7 @@
     protected abstract void rescanFieldOffsets(CalcOffset calc);
 
     public abstract static class BaseFieldScanner {
+
         private final CalcOffset calc;
 
         /** The offsets of fields that are not specially handled by subclasses. */
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalInternalError.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraalInternalError.java	Fri Feb 01 17:06:26 2013 +0100
@@ -50,12 +50,14 @@
         throw new GraalInternalError("should not reach here: %s", msg);
     }
 
-
     /**
-     * This constructor creates a {@link GraalInternalError} with a message assembled via {@link String#format(String, Object...)}.
-     * It always uses the ENGLISH locale in order to always generate the same output.
+     * This constructor creates a {@link GraalInternalError} with a message assembled via
+     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
+     * always generate the same output.
+     * 
      * @param msg the message that will be associated with the error, in String.format syntax
-     * @param args parameters to String.format - parameters that implement {@link Iterable} will be expanded into a [x, x, ...] representation.
+     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
+     *            expanded into a [x, x, ...] representation.
      */
     public GraalInternalError(String msg, Object... args) {
         super(format(msg, args));
@@ -63,6 +65,7 @@
 
     /**
      * This constructor creates a {@link GraalInternalError} for a given causing Throwable instance.
+     * 
      * @param cause the original exception that contains additional information on this error
      */
     public GraalInternalError(Throwable cause) {
@@ -105,8 +108,11 @@
     }
 
     /**
-     * Adds a graph to the context of this VerificationError. The first graph added via this method will be returned by {@link #graph()}.
-     * @param newGraph the graph which is in a incorrect state, if the verification error was not caused by a specific node
+     * Adds a graph to the context of this VerificationError. The first graph added via this method
+     * will be returned by {@link #graph()}.
+     * 
+     * @param newGraph the graph which is in a incorrect state, if the verification error was not
+     *            caused by a specific node
      */
     public GraalInternalError addContext(Graph newGraph) {
         if (newGraph != this.graph) {
@@ -119,8 +125,11 @@
     }
 
     /**
-     * Adds a node to the context of this VerificationError. The first node added via this method will be returned by {@link #node()}.
-     * @param newNode the node which is in a incorrect state, if the verification error was caused by a node
+     * Adds a node to the context of this VerificationError. The first node added via this method
+     * will be returned by {@link #node()}.
+     * 
+     * @param newNode the node which is in a incorrect state, if the verification error was caused
+     *            by a node
      */
     public GraalInternalError addContext(Node newNode) {
         if (newNode != this.node) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Graph.java	Fri Feb 01 17:06:26 2013 +0100
@@ -88,7 +88,7 @@
 
     /**
      * Creates an empty Graph with a given name.
-     *
+     * 
      * @param name the name of the graph, used for debugging purposes
      */
     public Graph(String name) {
@@ -107,7 +107,7 @@
 
     /**
      * Creates a copy of this graph.
-     *
+     * 
      * @param newName the name of the copy, used for debugging purposes (can be null)
      */
     public Graph copy(String newName) {
@@ -123,7 +123,9 @@
     }
 
     /**
-     * Gets the number of live nodes in this graph. That is the number of nodes which have been added to the graph minus the number of deleted nodes.
+     * Gets the number of live nodes in this graph. That is the number of nodes which have been
+     * added to the graph minus the number of deleted nodes.
+     * 
      * @return the number of live nodes in this graph
      */
     public int getNodeCount() {
@@ -132,6 +134,7 @@
 
     /**
      * Gets the number of node which have been deleted from this graph.
+     * 
      * @return the number of node which have been deleted from this graph
      */
     public int getDeletedNodeCount() {
@@ -140,6 +143,7 @@
 
     /**
      * Adds a new node to the graph.
+     * 
      * @param node the node to be added
      * @return the node which was added to the graph
      */
@@ -149,6 +153,7 @@
     }
 
     public interface InputChangedListener {
+
         void inputChanged(Node node);
     }
 
@@ -161,9 +166,13 @@
     }
 
     /**
-     * Adds a new node to the graph, if a <i>similar</i> node already exists in the graph, the provided node will not be added to the graph but the <i>similar</i> node will be returned instead.
+     * Adds a new node to the graph, if a <i>similar</i> node already exists in the graph, the
+     * provided node will not be added to the graph but the <i>similar</i> node will be returned
+     * instead.
+     * 
      * @param node
-     * @return the node which was added to the graph or a <i>similar</i> which was already in the graph.
+     * @return the node which was added to the graph or a <i>similar</i> which was already in the
+     *         graph.
      */
     @SuppressWarnings("unchecked")
     public <T extends Node & ValueNumberable> T unique(T node) {
@@ -231,6 +240,7 @@
     }
 
     private class NodeIterator implements Iterator<Node> {
+
         private int index;
 
         public NodeIterator() {
@@ -280,11 +290,13 @@
     }
 
     /**
-     * Returns an {@link Iterable} providing all nodes added since the last {@link Graph#getMark() mark}.
+     * Returns an {@link Iterable} providing all nodes added since the last {@link Graph#getMark()
+     * mark}.
      */
     public NodeIterable<Node> getNewNodes(int mark) {
         final int index = mark;
         return new AbstractNodeIterable<Node>() {
+
             @Override
             public Iterator<Node> iterator() {
                 return new NodeIterator(index);
@@ -294,10 +306,12 @@
 
     /**
      * Returns an {@link Iterable} providing all the live nodes.
+     * 
      * @return an {@link Iterable} providing all the live nodes.
      */
     public NodeIterable<Node> getNodes() {
         return new AbstractNodeIterable<Node>() {
+
             @Override
             public Iterator<Node> iterator() {
                 return new NodeIterator();
@@ -310,10 +324,13 @@
         };
     }
 
-    private static class PlaceHolderNode extends Node {}
+    private static class PlaceHolderNode extends Node {
+    }
+
     private static final PlaceHolderNode PLACE_HOLDER = new PlaceHolderNode();
 
     private class TypedNodeIterator<T extends IterableNodeType> implements Iterator<T> {
+
         private final int[] ids;
         private final Node[] current;
 
@@ -412,13 +429,16 @@
     }
 
     /**
-     * Returns an {@link Iterable} providing all the live nodes whose type is compatible with {@code type}.
+     * Returns an {@link Iterable} providing all the live nodes whose type is compatible with
+     * {@code type}.
+     * 
      * @param type the type of node to return
      * @return an {@link Iterable} providing all the matching nodes.
      */
     public <T extends Node & IterableNodeType> NodeIterable<T> getNodes(final Class<T> type) {
         final NodeClass nodeClass = NodeClass.get(type);
         return new AbstractNodeIterable<T>() {
+
             @Override
             public Iterator<T> iterator() {
                 return new TypedNodeIterator<>(nodeClass);
@@ -428,6 +448,7 @@
 
     /**
      * Returns whether the graph contains at least one node of the given type.
+     * 
      * @param type the type of node that is checked for occurrence
      * @return whether there is at least one such node
      */
@@ -543,6 +564,7 @@
 
     /**
      * Returns the number of node ids generated so far.
+     * 
      * @return the number of node ids generated so far
      */
     int nodeIdCount() {
@@ -550,12 +572,12 @@
     }
 
     /**
-     * Adds duplicates of the nodes in {@code nodes} to this graph.
-     * This will recreate any edges between the duplicate nodes. The {@code replacement} map can be used to
-     * replace a node from the source graph by a given node (which must already be in this graph).
-     * Edges between duplicate and replacement nodes will also be recreated so care should be taken
-     * regarding the matching of node types in the replacement map.
-     *
+     * Adds duplicates of the nodes in {@code nodes} to this graph. This will recreate any edges
+     * between the duplicate nodes. The {@code replacement} map can be used to replace a node from
+     * the source graph by a given node (which must already be in this graph). Edges between
+     * duplicate and replacement nodes will also be recreated so care should be taken regarding the
+     * matching of node types in the replacement map.
+     * 
      * @param newNodes the nodes to be duplicated
      * @param replacementsMap the replacement map (can be null if no replacement is to be performed)
      * @return a map which associates the original nodes from {@code nodes} to their duplicates
@@ -571,14 +593,18 @@
     }
 
     public interface DuplicationReplacement {
+
         Node replacement(Node original);
     }
 
     private static final class MapReplacement implements DuplicationReplacement {
+
         private final Map<Node, Node> map;
+
         public MapReplacement(Map<Node, Node> map) {
             this.map = map;
         }
+
         @Override
         public Node replacement(Node original) {
             Node replacement = map.get(original);
@@ -588,6 +614,7 @@
     }
 
     private static final DuplicationReplacement NO_REPLACEMENT = new DuplicationReplacement() {
+
         @Override
         public Node replacement(Node original) {
             return original;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEvent.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEvent.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.graph;
 
-
 public abstract class GraphEvent {
 
     private Exception exceptionContext;
@@ -30,9 +29,7 @@
     public static class NodeEvent extends GraphEvent {
 
         public static enum Type {
-            ADDED,
-            DELETED,
-            CHANGED
+            ADDED, DELETED, CHANGED
         }
 
         public final Node node;
@@ -55,8 +52,7 @@
     public static class EdgeEvent extends GraphEvent {
 
         public static enum Type {
-            INPUT,
-            SUCC
+            INPUT, SUCC
         }
 
         public final Node node;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEventLog.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/GraphEventLog.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-
 public class GraphEventLog {
 
     private List<GraphEvent> events = new ArrayList<>();
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,21 +29,25 @@
 import com.oracle.graal.graph.NodeClass.*;
 import com.oracle.graal.graph.iterators.*;
 
-
 /**
- * This class is the base class for all nodes, it represent a node which can be inserted in a {@link Graph}.<br>
- * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the subclasses are represented
- * with annotated fields. There are two kind of edges : {@link Input} and {@link Successor}. If a field, of a type
- * compatible with {@link Node}, annotated with either {@link Input} and {@link Successor} is not null, then there is an
- * edge from this node to the node this field points to.<br>
+ * This class is the base class for all nodes, it represent a node which can be inserted in a
+ * {@link Graph}.
+ * <p>
+ * Once a node has been added to a graph, it has a graph-unique {@link #id()}. Edges in the
+ * subclasses are represented with annotated fields. There are two kind of edges : {@link Input} and
+ * {@link Successor}. If a field, of a type compatible with {@link Node}, annotated with either
+ * {@link Input} and {@link Successor} is not null, then there is an edge from this node to the node
+ * this field points to.
+ * <p>
  * Nodes which are be value numberable should implement the {@link ValueNumberable} interface.
- *
+ * 
  * <h1>Assertions and Verification</h1>
- *
+ * 
  * The Node class supplies the {@link #assertTrue(boolean, String, Object...)} and
- * {@link #assertFalse(boolean, String, Object...)} methods, which will check the supplied boolean and throw a
- * VerificationError if it has the wrong value. Both methods will always either throw an exception or return true.
- * They can thus be used within an assert statement, so that the check is only performed if assertions are enabled.
+ * {@link #assertFalse(boolean, String, Object...)} methods, which will check the supplied boolean
+ * and throw a VerificationError if it has the wrong value. Both methods will always either throw an
+ * exception or return true. They can thus be used within an assert statement, so that the check is
+ * only performed if assertions are enabled.
  */
 public abstract class Node implements Cloneable, Formattable {
 
@@ -52,64 +56,69 @@
     static final int ALIVE_ID_START = 0;
 
     /**
-     * Denotes a node input. This should be applied to exactly the fields of a node that are of type {@link Node}.
-     * Nodes that update their inputs outside of their constructor should call {@link Node#updateUsages(Node, Node)}
-     * just prior to doing the update of the input.
+     * Denotes a node input. This should be applied to exactly the fields of a node that are of type
+     * {@link Node}. Nodes that update their inputs outside of their constructor should call
+     * {@link Node#updateUsages(Node, Node)} just prior to doing the update of the input.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public static @interface Input {
+
         boolean notDataflow() default false;
     }
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
-    public static @interface Successor {}
+    public static @interface Successor {
+    }
 
     /**
-     * Denotes that a parameter of an {@linkplain NodeIntrinsic intrinsic} method
-     * must be a compile time constant at all call sites to the intrinic method.
+     * Denotes that a parameter of an {@linkplain NodeIntrinsic intrinsic} method must be a compile
+     * time constant at all call sites to the intrinic method.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.PARAMETER)
-    public static @interface ConstantNodeParameter {}
+    public static @interface ConstantNodeParameter {
+    }
 
     /**
-     * Annotates a method that can be replaced by a compiler intrinsic.
-     * A (resolved) call to the annotated method can be replaced
-     * with an instance of the node class denoted by {@link #value()}.
-     * For this reason, the signature of the annotated method must match
-     * the signature of a constructor in the node class.
+     * Annotates a method that can be replaced by a compiler intrinsic. A (resolved) call to the
+     * annotated method can be replaced with an instance of the node class denoted by
+     * {@link #value()}. For this reason, the signature of the annotated method must match the
+     * signature of a constructor in the node class.
      * <p>
-     * All methods annotated with this annotation must be declared native
-     * to ensure they throw a {@link UnsatisfiedLinkError} if called by
-     * non-Graal compiled code.
+     * All methods annotated with this annotation must be declared native to ensure they throw a
+     * {@link UnsatisfiedLinkError} if called by non-Graal compiled code.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.METHOD)
     public static @interface NodeIntrinsic {
+
         /**
-         * Gets the {@link Node} subclass instantiated when intrinsifying a call to the annotated method.
-         * If not specified, then the class in which the annotated method is declared is used
-         * (and is assumed to be a {@link Node} subclass).
+         * Gets the {@link Node} subclass instantiated when intrinsifying a call to the annotated
+         * method. If not specified, then the class in which the annotated method is declared is
+         * used (and is assumed to be a {@link Node} subclass).
          */
         Class value() default NodeIntrinsic.class;
 
         /**
-         * Determines if the stamp of the instantiated intrinsic node has its stamp set
-         * from the return type of the annotated method.
+         * Determines if the stamp of the instantiated intrinsic node has its stamp set from the
+         * return type of the annotated method.
          */
         boolean setStampFromReturnType() default false;
     }
 
-    public interface ValueNumberable {}
+    public interface ValueNumberable {
+    }
 
-    public interface IterableNodeType {}
+    public interface IterableNodeType {
+    }
 
     private Graph graph;
     int id;
 
-    // this next pointer is used in Graph to implement fast iteration over NodeClass types, it therefore points to the next Node of the same type.
+    // this next pointer is used in Graph to implement fast iteration over NodeClass types, it
+    // therefore points to the next Node of the same type.
     Node typeCacheNext;
 
     private NodeUsagesList usages;
@@ -132,7 +141,9 @@
     }
 
     /**
-     * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null input edges of this node.
+     * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null
+     * input edges of this node.
+     * 
      * @return an {@link NodeClassIterable iterable} for all non-null input edges.
      */
     public NodeClassIterable inputs() {
@@ -140,7 +151,9 @@
     }
 
     /**
-     * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null successor edges of this node.
+     * Returns an {@link NodeClassIterable iterable} which can be used to traverse all non-null
+     * successor edges of this node.
+     * 
      * @return an {@link NodeClassIterable iterable} for all non-null successor edges.
      */
     public NodeClassIterable successors() {
@@ -172,8 +185,8 @@
     }
 
     /**
-     * Updates the usages sets of the given nodes after an input slot is changed from oldInput to newInput:
-     * removes this node from oldInput's usages and adds this node to newInput's usages.
+     * Updates the usages sets of the given nodes after an input slot is changed from oldInput to
+     * newInput: removes this node from oldInput's usages and adds this node to newInput's usages.
      */
     protected void updateUsages(Node oldInput, Node newInput) {
         assert assertTrue(usages != null, "usages == null while adding %s to %s", newInput, this);
@@ -193,8 +206,9 @@
     }
 
     /**
-     * Updates the predecessor of the given nodes after a successor slot is changed from oldSuccessor to newSuccessor:
-     * removes this node from oldSuccessor's predecessors and adds this node to newSuccessor's predecessors.
+     * Updates the predecessor of the given nodes after a successor slot is changed from
+     * oldSuccessor to newSuccessor: removes this node from oldSuccessor's predecessors and adds
+     * this node to newSuccessor's predecessors.
      */
     protected void updatePredecessor(Node oldSuccessor, Node newSuccessor) {
         assert assertTrue(usages != null, "usages == null while adding %s to %s", newSuccessor, this);
@@ -227,11 +241,9 @@
         return nodeClass;
     }
 
-    // TODO (thomaswue): Do not allow to replace with null.
     private boolean checkReplaceWith(Node other) {
         assert assertFalse(other == this, "cannot replace a node with itself");
         assert assertFalse(isDeleted(), "cannot replace deleted node");
-//        assert assertTrue(other != null, "cannot replace with null node");
         assert assertTrue(other == null || !other.isDeleted(), "cannot replace with deleted node %s", other);
         assert assertTrue(other == null || other.graph() == graph, "cannot replace with node in different graph: %s", other == null ? null : other.graph());
         return true;
@@ -318,8 +330,8 @@
     }
 
     /**
-     * Removes this node from its graph.
-     * This node must have no {@linkplain Node#usages() usages} and no {@linkplain #predecessor() predecessor}.
+     * Removes this node from its graph. This node must have no {@linkplain Node#usages() usages}
+     * and no {@linkplain #predecessor() predecessor}.
      */
     public void safeDelete() {
         assert checkDeletion();
@@ -406,16 +418,18 @@
     }
 
     /**
-     * Returns an iterator that will provide all control-flow successors of this node. Normally this will be the contents of all fields marked as NodeSuccessor,
-     * but some node classes (like EndNode) may return different nodes.
-     * Note that the iterator may generate null values if the fields contain them.
+     * Returns an iterator that will provide all control-flow successors of this node. Normally this
+     * will be the contents of all fields marked as NodeSuccessor, but some node classes (like
+     * EndNode) may return different nodes. Note that the iterator may generate null values if the
+     * fields contain them.
      */
     public Iterable<? extends Node> cfgSuccessors() {
         return successors();
     }
 
     /**
-     * hashCode and equals should always rely on object identity alone, thus hashCode and equals are final.
+     * hashCode and equals should always rely on object identity alone, thus hashCode and equals are
+     * final.
      */
     @Override
     public final int hashCode() {
@@ -423,7 +437,8 @@
     }
 
     /**
-     * hashCode and equals should always rely on object identity alone, thus hashCode and equals are final.
+     * hashCode and equals should always rely on object identity alone, thus hashCode and equals are
+     * final.
      */
     @Override
     public final boolean equals(Object obj) {
@@ -431,17 +446,18 @@
     }
 
     /**
-     * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the ideal graph
-     * visualizer).
+     * Provides a {@link Map} of properties of this node for use in debugging (e.g., to view in the
+     * ideal graph visualizer).
      */
     public Map<Object, Object> getDebugProperties() {
         return getDebugProperties(new HashMap<>());
     }
 
-
     /**
-     * Fills a {@link Map} with properties of this node for use in debugging (e.g., to view in the ideal graph
-     * visualizer). Subclasses overriding this method should also fill the map using their superclass.
+     * Fills a {@link Map} with properties of this node for use in debugging (e.g., to view in the
+     * ideal graph visualizer). Subclasses overriding this method should also fill the map using
+     * their superclass.
+     * 
      * @param map
      */
     public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
@@ -463,7 +479,8 @@
          */
         Id,
         /**
-         * Only the name of the node, which may contain some more information for certain node types (constants, ...).
+         * Only the name of the node, which may contain some more information for certain node types
+         * (constants, ...).
          */
         Name,
         /**
@@ -512,7 +529,6 @@
         }
     }
 
-
     @Deprecated
     public int getId() {
         return id;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeBitMap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,6 +27,7 @@
 import com.oracle.graal.graph.iterators.*;
 
 public final class NodeBitMap extends AbstractNodeIterable<Node> {
+
     private final boolean autoGrow;
     private final BitSet bitMap;
     private final Graph graph;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,6 +21,7 @@
  * questions.
  */
 package com.oracle.graal.graph;
+
 import java.lang.reflect.*;
 import java.util.*;
 import java.util.Map.Entry;
@@ -67,7 +68,6 @@
     private final int iterableId;
     private int[] iterableIds;
 
-
     public NodeClass(Class<?> clazz) {
         super(clazz);
         assert NODE_CLASS.isAssignableFrom(clazz);
@@ -175,6 +175,7 @@
     }
 
     protected static class FieldScanner extends BaseFieldScanner {
+
         public final ArrayList<Long> inputOffsets = new ArrayList<>();
         public final ArrayList<Long> inputListOffsets = new ArrayList<>();
         public final ArrayList<Long> successorOffsets = new ArrayList<>();
@@ -213,7 +214,6 @@
         }
     }
 
-
     @Override
     public String toString() {
         StringBuilder str = new StringBuilder();
@@ -235,10 +235,12 @@
 
     /**
      * Describes an edge slot for a {@link NodeClass}.
+     * 
      * @see NodeClass#get(Node, Position)
      * @see NodeClass#getName(Position)
      */
     public static final class Position {
+
         public final boolean input;
         public final int index;
         public final int subIndex;
@@ -319,14 +321,14 @@
     }
 
     /**
-     * An iterator that will iterate over the fields given in {@link #offsets}.
-     * The first {@link #directCount} offsets are treated as fields of type {@link Node},
-     * while the rest of the fields are treated as {@link NodeList}s.
-     * All elements of these NodeLists will be visited by the iterator as well.
-     * This iterator can be used to iterate over the inputs or successors of a node.
-     *
-     * An iterator of this type will not return null values, unless the field values are modified concurrently.
-     * Concurrent modifications are detected by an assertion on a best-effort basis.
+     * An iterator that will iterate over the fields given in {@link #offsets}. The first
+     * {@link #directCount} offsets are treated as fields of type {@link Node}, while the rest of
+     * the fields are treated as {@link NodeList}s. All elements of these NodeLists will be visited
+     * by the iterator as well. This iterator can be used to iterate over the inputs or successors
+     * of a node.
+     * 
+     * An iterator of this type will not return null values, unless the field values are modified
+     * concurrently. Concurrent modifications are detected by an assertion on a best-effort basis.
      */
     public static final class NodeClassIterator implements Iterator<Node> {
 
@@ -339,9 +341,11 @@
 
         /**
          * Creates an iterator that will iterate over fields in the given node.
+         * 
          * @param node the node which contains the fields.
          * @param offsets the offsets of the fields.
-         * @param directCount the number of fields that should be treated as fields of type {@link Node}, the rest are treated as {@link NodeList}s.
+         * @param directCount the number of fields that should be treated as fields of type
+         *            {@link Node}, the rest are treated as {@link NodeList}s.
          */
         private NodeClassIterator(Node node, long[] offsets, int directCount) {
             this.node = node;
@@ -382,7 +386,7 @@
         private Node nextElement() {
             if (index < directCount) {
                 return getNode(node, offsets[index]);
-            } else  if (index < offsets.length) {
+            } else if (index < offsets.length) {
                 NodeList<Node> list = getNodeList(node, offsets[index]);
                 return list.get(subIndex);
             }
@@ -432,7 +436,7 @@
         if (canGVN) {
             number = startGVNNumber;
             for (int i = 0; i < dataOffsets.length; ++i) {
-                Class< ? > type = dataTypes[i];
+                Class<?> type = dataTypes[i];
                 if (type.isPrimitive()) {
                     if (type == Integer.TYPE) {
                         int intValue = unsafe.getInt(n, dataOffsets[i]);
@@ -462,7 +466,7 @@
 
     /**
      * Populates a given map with the names and values of all data fields.
-     *
+     * 
      * @param node the node from which to take the values.
      * @param properties a map that will be populated.
      */
@@ -567,7 +571,7 @@
     public void set(Node node, Position pos, Node x) {
         long offset = pos.input ? inputOffsets[pos.index] : successorOffsets[pos.index];
         if (pos.subIndex == NOT_ITERABLE) {
-            Node old = getNode(node,  offset);
+            Node old = getNode(node, offset);
             assert x == null || fieldTypes.get((pos.input ? inputOffsets : successorOffsets)[pos.index]).isAssignableFrom(x.getClass()) : this + ".set(node, pos, " + x + ")";
             putNode(node, offset, x);
             if (pos.input) {
@@ -607,6 +611,7 @@
     public NodeClassIterable getSuccessorIterable(final Node node) {
         assert clazz.isInstance(node);
         return new NodeClassIterable() {
+
             @Override
             public NodeClassIterator iterator() {
                 return new NodeClassIterator(node, successorOffsets, directSuccessorCount);
@@ -624,7 +629,8 @@
         while (index < directInputCount) {
             Node input = getNode(node, inputOffsets[index]);
             if (input == old) {
-                assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) + " in " + node;
+                assert other == null || fieldTypes.get(inputOffsets[index]).isAssignableFrom(other.getClass()) : "Can not assign " + other.getClass() + " to " + fieldTypes.get(inputOffsets[index]) +
+                                " in " + node;
                 putNode(node, inputOffsets[index], other);
                 return true;
             }
@@ -646,7 +652,12 @@
         while (index < directSuccessorCount) {
             Node successor = getNode(node, successorOffsets[index]);
             if (successor == old) {
-                assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()); // : successorTypes[index] + " is not compatible with " + other.getClass();
+                assert other == null || fieldTypes.get(successorOffsets[index]).isAssignableFrom(other.getClass()); // :
+                                                                                                                    // successorTypes[index]
+                                                                                                                    // +
+                                                                                                                    // " is not compatible with "
+                                                                                                                    // +
+                                                                                                                    // other.getClass();
                 putNode(node, successorOffsets[index], other);
                 return true;
             }
@@ -664,8 +675,10 @@
     }
 
     /**
-     * Clear all inputs in the given node. This is accomplished by setting input fields to null and replacing input lists with new lists.
-     * (which is important so that this method can be used to clear the inputs of cloned nodes.)
+     * Clear all inputs in the given node. This is accomplished by setting input fields to null and
+     * replacing input lists with new lists. (which is important so that this method can be used to
+     * clear the inputs of cloned nodes.)
+     * 
      * @param node the node to be cleared
      */
     public void clearInputs(Node node) {
@@ -682,8 +695,10 @@
     }
 
     /**
-     * Clear all successors in the given node. This is accomplished by setting successor fields to null and replacing successor lists with new lists.
-     * (which is important so that this method can be used to clear the successors of cloned nodes.)
+     * Clear all successors in the given node. This is accomplished by setting successor fields to
+     * null and replacing successor lists with new lists. (which is important so that this method
+     * can be used to clear the successors of cloned nodes.)
+     * 
      * @param node the node to be cleared
      */
     public void clearSuccessors(Node node) {
@@ -700,7 +715,9 @@
     }
 
     /**
-     * Copies the inputs from node to newNode. The nodes are expected to be of the exact same NodeClass type.
+     * Copies the inputs from node to newNode. The nodes are expected to be of the exact same
+     * NodeClass type.
+     * 
      * @param node the node from which the inputs should be copied.
      * @param newNode the node to which the inputs should be copied.
      */
@@ -720,7 +737,9 @@
     }
 
     /**
-     * Copies the successors from node to newNode. The nodes are expected to be of the exact same NodeClass type.
+     * Copies the successors from node to newNode. The nodes are expected to be of the exact same
+     * NodeClass type.
+     * 
      * @param node the node from which the successors should be copied.
      * @param newNode the node to which the successors should be copied.
      */
@@ -835,8 +854,8 @@
     }
 
     /**
-     * The template used to build the {@link Verbosity#Name} version.
-     * Variable part are specified using &#123;i#inputName&#125; or &#123;p#propertyName&#125;.
+     * The template used to build the {@link Verbosity#Name} version. Variable part are specified
+     * using &#123;i#inputName&#125; or &#123;p#propertyName&#125;.
      */
     public String getNameTemplate() {
         return nameTemplate;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClassIterable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,9 +27,11 @@
 import com.oracle.graal.graph.iterators.*;
 
 /**
- * The iterator returned by this iterable can be used to access {@link Position Positions} during iteration using {@link NodeClassIterator#nextPosition()}.
+ * The iterator returned by this iterable can be used to access {@link Position Positions} during
+ * iteration using {@link NodeClassIterator#nextPosition()}.
  */
 public abstract class NodeClassIterable extends AbstractNodeIterable<Node> {
+
     @Override
     public abstract NodeClassIterator iterator();
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeFlood.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import java.util.Iterator;
 import java.util.Queue;
 
+public class NodeFlood implements Iterable<Node> {
 
-public class NodeFlood implements Iterable<Node> {
     private final NodeBitMap visited;
     private final Queue<Node> worklist;
 
@@ -58,6 +58,7 @@
     }
 
     private static class QueueConsumingIterator implements Iterator<Node> {
+
         private final Queue<Node> queue;
 
         public QueueConsumingIterator(Queue<Node> queue) {
@@ -86,6 +87,7 @@
     }
 
     private static class UnmarkedNodeIterator implements Iterator<Node> {
+
         private final NodeBitMap visited;
         private Iterator<Node> nodes;
         private Node nextNode;
@@ -128,6 +130,7 @@
 
     public Iterable<Node> unmarkedNodes() {
         return new Iterable<Node>() {
+
             @Override
             public Iterator<Node> iterator() {
                 return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator());
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,14 +29,15 @@
 
 import com.oracle.graal.graph.Node.*;
 
-
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
 public @interface NodeInfo {
+
     String shortName() default "";
+
     /**
-     * The template used to build the {@link Verbosity#Name} version.
-     * Variable part are specified using &#123;i#inputName&#125; or &#123;p#propertyName&#125;.
+     * The template used to build the {@link Verbosity#Name} version. Variable part are specified
+     * using &#123;i#inputName&#125; or &#123;p#propertyName&#125;.
      */
     String nameTemplate() default "";
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeInputList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import java.util.*;
 
-
 public final class NodeInputList<T extends Node> extends NodeList<T> {
 
     private final Node self;
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,6 +21,7 @@
  * questions.
  */
 package com.oracle.graal.graph;
+
 import java.util.*;
 
 import com.oracle.graal.graph.iterators.*;
@@ -215,6 +216,7 @@
     @Override
     public Iterator<T> iterator() {
         return new Iterator<T>() {
+
             private final int expectedModCount = NodeList.this.modCount;
             private int index = 0;
 
@@ -306,19 +308,18 @@
         return -1;
     }
 
-
     @Override
     public boolean contains(Object o) {
         return indexOf(o) != -1;
     }
 
     @Override
-    public boolean containsAll(Collection< ? > c) {
+    public boolean containsAll(Collection<?> c) {
         throw new UnsupportedOperationException("not implemented");
     }
 
     @Override
-    public boolean addAll(Collection< ? extends T> c) {
+    public boolean addAll(Collection<? extends T> c) {
         for (T e : c) {
             add(e);
         }
@@ -350,31 +351,38 @@
     public NodeIterable<T> until(final T u) {
         return new FilteredNodeIterable<>(this).until(u);
     }
+
     @Override
     public NodeIterable<T> until(final Class<? extends T> clazz) {
         return new FilteredNodeIterable<>(this).until(clazz);
     }
+
     @Override
     @SuppressWarnings("unchecked")
     public <F extends T> NodeIterable<F> filter(Class<F> clazz) {
         return (NodeIterable<F>) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz));
     }
+
     @Override
     public NodeIterable<T> filterInterface(Class<?> iface) {
         return new FilteredNodeIterable<>(this).and(NodePredicates.isAInterface(iface));
     }
+
     @Override
     public FilteredNodeIterable<T> filter(NodePredicate predicate) {
         return new FilteredNodeIterable<>(this).and(predicate);
     }
+
     @Override
     public FilteredNodeIterable<T> nonNull() {
         return new FilteredNodeIterable<>(this).and(NodePredicates.isNotNull());
     }
+
     @Override
     public NodeIterable<T> distinct() {
         return new FilteredNodeIterable<>(this).distinct();
     }
+
     @Override
     public T first() {
         if (size() > 0) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeMap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeMap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import java.util.*;
 import java.util.Map.Entry;
 
+public final class NodeMap<T> {
 
-public final class NodeMap<T> {
     private final Graph graph;
     private Object[] values;
     private int size;
@@ -67,15 +67,6 @@
         return node.id() >= size;
     }
 
-    public void grow(Node upTo) {
-        if (isNew(upTo)) {
-            size = upTo.id() + 1;
-            if (values.length < size) {
-                values = Arrays.copyOf(values, size + 9); // TODO implement a better growth policy
-            }
-        }
-    }
-
     private void check(Node node) {
         assert node.graph() == graph : "this node is not part of the graph";
         assert !isNew(node) : "this node was added to the graph after creating the node map : " + node;
@@ -83,10 +74,13 @@
 
     public Iterable<Entry<Node, T>> entries() {
         return new Iterable<Entry<Node, T>>() {
+
             @Override
             public Iterator<Entry<Node, T>> iterator() {
                 return new Iterator<Entry<Node, T>>() {
+
                     int i = 0;
+
                     @Override
                     public boolean hasNext() {
                         forward();
@@ -101,8 +95,10 @@
                         T value = (T) NodeMap.this.values[pos];
                         i++;
                         forward();
-                        return new SimpleEntry<Node, T>(key, value){
+                        return new SimpleEntry<Node, T>(key, value) {
+
                             private static final long serialVersionUID = 7813842391085737738L;
+
                             @Override
                             public T setValue(T v) {
                                 T oldv = super.setValue(v);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUsagesList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeUsagesList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -62,6 +62,7 @@
     @Override
     public Iterator<Node> iterator() {
         return new Iterator<Node>() {
+
             private final int expectedModCount = NodeUsagesList.this.modCount;
             private int index = 0;
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeWorkList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
 import java.util.Queue;
 
 public class NodeWorkList implements Iterable<Node> {
+
     private final NodeBitMap visited;
     private final NodeBitMap inQueue;
     private final Queue<Node> worklist;
@@ -139,6 +140,7 @@
     }
 
     private class QueueConsumingIterator implements Iterator<Node> {
+
         private final Queue<Node> queue;
 
         public QueueConsumingIterator(Queue<Node> queue) {
@@ -184,6 +186,7 @@
     }
 
     private static class UnmarkedNodeIterator implements Iterator<Node> {
+
         private final NodeBitMap visited;
         private Iterator<Node> nodes;
         private Node nextNode;
@@ -227,6 +230,7 @@
 
     public Iterable<Node> unmarkedNodes() {
         return new Iterable<Node>() {
+
             @Override
             public Iterator<Node> iterator() {
                 return new UnmarkedNodeIterator(visited, visited.graph().getNodes().iterator());
@@ -235,10 +239,13 @@
     }
 
     public static class InfiniteWorkException extends RuntimeException {
+
         private static final long serialVersionUID = -5319329402219396658L;
+
         public InfiniteWorkException() {
             super();
         }
+
         public InfiniteWorkException(String message) {
             super(message);
         }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/VerificationError.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,19 +22,22 @@
  */
 package com.oracle.graal.graph;
 
-
 /**
- * This error represents a failed verification of a node . It must only be used for conditions that should never occur during normal operation.
+ * This error represents a failed verification of a node . It must only be used for conditions that
+ * should never occur during normal operation.
  */
 public class VerificationError extends GraalInternalError {
 
     private static final long serialVersionUID = 8459607567446819822L;
 
     /**
-     * This constructor creates a {@link VerificationError} with a message assembled via {@link String#format(String, Object...)}.
-     * It always uses the ENGLISH locale in order to always generate the same output.
+     * This constructor creates a {@link VerificationError} with a message assembled via
+     * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to
+     * always generate the same output.
+     * 
      * @param msg the message that will be associated with the error, in String.format syntax
-     * @param args parameters to String.format - parameters that implement {@link Iterable} will be expanded into a [x, x, ...] representation.
+     * @param args parameters to String.format - parameters that implement {@link Iterable} will be
+     *            expanded into a [x, x, ...] representation.
      */
     public VerificationError(String msg, Object... args) {
         super(msg, args);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,35 +27,43 @@
 import com.oracle.graal.graph.*;
 
 public abstract class AbstractNodeIterable<T extends Node> implements NodeIterable<T> {
+
     @Override
     public NodeIterable<T> until(final T u) {
         return new FilteredNodeIterable<>(this).until(u);
     }
+
     @Override
     public NodeIterable<T> until(final Class<? extends T> clazz) {
         return new FilteredNodeIterable<>(this).until(clazz);
     }
+
     @Override
     @SuppressWarnings("unchecked")
     public <F extends T> NodeIterable<F> filter(Class<F> clazz) {
         return (NodeIterable<F>) new FilteredNodeIterable<>(this).and(NodePredicates.isA(clazz));
     }
+
     @Override
     public NodeIterable<T> filterInterface(Class<?> iface) {
         return new FilteredNodeIterable<>(this).and(NodePredicates.isAInterface(iface));
     }
+
     @Override
     public FilteredNodeIterable<T> filter(NodePredicate predicate) {
         return new FilteredNodeIterable<>(this).and(predicate);
     }
+
     @Override
     public FilteredNodeIterable<T> nonNull() {
         return new FilteredNodeIterable<>(this).and(NodePredicates.isNotNull());
     }
+
     @Override
     public NodeIterable<T> distinct() {
         return new FilteredNodeIterable<>(this).distinct();
     }
+
     @Override
     public List<T> snapshot() {
         ArrayList<T> list = new ArrayList<>();
@@ -64,12 +72,14 @@
         }
         return list;
     }
+
     @Override
     public void snapshotTo(List<T> to) {
         for (T n : this) {
             to.add(n);
         }
     }
+
     @Override
     public T first() {
         Iterator<T> iterator = iterator();
@@ -78,6 +88,7 @@
         }
         return null;
     }
+
     @Override
     public int count() {
         int count = 0;
@@ -88,14 +99,17 @@
         }
         return count;
     }
+
     @Override
     public boolean isEmpty() {
         return !iterator().hasNext();
     }
+
     @Override
     public boolean isNotEmpty() {
         return iterator().hasNext();
     }
+
     @Override
     public boolean contains(T node) {
         return this.filter(NodePredicates.equals(node)).isNotEmpty();
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctFilteredNodeIterable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 
 import com.oracle.graal.graph.*;
 
-
 public class DistinctFilteredNodeIterable<T extends Node> extends FilteredNodeIterable<T> {
 
     public DistinctFilteredNodeIterable(NodeIterable<T> nodeIterable) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/DistinctPredicatedProxyNodeIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 
 import com.oracle.graal.graph.*;
 
+public class DistinctPredicatedProxyNodeIterator<T extends Node> extends PredicatedProxyNodeIterator<T> {
 
-public class DistinctPredicatedProxyNodeIterator<T extends Node> extends PredicatedProxyNodeIterator<T> {
     private NodeBitMap visited;
 
     public DistinctPredicatedProxyNodeIterator(NodePredicate until, Iterator<T> iterator, NodePredicate predicate) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/FilteredNodeIterable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/FilteredNodeIterable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,35 +27,43 @@
 import com.oracle.graal.graph.*;
 
 public class FilteredNodeIterable<T extends Node> extends AbstractNodeIterable<T> {
+
     protected final NodeIterable<T> nodeIterable;
     protected NodePredicate predicate = NodePredicates.alwaysTrue();
     protected NodePredicate until = NodePredicates.isNull();
+
     public FilteredNodeIterable(NodeIterable<T> nodeIterable) {
         this.nodeIterable = nodeIterable;
     }
+
     public FilteredNodeIterable<T> and(NodePredicate nodePredicate) {
         this.predicate = this.predicate.and(nodePredicate);
         return this;
     }
+
     public FilteredNodeIterable<T> or(NodePredicate nodePredicate) {
         this.predicate = this.predicate.or(nodePredicate);
         return this;
     }
+
     @Override
     public NodeIterable<T> until(final T u) {
         until = until.or(NodePredicates.equals(u));
         return this;
     }
+
     @Override
     public NodeIterable<T> until(final Class<? extends T> clazz) {
         until = until.or(NodePredicates.isA(clazz));
         return this;
     }
+
     @Override
     public FilteredNodeIterable<T> nonNull() {
         this.predicate = this.predicate.and(NodePredicates.isNotNull());
         return this;
     }
+
     @Override
     public DistinctFilteredNodeIterable<T> distinct() {
         DistinctFilteredNodeIterable<T> distinct = new DistinctFilteredNodeIterable<>(nodeIterable);
@@ -63,6 +71,7 @@
         distinct.until = until;
         return distinct;
     }
+
     @Override
     public Iterator<T> iterator() {
         return new PredicatedProxyNodeIterator<>(until, nodeIterable.iterator(), predicate);
@@ -80,7 +89,7 @@
     }
 
     @Override
-    public FilteredNodeIterable<T> filterInterface(Class< ? > iface) {
+    public FilteredNodeIterable<T> filterInterface(Class<?> iface) {
         return this.and(NodePredicates.isAInterface(iface));
     }
 }
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,11 +30,11 @@
 
     NodeIterable<T> until(T u);
 
-    NodeIterable<T> until(Class< ? extends T> clazz);
+    NodeIterable<T> until(Class<? extends T> clazz);
 
     <F extends T> NodeIterable<F> filter(Class<F> clazz);
 
-    NodeIterable<T> filterInterface(Class< ? > iface);
+    NodeIterable<T> filterInterface(Class<?> iface);
 
     FilteredNodeIterable<T> filter(NodePredicate predicate);
 
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,14 +26,18 @@
 
 import com.oracle.graal.graph.*;
 
-public abstract class NodeIterator<T extends Node> implements Iterator<T>{
+public abstract class NodeIterator<T extends Node> implements Iterator<T> {
+
     protected T current;
+
     protected abstract void forward();
+
     @Override
     public boolean hasNext() {
         forward();
         return current != null;
     }
+
     @Override
     public T next() {
         forward();
@@ -44,6 +48,7 @@
         current = null;
         return ret;
     }
+
     @Override
     public void remove() {
         throw new UnsupportedOperationException();
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicates.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodePredicates.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 import com.oracle.graal.graph.*;
 
 public abstract class NodePredicates {
+
     private static final TautologyPredicate TAUTOLOGY = new TautologyPredicate();
     private static final FalsePredicate FALSE = new FalsePredicate();
     private static final IsNullPredicate IS_NULL = new IsNullPredicate();
@@ -126,6 +127,7 @@
     }
 
     private static final class TautologyPredicate extends NodePredicate {
+
         @Override
         public boolean apply(Node n) {
             return true;
@@ -133,6 +135,7 @@
     }
 
     private static final class FalsePredicate extends NodePredicate {
+
         @Override
         public boolean apply(Node n) {
             return false;
@@ -140,12 +143,15 @@
     }
 
     private static final class AndPredicate extends NodePredicate {
+
         private final NodePredicate a;
         private final NodePredicate b;
+
         private AndPredicate(NodePredicate a, NodePredicate b) {
             this.a = a;
             this.b = b;
         }
+
         @Override
         public boolean apply(Node n) {
             return a.apply(n) && b.apply(n);
@@ -153,10 +159,13 @@
     }
 
     private static final class NotPredicate extends NodePredicate {
+
         private final NodePredicate a;
+
         private NotPredicate(NodePredicate n) {
             this.a = n;
         }
+
         @Override
         public boolean apply(Node n) {
             return !a.apply(n);
@@ -164,12 +173,15 @@
     }
 
     private static final class OrPredicate extends NodePredicate {
+
         private final NodePredicate a;
         private final NodePredicate b;
+
         private OrPredicate(NodePredicate a, NodePredicate b) {
             this.a = a;
             this.b = b;
         }
+
         @Override
         public boolean apply(Node n) {
             return a.apply(n) || b.apply(n);
@@ -177,6 +189,7 @@
     }
 
     private static final class IsNullPredicate extends NodePredicate {
+
         @Override
         public boolean apply(Node n) {
             return n == null;
@@ -184,6 +197,7 @@
     }
 
     private static final class IsNotNullPredicate extends NodePredicate {
+
         @Override
         public boolean apply(Node n) {
             return n != null;
@@ -191,10 +205,13 @@
     }
 
     private static final class EqualsPredicate extends NodePredicate {
+
         private final Node u;
+
         public EqualsPredicate(Node u) {
             this.u = u;
         }
+
         @Override
         public boolean apply(Node n) {
             return u == n;
@@ -202,10 +219,13 @@
     }
 
     private static final class NotEqualsPredicate extends NodePredicate {
+
         private final Node u;
+
         public NotEqualsPredicate(Node u) {
             this.u = u;
         }
+
         @Override
         public boolean apply(Node n) {
             return u != n;
@@ -213,21 +233,26 @@
     }
 
     public static final class PositiveTypePredicate extends NodePredicate {
+
         private final Class<?> type;
         private PositiveTypePredicate or;
+
         public PositiveTypePredicate(Class<?> type) {
             this.type = type;
         }
+
         public PositiveTypePredicate(NegativeTypePredicate a) {
             type = a.type;
             if (a.nor != null) {
                 or = new PositiveTypePredicate(a.nor);
             }
         }
+
         @Override
         public boolean apply(Node n) {
             return type.isInstance(n) || (or != null && or.apply(n));
         }
+
         public PositiveTypePredicate or(Class<? extends Node> clazz) {
             if (or == null) {
                 or = new PositiveTypePredicate(clazz);
@@ -239,21 +264,26 @@
     }
 
     public static final class NegativeTypePredicate extends NodePredicate {
+
         private final Class<?> type;
         private NegativeTypePredicate nor;
+
         public NegativeTypePredicate(Class<?> type) {
             this.type = type;
         }
+
         public NegativeTypePredicate(PositiveTypePredicate a) {
             type = a.type;
             if (a.or != null) {
                 nor = new NegativeTypePredicate(a.or);
             }
         }
+
         @Override
         public boolean apply(Node n) {
             return !type.isInstance(n) && (nor == null || nor.apply(n));
         }
+
         public NegativeTypePredicate nor(Class<? extends Node> clazz) {
             if (nor == null) {
                 nor = new NegativeTypePredicate(clazz);
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/PredicatedProxyNodeIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/PredicatedProxyNodeIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,14 +27,17 @@
 import com.oracle.graal.graph.*;
 
 public class PredicatedProxyNodeIterator<T extends Node> extends NodeIterator<T> {
+
     private final Iterator<T> iterator;
     private final NodePredicate predicate;
     private final NodePredicate until;
+
     public PredicatedProxyNodeIterator(NodePredicate until, Iterator<T> iterator, NodePredicate predicate) {
         this.until = until;
         this.iterator = iterator;
         this.predicate = predicate;
     }
+
     @Override
     protected void forward() {
         while ((current == null || !current.isAlive() || !predicate.apply(current)) && iterator.hasNext()) {
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,3 +24,4 @@
  * This package contains the Node base class and the Graph container class of the Graal IR.
  */
 package com.oracle.graal.graph;
+
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DirectCallOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64DirectCallOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,27 +37,25 @@
 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
 
 /**
- * A direct call that complies with the conventions for such calls in HotSpot.
- * In particular, for calls using an inline cache, a MOVE instruction is
- * emitted just prior to the aligned direct call. This instruction
- * (which moves 0L in RAX) is patched by the C++ Graal code to replace the
- * 0L constant with Universe::non_oop_word(), a special sentinel
- * used for the initial value of the Klass in an inline cache.
+ * A direct call that complies with the conventions for such calls in HotSpot. In particular, for
+ * calls using an inline cache, a MOVE instruction is emitted just prior to the aligned direct call.
+ * This instruction (which moves 0L in RAX) is patched by the C++ Graal code to replace the 0L
+ * constant with Universe::non_oop_word(), a special sentinel used for the initial value of the
+ * Klass in an inline cache.
  * <p>
- * For non-inline cache calls (i.e., INVOKESTATIC and INVOKESPECIAL), a static
- * call stub is emitted. Initially, these calls go to the global static call
- * resolution stub (i.e., SharedRuntime::get_resolve_static_call_stub()).
- * Resolution will link the call to a compiled version of the callee if
- * available otherwise to the interpreter. The interpreter expects to
- * find the Method* for the callee in RBX. To achieve this, the static call
- * is linked to a static call stub which initializes RBX and jumps to the
- * interpreter. This pattern is shown below:
+ * For non-inline cache calls (i.e., INVOKESTATIC and INVOKESPECIAL), a static call stub is emitted.
+ * Initially, these calls go to the global static call resolution stub (i.e.,
+ * SharedRuntime::get_resolve_static_call_stub()). Resolution will link the call to a compiled
+ * version of the callee if available otherwise to the interpreter. The interpreter expects to find
+ * the Method* for the callee in RBX. To achieve this, the static call is linked to a static call
+ * stub which initializes RBX and jumps to the interpreter. This pattern is shown below:
+ * 
  * <pre>
  *       call L1
  *       nop
- *
+ * 
  *       ...
- *
+ * 
  *   L1: mov rbx [Method*]
  *       jmp [interpreter entry point]
  * </pre>
@@ -66,9 +64,9 @@
 final class AMD64DirectCallOp extends DirectCallOp {
 
     /**
-     * The mark emitted at the position of the direct call instruction.
-     * This is only recorded for calls that have an associated static
-     * call stub (i.e., {@code invokeKind == Static || invokeKind == Special}).
+     * The mark emitted at the position of the direct call instruction. This is only recorded for
+     * calls that have an associated static call stub (i.e.,
+     * {@code invokeKind == Static || invokeKind == Special}).
      */
     Mark callsiteMark;
 
@@ -80,16 +78,19 @@
 
         if (invokeKind == Static || invokeKind == Special) {
             lir.stubs.add(new AMD64Code() {
+
                 public String description() {
                     return "static call stub for Invoke" + AMD64DirectCallOp.this.invokeKind;
                 }
+
                 @Override
                 public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
                     assert callsiteMark != null : "static call site has not yet been emitted";
                     tasm.recordMark(Marks.MARK_STATIC_CALL_STUB, callsiteMark);
                     masm.movq(AMD64.rbx, 0L);
                     int pos = masm.codeBuffer.position();
-                    // Create a jump-to-self as expected by CompiledStaticCall::set_to_interpreted() in compiledIC.cpp
+                    // Create a jump-to-self as expected by CompiledStaticCall::set_to_interpreted()
+                    // in compiledIC.cpp
                     masm.jmp(pos, true);
                 }
             });
@@ -103,7 +104,8 @@
             tasm.recordMark(invokeKind == Static ? Marks.MARK_INVOKESTATIC : Marks.MARK_INVOKESPECIAL);
         } else {
             assert invokeKind == Virtual || invokeKind == Interface;
-            // The mark for an invocation that uses an inline cache must be placed at the instruction
+            // The mark for an invocation that uses an inline cache must be placed at the
+            // instruction
             // that loads the Klass from the inline cache so that the C++ code can find it
             // and replace the inline 0L value with Universe::non_oop_word()
             tasm.recordMark(invokeKind == Virtual ? Marks.MARK_INVOKEVIRTUAL : Marks.MARK_INVOKEINTERFACE);
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotBackend.java	Fri Feb 01 17:06:26 2013 +0100
@@ -231,15 +231,12 @@
     @Override
     public TargetMethodAssembler newAssembler(FrameMap frameMap, LIR lir) {
         // Omit the frame if the method:
-        //  - has no spill slots or other slots allocated during register allocation
-        //  - has no callee-saved registers
-        //  - has no incoming arguments passed on the stack
-        //  - has no instructions with debug info
-        boolean omitFrame = GraalOptions.CanOmitFrame &&
-            frameMap.frameSize() == frameMap.initialFrameSize &&
-            frameMap.registerConfig.getCalleeSaveLayout().registers.length == 0 &&
-            !lir.hasArgInCallerFrame() &&
-            !lir.hasDebugInfo();
+        // - has no spill slots or other slots allocated during register allocation
+        // - has no callee-saved registers
+        // - has no incoming arguments passed on the stack
+        // - has no instructions with debug info
+        boolean omitFrame = GraalOptions.CanOmitFrame && frameMap.frameSize() == frameMap.initialFrameSize && frameMap.registerConfig.getCalleeSaveLayout().registers.length == 0 &&
+                        !lir.hasArgInCallerFrame() && !lir.hasDebugInfo();
 
         AbstractAssembler masm = new AMD64MacroAssembler(target, frameMap.registerConfig);
         HotSpotFrameContext frameContext = omitFrame ? null : new HotSpotFrameContext();
@@ -262,8 +259,9 @@
 
         if (!isStatic) {
             tasm.recordMark(Marks.MARK_UNVERIFIED_ENTRY);
-            CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[] {runtime().lookupJavaType(Object.class)}, target, false);
-            Register inlineCacheKlass = rax; // see definition of IC_Klass in c1_LIRAssembler_x86.cpp
+            CallingConvention cc = regConfig.getCallingConvention(JavaCallee, null, new JavaType[]{runtime().lookupJavaType(Object.class)}, target, false);
+            Register inlineCacheKlass = rax; // see definition of IC_Klass in
+                                             // c1_LIRAssembler_x86.cpp
             Register receiver = asRegister(cc.getArgument(0));
             Address src = new Address(target.wordKind, receiver.asValue(), config.hubOffset);
 
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotGraalRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -49,7 +49,9 @@
     protected TargetDescription createTarget() {
         final int wordSize = 8;
         final int stackFrameAlignment = 16;
-        return new TargetDescription(new AMD64(), true, stackFrameAlignment, config.vmPageSize, wordSize, true, true);
+        final int stackBias = 0;
+        final int implicitNullCheckLimit = 4096;
+        return new TargetDescription(new AMD64(), true, stackFrameAlignment, stackBias, implicitNullCheckLimit, config.vmPageSize, wordSize, true, true);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRegisterConfig.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 
+// @formatter:off
 public class AMD64HotSpotRegisterConfig implements RegisterConfig {
 
     // be careful - the contents of this array are duplicated in graal_CodeInstaller.cpp
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -54,6 +54,8 @@
 
         Kind word = graalRuntime.getTarget().wordKind;
 
+        // @formatter:off
+
         addRuntimeCall(DEOPTIMIZE, config.deoptimizeStub,
                 /*           temps */ null,
                 /*             ret */ ret(Kind.Void));
@@ -174,6 +176,9 @@
                 /* arg2:    key */                         word,
                 /* arg3:      r */                         word,
               /* arg4: inLength */                         Kind.Int));
+
+        // @formatter:on
+
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64IndirectCallOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,10 +37,10 @@
 import com.oracle.graal.lir.asm.*;
 
 /**
- * A register indirect call that complies with the extra conventions for such calls in HotSpot.
- * In particular, the metaspace Method of the callee must be in RBX for the case where a vtable entry's
- * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target
- * method to be in RBX.
+ * A register indirect call that complies with the extra conventions for such calls in HotSpot. In
+ * particular, the metaspace Method of the callee must be in RBX for the case where a vtable entry's
+ * _from_compiled_entry is the address of an C2I adapter. Such adapters expect the target method to
+ * be in RBX.
  */
 @Opcode("CALL_INDIRECT")
 final class AMD64IndirectCallOp extends IndirectCallOp {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64SafepointOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,6 +39,7 @@
  */
 @Opcode("SAFEPOINT")
 public class AMD64SafepointOp extends AMD64LIRInstruction {
+
     @State protected LIRFrameState state;
 
     private final HotSpotVMConfig config;
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64TailcallOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,10 +32,12 @@
 import com.oracle.graal.lir.asm.*;
 
 /**
- * Performs a hard-coded tail call to the specified target, which normally should be an {@link InstalledCode} instance.
+ * Performs a hard-coded tail call to the specified target, which normally should be an
+ * {@link InstalledCode} instance.
  */
 @Opcode("TAILCALL")
 public class AMD64TailcallOp extends AMD64LIRInstruction {
+
     @Use protected Value target;
     @Alive protected Value[] parameters;
 
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/CompilationServer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,8 @@
 import com.oracle.graal.hotspot.logging.*;
 
 /**
- * Server side of the client/server compilation model. The server listens for connections on the hardcoded port 1199.
+ * Server side of the client/server compilation model. The server listens for connections on the
+ * hardcoded port 1199.
  */
 public class CompilationServer implements Runnable {
 
@@ -52,11 +53,12 @@
     private final ArrayList<ConnectionObserver> observers = new ArrayList<>();
 
     /**
-     * Creates a new Compilation server. The server is activated by calling {@link #run()} directly or via a new
-     * {@link Thread}.
-     *
-     * @param multiple true if the server should server should serve an infinite amount of consecutive connections,
-     *            false if it should terminate after the first connection ends.
+     * Creates a new Compilation server. The server is activated by calling {@link #run()} directly
+     * or via a new {@link Thread}.
+     * 
+     * @param multiple true if the server should server should serve an infinite amount of
+     *            consecutive connections, false if it should terminate after the first connection
+     *            ends.
      */
     public CompilationServer(boolean multiple) {
         this.multiple = multiple;
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/InvocationSocket.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,10 +30,11 @@
 
 /**
  * A collection of java.lang.reflect proxies that communicate over a socket connection.
- *
- * Calling a method sends the method name and the parameters through the socket. Afterwards this class waits for a
- * result. While waiting for a result three types of objects can arrive through the socket: a method invocation, a
- * method result or an exception. Method invocation can thus be recursive.
+ * 
+ * Calling a method sends the method name and the parameters through the socket. Afterwards this
+ * class waits for a result. While waiting for a result three types of objects can arrive through
+ * the socket: a method invocation, a method result or an exception. Method invocation can thus be
+ * recursive.
  */
 public class InvocationSocket {
 
@@ -64,6 +65,7 @@
 
         if (COUNT_CALLS) {
             Runtime.getRuntime().addShutdownHook(new Thread() {
+
                 @Override
                 public void run() {
                     SortedMap<Integer, String> sorted = new TreeMap<>();
@@ -80,7 +82,7 @@
 
     /**
      * Represents one invocation of a method that is transferred via the socket connection.
-     *
+     * 
      */
     private static class Invocation implements Serializable {
 
@@ -99,7 +101,7 @@
 
     /**
      * Represents the result of an invocation that is transferred via the socket connection.
-     *
+     * 
      */
     private static class Result implements Serializable {
 
@@ -124,9 +126,10 @@
     }
 
     /**
-     * Each instance of this class handles remote invocations for one instance of a Remote class. It will forward all
-     * interface methods to the other end of the socket and cache the results of calls to certain methods.
-     *
+     * Each instance of this class handles remote invocations for one instance of a Remote class. It
+     * will forward all interface methods to the other end of the socket and cache the results of
+     * calls to certain methods.
+     * 
      */
     public class Handler implements InvocationHandler {
 
@@ -181,8 +184,9 @@
     }
 
     /**
-     * Waits for the result of a remote method invocation. Invocations that should be executed in this VM might arrive
-     * while waiting for the result, and these invocations will be executed before again waiting fort he result.
+     * Waits for the result of a remote method invocation. Invocations that should be executed in
+     * this VM might arrive while waiting for the result, and these invocations will be executed
+     * before again waiting fort he result.
      */
     @SuppressWarnings("unused")
     public Object waitForResult(boolean eofExpected) throws IOException, ClassNotFoundException {
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/Remote.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/Remote.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.hotspot.server;
 
-
 public interface Remote {
 
 }
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/ReplacingStreams.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,7 +41,8 @@
 
     public ReplacingStreams(OutputStream outputStream, InputStream inputStream) throws IOException {
         output = new ReplacingOutputStream(new BufferedOutputStream(outputStream));
-        // required, because creating an ObjectOutputStream writes a header, but doesn't flush the stream
+        // required, because creating an ObjectOutputStream writes a header, but doesn't flush the
+        // stream
         output.flush();
         input = new ReplacingInputStream(new BufferedInputStream(inputStream));
         invocation = new InvocationSocket(output, input);
@@ -97,6 +98,7 @@
     }
 
     public static class NewDummyPlaceholder implements Serializable {
+
         private static final long serialVersionUID = 2692666726573532288L;
     }
 
@@ -112,7 +114,8 @@
 
         @Override
         protected Object resolveObject(Object obj) throws IOException {
-            // see ReplacingInputStream.replaceObject for details on when these types of objects are created
+            // see ReplacingInputStream.replaceObject for details on when these types of objects are
+            // created
 
             if (obj instanceof Placeholder) {
                 Placeholder placeholder = (Placeholder) obj;
@@ -191,7 +194,8 @@
     }
 
     private Object createRemoteCallPlaceholder(Object obj) {
-        // collect all interfaces that this object's class implements (proxies only support interfaces)
+        // collect all interfaces that this object's class implements (proxies only support
+        // interfaces)
         objectMap.put(obj, new Placeholder(objectList.size()));
         objectList.add(obj);
         return new NewRemoteCallPlaceholder(ProxyUtil.getAllInterfaces(obj.getClass()));
--- a/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.server/src/com/oracle/graal/hotspot/server/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,3 +24,4 @@
  * Implementation of a compilation server socket that delegates incoming requests to Graal.
  */
 package com.oracle.graal.hotspot.server;
+
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/ArrayCopyIntrinsificationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,11 +33,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.compiler.test.*;
 import com.oracle.graal.graph.*;
-import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.phases.*;
-import com.oracle.graal.phases.PhasePlan.PhasePosition;
-
 
 /**
  * Tests intrinsification of {@link System#arraycopy(Object, int, Object, int, int)}.
@@ -45,18 +41,13 @@
 public class ArrayCopyIntrinsificationTest extends GraalCompilerTest {
 
     @Override
-    protected void editPhasePlan(ResolvedJavaMethod method, StructuredGraph graph, PhasePlan phasePlan) {
-        phasePlan.addPhase(PhasePosition.HIGH_LEVEL, new IntrinsifyArrayCopyPhase(runtime, new Assumptions(false)));
-    }
-
-    @Override
     protected InstalledCode getCode(ResolvedJavaMethod method, StructuredGraph graph) {
         int nodeCount = graph.getNodeCount();
         InstalledCode result = super.getCode(method, graph);
         boolean graphWasProcessed = nodeCount != graph.getNodeCount();
         if (graphWasProcessed) {
             if (mustIntrinsify) {
-                for (Node node: graph.getNodes()) {
+                for (Node node : graph.getNodes()) {
                     if (node instanceof Invoke) {
                         Invoke invoke = (Invoke) node;
                         Assert.assertTrue(invoke.callTarget() instanceof DirectCallTargetNode);
@@ -65,12 +56,12 @@
                         JavaMethod callee = (JavaMethod) directCall.target();
                         Assert.assertTrue(callee.getName().equals("<init>"));
                         Assert.assertTrue(runtime.lookupJavaType(ArrayIndexOutOfBoundsException.class).equals(callee.getDeclaringClass()) ||
-                                          runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass()));
+                                        runtime.lookupJavaType(NullPointerException.class).equals(callee.getDeclaringClass()));
                     }
                 }
             } else {
                 boolean found = false;
-                for (Node node: graph.getNodes()) {
+                for (Node node : graph.getNodes()) {
                     if (node instanceof Invoke) {
                         Invoke invoke = (Invoke) node;
                         DirectCallTargetNode directCall = (DirectCallTargetNode) invoke.callTarget();
@@ -96,6 +87,8 @@
         // Array store checks
         test("genericArraycopy", new Object(), 0, new Object[0], 0, 0);
         test("genericArraycopy", new Object[0], 0, new Object(), 0, 0);
+
+        mustIntrinsify = true;
     }
 
     @Test
@@ -154,8 +147,18 @@
 
     @Test
     public void testObject() {
+        mustIntrinsify = false; // a generic call to arraycopy will not be intrinsified
+
         Object[] src = {"one", "two", "three", new ArrayList<>(), new HashMap<>()};
         testHelper("objectArraycopy", src);
+
+        mustIntrinsify = true;
+    }
+
+    @Test
+    public void testObjectExact() {
+        Integer[] src = {1, 2, 3, 4};
+        testHelper("objectArraycopyExact", src);
     }
 
     private static Object newArray(Object proto, int length) {
@@ -170,7 +173,7 @@
         // Complete array copy
         test(name, src, 0, newArray(src, srcLength), 0, srcLength);
 
-        for (int length : new int[] {0, 1, srcLength - 1, srcLength}) {
+        for (int length : new int[]{0, 1, srcLength - 1, srcLength}) {
             // Partial array copying
             test(name, src, 0, newArray(src, length), 0, length);
             test(name, src, srcLength - length, newArray(src, length), 0, length);
@@ -188,6 +191,11 @@
         return dst;
     }
 
+    public static Object[] objectArraycopyExact(Integer[] src, int srcPos, Integer[] dst, int dstPos, int length) {
+        System.arraycopy(src, srcPos, dst, dstPos, length);
+        return dst;
+    }
+
     public static boolean[] booleanArraycopy(boolean[] src, int srcPos, boolean[] dst, int dstPos, int length) {
         System.arraycopy(src, srcPos, dst, dstPos, length);
         return dst;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationStatistics.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,25 +22,29 @@
  */
 package com.oracle.graal.hotspot;
 
+import static com.oracle.graal.graph.UnsafeAccess.*;
+import static java.lang.Thread.*;
+
 import java.io.*;
 import java.lang.annotation.*;
+import java.lang.management.*;
 import java.lang.reflect.*;
 import java.util.*;
 import java.util.concurrent.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.meta.*;
+import com.sun.management.ThreadMXBean;
 
 @SuppressWarnings("unused")
 public final class CompilationStatistics {
 
     private static final long RESOLUTION = 100000000;
-    private static final boolean TIMELINE_ENABLED = System.getProperty("stats.timeline.file") != null;
-    private static final boolean COMPILATIONSTATS_ENABLED = System.getProperty("stats.compilations.file") != null;
-    private static final boolean ENABLED = TIMELINE_ENABLED || COMPILATIONSTATS_ENABLED;
+    private static final boolean ENABLED = Boolean.getBoolean("graal.comp.stats");
 
-    private static final CompilationStatistics DUMMY = new CompilationStatistics(null);
+    private static final CompilationStatistics DUMMY = new CompilationStatistics(null, false);
 
     private static ConcurrentLinkedDeque<CompilationStatistics> list = new ConcurrentLinkedDeque<>();
 
@@ -54,7 +58,7 @@
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
-    private static @interface AbsoluteTimeValue {
+    private static @interface NotReported {
     }
 
     @Retention(RetentionPolicy.RUNTIME)
@@ -64,27 +68,35 @@
 
     private static long zeroTime = System.nanoTime();
 
+    private static long getThreadAllocatedBytes() {
+        ThreadMXBean thread = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+        return thread.getThreadAllocatedBytes(currentThread().getId());
+    }
+
+    @NotReported private final long startTime;
+    @NotReported private long threadAllocatedBytesStart;
+    @NotReported private int startInvCount;
+    @NotReported private int endInvCount;
+
+    private int bytecodeCount;
+    private int codeSize;
+    @TimeValue private long duration;
+    private long memoryUsed;
+    private final boolean osr;
     private final String holder;
     private final String name;
     private final String signature;
-    @AbsoluteTimeValue
-    private final long startTime;
-    @TimeValue
-    private long duration;
-    private int startInvCount;
-    private int endInvCount;
-    private int bytecodeCount;
-    private int codeSize;
-    private int deoptCount;
 
-    private CompilationStatistics(HotSpotResolvedJavaMethod method) {
+    private CompilationStatistics(HotSpotResolvedJavaMethod method, boolean osr) {
+        this.osr = osr;
         if (method != null) {
-            holder = MetaUtil.format("%H", method);
+            holder = method.getDeclaringClass().getName();
             name = method.getName();
-            signature = MetaUtil.format("%p", method);
+            signature = method.getSignature().getMethodDescriptor();
             startTime = System.nanoTime();
             startInvCount = method.invocationCount();
             bytecodeCount = method.getCodeSize();
+            threadAllocatedBytesStart = getThreadAllocatedBytes();
         } else {
             holder = "";
             name = "";
@@ -98,6 +110,7 @@
             duration = System.nanoTime() - startTime;
             endInvCount = method.invocationCount();
             codeSize = method.getCompiledCodeSize();
+            memoryUsed = getThreadAllocatedBytes() - threadAllocatedBytesStart;
             if (current.get().getLast() != this) {
                 throw new RuntimeException("mismatch in finish()");
             }
@@ -109,9 +122,9 @@
         return current.get().isEmpty() ? null : current.get().getLast();
     }
 
-    public static CompilationStatistics create(HotSpotResolvedJavaMethod method) {
+    public static CompilationStatistics create(HotSpotResolvedJavaMethod method, boolean isOSR) {
         if (ENABLED) {
-            CompilationStatistics stats = new CompilationStatistics(method);
+            CompilationStatistics stats = new CompilationStatistics(method, isOSR);
             list.add(stats);
             current.get().addLast(stats);
             return stats;
@@ -133,42 +146,11 @@
             zeroTime = System.nanoTime();
 
             Date now = new Date();
-            String dateString = (now.getYear() + 1900) + "_" + (now.getMonth() + 1) + "_" + now.getDate() + " " + now.getHours() + "_" + now.getMinutes() + "_" + now.getSeconds();
-            try (PrintStream out = new PrintStream("compilations " + dateString + " " + dumpName + ".csv")) {
-                // output the list of all compilations
+            String dateString = (now.getYear() + 1900) + "-" + (now.getMonth() + 1) + "-" + now.getDate() + "-" + now.getHours() + "" + now.getMinutes();
 
-                Field[] declaredFields = CompilationStatistics.class.getDeclaredFields();
-                ArrayList<Field> fields = new ArrayList<>();
-                for (Field field : declaredFields) {
-                    if (!Modifier.isStatic(field.getModifiers())) {
-                        fields.add(field);
-                    }
-                }
-                for (Field field : fields) {
-                    out.print(field.getName() + ";");
-                }
-                out.println();
-                for (CompilationStatistics stats : snapshot) {
-                    for (Field field : fields) {
-                        if (field.isAnnotationPresent(AbsoluteTimeValue.class)) {
-                            double value = (field.getLong(stats) - snapshotZeroTime) / 1000000d;
-                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
-                        } else if (field.isAnnotationPresent(TimeValue.class)) {
-                            double value = field.getLong(stats) / 1000000d;
-                            out.print(String.format(Locale.ENGLISH, "%.3f", value) + ";");
-                        } else {
-                            out.print(field.get(stats) + ";");
-                        }
-                    }
-                    out.println();
-                }
-            }
+            dumpCompilations(snapshot, dumpName, dateString);
 
-            String timelineFile = System.getProperty("stats.timeline.file");
-            if (timelineFile == null || timelineFile.isEmpty()) {
-                timelineFile = "timeline " + dateString;
-            }
-            try (FileOutputStream fos = new FileOutputStream(timelineFile + " " + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
+            try (FileOutputStream fos = new FileOutputStream("timeline_" + dateString + "_" + dumpName + ".csv", true); PrintStream out = new PrintStream(fos)) {
 
                 long[] timeSpent = new long[10000];
                 int maxTick = 0;
@@ -195,10 +177,10 @@
                 }
                 String timelineName = System.getProperty("stats.timeline.name");
                 if (timelineName != null && !timelineName.isEmpty()) {
-                    out.print(timelineName + ";");
+                    out.print(timelineName + "\t");
                 }
                 for (int i = 0; i <= maxTick; i++) {
-                    out.print((timeSpent[i] * 100 / RESOLUTION) + ";");
+                    out.print((timeSpent[i] * 100 / RESOLUTION) + "\t");
                 }
                 out.println();
             }
@@ -207,7 +189,33 @@
         }
     }
 
-    public void setDeoptCount(int count) {
-        this.deoptCount = count;
+    protected static void dumpCompilations(ConcurrentLinkedDeque<CompilationStatistics> snapshot, String dumpName, String dateString) throws IllegalAccessException, FileNotFoundException {
+        String fileName = "compilations_" + dateString + "_" + dumpName + ".csv";
+        try (PrintStream out = new PrintStream(fileName)) {
+            // output the list of all compilations
+
+            Field[] declaredFields = CompilationStatistics.class.getDeclaredFields();
+            ArrayList<Field> fields = new ArrayList<>();
+            for (Field field : declaredFields) {
+                if (!Modifier.isStatic(field.getModifiers()) && !field.isAnnotationPresent(NotReported.class)) {
+                    fields.add(field);
+                }
+            }
+            for (Field field : fields) {
+                out.print(field.getName() + "\t");
+            }
+            out.println();
+            for (CompilationStatistics stats : snapshot) {
+                for (Field field : fields) {
+                    if (field.isAnnotationPresent(TimeValue.class)) {
+                        double value = field.getLong(stats) / 1000000d;
+                        out.print(String.format(Locale.ENGLISH, "%.3f", value) + "\t");
+                    } else {
+                        out.print(field.get(stats) + "\t");
+                    }
+                }
+                out.println();
+            }
+        }
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,22 +23,23 @@
 package com.oracle.graal.hotspot;
 
 import static com.oracle.graal.nodes.StructuredGraph.*;
+import static com.oracle.graal.phases.common.InliningUtil.*;
 
 import java.util.concurrent.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 
-
 public final class CompilationTask implements Runnable, Comparable<CompilationTask> {
 
+    public static final ThreadLocal<Boolean> withinEnqueue = new ThreadLocal<Boolean>() {
 
-    public static final ThreadLocal<Boolean> withinEnqueue = new ThreadLocal<Boolean>() {
         @Override
         protected Boolean initialValue() {
             return Boolean.valueOf(Thread.currentThread() instanceof CompilerThread);
@@ -113,12 +114,18 @@
         }
     }
 
+    /**
+     * Time spent in compilation.
+     */
+    public static final DebugTimer CompilationTime = Debug.timer("CompilationTime");
+
     public void runCompilation() {
-        CompilationStatistics stats = CompilationStatistics.create(method);
-        try {
+        CompilationStatistics stats = CompilationStatistics.create(method, entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI);
+        try (TimerCloseable a = CompilationTime.start()) {
             final boolean printCompilation = GraalOptions.PrintCompilation && !TTY.isSuppressed();
             if (printCompilation) {
-                TTY.println(String.format("%-6d Graal %-70s %-45s %-50s %s...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature(), entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") "));
+                TTY.println(String.format("%-6d Graal %-70s %-45s %-50s %s...", id, method.getDeclaringClass().getName(), method.getName(), method.getSignature(),
+                                entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "(OSR@" + entryBCI + ") "));
             }
 
             CompilationResult result = null;
@@ -136,8 +143,9 @@
                         } else {
                             // Compiling an intrinsic graph - must clone the graph
                             graph = graph.copy();
-                            //System.out.println("compiling intrinsic " + method);
+                            // System.out.println("compiling intrinsic " + method);
                         }
+                        InlinedBytecodes.add(method.getCodeSize());
                         return graalRuntime.getCompiler().compileMethod(method, graph, graalRuntime.getCache(), plan, optimisticOpts);
                     }
                 });
@@ -169,13 +177,14 @@
     }
 
     private void installMethod(final CompilationResult tm) {
-        Debug.scope("CodeInstall", new Object[] {new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), method}, new Runnable() {
+        Debug.scope("CodeInstall", new Object[]{new DebugDumpScope(String.valueOf(id), true), graalRuntime.getCompiler(), 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");
+                    Debug.dump(new Object[]{tm, info[0]}, "After code installation");
                 }
             }
 
@@ -195,7 +204,6 @@
 
     @Override
     public String toString() {
-        return "Compilation[id=" + id + ", prio=" + priority + " " + MetaUtil.format("%H.%n(%p)", method) +
-                        (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]";
+        return "Compilation[id=" + id + ", prio=" + priority + " " + MetaUtil.format("%H.%n(%p)", method) + (entryBCI == StructuredGraph.INVOCATION_ENTRY_BCI ? "" : "@" + entryBCI) + "]";
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerObject.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,10 @@
 
 import com.oracle.graal.api.meta.Kind.*;
 
-
 /**
  * Parent class for all HotSpot types that need to be serialized.
  */
 public abstract class CompilerObject implements Serializable, FormatWithToString {
+
     private static final long serialVersionUID = -4551670987101214877L;
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerThread.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,7 +30,6 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.printer.*;
 
-
 public final class CompilerThread extends Thread {
 
     public static final ThreadFactory FACTORY = new ThreadFactory() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompilationResult.java	Fri Feb 01 17:06:26 2013 +0100
@@ -57,6 +57,7 @@
     }
 
     static class SiteComparator implements Comparator<Site> {
+
         public int compare(Site s1, Site s2) {
             if (s1.pcOffset == s2.pcOffset && (s1 instanceof Mark ^ s2 instanceof Mark)) {
                 return s1 instanceof Mark ? -1 : 1;
@@ -66,7 +67,7 @@
     }
 
     private static Site[] getSortedSites(CompilationResult target) {
-        List<?>[] lists = new List<?>[] {target.getSafepoints(), target.getDataReferences(), target.getMarks()};
+        List<?>[] lists = new List<?>[]{target.getSafepoints(), target.getDataReferences(), target.getMarks()};
         int count = 0;
         for (List<?> list : lists) {
             count += list.size();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,9 +41,8 @@
 
 /**
  * Singleton class holding the instance of the {@link GraalRuntime}.
- *
- * The platform specific subclass is created by a call from
- * the C++ HotSpot code.
+ * 
+ * The platform specific subclass is created by a call from the C++ HotSpot code.
  */
 public abstract class HotSpotGraalRuntime implements GraalRuntime {
 
@@ -107,8 +106,8 @@
         return unsafe.getInt(address);
     }
 
-    protected /*final*/ CompilerToVM compilerToVm;
-    protected /*final*/ VMToCompiler vmToCompiler;
+    protected/* final */CompilerToVM compilerToVm;
+    protected/* final */VMToCompiler vmToCompiler;
 
     protected final HotSpotRuntime runtime;
     protected final GraalCompiler compiler;
@@ -165,7 +164,9 @@
     }
 
     protected abstract TargetDescription createTarget();
+
     protected abstract HotSpotBackend createBackend();
+
     protected abstract HotSpotRuntime createRuntime();
 
     public HotSpotVMConfig getConfig() {
@@ -196,7 +197,7 @@
         if (name.length() == 1 && vmToCompiler instanceof VMToCompilerImpl) {
             VMToCompilerImpl impl = (VMToCompilerImpl) vmToCompiler;
             Kind kind = Kind.fromPrimitiveOrVoidTypeChar(name.charAt(0));
-            switch(kind) {
+            switch (kind) {
                 case Boolean:
                     return impl.typeBoolean;
                 case Byte:
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotLIRGenerator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,14 +28,14 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * This interface defines the contract a HotSpot backend LIR generator needs to fulfill
- * in addition to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}.
+ * This interface defines the contract a HotSpot backend LIR generator needs to fulfill in addition
+ * to abstract methods from {@link LIRGenerator} and {@link LIRGeneratorTool}.
  */
 public interface HotSpotLIRGenerator {
 
     /**
      * Emits an operation to make a tail call.
-     *
+     * 
      * @param args the arguments of the call
      * @param address the target address of the call
      */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotOptions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -69,7 +69,7 @@
         Field f;
         try {
             f = GraalOptions.class.getDeclaredField(fieldName);
-            Class< ? > fType = f.getType();
+            Class<?> fType = f.getType();
 
             if (value == null) {
                 if (fType == Boolean.TYPE) {
@@ -101,7 +101,7 @@
             if (value != null) {
                 f.setAccessible(true);
                 f.set(null, value);
-                //Logger.info("Set option " + fieldName + " to " + value);
+                // Logger.info("Set option " + fieldName + " to " + value);
             } else {
                 Logger.info("Wrong value \"" + valueString + "\" for option " + fieldName);
                 return false;
@@ -127,6 +127,7 @@
         Logger.info("[Graal flags]");
         Field[] flags = GraalOptions.class.getDeclaredFields();
         Arrays.sort(flags, new Comparator<Field>() {
+
             public int compare(Field o1, Field o2) {
                 return o1.getName().compareTo(o2.getName());
             }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotRuntimeInterpreterInterface.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,7 +40,7 @@
         this.metaProvider = metaProvider;
     }
 
-    public Class< ? > getMirror(ResolvedJavaType type) {
+    public Class<?> getMirror(ResolvedJavaType type) {
         return ((HotSpotResolvedJavaType) type).mirror();
     }
 
@@ -159,7 +159,6 @@
         }
     }
 
-
     public void setFieldFloat(float value, Object base, ResolvedJavaField field) {
         long offset = resolveOffset(field);
         if (isVolatile(field)) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotSnippetInstaller.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotSnippetInstaller.java	Fri Feb 01 17:06:26 2013 +0100
@@ -42,7 +42,7 @@
     }
 
     @Override
-    protected void installSubstitution(Method originalMethod, Method substituteMethod) {
+    protected void installMethodSubstitution(Method originalMethod, Method substituteMethod) {
         if (substituteMethod.getDeclaringClass() == IntegerSubstitutions.class || substituteMethod.getDeclaringClass() == LongSubstitutions.class) {
             if (substituteMethod.getName().equals("bitCount")) {
                 if (!config.usePopCountInstruction) {
@@ -58,6 +58,6 @@
             assert config.cipherBlockChainingEncryptAESCryptStub != 0L;
             assert config.cipherBlockChainingDecryptAESCryptStub != 0L;
         }
-        super.installSubstitution(originalMethod, substituteMethod);
+        super.installMethodSubstitution(originalMethod, substituteMethod);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.hotspot;
 
-
 /**
  * Used to communicate configuration details, runtime offsets, etc. to Graal upon compileMethod.
  */
@@ -37,6 +36,7 @@
     public boolean windowsOs;
     public int codeEntryAlignment;
     public boolean verifyOops;
+    public boolean ciTime;
     public boolean useFastLocking;
     public boolean useTLAB;
     public boolean useBiasedLocking;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,7 @@
 
     /**
      * Copies the original bytecode of a given method into a given byte array.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object
      * @param code the array into which to copy the original bytecode
      * @return the value of {@code code}
@@ -49,7 +49,7 @@
 
     /**
      * Determines if a given metaspace Method object has balanced monitors.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object to query
      * @return true if the method has balanced monitors
      */
@@ -63,9 +63,9 @@
      * <li>the method may have a bytecode breakpoint set</li>
      * <li>the method may have other bytecode features that require special handling by the VM</li>
      * </ul>
-     *
+     * 
      * A non-compilable method should not be inlined.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object to query
      * @return true if the method is compilable
      */
@@ -73,24 +73,26 @@
 
     /**
      * Used to implement {@link ResolvedJavaType#findUniqueConcreteMethod(ResolvedJavaMethod)}.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method on which to based the search
      * @param resultHolder the holder of the result is put in element 0 of this array
-     * @return the metaspace Method result or 0 is there is no unique concrete method for {@code metaspaceMethod}
+     * @return the metaspace Method result or 0 is there is no unique concrete method for
+     *         {@code metaspaceMethod}
      */
     long getUniqueConcreteMethod(long metaspaceMethod, HotSpotResolvedObjectType[] resultHolder);
 
     /**
      * Used to determine if an interface has exactly one implementor.
-     *
+     * 
      * @param interfaceType interface for which the implementor should be returned
-     * @return the unique implementor of the interface or null if the interface has 0 or more than 1 implementor
+     * @return the unique implementor of the interface or null if the interface has 0 or more than 1
+     *         implementor
      */
     ResolvedJavaType getUniqueImplementor(HotSpotResolvedObjectType interfaceType);
 
     /**
      * Gets the invocation count for a method.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object to query
      * @return the invocation count for the method
      */
@@ -98,7 +100,7 @@
 
     /**
      * Initializes a {@link HotSpotResolvedJavaMethod} object from a metaspace Method object.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object
      * @param method address of a metaspace Method object
      */
@@ -106,7 +108,7 @@
 
     /**
      * Initializes a {@link HotSpotMethodData} object from a metaspace MethodData object.
-     *
+     * 
      * @param metaspaceMethodData the metaspace MethodData object
      * @param methodData the object to initialize from the metaspace object
      */
@@ -114,13 +116,13 @@
 
     /**
      * Converts a name to a Java type.
-     *
+     * 
      * @param name a well formed Java type in {@linkplain JavaType#getName() internal} format
      * @param accessingClass the context of resolution (may be null)
-     * @param eagerResolve force resolution to a {@link ResolvedJavaType}. If true, this method will either return a
-     *            {@link ResolvedJavaType} or throw an exception
-     * @return a Java type for {@code name} which is guaranteed to be of type {@link ResolvedJavaType} if
-     *         {@code eagerResolve == true}
+     * @param eagerResolve force resolution to a {@link ResolvedJavaType}. If true, this method will
+     *            either return a {@link ResolvedJavaType} or throw an exception
+     * @return a Java type for {@code name} which is guaranteed to be of type
+     *         {@link ResolvedJavaType} if {@code eagerResolve == true}
      * @throws LinkageError if {@code eagerResolve == true} and the resolution failed
      */
     JavaType lookupType(String name, HotSpotResolvedObjectType accessingClass, boolean eagerResolve);
@@ -137,18 +139,17 @@
 
     // Must be kept in sync with enum in graalEnv.hpp
     public enum CodeInstallResult {
-        OK,
-        DEPENDENCIES_FAILED,
-        CACHE_FULL
+        OK, DEPENDENCIES_FAILED, CACHE_FULL
     }
 
     /**
      * Installs the result of a compilation into the code cache.
-     *
+     * 
      * @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
+     * @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);
@@ -167,7 +168,7 @@
 
     /**
      * Gets the compiled code size for a method.
-     *
+     * 
      * @param metaspaceMethod the metaspace Method object to query
      * @return the compiled code size the method
      */
@@ -175,12 +176,13 @@
 
     /**
      * Gets the metaspace Method object corresponding to a given reflection {@link Method} object.
-     *
+     * 
      * @param reflectionMethod
      * @param resultHolder the holder of the result is put in element 0 of this array
      * @return the metaspace Method result for {@code reflectionMethod}
      */
     long getMetaspaceMethod(Method reflectionMethod, HotSpotResolvedObjectType[] resultHolder);
+
     long getMetaspaceConstructor(Constructor reflectionConstructor, HotSpotResolvedObjectType[] resultHolder);
 
     HotSpotResolvedJavaField getJavaField(Field reflectionField);
@@ -201,9 +203,7 @@
 
     String decodePC(long pc);
 
-
     long[] getLineNumberTable(HotSpotResolvedJavaMethod method);
 
-
     String getFileName(HotSpotResolvedJavaType method);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/Marks.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,12 +23,13 @@
 package com.oracle.graal.hotspot.bridge;
 
 /**
- * Constants used to mark special positions in code being installed into
- * the code cache by Graal C++ code. These constants need to be kept in
- * sync with those of the same name defined in graalCodeInstaller.hpp.
+ * Constants used to mark special positions in code being installed into the code cache by Graal C++
+ * code. These constants need to be kept in sync with those of the same name defined in
+ * graalCodeInstaller.hpp.
  */
 public interface Marks {
 
+    // @formatter:off
     // These constants need to correspond to those of the same name in graalCodeInstaller.hpp
     Integer MARK_VERIFIED_ENTRY            = 0x0001;
     Integer MARK_UNVERIFIED_ENTRY          = 0x0002;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/MetricRateInPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,75 @@
+/*
+ * 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.hotspot.bridge;
+
+import java.util.concurrent.*;
+
+import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.internal.*;
+
+/**
+ * The rate of accumulation for a metric within an execution phase.
+ */
+final class MetricRateInPhase {
+
+    private final String phase;
+    private final MetricRateInPhase previous;
+    private final long time;
+    private final long value;
+    private final TimeUnit timeUnit;
+
+    public static MetricRateInPhase snapshot(String phase, MetricRateInPhase previous, DebugMetric metric, DebugTimer timer, TimeUnit timeUnit) {
+        return new MetricRateInPhase(phase, previous, metric, timer, timeUnit);
+    }
+
+    private MetricRateInPhase(String phase, MetricRateInPhase previous, DebugMetric metric, DebugTimer timer, TimeUnit timeUnit) {
+        this.phase = phase;
+        this.previous = previous;
+        this.time = VMToCompilerImpl.collectTotal((DebugValue) timer);
+        this.value = VMToCompilerImpl.collectTotal((DebugValue) metric);
+        this.timeUnit = timeUnit;
+    }
+
+    public int rate() {
+        long t = time;
+        long v = value;
+        if (previous != null) {
+            t -= previous.time;
+            v -= previous.value;
+        }
+
+        t = timeUnit.convert(t, TimeUnit.NANOSECONDS);
+        if (t == 0) {
+            t = 1;
+        }
+        return (int) (v / t);
+    }
+
+    public void printAll(String label) {
+        MetricRateInPhase rs = this;
+        while (rs != null) {
+            System.out.println(label + "@" + rs.phase + ": " + rs.rate());
+            rs = rs.previous;
+        }
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -55,22 +55,20 @@
 
     /**
      * Creates a resolved Java type.
-     *
+     * 
      * @param metaspaceKlass the metaspace Klass object for the type
      * @param name the {@linkplain JavaType#getName() name} of the type
      * @param simpleName a simple, unqualified name for the type
      * @param javaMirror the {@link Class} mirror
      * @param hasFinalizableSubclass specifies if the type has a finalizable subtype
-     * @param sizeOrSpecies the size of an instance of the type, or {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE}
-     * @return the resolved type associated with {@code javaMirror} which may not be the type instantiated by this call
-     *         in the case of another thread racing to create the same type
+     * @param sizeOrSpecies the size of an instance of the type, or
+     *            {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or
+     *            {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE}
+     * @return the resolved type associated with {@code javaMirror} which may not be the type
+     *         instantiated by this call in the case of another thread racing to create the same
+     *         type
      */
-    ResolvedJavaType createResolvedJavaType(long metaspaceKlass,
-                    String name,
-                    String simpleName,
-                    Class javaMirror,
-                    boolean hasFinalizableSubclass,
-                    int sizeOrSpecies);
+    ResolvedJavaType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies);
 
     Constant createConstant(Kind kind, long value);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,9 @@
 package com.oracle.graal.hotspot.bridge;
 
 import static com.oracle.graal.graph.UnsafeAccess.*;
+import static com.oracle.graal.hotspot.CompilationTask.*;
+import static com.oracle.graal.java.GraphBuilderPhase.*;
+import static com.oracle.graal.phases.common.InliningUtil.*;
 
 import java.io.*;
 import java.lang.reflect.*;
@@ -39,7 +42,6 @@
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.hotspot.phases.*;
-import com.oracle.graal.hotspot.snippets.*;
 import com.oracle.graal.java.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
@@ -53,7 +55,6 @@
 public class VMToCompilerImpl implements VMToCompiler {
 
     private final HotSpotGraalRuntime graalRuntime;
-    private IntrinsifyArrayCopyPhase intrinsifyArrayCopy;
 
     public final HotSpotResolvedPrimitiveType typeBoolean;
     public final HotSpotResolvedPrimitiveType typeChar;
@@ -73,6 +74,8 @@
 
     private PrintStream log = System.out;
 
+    private boolean quietMeterAndTime;
+
     public VMToCompilerImpl(HotSpotGraalRuntime compiler) {
         this.graalRuntime = compiler;
 
@@ -93,10 +96,10 @@
         assert unsafe.getObject(mirror, offset) == type;
     }
 
-
     public void startCompiler() throws Throwable {
 
-        long offset = HotSpotGraalRuntime.getInstance().getConfig().graalMirrorInClassOffset;
+        HotSpotVMConfig config = graalRuntime.getConfig();
+        long offset = config.graalMirrorInClassOffset;
         initMirror(typeBoolean, offset);
         initMirror(typeChar, offset);
         initMirror(typeFloat, offset);
@@ -124,6 +127,13 @@
             }
         }
 
+        if (config.ciTime) {
+            quietMeterAndTime = (GraalOptions.Meter == null && GraalOptions.Time == null);
+            GraalOptions.Debug = true;
+            GraalOptions.Meter = "";
+            GraalOptions.Time = "";
+        }
+
         if (GraalOptions.Debug) {
             Debug.enable();
             if (GraalOptions.DebugSnippets) {
@@ -135,13 +145,13 @@
         GraalCompiler compiler = graalRuntime.getCompiler();
         final HotSpotRuntime runtime = (HotSpotRuntime) compiler.runtime;
         if (GraalOptions.Intrinsify) {
-            Debug.scope("InstallSnippets", new Object[] {new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() {
+            Debug.scope("InstallSnippets", new Object[]{new DebugDumpScope("InstallSnippets"), compiler}, new Runnable() {
 
                 @Override
                 public void run() {
-                    // Snippets cannot have speculative optimizations since they have to be valid for the entire run of the VM.
+                    // Snippets cannot have speculative optimizations since they have to be valid
+                    // for the entire run of the VM.
                     Assumptions assumptions = new Assumptions(false);
-                    VMToCompilerImpl.this.intrinsifyArrayCopy = new IntrinsifyArrayCopyPhase(runtime, assumptions);
                     SnippetInstaller installer = new HotSpotSnippetInstaller(runtime, assumptions, runtime.getGraalRuntime().getTarget());
                     GraalIntrinsics.installIntrinsics(installer);
                     runtime.installSnippets(installer, assumptions);
@@ -150,6 +160,10 @@
 
         }
 
+        if (GraalOptions.DebugSnippets) {
+            phaseTransition("snippets");
+        }
+
         // Create compilation queue.
         BlockingQueue<Runnable> queue = GraalOptions.PriorityCompileQueue ? new PriorityBlockingQueue<Runnable>() : new LinkedBlockingQueue<Runnable>();
         compileQueue = new ThreadPoolExecutor(GraalOptions.Threads, GraalOptions.Threads, 0L, TimeUnit.MILLISECONDS, queue, CompilerThread.FACTORY);
@@ -184,9 +198,22 @@
     }
 
     /**
-     * This method is the first method compiled during bootstrapping. Put any code in there that warms up compiler paths
-     * that are otherwise not exercised during bootstrapping and lead to later deoptimization when application code is
-     * compiled.
+     * Take action related to entering a new execution phase.
+     * 
+     * @param phase the execution phase being entered
+     */
+    protected void phaseTransition(String phase) {
+        CompilationStatistics.clear(phase);
+        if (graalRuntime.getConfig().ciTime) {
+            parsedBytecodesPerSecond = MetricRateInPhase.snapshot(phase, parsedBytecodesPerSecond, BytecodesParsed, CompilationTime, TimeUnit.SECONDS);
+            inlinedBytecodesPerSecond = MetricRateInPhase.snapshot(phase, inlinedBytecodesPerSecond, InlinedBytecodes, CompilationTime, TimeUnit.SECONDS);
+        }
+    }
+
+    /**
+     * This method is the first method compiled during bootstrapping. Put any code in there that
+     * warms up compiler paths that are otherwise not exercised during bootstrapping and lead to
+     * later deoptimization when application code is compiled.
      */
     @SuppressWarnings("unused")
     @Deprecated
@@ -242,7 +269,9 @@
                 }
             }
         } while ((System.currentTimeMillis() - startTime) <= GraalOptions.TimedBootstrap);
-        CompilationStatistics.clear("bootstrap");
+
+        phaseTransition("bootstrap");
+
         bootstrapRunning = false;
 
         TTY.println(" in %d ms", System.currentTimeMillis() - startTime);
@@ -250,9 +279,12 @@
             graalRuntime.getCache().clear();
         }
         System.gc();
-        CompilationStatistics.clear("bootstrap2");
+        phaseTransition("bootstrap2");
     }
 
+    private MetricRateInPhase parsedBytecodesPerSecond;
+    private MetricRateInPhase inlinedBytecodesPerSecond;
+
     private void enqueue(Method m) throws Throwable {
         JavaMethod javaMethod = graalRuntime.getRuntime().lookupJavaMethod(m);
         assert !Modifier.isAbstract(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) && !Modifier.isNative(((HotSpotResolvedJavaMethod) javaMethod).getModifiers()) : javaMethod;
@@ -279,13 +311,12 @@
             CompilationTask.withinEnqueue.set(Boolean.FALSE);
         }
 
-
-        if (Debug.isEnabled()) {
+        if (Debug.isEnabled() && !quietMeterAndTime) {
             List<DebugValueMap> topLevelMaps = DebugValueMap.getTopLevelMaps();
             List<DebugValue> debugValues = KeyRegistry.getDebugValues();
             if (debugValues.size() > 0) {
                 ArrayList<DebugValue> sortedValues = new ArrayList<>(debugValues);
-                Collections.sort(sortedValues, DebugValue.ORDER_BY_NAME);
+                Collections.sort(sortedValues);
 
                 if (GraalOptions.SummarizeDebugValues) {
                     printSummary(topLevelMaps, sortedValues);
@@ -302,9 +333,7 @@
                         if (GraalOptions.SummarizePerPhase) {
                             flattenChildren(map, globalMap);
                         } else {
-                            for (DebugValueMap child : map.getChildren()) {
-                                globalMap.addChild(child);
-                            }
+                            globalMap.addChild(map);
                         }
                     }
                     if (!GraalOptions.SummarizePerPhase) {
@@ -315,7 +344,13 @@
                 }
             }
         }
-        CompilationStatistics.clear("final");
+        phaseTransition("final");
+
+        if (graalRuntime.getConfig().ciTime) {
+            parsedBytecodesPerSecond.printAll("ParsedBytecodesPerSecond");
+            inlinedBytecodesPerSecond.printAll("InlinedBytecodesPerSecond");
+        }
+
         SnippetCounter.printGroups(TTY.out().out());
     }
 
@@ -338,6 +373,18 @@
         printMap(result, debugValues, 0);
     }
 
+    static long collectTotal(DebugValue value) {
+        List<DebugValueMap> maps = DebugValueMap.getTopLevelMaps();
+        long total = 0;
+        for (int i = 0; i < maps.size(); i++) {
+            DebugValueMap map = maps.get(i);
+            int index = value.getIndex();
+            total += map.getCurrentValue(index);
+            total += collectTotal(map.getChildren(), index);
+        }
+        return total;
+    }
+
     private static long collectTotal(List<DebugValueMap> maps, int index) {
         long total = 0;
         for (int i = 0; i < maps.size(); i++) {
@@ -381,13 +428,16 @@
 
     /**
      * Compiles a method to machine code.
-     * @return true if the method is in the queue (either added to the queue or already in the queue)
+     * 
+     * @return true if the method is in the queue (either added to the queue or already in the
+     *         queue)
      */
     public boolean compileMethod(final HotSpotResolvedJavaMethod method, final int entryBCI, boolean blocking, int priority) throws Throwable {
         CompilationTask current = method.currentTask();
         boolean osrCompilation = entryBCI != StructuredGraph.INVOCATION_ENTRY_BCI;
         if (osrCompilation && bootstrapRunning) {
-            // no OSR compilations during bootstrap - the compiler is just too slow at this point, and we know that there are no endless loops
+            // no OSR compilations during bootstrap - the compiler is just too slow at this point,
+            // and we know that there are no endless loops
             return current != null;
         }
 
@@ -404,15 +454,18 @@
             if (!blocking && current != null) {
                 if (current.isInProgress()) {
                     if (current.getEntryBCI() == entryBCI) {
-                        // a compilation with the correct bci is already in progress, so just return true
+                        // a compilation with the correct bci is already in progress, so just return
+                        // true
                         return true;
                     }
                 } else {
                     if (GraalOptions.PriorityCompileQueue) {
-                        // normally compilation tasks will only be re-queued when they get a priority boost, so cancel the old task and add a new one
+                        // normally compilation tasks will only be re-queued when they get a
+                        // priority boost, so cancel the old task and add a new one
                         current.cancel();
                     } else {
-                        // without a prioritizing compile queue it makes no sense to re-queue the compilation task
+                        // without a prioritizing compile queue it makes no sense to re-queue the
+                        // compilation task
                         return true;
                     }
                 }
@@ -510,19 +563,8 @@
     }
 
     @Override
-    public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass,
-                    String name,
-                    String simpleName,
-                    Class javaMirror,
-                    boolean hasFinalizableSubclass,
-                    int sizeOrSpecies) {
-        HotSpotResolvedObjectType type = new HotSpotResolvedObjectType(
-                                        metaspaceKlass,
-                                        name,
-                                        simpleName,
-                                        javaMirror,
-                                        hasFinalizableSubclass,
-                                        sizeOrSpecies);
+    public HotSpotResolvedObjectType createResolvedJavaType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies) {
+        HotSpotResolvedObjectType type = new HotSpotResolvedObjectType(metaspaceKlass, name, simpleName, javaMirror, hasFinalizableSubclass, sizeOrSpecies);
 
         long offset = HotSpotGraalRuntime.getInstance().getConfig().graalMirrorInClassOffset;
         if (!unsafe.compareAndSwapObject(javaMirror, offset, null, type)) {
@@ -572,9 +614,6 @@
         if (onStackReplacement) {
             phasePlan.addPhase(PhasePosition.AFTER_PARSING, new OnStackReplacementPhase());
         }
-        if (GraalOptions.Intrinsify && GraalOptions.IntrinsifyArrayCopy) {
-            phasePlan.addPhase(PhasePosition.HIGH_LEVEL, intrinsifyArrayCopy);
-        }
         return phasePlan;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LineNumberTableImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/LineNumberTableImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.api.meta.*;
 
+public class LineNumberTableImpl implements LineNumberTable {
 
-public class LineNumberTableImpl implements LineNumberTable {
     private final int[] lineNumbers;
     private final int[] bci;
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import java.util.concurrent.atomic.*;
 
 /**
- * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return
- * values.
+ * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
+ * parameters and return values.
  */
 public class CountingProxy<T> implements InvocationHandler {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java	Fri Feb 01 17:06:26 2013 +0100
@@ -44,6 +44,7 @@
     static {
         if (ENABLED) {
             loggerTL = new ThreadLocal<Logger>() {
+
                 @Override
                 protected Logger initialValue() {
                     return new Logger();
@@ -53,7 +54,6 @@
             loggerTL = null;
         }
 
-
         PrintStream ps = null;
         String filename = System.getProperty("graal.info_file");
         if (filename != null && !"".equals(filename)) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/LoggingProxy.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import java.lang.reflect.*;
 
 /**
- * A java.lang.reflect proxy that hierarchically logs all method invocations along with their parameters and return values.
+ * A java.lang.reflect proxy that hierarchically logs all method invocations along with their
+ * parameters and return values.
  */
 public class LoggingProxy<T> implements InvocationHandler {
 
@@ -65,7 +66,8 @@
     }
 
     /**
-     * The object returned by this method will implement all interfaces that are implemented by delegate.
+     * The object returned by this method will implement all interfaces that are implemented by
+     * delegate.
      */
     public static <T> T getProxy(Class<T> interf, T delegate) {
         Class<?>[] interfaces = ProxyUtil.getAllInterfaces(delegate.getClass());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/ProxyUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,16 +24,16 @@
 
 import java.util.*;
 
+public final class ProxyUtil {
 
-public final class ProxyUtil {
     public static Class<?>[] getAllInterfaces(Class<?> clazz) {
-        HashSet<Class< ? >> interfaces = new HashSet<>();
+        HashSet<Class<?>> interfaces = new HashSet<>();
         getAllInterfaces(clazz, interfaces);
         return interfaces.toArray(new Class<?>[interfaces.size()]);
     }
 
     private static void getAllInterfaces(Class<?> clazz, HashSet<Class<?>> interfaces) {
-        for (Class< ? > iface : clazz.getInterfaces()) {
+        for (Class<?> iface : clazz.getInterfaces()) {
             if (!interfaces.contains(iface)) {
                 interfaces.add(iface);
                 getAllInterfaces(iface, interfaces);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,3 +24,4 @@
  * Logging framework for the HotSpot CRI implementation.
  */
 package com.oracle.graal.hotspot.logging;
+
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,22 +34,24 @@
 
 /**
  * This class implements the graph caching system for the HotSpot platform.
- *
- * This implementation does not use a map to store the actual cached graphs. The problem is that such maps keep the
- * graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph, alive. For some applications and benchmarks this
- * is a problem, e.g., the DaCapoScala "scalatest" benchmark will quickly run out of perm gen because of this.
- *
- * This cannot be solved with a {@code WeakHashMap<ResolvedJavaMethod, Graph>}, since the values within the map will keep the keys
- * alive. In order for this to work we would require a weak map in which the "strongness" of the value references
- * depends upon the reachability of the keys.
- *
- * Therefore the graph cache is implemented in such a way that it stores its cache entries within the {@link ResolvedJavaMethod}.
- * It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map with the HotSpotGraphCache instance as key.
- * The cached graph will be kept alive as long as the {@link ResolvedJavaMethod} is alive, but does not prevent the method, and
- * therefore the class, from being unloaded.
- *
- * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of deoptimization, and to
- * enforce the graph cache size restriction.
+ * 
+ * This implementation does not use a map to store the actual cached graphs. The problem is that
+ * such maps keep the graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph,
+ * alive. For some applications and benchmarks this is a problem, e.g., the DaCapoScala "scalatest"
+ * benchmark will quickly run out of perm gen because of this.
+ * 
+ * This cannot be solved with a {@code WeakHashMap<ResolvedJavaMethod, Graph>}, since the values
+ * within the map will keep the keys alive. In order for this to work we would require a weak map in
+ * which the "strongness" of the value references depends upon the reachability of the keys.
+ * 
+ * Therefore the graph cache is implemented in such a way that it stores its cache entries within
+ * the {@link ResolvedJavaMethod}. It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map
+ * with the HotSpotGraphCache instance as key. The cached graph will be kept alive as long as the
+ * {@link ResolvedJavaMethod} is alive, but does not prevent the method, and therefore the class,
+ * from being unloaded.
+ * 
+ * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of
+ * deoptimization, and to enforce the graph cache size restriction.
  */
 public class HotSpotGraphCache implements GraphCache {
 
@@ -62,8 +64,9 @@
     private volatile long putCounter;
 
     /**
-     * An ordered hash map for looking up the methods corresponding to a specific graph id. It enforces the maximum
-     * graph cache size by removing the oldest (in insertion-order) element if the cache gets too big.
+     * An ordered hash map for looking up the methods corresponding to a specific graph id. It
+     * enforces the maximum graph cache size by removing the oldest (in insertion-order) element if
+     * the cache gets too big.
      */
     private final class LRUCache extends LinkedHashMap<Long, WeakReference<ResolvedJavaMethod>> {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotInstalledCode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,9 +29,8 @@
 import com.oracle.graal.hotspot.*;
 
 /**
- * Implementation of {@link InstalledCode} for HotSpot.
- * Stores a reference to the nmethod which contains the compiled code.
- * The nmethod also stores a weak reference to the HotSpotCompiledMethod
+ * Implementation of {@link InstalledCode} for HotSpot. Stores a reference to the nmethod which
+ * contains the compiled code. The nmethod also stores a weak reference to the HotSpotCompiledMethod
  * instance which is necessary to keep the nmethod from being unloaded.
  */
 public class HotSpotInstalledCode extends CompilerObject implements InstalledCode {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotJavaType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
  * Common interface for all HotSpot {@link JavaType} implementations.
  */
 public abstract class HotSpotJavaType extends CompilerObject implements JavaType {
+
     private static final long serialVersionUID = -4252886265301910771L;
 
     private final String name;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,11 +45,8 @@
     private static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(ExceptionSeen.NOT_SUPPORTED);
 
     // sorted by tag
-    private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {
-        null, new BitData(), new CounterData(), new JumpData(),
-        new TypeCheckData(), new VirtualCallData(), new RetData(),
-        new BranchData(), new MultiBranchData(), new ArgInfoData()
-    };
+    private static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = {null, new BitData(), new CounterData(), new JumpData(), new TypeCheckData(), new VirtualCallData(), new RetData(),
+                    new BranchData(), new MultiBranchData(), new ArgInfoData()};
 
     /**
      * Reference to the C++ MethodData object.
@@ -164,6 +161,7 @@
     }
 
     private abstract static class AbstractMethodData implements HotSpotMethodDataAccessor {
+
         /**
          * Corresponds to DS_RECOMPILE_BIT defined in deoptimization.cpp.
          */
@@ -230,6 +228,7 @@
     }
 
     private static class NoMethodData extends AbstractMethodData {
+
         private static final int NO_DATA_TAG = 0;
         private static final int NO_DATA_SIZE = cellIndexToOffset(0);
 
@@ -245,7 +244,6 @@
             return -1;
         }
 
-
         @Override
         public ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position) {
             return exceptionSeen;
@@ -253,6 +251,7 @@
     }
 
     private static class BitData extends AbstractMethodData {
+
         private static final int BIT_DATA_TAG = 1;
         private static final int BIT_DATA_SIZE = cellIndexToOffset(0);
         private static final int BIT_DATA_NULL_SEEN_FLAG = 0x01;
@@ -272,6 +271,7 @@
     }
 
     private static class CounterData extends BitData {
+
         private static final int COUNTER_DATA_TAG = 2;
         private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
         private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(0);
@@ -295,6 +295,7 @@
     }
 
     private static class JumpData extends AbstractMethodData {
+
         private static final int JUMP_DATA_TAG = 3;
         private static final int JUMP_DATA_SIZE = cellIndexToOffset(2);
         protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(0);
@@ -325,6 +326,7 @@
     }
 
     private abstract static class AbstractTypeData extends CounterData {
+
         private static final int RECEIVER_TYPE_DATA_ROW_SIZE = cellsToBytes(2);
         private static final int RECEIVER_TYPE_DATA_SIZE = cellIndexToOffset(2) + RECEIVER_TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
         protected static final int NONPROFILED_RECEIVER_COUNT_OFFSET = cellIndexToOffset(1);
@@ -393,6 +395,7 @@
     }
 
     private static class TypeCheckData extends AbstractTypeData {
+
         private static final int RECEIVER_TYPE_DATA_TAG = 4;
 
         public TypeCheckData() {
@@ -411,6 +414,7 @@
     }
 
     private static class VirtualCallData extends AbstractTypeData {
+
         private static final int VIRTUAL_CALL_DATA_TAG = 5;
 
         public VirtualCallData() {
@@ -437,6 +441,7 @@
     }
 
     private static class RetData extends CounterData {
+
         private static final int RET_DATA_TAG = 6;
         private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
         private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
@@ -447,6 +452,7 @@
     }
 
     private static class BranchData extends JumpData {
+
         private static final int BRANCH_DATA_TAG = 7;
         private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
         private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(2);
@@ -476,6 +482,7 @@
     }
 
     private static class ArrayData extends AbstractMethodData {
+
         private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(0);
         protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(1);
 
@@ -494,6 +501,7 @@
     }
 
     private static class MultiBranchData extends ArrayData {
+
         private static final int MULTI_BRANCH_DATA_TAG = 8;
         private static final int MULTI_BRANCH_DATA_SIZE = cellIndexToOffset(1);
         private static final int MULTI_BRANCH_DATA_ROW_SIZE_IN_CELLS = 2;
@@ -571,6 +579,7 @@
     }
 
     private static class ArgInfoData extends ArrayData {
+
         private static final int ARG_INFO_DATA_TAG = 9;
         private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodDataAccessor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,32 +26,40 @@
 import com.oracle.graal.api.meta.ProfilingInfo.ExceptionSeen;
 
 /**
- * Interface for accessor objects that encapsulate the logic for accessing the different kinds of data in a HotSpot methodDataOop.
- * This interface is similar to the interface {@link ProfilingInfo}, but most methods require a MethodDataObject and the
- * exact position within the methodData.
+ * Interface for accessor objects that encapsulate the logic for accessing the different kinds of
+ * data in a HotSpot methodDataOop. This interface is similar to the interface {@link ProfilingInfo}
+ * , but most methods require a MethodDataObject and the exact position within the methodData.
  */
 public interface HotSpotMethodDataAccessor {
+
     /**
      * Returns the tag stored in the LayoutData header.
+     * 
      * @return An integer >= 0 or -1 if not supported.
      */
     int getTag();
 
     /**
      * Returns the BCI stored in the LayoutData header.
+     * 
      * @return An integer >= 0 and <= Short.MAX_VALUE, or -1 if not supported.
      */
     int getBCI(HotSpotMethodData data, int position);
 
     /**
      * Computes the size for the specific data at the given position.
+     * 
      * @return An integer > 0.
      */
     int getSize(HotSpotMethodData data, int position);
 
     JavaTypeProfile getTypeProfile(HotSpotMethodData data, int position);
+
     double getBranchTakenProbability(HotSpotMethodData data, int position);
+
     double[] getSwitchProbabilities(HotSpotMethodData data, int position);
+
     ExceptionSeen getExceptionSeen(HotSpotMethodData data, int position);
+
     int getExecutionCount(HotSpotMethodData data, int position);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethodUnresolved.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
  * Implementation of {@link JavaMethod} for unresolved HotSpot methods.
  */
 public final class HotSpotMethodUnresolved extends HotSpotMethod {
+
     private static final long serialVersionUID = 5610263481791970079L;
     private final Signature signature;
     protected JavaType holder;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotProfilingInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.hotspot.*;
 
-
 public final class HotSpotProfilingInfo extends CompilerObject implements ProfilingInfo {
 
     private static final long serialVersionUID = -8307682725047864875L;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,8 @@
  */
 public class HotSpotResolvedJavaField extends CompilerObject implements ResolvedJavaField {
 
-    // Must not conflict with any fields flags used by the VM - the assertion in the constructor checks this assumption
+    // Must not conflict with any fields flags used by the VM - the assertion in the constructor
+    // checks this assumption
     private static final int FIELD_INTERNAL_FLAG = 0x80000000;
 
     private static final long serialVersionUID = 7692985878836955683L;
@@ -109,7 +110,7 @@
         }
     }
 
-    private static boolean assumeStaticFieldsFinal(Class< ? > clazz) {
+    private static boolean assumeStaticFieldsFinal(Class<?> clazz) {
         return clazz == GraalOptions.class;
     }
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java	Fri Feb 01 17:06:26 2013 +0100
@@ -50,8 +50,8 @@
     final long metaspaceMethod;
 
     private final HotSpotResolvedObjectType holder;
-    private /*final*/ int codeSize;
-    private /*final*/ int exceptionHandlerCount;
+    private/* final */int codeSize;
+    private/* final */int exceptionHandlerCount;
     private Signature signature;
     private Boolean hasBalancedMonitors;
     private Map<Object, Object> compilerStorage;
@@ -130,7 +130,8 @@
     @Override
     public int getMaxLocals() {
         HotSpotVMConfig config = HotSpotGraalRuntime.getInstance().getConfig();
-        return unsafe.getShort(metaspaceMethod + config.methodMaxLocalsOffset) & 0xFFFF;
+        long metaspaceConstMethod = unsafe.getLong(metaspaceMethod + config.methodConstMethodOffset);
+        return unsafe.getShort(metaspaceConstMethod + config.methodMaxLocalsOffset) & 0xFFFF;
     }
 
     @Override
@@ -209,7 +210,8 @@
         }
 
         if (methodData == null || (!methodData.hasNormalData() && !methodData.hasExtraData())) {
-            // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in case of a deoptimization.
+            // Be optimistic and return false for exceptionSeen. A methodDataOop is allocated in
+            // case of a deoptimization.
             info = DefaultProfilingInfo.get(ExceptionSeen.FALSE);
         } else {
             info = new HotSpotProfilingInfo(methodData, codeSize);
@@ -263,7 +265,7 @@
     public Class<?>[] signatureToTypes() {
         Signature sig = getSignature();
         int count = sig.getParameterCount(false);
-        Class< ? >[] result = new Class< ? >[count];
+        Class<?>[] result = new Class<?>[count];
         for (int i = 0; i < result.length; ++i) {
             result[i] = ((HotSpotResolvedJavaType) sig.getParameterType(i, holder).resolve(holder)).mirror();
         }
@@ -307,8 +309,9 @@
     }
 
     /**
-     * Returns the offset of this method into the v-table.
-     * If the holder is not initialized, returns -1
+     * Returns the offset of this method into the v-table. If the holder is not initialized, returns
+     * -1
+     * 
      * @return the offset of this method into the v-table
      */
     public int vtableEntryOffset() {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,8 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.hotspot.*;
 
+public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
 
-public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
     private static final long serialVersionUID = -6410840212023428347L;
 
     public HotSpotResolvedJavaType(String name) {
@@ -37,6 +37,6 @@
 
     @Override
     public String getSourceFileName() {
-       return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this);
+        return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -42,14 +42,16 @@
     private static final long serialVersionUID = 3481514353553840471L;
 
     /**
-     * Value for the {@code sizeOrSpecies} parameter in {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType}
-     * denoting that the new type represents an interface class.
+     * Value for the {@code sizeOrSpecies} parameter in
+     * {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} denoting that the new type
+     * represents an interface class.
      */
     public static final int INTERFACE_SPECIES_VALUE = Integer.MIN_VALUE;
 
     /**
-     * Value for the {@code sizeOrSpecies} parameter in {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType}
-     * denoting that the new type represents an array class.
+     * Value for the {@code sizeOrSpecies} parameter in
+     * {@link HotSpotResolvedObjectType#HotSpotResolvedObjectType} denoting that the new type
+     * represents an array class.
      */
     public static final int ARRAY_SPECIES_VALUE = Integer.MAX_VALUE;
 
@@ -63,8 +65,9 @@
     private final boolean hasFinalizableSubclass;
 
     /**
-     * The instance size (in bytes) for an instance type, {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} denoting
-     * an interface type or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} denoting an array type.
+     * The instance size (in bytes) for an instance type,
+     * {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} denoting an interface type or
+     * {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE} denoting an array type.
      */
     private final int sizeOrSpecies;
 
@@ -78,7 +81,7 @@
 
     /**
      * Gets the Graal mirror from a HotSpot metaspace Klass native object.
-     *
+     * 
      * @param metaspaceKlass a metaspace Klass object boxed in a {@link Constant}
      * @return the {@link ResolvedJavaType} corresponding to {@code klassConstant}
      */
@@ -89,7 +92,7 @@
 
     /**
      * Gets the Graal mirror from a HotSpot metaspace Klass native object.
-     *
+     * 
      * @param metaspaceKlass a metaspace Klass object
      * @return the {@link ResolvedJavaType} corresponding to {@code metaspaceKlass}
      */
@@ -102,7 +105,7 @@
 
     /**
      * Gets the Graal mirror from a {@link Class} object.
-     *
+     * 
      * @return the {@link HotSpotResolvedObjectType} corresponding to {@code javaClass}
      */
     public static ResolvedJavaType fromClass(Class javaClass) {
@@ -117,14 +120,11 @@
 
     /**
      * @param hasFinalizableSubclass
-     * @param sizeOrSpecies the size of an instance of the type, or {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE}
+     * @param sizeOrSpecies the size of an instance of the type, or
+     *            {@link HotSpotResolvedObjectType#INTERFACE_SPECIES_VALUE} or
+     *            {@link HotSpotResolvedObjectType#ARRAY_SPECIES_VALUE}
      */
-    public HotSpotResolvedObjectType(long metaspaceKlass,
-                    String name,
-                    String simpleName,
-                    Class javaMirror,
-                    boolean hasFinalizableSubclass,
-                    int sizeOrSpecies) {
+    public HotSpotResolvedObjectType(long metaspaceKlass, String name, String simpleName, Class javaMirror, boolean hasFinalizableSubclass, int sizeOrSpecies) {
         super(name);
         this.metaspaceKlass = metaspaceKlass;
         this.javaMirror = javaMirror;
@@ -134,7 +134,7 @@
         assert name.charAt(0) != '[' || sizeOrSpecies == ARRAY_SPECIES_VALUE : name + " " + Long.toHexString(sizeOrSpecies);
         assert javaMirror.isArray() == isArray();
         assert javaMirror.isInterface() == isInterface();
-        //System.out.println("0x" + Long.toHexString(metaspaceKlass) + ": " + name);
+        // System.out.println("0x" + Long.toHexString(metaspaceKlass) + ": " + name);
     }
 
     @Override
@@ -225,14 +225,14 @@
             HotSpotResolvedObjectType t1 = this;
             HotSpotResolvedObjectType t2 = (HotSpotResolvedObjectType) otherType;
             while (true) {
-              if (t1.isAssignableFrom(t2)) {
-                  return t1;
-              }
-              if (t2.isAssignableFrom(t1)) {
-                  return t2;
-              }
-              t1 = t1.getSupertype();
-              t2 = t2.getSupertype();
+                if (t1.isAssignableFrom(t2)) {
+                    return t1;
+                }
+                if (t2.isAssignableFrom(t1)) {
+                    return t2;
+                }
+                t1 = t1.getSupertype();
+                t2 = t2.getSupertype();
             }
         }
     }
@@ -346,9 +346,9 @@
     }
 
     /**
-     * Gets the instance size of this type. If an instance of this type cannot
-     * be fast path allocated, then the returned value is negative (its absolute
-     * value gives the size). Must not be called if this is an array or interface type.
+     * Gets the instance size of this type. If an instance of this type cannot be fast path
+     * allocated, then the returned value is negative (its absolute value gives the size). Must not
+     * be called if this is an array or interface type.
      */
     public int instanceSize() {
         assert !isArray();
@@ -375,7 +375,8 @@
 
         long id = offset + ((long) flags << 32);
 
-        // (thomaswue) Must cache the fields, because the local load elimination only works if the objects from two field lookups are identical.
+        // (thomaswue) Must cache the fields, because the local load elimination only works if the
+        // objects from two field lookups are identical.
         if (fieldCache == null) {
             fieldCache = new HashMap<>(8);
         } else {
@@ -399,6 +400,7 @@
     }
 
     private static class OffsetComparator implements Comparator<HotSpotResolvedJavaField> {
+
         @Override
         public int compare(HotSpotResolvedJavaField o1, HotSpotResolvedJavaField o2) {
             return o1.offset() - o2.offset();
@@ -447,7 +449,7 @@
 
     @Override
     public String getSourceFileName() {
-       return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this);
+        return HotSpotGraalRuntime.getInstance().getCompilerToVM().getFileName(this);
     }
 
     @Override
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java	Fri Feb 01 17:06:26 2013 +0100
@@ -186,7 +186,7 @@
     }
 
     @Override
-    public Class< ? > mirror() {
+    public Class<?> mirror() {
         return javaMirror;
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.hotspot.meta;
 
+import static com.oracle.graal.api.code.CallingConvention.Type.*;
 import static com.oracle.graal.api.code.DeoptimizationAction.*;
 import static com.oracle.graal.api.code.MemoryBarriers.*;
 import static com.oracle.graal.api.code.Register.RegisterFlag.*;
@@ -29,12 +30,11 @@
 import static com.oracle.graal.api.meta.Value.*;
 import static com.oracle.graal.hotspot.HotSpotGraalRuntime.*;
 import static com.oracle.graal.hotspot.snippets.SystemSubstitutions.*;
-import static com.oracle.graal.java.GraphBuilderPhase.*;
+import static com.oracle.graal.java.GraphBuilderPhase.RuntimeCalls.*;
 import static com.oracle.graal.nodes.UnwindNode.*;
 import static com.oracle.graal.nodes.java.RegisterFinalizerNode.*;
 import static com.oracle.graal.snippets.Log.*;
 import static com.oracle.graal.snippets.MathSubstitutionsX86.*;
-import static com.oracle.graal.api.code.CallingConvention.Type.*;
 
 import java.lang.reflect.*;
 import java.util.*;
@@ -74,6 +74,7 @@
  * HotSpot implementation of {@link GraalCodeCacheProvider}.
  */
 public abstract class HotSpotRuntime implements GraalCodeCacheProvider, SnippetProvider {
+
     public final HotSpotVMConfig config;
 
     protected final RegisterConfig regConfig;
@@ -92,16 +93,15 @@
     private final Map<ResolvedJavaMethod, Stub> stubs = new HashMap<>();
 
     /**
-     * Holds onto objects that will be embedded in compiled code. HotSpot treats oops
-     * embedded in code as weak references so without an external strong root, such
-     * an embedded oop will quickly die. This in turn will cause the nmethod to
-     * be unloaded.
+     * Holds onto objects that will be embedded in compiled code. HotSpot treats oops embedded in
+     * code as weak references so without an external strong root, such an embedded oop will quickly
+     * die. This in turn will cause the nmethod to be unloaded.
      */
     private final Map<Object, Object> gcRoots = new HashMap<>();
 
     /**
      * The offset from the origin of an array to the first element.
-     *
+     * 
      * @return the offset in bytes
      */
     public static int getArrayBaseOffset(Kind kind) {
@@ -131,7 +131,7 @@
 
     /**
      * The scale used for the index when accessing elements of an array of this kind.
-     *
+     * 
      * @return the scale in order to convert the index into a byte offset
      */
     public static int getArrayIndexScale(Kind kind) {
@@ -203,6 +203,8 @@
         regConfig = createRegisterConfig(false);
         globalStubRegConfig = createRegisterConfig(true);
 
+        // @formatter:off
+
         addRuntimeCall(UNWIND_EXCEPTION, config.unwindExceptionStub,
                         /*           temps */ null,
                         /*             ret */ ret(Kind.Void),
@@ -270,12 +272,13 @@
                         /*             ret */ ret(Kind.Void),
                         /* arg0:    object */ javaCallingConvention(Kind.Object,
                         /* arg1:     flags */                       Kind.Int));
+
+        // @formatter:on
     }
 
-
     /**
      * Registers the details for linking a runtime call.
-     *
+     * 
      * @param descriptor name and signature of the call
      * @param address target address of the call
      * @param tempRegs temporary registers used (and killed) by the call (null if none)
@@ -310,7 +313,7 @@
 
     /**
      * Binds a snippet-base {@link Stub} to a runtime call descriptor.
-     *
+     * 
      * @return the linkage information for a call to the stub
      */
     public HotSpotRuntimeCallTarget registerStub(Descriptor descriptor, Stub stub) {
@@ -458,10 +461,7 @@
             String nl = HexCodeFile.NEW_LINE;
             StringBuilder buf = new StringBuilder("------ Exception Handlers ------").append(nl);
             for (CompilationResult.ExceptionHandler e : tm.getExceptionHandlers()) {
-                buf.append("    ").
-                    append(e.pcOffset).append(" -> ").
-                    append(e.handlerPos).
-                    append(nl);
+                buf.append("    ").append(e.pcOffset).append(" -> ").append(e.handlerPos).append(nl);
                 hcf.addComment(e.pcOffset, "[exception -> " + e.handlerPos + "]");
                 hcf.addComment(e.handlerPos, "[exception handler for " + e.pcOffset + "]");
             }
@@ -504,7 +504,8 @@
     }
 
     /**
-     * HotSpots needs an area suitable for storing a program counter for temporary use during the deoptimization process.
+     * HotSpots needs an area suitable for storing a program counter for temporary use during the
+     * deoptimization process.
      */
     @Override
     public int getCustomStackAreaSize() {
@@ -544,22 +545,23 @@
                 JavaType[] signature = MetaUtil.signatureToTypes(callTarget.targetMethod().getSignature(), callTarget.isStatic() ? null : callTarget.targetMethod().getDeclaringClass());
 
                 AbstractCallTargetNode loweredCallTarget = null;
-                if (callTarget.invokeKind() == InvokeKind.Virtual &&
-                    GraalOptions.InlineVTableStubs &&
-                    (GraalOptions.AlwaysInlineVTableStubs || invoke.isPolymorphic())) {
+                if (callTarget.invokeKind() == InvokeKind.Virtual && GraalOptions.InlineVTableStubs && (GraalOptions.AlwaysInlineVTableStubs || invoke.isPolymorphic())) {
 
                     HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod();
                     if (!hsMethod.getDeclaringClass().isInterface()) {
                         int vtableEntryOffset = hsMethod.vtableEntryOffset();
                         if (vtableEntryOffset > 0) {
-                            // We use LocationNode.ANY_LOCATION for the reads that access the vtable entry and the compiled code entry
+                            // We use LocationNode.ANY_LOCATION for the reads that access the vtable
+                            // entry and the compiled code entry
                             // as HotSpot does not guarantee they are final values.
                             assert vtableEntryOffset > 0;
                             LoadHubNode hub = graph.add(new LoadHubNode(receiver, wordKind));
                             ReadNode metaspaceMethod = graph.add(new ReadNode(hub, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, vtableEntryOffset, graph), StampFactory.forKind(wordKind())));
-                            ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph), StampFactory.forKind(wordKind())));
+                            ReadNode compiledEntry = graph.add(new ReadNode(metaspaceMethod, LocationNode.create(LocationNode.ANY_LOCATION, wordKind, config.methodCompiledEntryOffset, graph),
+                                            StampFactory.forKind(wordKind())));
 
-                            loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall));
+                            loweredCallTarget = graph.add(new HotSpotIndirectCallTargetNode(metaspaceMethod, compiledEntry, parameters, invoke.node().stamp(), signature, callTarget.targetMethod(),
+                                            CallingConvention.Type.JavaCall));
 
                             graph.addBeforeFixed(invoke.node(), hub);
                             graph.addAfterFixed(hub, metaspaceMethod);
@@ -569,7 +571,8 @@
                 }
 
                 if (loweredCallTarget == null) {
-                    loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall, callTarget.invokeKind()));
+                    loweredCallTarget = graph.add(new HotSpotDirectCallTargetNode(parameters, invoke.node().stamp(), signature, callTarget.targetMethod(), CallingConvention.Type.JavaCall,
+                                    callTarget.invokeKind()));
                 }
                 callTarget.replaceAndDelete(loweredCallTarget);
             }
@@ -673,7 +676,8 @@
             assert load.kind() != Kind.Illegal;
             IndexedLocationNode location = IndexedLocationNode.create(LocationNode.ANY_LOCATION, load.accessKind(), load.displacement(), load.offset(), graph, false);
             ReadNode memoryRead = graph.add(new ReadNode(load.object(), location, load.stamp()));
-            // An unsafe read must not floating outside its block as may float above an explicit null check on its object.
+            // An unsafe read must not floating outside its block as may float above an explicit
+            // null check on its object.
             memoryRead.dependencies().add(BeginNode.prevBegin(load));
             graph.replaceFixedWithFixed(load, memoryRead);
         } else if (n instanceof UnsafeStoreNode) {
@@ -734,7 +738,8 @@
         } else if (n instanceof NewMultiArrayNode) {
             newObjectSnippets.lower((NewMultiArrayNode) n, tool);
         } 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.
+            // Nothing to do for division nodes. The HotSpot signal handler catches divisions by
+            // zero and the MIN_VALUE / -1 cases.
         } else {
             assert false : "Node implementing Lowerable not handled: " + n;
             throw GraalInternalError.shouldNotReachHere();
@@ -775,9 +780,9 @@
 
     /**
      * Gets the stub corresponding to a given method.
-     *
-     * @return the stub {@linkplain Stub#getMethod() implemented} by {@code method} or null if {@code method} does not
-     *         implement a stub
+     * 
+     * @return the stub {@linkplain Stub#getMethod() implemented} by {@code method} or null if
+     *         {@code method} does not implement a stub
      */
     public Stub asStub(ResolvedJavaMethod method) {
         return stubs.get(method);
@@ -845,32 +850,52 @@
     }
 
     public int convertDeoptAction(DeoptimizationAction action) {
-        switch(action) {
-            case None: return config.deoptActionNone;
-            case RecompileIfTooManyDeopts: return config.deoptActionMaybeRecompile;
-            case InvalidateReprofile: return config.deoptActionReinterpret;
-            case InvalidateRecompile: return config.deoptActionMakeNotEntrant;
-            case InvalidateStopCompiling: return config.deoptActionMakeNotCompilable;
-            default: throw GraalInternalError.shouldNotReachHere();
+        switch (action) {
+            case None:
+                return config.deoptActionNone;
+            case RecompileIfTooManyDeopts:
+                return config.deoptActionMaybeRecompile;
+            case InvalidateReprofile:
+                return config.deoptActionReinterpret;
+            case InvalidateRecompile:
+                return config.deoptActionMakeNotEntrant;
+            case InvalidateStopCompiling:
+                return config.deoptActionMakeNotCompilable;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
     public int convertDeoptReason(DeoptimizationReason reason) {
-        switch(reason) {
-            case None: return config.deoptReasonNone;
-            case NullCheckException: return config.deoptReasonNullCheck;
-            case BoundsCheckException: return config.deoptReasonRangeCheck;
-            case ClassCastException: return config.deoptReasonClassCheck;
-            case ArrayStoreException: return config.deoptReasonArrayCheck;
-            case UnreachedCode: return config.deoptReasonUnreached0;
-            case TypeCheckedInliningViolated: return config.deoptReasonTypeCheckInlining;
-            case OptimizedTypeCheckViolated: return config.deoptReasonOptimizedTypeCheck;
-            case NotCompiledExceptionHandler: return config.deoptReasonNotCompiledExceptionHandler;
-            case Unresolved: return config.deoptReasonUnresolved;
-            case JavaSubroutineMismatch: return config.deoptReasonJsrMismatch;
-            case ArithmeticException: return config.deoptReasonDiv0Check;
-            case RuntimeConstraint: return config.deoptReasonConstraint;
-            default: throw GraalInternalError.shouldNotReachHere();
+        switch (reason) {
+            case None:
+                return config.deoptReasonNone;
+            case NullCheckException:
+                return config.deoptReasonNullCheck;
+            case BoundsCheckException:
+                return config.deoptReasonRangeCheck;
+            case ClassCastException:
+                return config.deoptReasonClassCheck;
+            case ArrayStoreException:
+                return config.deoptReasonArrayCheck;
+            case UnreachedCode:
+                return config.deoptReasonUnreached0;
+            case TypeCheckedInliningViolated:
+                return config.deoptReasonTypeCheckInlining;
+            case OptimizedTypeCheckViolated:
+                return config.deoptReasonOptimizedTypeCheck;
+            case NotCompiledExceptionHandler:
+                return config.deoptReasonNotCompiledExceptionHandler;
+            case Unresolved:
+                return config.deoptReasonUnresolved;
+            case JavaSubroutineMismatch:
+                return config.deoptReasonJsrMismatch;
+            case ArithmeticException:
+                return config.deoptReasonDiv0Check;
+            case RuntimeConstraint:
+                return config.deoptReasonConstraint;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -879,9 +904,9 @@
     }
 
     /**
-     * Registers an object created by the compiler and referenced by some generated code.
-     * HotSpot treats oops embedded in code as weak references so without an external strong root, such
-     * an embedded oop will quickly die. This in turn will cause the nmethod to be unloaded.
+     * Registers an object created by the compiler and referenced by some generated code. HotSpot
+     * treats oops embedded in code as weak references so without an external strong root, such an
+     * embedded oop will quickly die. This in turn will cause the nmethod to be unloaded.
      */
     public synchronized Object registerGCRoot(Object object) {
         Object existing = gcRoots.get(object);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotUnresolvedField.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 /**
  * A implementation of {@link JavaField} for an unresolved field.
  */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/BeginLockScopeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,11 +32,10 @@
 import com.oracle.graal.word.*;
 
 /**
- * Intrinsic for opening a scope binding a stack-based lock with an object.
- * A lock scope must be closed with an {@link EndLockScopeNode}.
- * The frame state after this node denotes that the object is locked
- * (ensuring the GC sees and updates the object) so it must come
- * after any null pointer check on the object.
+ * Intrinsic for opening a scope binding a stack-based lock with an object. A lock scope must be
+ * closed with an {@link EndLockScopeNode}. The frame state after this node denotes that the object
+ * is locked (ensuring the GC sees and updates the object) so it must come after any null pointer
+ * check on the object.
  */
 public final class BeginLockScopeNode extends AbstractStateSplit implements LIRGenLowerable, MonitorEnter {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DimensionsNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.word.*;
 
 /**
- * Intrinsic for allocating an on-stack array of integers to hold the dimensions
- * of a multianewarray instruction.
+ * Intrinsic for allocating an on-stack array of integers to hold the dimensions of a multianewarray
+ * instruction.
  */
 public final class DimensionsNode extends FixedWithNextNode implements LIRGenLowerable {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/DirectCompareAndSwapNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,9 +31,9 @@
 import com.oracle.graal.word.*;
 
 /**
- * A special purpose store node that differs from {@link CompareAndSwapNode} in that
- * it is not a {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns}
- * either the expected value or the compared against value instead of a boolean.
+ * A special purpose store node that differs from {@link CompareAndSwapNode} in that it is not a
+ * {@link StateSplit} and it {@linkplain #compareAndSwap(Object, long, Word, Word) returns} either
+ * the expected value or the compared against value instead of a boolean.
  */
 public class DirectCompareAndSwapNode extends FixedWithNextNode implements LIRGenLowerable, MemoryCheckpoint {
 
@@ -50,7 +50,6 @@
         this.newValue = newValue;
     }
 
-
     @Override
     public void generate(LIRGenerator gen) {
         ((HotSpotLIRGenerator) gen).visitDirectCompareAndSwap(this);
@@ -73,11 +72,11 @@
     }
 
     /**
-     * Compares an expected value with the actual value in a location denoted by an object and a given offset.
-     * Iff they are same, {@code newValue} is placed into the location and the {@code expectedValue} is returned.
-     * Otherwise, the actual value is returned.
-     * All of the above is performed in one atomic hardware transaction.
-     *
+     * Compares an expected value with the actual value in a location denoted by an object and a
+     * given offset. Iff they are same, {@code newValue} is placed into the location and the
+     * {@code expectedValue} is returned. Otherwise, the actual value is returned. All of the above
+     * is performed in one atomic hardware transaction.
+     * 
      * @param object the object containing a field to be atomically tested and updated
      * @param offset offset from {@code object} of the field
      * @param expectedValue if this value is currently in the field, perform the swap
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/EndLockScopeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,9 +28,9 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.type.*;
 
-
 /**
- * Intrinsic for closing a {@linkplain BeginLockScopeNode scope} binding a stack-based lock with an object.
+ * Intrinsic for closing a {@linkplain BeginLockScopeNode scope} binding a stack-based lock with an
+ * object.
  */
 public final class EndLockScopeNode extends AbstractStateSplit implements LIRGenLowerable, MonitorExit {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/GetObjectAddressNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,12 +28,12 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Intrinsification for getting the address of an object.
- * The code path(s) between a call to {@link #get(Object)} and all uses
- * of the returned value must be atomic. The only exception to this is
- * if the usage is not an attempt to dereference the value.
+ * Intrinsification for getting the address of an object. The code path(s) between a call to
+ * {@link #get(Object)} and all uses of the returned value must be atomic. The only exception to
+ * this is if the usage is not an attempt to dereference the value.
  */
 public class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable {
+
     @Input private ValueNode object;
 
     public GetObjectAddressNode(ValueNode obj) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotCurrentRawThreadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/HotSpotCurrentRawThreadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,8 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.word.*;
 
+public class HotSpotCurrentRawThreadNode extends FloatingNode implements LIRLowerable {
 
-public class HotSpotCurrentRawThreadNode extends FloatingNode implements LIRLowerable {
     public HotSpotCurrentRawThreadNode() {
         super(StampFactory.forWord());
     }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/IdentityHashCodeStubCall.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,6 +35,7 @@
  * Node implementing a call to HotSpot's {@code graal_identityhashcode} stub.
  */
 public class IdentityHashCodeStubCall extends FixedWithNextNode implements LIRGenLowerable {
+
     @Input private final ValueNode object;
     public static final Descriptor IDENTITY_HASHCODE = new Descriptor("identity_hashcode", false, int.class, Object.class);
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,9 +28,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Initializes the header and body of an uninitialized array cell.
- * This node calls out to a stub to do both the allocation and formatting
- * if the memory address it is given is zero/null (e.g. due to
+ * Initializes the header and body of an uninitialized array cell. This node calls out to a stub to
+ * do both the allocation and formatting if the memory address it is given is zero/null (e.g. due to
  * {@linkplain TLABAllocateNode TLAB allocation} failing).
  */
 public final class InitializeArrayNode extends FixedWithNextNode implements Lowerable, ArrayLengthProvider {
@@ -86,5 +85,6 @@
     }
 
     @NodeIntrinsic
-    public static native Object initialize(Object memory, int length, int allocationSize, @ConstantNodeParameter ResolvedJavaType type, @ConstantNodeParameter boolean fillContents, @ConstantNodeParameter boolean locked);
+    public static native Object initialize(Object memory, int length, int allocationSize, @ConstantNodeParameter ResolvedJavaType type, @ConstantNodeParameter boolean fillContents,
+                    @ConstantNodeParameter boolean locked);
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/InitializeObjectNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,9 +28,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Initializes the header and body of an uninitialized object cell.
- * This node calls out to a stub to do both the allocation and formatting
- * if the memory address it is given is zero/null (e.g. due to
+ * Initializes the header and body of an uninitialized object cell. This node calls out to a stub to
+ * do both the allocation and formatting if the memory address it is given is zero/null (e.g. due to
  * {@linkplain TLABAllocateNode TLAB allocation} failing).
  */
 public final class InitializeObjectNode extends FixedWithNextNode implements Lowerable {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/MonitorCounterNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,7 @@
 import com.oracle.graal.word.*;
 
 /**
- * Node that is used to maintain a stack based counter of how many locks
- * are currently held.
+ * Node that is used to maintain a stack based counter of how many locks are currently held.
  */
 public final class MonitorCounterNode extends FloatingNode implements LIRGenLowerable {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.word.*;
 
 /**
- * Allocates some uninitialized area. This is used for TLAB allocation
- * only. If allocation fails, zero/null is produced by this node.
+ * Allocates some uninitialized area. This is used for TLAB allocation only. If allocation fails,
+ * zero/null is produced by this node.
  */
 public final class TLABAllocateNode extends FixedWithNextNode implements Lowerable {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TailcallNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,7 +35,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Performs a tail call to the specified target compiled method, with the parameter taken from the supplied FrameState.
+ * Performs a tail call to the specified target compiled method, with the parameter taken from the
+ * supplied FrameState.
  */
 public class TailcallNode extends FixedWithNextNode implements LIRLowerable {
 
@@ -44,6 +45,7 @@
 
     /**
      * Creates a TailcallNode.
+     * 
      * @param target points to the start of an nmethod
      * @param frameState the parameters will be taken from this FrameState
      */
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/ThreadIsInterruptedStubCall.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,6 +35,7 @@
  * Node implementing a call to HotSpot's ThreadIsInterrupted stub.
  */
 public class ThreadIsInterruptedStubCall extends FixedWithNextNode implements LIRGenLowerable {
+
     @Input private final ValueNode thread;
     @Input private final ValueNode clearIsInterrupted;
     public static final Descriptor THREAD_IS_INTERRUPTED = new Descriptor("thread_is_interrupted", false, int.class, Object.class, boolean.class);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,8 +34,8 @@
 import com.oracle.graal.snippets.*;
 
 /**
- * Causes the VM to exit with a description of the current Java location
- * and an optional {@linkplain Log#printf(String, long) formatted} error message specified.
+ * Causes the VM to exit with a description of the current Java location and an optional
+ * {@linkplain Log#printf(String, long) formatted} error message specified.
  */
 public final class VMErrorNode extends FixedWithNextNode implements LIRGenLowerable {
 
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,3 +26,4 @@
  * from the Java to the C++ side (CompilerToVMImpl.java).
  */
 package com.oracle.graal.hotspot;
+
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,8 @@
     @Override
     protected void run(StructuredGraph graph) {
         if (graph.getEntryBCI() == StructuredGraph.INVOCATION_ENTRY_BCI) {
-            // This happens during inlining in a OSR method, because the same phase plan will be used.
+            // This happens during inlining in a OSR method, because the same phase plan will be
+            // used.
             return;
         }
         Debug.dump(graph, "OnStackReplacement initial");
@@ -90,7 +91,6 @@
             Debug.dump(graph, "OnStackReplacement loop peeling result");
         } while (true);
 
-
         LocalNode buffer = graph.unique(new LocalNode(0, StampFactory.forKind(wordKind())));
         RuntimeCallNode migrationEnd = graph.add(new RuntimeCallNode(OSR_MIGRATION_END, buffer));
         FrameState osrState = osr.stateAfter();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/AESCryptSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/AESCryptSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -61,64 +61,66 @@
 
     @MethodSubstitution(isStatic = false)
     static void encryptBlock(Object rcvr, byte[] in, int inOffset, byte[] out, int outOffset) {
-        Word kAddr = Word.fromObject(rcvr).readWord(Word.unsigned(kOffset)).add(arrayBaseOffset(Kind.Byte));
-        Word inAddr = Word.unsigned(GetObjectAddressNode.get(in) + arrayBaseOffset(Kind.Byte) + inOffset);
-        Word outAddr = Word.unsigned(GetObjectAddressNode.get(out) + arrayBaseOffset(Kind.Byte) + outOffset);
-        EncryptBlockStubCall.call(inAddr, outAddr, kAddr);
+        crypt(rcvr, in, inOffset, out, outOffset, true);
     }
 
     @MethodSubstitution(isStatic = false)
     static void decryptBlock(Object rcvr, byte[] in, int inOffset, byte[] out, int outOffset) {
-        Word kAddr = Word.unsigned(GetObjectAddressNode.get(rcvr)).readWord(Word.unsigned(kOffset)).add(arrayBaseOffset(Kind.Byte));
+        crypt(rcvr, in, inOffset, out, outOffset, false);
+    }
+
+    private static void crypt(Object rcvr, byte[] in, int inOffset, byte[] out, int outOffset, boolean encrypt) {
+        Word kAddr = Word.fromObject(rcvr).readWord(Word.unsigned(kOffset)).add(arrayBaseOffset(Kind.Byte));
         Word inAddr = Word.unsigned(GetObjectAddressNode.get(in) + arrayBaseOffset(Kind.Byte) + inOffset);
         Word outAddr = Word.unsigned(GetObjectAddressNode.get(out) + arrayBaseOffset(Kind.Byte) + outOffset);
-        DecryptBlockStubCall.call(inAddr, outAddr, kAddr);
+        if (encrypt) {
+            EncryptBlockStubCall.call(inAddr, outAddr, kAddr);
+        } else {
+            DecryptBlockStubCall.call(inAddr, outAddr, kAddr);
+        }
     }
 
-    public static class EncryptBlockStubCall extends FixedWithNextNode implements LIRGenLowerable {
+    abstract static class CryptBlockStubCall extends FixedWithNextNode implements LIRGenLowerable {
 
         @Input private final ValueNode in;
         @Input private final ValueNode out;
         @Input private final ValueNode key;
 
-        public static final Descriptor ENCRYPT_BLOCK = new Descriptor("encrypt_block", false, void.class, Word.class, Word.class, Word.class);
+        private final Descriptor descriptor;
 
-        public EncryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key) {
+        public CryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key, Descriptor descriptor) {
             super(StampFactory.forVoid());
             this.in = in;
             this.out = out;
             this.key = key;
+            this.descriptor = descriptor;
         }
 
         @Override
         public void generate(LIRGenerator gen) {
-            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(ENCRYPT_BLOCK);
+            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(descriptor);
             gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(in), gen.operand(out), gen.operand(key));
         }
+    }
+
+    public static class EncryptBlockStubCall extends CryptBlockStubCall {
+
+        public static final Descriptor ENCRYPT_BLOCK = new Descriptor("encrypt_block", false, void.class, Word.class, Word.class, Word.class);
+
+        public EncryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key) {
+            super(in, out, key, ENCRYPT_BLOCK);
+        }
 
         @NodeIntrinsic
         public static native void call(Word in, Word out, Word key);
     }
 
-    public static class DecryptBlockStubCall extends FixedWithNextNode implements LIRGenLowerable {
-
-        @Input private final ValueNode in;
-        @Input private final ValueNode out;
-        @Input private final ValueNode key;
+    public static class DecryptBlockStubCall extends CryptBlockStubCall {
 
         public static final Descriptor DECRYPT_BLOCK = new Descriptor("decrypt_block", false, void.class, Word.class, Word.class, Word.class);
 
         public DecryptBlockStubCall(ValueNode in, ValueNode out, ValueNode key) {
-            super(StampFactory.forVoid());
-            this.in = in;
-            this.out = out;
-            this.key = key;
-        }
-
-        @Override
-        public void generate(LIRGenerator gen) {
-            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(DECRYPT_BLOCK);
-            gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(in), gen.operand(out), gen.operand(key));
+            super(in, out, key, DECRYPT_BLOCK);
         }
 
         @NodeIntrinsic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopyNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,157 @@
+/*
+ * 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.hotspot.snippets;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.debug.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.graph.Node.IterableNodeType;
+import com.oracle.graal.loop.phases.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.virtual.*;
+import com.oracle.graal.phases.common.*;
+import com.oracle.graal.snippets.nodes.*;
+
+public class ArrayCopyNode extends MacroNode implements Virtualizable, IterableNodeType, Lowerable {
+
+    public ArrayCopyNode(Invoke invoke) {
+        super(invoke);
+    }
+
+    private ValueNode getSource() {
+        return arguments.get(0);
+    }
+
+    private ValueNode getSourcePosition() {
+        return arguments.get(1);
+    }
+
+    private ValueNode getDestination() {
+        return arguments.get(2);
+    }
+
+    private ValueNode getDestinationPosition() {
+        return arguments.get(3);
+    }
+
+    private ValueNode getLength() {
+        return arguments.get(4);
+    }
+
+    private ResolvedJavaMethod selectSnippet(LoweringTool tool) {
+        ResolvedJavaType srcType = getSource().objectStamp().type();
+        ResolvedJavaType destType = getDestination().objectStamp().type();
+
+        if (srcType != null && srcType.isArray() && destType != null && destType.isArray()) {
+            Kind componentKind = srcType.getComponentType().getKind();
+            if (componentKind != Kind.Object) {
+                if (srcType.getComponentType() == destType.getComponentType()) {
+                    return tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.getSnippetForKind(componentKind));
+                }
+            } else if (destType.getComponentType().isAssignableFrom(srcType.getComponentType()) && getDestination().objectStamp().isExactType()) {
+                return tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.getSnippetForKind(Kind.Object));
+            }
+        }
+        return null;
+    }
+
+    private static void unrollFixedLengthLoop(StructuredGraph snippetGraph, int length, LoweringTool tool) {
+        LocalNode lengthLocal = snippetGraph.getLocal(4);
+        if (lengthLocal != null) {
+            snippetGraph.replaceFloating(lengthLocal, ConstantNode.forInt(length, snippetGraph));
+        }
+        // the canonicalization before loop unrolling is needed to propagate the length into
+        // additions, etc.
+        new CanonicalizerPhase(tool.getTarget(), tool.getRuntime(), tool.assumptions()).apply(snippetGraph);
+        new LoopFullUnrollPhase(tool.getRuntime(), tool.assumptions()).apply(snippetGraph);
+        new CanonicalizerPhase(tool.getTarget(), tool.getRuntime(), tool.assumptions()).apply(snippetGraph);
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        ResolvedJavaMethod snippetMethod = selectSnippet(tool);
+        if (snippetMethod == null) {
+            snippetMethod = tool.getRuntime().lookupJavaMethod(ArrayCopySnippets.increaseGenericCallCounterMethod);
+            // we will call the generic method. the generic snippet will only increase the counter,
+            // not call the actual method. therefore we create a second invoke here.
+            ((StructuredGraph) graph()).addAfterFixed(this, createInvoke());
+        }
+        if (Debug.isLogEnabled()) {
+            Debug.log("%s > Intrinsify (%s)", Debug.currentScope(), snippetMethod.getSignature().getParameterType(0, snippetMethod.getDeclaringClass()).getComponentType());
+        }
+
+        StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class);
+        assert snippetGraph != null : "ArrayCopySnippets should be installed";
+        if (getLength().isConstant()) {
+            snippetGraph = snippetGraph.copy();
+            unrollFixedLengthLoop(snippetGraph, getLength().asConstant().asInt(), tool);
+        }
+        InvokeNode invoke = replaceWithInvoke();
+        InliningUtil.inline(invoke, snippetGraph, false);
+    }
+
+    private static boolean checkBounds(int position, int length, VirtualObjectNode virtualObject) {
+        return position >= 0 && position + length <= virtualObject.entryCount();
+    }
+
+    private static boolean checkEntryTypes(int srcPos, int length, State srcState, ResolvedJavaType destComponentType) {
+        if (destComponentType.getKind() == Kind.Object) {
+            for (int i = 0; i < length; i++) {
+                if (!destComponentType.isAssignableFrom(srcState.getEntry(srcPos + i).objectStamp().type())) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    @Override
+    public void virtualize(VirtualizerTool tool) {
+        if (getSourcePosition().isConstant() && getDestinationPosition().isConstant() && getLength().isConstant()) {
+            int srcPos = getSourcePosition().asConstant().asInt();
+            int destPos = getDestinationPosition().asConstant().asInt();
+            int length = getLength().asConstant().asInt();
+            State srcState = tool.getObjectState(getSource());
+            State destState = tool.getObjectState(getDestination());
+
+            if (srcState != null && srcState.getState() == EscapeState.Virtual && destState != null && destState.getState() == EscapeState.Virtual) {
+                VirtualObjectNode srcVirtual = srcState.getVirtualObject();
+                VirtualObjectNode destVirtual = destState.getVirtualObject();
+                if (length < 0 || !checkBounds(srcPos, length, srcVirtual) || !checkBounds(destPos, length, destVirtual)) {
+                    return;
+                }
+                if (!checkEntryTypes(srcPos, length, srcState, destVirtual.type().getComponentType())) {
+                    return;
+                }
+                for (int i = 0; i < length; i++) {
+                    tool.setVirtualEntry(destState, destPos + i, srcState.getEntry(srcPos + i));
+                }
+                tool.delete();
+                if (Debug.isLogEnabled()) {
+                    Debug.log("virtualized arraycopyf(%s, %d, %s, %d, %d)", getSource(), srcPos, getDestination(), destPos, length);
+                }
+            }
+        }
+    }
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ArrayCopySnippets.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,12 +21,18 @@
  * questions.
  */
 package com.oracle.graal.hotspot.snippets;
+
 import static com.oracle.graal.api.code.DeoptimizationAction.*;
 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
+import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
+
+import java.lang.reflect.*;
+import java.util.*;
 
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
 import com.oracle.graal.hotspot.*;
 import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.*;
@@ -34,14 +40,43 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
+import com.oracle.graal.phases.*;
 import com.oracle.graal.snippets.*;
 import com.oracle.graal.snippets.Snippet.ConstantParameter;
 import com.oracle.graal.snippets.Snippet.Fold;
 import com.oracle.graal.snippets.nodes.*;
 
+@SuppressWarnings("unused")
+public class ArrayCopySnippets implements SnippetsInterface {
 
-@SuppressWarnings("unused")
-public class ArrayCopySnippets implements SnippetsInterface{
+    private static final EnumMap<Kind, Method> arraycopyMethods = new EnumMap<>(Kind.class);
+    public static final Method increaseGenericCallCounterMethod;
+
+    private static void addArraycopySnippetMethod(Kind kind, Class<?> arrayClass) throws NoSuchMethodException {
+        arraycopyMethods.put(kind, ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class));
+    }
+
+    static {
+        try {
+            addArraycopySnippetMethod(Kind.Byte, byte[].class);
+            addArraycopySnippetMethod(Kind.Boolean, boolean[].class);
+            addArraycopySnippetMethod(Kind.Char, char[].class);
+            addArraycopySnippetMethod(Kind.Short, short[].class);
+            addArraycopySnippetMethod(Kind.Int, int[].class);
+            addArraycopySnippetMethod(Kind.Long, long[].class);
+            addArraycopySnippetMethod(Kind.Float, float[].class);
+            addArraycopySnippetMethod(Kind.Double, double[].class);
+            addArraycopySnippetMethod(Kind.Object, Object[].class);
+            increaseGenericCallCounterMethod = ArrayCopySnippets.class.getDeclaredMethod("increaseGenericCallCounter", Object.class, int.class, Object.class, int.class, int.class);
+        } catch (SecurityException | NoSuchMethodException e) {
+            throw new GraalInternalError(e);
+        }
+    }
+
+    public static Method getSnippetForKind(Kind kind) {
+        return arraycopyMethods.get(kind);
+    }
+
     private static final Kind VECTOR_KIND = Kind.Long;
     private static final long VECTOR_SIZE = arrayIndexScale(Kind.Long);
 
@@ -54,6 +89,7 @@
         long srcOffset = (long) srcPos * elementSize;
         long destOffset = (long) destPos * elementSize;
         if (src == dest && srcPos < destPos) { // bad aliased case
+            probability(NOT_FREQUENT_PROBABILITY);
             for (long i = byteLength - elementSize; i >= byteLength - nonVectorBytes; i -= elementSize) {
                 UnsafeStoreNode.store(dest, header, i + destOffset, UnsafeLoadNode.load(src, header, i + srcOffset, baseKind), baseKind);
             }
@@ -74,41 +110,83 @@
     }
 
     public static void checkInputs(Object src, int srcPos, Object dest, int destPos, int length) {
-        if (src == null || dest == null) {
-            throw new NullPointerException();
+        if (src == null) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkNPECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (dest == null) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkNPECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (srcPos < 0) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
-        if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > ArrayLengthNode.arrayLength(src) || destPos + length > ArrayLengthNode.arrayLength(dest)) {
-            throw new ArrayIndexOutOfBoundsException();
+        if (destPos < 0) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (length < 0) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
+        if (srcPos + length > ArrayLengthNode.arrayLength(src)) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        if (destPos + length > ArrayLengthNode.arrayLength(dest)) {
+            probability(DEOPT_PATH_PROBABILITY);
+            checkAIOOBECounter.inc();
+            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+        }
+        checkSuccessCounter.inc();
     }
 
     @Snippet
     public static void arraycopy(byte[] src, int srcPos, byte[] dest, int destPos, int length) {
+        byteCounter.inc();
+        vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Byte);
+    }
+
+    @Snippet
+    public static void arraycopy(boolean[] src, int srcPos, boolean[] dest, int destPos, int length) {
+        booleanCounter.inc();
         vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Byte);
     }
 
     @Snippet
     public static void arraycopy(char[] src, int srcPos, char[] dest, int destPos, int length) {
+        charCounter.inc();
         vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Char);
     }
 
     @Snippet
     public static void arraycopy(short[] src, int srcPos, short[] dest, int destPos, int length) {
+        shortCounter.inc();
         vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Short);
     }
 
     @Snippet
     public static void arraycopy(int[] src, int srcPos, int[] dest, int destPos, int length) {
+        intCounter.inc();
         vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Int);
     }
 
     @Snippet
     public static void arraycopy(float[] src, int srcPos, float[] dest, int destPos, int length) {
+        floatCounter.inc();
         vectorizedCopy(src, srcPos, dest, destPos, length, Kind.Float);
     }
 
     @Snippet
     public static void arraycopy(long[] src, int srcPos, long[] dest, int destPos, int length) {
+        longCounter.inc();
         checkInputs(src, srcPos, dest, destPos, length);
         Kind baseKind = Kind.Long;
         int header = arrayBaseOffset(baseKind);
@@ -130,6 +208,7 @@
 
     @Snippet
     public static void arraycopy(double[] src, int srcPos, double[] dest, int destPos, int length) {
+        doubleCounter.inc();
         checkInputs(src, srcPos, dest, destPos, length);
         Kind baseKind = Kind.Double;
         int header = arrayBaseOffset(baseKind);
@@ -152,6 +231,7 @@
     // Does NOT perform store checks
     @Snippet
     public static void arraycopy(Object[] src, int srcPos, Object[] dest, int destPos, int length) {
+        objectCounter.inc();
         checkInputs(src, srcPos, dest, destPos, length);
         final int scale = arrayIndexScale(Kind.Object);
         int header = arrayBaseOffset(Kind.Object);
@@ -180,4 +260,34 @@
             }
         }
     }
+
+    @Snippet
+    public static void increaseGenericCallCounter(Object src, int srcPos, Object dest, int destPos, int length) {
+        if (GraalOptions.SnippetCounters) {
+            if (src.getClass().getComponentType().isPrimitive()) {
+                genericPrimitiveCallCounter.inc();
+            } else {
+                genericObjectCallCounter.inc();
+            }
+        }
+    }
+
+    private static final SnippetCounter.Group checkCounters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("System.arraycopy checkInputs") : null;
+    private static final SnippetCounter checkSuccessCounter = new SnippetCounter(checkCounters, "checkSuccess", "checkSuccess");
+    private static final SnippetCounter checkNPECounter = new SnippetCounter(checkCounters, "checkNPE", "checkNPE");
+    private static final SnippetCounter checkAIOOBECounter = new SnippetCounter(checkCounters, "checkAIOOBE", "checkAIOOBE");
+
+    private static final SnippetCounter.Group counters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("System.arraycopy") : null;
+    private static final SnippetCounter byteCounter = new SnippetCounter(counters, "byte[]", "arraycopy for byte[] arrays");
+    private static final SnippetCounter charCounter = new SnippetCounter(counters, "char[]", "arraycopy for char[] arrays");
+    private static final SnippetCounter shortCounter = new SnippetCounter(counters, "short[]", "arraycopy for short[] arrays");
+    private static final SnippetCounter intCounter = new SnippetCounter(counters, "int[]", "arraycopy for int[] arrays");
+    private static final SnippetCounter booleanCounter = new SnippetCounter(counters, "boolean[]", "arraycopy for boolean[] arrays");
+    private static final SnippetCounter longCounter = new SnippetCounter(counters, "long[]", "arraycopy for long[] arrays");
+    private static final SnippetCounter objectCounter = new SnippetCounter(counters, "Object[]", "arraycopy for Object[] arrays");
+    private static final SnippetCounter floatCounter = new SnippetCounter(counters, "float[]", "arraycopy for float[] arrays");
+    private static final SnippetCounter doubleCounter = new SnippetCounter(counters, "double[]", "arraycopy for double[] arrays");
+    private static final SnippetCounter genericPrimitiveCallCounter = new SnippetCounter(counters, "genericPrimitive", "call to the generic, native arraycopy method");
+    private static final SnippetCounter genericObjectCallCounter = new SnippetCounter(counters, "genericObject", "call to the generic, native arraycopy method");
+
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CheckCastSnippets.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,11 @@
  */
 package com.oracle.graal.hotspot.snippets;
 
+import static com.oracle.graal.api.code.DeoptimizationAction.*;
+import static com.oracle.graal.api.meta.DeoptimizationReason.*;
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
+import static com.oracle.graal.hotspot.snippets.TypeCheckSnippetUtils.*;
+import static com.oracle.graal.nodes.extended.UnsafeCastNode.*;
 import static com.oracle.graal.snippets.SnippetTemplate.*;
 import static com.oracle.graal.snippets.SnippetTemplate.Arguments.*;
 import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
@@ -30,7 +34,6 @@
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
-import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
 import com.oracle.graal.hotspot.meta.*;
 import com.oracle.graal.nodes.*;
@@ -51,15 +54,18 @@
 
 /**
  * Snippets used for implementing the type test of a checkcast instruction.
- *
- * The type tests implemented are described in the paper <a href="http://dl.acm.org/citation.cfm?id=583821">
- * Fast subtype checking in the HotSpot JVM</a> by Cliff Click and John Rose.
+ * 
+ * The type tests implemented are described in the paper <a
+ * href="http://dl.acm.org/citation.cfm?id=583821"> Fast subtype checking in the HotSpot JVM</a> by
+ * Cliff Click and John Rose.
  */
 public class CheckCastSnippets implements SnippetsInterface {
 
     @NodeIntrinsic(BreakpointNode.class)
     static native void bkpt(Object object, Word hub, Word objectHub);
 
+    // @formatter:off
+
     /**
      * Type test used when the type being tested against is a final type.
      */
@@ -69,19 +75,19 @@
                     @Parameter("exactHub") Word exactHub,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
-            probability(0.1);
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
-            return object;
+        } else {
+            Word objectHub = loadHub(object);
+            if (objectHub != exactHub) {
+                probability(DEOPT_PATH_PROBABILITY);
+                exactMiss.inc();
+                //bkpt(object, exactHub, objectHub);
+                DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException);
+            }
+            exactHit.inc();
         }
-        Word objectHub = loadHub(object);
-        if (objectHub != exactHub) {
-            probability(0.01);
-            exactMiss.inc();
-            //bkpt(object, exactHub, objectHub);
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ClassCastException);
-        }
-        exactHit.inc();
-        return object;
+        return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
     }
 
     /**
@@ -98,16 +104,18 @@
                     @ConstantParameter("checkNull") boolean checkNull,
                     @ConstantParameter("superCheckOffset") int superCheckOffset) {
         if (checkNull && object == null) {
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
-            return object;
+        } else {
+            Word objectHub = loadHub(object);
+            if (objectHub.readWord(superCheckOffset) != hub) {
+                probability(DEOPT_PATH_PROBABILITY);
+                displayMiss.inc();
+                DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException);
+            }
+            displayHit.inc();
         }
-        Word objectHub = loadHub(object);
-        if (objectHub.readWord(superCheckOffset) != hub) {
-            displayMiss.inc();
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ClassCastException);
-        }
-        displayHit.inc();
-        return object;
+        return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
     }
 
     /**
@@ -120,23 +128,24 @@
                     @VarargsParameter("hints") Word[] hints,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
-            return object;
-        }
-        Word objectHub = loadHub(object);
-        // if we get an exact match: succeed immediately
-        ExplodeLoopNode.explodeLoop();
-        for (int i = 0; i < hints.length; i++) {
-            Word hintHub = hints[i];
-            if (hintHub == objectHub) {
-                hintsHit.inc();
-                return object;
+        } else {
+            Word objectHub = loadHub(object);
+            // if we get an exact match: succeed immediately
+            ExplodeLoopNode.explodeLoop();
+            for (int i = 0; i < hints.length; i++) {
+                Word hintHub = hints[i];
+                if (hintHub == objectHub) {
+                    hintsHit.inc();
+                    return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
+                }
+            }
+            if (!checkSecondarySubType(hub, objectHub)) {
+                DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException);
             }
         }
-        if (!checkSecondarySubType(hub, objectHub)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ClassCastException);
-        }
-        return object;
+        return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
     }
 
     /**
@@ -149,88 +158,18 @@
                     @Parameter("object") Object object,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
-            return object;
-        }
-        Word objectHub = loadHub(object);
-        if (!checkUnknownSubType(hub, objectHub)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.InvalidateReprofile, DeoptimizationReason.ClassCastException);
-        }
-        return object;
-    }
-
-    static Word loadWordElement(Word metaspaceArray, int index) {
-        return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize());
-    }
-
-    static boolean checkSecondarySubType(Word t, Word s) {
-        // if (S.cache == T) return true
-        if (s.readWord(secondarySuperCacheOffset()) == t) {
-            cacheHit.inc();
-            return true;
-        }
-
-        // if (T == S) return true
-        if (s == t) {
-            T_equals_S.inc();
-            return true;
-        }
-
-        // if (S.scan_s_s_array(T)) { S.cache = T; return true; }
-        Word secondarySupers = s.readWord(secondarySupersOffset());
-        int length = secondarySupers.readInt(metaspaceArrayLengthOffset());
-        for (int i = 0; i < length; i++) {
-            if (t == loadWordElement(secondarySupers, i)) {
-                s.writeWord(secondarySuperCacheOffset(), t);
-                secondariesHit.inc();
-                return true;
+        } else {
+            Word objectHub = loadHub(object);
+            if (!checkUnknownSubType(hub, objectHub)) {
+                DeoptimizeNode.deopt(InvalidateReprofile, ClassCastException);
             }
         }
-        secondariesMiss.inc();
-        return false;
+        return unsafeCast(verifyOop(object), StampFactory.forNodeIntrinsic());
     }
 
-    static boolean checkUnknownSubType(Word t, Word s) {
-        // int off = T.offset
-        int superCheckOffset = t.readInt(superCheckOffsetOffset());
-        boolean primary = superCheckOffset != secondarySuperCacheOffset();
-
-        // if (T = S[off]) return true
-        if (s.readWord(superCheckOffset) == t) {
-            if (primary) {
-                cacheHit.inc();
-            } else {
-                displayHit.inc();
-            }
-            return true;
-        }
-
-        // if (off != &cache) return false
-        if (primary) {
-            displayMiss.inc();
-            return false;
-        }
-
-        // if (T == S) return true
-        if (s == t) {
-            T_equals_S.inc();
-            return true;
-        }
-
-        // if (S.scan_s_s_array(T)) { S.cache = T; return true; }
-        Word secondarySupers = s.readWord(secondarySupersOffset());
-        int length = secondarySupers.readInt(metaspaceArrayLengthOffset());
-        for (int i = 0; i < length; i++) {
-            if (t == loadWordElement(secondarySupers, i)) {
-                s.writeWord(secondarySuperCacheOffset(), t);
-                secondariesHit.inc();
-                return true;
-            }
-        }
-
-        secondariesMiss.inc();
-        return false;
-    }
+    // @formatter:on
 
     public static class Templates extends AbstractTemplates<CheckCastSnippets> {
 
@@ -296,25 +235,5 @@
             Debug.log("Lowering dynamic checkcast in %s: node=%s, template=%s, arguments=%s", graph, checkcast, template, arguments);
             template.instantiate(runtime, checkcast, DEFAULT_REPLACER, arguments);
         }
-
-        static ConstantNode[] createHints(TypeCheckHints hints, MetaAccessProvider runtime, Graph graph) {
-            ConstantNode[] hintHubs = new ConstantNode[hints.types.length];
-            for (int i = 0; i < hintHubs.length; i++) {
-                hintHubs[i] = ConstantNode.forConstant(((HotSpotResolvedObjectType) hints.types[i]).klass(), runtime, graph);
-            }
-            return hintHubs;
-        }
     }
-
-    private static final SnippetCounter.Group counters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("Checkcast") : null;
-    private static final SnippetCounter hintsHit = new SnippetCounter(counters, "hintsHit", "hit a hint type");
-    private static final SnippetCounter exactHit = new SnippetCounter(counters, "exactHit", "exact type test succeeded");
-    private static final SnippetCounter exactMiss = new SnippetCounter(counters, "exactMiss", "exact type test failed");
-    private static final SnippetCounter isNull = new SnippetCounter(counters, "isNull", "object tested was null");
-    private static final SnippetCounter cacheHit = new SnippetCounter(counters, "cacheHit", "secondary type cache hit");
-    private static final SnippetCounter secondariesHit = new SnippetCounter(counters, "secondariesHit", "secondaries scan succeeded");
-    private static final SnippetCounter secondariesMiss = new SnippetCounter(counters, "secondariesMiss", "secondaries scan failed");
-    private static final SnippetCounter displayHit = new SnippetCounter(counters, "displayHit", "primary type test succeeded");
-    private static final SnippetCounter displayMiss = new SnippetCounter(counters, "displayMiss", "primary type test failed");
-    private static final SnippetCounter T_equals_S = new SnippetCounter(counters, "T_equals_S", "object type was equal to secondary type");
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CipherBlockChainingSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/CipherBlockChainingSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -68,31 +68,36 @@
     static void encrypt(Object rcvr, byte[] in, int inOffset, int inLength, byte[] out, int outOffset) {
         Object embeddedCipher = Word.fromObject(rcvr).readObject(Word.unsigned(embeddedCipherOffset));
         if (getAESCryptClass().isInstance(embeddedCipher)) {
-            Word kAddr = Word.fromObject(embeddedCipher).readWord(Word.unsigned(AESCryptSubstitutions.kOffset)).add(arrayBaseOffset(Kind.Byte));
-            Word rAddr = Word.unsigned(GetObjectAddressNode.get(rcvr)).readWord(Word.unsigned(rOffset)).add(arrayBaseOffset(Kind.Byte));
-            Word inAddr = Word.unsigned(GetObjectAddressNode.get(in) + arrayBaseOffset(Kind.Byte) + inOffset);
-            Word outAddr = Word.unsigned(GetObjectAddressNode.get(out) + arrayBaseOffset(Kind.Byte) + outOffset);
-            EncryptAESCryptStubCall.call(inAddr, outAddr, kAddr, rAddr, inLength);
+            crypt(rcvr, in, inOffset, inLength, out, outOffset, embeddedCipher, true);
         } else {
             encrypt(rcvr, in, inOffset, inLength, out, outOffset);
         }
     }
 
+    private static void crypt(Object rcvr, byte[] in, int inOffset, int inLength, byte[] out, int outOffset, Object embeddedCipher, boolean encrypt) {
+        Word kAddr = Word.fromObject(embeddedCipher).readWord(Word.unsigned(AESCryptSubstitutions.kOffset)).add(arrayBaseOffset(Kind.Byte));
+        Word rAddr = Word.unsigned(GetObjectAddressNode.get(rcvr)).readWord(Word.unsigned(rOffset)).add(arrayBaseOffset(Kind.Byte));
+        Word inAddr = Word.unsigned(GetObjectAddressNode.get(in) + arrayBaseOffset(Kind.Byte) + inOffset);
+        Word outAddr = Word.unsigned(GetObjectAddressNode.get(out) + arrayBaseOffset(Kind.Byte) + outOffset);
+        if (encrypt) {
+            EncryptAESCryptStubCall.call(inAddr, outAddr, kAddr, rAddr, inLength);
+        } else {
+            DecryptAESCryptStubCall.call(inAddr, outAddr, kAddr, rAddr, inLength);
+        }
+
+    }
+
     @MethodSubstitution(isStatic = false)
     static void decrypt(Object rcvr, byte[] in, int inOffset, int inLength, byte[] out, int outOffset) {
         Object embeddedCipher = Word.fromObject(rcvr).readObject(Word.unsigned(embeddedCipherOffset));
         if (in != out && getAESCryptClass().isInstance(embeddedCipher)) {
-            Word kAddr = Word.fromObject(embeddedCipher).readWord(Word.unsigned(AESCryptSubstitutions.kOffset)).add(arrayBaseOffset(Kind.Byte));
-            Word rAddr = Word.unsigned(GetObjectAddressNode.get(rcvr)).readWord(Word.unsigned(rOffset)).add(arrayBaseOffset(Kind.Byte));
-            Word inAddr = Word.unsigned(GetObjectAddressNode.get(in) + arrayBaseOffset(Kind.Byte) + inOffset);
-            Word outAddr = Word.unsigned(GetObjectAddressNode.get(out) + arrayBaseOffset(Kind.Byte) + outOffset);
-            DecryptAESCryptStubCall.call(inAddr, outAddr, kAddr, rAddr, inLength);
+            crypt(rcvr, in, inOffset, inLength, out, outOffset, embeddedCipher, false);
         } else {
             decrypt(rcvr, in, inOffset, inLength, out, outOffset);
         }
     }
 
-    public static class EncryptAESCryptStubCall extends FixedWithNextNode implements LIRGenLowerable {
+    abstract static class AESCryptStubCall extends FixedWithNextNode implements LIRGenLowerable {
 
         @Input private final ValueNode in;
         @Input private final ValueNode out;
@@ -100,50 +105,43 @@
         @Input private final ValueNode r;
         @Input private final ValueNode inLength;
 
-        public static final Descriptor ENCRYPT = new Descriptor("encrypt", false, void.class, Word.class, Word.class, Word.class, Word.class, int.class);
+        private final Descriptor descriptor;
 
-        public EncryptAESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength) {
+        public AESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength, Descriptor descriptor) {
             super(StampFactory.forVoid());
             this.in = in;
             this.out = out;
             this.key = key;
             this.r = r;
             this.inLength = inLength;
+            this.descriptor = descriptor;
         }
 
         @Override
         public void generate(LIRGenerator gen) {
-            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(ENCRYPT);
+            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(descriptor);
             gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(in), gen.operand(out), gen.operand(key), gen.operand(r), gen.operand(inLength));
         }
+    }
+
+    public static class EncryptAESCryptStubCall extends AESCryptStubCall {
+
+        public static final Descriptor ENCRYPT = new Descriptor("encrypt", false, void.class, Word.class, Word.class, Word.class, Word.class, int.class);
+
+        public EncryptAESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength) {
+            super(in, out, key, r, inLength, ENCRYPT);
+        }
 
         @NodeIntrinsic
         public static native void call(Word in, Word out, Word key, Word r, int inLength);
     }
 
-    public static class DecryptAESCryptStubCall extends FixedWithNextNode implements LIRGenLowerable {
-
-        @Input private final ValueNode in;
-        @Input private final ValueNode out;
-        @Input private final ValueNode key;
-        @Input private final ValueNode r;
-        @Input private final ValueNode inLength;
+    public static class DecryptAESCryptStubCall extends AESCryptStubCall {
 
         public static final Descriptor DECRYPT = new Descriptor("decrypt", false, void.class, Word.class, Word.class, Word.class, Word.class, int.class);
 
         public DecryptAESCryptStubCall(ValueNode in, ValueNode out, ValueNode key, ValueNode r, ValueNode inLength) {
-            super(StampFactory.forVoid());
-            this.in = in;
-            this.out = out;
-            this.key = key;
-            this.r = r;
-            this.inLength = inLength;
-        }
-
-        @Override
-        public void generate(LIRGenerator gen) {
-            RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(DECRYPT);
-            gen.emitCall(stub, stub.getCallingConvention(), false, gen.operand(in), gen.operand(out), gen.operand(key), gen.operand(r), gen.operand(inLength));
+            super(in, out, key, r, inLength, DECRYPT);
         }
 
         @NodeIntrinsic
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ClassSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,6 +37,7 @@
  */
 @ClassSubstitution(java.lang.Class.class)
 public class ClassSubstitutions {
+
     @MethodSubstitution(isStatic = false)
     public static int getModifiers(final Class<?> thisObj) {
         Word klass = loadWordFromObject(thisObj, klassOffset());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.hotspot.snippets;
 
+import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
+
 import com.oracle.graal.api.code.*;
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
@@ -36,7 +38,7 @@
 //JaCoCo Exclude
 
 /**
- * A collection of methods used in HotSpot snippets.
+ * A collection of methods used in HotSpot snippets and substitutions.
  */
 public class HotSpotSnippetUtils {
 
@@ -146,12 +148,13 @@
 
     /**
      * Mask for a biasable, locked or unlocked mark word.
+     * 
      * <pre>
      * +----------------------------------+-+-+
      * |                                 1|1|1|
      * +----------------------------------+-+-+
      * </pre>
-     *
+     * 
      */
     @Fold
     public static int biasedLockMaskInPlace() {
@@ -165,12 +168,13 @@
 
     /**
      * Pattern for a biasable, unlocked mark word.
+     * 
      * <pre>
      * +----------------------------------+-+-+
      * |                                 1|0|1|
      * +----------------------------------+-+-+
      * </pre>
-     *
+     * 
      */
     @Fold
     public static int biasedLockPattern() {
@@ -298,130 +302,108 @@
     @NodeIntrinsic(value = LoadHubNode.class, setStampFromReturnType = true)
     static native Word loadHubIntrinsic(Object object, @ConstantNodeParameter Kind word);
 
-
     @Fold
-    public
-    static int log2WordSize() {
+    public static int log2WordSize() {
         return CodeUtil.log2(wordSize());
     }
 
     @Fold
-    public
-    static int klassStateOffset() {
+    public static int klassStateOffset() {
         return config().klassStateOffset;
     }
 
     @Fold
-    public
-    static int klassModifierFlagsOffset() {
+    public static int klassModifierFlagsOffset() {
         return config().klassModifierFlagsOffset;
     }
 
     @Fold
-    public
-    static int klassOffset() {
+    public static int klassOffset() {
         return config().klassOffset;
     }
 
     @Fold
-    public
-    static int classMirrorOffset() {
+    public static int classMirrorOffset() {
         return config().classMirrorOffset;
     }
 
     @Fold
-    public
-    static int klassInstanceSizeOffset() {
+    public static int klassInstanceSizeOffset() {
         return config().klassInstanceSizeOffset;
     }
 
     @Fold
-    public
-    static long heapTopAddress() {
+    public static long heapTopAddress() {
         return config().heapTopAddress;
     }
 
     @Fold
-    public
-    static long heapEndAddress() {
+    public static long heapEndAddress() {
         return config().heapEndAddress;
     }
 
     @Fold
-    public
-    static int threadTlabStartOffset() {
+    public static int threadTlabStartOffset() {
         return config().threadTlabStartOffset;
     }
 
     @Fold
-    public
-    static long tlabIntArrayMarkWord() {
+    public static long tlabIntArrayMarkWord() {
         return config().tlabIntArrayMarkWord;
     }
 
     @Fold
-    public
-    static boolean inlineContiguousAllocationSupported() {
+    public static boolean inlineContiguousAllocationSupported() {
         return config().inlineContiguousAllocationSupported;
     }
 
     @Fold
-    public
-    static int tlabAlignmentReserveInHeapWords() {
+    public static int tlabAlignmentReserveInHeapWords() {
         return config().tlabAlignmentReserve;
     }
 
     @Fold
-    public
-    static int threadTlabSizeOffset() {
+    public static int threadTlabSizeOffset() {
         return config().threadTlabSizeOffset;
     }
 
     @Fold
-    public
-    static int threadAllocatedBytesOffset() {
+    public static int threadAllocatedBytesOffset() {
         return config().threadAllocatedBytesOffset;
     }
 
     @Fold
-    public
-    static int klassStateFullyInitialized() {
+    public static int klassStateFullyInitialized() {
         return config().klassStateFullyInitialized;
     }
 
     @Fold
-    public
-    static int tlabRefillWasteLimitOffset() {
+    public static int tlabRefillWasteLimitOffset() {
         return config().tlabRefillWasteLimitOffset;
     }
 
     @Fold
-    public
-    static int tlabNumberOfRefillsOffset() {
+    public static int tlabNumberOfRefillsOffset() {
         return config().tlabNumberOfRefillsOffset;
     }
 
     @Fold
-    public
-    static int tlabFastRefillWasteOffset() {
+    public static int tlabFastRefillWasteOffset() {
         return config().tlabFastRefillWasteOffset;
     }
 
     @Fold
-    public
-    static int tlabSlowAllocationsOffset() {
+    public static int tlabSlowAllocationsOffset() {
         return config().tlabSlowAllocationsOffset;
     }
 
     @Fold
-    public
-    static int tlabRefillWasteIncrement() {
+    public static int tlabRefillWasteIncrement() {
         return config().tlabRefillWasteIncrement;
     }
 
     @Fold
-    public
-    static boolean tlabStats() {
+    public static boolean tlabStats() {
         return config().tlabStats;
     }
 
@@ -470,4 +452,21 @@
         assert arrayIndexScale(Kind.Float) == 4;
         assert arrayIndexScale(Kind.Double) == 8;
     }
+
+    static int computeHashCode(Object x) {
+        Word mark = loadWordFromObject(x, markOffset());
+
+        // this code is independent from biased locking (although it does not look that way)
+        final Word biasedLock = mark.and(biasedLockMaskInPlace());
+        if (biasedLock == Word.unsigned(unlockedMask())) {
+            probability(FAST_PATH_PROBABILITY);
+            int hash = (int) mark.unsignedShiftRight(identityHashCodeShift()).rawValue();
+            if (hash != uninitializedIdentityHashCodeValue()) {
+                probability(FAST_PATH_PROBABILITY);
+                return hash;
+            }
+        }
+
+        return IdentityHashCodeStubCall.call(x);
+    }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/InstanceOfSnippets.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,9 +22,8 @@
  */
 package com.oracle.graal.hotspot.snippets;
 
-import static com.oracle.graal.hotspot.snippets.CheckCastSnippets.*;
-import static com.oracle.graal.hotspot.snippets.CheckCastSnippets.Templates.*;
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
+import static com.oracle.graal.hotspot.snippets.TypeCheckSnippetUtils.*;
 import static com.oracle.graal.snippets.SnippetTemplate.Arguments.*;
 import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
 
@@ -47,15 +46,17 @@
 import com.oracle.graal.word.*;
 
 /**
- * Snippets used for implementing the type test of an instanceof instruction.
- * Since instanceof is a floating node, it is lowered separately for each of
- * its usages.
- *
- * The type tests implemented are described in the paper <a href="http://dl.acm.org/citation.cfm?id=583821">
- * Fast subtype checking in the HotSpot JVM</a> by Cliff Click and John Rose.
+ * Snippets used for implementing the type test of an instanceof instruction. Since instanceof is a
+ * floating node, it is lowered separately for each of its usages.
+ * 
+ * The type tests implemented are described in the paper <a
+ * href="http://dl.acm.org/citation.cfm?id=583821"> Fast subtype checking in the HotSpot JVM</a> by
+ * Cliff Click and John Rose.
  */
 public class InstanceOfSnippets implements SnippetsInterface {
 
+    // @formatter:off
+
     /**
      * A test against a final type.
      */
@@ -67,13 +68,13 @@
                     @Parameter("falseValue") Object falseValue,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
-            probability(0.01);
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
             return falseValue;
         }
         Word objectHub = loadHub(object);
         if (objectHub != exactHub) {
-            probability(0.75);
+            probability(LIKELY_PROBABILITY);
             exactMiss.inc();
             return falseValue;
         }
@@ -93,13 +94,13 @@
                     @ConstantParameter("checkNull") boolean checkNull,
                     @ConstantParameter("superCheckOffset") int superCheckOffset) {
         if (checkNull && object == null) {
-            probability(0.01);
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
             return falseValue;
         }
         Word objectHub = loadHub(object);
         if (objectHub.readWord(superCheckOffset) != hub) {
-            probability(0.45);
+            probability(NOT_LIKELY_PROBABILITY);
             displayMiss.inc();
             return falseValue;
         }
@@ -119,7 +120,7 @@
                     @VarargsParameter("hints") Word[] hints,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
-            probability(0.01);
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
             return falseValue;
         }
@@ -129,7 +130,7 @@
         for (int i = 0; i < hints.length; i++) {
             Word hintHub = hints[i];
             if (hintHub == objectHub) {
-                probability(0.01);
+                probability(NOT_FREQUENT_PROBABILITY);
                 hintsHit.inc();
                 return trueValue;
             }
@@ -140,34 +141,6 @@
         return trueValue;
     }
 
-    static boolean checkSecondarySubType(Word t, Word s) {
-        // if (S.cache == T) return true
-        if (s.readWord(secondarySuperCacheOffset()) == t) {
-            cacheHit.inc();
-            return true;
-        }
-
-        // if (T == S) return true
-        if (s == t) {
-            T_equals_S.inc();
-            return true;
-        }
-
-        // if (S.scan_s_s_array(T)) { S.cache = T; return true; }
-        Word secondarySupers = s.readWord(secondarySupersOffset());
-        int length = secondarySupers.readInt(metaspaceArrayLengthOffset());
-        for (int i = 0; i < length; i++) {
-            if (t == loadWordElement(secondarySupers, i)) {
-                probability(0.01);
-                s.writeWord(secondarySuperCacheOffset(), t);
-                secondariesHit.inc();
-                return true;
-            }
-        }
-        secondariesMiss.inc();
-        return false;
-    }
-
     /**
      * Type test used when the type being tested against is not known at compile time.
      */
@@ -179,7 +152,7 @@
                     @Parameter("falseValue") Object falseValue,
                     @ConstantParameter("checkNull") boolean checkNull) {
         if (checkNull && object == null) {
-            probability(0.01);
+            probability(NOT_FREQUENT_PROBABILITY);
             isNull.inc();
             return falseValue;
         }
@@ -192,6 +165,8 @@
         return trueValue;
     }
 
+    // @formatter:on
+
     public static class Templates extends InstanceOfSnippetsTemplates<InstanceOfSnippets> {
 
         private final ResolvedJavaMethod instanceofExact;
@@ -248,16 +223,4 @@
             }
         }
     }
-
-    private static final SnippetCounter.Group counters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("InstanceOf") : null;
-    private static final SnippetCounter hintsHit = new SnippetCounter(counters, "hintsHit", "hit a hint type");
-    private static final SnippetCounter exactHit = new SnippetCounter(counters, "exactHit", "exact type test succeeded");
-    private static final SnippetCounter exactMiss = new SnippetCounter(counters, "exactMiss", "exact type test failed");
-    private static final SnippetCounter isNull = new SnippetCounter(counters, "isNull", "object tested was null");
-    private static final SnippetCounter cacheHit = new SnippetCounter(counters, "cacheHit", "secondary type cache hit");
-    private static final SnippetCounter secondariesHit = new SnippetCounter(counters, "secondariesHit", "secondaries scan succeeded");
-    private static final SnippetCounter secondariesMiss = new SnippetCounter(counters, "secondariesMiss", "secondaries scan failed");
-    private static final SnippetCounter displayHit = new SnippetCounter(counters, "displayHit", "primary type test succeeded");
-    private static final SnippetCounter displayMiss = new SnippetCounter(counters, "displayMiss", "primary type test failed");
-    private static final SnippetCounter T_equals_S = new SnippetCounter(counters, "T_equals_S", "object type was equal to secondary type");
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/IntrinsifyArrayCopyPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +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.snippets;
-
-import java.lang.reflect.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.debug.*;
-import com.oracle.graal.graph.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.phases.*;
-import com.oracle.graal.phases.common.*;
-
-public class IntrinsifyArrayCopyPhase extends Phase {
-    private final GraalCodeCacheProvider runtime;
-    private final Assumptions assumptions;
-    private ResolvedJavaMethod arrayCopy;
-    private ResolvedJavaMethod byteArrayCopy;
-    private ResolvedJavaMethod shortArrayCopy;
-    private ResolvedJavaMethod charArrayCopy;
-    private ResolvedJavaMethod intArrayCopy;
-    private ResolvedJavaMethod longArrayCopy;
-    private ResolvedJavaMethod floatArrayCopy;
-    private ResolvedJavaMethod doubleArrayCopy;
-    private ResolvedJavaMethod objectArrayCopy;
-
-    public IntrinsifyArrayCopyPhase(GraalCodeCacheProvider runtime, Assumptions assumptions) {
-        this.runtime = runtime;
-        this.assumptions = assumptions;
-        try {
-            byteArrayCopy = getArrayCopySnippet(runtime, byte.class);
-            charArrayCopy = getArrayCopySnippet(runtime, char.class);
-            shortArrayCopy = getArrayCopySnippet(runtime, short.class);
-            intArrayCopy = getArrayCopySnippet(runtime, int.class);
-            longArrayCopy = getArrayCopySnippet(runtime, long.class);
-            floatArrayCopy = getArrayCopySnippet(runtime, float.class);
-            doubleArrayCopy = getArrayCopySnippet(runtime, double.class);
-            objectArrayCopy = getArrayCopySnippet(runtime, Object.class);
-            arrayCopy = runtime.lookupJavaMethod(System.class.getDeclaredMethod("arraycopy", Object.class, int.class, Object.class, int.class, int.class));
-        } catch (SecurityException e) {
-            e.printStackTrace();
-        } catch (NoSuchMethodException e) {
-            e.printStackTrace();
-        }
-    }
-
-    private static ResolvedJavaMethod getArrayCopySnippet(CodeCacheProvider runtime, Class<?> componentClass) throws NoSuchMethodException {
-        Class<?> arrayClass = Array.newInstance(componentClass, 0).getClass();
-        return runtime.lookupJavaMethod(ArrayCopySnippets.class.getDeclaredMethod("arraycopy", arrayClass, int.class, arrayClass, int.class, int.class));
-    }
-
-    @Override
-    protected void run(StructuredGraph graph) {
-        boolean hits = false;
-        for (MethodCallTargetNode methodCallTarget : graph.getNodes(MethodCallTargetNode.class)) {
-            ResolvedJavaMethod targetMethod = methodCallTarget.targetMethod();
-            ResolvedJavaMethod snippetMethod = null;
-            if (targetMethod == arrayCopy) {
-                ValueNode src = methodCallTarget.arguments().get(0);
-                ValueNode dest = methodCallTarget.arguments().get(2);
-                assert src != null && dest != null;
-                ResolvedJavaType srcType = src.objectStamp().type();
-                ResolvedJavaType destType = dest.objectStamp().type();
-                if (srcType != null
-                                && srcType.isArray()
-                                && destType != null
-                                && destType.isArray()) {
-                    Kind componentKind = srcType.getComponentType().getKind();
-                    if (srcType.getComponentType() == destType.getComponentType()) {
-                        if (componentKind == Kind.Int) {
-                            snippetMethod = intArrayCopy;
-                        } else if (componentKind == Kind.Char) {
-                            snippetMethod = charArrayCopy;
-                        } else if (componentKind == Kind.Long) {
-                            snippetMethod = longArrayCopy;
-                        } else if (componentKind == Kind.Byte) {
-                            snippetMethod = byteArrayCopy;
-                        } else if (componentKind == Kind.Short) {
-                            snippetMethod = shortArrayCopy;
-                        } else if (componentKind == Kind.Float) {
-                            snippetMethod = floatArrayCopy;
-                        } else if (componentKind == Kind.Double) {
-                            snippetMethod = doubleArrayCopy;
-                        } else if (componentKind == Kind.Object) {
-                            snippetMethod = objectArrayCopy;
-                        }
-                    } else if (componentKind == Kind.Object
-                                    && destType.getComponentType().isAssignableFrom(srcType.getComponentType())) {
-                        snippetMethod = objectArrayCopy;
-                    }
-                }
-            }
-
-            if (snippetMethod != null) {
-                StructuredGraph snippetGraph = (StructuredGraph) snippetMethod.getCompilerStorage().get(Graph.class);
-                assert snippetGraph != null : "ArrayCopySnippets should be installed";
-                hits = true;
-                Debug.log("%s > Intrinsify (%s)", Debug.currentScope(), snippetMethod.getSignature().getParameterType(0, snippetMethod.getDeclaringClass()).getComponentType());
-                InliningUtil.inline(methodCallTarget.invoke(), snippetGraph, false);
-            } else {
-                Debug.log("%s > not intrinsifying arraycopy", Debug.currentScope());
-            }
-        }
-        if (GraalOptions.OptCanonicalizer && hits) {
-            new CanonicalizerPhase(null, runtime, assumptions).apply(graph);
-        }
-    }
-}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/MonitorSnippets.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
 import static com.oracle.graal.hotspot.nodes.VMErrorNode.*;
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
 import static com.oracle.graal.snippets.SnippetTemplate.*;
+import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
 
 import java.util.*;
 
@@ -53,10 +54,11 @@
 
 /**
  * Snippets used for implementing the monitorenter and monitorexit instructions.
- *
- * The locking algorithm used is described in the paper <a href="http://dl.acm.org/citation.cfm?id=1167515.1167496">
- * Eliminating synchronization-related atomic operations with biased locking and bulk rebiasing</a>
- * by Kenneth Russell and David Detlefs.
+ * 
+ * The locking algorithm used is described in the paper <a
+ * href="http://dl.acm.org/citation.cfm?id=1167515.1167496"> Eliminating synchronization-related
+ * atomic operations with biased locking and bulk rebiasing</a> by Kenneth Russell and David
+ * Detlefs.
  */
 public class MonitorSnippets implements SnippetsInterface {
 
@@ -66,7 +68,8 @@
     private static final String TRACE_TYPE_FILTER = System.getProperty("graal.monitors.trace.typeFilter");
 
     /**
-     * Monitor operations in methods whose fully qualified name contains this substring will be traced.
+     * Monitor operations in methods whose fully qualified name contains this substring will be
+     * traced.
      */
     private static final String TRACE_METHOD_FILTER = System.getProperty("graal.monitors.trace.methodFilter");
 
@@ -102,6 +105,7 @@
             if (biasableLockBits != Word.unsigned(biasedLockPattern())) {
                 // Biasing not enabled -> fall through to lightweight locking
             } else {
+                probability(FREQUENT_PROBABILITY);
                 // The bias pattern is present in the object's mark word. Need to check
                 // whether the bias owner and the epoch are both still current.
                 Word hub = loadHub(object);
@@ -113,6 +117,7 @@
                 trace(trace, "              tmp: 0x%016lx\n", tmp);
                 if (tmp == Word.zero()) {
                     // Object is already biased to current thread -> done
+                    probability(FREQUENT_PROBABILITY);
                     traceObject(trace, "+lock{bias:existing}", object);
                     return;
                 }
@@ -127,6 +132,7 @@
                 // the prototype header is no longer biasable and we have to revoke
                 // the bias on this object.
                 if (tmp.and(biasedLockMaskInPlace()) == Word.zero()) {
+                    probability(FREQUENT_PROBABILITY);
                     // Biasing is still enabled for object's type. See whether the
                     // epoch of the current bias is still valid, meaning that the epoch
                     // bits of the mark word are equal to the epoch bits of the
@@ -137,6 +143,7 @@
                     // otherwise the manipulations it performs on the mark word are
                     // illegal.
                     if (tmp.and(epochMaskInPlace()) == Word.zero()) {
+                        probability(FREQUENT_PROBABILITY);
                         // The epoch of the current bias is still valid but we know nothing
                         // about the owner; it might be set or it might be clear. Try to
                         // acquire the bias of the object using an atomic operation. If this
@@ -155,6 +162,7 @@
                         // If the biasing toward our thread failed, this means that another thread
                         // owns the bias and we need to revoke that bias. The revocation will occur
                         // in the interpreter runtime.
+                        probability(DEOPT_PATH_PROBABILITY);
                         traceObject(trace, "+lock{stub:revoke}", object);
                         MonitorEnterStubCall.call(object, lock);
                         return;
@@ -175,6 +183,7 @@
                         // If the biasing toward our thread failed, then another thread
                         // succeeded in biasing it toward itself and we need to revoke that
                         // bias. The revocation will occur in the runtime in the slow case.
+                        probability(DEOPT_PATH_PROBABILITY);
                         traceObject(trace, "+lock{stub:epoch-expired}", object);
                         MonitorEnterStubCall.call(object, lock);
                         return;
@@ -218,13 +227,13 @@
             // by the current thread. The latter is true if the mark word
             // is a stack pointer into the current thread's stack, i.e.:
             //
-            //   1) (currentMark & aligned_mask) == 0
-            //   2)  rsp <= currentMark
-            //   3)  currentMark <= rsp + page_size
+            // 1) (currentMark & aligned_mask) == 0
+            // 2) rsp <= currentMark
+            // 3) currentMark <= rsp + page_size
             //
             // These 3 tests can be done by evaluating the following expression:
             //
-            //   (currentMark - rsp) & (aligned_mask - page_size)
+            // (currentMark - rsp) & (aligned_mask - page_size)
             //
             // assuming both the stack pointer and page_size have their least
             // significant 2 bits cleared and page_size is a power of 2
@@ -232,6 +241,7 @@
             final Word stackPointer = stackPointer();
             if (currentMark.subtract(stackPointer).and(alignedMask.subtract(pageSize())) != Word.zero()) {
                 // Most likely not a recursive lock, go into a slow runtime call
+                probability(DEOPT_PATH_PROBABILITY);
                 traceObject(trace, "+lock{stub:failed-cas}", object);
                 MonitorEnterStubCall.call(object, lock);
                 return;
@@ -281,6 +291,7 @@
             final Word mark = loadWordFromObject(object, markOffset());
             trace(trace, "             mark: 0x%016lx\n", mark);
             if (mark.and(biasedLockMaskInPlace()) == Word.unsigned(biasedLockPattern())) {
+                probability(FREQUENT_PROBABILITY);
                 endLockScope();
                 decCounter();
                 traceObject(trace, "-lock{bias}", object);
@@ -303,8 +314,9 @@
             // the displaced mark in the object - if the object's mark word is not pointing to
             // the displaced mark word, do unlocking via runtime call.
             if (DirectCompareAndSwapNode.compareAndSwap(object, markOffset(), lock, displacedMark) != lock) {
-              // The object's mark word was not pointing to the displaced header,
-              // we do unlocking via runtime call.
+                // The object's mark word was not pointing to the displaced header,
+                // we do unlocking via runtime call.
+                probability(DEOPT_PATH_PROBABILITY);
                 traceObject(trace, "-lock{stub}", object);
                 MonitorExitStubCall.call(object);
             } else {
@@ -348,7 +360,8 @@
     }
 
     /**
-     * Leaving the breakpoint code in to provide an example of how to use the {@link BreakpointNode} intrinsic.
+     * Leaving the breakpoint code in to provide an example of how to use the {@link BreakpointNode}
+     * intrinsic.
      */
     private static final boolean ENABLE_BREAKPOINT = false;
 
@@ -425,9 +438,7 @@
                 key.add("checkNull", checkNull);
             }
             if (!eliminated) {
-                key.add("trace", isTracingEnabledForType(monitorenterNode.object()) ||
-                                 isTracingEnabledForMethod(stateAfter.method()) ||
-                                 isTracingEnabledForMethod(graph.method()));
+                key.add("trace", isTracingEnabledForType(monitorenterNode.object()) || isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method()));
             }
 
             Arguments arguments = new Arguments();
@@ -451,9 +462,7 @@
             ResolvedJavaMethod method = eliminated ? monitorexitEliminated : useFastLocking ? monitorexit : monitorexitStub;
             Key key = new Key(method);
             if (!eliminated) {
-                key.add("trace", isTracingEnabledForType(monitorexitNode.object()) ||
-                                 isTracingEnabledForMethod(stateAfter.method()) ||
-                                 isTracingEnabledForMethod(graph.method()));
+                key.add("trace", isTracingEnabledForType(monitorexitNode.object()) || isTracingEnabledForMethod(stateAfter.method()) || isTracingEnabledForMethod(graph.method()));
             }
             Arguments arguments = new Arguments();
             if (!eliminated) {
@@ -499,9 +508,8 @@
         }
 
         /**
-         * If balanced monitor checking is enabled then nodes are inserted at the start and
-         * all return points of the graph to initialize and check the monitor counter
-         * respectively.
+         * If balanced monitor checking is enabled then nodes are inserted at the start and all
+         * return points of the graph to initialize and check the monitor counter respectively.
          */
         private void checkBalancedMonitors(StructuredGraph graph) {
             if (CHECK_BALANCED_MONITORS) {
@@ -521,7 +529,7 @@
                         returnType = checkCounter.getSignature().getReturnType(checkCounter.getDeclaringClass());
                         Object msg = ((HotSpotRuntime) runtime).registerGCRoot("unbalanced monitors in " + MetaUtil.format("%H.%n(%p)", graph.method()) + ", count = %d");
                         ConstantNode errMsg = ConstantNode.forObject(msg, runtime, graph);
-                        callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter, new ValueNode[] {errMsg}, returnType));
+                        callTarget = graph.add(new MethodCallTargetNode(InvokeKind.Static, checkCounter, new ValueNode[]{errMsg}, returnType));
                         invoke = graph.add(new InvokeNode(callTarget, 0, -1));
                         List<ValueNode> stack = Collections.emptyList();
                         FrameState stateAfter = new FrameState(graph.method(), FrameState.AFTER_BCI, new ValueNode[0], stack, new ValueNode[0], false, false);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java	Fri Feb 01 17:06:26 2013 +0100
@@ -57,6 +57,8 @@
  */
 public class NewObjectSnippets implements SnippetsInterface {
 
+    // @formatter:off
+
     @Snippet
     public static Word allocate(@Parameter("size") int size) {
         Word thread = thread();
@@ -65,7 +67,7 @@
         Word newTop = top.add(size);
         // this check might lead to problems if the TLAB is within 16GB of the address space end (checked in c++ code)
         if (newTop.belowOrEqual(end)) {
-            probability(0.99);
+            probability(FAST_PATH_PROBABILITY);
             thread.writeWord(threadTlabTopOffset(), newTop);
             return top;
         }
@@ -86,7 +88,7 @@
             new_stub.inc();
             result = NewInstanceStubCall.call(hub);
         } else {
-            probability(0.99);
+            probability(FAST_PATH_PROBABILITY);
             if (locked) {
                 formatObject(hub, size, memory, thread().or(biasedLockPattern()), fillContents);
             } else {
@@ -120,7 +122,7 @@
             newarray_stub.inc();
             result = NewArrayStubCall.call(hub, length);
         } else {
-            probability(0.99);
+            probability(FAST_PATH_PROBABILITY);
             newarray_loopInit.inc();
             formatArray(hub, allocationSize, length, headerSize, memory, prototypeMarkWord, fillContents);
             result = memory.toObject();
@@ -141,10 +143,10 @@
                     @ConstantParameter("log2ElementSize") int log2ElementSize,
                     @ConstantParameter("type") ResolvedJavaType type) {
         if (!belowThan(length, MAX_ARRAY_FAST_PATH_ALLOCATION_LENGTH)) {
+            probability(DEOPT_PATH_PROBABILITY);
             // This handles both negative array sizes and very large array sizes
             DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
         }
-        probability(0.99);
         int allocationSize = computeArrayAllocationSize(length, alignment, headerSize, log2ElementSize);
         Word memory = TLABAllocateNode.allocateVariableSize(allocationSize);
         return InitializeArrayNode.initialize(memory, length, allocationSize, type, true, false);
@@ -226,6 +228,8 @@
         }
     }
 
+    // @formatter:on
+
     public static class Templates extends AbstractTemplates<NewObjectSnippets> {
 
         private final ResolvedJavaMethod allocate;
@@ -255,9 +259,7 @@
             StructuredGraph graph = (StructuredGraph) newInstanceNode.graph();
             HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) newInstanceNode.instanceClass();
             ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, graph);
-            int size = type.instanceSize();
-            assert (size % wordSize()) == 0;
-            assert size >= 0;
+            int size = instanceSize(type);
 
             ValueNode memory;
             if (!useTLAB) {
@@ -289,7 +291,8 @@
             int log2ElementSize = CodeUtil.log2(target.sizeInBytes(elementKind));
             if (!useTLAB) {
                 ConstantNode zero = ConstantNode.defaultForKind(target.wordKind, graph);
-                // value for 'size' doesn't matter as it isn't used since a stub call will be made anyway
+                // value for 'size' doesn't matter as it isn't used since a stub call will be made
+                // anyway
                 // for both allocation and initialization - it just needs to be non-null
                 ConstantNode size = ConstantNode.forInt(-1, graph);
                 InitializeArrayNode initializeNode = graph.add(new InitializeArrayNode(zero, lengthNode, size, arrayType, newArrayNode.fillContents(), newArrayNode.locked()));
@@ -303,11 +306,7 @@
                 InitializeArrayNode initializeNode = graph.add(new InitializeArrayNode(tlabAllocateNode, lengthNode, sizeNode, arrayType, newArrayNode.fillContents(), newArrayNode.locked()));
                 graph.replaceFixedWithFixed(newArrayNode, initializeNode);
             } else {
-                Key key = new Key(allocateArrayAndInitialize).
-                                add("alignment", alignment).
-                                add("headerSize", headerSize).
-                                add("log2ElementSize", log2ElementSize).
-                                add("type", arrayType);
+                Key key = new Key(allocateArrayAndInitialize).add("alignment", alignment).add("headerSize", headerSize).add("log2ElementSize", log2ElementSize).add("type", arrayType);
                 Arguments arguments = new Arguments().add("length", lengthNode);
                 SnippetTemplate template = cache.get(key, assumptions);
                 Debug.log("Lowering allocateArrayAndInitialize in %s: node=%s, template=%s, arguments=%s", graph, newArrayNode, template, arguments);
@@ -332,9 +331,7 @@
             HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) initializeNode.type();
             assert !type.isArray();
             ConstantNode hub = ConstantNode.forConstant(type.klass(), runtime, graph);
-            int size = type.instanceSize();
-            assert (size % wordSize()) == 0;
-            assert size >= 0;
+            int size = instanceSize(type);
             Key key = new Key(initializeObject).add("size", size).add("fillContents", initializeNode.fillContents()).add("locked", initializeNode.locked());
             ValueNode memory = initializeNode.memory();
             Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord());
@@ -354,7 +351,8 @@
             final int headerSize = HotSpotRuntime.getArrayBaseOffset(elementKind);
             Key key = new Key(initializeArray).add("headerSize", headerSize).add("fillContents", initializeNode.fillContents()).add("locked", initializeNode.locked());
             ValueNode memory = initializeNode.memory();
-            Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("allocationSize", initializeNode.allocationSize()).add("length", initializeNode.length());
+            Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("allocationSize", initializeNode.allocationSize()).add("length",
+                            initializeNode.length());
             SnippetTemplate template = cache.get(key, assumptions);
             Debug.log("Lowering initializeArray in %s: node=%s, template=%s, arguments=%s", graph, initializeNode, template, arguments);
             template.instantiate(runtime, initializeNode, DEFAULT_REPLACER, arguments);
@@ -375,6 +373,13 @@
             SnippetTemplate template = cache.get(key, assumptions);
             template.instantiate(runtime, newmultiarrayNode, DEFAULT_REPLACER, arguments);
         }
+
+        private static int instanceSize(HotSpotResolvedObjectType type) {
+            int size = type.instanceSize();
+            assert (size % wordSize()) == 0;
+            assert size >= 0;
+            return size;
+        }
     }
 
     private static final SnippetCounter.Group countersNew = GraalOptions.SnippetCounters ? new SnippetCounter.Group("NewInstance") : null;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/ObjectSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,9 +24,7 @@
 
 import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
 import static com.oracle.graal.nodes.extended.UnsafeCastNode.*;
-import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
 
-import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.snippets.*;
 import com.oracle.graal.snippets.ClassSubstitution.MethodSubstitution;
 import com.oracle.graal.word.*;
@@ -38,26 +36,13 @@
 public class ObjectSubstitutions {
 
     @MethodSubstitution(isStatic = false)
-    public static Class< ? > getClass(final Object thisObj) {
+    public static Class<?> getClass(final Object thisObj) {
         Word hub = loadHub(thisObj);
         return unsafeCast(hub.readFinalObject(Word.signed(classMirrorOffset())), Class.class, true, true);
     }
 
     @MethodSubstitution(isStatic = false)
     public static int hashCode(final Object thisObj) {
-        Word mark = loadWordFromObject(thisObj, markOffset());
-
-        // this code is independent from biased locking (although it does not look that way)
-        final Word biasedLock = mark.and(biasedLockMaskInPlace());
-        if (biasedLock == Word.unsigned(unlockedMask())) {
-            probability(0.99);
-            int hash = (int) mark.unsignedShiftRight(identityHashCodeShift()).rawValue();
-            if (hash != uninitializedIdentityHashCodeValue()) {
-                probability(0.99);
-                return hash;
-            }
-        }
-
-        return IdentityHashCodeStubCall.call(thisObj);
+        return computeHashCode(thisObj);
     }
 }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/SystemSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,11 +28,10 @@
 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
 import com.oracle.graal.graph.Node.ConstantNodeParameter;
 import com.oracle.graal.graph.Node.NodeIntrinsic;
-import com.oracle.graal.hotspot.nodes.*;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.snippets.*;
+import com.oracle.graal.snippets.ClassSubstitution.MacroSubstitution;
 import com.oracle.graal.snippets.ClassSubstitution.MethodSubstitution;
-import com.oracle.graal.word.*;
 
 /**
  * Substitutions for {@link java.lang.System} methods.
@@ -43,6 +42,9 @@
     public static final Descriptor JAVA_TIME_MILLIS = new Descriptor("javaTimeMillis", false, long.class);
     public static final Descriptor JAVA_TIME_NANOS = new Descriptor("javaTimeNanos", false, long.class);
 
+    @MacroSubstitution(macro = ArrayCopyNode.class, isStatic = true)
+    public static native void arraycopy(Object src, int srcPos, Object dest, int destPos, int length);
+
     @MethodSubstitution
     public static long currentTimeMillis() {
         return callLong(JAVA_TIME_MILLIS);
@@ -56,24 +58,11 @@
     @MethodSubstitution
     public static int identityHashCode(Object x) {
         if (x == null) {
-            probability(0.01);
+            probability(NOT_FREQUENT_PROBABILITY);
             return 0;
         }
 
-        Word mark = loadWordFromObject(x, markOffset());
-
-        // this code is independent from biased locking (although it does not look that way)
-        final Word biasedLock = mark.and(biasedLockMaskInPlace());
-        if (biasedLock == Word.unsigned(unlockedMask())) {
-            probability(0.99);
-            int hash = (int) mark.unsignedShiftRight(identityHashCodeShift()).rawValue();
-            if (hash != uninitializedIdentityHashCodeValue()) {
-                probability(0.99);
-                return hash;
-            }
-        }
-
-        return IdentityHashCodeStubCall.call(x);
+        return computeHashCode(x);
     }
 
     @NodeIntrinsic(value = RuntimeCallNode.class, setStampFromReturnType = true)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/TypeCheckSnippetUtils.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,122 @@
+/*
+ * 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.hotspot.snippets;
+
+import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*;
+import static com.oracle.graal.snippets.nodes.BranchProbabilityNode.*;
+
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.phases.*;
+import com.oracle.graal.snippets.*;
+import com.oracle.graal.word.*;
+
+/**
+ * Utilities and common code paths used by the type check snippets.
+ */
+public class TypeCheckSnippetUtils {
+
+    static boolean checkSecondarySubType(Word t, Word s) {
+        // if (S.cache == T) return true
+        if (s.readWord(secondarySuperCacheOffset()) == t) {
+            cacheHit.inc();
+            return true;
+        }
+
+        return checkSelfAndSupers(t, s);
+    }
+
+    static boolean checkUnknownSubType(Word t, Word s) {
+        // int off = T.offset
+        int superCheckOffset = t.readInt(superCheckOffsetOffset());
+        boolean primary = superCheckOffset != secondarySuperCacheOffset();
+
+        // if (T = S[off]) return true
+        if (s.readWord(superCheckOffset) == t) {
+            if (primary) {
+                cacheHit.inc();
+            } else {
+                displayHit.inc();
+            }
+            return true;
+        }
+
+        // if (off != &cache) return false
+        if (primary) {
+            displayMiss.inc();
+            return false;
+        }
+
+        return checkSelfAndSupers(t, s);
+    }
+
+    private static boolean checkSelfAndSupers(Word t, Word s) {
+        // if (T == S) return true
+        if (s == t) {
+            T_equals_S.inc();
+            return true;
+        }
+
+        // if (S.scan_s_s_array(T)) { S.cache = T; return true; }
+        Word secondarySupers = s.readWord(secondarySupersOffset());
+        int length = secondarySupers.readInt(metaspaceArrayLengthOffset());
+        for (int i = 0; i < length; i++) {
+            if (t == loadWordElement(secondarySupers, i)) {
+                probability(NOT_LIKELY_PROBABILITY);
+                s.writeWord(secondarySuperCacheOffset(), t);
+                secondariesHit.inc();
+                return true;
+            }
+        }
+        secondariesMiss.inc();
+        return false;
+    }
+
+    static ConstantNode[] createHints(TypeCheckHints hints, MetaAccessProvider runtime, Graph graph) {
+        ConstantNode[] hintHubs = new ConstantNode[hints.types.length];
+        for (int i = 0; i < hintHubs.length; i++) {
+            hintHubs[i] = ConstantNode.forConstant(((HotSpotResolvedObjectType) hints.types[i]).klass(), runtime, graph);
+        }
+        return hintHubs;
+    }
+
+    static Word loadWordElement(Word metaspaceArray, int index) {
+        return metaspaceArray.readWord(metaspaceArrayBaseOffset() + index * wordSize());
+    }
+
+    private static final SnippetCounter.Group counters = GraalOptions.SnippetCounters ? new SnippetCounter.Group("TypeCheck") : null;
+    static final SnippetCounter hintsHit = new SnippetCounter(counters, "hintsHit", "hit a hint type");
+    static final SnippetCounter exactHit = new SnippetCounter(counters, "exactHit", "exact type test succeeded");
+    static final SnippetCounter exactMiss = new SnippetCounter(counters, "exactMiss", "exact type test failed");
+    static final SnippetCounter isNull = new SnippetCounter(counters, "isNull", "object tested was null");
+    static final SnippetCounter cacheHit = new SnippetCounter(counters, "cacheHit", "secondary type cache hit");
+    static final SnippetCounter secondariesHit = new SnippetCounter(counters, "secondariesHit", "secondaries scan succeeded");
+    static final SnippetCounter secondariesMiss = new SnippetCounter(counters, "secondariesMiss", "secondaries scan failed");
+    static final SnippetCounter displayHit = new SnippetCounter(counters, "displayHit", "primary type test succeeded");
+    static final SnippetCounter displayMiss = new SnippetCounter(counters, "displayMiss", "primary type test failed");
+    static final SnippetCounter T_equals_S = new SnippetCounter(counters, "T_equals_S", "object type was equal to secondary type");
+
+}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewArrayStub.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,11 +38,10 @@
 import com.oracle.graal.word.*;
 
 /**
- * Stub implementing the fast path for TLAB refill during instance class allocation.
- * This stub is called from the {@linkplain NewObjectSnippets inline} allocation
- * code when TLAB allocation fails. If this stub fails to refill the TLAB
- * or allocate the object, it calls out to the HotSpot C++ runtime for
- * to complete the allocation.
+ * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
+ * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails.
+ * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++
+ * runtime for to complete the allocation.
  */
 public class NewArrayStub extends Stub {
 
@@ -58,19 +57,16 @@
     }
 
     /**
-     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to -XX:-UseTLAB).
-     *
+     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to
+     * -XX:-UseTLAB).
+     * 
      * @param hub the hub of the object to be allocated
      * @param length the length of the array
      * @param intArrayHub the hub for {@code int[].class}
      * @param log specifies if logging is enabled
      */
     @Snippet
-    private static Object newArray(
-                    @Parameter("hub") Word hub,
-                    @Parameter("length") int length,
-                    @ConstantParameter("intArrayHub") Word intArrayHub,
-                    @ConstantParameter("log") boolean log) {
+    private static Object newArray(@Parameter("hub") Word hub, @Parameter("length") int length, @ConstantParameter("intArrayHub") Word intArrayHub, @ConstantParameter("log") boolean log) {
         int layoutHelper = hub.readInt(layoutHelperOffset());
         int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift()) & layoutHelperLog2ElementSizeMask();
         int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift()) & layoutHelperHeaderSizeMask();
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/NewInstanceStub.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,11 +40,10 @@
 import com.oracle.graal.word.*;
 
 /**
- * Stub implementing the fast path for TLAB refill during instance class allocation.
- * This stub is called from the {@linkplain NewObjectSnippets inline} allocation
- * code when TLAB allocation fails. If this stub fails to refill the TLAB
- * or allocate the object, it calls out to the HotSpot C++ runtime for
- * to complete the allocation.
+ * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
+ * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails.
+ * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++
+ * runtime for to complete the allocation.
  */
 public class NewInstanceStub extends Stub {
 
@@ -60,16 +59,14 @@
     }
 
     /**
-     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to -XX:-UseTLAB).
-     *
+     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to
+     * -XX:-UseTLAB).
+     * 
      * @param hub the hub of the object to be allocated
      * @param intArrayHub the hub for {@code int[].class}
      */
     @Snippet
-    private static Object newInstance(
-                    @Parameter("hub") Word hub,
-                    @ConstantParameter("intArrayHub") Word intArrayHub,
-                    @ConstantParameter("log") boolean log) {
+    private static Object newInstance(@Parameter("hub") Word hub, @ConstantParameter("intArrayHub") Word intArrayHub, @ConstantParameter("log") boolean log) {
         int sizeInBytes = hub.readInt(klassInstanceSizeOffset());
         if (!forceSlowPath() && inlineContiguousAllocationSupported()) {
             if (hub.readInt(klassStateOffset()) == klassStateFullyInitialized()) {
@@ -90,11 +87,12 @@
 
     /**
      * Attempts to refill the current thread's TLAB and retries the allocation.
-     *
+     * 
      * @param intArrayHub the hub for {@code int[].class}
      * @param sizeInBytes the size of the allocation
      * @param log specifies if logging is enabled
-     * @return the newly allocated, uninitialized chunk of memory, or {@link Word#zero()} if the operation was unsuccessful
+     * @return the newly allocated, uninitialized chunk of memory, or {@link Word#zero()} if the
+     *         operation was unsuccessful
      */
     static Word refillAllocate(Word intArrayHub, int sizeInBytes, boolean log) {
 
@@ -133,7 +131,8 @@
             // fill [top, end + alignment_reserve) with array object
             if (top != Word.zero()) {
                 int headerSize = arrayBaseOffset(Kind.Int);
-                // just like the HotSpot assembler stubs, assumes that tlabFreeSpaceInInts fits in an int
+                // just like the HotSpot assembler stubs, assumes that tlabFreeSpaceInInts fits in
+                // an int
                 int tlabFreeSpaceInInts = (int) tlabFreeSpaceInBytes.rawValue() >>> 2;
                 int length = ((alignmentReserveInBytes - headerSize) >>> 2) + tlabFreeSpaceInInts;
                 NewObjectSnippets.formatArray(intArrayHub, -1, length, headerSize, top, intArrayMarkWord, false);
@@ -175,7 +174,7 @@
 
     /**
      * Attempts to allocate a chunk of memory from Eden space.
-     *
+     * 
      * @param sizeInBytes the size of the chunk to allocate
      * @param log specifies if logging is enabled
      * @return the allocated chunk or {@link Word#zero()} if allocation fails
@@ -212,26 +211,31 @@
             Log.printf(format, value);
         }
     }
+
     static void log(boolean enabled, String format, WordBase value) {
         if (enabled) {
             Log.printf(format, value.rawValue());
         }
     }
+
     static void log(boolean enabled, String format, long v1, long v2) {
         if (enabled) {
             Log.printf(format, v1, v2);
         }
     }
+
     static void log(boolean enabled, String format, Word v1, long v2) {
         if (enabled) {
             Log.printf(format, v1.rawValue(), v2);
         }
     }
+
     static void log(boolean enabled, String format, Word v1, Word v2) {
         if (enabled) {
             Log.printf(format, v1.rawValue(), v2.rawValue());
         }
     }
+
     static void log(boolean enabled, String format, long v1, long v2, long v3) {
         if (enabled) {
             Log.printf(format, v1, v2, v3);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/Stub.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,8 +45,8 @@
 import com.oracle.graal.snippets.SnippetTemplate.Key;
 
 /**
- * Base class for implementing some low level code providing the out-of-line slow path for a snippet.
- * A concrete stub is defined a subclass of this class.
+ * Base class for implementing some low level code providing the out-of-line slow path for a
+ * snippet. A concrete stub is defined a subclass of this class.
  * <p>
  * Implementation detail: The stub classes re-use some of the functionality for {@link Snippet}s
  * purely for convenience (e.g., can re-use the {@link SnippetInstaller}).
@@ -69,8 +69,9 @@
     protected InstalledCode stubCode;
 
     /**
-     * Creates a new stub container. The new stub still needs to be {@linkplain #install(GraalCompiler) installed}.
-     *
+     * Creates a new stub container. The new stub still needs to be
+     * {@linkplain #install(GraalCompiler) installed}.
+     * 
      * @param descriptor linkage details for a call to the stub
      */
     @SuppressWarnings("unchecked")
@@ -102,7 +103,8 @@
     }
 
     /**
-     * Compiles the code for this stub, installs it and initializes the address used for calls to it.
+     * Compiles the code for this stub, installs it and initializes the address used for calls to
+     * it.
      */
     public void install(GraalCompiler compiler) {
         StructuredGraph graph = (StructuredGraph) stubMethod.getCompilerStorage().get(Graph.class);
@@ -118,13 +120,14 @@
         final CompilationResult compResult = compiler.compileMethod(stubMethod, graph, null, phasePlan, OptimisticOptimizations.ALL);
 
         final CodeInfo[] info = new CodeInfo[1];
-        stubCode = Debug.scope("CodeInstall", new Object[] {compiler, stubMethod}, new Callable<InstalledCode>() {
+        stubCode = Debug.scope("CodeInstall", new Object[]{compiler, stubMethod}, new Callable<InstalledCode>() {
+
             @Override
             public InstalledCode call() {
                 InstalledCode installedCode = runtime().addMethod(stubMethod, compResult, info);
                 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, info[0]}, "After code installation");
                 }
                 return installedCode;
             }
@@ -135,7 +138,8 @@
     }
 
     /**
-     * Finds the static method annotated with {@link Snippet} in a given class of which there must be exactly one.
+     * Finds the static method annotated with {@link Snippet} in a given class of which there must
+     * be exactly one.
      */
     private static HotSpotResolvedJavaMethod findStubMethod(HotSpotRuntime runtime, Class<?> stubClass) {
         HotSpotResolvedJavaMethod m = null;
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.bytecode.*;
 
 /**
- * High-level bytecode interpreter that executes on top of Java. Java native methods
- * are executed using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}.
+ * High-level bytecode interpreter that executes on top of Java. Java native methods are executed
+ * using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}.
  */
 @SuppressWarnings("static-method")
 public final class BytecodeInterpreter implements Interpreter {
@@ -1194,7 +1194,7 @@
         return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().getDeclaringClass());
     }
 
-    private ResolvedJavaType resolveType(InterpreterFrame frame, Class< ? > javaClass) {
+    private ResolvedJavaType resolveType(InterpreterFrame frame, Class<?> javaClass) {
         return metaAccessProvider.lookupJavaType(javaClass).resolve(frame.getMethod().getDeclaringClass());
     }
 
@@ -1371,7 +1371,8 @@
             traceCall(caller, "Delegate " + originalMethod);
         }
 
-        // current thread is low level and we also execute the target method in the low-level interpreter
+        // current thread is low level and we also execute the target method in the low-level
+        // interpreter
         Object[] originalCalleeParameters = popArgumentsAsObject(caller, originalMethod, hasReceiver);
         Object[] parameters = new Object[]{caller, originalMethod, originalCalleeParameters};
         Object returnValue = redirectionInfo.getTargetMethod().invoke(redirectionInfo.getReceiver(), parameters);
@@ -1609,7 +1610,7 @@
         }
     }
 
-    private static Method findMethod(Class< ? > clazz, String name, Class< ? >... parameters) {
+    private static Method findMethod(Class<?> clazz, String name, Class<?>... parameters) {
         try {
             return clazz.getDeclaredMethod(name, parameters);
         } catch (Exception e) {
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterCallable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.api.meta.*;
 
+public interface InterpreterCallable {
 
-public interface InterpreterCallable {
     // static final fields
     String INTERPRETER_CALLABLE_INVOKE_NAME = "invoke";
     Class<?>[] INTERPRETER_CALLABLE_INVOKE_SIGNATURE = {InterpreterFrame.class, ResolvedJavaMethod.class, Object[].class};
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterException.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.graal.interpreter;
 
 /**
- * Thrown if executed byte code caused an error in {@link BytecodeInterpreter}. The actual execution exception is
- * accessible using {@link #getCause()} or {@link #getExecutionThrowable()}.
+ * Thrown if executed byte code caused an error in {@link BytecodeInterpreter}. The actual execution
+ * exception is accessible using {@link #getCause()} or {@link #getExecutionThrowable()}.
  */
 public class InterpreterException extends RuntimeException {
 
--- a/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/InterpreterFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -78,13 +78,10 @@
     }
 
     private void copyArguments(InterpreterFrame dest, int length) {
-        System.arraycopy(locals, tosSingle(length - 1), dest.locals,
-                        BASE_LENGTH, length);
-        System.arraycopy(primitiveLocals, tosSingle(length - 1), dest.primitiveLocals,
-                        BASE_LENGTH, length);
+        System.arraycopy(locals, tosSingle(length - 1), dest.locals, BASE_LENGTH, length);
+        System.arraycopy(primitiveLocals, tosSingle(length - 1), dest.primitiveLocals, BASE_LENGTH, length);
     }
 
-
     public Object peekReceiver(ResolvedJavaMethod method) {
         return getObject(tosSingle(method.getSignature().getParameterSlots(false)));
     }
@@ -298,11 +295,9 @@
     }
 
     public void pushTo(InterpreterFrame childFrame, int argumentSlots) {
-        System.arraycopy(locals, tos - argumentSlots, childFrame.locals,
-                        InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
+        System.arraycopy(locals, tos - argumentSlots, childFrame.locals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
 
-        System.arraycopy(primitiveLocals, tos - argumentSlots, childFrame.primitiveLocals,
-                        InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
+        System.arraycopy(primitiveLocals, tos - argumentSlots, childFrame.primitiveLocals, InterpreterFrame.MIN_FRAME_SIZE, argumentSlots);
         popVoid(argumentSlots);
     }
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,38 +34,46 @@
 import com.oracle.graal.phases.*;
 
 /**
- * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph (CFG).
- * It makes one linear passes over the bytecodes to build the CFG where it detects block headers and connects them.
- * <br>
- * It also creates exception dispatch blocks for exception handling. These blocks are between a bytecode that might
- * throw an exception, and the actual exception handler entries, and are later used to create the type checks with the
- * exception handler catch types. If a bytecode is covered by an exception handler, this bytecode ends the basic block.
- * This guarantees that a) control flow cannot be transferred to an exception dispatch block in the middle of a block, and
- * b) that every block has at most one exception dispatch block (which is always the last entry in the successor list).
- * <br>
- * If a bytecode is covered by multiple exception handlers, a chain of exception dispatch blocks is created so that
- * multiple exception handler types can be checked. The chains are re-used if multiple bytecodes are covered by the same
- * exception handlers.
- * <br>
- * Note that exception unwinds, i.e., bytecodes that can throw an exception but the exception is not handled in this method,
- * do not end a basic block. Not modeling the exception unwind block reduces the complexity of the CFG, and there is no
- * algorithm yet where the exception unwind block would matter.
- * <br>
- * The class also handles subroutines (jsr and ret bytecodes): subroutines are inlined by duplicating the subroutine blocks.
- * This is limited to simple, structured subroutines with a maximum subroutine nesting of 4. Otherwise, a bailout is thrown.
- * <br>
- * Loops in the methods are detected. If a method contains an irreducible loop (a loop with more than one entry), a bailout is
- * thrown. This simplifies the compiler later on since only structured loops need to be supported.
- * <br>
- * A data flow analysis computes the live local variables from the point of view of the interpreter. The result is used later
- * to prune frame states, i.e., remove local variable entries that are guaranteed to be never used again (even in the case of
- * deoptimization).
- * <br>
- * The algorithms and analysis in this class are conservative and do not use any assumptions or profiling information.
+ * Builds a mapping between bytecodes and basic blocks and builds a conservative control flow graph
+ * (CFG). It makes one linear passes over the bytecodes to build the CFG where it detects block
+ * headers and connects them.
+ * <p>
+ * It also creates exception dispatch blocks for exception handling. These blocks are between a
+ * bytecode that might throw an exception, and the actual exception handler entries, and are later
+ * used to create the type checks with the exception handler catch types. If a bytecode is covered
+ * by an exception handler, this bytecode ends the basic block. This guarantees that a) control flow
+ * cannot be transferred to an exception dispatch block in the middle of a block, and b) that every
+ * block has at most one exception dispatch block (which is always the last entry in the successor
+ * list).
+ * <p>
+ * If a bytecode is covered by multiple exception handlers, a chain of exception dispatch blocks is
+ * created so that multiple exception handler types can be checked. The chains are re-used if
+ * multiple bytecodes are covered by the same exception handlers.
+ * <p>
+ * Note that exception unwinds, i.e., bytecodes that can throw an exception but the exception is not
+ * handled in this method, do not end a basic block. Not modeling the exception unwind block reduces
+ * the complexity of the CFG, and there is no algorithm yet where the exception unwind block would
+ * matter.
+ * <p>
+ * The class also handles subroutines (jsr and ret bytecodes): subroutines are inlined by
+ * duplicating the subroutine blocks. This is limited to simple, structured subroutines with a
+ * maximum subroutine nesting of 4. Otherwise, a bailout is thrown.
+ * <p>
+ * Loops in the methods are detected. If a method contains an irreducible loop (a loop with more
+ * than one entry), a bailout is thrown. This simplifies the compiler later on since only structured
+ * loops need to be supported.
+ * <p>
+ * A data flow analysis computes the live local variables from the point of view of the interpreter.
+ * The result is used later to prune frame states, i.e., remove local variable entries that are
+ * guaranteed to be never used again (even in the case of deoptimization).
+ * <p>
+ * The algorithms and analysis in this class are conservative and do not use any assumptions or
+ * profiling information.
  */
 public final class BciBlockMapping {
 
     public static class Block implements Cloneable {
+
         public int startBci;
         public int endBci;
         public boolean isExceptionEntry;
@@ -103,7 +111,7 @@
         }
 
         public int numNormalSuccessors() {
-            if  (exceptionDispatchBlock() != null) {
+            if (exceptionDispatchBlock() != null) {
                 return successors.size() - 1;
             }
             return successors.size();
@@ -138,6 +146,7 @@
     }
 
     public static class ExceptionDispatchBlock extends Block {
+
         private HashMap<ExceptionHandler, ExceptionDispatchBlock> exceptionDispatch = new HashMap<>();
 
         public ExceptionHandler handler;
@@ -159,6 +168,7 @@
 
     /**
      * Creates a new BlockMap instance from bytecode of the given method .
+     * 
      * @param method the compiler interface method containing the code
      */
     public BciBlockMapping(ResolvedJavaMethod method) {
@@ -201,6 +211,7 @@
         }
         if (GraalOptions.OptLivenessAnalysis) {
             Debug.scope("LivenessAnalysis", new Runnable() {
+
                 @Override
                 public void run() {
                     computeLiveness();
@@ -478,7 +489,6 @@
         }
     }
 
-
     private HashMap<ExceptionHandler, ExceptionDispatchBlock> initialExceptionDispatch = new HashMap<>();
 
     private ExceptionDispatchBlock handleExceptions(int bci) {
@@ -488,7 +498,8 @@
             ExceptionHandler h = exceptionHandlers[i];
             if (h.getStartBCI() <= bci && bci < h.getEndBCI()) {
                 if (h.isCatchAll()) {
-                    // Discard all information about succeeding exception handlers, since they can never be reached.
+                    // Discard all information about succeeding exception handlers, since they can
+                    // never be reached.
                     lastHandler = null;
                 }
 
@@ -524,9 +535,11 @@
             long loop = fixLoopBits(blockMap[0]);
 
             if (loop != 0) {
-                // There is a path from a loop end to the method entry that does not pass the loop header.
+                // There is a path from a loop end to the method entry that does not pass the loop
+                // header.
                 // Therefore, the loop is non reducible (has more than one entry).
-                // We don't want to compile such methods because the IR only supports structured loops.
+                // We don't want to compile such methods because the IR only supports structured
+                // loops.
                 throw new BailoutException("Non-reducible loop: %016x", loop);
             }
         } while (loopChanges);
@@ -536,7 +549,8 @@
         long loop = computeBlockOrder(blockMap[0]);
 
         if (loop != 0) {
-            // There is a path from a loop end to the method entry that does not pass the loop header.
+            // There is a path from a loop end to the method entry that does not pass the loop
+            // header.
             // Therefore, the loop is non reducible (has more than one entry).
             // We don't want to compile such methods because the IR only supports structured loops.
             throw new BailoutException("Non-reducible loop");
@@ -610,21 +624,25 @@
     private int nextLoop;
 
     /**
-     * Mark the block as a loop header, using the next available loop number.
-     * Also checks for corner cases that we don't want to compile.
+     * Mark the block as a loop header, using the next available loop number. Also checks for corner
+     * cases that we don't want to compile.
      */
     private void makeLoopHeader(Block block) {
         if (!block.isLoopHeader) {
             block.isLoopHeader = true;
 
             if (block.isExceptionEntry) {
-                // Loops that are implicitly formed by an exception handler lead to all sorts of corner cases.
-                // Don't compile such methods for now, until we see a concrete case that allows checking for correctness.
+                // Loops that are implicitly formed by an exception handler lead to all sorts of
+                // corner cases.
+                // Don't compile such methods for now, until we see a concrete case that allows
+                // checking for correctness.
                 throw new BailoutException("Loop formed by an exception handler");
             }
             if (nextLoop >= Long.SIZE) {
-                // This restriction can be removed by using a fall-back to a BitSet in case we have more than 64 loops
-                // Don't compile such methods for now, until we see a concrete case that allows checking for correctness.
+                // This restriction can be removed by using a fall-back to a BitSet in case we have
+                // more than 64 loops
+                // Don't compile such methods for now, until we see a concrete case that allows
+                // checking for correctness.
                 throw new BailoutException("Too many loops in method");
             }
 
@@ -639,9 +657,9 @@
     }
 
     /**
-     * Depth-first traversal of the control flow graph. The flag {@linkplain Block#visited} is used to
-     * visit every block only once. The flag {@linkplain Block#active} is used to detect cycles (backward
-     * edges).
+     * Depth-first traversal of the control flow graph. The flag {@linkplain Block#visited} is used
+     * to visit every block only once. The flag {@linkplain Block#active} is used to detect cycles
+     * (backward edges).
      */
     private long computeBlockOrder(Block block) {
         if (block.visited) {
@@ -723,7 +741,8 @@
             changed = false;
             for (int i = blocks.size() - 1; i >= 0; i--) {
                 Block block = blocks.get(i);
-                Debug.log("  start B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, block.localsLiveKill);
+                Debug.log("  start B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen,
+                                block.localsLiveKill);
 
                 boolean blockChanged = (iteration == 0);
                 if (block.successors.size() > 0) {
@@ -740,7 +759,8 @@
                     block.localsLiveIn.or(block.localsLiveOut);
                     block.localsLiveIn.xor(block.localsLiveKill);
                     block.localsLiveIn.or(block.localsLiveGen);
-                    Debug.log("  end   B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, block.localsLiveKill);
+                    Debug.log("  end   B%d  [%d, %d]  in: %s  out: %s  gen: %s  kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen,
+                                    block.localsLiveKill);
                 }
                 changed |= blockChanged;
             }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -47,7 +47,7 @@
 
     /**
      * Disassembles the bytecode of a given method in a {@code javap}-like format.
-     *
+     * 
      * @return {@code null} if {@code method} has no bytecode (e.g., it is native or abstract)
      */
     public String disassemble(ResolvedJavaMethod method) {
@@ -63,6 +63,7 @@
             String mnemonic = Bytecodes.nameOf(opcode);
             buf.append(String.format("%4d: %-14s", bci, mnemonic));
             if (stream.nextBCI() > bci + 1) {
+                // @formatter:off
                 switch (opcode) {
                     case BIPUSH         : buf.append(stream.readByte()); break;
                     case SIPUSH         : buf.append(stream.readShort()); break;
@@ -221,6 +222,7 @@
                         break;
                     }
                 }
+                // @formatter:on
             }
             buf.append(String.format("%n"));
             stream.next();
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java	Fri Feb 01 17:06:26 2013 +0100
@@ -207,7 +207,8 @@
         if (node.isDeleted()) {
             return;
         }
-        // Collect all phi functions that use this phi so that we can delete them recursively (after we delete ourselves to avoid circles).
+        // Collect all phi functions that use this phi so that we can delete them recursively (after
+        // we delete ourselves to avoid circles).
         List<FloatingNode> propagateUsages = node.usages().filter(FloatingNode.class).filter(isA(PhiNode.class).or(ValueProxyNode.class)).snapshot();
 
         // Remove the phi function from all FrameStates where it is used and then delete it.
@@ -316,10 +317,9 @@
         rethrowException = b;
     }
 
-
     /**
      * Returns the size of the local variables.
-     *
+     * 
      * @return the size of the local variables
      */
     public int localsSize() {
@@ -335,7 +335,7 @@
 
     /**
      * Gets the value in the local variables at the specified index, without any sanity checking.
-     *
+     * 
      * @param i the index into the locals
      * @return the instruction that produced the value for the specified local
      */
@@ -345,7 +345,7 @@
 
     /**
      * Get the value on the stack at the specified stack index.
-     *
+     * 
      * @param i the index into the stack, with {@code 0} being the bottom of the stack
      * @return the instruction at the specified position in the stack
      */
@@ -355,7 +355,7 @@
 
     /**
      * Adds a locked monitor to this frame state.
-     *
+     * 
      * @param object the object whose monitor will be locked.
      */
     public void pushLock(ValueNode object) {
@@ -365,7 +365,7 @@
 
     /**
      * Removes a locked monitor from this frame state.
-     *
+     * 
      * @return the object whose monitor was removed from the locks list.
      */
     public ValueNode popLock() {
@@ -386,7 +386,7 @@
     /**
      * Loads the local variable at the specified index, checking that the returned value is non-null
      * and that two-stack values are properly handled.
-     *
+     * 
      * @param i the index of the local variable to load
      * @return the instruction that produced the specified local
      */
@@ -399,9 +399,10 @@
     }
 
     /**
-     * Stores a given local variable at the specified index. If the value occupies {@linkplain FrameStateBuilder#isTwoSlot(Kind) two slots},
-     * then the next local variable index is also overwritten.
-     *
+     * Stores a given local variable at the specified index. If the value occupies
+     * {@linkplain FrameStateBuilder#isTwoSlot(Kind) two slots}, then the next local variable index
+     * is also overwritten.
+     * 
      * @param i the index at which to store
      * @param x the instruction which produces the value for the local
      */
@@ -428,6 +429,7 @@
 
     /**
      * Pushes an instruction onto the stack with the expected type.
+     * 
      * @param kind the type expected for this instruction
      * @param x the instruction to push onto the stack
      */
@@ -441,6 +443,7 @@
 
     /**
      * Pushes a value onto the stack without checking the type.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void xpush(ValueNode x) {
@@ -450,6 +453,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is an int.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void ipush(ValueNode x) {
@@ -458,6 +462,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is a float.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void fpush(ValueNode x) {
@@ -466,6 +471,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is an object.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void apush(ValueNode x) {
@@ -474,6 +480,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is a JSR return address.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void jpush(ValueNode x) {
@@ -482,7 +489,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is a long.
-     *
+     * 
      * @param x the instruction to push onto the stack
      */
     public void lpush(ValueNode x) {
@@ -492,6 +499,7 @@
 
     /**
      * Pushes a value onto the stack and checks that it is a double.
+     * 
      * @param x the instruction to push onto the stack
      */
     public void dpush(ValueNode x) {
@@ -507,6 +515,7 @@
 
     /**
      * Pops an instruction off the stack with the expected type.
+     * 
      * @param kind the expected type
      * @return the instruction on the top of the stack
      */
@@ -520,6 +529,7 @@
 
     /**
      * Pops a value off of the stack without checking the type.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode xpop() {
@@ -530,6 +540,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is an int.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode ipop() {
@@ -538,6 +549,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is a float.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode fpop() {
@@ -546,6 +558,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is an object.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode apop() {
@@ -554,6 +567,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is a JSR return address.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode jpop() {
@@ -562,6 +576,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is a long.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode lpop() {
@@ -571,6 +586,7 @@
 
     /**
      * Pops a value off of the stack and checks that it is a double.
+     * 
      * @return x the instruction popped off the stack
      */
     public ValueNode dpop() {
@@ -579,7 +595,9 @@
     }
 
     /**
-     * Pop the specified number of slots off of this stack and return them as an array of instructions.
+     * Pop the specified number of slots off of this stack and return them as an array of
+     * instructions.
+     * 
      * @return an array containing the arguments off of the stack
      */
     public ValueNode[] popArguments(int slotSize, int argSize) {
@@ -599,8 +617,10 @@
 
     /**
      * Peeks an element from the operand stack.
-     * @param argumentNumber The number of the argument, relative from the top of the stack (0 = top).
-     *        Long and double arguments only count as one argument, i.e., null-slots are ignored.
+     * 
+     * @param argumentNumber The number of the argument, relative from the top of the stack (0 =
+     *            top). Long and double arguments only count as one argument, i.e., null-slots are
+     *            ignored.
      * @return The peeked argument.
      */
     public ValueNode peek(int argumentNumber) {
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -54,9 +54,11 @@
  */
 public final class GraphBuilderPhase extends Phase {
 
-    public static final Descriptor CREATE_NULL_POINTER_EXCEPTION = new Descriptor("createNullPointerException", true, Object.class);
-    public static final Descriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new Descriptor("createOutOfBoundsException", true, Object.class, int.class);
+    public static final class RuntimeCalls {
 
+        public static final Descriptor CREATE_NULL_POINTER_EXCEPTION = new Descriptor("createNullPointerException", true, Object.class);
+        public static final Descriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new Descriptor("createOutOfBoundsException", true, Object.class, int.class);
+    }
 
     /**
      * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace
@@ -95,12 +97,18 @@
     private long graphId;
 
     /**
-     * Node that marks the begin of block during bytecode parsing.  When a block is identified the first
-     * time as a jump target, the placeholder is created and used as the successor for the jump.  When the
-     * block is seen the second time, a MergeNode is created to correctly merge the now two different
-     * predecessor states.
+     * Meters the number of actual bytecodes parsed.
+     */
+    public static final DebugMetric BytecodesParsed = Debug.metric("BytecodesParsed");
+
+    /**
+     * Node that marks the begin of block during bytecode parsing. When a block is identified the
+     * first time as a jump target, the placeholder is created and used as the successor for the
+     * jump. When the block is seen the second time, a MergeNode is created to correctly merge the
+     * now two different predecessor states.
      */
     private static class BlockPlaceholderNode extends FixedWithNextNode implements Node.IterableNodeType {
+
         public BlockPlaceholderNode() {
             super(StampFactory.forVoid());
         }
@@ -177,8 +185,10 @@
         currentBlock = blockMap.startBlock;
         blockMap.startBlock.entryState = frameState;
         if (blockMap.startBlock.isLoopHeader) {
-            // TODO(lstadler,gduboscq) createTarget might not be safe at this position, since it expects currentBlock,
-            // etc. to be set up correctly. A better solution to this problem of start blocks that are loop headers
+            // TODO(lstadler,gduboscq) createTarget might not be safe at this position, since it
+            // expects currentBlock,
+            // etc. to be set up correctly. A better solution to this problem of start blocks that
+            // are loop headers
             // would be to create a dummy block in BciBlockMapping.
             appendGoto(createTarget(blockMap.startBlock, frameState));
         } else {
@@ -258,7 +268,8 @@
         Debug.log("Creating exception dispatch edges at %d, exception object=%s, exception seen=%s", bci, exceptionObject, profilingInfo.getExceptionSeen(bci));
 
         Block dispatchBlock = currentBlock.exceptionDispatchBlock();
-        // The exception dispatch block is always for the last bytecode of a block, so if we are not at the endBci yet,
+        // The exception dispatch block is always for the last bytecode of a block, so if we are not
+        // at the endBci yet,
         // there is no exception handler for this bci and we can unwind immediately.
         if (bci != currentBlock.endBci || dispatchBlock == null) {
             dispatchBlock = unwindBlock(bci);
@@ -414,23 +425,39 @@
         ValueNode x = frameState.pop(result);
         boolean isStrictFP = isStrict(method.getModifiers());
         ArithmeticNode v;
-        switch(opcode){
+        switch (opcode) {
             case IADD:
-            case LADD: v = new IntegerAddNode(result, x, y); break;
+            case LADD:
+                v = new IntegerAddNode(result, x, y);
+                break;
             case FADD:
-            case DADD: v = new FloatAddNode(result, x, y, isStrictFP); break;
+            case DADD:
+                v = new FloatAddNode(result, x, y, isStrictFP);
+                break;
             case ISUB:
-            case LSUB: v = new IntegerSubNode(result, x, y); break;
+            case LSUB:
+                v = new IntegerSubNode(result, x, y);
+                break;
             case FSUB:
-            case DSUB: v = new FloatSubNode(result, x, y, isStrictFP); break;
+            case DSUB:
+                v = new FloatSubNode(result, x, y, isStrictFP);
+                break;
             case IMUL:
-            case LMUL: v = new IntegerMulNode(result, x, y); break;
+            case LMUL:
+                v = new IntegerMulNode(result, x, y);
+                break;
             case FMUL:
-            case DMUL: v = new FloatMulNode(result, x, y, isStrictFP); break;
+            case DMUL:
+                v = new FloatMulNode(result, x, y, isStrictFP);
+                break;
             case FDIV:
-            case DDIV: v = new FloatDivNode(result, x, y, isStrictFP); break;
+            case DDIV:
+                v = new FloatDivNode(result, x, y, isStrictFP);
+                break;
             case FREM:
-            case DREM: v = new FloatRemNode(result, x, y, isStrictFP); break;
+            case DREM:
+                v = new FloatRemNode(result, x, y, isStrictFP);
+                break;
             default:
                 throw new GraalInternalError("should not reach");
         }
@@ -442,11 +469,15 @@
         ValueNode y = frameState.pop(result);
         ValueNode x = frameState.pop(result);
         FixedWithNextNode v;
-        switch(opcode){
+        switch (opcode) {
             case IDIV:
-            case LDIV: v = new IntegerDivNode(result, x, y); break;
+            case LDIV:
+                v = new IntegerDivNode(result, x, y);
+                break;
             case IREM:
-            case LREM: v = new IntegerRemNode(result, x, y); break;
+            case LREM:
+                v = new IntegerRemNode(result, x, y);
+                break;
             default:
                 throw new GraalInternalError("should not reach");
         }
@@ -462,13 +493,19 @@
         ValueNode s = frameState.ipop();
         ValueNode x = frameState.pop(kind);
         ShiftNode v;
-        switch(opcode){
+        switch (opcode) {
             case ISHL:
-            case LSHL: v = new LeftShiftNode(kind, x, s); break;
+            case LSHL:
+                v = new LeftShiftNode(kind, x, s);
+                break;
             case ISHR:
-            case LSHR: v = new RightShiftNode(kind, x, s); break;
+            case LSHR:
+                v = new RightShiftNode(kind, x, s);
+                break;
             case IUSHR:
-            case LUSHR: v = new UnsignedRightShiftNode(kind, x, s); break;
+            case LUSHR:
+                v = new UnsignedRightShiftNode(kind, x, s);
+                break;
             default:
                 throw new GraalInternalError("should not reach");
         }
@@ -479,13 +516,19 @@
         ValueNode y = frameState.pop(kind);
         ValueNode x = frameState.pop(kind);
         LogicNode v;
-        switch(opcode){
+        switch (opcode) {
             case IAND:
-            case LAND: v = new AndNode(kind, x, y); break;
+            case LAND:
+                v = new AndNode(kind, x, y);
+                break;
             case IOR:
-            case LOR: v = new OrNode(kind, x, y); break;
+            case LOR:
+                v = new OrNode(kind, x, y);
+                break;
             case IXOR:
-            case LXOR: v = new XorNode(kind, x, y); break;
+            case LXOR:
+                v = new XorNode(kind, x, y);
+                break;
             default:
                 throw new GraalInternalError("should not reach");
         }
@@ -586,7 +629,8 @@
 
     private void genThrow() {
         ValueNode exception = frameState.apop();
-        FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true, graphId));
+        FixedGuardNode node = currentGraph.add(new FixedGuardNode(currentGraph.unique(new IsNullNode(exception)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile,
+                        true, graphId));
         append(node);
         append(handleException(exception, bci()));
     }
@@ -619,11 +663,11 @@
         return result;
     }
 
-//    private void eagerResolving(int cpi, int bytecode) {
-//        if (graphBuilderConfig.eagerResolving()) {
-//            constantPool.loadReferencedType(cpi, bytecode);
-//        }
-//    }
+    // private void eagerResolving(int cpi, int bytecode) {
+    // if (graphBuilderConfig.eagerResolving()) {
+    // constantPool.loadReferencedType(cpi, bytecode);
+    // }
+    // }
 
     private void eagerResolvingForSnippets(int cpi, int bytecode) {
         if (graphBuilderConfig.eagerResolvingForSnippets()) {
@@ -690,29 +734,39 @@
     }
 
     /**
-     * Gets the kind of array elements for the array type code that appears
-     * in a {@link Bytecodes#NEWARRAY} bytecode.
+     * Gets the kind of array elements for the array type code that appears in a
+     * {@link Bytecodes#NEWARRAY} bytecode.
+     * 
      * @param code the array type code
      * @return the kind from the array type code
      */
-    public static Class< ? > arrayTypeCodeToClass(int code) {
+    public static Class<?> arrayTypeCodeToClass(int code) {
         // Checkstyle: stop
         switch (code) {
-            case 4:  return boolean.class;
-            case 5:  return char.class;
-            case 6:  return float.class;
-            case 7:  return double.class;
-            case 8:  return byte.class;
-            case 9:  return short.class;
-            case 10: return int.class;
-            case 11: return long.class;
-            default: throw new IllegalArgumentException("unknown array type code: " + code);
+            case 4:
+                return boolean.class;
+            case 5:
+                return char.class;
+            case 6:
+                return float.class;
+            case 7:
+                return double.class;
+            case 8:
+                return byte.class;
+            case 9:
+                return short.class;
+            case 10:
+                return int.class;
+            case 11:
+                return long.class;
+            default:
+                throw new IllegalArgumentException("unknown array type code: " + code);
         }
         // Checkstyle: resume
     }
 
     private void genNewPrimitiveArray(int typeCode) {
-        Class< ? > clazz = arrayTypeCodeToClass(typeCode);
+        Class<?> clazz = arrayTypeCodeToClass(typeCode);
         ResolvedJavaType elementType = runtime.lookupJavaType(clazz);
         NewPrimitiveArrayNode nta = currentGraph.add(new NewPrimitiveArrayNode(elementType, frameState.ipop(), true, false));
         frameState.apush(append(nta));
@@ -787,7 +841,7 @@
             ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph);
             trueSucc.setNext(handleException(exception, bci()));
         } else {
-            RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CREATE_NULL_POINTER_EXCEPTION));
+            RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(RuntimeCalls.CREATE_NULL_POINTER_EXCEPTION));
             call.setStateAfter(frameState.create(bci()));
             trueSucc.setNext(call);
             call.setNext(handleException(call, bci()));
@@ -801,7 +855,6 @@
         cachedNullPointerException.setStackTrace(new StackTraceElement[0]);
     }
 
-
     private void emitBoundsCheck(ValueNode index, ValueNode length) {
         BlockPlaceholderNode trueSucc = currentGraph.add(new BlockPlaceholderNode());
         BlockPlaceholderNode falseSucc = currentGraph.add(new BlockPlaceholderNode());
@@ -814,7 +867,7 @@
             ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph);
             falseSucc.setNext(handleException(exception, bci()));
         } else {
-            RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CREATE_OUT_OF_BOUNDS_EXCEPTION, index));
+            RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(RuntimeCalls.CREATE_OUT_OF_BOUNDS_EXCEPTION, index));
             call.setStateAfter(frameState.create(bci()));
             falseSucc.setNext(call);
             call.setNext(handleException(call, bci()));
@@ -991,7 +1044,8 @@
             returnType = returnType.resolve(targetMethod.getDeclaringClass());
         }
         MethodCallTargetNode callTarget = currentGraph.add(new MethodCallTargetNode(invokeKind, targetMethod, args, returnType));
-        // be conservative if information was not recorded (could result in endless recompiles otherwise)
+        // be conservative if information was not recorded (could result in endless recompiles
+        // otherwise)
         if (optimisticOpts.useExceptionProbability() && profilingInfo.getExceptionSeen(bci()) == ExceptionSeen.FALSE) {
             ValueNode result = appendWithBCI(currentGraph.add(new InvokeNode(callTarget, bci(), graphId)));
             frameState.pushReturn(resultType, result);
@@ -1060,7 +1114,8 @@
         ValueNode local = frameState.loadLocal(localIndex);
         JsrScope scope = currentBlock.jsrScope;
         int retAddress = scope.nextReturnAddress();
-        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), DeoptimizationReason.JavaSubroutineMismatch, DeoptimizationAction.InvalidateReprofile, graphId)));
+        append(currentGraph.add(new FixedGuardNode(currentGraph.unique(new IntegerEqualsNode(local, ConstantNode.forJsr(retAddress, currentGraph))), DeoptimizationReason.JavaSubroutineMismatch,
+                        DeoptimizationAction.InvalidateReprofile, graphId)));
         if (!successor.jsrScope.equals(scope.pop())) {
             throw new JsrNotSupportedBailout("unstructured control flow (ret leaves more than one scope)");
         }
@@ -1143,6 +1198,7 @@
     }
 
     private static class SuccessorInfo {
+
         int blockIndex;
         int actualIndex;
 
@@ -1180,8 +1236,10 @@
     }
 
     private static class Target {
+
         FixedNode fixed;
         FrameStateBuilder state;
+
         public Target(FixedNode fixed, FrameStateBuilder state) {
             this.fixed = fixed;
             this.state = state;
@@ -1207,6 +1265,7 @@
                 } while (exits != 0);
 
                 Collections.sort(exitLoops, new Comparator<Block>() {
+
                     @Override
                     public int compare(Block o1, Block o2) {
                         return Long.bitCount(o2.loops) - Long.bitCount(o1.loops);
@@ -1260,7 +1319,8 @@
 
         if (block.firstInstruction == null) {
             // This is the first time we see this block as a branch target.
-            // Create and return a placeholder that later can be replaced with a MergeNode when we see this block again.
+            // Create and return a placeholder that later can be replaced with a MergeNode when we
+            // see this block again.
             block.firstInstruction = currentGraph.add(new BlockPlaceholderNode());
             Target target = checkLoopExit(block.firstInstruction, block, state);
             FixedNode result = target.fixed;
@@ -1278,7 +1338,8 @@
 
         if (block.firstInstruction instanceof LoopBeginNode) {
             assert block.isLoopHeader && currentBlock.blockID >= block.blockID : "must be backward branch";
-            // Backward loop edge. We need to create a special LoopEndNode and merge with the loop begin node created before.
+            // Backward loop edge. We need to create a special LoopEndNode and merge with the loop
+            // begin node created before.
             LoopBeginNode loopBegin = (LoopBeginNode) block.firstInstruction;
             Target target = checkLoopExit(currentGraph.add(new LoopEndNode(loopBegin)), block, state);
             FixedNode result = target.fixed;
@@ -1291,14 +1352,16 @@
         assert block.firstInstruction.next() == null : "bytecodes already parsed for block";
 
         if (block.firstInstruction instanceof BlockPlaceholderNode) {
-            // This is the second time we see this block. Create the actual MergeNode and the End Node for the already existing edge.
-            // For simplicity, we leave the placeholder in the graph and just append the new nodes after the placeholder.
+            // This is the second time we see this block. Create the actual MergeNode and the End
+            // Node for the already existing edge.
+            // For simplicity, we leave the placeholder in the graph and just append the new nodes
+            // after the placeholder.
             BlockPlaceholderNode placeholder = (BlockPlaceholderNode) block.firstInstruction;
 
             // The EndNode for the already existing edge.
             EndNode end = currentGraph.add(new EndNode());
             // The MergeNode that replaces the placeholder.
-            MergeNode mergeNode  = currentGraph.add(new MergeNode());
+            MergeNode mergeNode = currentGraph.add(new MergeNode());
             FixedNode next = placeholder.next();
 
             placeholder.setNext(end);
@@ -1322,15 +1385,15 @@
     }
 
     /**
-     * Returns a block begin node with the specified state.  If the specified probability is 0, the block
-     * deoptimizes immediately.
+     * Returns a block begin node with the specified state. If the specified probability is 0, the
+     * block deoptimizes immediately.
      */
     private BeginNode createBlockTarget(double probability, Block block, FrameStateBuilder stateAfter) {
         FixedNode target = createTarget(probability, block, stateAfter);
         BeginNode begin = BeginNode.begin(target);
 
-        assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) :
-            "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize to a bci _before_ the actual if, so that the interpreter can update the profiling information.";
+        assert !(target instanceof DeoptimizeNode && begin.stateAfter() != null) : "We are not allowed to set the stateAfter of the begin node, because we have to deoptimize "
+                        + "to a bci _before_ the actual if, so that the interpreter can update the profiling information.";
         return begin;
     }
 
@@ -1380,6 +1443,7 @@
     private void connectLoopEndToBegin() {
         for (LoopBeginNode begin : currentGraph.getNodes(LoopBeginNode.class)) {
             if (begin.loopEnds().isEmpty()) {
+                // @formatter:off
                 // Remove loop header without loop ends.
                 // This can happen with degenerated loops like this one:
                 // for (;;) {
@@ -1388,6 +1452,7 @@
                 //     } catch (UnresolvedException iioe) {
                 //     }
                 // }
+                // @formatter:on
                 assert begin.forwardEndCount() == 1;
                 currentGraph.reduceDegenerateLoopBegin(begin);
             } else {
@@ -1499,7 +1564,8 @@
 
     private void iterateBytecodesForBlock(Block block) {
         if (block.isLoopHeader) {
-            // Create the loop header block, which later will merge the backward branches of the loop.
+            // Create the loop header block, which later will merge the backward branches of the
+            // loop.
             EndNode preLoopEnd = currentGraph.add(new EndNode());
             LoopBeginNode loopBegin = currentGraph.add(new LoopBeginNode());
             lastInstr.setNext(preLoopEnd);
@@ -1511,10 +1577,12 @@
             frameState.insertLoopPhis(loopBegin);
             loopBegin.setStateAfter(frameState.create(block.startBci));
 
-            // We have seen all forward branches. All subsequent backward branches will merge to the loop header.
+            // We have seen all forward branches. All subsequent backward branches will merge to the
+            // loop header.
             // This ensures that the loop header has exactly one non-loop predecessor.
             block.firstInstruction = loopBegin;
-            // We need to preserve the frame state builder of the loop header so that we can merge values for
+            // We need to preserve the frame state builder of the loop header so that we can merge
+            // values for
             // phi functions, so make a copy of it.
             block.entryState = frameState.copy();
 
@@ -1527,6 +1595,8 @@
 
         stream.setBCI(block.startBci);
         int bci = block.startBci;
+        BytecodesParsed.add(block.endBci - bci);
+
         while (bci < endBCI) {
             // read the opcode
             int opcode = stream.currentBC();
@@ -1590,6 +1660,7 @@
         int cpi;
 
         // Checkstyle: stop
+        // @formatter:off
         switch (opcode) {
             case NOP            : /* nothing to do */ break;
             case ACONST_NULL    : frameState.apush(appendConstant(Constant.NULL_OBJECT)); break;
@@ -1796,6 +1867,7 @@
             default:
                 throw new BailoutException("Unsupported opcode " + opcode + " (" + nameOf(opcode) + ") [bci=" + bci + "]");
         }
+        // @formatter:on
         // Checkstyle: resume
     }
 
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/JsrNotSupportedBailout.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.api.code.*;
 
+public class JsrNotSupportedBailout extends BailoutException {
 
-public class JsrNotSupportedBailout extends BailoutException{
     private static final long serialVersionUID = -7476925652727154272L;
 
     public JsrNotSupportedBailout(String reason) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/ConvertJTT.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/ConvertJTT.java	Fri Feb 01 17:06:26 2013 +0100
@@ -135,7 +135,7 @@
                 }
                 output.add(line);
             } else {
-// line = line.replace(oldClassName, newClassName);
+                // line = line.replace(oldClassName, newClassName);
                 line = line.replace(" jtt.", " com.oracle.graal.jtt.");
                 output.add(line);
             }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/JTTTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,9 +37,9 @@
 /**
  * Base class for the JTT tests.
  * <p>
- * These tests are executed twice: once with arguments passed to the execution and
- * once with the arguments bound to the test's parameters during compilation.
- * The latter is a good test of canonicalization.
+ * These tests are executed twice: once with arguments passed to the execution and once with the
+ * arguments bound to the test's parameters during compilation. The latter is a good test of
+ * canonicalization.
  */
 public class JTTTest extends GraalCompilerTest {
 
@@ -89,7 +89,7 @@
     }
 
     protected void runTest(String name, Object... args) {
-        //System.out.println(getClass().getSimpleName() + "." + name);
+        // System.out.println(getClass().getSimpleName() + "." + name);
         super.test(name, args);
         this.argsToBind = args;
         super.test(name, args);
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_dneg2.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_dneg2.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,6 @@
  */
 public class BC_dneg2 extends JTTTest {
 
-// @NEVER_INLINE
     public static double test(double a) {
         return 1 / (-a);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,8 +35,8 @@
         return object.id(a);
     }
 
-        @SuppressWarnings("static-method")
-        private int id(int i) {
+    @SuppressWarnings("static-method")
+    private int id(int i) {
         return i;
     }
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial2.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_invokespecial2.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,8 +38,8 @@
         return 3 + object.id(a);
     }
 
-        @SuppressWarnings("static-method")
-        private int id(int i) {
+    @SuppressWarnings("static-method")
+    private int id(int i) {
         return 4 + i;
     }
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv2.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
 /*
  */
 public class BC_ldiv2 extends JTTTest {
+
     public static long MIN = Long.MIN_VALUE;
     public static long MAX = Long.MAX_VALUE;
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/bytecode/BC_ldiv3.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
 /*
  */
 public class BC_ldiv3 extends JTTTest {
+
     public static long PLUS7 = 7;
     public static long PLUS3 = 3;
     public static long MIN7 = -7;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Finally02.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Finally02.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,12 +39,10 @@
         return c();
     }
 
-// @NEVER_INLINE
     static int a() {
         return 0;
     }
 
-// @NEVER_INLINE
     static int b() {
         return -3;
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_idea.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,7 @@
 import com.oracle.graal.jtt.*;
 import org.junit.*;
 
-/*
- */
+//@formatter:off
 public class HP_idea extends JTTTest {
 
     public boolean test() {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_scope02.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_scope02.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,8 @@
         // by the guard bail-out.
         for (int i = 0; i < count; i++) {
             if (i > 20) {
-                break; // We need to write back either the original value of sum, or the previous iteration's value.
+                break; // We need to write back either the original value of sum, or the previous
+                       // iteration's value.
             }
             sum = i;
         }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_series.java	Fri Feb 01 17:06:26 2013 +0100
@@ -98,12 +98,13 @@
         return (0.0);
     }
 
-    /* This test is sensible to the implementation of Math.pow, cos and sin.
-     * Since for these functions, the specs says "The computed result must be within 1 ulp of the exact result",
-     * different implementation may return different results.
-     * The 11 ulp delta allowed for test(100) tries to account for that but is not guaranteed to work forever.
+    /*
+     * This test is sensible to the implementation of Math.pow, cos and sin. Since for these
+     * functions, the specs says "The computed result must be within 1 ulp of the exact result",
+     * different implementation may return different results. The 11 ulp delta allowed for test(100)
+     * tries to account for that but is not guaranteed to work forever.
      */
-    //@Test
+    // @Test
     public void run0() throws Throwable {
         double expected = 0.6248571921291398d;
         runTestWithDelta(11 * Math.ulp(expected), "test", 100);
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6186134.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6186134.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,6 +27,7 @@
 import com.oracle.graal.jtt.*;
 import org.junit.*;
 
+// @formatter:off
 public class Test6186134 extends JTTTest {
 
     public static class TestClass {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6196102.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,7 @@
  * 
  * @run main Test6196102
  */
-
+// @formatter:off
 public class Test6196102 extends JTTTest {
 
     public static String test() {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6753639.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,7 @@
  * 
  * @run main/othervm -Xbatch Test6753639
  */
-
+// @formatter:off
 public class Test6753639 extends JTTTest {
 
     public static int test() {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6823354.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6823354.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.jtt.hotspot;
 
+//@formatter:off
+
 /**
  * @test
  * @bug 6823354
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6850611.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6850611.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,11 +25,13 @@
 import com.oracle.graal.jtt.*;
 import org.junit.*;
 
+//@formatter:off
+
 /**
  * @test
  * @bug 6850611
  * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP)
- * 
+ *
  * @run main Test6850611
  */
 
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6959129.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6959129.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,8 @@
 
 import com.oracle.graal.jtt.*;
 
+//@formatter:off
+
 /**
  * @test
  * @bug 6959129
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test7005594.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test7005594.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,6 +22,8 @@
  */
 package com.oracle.graal.jtt.hotspot;
 
+//@formatter:off
+
 /**
  * @test
  * @bug 7005594
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/IntegerBits.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,10 +25,9 @@
 import com.oracle.graal.jtt.*;
 import org.junit.*;
 
+public class IntegerBits extends JTTTest {
 
-public class IntegerBits extends JTTTest {
-    @SuppressWarnings("unused")
-    private static int init = Integer.reverseBytes(42);
+    @SuppressWarnings("unused") private static int init = Integer.reverseBytes(42);
     private static int original = 0x01020304;
     private static int v = 0b1000;
     private static int zero = 0;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/LongBits.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/LongBits.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,10 +25,9 @@
 import com.oracle.graal.jtt.*;
 import org.junit.*;
 
+public class LongBits extends JTTTest {
 
-public class LongBits extends JTTTest {
-    @SuppressWarnings("unused")
-    private static long init = Long.reverseBytes(42);
+    @SuppressWarnings("unused") private static long init = Long.reverseBytes(42);
     private static long original = 0x0102030405060708L;
     private static long v = 0b1000L;
     private static long v2 = 0x0100000000L;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,6 @@
         return sum;
     }
 
-// @NEVER_INLINE
     private static void doPrint(int n) {
         for (int i = 0; i < n; i++) {
             System.out.print('x');
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/UnsafeAccess01.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,8 +33,7 @@
  */
 public class UnsafeAccess01 extends JTTTest {
 
-    @SuppressWarnings("unused")
-    private int field = 42;
+    @SuppressWarnings("unused") private int field = 42;
 
     public static int test() throws SecurityException, NoSuchFieldException {
         final Unsafe unsafe = getUnsafe();
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Unsafe_compareAndSwap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,12 +29,15 @@
 import sun.misc.*;
 
 public class Unsafe_compareAndSwap extends JTTTest {
+
     static final Unsafe unsafe = UnsafeAccess01.getUnsafe();
     static final long valueOffset;
     static {
         try {
             valueOffset = unsafe.objectFieldOffset(Unsafe_compareAndSwap.class.getDeclaredField("value"));
-        } catch (Exception ex) { throw new Error(ex); }
+        } catch (Exception ex) {
+            throw new Error(ex);
+        }
     }
 
     public static String test(Unsafe_compareAndSwap u, Object o, String expected, String newValue) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getInterfaces01.java	Fri Feb 01 17:06:26 2013 +0100
@@ -47,11 +47,11 @@
         }
     }
 
-    private static String toString(Class< ? > klass) {
-        final Class< ? >[] classes = klass.getInterfaces();
+    private static String toString(Class<?> klass) {
+        final Class<?>[] classes = klass.getInterfaces();
         final StringBuilder sb = new StringBuilder();
         boolean first = true;
-        for (Class< ? > c : classes) {
+        for (Class<?> c : classes) {
             if (!first) {
                 sb.append(' ');
             } else {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getModifiers01.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/lang/Class_getModifiers01.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,11 +29,14 @@
 
 public final class Class_getModifiers01 extends JTTTest {
 
-    private static class PrivateStatic {}
+    private static class PrivateStatic {
+    }
 
-    private static final class PrivateStaticFinal {}
+    private static final class PrivateStaticFinal {
+    }
 
-    private static class Private {}
+    private static class Private {
+    }
 
     public static int test(Class c) {
         return c.getModifiers();
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop16.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop16.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,7 +40,7 @@
     }
 
     public int run(int count) {
-    l1: for (int i = 0; i <= count; i++) {
+        l1: for (int i = 0; i <= count; i++) {
             if (i > 5) {
                 for (int j = 0; j < i; j++) {
                     a += i;
@@ -51,7 +51,7 @@
             } else if (i > 7) {
                 b += i;
             } else {
-                    c += i;
+                c += i;
             }
         }
         return a + b + c;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop17.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/Loop17.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,9 +32,11 @@
 public class Loop17 extends JTTTest {
 
     private static class L {
+
         public int a;
         public int b;
         public int c;
+
         public L(int a, int b, int c) {
             this.a = a;
             this.b = b;
@@ -42,12 +44,11 @@
         }
     }
 
-
     public static int test(int count) {
         int i = 0;
         L l;
         do {
-            l = new L(i, i+1, i+2);
+            l = new L(i, i + 1, i + 2);
         } while (++i < count);
 
         return l.a + l.b * 10 + l.c * 100;
@@ -55,6 +56,6 @@
 
     @Test
     public void run0() throws Throwable {
-        runTest("test", new L(4,4,4).a);
+        runTest("test", new L(4, 4, 4).a);
     }
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopEscape.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopEscape.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,12 +30,15 @@
  * Test around an object that escapes directly from inside a loop (no virtual phi on the loop)
  */
 public class LoopEscape extends JTTTest {
+
     public static L ll = new L(0, 1, 2);
 
     private static class L {
+
         public int a;
         public int b;
         public int c;
+
         public L(int a, int b, int c) {
             this.a = a;
             this.b = b;
@@ -43,7 +46,6 @@
         }
     }
 
-
     public static int test0(int count) {
         L l = new L(5, 5, 5);
         for (int i = 0; i < count; i++) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopLastIndexOf.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/loop/LoopLastIndexOf.java	Fri Feb 01 17:06:26 2013 +0100
@@ -95,7 +95,8 @@
         runTest("test", v1, 1, v1.length - 1, v3, 0, v3.length, 10);
     }
 
-    @Test//(expected = ArrayIndexOutOfBoundsException.class)
+    @Test
+    // (expected = ArrayIndexOutOfBoundsException.class)
     public void run4() throws Throwable {
         runTest("test", v1, 1, v1.length, v3, 0, v3.length, 10);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/FloatingReads.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/micro/FloatingReads.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,8 +24,8 @@
 
 import com.oracle.graal.jtt.*;
 
+public class FloatingReads extends JTTTest {
 
-public class FloatingReads extends JTTTest {
     public static long init = Runtime.getRuntime().totalMemory();
     private final int f = 10;
     private int a;
@@ -61,22 +61,22 @@
         return a + b + c;
     }
 
-    //@Test
+    // @Test
     public void run0() {
         runTest("test", 10);
     }
 
-    //@Test
+    // @Test
     public void run1() {
         runTest("test", 1000);
     }
 
-    //@Test
+    // @Test
     public void run2() {
         runTest("test", 1);
     }
 
-    //@Test
+    // @Test
     public void run3() {
         runTest("test", 0);
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Conditional01.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,6 +31,7 @@
  */
 @SuppressWarnings("unused")
 public class Conditional01 extends JTTTest {
+
     private static final int RAM_SIZE = 0x100;
     private static final int init = new Random().nextInt();
     private static final int init1 = new Register().val;
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Convert02.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Convert02.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
  * Tests constant folding of integer operations.
  */
 public class Fold_Convert02 extends JTTTest {
+
     public static long test(long arg) {
         if (arg == 0) {
             return i2l();
@@ -39,20 +40,24 @@
         if (arg == 2) {
             return d2l();
         }
-        return  0;
+        return 0;
     }
+
     public static long i2l() {
         int x = 0x80000000;
         return x;
     }
+
     public static long f2l() {
         float x = -33.1f;
         return (long) x;
     }
+
     public static long d2l() {
         double x = -78.1d;
         return (long) x;
     }
+
     @Test
     public void run0() throws Throwable {
         runTest("test", 0L);
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi01.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi01.java	Fri Feb 01 17:06:26 2013 +0100
@@ -42,7 +42,6 @@
         return test2(new Phi(arg), arg);
     }
 
-// @NEVER_INLINE
     private static int test2(Phi p, int a) {
         int arg = a;
         if (arg > 2) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi02.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi02.java	Fri Feb 01 17:06:26 2013 +0100
@@ -42,7 +42,6 @@
         return test2(new Phi(arg), arg);
     }
 
-// @NEVER_INLINE
     private static int test2(Phi p, int a) {
         int arg = a;
         if (arg > 2) {
@@ -69,7 +68,6 @@
         return arg + p.f;
     }
 
-// @NEVER_INLINE
     private static void inc(Phi p, int inc) {
         p.f += inc;
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi03.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Phi03.java	Fri Feb 01 17:06:26 2013 +0100
@@ -42,7 +42,6 @@
         return test2(new Phi(arg), arg);
     }
 
-// @NEVER_INLINE
     private static int test2(Phi p, int a) {
         int arg = a;
         if (arg > 2) {
@@ -69,7 +68,6 @@
         return p.f;
     }
 
-// @NEVER_INLINE
     private static void inc(Phi p, int inc) {
         p.f += inc;
     }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ReassociateConstants.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/ReassociateConstants.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,9 +24,10 @@
 
 import org.junit.*;
 
+public class ReassociateConstants {
 
-public class ReassociateConstants {
     public static int rnd = (int) (Math.random() * 100);
+
     @Test
     public void run0() throws Throwable {
         Assert.assertEquals(rnd + 3, 1 + (rnd + 2));
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance02.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance02.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,7 @@
 public class Array_newInstance02 extends JTTTest {
 
     public static boolean test(int i) {
-        Class< ? > javaClass;
+        Class<?> javaClass;
         if (i == 2) {
             javaClass = void.class;
         } else if (i == 3) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance03.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance03.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,7 @@
 public class Array_newInstance03 extends JTTTest {
 
     public static boolean test(int i) {
-        Class< ? > javaClass;
+        Class<?> javaClass;
         if (i == 2) {
             javaClass = int.class;
         } else if (i == 3) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance05.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance05.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 
     public static boolean test(int i, int j) {
         final int[] dims = {i, j};
-        Class< ? > javaClass;
+        Class<?> javaClass;
         if (i == 2) {
             javaClass = void.class;
         } else if (i == 3) {
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance06.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/reflect/Array_newInstance06.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 
     public static boolean test(int i) {
         final int[] dims = {i, 3};
-        Class< ? > javaClass;
+        Class<?> javaClass;
         if (i == 2) {
             javaClass = int.class;
         } else if (i == 3) {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Arithmetic.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.lir.*;
 import com.oracle.graal.lir.asm.*;
 
+// @formatter:off
 public enum AMD64Arithmetic {
     IADD, ISUB, IMUL, IDIV, IDIVREM, IREM, IUDIV, IUREM, IAND, IOR, IXOR, ISHL, ISHR, IUSHR,
     LADD, LSUB, LMUL, LDIV, LDIVREM, LREM, LUDIV, LUREM, LAND, LOR, LXOR, LSHL, LSHR, LUSHR,
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64BitManipulationOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,10 +28,9 @@
 import com.oracle.graal.lir.asm.*;
 
 public class AMD64BitManipulationOp extends AMD64LIRInstruction {
-    public enum IntrinsicOpcode  {
-        IPOPCNT, LPOPCNT,
-        IBSR, LBSR,
-        BSF;
+
+    public enum IntrinsicOpcode {
+        IPOPCNT, LPOPCNT, IBSR, LBSR, BSF;
     }
 
     @Opcode private final IntrinsicOpcode opcode;
@@ -49,7 +48,7 @@
         Register dst = ValueUtil.asIntReg(result);
         if (ValueUtil.isAddress(input)) {
             Address src = ValueUtil.asAddress(input);
-            switch(opcode) {
+            switch (opcode) {
                 case IPOPCNT:
                     masm.popcntl(dst, src);
                     break;
@@ -68,7 +67,7 @@
             }
         } else {
             Register src = ValueUtil.asRegister(input);
-            switch(opcode) {
+            switch (opcode) {
                 case IPOPCNT:
                     masm.popcntl(dst, src);
                     break;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ByteSwapOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
 
 @Opcode("BSWAP")
 public class AMD64ByteSwapOp extends AMD64LIRInstruction {
+
     @Def({OperandFlag.REG, OperandFlag.HINT}) protected Value result;
     @Use protected Value input;
 
@@ -41,7 +42,7 @@
     @Override
     public void emitCode(TargetMethodAssembler tasm, AMD64MacroAssembler masm) {
         AMD64Move.move(tasm, masm, result, input);
-        switch(input.getKind()) {
+        switch (input.getKind()) {
             case Int:
                 masm.bswapl(ValueUtil.asIntReg(result));
                 break;
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,6 +39,7 @@
 
     @Opcode("CALL_DIRECT")
     public static class DirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+
         @Def({REG, ILLEGAL}) protected Value result;
         @Use({REG, STACK}) protected Value[] parameters;
         @Temp protected Value[] temps;
@@ -71,6 +72,7 @@
 
     @Opcode("CALL_INDIRECT")
     public static class IndirectCallOp extends AMD64LIRInstruction implements StandardOp.CallOp {
+
         @Def({REG, ILLEGAL}) protected Value result;
         @Use({REG, STACK}) protected Value[] parameters;
         @Use({REG}) protected Value targetAddress;
@@ -109,7 +111,6 @@
                 // offset might not fit a 32-bit immediate, generate an
                 // indirect call with a 64-bit immediate
                 Register scratch = tasm.frameMap.registerConfig.getScratchRegister();
-                // TODO (cwimmer): we want to get rid of a generally reserved scratch register.
                 masm.movq(scratch, 0L);
                 masm.call(scratch);
             } else {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Code.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
  * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method.
  */
 public abstract class AMD64Code implements LIR.Code {
+
     @Override
     public final void emitCode(TargetMethodAssembler tasm) {
         emitCode(tasm, (AMD64MacroAssembler) tasm.asm);
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Compare.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.asm.*;
 
+// @formatter:off
 public enum AMD64Compare {
     ICMP, LCMP, ACMP, FCMP, DCMP;
 
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64ControlFlow.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,6 +40,7 @@
 import com.oracle.graal.lir.asm.*;
 import com.oracle.graal.nodes.calc.*;
 
+// @formatter:off
 public class AMD64ControlFlow {
 
     public static class ReturnOp extends AMD64LIRInstruction {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64LIRInstruction.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
  * Convenience class to provide AMD64MacroAssembler for the {@link #emitCode} method.
  */
 public abstract class AMD64LIRInstruction extends LIRInstruction {
+
     @Override
     public final void emitCode(TargetMethodAssembler tasm) {
         emitCode(tasm, (AMD64MacroAssembler) tasm.asm);
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64MathIntrinsicOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.lir.asm.*;
 
+// @formatter:off
 public class AMD64MathIntrinsicOp extends AMD64LIRInstruction {
     public enum IntrinsicOpcode  {
         SQRT,
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,6 +38,7 @@
 import com.oracle.graal.lir.StandardOp.MoveOp;
 import com.oracle.graal.lir.asm.*;
 
+// @formatter:off
 public class AMD64Move {
 
     @Opcode("MOVE")
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/ControlFlowOptimizer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -47,13 +47,12 @@
     /**
      * Checks whether a block can be deleted. Only blocks with exactly one successor and an
      * unconditional branch to this successor are eligable.
+     * 
      * @param block the block checked for deletion
      * @return whether the block can be deleted
      */
     private static boolean canDeleteBlock(LIR ir, Block block) {
-        if (block.numberOfSux() != 1 ||
-            block.numberOfPreds() == 0 ||
-            block.suxAt(0) == block) {
+        if (block.getSuccessorCount() != 1 || block.getPredecessorCount() == 0 || block.getFirstSuccessor() == block) {
             return false;
         }
 
@@ -62,7 +61,7 @@
         assert instructions.size() >= 2 : "block must have label and branch";
         assert instructions.get(0) instanceof StandardOp.LabelOp : "first instruction must always be a label";
         assert instructions.get(instructions.size() - 1) instanceof StandardOp.JumpOp : "last instruction must always be a branch";
-        assert ((StandardOp.JumpOp) instructions.get(instructions.size() - 1)).destination().label() == ((StandardOp.LabelOp) ir.lir(block.suxAt(0)).get(0)).getLabel() : "branch target must be the successor";
+        assert ((StandardOp.JumpOp) instructions.get(instructions.size() - 1)).destination().label() == ((StandardOp.LabelOp) ir.lir(block.getFirstSuccessor()).get(0)).getLabel() : "branch target must be the successor";
 
         // Block must have exactly one successor.
         return instructions.size() == 2 && !instructions.get(instructions.size() - 1).hasState();
@@ -75,11 +74,11 @@
             Block block = iterator.next();
             if (canDeleteBlock(ir, block)) {
                 // adjust successor and predecessor lists
-                Block other = block.suxAt(0);
+                Block other = block.getFirstSuccessor();
                 for (Block pred : block.getPredecessors()) {
                     Collections.replaceAll(pred.getSuccessors(), block, other);
                 }
-                for (int i = 0; i < other.getPredecessors().size(); i++) {
+                for (int i = 0; i < other.getPredecessorCount(); i++) {
                     if (other.getPredecessors().get(i) == block) {
                         other.getPredecessors().remove(i);
                         other.getPredecessors().addAll(i, block.getPredecessors());
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/EdgeMoveOptimizer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,23 +29,21 @@
 
 /**
  * This class optimizes moves, particularly those that result from eliminating SSA form.
- *
- * When a block has more than one predecessor, and all predecessors end with
- * the {@linkplain #same(LIRInstruction, LIRInstruction) same} sequence of
- * {@linkplain MoveOp move} instructions, then these sequences
- * can be replaced with a single copy of the sequence at the beginning of the block.
- *
- * Similarly, when a block has more than one successor, then same sequences of
- * moves at the beginning of the successors can be placed once at the end of
- * the block. But because the moves must be inserted before all branch
- * instructions, this works only when there is exactly one conditional branch
- * at the end of the block (because the moves must be inserted before all
+ * 
+ * When a block has more than one predecessor, and all predecessors end with the
+ * {@linkplain #same(LIRInstruction, LIRInstruction) same} sequence of {@linkplain MoveOp move}
+ * instructions, then these sequences can be replaced with a single copy of the sequence at the
+ * beginning of the block.
+ * 
+ * Similarly, when a block has more than one successor, then same sequences of moves at the
+ * beginning of the successors can be placed once at the end of the block. But because the moves
+ * must be inserted before all branch instructions, this works only when there is exactly one
+ * conditional branch at the end of the block (because the moves must be inserted before all
  * branches, but after all compares).
- *
- * This optimization affects all kind of moves (reg->reg, reg->stack and
- * stack->reg). Because this optimization works best when a block contains only
- * a few moves, it has a huge impact on the number of blocks that are totally
- * empty.
+ * 
+ * This optimization affects all kind of moves (reg->reg, reg->stack and stack->reg). Because this
+ * optimization works best when a block contains only a few moves, it has a huge impact on the
+ * number of blocks that are totally empty.
  */
 public final class EdgeMoveOptimizer {
 
@@ -60,10 +58,10 @@
         for (int i = blockList.size() - 1; i >= 1; i--) {
             Block block = blockList.get(i);
 
-            if (block.numberOfPreds() > 1) {
+            if (block.getPredecessorCount() > 1) {
                 optimizer.optimizeMovesAtBlockEnd(block);
             }
-            if (block.numberOfSux() == 2) {
+            if (block.getSuccessorCount() == 2) {
                 optimizer.optimizeMovesAtBlockBegin(block);
             }
         }
@@ -78,9 +76,10 @@
     }
 
     /**
-     * Determines if two operations are both {@linkplain MoveOp moves}
-     * that have the same {@linkplain MoveOp#getInput() source} and {@linkplain MoveOp#getResult() destination} operands.
-     *
+     * Determines if two operations are both {@linkplain MoveOp moves} that have the same
+     * {@linkplain MoveOp#getInput() source} and {@linkplain MoveOp#getResult() destination}
+     * operands.
+     * 
      * @param op1 the first instruction to compare
      * @param op2 the second instruction to compare
      * @return {@code true} if {@code op1} and {@code op2} are the same by the above algorithm
@@ -101,8 +100,8 @@
     }
 
     /**
-     * Moves the longest {@linkplain #same common} subsequence at the end all
-     * predecessors of {@code block} to the start of {@code block}.
+     * Moves the longest {@linkplain #same common} subsequence at the end all predecessors of
+     * {@code block} to the start of {@code block}.
      */
     private void optimizeMovesAtBlockEnd(Block block) {
         for (Block pred : block.getPredecessors()) {
@@ -115,7 +114,7 @@
         // clear all internal data structures
         edgeInstructionSeqences.clear();
 
-        int numPreds = block.numberOfPreds();
+        int numPreds = block.getPredecessorCount();
         assert numPreds > 1 : "do not call otherwise";
 
         // setup a list with the LIR instructions of all predecessors
@@ -124,13 +123,13 @@
             assert ir.lir(pred) != null;
             List<LIRInstruction> predInstructions = ir.lir(pred);
 
-            if (pred.numberOfSux() != 1) {
+            if (pred.getSuccessorCount() != 1) {
                 // this can happen with switch-statements where multiple edges are between
                 // the same blocks.
                 return;
             }
 
-            assert pred.suxAt(0) == block : "invalid control flow";
+            assert pred.getFirstSuccessor() == block : "invalid control flow";
             assert predInstructions.get(predInstructions.size() - 1) instanceof StandardOp.JumpOp : "block must end with unconditional jump";
 
             if (predInstructions.get(predInstructions.size() - 1).hasState()) {
@@ -170,14 +169,14 @@
     }
 
     /**
-     * Moves the longest {@linkplain #same common} subsequence at the start of all
-     * successors of {@code block} to the end of {@code block} just prior to the
-     * branch instruction ending {@code block}.
+     * Moves the longest {@linkplain #same common} subsequence at the start of all successors of
+     * {@code block} to the end of {@code block} just prior to the branch instruction ending
+     * {@code block}.
      */
     private void optimizeMovesAtBlockBegin(Block block) {
 
         edgeInstructionSeqences.clear();
-        int numSux = block.numberOfSux();
+        int numSux = block.getSuccessorCount();
 
         List<LIRInstruction> instructions = ir.lir(block);
 
@@ -203,18 +202,17 @@
         int insertIdx = instructions.size() - 2;
 
         // setup a list with the lir-instructions of all successors
-        for (int i = 0; i < numSux; i++) {
-            Block sux = block.suxAt(i);
+        for (Block sux : block.getSuccessors()) {
             List<LIRInstruction> suxInstructions = ir.lir(sux);
 
             assert suxInstructions.get(0) instanceof StandardOp.LabelOp : "block must start with label";
 
-            if (sux.numberOfPreds() != 1) {
+            if (sux.getPredecessorCount() != 1) {
                 // this can happen with switch-statements where multiple edges are between
                 // the same blocks.
                 return;
             }
-            assert sux.predAt(0) == block : "invalid control flow";
+            assert sux.getFirstPredecessor() == block : "invalid control flow";
 
             // ignore the label at the beginning of the block
             List<LIRInstruction> seq = suxInstructions.subList(1, suxInstructions.size());
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/FrameMap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,18 +31,18 @@
 import com.oracle.graal.asm.*;
 
 /**
- * This class is used to build the stack frame layout for a compiled method.
- * A {@link StackSlot} is used to index slots of the frame relative to the stack pointer.
- * The frame size is only fixed after register allocation when all spill slots have
- * been allocated. Both the outgoing argument area and the spill are can grow until then.
- * Therefore, outgoing arguments are indexed from the stack pointer, while spill slots
- * are indexed from the beginning of the frame (and the total frame size has to be added
- * to get the actual offset from the stack pointer).
- * <br>
+ * This class is used to build the stack frame layout for a compiled method. A {@link StackSlot} is
+ * used to index slots of the frame relative to the stack pointer. The frame size is only fixed
+ * after register allocation when all spill slots have been allocated. Both the outgoing argument
+ * area and the spill are can grow until then. Therefore, outgoing arguments are indexed from the
+ * stack pointer, while spill slots are indexed from the beginning of the frame (and the total frame
+ * size has to be added to get the actual offset from the stack pointer).
+ * <p>
  * This is the format of a stack frame:
+ * 
  * <pre>
  *   Base       Contents
- *
+ * 
  *            :                                :  -----
  *   caller   | incoming overflow argument n   |    ^
  *   frame    :     ...                        :    | positive
@@ -64,34 +64,39 @@
  *            :     ...                        :    | positive   |      |
  *            | outgoing overflow argument 0   |    | offsets    v      v
  *    %sp-->  +--------------------------------+---------------------------
- *
+ * 
  * </pre>
- * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size
- * of such a block may be greater than the size of a normal spill slot or the word size.
- * <br>
- * A runtime has two ways to reserve space in the stack frame for its own use: <ul>
- * <li>A memory block somewhere in the frame of size {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset
- *     to this block is returned in {@link CompilationResult#getCustomStackAreaOffset()}.
- * <li>At the beginning of the overflow argument area: The calling convention can specify that the first
- *     overflow stack argument is not at offset 0, but at a specified offset o. Use
- *     {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have this space
- *     reserved. Then the VM can use memory the memory at offset 0 relative to the stack pointer.
+ * 
+ * The spill slot area also includes stack allocated memory blocks (ALLOCA blocks). The size of such
+ * a block may be greater than the size of a normal spill slot or the word size.
+ * <p>
+ * A runtime has two ways to reserve space in the stack frame for its own use:
+ * <ul>
+ * <li>A memory block somewhere in the frame of size
+ * {@link CodeCacheProvider#getCustomStackAreaSize()}. The offset to this block is returned in
+ * {@link CompilationResult#getCustomStackAreaOffset()}.
+ * <li>At the beginning of the overflow argument area: The calling convention can specify that the
+ * first overflow stack argument is not at offset 0, but at a specified offset o. Use
+ * {@link CodeCacheProvider#getMinimumOutgoingSize()} to make sure that call-free methods also have
+ * this space reserved. Then the VM can use memory the memory at offset 0 relative to the stack
+ * pointer.
  * </ul>
  */
 public final class FrameMap {
+
     public final CodeCacheProvider runtime;
     public final TargetDescription target;
     public final RegisterConfig registerConfig;
 
     /**
-     * The initial frame size, not including the size of the return address.
-     * This is the constant space reserved by the runtime for all compiled methods.
+     * The initial frame size, not including the size of the return address. This is the constant
+     * space reserved by the runtime for all compiled methods.
      */
     public final int initialFrameSize;
 
     /**
-     * The final frame size, not including the size of the return address.
-     * The value is only set after register allocation is complete, i.e., after all spill slots have been allocated.
+     * The final frame size, not including the size of the return address. The value is only set
+     * after register allocation is complete, i.e., after all spill slots have been allocated.
      */
     private int frameSize;
 
@@ -101,8 +106,8 @@
     private int spillSize;
 
     /**
-     * Size of the area occupied by outgoing overflow arguments.
-     * This value is adjusted as calling conventions for outgoing calls are retrieved.
+     * Size of the area occupied by outgoing overflow arguments. This value is adjusted as calling
+     * conventions for outgoing calls are retrieved.
      */
     private int outgoingSize;
 
@@ -112,12 +117,14 @@
     private final List<StackSlot> objectStackBlocks;
 
     /**
-     * The stack area reserved for use by the VM, or {@code null} if the VM does not request stack space.
+     * The stack area reserved for use by the VM, or {@code null} if the VM does not request stack
+     * space.
      */
     private final StackSlot customArea;
 
     /**
-     * Records whether an offset to an incoming stack argument was ever returned by {@link #offsetForStackSlot(StackSlot)}.
+     * Records whether an offset to an incoming stack argument was ever returned by
+     * {@link #offsetForStackSlot(StackSlot)}.
      */
     private boolean accessesCallerFrame;
 
@@ -146,7 +153,8 @@
     }
 
     /**
-     * Determines if an offset to an incoming stack argument was ever returned by {@link #offsetForStackSlot(StackSlot)}.
+     * Determines if an offset to an incoming stack argument was ever returned by
+     * {@link #offsetForStackSlot(StackSlot)}.
      */
     public boolean accessesCallerFrame() {
         return accessesCallerFrame;
@@ -154,6 +162,7 @@
 
     /**
      * Gets the frame size of the compiled frame, not including the size of the return address.
+     * 
      * @return The size of the frame (in bytes).
      */
     public int frameSize() {
@@ -163,6 +172,7 @@
 
     /**
      * Gets the total frame size of the compiled frame, including the size of the return address.
+     * 
      * @return The total size of the frame (in bytes).
      */
     public int totalFrameSize() {
@@ -178,8 +188,9 @@
     }
 
     /**
-     * Computes the final size of this frame. After this method has been called, methods that change the
-     * frame size cannot be called anymore, e.g., no more spill slots or outgoing arguments can be requested.
+     * Computes the final size of this frame. After this method has been called, methods that change
+     * the frame size cannot be called anymore, e.g., no more spill slots or outgoing arguments can
+     * be requested.
      */
     public void finish() {
         assert this.frameSize == -1 : "must only be set once";
@@ -187,16 +198,15 @@
     }
 
     /**
-     * Computes the offset of a stack slot relative to the frame register.
-     * This is also the bit index of stack slots in the reference map.
-     *
+     * Computes the offset of a stack slot relative to the frame register. This is also the bit
+     * index of stack slots in the reference map.
+     * 
      * @param slot a stack slot
      * @return the offset of the stack slot
      */
     public int offsetForStackSlot(StackSlot slot) {
-        assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) ||
-            (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) ||
-            (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0);
+        assert (!slot.getRawAddFrameSize() && slot.getRawOffset() < outgoingSize) || (slot.getRawAddFrameSize() && slot.getRawOffset() < 0 && -slot.getRawOffset() <= spillSize) ||
+                        (slot.getRawAddFrameSize() && slot.getRawOffset() >= 0);
         if (slot.isInCallerFrame()) {
             accessesCallerFrame = true;
         }
@@ -205,6 +215,7 @@
 
     /**
      * Gets the offset to the stack area where callee-saved registers are stored.
+     * 
      * @return The offset to the callee save area (in bytes).
      */
     public int offsetToCalleeSaveArea() {
@@ -212,7 +223,9 @@
     }
 
     /**
-     * Gets the offset of the stack area stack block reserved for use by the VM, or -1 if the VM does not request stack space.
+     * Gets the offset of the stack area stack block reserved for use by the VM, or -1 if the VM
+     * does not request stack space.
+     * 
      * @return The offset to the custom area (in bytes).
      */
     public int offsetToCustomArea() {
@@ -220,8 +233,9 @@
     }
 
     /**
-     * Informs the frame map that the compiled code calls a particular method, which
-     * may need stack space for outgoing arguments.
+     * Informs the frame map that the compiled code calls a particular method, which may need stack
+     * space for outgoing arguments.
+     * 
      * @param cc The calling convention for the called method.
      */
     public void callsMethod(CallingConvention cc) {
@@ -230,6 +244,7 @@
 
     /**
      * Reserves space for stack-based outgoing arguments.
+     * 
      * @param argsSize The amount of space (in bytes) to reserve for stack-based outgoing arguments.
      */
     public void reserveOutgoing(int argsSize) {
@@ -242,8 +257,9 @@
     }
 
     /**
-     * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned on its natural alignment,
-     * i.e., an 8-byte spill slot is aligned at an 8-byte boundary.
+     * Reserves a spill slot in the frame of the method being compiled. The returned slot is aligned
+     * on its natural alignment, i.e., an 8-byte spill slot is aligned at an 8-byte boundary.
+     * 
      * @param kind The kind of the spill slot to be reserved.
      * @return A spill slot denoting the reserved memory area.
      */
@@ -255,12 +271,13 @@
     }
 
     /**
-     * Reserves a block of memory in the frame of the method being compiled. The returned block is aligned on a word boundary.
-     * If the requested size is 0, the method returns {@code null}.
-     *
+     * Reserves a block of memory in the frame of the method being compiled. The returned block is
+     * aligned on a word boundary. If the requested size is 0, the method returns {@code null}.
+     * 
      * @param size The size to reserve (in bytes).
-     * @param refs Specifies if the block is all references. If true, the block will be in all reference maps for this method.
-     *             The caller is responsible to initialize the memory block before the first instruction that uses a reference map.
+     * @param refs Specifies if the block is all references. If true, the block will be in all
+     *            reference maps for this method. The caller is responsible to initialize the memory
+     *            block before the first instruction that uses a reference map.
      * @return A stack slot describing the begin of the memory block.
      */
     public StackSlot allocateStackBlock(int size, boolean refs) {
@@ -284,7 +301,6 @@
         }
     }
 
-
     private int frameRefMapIndex(StackSlot slot) {
         assert offsetForStackSlot(slot) % target.wordSize == 0;
         return offsetForStackSlot(slot) / target.wordSize;
@@ -298,9 +314,9 @@
     }
 
     /**
-     * Initializes a reference map. Initially, the size is large enough to cover all the
-     * slots in the frame. If the method has incoming reference arguments on the stack,
-     * the reference map might grow later when such a reference is set.
+     * Initializes a reference map. Initially, the size is large enough to cover all the slots in
+     * the frame. If the method has incoming reference arguments on the stack, the reference map
+     * might grow later when such a reference is set.
      */
     public BitSet initFrameRefMap() {
         BitSet frameRefMap = new BitSet(frameSize() / target.wordSize);
@@ -314,7 +330,7 @@
      * Marks the specified location as a reference in the reference map of the debug information.
      * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a
      * {@link Constant} is automatically tracked.
-     *
+     * 
      * @param location The location to be added to the reference map.
      * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}.
      * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}.
@@ -336,7 +352,7 @@
      * Clears the specified location as a reference in the reference map of the debug information.
      * The tracked location can be a {@link RegisterValue} or a {@link StackSlot}. Note that a
      * {@link Constant} is automatically tracked.
-     *
+     * 
      * @param location The location to be removed from the reference map.
      * @param registerRefMap A register reference map, as created by {@link #initRegisterRefMap()}.
      * @param frameRefMap A frame reference map, as created by {@link #initFrameRefMap()}.
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,16 +32,16 @@
 import com.oracle.graal.nodes.cfg.*;
 
 /**
- * This class implements the overall container for the LIR graph
- * and directs its construction, optimization, and finalization.
+ * This class implements the overall container for the LIR graph and directs its construction,
+ * optimization, and finalization.
  */
 public class LIR {
 
     public final ControlFlowGraph cfg;
 
     /**
-     * The nodes for the blocks.
-     * TODO: This should go away, we want all nodes connected with a next-pointer.
+     * The nodes for the blocks. TODO: This should go away, we want all nodes connected with a
+     * next-pointer.
      */
     private final BlockMap<List<ScheduledNode>> blockToNodesMap;
 
@@ -56,8 +56,8 @@
     private final List<Block> codeEmittingOrder;
 
     /**
-     * Various out-of-line stubs to be emitted near the end of the method
-     * after all other LIR code has been emitted.
+     * Various out-of-line stubs to be emitted near the end of the method after all other LIR code
+     * has been emitted.
      */
     public final List<Code> stubs;
 
@@ -68,8 +68,8 @@
     public final BlockMap<List<LIRInstruction>> lirInstructions;
 
     public interface SpillMoveFactory {
+
         LIRInstruction createMove(Value result, Value input);
-        LIRInstruction createExchange(Value input1, Value input2);
     }
 
     private boolean hasArgInCallerFrame;
@@ -78,7 +78,9 @@
      * An opaque chunk of machine code.
      */
     public interface Code {
+
         void emitCode(TargetMethodAssembler tasm);
+
         /**
          * A description of this code stub useful for commenting the code in a disassembly.
          */
@@ -130,6 +132,7 @@
 
     /**
      * Gets the linear scan ordering of blocks as a list.
+     * 
      * @return the blocks in linear scan order
      */
     public List<Block> linearScanOrder() {
@@ -203,8 +206,8 @@
     }
 
     /**
-     * Determines if any of the parameters to the method are passed via the stack
-     * where the parameters are located in the caller's frame.
+     * Determines if any of the parameters to the method are passed via the stack where the
+     * parameters are located in the caller's frame.
      */
     public boolean hasArgInCallerFrame() {
         return hasArgInCallerFrame;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRFrameState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,19 +33,19 @@
 import com.oracle.graal.lir.LIRInstruction.ValueProcedure;
 
 /**
- * This class represents garbage collection and deoptimization information attached to a LIR instruction.
+ * This class represents garbage collection and deoptimization information attached to a LIR
+ * instruction.
  */
 public class LIRFrameState {
+
     public final BytecodeFrame topFrame;
     private final VirtualObject[] virtualObjects;
-    private final List<StackSlot> pointerSlots;
     public final LabelRef exceptionEdge;
     private DebugInfo debugInfo;
 
-    public LIRFrameState(BytecodeFrame topFrame, VirtualObject[] virtualObjects, List<StackSlot> pointerSlots, LabelRef exceptionEdge) {
+    public LIRFrameState(BytecodeFrame topFrame, VirtualObject[] virtualObjects, LabelRef exceptionEdge) {
         this.topFrame = topFrame;
         this.virtualObjects = virtualObjects;
-        this.pointerSlots = pointerSlots;
         this.exceptionEdge = exceptionEdge;
     }
 
@@ -60,7 +60,7 @@
 
     /**
      * Iterates the frame state and calls the {@link ValueProcedure} for every variable.
-     *
+     * 
      * @param proc The procedure called for variables.
      */
     public void forEachState(ValueProcedure proc) {
@@ -75,7 +75,8 @@
     }
 
     /**
-     * We filter out constant and illegal values ourself before calling the procedure, so {@link OperandFlag#CONST} and {@link OperandFlag#ILLEGAL} need not be set.
+     * We filter out constant and illegal values ourself before calling the procedure, so
+     * {@link OperandFlag#CONST} and {@link OperandFlag#ILLEGAL} need not be set.
      */
     private static final EnumSet<OperandFlag> STATE_FLAGS = EnumSet.of(OperandFlag.REG, OperandFlag.STACK);
 
@@ -109,19 +110,10 @@
         }
     }
 
-
-    public void finish(BitSet registerRefMap, BitSet frameRefMap, FrameMap frameMap) {
+    public void finish(BitSet registerRefMap, BitSet frameRefMap) {
         debugInfo = new DebugInfo(topFrame, registerRefMap, frameRefMap);
-
-        // Add additional stack slots for outgoing method parameters.
-        if (pointerSlots != null) {
-            for (StackSlot v : pointerSlots) {
-                frameMap.setReference(v, registerRefMap, frameRefMap);
-            }
-        }
     }
 
-
     @Override
     public String toString() {
         return debugInfo != null ? debugInfo.toString() : topFrame.toString();
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInsertionBuffer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInsertionBuffer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,14 +25,15 @@
 import java.util.*;
 
 /**
- * A buffer to enqueue updates to a list. This avoids frequent re-sizing of the list and copying of list elements
- * when insertions are done at multiple positions of the list. Additionally, it ensures that the list is not modified
- * while it is, e.g., iterated, and instead only modified once after the iteration is done.
- * <br>
- * The buffer uses internal data structures to store the enqueued updates. To avoid allocations, a buffer can be re-used.
- * Call the methods in the following order:
- * {@link #init}, {@link #append}, {@link #append}, ..., {@link #finish()}, {@link #init}, ...
- * <br>
+ * A buffer to enqueue updates to a list. This avoids frequent re-sizing of the list and copying of
+ * list elements when insertions are done at multiple positions of the list. Additionally, it
+ * ensures that the list is not modified while it is, e.g., iterated, and instead only modified once
+ * after the iteration is done.
+ * <p>
+ * The buffer uses internal data structures to store the enqueued updates. To avoid allocations, a
+ * buffer can be re-used. Call the methods in the following order: {@link #init}, {@link #append},
+ * {@link #append}, ..., {@link #finish()}, {@link #init}, ...
+ * <p>
  * Note: This class does not depend on LIRInstruction, so we could make it a generic utility class.
  */
 public final class LIRInsertionBuffer {
@@ -43,9 +44,9 @@
     private List<LIRInstruction> lir;
 
     /**
-     * List of insertion points. index and count are stored alternately:
-     * indexAndCount[i * 2]: the index into lir list where "count" ops should be inserted
-     * indexAndCount[i * 2 + 1]: the number of ops to be inserted at index
+     * List of insertion points. index and count are stored alternately: indexAndCount[i * 2]: the
+     * index into lir list where "count" ops should be inserted indexAndCount[i * 2 + 1]: the number
+     * of ops to be inserted at index
      */
     private final List<Integer> indexAndCount;
 
@@ -54,7 +55,6 @@
      */
     private final List<LIRInstruction> ops;
 
-
     public LIRInsertionBuffer() {
         indexAndCount = new ArrayList<>(8);
         ops = new ArrayList<>(8);
@@ -78,10 +78,11 @@
     }
 
     /**
-     * Enqueue a new instruction that will be appended to the instruction list when {@link #finish()} is called.
-     * The new instruction is added <b>before</b> the existing instruction with the given index. This method can only be called
-     * with increasing values of index, e.g., once an instruction was appended with index 4, subsequent instructions can
-     * only be appended with index 4 or higher.
+     * Enqueue a new instruction that will be appended to the instruction list when
+     * {@link #finish()} is called. The new instruction is added <b>before</b> the existing
+     * instruction with the given index. This method can only be called with increasing values of
+     * index, e.g., once an instruction was appended with index 4, subsequent instructions can only
+     * be appended with index 4 or higher.
      */
     public void append(int index, LIRInstruction op) {
         int i = numberOfInsertionPoints() - 1;
@@ -98,7 +99,8 @@
     }
 
     /**
-     * Append all enqueued instructions to the instruction list. After that, {@link #init(List)} can be called again to re-use this buffer.
+     * Append all enqueued instructions to the instruction list. After that, {@link #init(List)} can
+     * be called again to re-use this buffer.
      */
     public void finish() {
         if (ops.size() > 0) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstruction.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,14 +41,16 @@
     public static final Value[] NO_OPERANDS = {};
 
     /**
-     * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue methods.
-     * Clients of the class must only call the doValue method that takes additional parameters.
+     * Iterator for iterating over a list of values. Subclasses must overwrite one of the doValue
+     * methods. Clients of the class must only call the doValue method that takes additional
+     * parameters.
      */
     public abstract static class ValueProcedure {
+
         /**
-         * Iterator method to be overwritten. This version of the iterator does not take additional parameters
-         * to keep the signature short.
-         *
+         * Iterator method to be overwritten. This version of the iterator does not take additional
+         * parameters to keep the signature short.
+         * 
          * @param value The value that is iterated.
          * @return The new value to replace the value that was passed in.
          */
@@ -57,9 +59,9 @@
         }
 
         /**
-         * Iterator method to be overwritten. This version of the iterator gets additional parameters about the
-         * processed value.
-         *
+         * Iterator method to be overwritten. This version of the iterator gets additional
+         * parameters about the processed value.
+         * 
          * @param value The value that is iterated.
          * @param mode The operand mode for the value.
          * @param flags A set of flags for the value.
@@ -70,40 +72,41 @@
         }
     }
 
+    public abstract static class StateProcedure {
 
-    public abstract static class StateProcedure {
         protected abstract void doState(LIRFrameState state);
     }
 
-
     /**
      * Constants denoting how a LIR instruction uses an operand.
      */
     public enum OperandMode {
         /**
-         * The value must have been defined before. It is alive before the instruction until the beginning of the
-         * instruction, but not necessarily throughout the instruction. A register assigned to it can also be assigend
-         * to a Temp or Output operand. The value can be used again after the instruction, so the instruction must not
-         * modify the register.
+         * The value must have been defined before. It is alive before the instruction until the
+         * beginning of the instruction, but not necessarily throughout the instruction. A register
+         * assigned to it can also be assigend to a Temp or Output operand. The value can be used
+         * again after the instruction, so the instruction must not modify the register.
          */
         USE,
 
         /**
-         * The value must have been defined before. It is alive before the instruction and throughout the instruction. A
-         * register assigned to it cannot be assigned to a Temp or Output operand. The value can be used again after the
-         * instruction, so the instruction must not modify the register.
+         * The value must have been defined before. It is alive before the instruction and
+         * throughout the instruction. A register assigned to it cannot be assigned to a Temp or
+         * Output operand. The value can be used again after the instruction, so the instruction
+         * must not modify the register.
          */
         ALIVE,
 
         /**
-         * The value must not have been defined before, and must not be used after the instruction. The instruction can
-         * do whatever it wants with the register assigned to it (or not use it at all).
+         * The value must not have been defined before, and must not be used after the instruction.
+         * The instruction can do whatever it wants with the register assigned to it (or not use it
+         * at all).
          */
         TEMP,
 
         /**
-         * The value must not have been defined before. The instruction has to assign a value to the register. The
-         * value can (and most likely will) be used after the instruction.
+         * The value must not have been defined before. The instruction has to assign a value to the
+         * register. The value can (and most likely will) be used after the instruction.
          */
         DEF,
     }
@@ -111,24 +114,28 @@
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public static @interface Use {
+
         OperandFlag[] value() default REG;
     }
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public static @interface Alive {
+
         OperandFlag[] value() default REG;
     }
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public static @interface Temp {
+
         OperandFlag[] value() default REG;
     }
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public static @interface Def {
+
         OperandFlag[] value() default REG;
     }
 
@@ -140,10 +147,10 @@
     @Retention(RetentionPolicy.RUNTIME)
     @Target({ElementType.TYPE, ElementType.FIELD})
     public static @interface Opcode {
+
         String value() default "";
     }
 
-
     /**
      * Flags for an operand.
      */
@@ -180,13 +187,12 @@
         HINT,
 
         /**
-         * The value can be uninitialized, e.g., a stack slot that has not written to before. This is only
-         * used to avoid false positives in verification code.
+         * The value can be uninitialized, e.g., a stack slot that has not written to before. This
+         * is only used to avoid false positives in verification code.
          */
         UNINITIALIZED,
     }
 
-
     /**
      * For validity checking of the operand flags defined by instruction subclasses.
      */
@@ -196,7 +202,7 @@
         ALLOWED_FLAGS = new EnumMap<>(OperandMode.class);
         ALLOWED_FLAGS.put(USE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED));
         ALLOWED_FLAGS.put(ALIVE, EnumSet.of(REG, STACK, ADDR, CONST, ILLEGAL, HINT, UNINITIALIZED));
-        ALLOWED_FLAGS.put(TEMP,  EnumSet.of(REG, CONST, ILLEGAL, HINT));
+        ALLOWED_FLAGS.put(TEMP, EnumSet.of(REG, CONST, ILLEGAL, HINT));
         ALLOWED_FLAGS.put(DEF, EnumSet.of(REG, STACK, ILLEGAL, HINT));
     }
 
@@ -222,7 +228,6 @@
 
     public abstract void emitCode(TargetMethodAssembler tasm);
 
-
     public final int id() {
         return id;
     }
@@ -247,13 +252,13 @@
     }
 
     /**
-     * Returns true when this instruction is a call instruction that destroys all caller-saved registers.
+     * Returns true when this instruction is a call instruction that destroys all caller-saved
+     * registers.
      */
     public final boolean hasCall() {
         return this instanceof StandardOp.CallOp;
     }
 
-
     public final void forEachInput(ValueProcedure proc) {
         instructionClass.forEachUse(this, proc);
     }
@@ -279,27 +284,27 @@
     }
 
     /**
-     * Iterates all register hints for the specified value, i.e., all preferred candidates for the register to be
-     * assigned to the value.
-     * <br>
-     * Subclasses can override this method. The default implementation processes all Input operands as the hints for
-     * an Output operand, and all Output operands as the hints for an Input operand.
-     *
+     * Iterates all register hints for the specified value, i.e., all preferred candidates for the
+     * register to be assigned to the value.
+     * <p>
+     * Subclasses can override this method. The default implementation processes all Input operands
+     * as the hints for an Output operand, and all Output operands as the hints for an Input
+     * operand.
+     * 
      * @param value The value the hints are needed for.
      * @param mode The operand mode of the value.
-     * @param proc The procedure invoked for all the hints. If the procedure returns a non-null value, the iteration is stopped
-     *             and the value is returned by this method, i.e., clients can stop the iteration once a suitable hint has been found.
+     * @param proc The procedure invoked for all the hints. If the procedure returns a non-null
+     *            value, the iteration is stopped and the value is returned by this method, i.e.,
+     *            clients can stop the iteration once a suitable hint has been found.
      * @return The non-null value returned by the procedure, or null.
      */
     public Value forEachRegisterHint(Value value, OperandMode mode, ValueProcedure proc) {
         return instructionClass.forEachRegisterHint(this, mode, proc);
     }
 
-
     protected void verify() {
     }
 
-
     public final String toStringWithIdPrefix() {
         if (id != -1) {
             return String.format("%4d %s", id, toString());
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRInstructionClass.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,6 +21,7 @@
  * questions.
  */
 package com.oracle.graal.lir;
+
 import static com.oracle.graal.api.code.ValueUtil.*;
 
 import java.lang.annotation.*;
@@ -55,7 +56,6 @@
         }
     }
 
-
     private static final Class<?> INSTRUCTION_CLASS = LIRInstruction.class;
     private static final Class<?> VALUE_CLASS = Value.class;
     private static final Class<?> VALUE_ARRAY_CLASS = Value[].class;
@@ -143,14 +143,15 @@
         opcodeOffset = scanner.opcodeOffset;
     }
 
+    private static class OperandModeAnnotation {
 
-    private static class OperandModeAnnotation {
         public final ArrayList<Long> scalarOffsets = new ArrayList<>();
         public final ArrayList<Long> arrayOffsets = new ArrayList<>();
         public final Map<Long, EnumSet<OperandFlag>> flags = new HashMap<>();
     }
 
     protected static class FieldScanner extends BaseFieldScanner {
+
         public final Map<Class<? extends Annotation>, OperandModeAnnotation> valueAnnotations;
         public final ArrayList<Long> stateOffsets = new ArrayList<>();
 
@@ -161,15 +162,15 @@
             super(calc);
 
             valueAnnotations = new HashMap<>();
-            valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation()); //LIRInstruction.Use.class));
-            valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation()); //LIRInstruction.Alive.class));
-            valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation()); //LIRInstruction.Temp.class));
-            valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation()); //LIRInstruction.Def.class));
+            valueAnnotations.put(LIRInstruction.Use.class, new OperandModeAnnotation()); // LIRInstruction.Use.class));
+            valueAnnotations.put(LIRInstruction.Alive.class, new OperandModeAnnotation()); // LIRInstruction.Alive.class));
+            valueAnnotations.put(LIRInstruction.Temp.class, new OperandModeAnnotation()); // LIRInstruction.Temp.class));
+            valueAnnotations.put(LIRInstruction.Def.class, new OperandModeAnnotation()); // LIRInstruction.Def.class));
         }
 
         private OperandModeAnnotation getOperandModeAnnotation(Field field) {
             OperandModeAnnotation result = null;
-            for (Entry<Class<? extends Annotation>, OperandModeAnnotation> entry  : valueAnnotations.entrySet()) {
+            for (Entry<Class<? extends Annotation>, OperandModeAnnotation> entry : valueAnnotations.entrySet()) {
                 Annotation annotation = field.getAnnotation(entry.getKey());
                 if (annotation != null) {
                     assert result == null : "Field has two operand mode annotations: " + field;
@@ -181,8 +182,10 @@
 
         private static EnumSet<OperandFlag> getFlags(Field field) {
             EnumSet<OperandFlag> result = EnumSet.noneOf(OperandFlag.class);
-            // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so we have to duplicate the code for every operand mode.
-            // Unfortunately, annotations cannot have an EnumSet property, so we have to convert from arrays to EnumSet manually.
+            // Unfortunately, annotations cannot have class hierarchies or implement interfaces, so
+            // we have to duplicate the code for every operand mode.
+            // Unfortunately, annotations cannot have an EnumSet property, so we have to convert
+            // from arrays to EnumSet manually.
             if (field.isAnnotationPresent(LIRInstruction.Use.class)) {
                 result.addAll(Arrays.asList(field.getAnnotation(LIRInstruction.Use.class).value()));
             } else if (field.isAnnotationPresent(LIRInstruction.Alive.class)) {
@@ -217,7 +220,8 @@
         @Override
         protected void scanField(Field field, Class<?> type, long offset) {
             if (VALUE_CLASS.isAssignableFrom(type)) {
-                assert Modifier.isProtected(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final or [package] private because it is modified by register allocator: " + field;
+                assert Modifier.isProtected(field.getModifiers()) && !Modifier.isFinal(field.getModifiers()) : "Value field must not be declared final or [package] private because it is modified by register allocator: " +
+                                field;
                 OperandModeAnnotation annotation = getOperandModeAnnotation(field);
                 assert annotation != null : "Field must have operand mode annotation: " + field;
                 annotation.scalarOffsets.add(offset);
@@ -275,7 +279,6 @@
         return str.toString();
     }
 
-
     public final String getOpcode(LIRInstruction obj) {
         if (opcodeConstant != null) {
             return opcodeConstant;
@@ -412,14 +415,13 @@
         return (LIRFrameState) unsafe.getObject(obj, offset);
     }
 
-
     public String toString(LIRInstruction obj) {
         StringBuilder result = new StringBuilder();
 
-        appendValues(result, obj, "", " = ", "(", ")", new String[] {""}, defOffsets);
+        appendValues(result, obj, "", " = ", "(", ")", new String[]{""}, defOffsets);
         result.append(getOpcode(obj).toUpperCase());
-        appendValues(result, obj, " ", "", "(", ")", new String[] {"", "~"}, useOffsets, aliveOffsets);
-        appendValues(result, obj, " ", "", "{", "}", new String[] {""}, tempOffsets);
+        appendValues(result, obj, " ", "", "(", ")", new String[]{"", "~"}, useOffsets, aliveOffsets);
+        appendValues(result, obj, " ", "", "{", "}", new String[]{""}, tempOffsets);
 
         for (int i = 0; i < dataOffsets.length; i++) {
             if (dataOffsets[i] == opcodeOffset) {
@@ -444,7 +446,7 @@
         return result.toString();
     }
 
-    private void appendValues(StringBuilder result, LIRInstruction obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]...moffsets) {
+    private void appendValues(StringBuilder result, LIRInstruction obj, String start, String end, String startMultiple, String endMultiple, String[] prefix, long[]... moffsets) {
         int total = 0;
         for (long[] offsets : moffsets) {
             total += offsets.length;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRValueUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 import com.oracle.graal.api.meta.*;
 
 public final class LIRValueUtil {
+
     public static boolean isVariable(Value value) {
         assert value != null;
         return value instanceof Variable;
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIRVerifier.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,6 +35,7 @@
 import com.oracle.graal.nodes.cfg.*;
 
 public final class LIRVerifier {
+
     private final LIR lir;
     private final FrameMap frameMap;
 
@@ -46,6 +47,7 @@
     private BitSet liveOutFor(Block block) {
         return blockLiveOut[block.getId()];
     }
+
     private void setLiveOutFor(Block block, BitSet liveOut) {
         blockLiveOut[block.getId()] = liveOut;
     }
@@ -60,7 +62,9 @@
 
     public static boolean verify(final LIRInstruction op) {
         ValueProcedure allowedProc = new ValueProcedure() {
-            @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
+
+            @Override
+            public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
                 return allowed(op, value, mode, flags);
             }
         };
@@ -81,7 +85,6 @@
         return true;
     }
 
-
     private LIRVerifier(boolean beforeRegisterAllocation, LIR lir, FrameMap frameMap) {
         this.beforeRegisterAllocation = beforeRegisterAllocation;
         this.lir = lir;
@@ -98,8 +101,20 @@
     private BitSet curRegistersDefined;
 
     private void verify() {
-        ValueProcedure useProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { return use(value, mode, flags); } };
-        ValueProcedure defProc = new ValueProcedure() { @Override public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) { return def(value, mode, flags); } };
+        ValueProcedure useProc = new ValueProcedure() {
+
+            @Override
+            public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
+                return use(value, mode, flags);
+            }
+        };
+        ValueProcedure defProc = new ValueProcedure() {
+
+            @Override
+            public Value doValue(Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
+                return def(value, mode, flags);
+            }
+        };
 
         int maxRegisterNum = maxRegisterNum();
         curRegistersDefined = new BitSet();
@@ -114,7 +129,7 @@
 
             assert lir.lir(block).get(0) instanceof StandardOp.LabelOp : "block must start with label";
 
-            if (block.numberOfSux() > 0) {
+            if (block.getSuccessorCount() > 0) {
                 LIRInstruction last = lir.lir(block).get(lir.lir(block).size() - 1);
                 assert last instanceof StandardOp.JumpOp : "block with successor must end with unconditional jump";
             }
@@ -216,11 +231,8 @@
     }
 
     private static Value allowed(Object op, Value value, OperandMode mode, EnumSet<OperandFlag> flags) {
-        if ((isVariable(value)  && flags.contains(OperandFlag.REG)) ||
-            (isRegister(value)  && flags.contains(OperandFlag.REG)) ||
-            (isStackSlot(value) && flags.contains(OperandFlag.STACK)) ||
-            (isConstant(value)  && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) ||
-            (isIllegal(value)   && flags.contains(OperandFlag.ILLEGAL))) {
+        if ((isVariable(value) && flags.contains(OperandFlag.REG)) || (isRegister(value) && flags.contains(OperandFlag.REG)) || (isStackSlot(value) && flags.contains(OperandFlag.STACK)) ||
+                        (isConstant(value) && flags.contains(OperandFlag.CONST) && mode != OperandMode.DEF) || (isIllegal(value) && flags.contains(OperandFlag.ILLEGAL))) {
             return value;
         }
         TTY.println("instruction %s", op);
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LabelRef.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,14 +27,14 @@
 
 /**
  * LIR instructions such as JUMP and BRANCH need to reference their target {@link Block}. However,
- * direct references are not possible since the control flow graph (and therefore successors lists) can
- * be changed by optimizations - and fixing the instructions is error prone.
- * Therefore, we only 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}.
+ * direct references are not possible since the control flow graph (and therefore successors lists)
+ * can be changed by optimizations - and fixing the instructions is error prone. Therefore, we only
+ * 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 {
 
@@ -42,42 +42,45 @@
 
     /**
      * 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;
-           }
+        return new LabelRef() {
 
-           @Override
-           public String toString() {
-               return label.toString();
-           }
-       };
+            @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. 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)}.
+     * 
      * @param block The base block that contains the successor list.
      * @param suxIndex The index of the successor.
      * @return The newly created label reference.
      */
     public static LabelRef forSuccessor(final LIR lir, final Block block, final int suxIndex) {
         return new LabelRef() {
+
             @Override
             public Label label() {
-                return ((StandardOp.LabelOp) lir.lir(block.suxAt(suxIndex)).get(0)).getLabel();
+                return ((StandardOp.LabelOp) lir.lir(block.getSuccessors().get(suxIndex)).get(0)).getLabel();
             }
 
             @Override
             public String toString() {
-                return suxIndex < block.numberOfSux() ? block.suxAt(suxIndex).toString() : "?" + block + ":" + suxIndex + "?";
+                return suxIndex < block.getSuccessorCount() ? block.getSuccessors().get(suxIndex).toString() : "?" + block + ":" + suxIndex + "?";
             }
         };
     }
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/StandardOp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,27 +28,31 @@
 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*;
 
 /**
- * A collection of machine-independent LIR operations, as well as interfaces to be implemented for specific kinds or LIR
- * operations.
+ * A collection of machine-independent LIR operations, as well as interfaces to be implemented for
+ * specific kinds or LIR operations.
  */
 public class StandardOp {
 
     private static Value[] EMPTY = new Value[0];
 
     /**
-     * Marker interface for LIR ops that can fall through to the next operation, like a switch statement.
-     * setFallThroughTarget(null) can be used to make the operation fall through to the next one.
+     * Marker interface for LIR ops that can fall through to the next operation, like a switch
+     * statement. setFallThroughTarget(null) can be used to make the operation fall through to the
+     * next one.
      */
     public interface FallThroughOp {
+
         LabelRef fallThroughTarget();
+
         void setFallThroughTarget(LabelRef target);
     }
 
     /**
-     * LIR operation that defines the position of a label.
-     * The first operation of every block must implement this interface.
+     * LIR operation that defines the position of a label. The first operation of every block must
+     * implement this interface.
      */
     public static class LabelOp extends LIRInstruction {
+
         private final Label label;
         private final boolean align;
 
@@ -71,13 +75,14 @@
     }
 
     /**
-     * LIR operation that is an unconditional jump to {@link #destination()}.
-     * When the LIR is constructed, the last operation of every block must implement this interface. After
-     * register allocation, unnecessary jumps can be deleted.
-     *
+     * LIR operation that is an unconditional jump to {@link #destination()}. When the LIR is
+     * constructed, the last operation of every block must implement this interface. After register
+     * allocation, unnecessary jumps can be deleted.
+     * 
      * TODO (cwimmer) Currently, a block can also end with an XIR operation.
      */
     public static class JumpOp extends LIRInstruction {
+
         private final LabelRef destination;
         @State protected LIRFrameState state;
 
@@ -97,6 +102,7 @@
     }
 
     public static class PhiJumpOp extends JumpOp {
+
         @Alive({REG, STACK, CONST}) protected Value[] phiInputs;
 
         public PhiJumpOp(LabelRef destination, Value[] phiInputs) {
@@ -118,31 +124,37 @@
      * Conditional jumps may be negated or optimized away after register allocation.
      */
     public interface BranchOp {
+
         LabelRef destination();
+
         void negate(LabelRef newDestination);
     }
 
     /**
-     * Marker interface for a LIR operation that moves a value from {@link #getInput()} to {@link #getResult()}.
+     * Marker interface for a LIR operation that moves a value from {@link #getInput()} to
+     * {@link #getResult()}.
      */
     public interface MoveOp {
+
         Value getInput();
+
         Value getResult();
     }
 
     /**
-     * Marker interface for a LIR operation that calls a method, i.e., destroys all caller-saved registers.
+     * Marker interface for a LIR operation that calls a method, i.e., destroys all caller-saved
+     * registers.
      */
     public interface CallOp {
     }
 
-
     /**
-     * Meta-operation that defines the incoming method parameters. In the LIR, every register and variable must be
-     * defined before it is used. This operation is the definition point of method parameters, but is otherwise a no-op.
-     * In particular, it is not the actual method prologue.
+     * Meta-operation that defines the incoming method parameters. In the LIR, every register and
+     * variable must be defined before it is used. This operation is the definition point of method
+     * parameters, but is otherwise a no-op. In particular, it is not the actual method prologue.
      */
     public static final class ParametersOp extends LIRInstruction {
+
         @Def({REG, STACK}) protected Value[] params;
 
         public ParametersOp(Value[] params) {
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/Variable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,11 @@
 import com.oracle.graal.api.meta.*;
 
 /**
- * Represents a value that is yet to be bound to a machine location (such as
- * a {@link RegisterValue} or {@link StackSlot}) by a register allocator.
+ * Represents a value that is yet to be bound to a machine location (such as a {@link RegisterValue}
+ * or {@link StackSlot}) by a register allocator.
  */
 public final class Variable extends Value {
+
     private static final long serialVersionUID = 4507578431686109809L;
 
     /**
@@ -44,6 +45,7 @@
 
     /**
      * Creates a new variable.
+     * 
      * @param kind
      * @param index
      */
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/FrameContext.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/FrameContext.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,11 +22,11 @@
  */
 package com.oracle.graal.lir.asm;
 
-
 /**
  * Code for managing a method's native frame.
  */
 public interface FrameContext {
+
     /**
      * Emits code common to all entry points of a method. This may include:
      * <ul>
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/asm/TargetMethodAssembler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,6 +37,7 @@
 public class TargetMethodAssembler {
 
     private static class ExceptionInfo {
+
         public final int codeOffset;
         public final LabelRef exceptionEdge;
 
@@ -58,8 +59,8 @@
     public final List<Code> stubs;
 
     /**
-     * The object that emits code for managing a method's frame.
-     * If null, no frame is used by the method.
+     * The object that emits code for managing a method's frame. If null, no frame is used by the
+     * method.
      */
     public final FrameContext frameContext;
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/BasicInductionVariable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.type.*;
 
+public class BasicInductionVariable extends InductionVariable {
 
-public class BasicInductionVariable extends InductionVariable {
     private PhiNode phi;
     private ValueNode init;
     private ValueNode rawStride;
@@ -51,7 +51,7 @@
             if (integerStamp.isStrictlyPositive()) {
                 dir = Direction.Up;
             } else if (integerStamp.isStrictlyNegative()) {
-                dir =  Direction.Down;
+                dir = Direction.Down;
             }
             if (dir != null) {
                 if (op instanceof IntegerAddNode) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/CountedLoopInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,6 +27,7 @@
 import com.oracle.graal.nodes.*;
 
 public class CountedLoopInfo {
+
     private final LoopEx loop;
     private InductionVariable iv;
     private ValueNode end;
@@ -40,9 +41,10 @@
     }
 
     public ValueNode maxTripCountNode() {
-        //TODO (gd) stuarte and respect oneOff
+        // TODO (gd) stuarte and respect oneOff
         throw GraalInternalError.unimplemented("division is a fixed node that needs to be inserted into the control flow");
-        // return IntegerArithmeticNode.div(IntegerArithmeticNode.sub(end, iv.initNode()), iv.strideNode());
+        // return IntegerArithmeticNode.div(IntegerArithmeticNode.sub(end, iv.initNode()),
+        // iv.strideNode());
     }
 
     public boolean isConstantMaxTripCount() {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedOffsetInductionVariable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 
+public class DerivedOffsetInductionVariable extends InductionVariable {
 
-public class DerivedOffsetInductionVariable extends InductionVariable {
     private InductionVariable base;
     private ValueNode offset;
     private IntegerArithmeticNode value;
@@ -117,7 +117,7 @@
 
     private ValueNode op(ValueNode b, ValueNode o) {
         if (value instanceof IntegerAddNode) {
-        return IntegerArithmeticNode.add(b, o);
+            return IntegerArithmeticNode.add(b, o);
         }
         if (value instanceof IntegerSubNode) {
             if (base.valueNode() == value.x()) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedScaledInductionVariable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/DerivedScaledInductionVariable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.type.*;
 
+public class DerivedScaledInductionVariable extends InductionVariable {
 
-public class DerivedScaledInductionVariable extends InductionVariable {
     private InductionVariable base;
     private ValueNode scale;
     private ValueNode value;
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,16 +25,19 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 
+public abstract class InductionVariable {
 
-public abstract class InductionVariable {
     public enum Direction {
-        Up,
-        Down;
+        Up, Down;
+
         public Direction opposite() {
-            switch(this) {
-                case Up: return Down;
-                case Down: return Up;
-                default: throw GraalInternalError.shouldNotReachHere();
+            switch (this) {
+                case Up:
+                    return Down;
+                case Down:
+                    return Up;
+                default:
+                    throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
@@ -50,15 +53,20 @@
     public abstract ValueNode valueNode();
 
     public abstract ValueNode initNode();
+
     public abstract ValueNode strideNode();
 
     public abstract boolean isConstantInit();
+
     public abstract boolean isConstantStride();
 
     public abstract long constantInit();
+
     public abstract long constantStride();
 
     public abstract ValueNode extremumNode();
+
     public abstract boolean isConstantExtremum();
+
     public abstract long constantExtremum();
 }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariables.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/InductionVariables.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.calc.*;
 
+public class InductionVariables {
 
-public class InductionVariables {
     private final LoopEx loop;
     private Map<Node, InductionVariable> ivs;
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopEx.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,10 +33,11 @@
 import com.oracle.graal.nodes.cfg.*;
 
 public class LoopEx {
+
     private final Loop lirLoop;
     private LoopFragmentInside inside;
     private LoopFragmentWhole whole;
-    private CountedLoopInfo counted; //TODO (gd) detect
+    private CountedLoopInfo counted; // TODO (gd) detect
     private LoopsData data;
 
     LoopEx(Loop lirLoop, LoopsData data) {
@@ -115,6 +116,7 @@
     }
 
     private class InvariantPredicate extends NodePredicate {
+
         @Override
         public boolean apply(Node n) {
             return isOutsideLoop(n);
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragment.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,8 +34,8 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.type.*;
 
+public abstract class LoopFragment {
 
-public abstract class LoopFragment {
     private final LoopEx loop;
     private final LoopFragment original;
     protected NodeBitMap nodes;
@@ -114,6 +114,7 @@
                 dr = cfgFix;
             } else if (cfgFix != null && dataFix != null) {
                 dr = new DuplicationReplacement() {
+
                     @Override
                     public Node replacement(Node o) {
                         Node r1 = dataFix.replacement(o);
@@ -130,6 +131,7 @@
                 };
             } else {
                 dr = new DuplicationReplacement() {
+
                     @Override
                     public Node replacement(Node o) {
                         return o;
@@ -140,12 +142,12 @@
             finishDuplication();
             nodesReady = true;
         } else {
-            //TODO (gd) apply fix ?
+            // TODO (gd) apply fix ?
         }
     }
 
     protected static NodeBitMap computeNodes(Graph graph, Collection<BeginNode> blocks) {
-        return computeNodes(graph, blocks, Collections.<BeginNode>emptyList());
+        return computeNodes(graph, blocks, Collections.<BeginNode> emptyList());
     }
 
     protected static NodeBitMap computeNodes(Graph graph, Collection<BeginNode> blocks, Collection<BeginNode> earlyExits) {
@@ -169,6 +171,7 @@
             if (stateAfter != null) {
                 nodes.mark(stateAfter);
                 stateAfter.applyToVirtual(new VirtualClosure() {
+
                     @Override
                     public void apply(VirtualState node) {
                         nodes.mark(node);
@@ -230,7 +233,8 @@
     }
 
     /**
-     * Merges the early exits (i.e. loop exits) that were duplicated as part of this fragment, with the original fragment's exits.
+     * Merges the early exits (i.e. loop exits) that were duplicated as part of this fragment, with
+     * the original fragment's exits.
      */
     protected void mergeEarlyExits() {
         assert isDuplicate();
@@ -271,7 +275,8 @@
                 final ValueNode replaceWith;
                 ValueProxyNode newVpn = getDuplicatedNode(vpn);
                 if (newVpn != null) {
-                    PhiNode phi = graph.add(vpn.type() == PhiType.Value ? vpn.stamp() == StampFactory.virtual() ? new PhiNode(vpn.stamp(), merge) : new PhiNode(vpn.kind(), merge) : new PhiNode(vpn.type(), merge));
+                    PhiNode phi = graph.add(vpn.type() == PhiType.Value ? vpn.stamp() == StampFactory.virtual() ? new PhiNode(vpn.stamp(), merge) : new PhiNode(vpn.kind(), merge) : new PhiNode(
+                                    vpn.type(), merge));
                     phi.addInput(vpn);
                     phi.addInput(newVpn);
                     replaceWith = phi;
@@ -280,6 +285,7 @@
                 }
                 if (state != null) {
                     state.applyToNonVirtual(new NodeClosure<ValueNode>() {
+
                         @Override
                         public void apply(Node from, ValueNode node) {
                             if (node == vpn) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInside.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,16 +33,18 @@
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 
+public class LoopFragmentInside extends LoopFragment {
 
-public class LoopFragmentInside extends LoopFragment {
-    /** mergedInitializers.
-     * When an inside fragment's (loop)ends are merged to create a unique exit point,
-     * some phis must be created : they phis together all the back-values of the loop-phis
-     * These can then be used to update the loop-phis' forward edge value ('initializer') in the peeling case.
-     * In the unrolling case they will be used as the value that replace the loop-phis of the duplicated inside fragment
+    /**
+     * mergedInitializers. When an inside fragment's (loop)ends are merged to create a unique exit
+     * point, some phis must be created : they phis together all the back-values of the loop-phis
+     * These can then be used to update the loop-phis' forward edge value ('initializer') in the
+     * peeling case. In the unrolling case they will be used as the value that replace the loop-phis
+     * of the duplicated inside fragment
      */
     private Map<PhiNode, ValueNode> mergedInitializers;
     private final DuplicationReplacement dataFixBefore = new DuplicationReplacement() {
+
         @Override
         public Node replacement(Node oriInput) {
             if (!(oriInput instanceof ValueNode)) {
@@ -124,6 +126,7 @@
         final LoopBeginNode loopBegin = loop().loopBegin();
         final StructuredGraph graph = graph();
         return new DuplicationReplacement() {
+
             @Override
             public Node replacement(Node original) {
                 if (original == loopBegin) {
@@ -157,8 +160,10 @@
             } else {
                 first = peel.mergedInitializers.get(phi);
             }
-            // create a new phi (we don't patch the old one since some usages of the old one may still be valid)
-            PhiNode newPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), loopBegin) : new PhiNode(phi.kind(), loopBegin) : new PhiNode(phi.type(), loopBegin));
+            // create a new phi (we don't patch the old one since some usages of the old one may
+            // still be valid)
+            PhiNode newPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), loopBegin) : new PhiNode(phi.kind(), loopBegin) : new PhiNode(
+                            phi.type(), loopBegin));
             newPhi.addInput(first);
             for (LoopEndNode end : loopBegin.orderedLoopEnds()) {
                 newPhi.addInput(phi.valueAt(end));
@@ -166,12 +171,15 @@
             peel.putDuplicatedNode(phi, newPhi);
             newPhis.add(newPhi);
             for (Node usage : phi.usages().snapshot()) {
-                if (peel.getDuplicatedNode(usage) != null) { // patch only usages that should use the new phi ie usages that were peeled
+                if (peel.getDuplicatedNode(usage) != null) { // patch only usages that should use
+                                                             // the new phi ie usages that were
+                                                             // peeled
                     usage.replaceFirstInput(phi, newPhi);
                 }
             }
         }
-        // check new phis to see if they have as input some old phis, replace those inputs with the new corresponding phis
+        // check new phis to see if they have as input some old phis, replace those inputs with the
+        // new corresponding phis
         for (PhiNode phi : newPhis) {
             for (int i = 0; i < phi.valueCount(); i++) {
                 ValueNode v = phi.valueAt(i);
@@ -187,7 +195,7 @@
 
     /**
      * Gets the corresponding value in this fragment.
-     *
+     * 
      * @param b original value
      * @return corresponding value in the peel
      */
@@ -211,7 +219,8 @@
     private BeginNode mergeEnds() {
         assert isDuplicate();
         List<EndNode> endsToMerge = new LinkedList<>();
-        Map<EndNode, LoopEndNode> reverseEnds = new HashMap<>(); // map peel's exit to the corresponding loop exits
+        Map<EndNode, LoopEndNode> reverseEnds = new HashMap<>(); // map peel's exit to the
+                                                                 // corresponding loop exits
         LoopBeginNode loopBegin = original().loop().loopBegin();
         for (LoopEndNode le : loopBegin.loopEnds()) {
             EndNode duplicate = getDuplicatedNode(le);
@@ -244,7 +253,8 @@
             }
 
             for (final PhiNode phi : loopBegin.phis().snapshot()) {
-                final PhiNode firstPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), newExitMerge) : new PhiNode(phi.kind(), newExitMerge) : new PhiNode(phi.type(), newExitMerge));
+                final PhiNode firstPhi = graph.add(phi.type() == PhiType.Value ? phi.stamp() == StampFactory.virtual() ? new PhiNode(phi.stamp(), newExitMerge) : new PhiNode(phi.kind(), newExitMerge)
+                                : new PhiNode(phi.type(), newExitMerge));
                 for (EndNode end : newExitMerge.forwardEnds()) {
                     LoopEndNode loopEnd = reverseEnds.get(end);
                     ValueNode prim = prim(phi.valueAt(loopEnd));
@@ -255,6 +265,7 @@
                 if (duplicateState != null) {
                     // fix the merge's state after
                     duplicateState.applyToNonVirtual(new NodeClosure<ValueNode>() {
+
                         @Override
                         public void apply(Node from, ValueNode node) {
                             if (node == phi) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideBefore.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideBefore.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
 
+public class LoopFragmentInsideBefore extends LoopFragmentInside {
 
-public class LoopFragmentInsideBefore extends LoopFragmentInside {
     private final FixedNode point;
 
     public LoopFragmentInsideBefore(LoopEx loop, FixedNode point) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideFrom.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentInsideFrom.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.*;
 
+public class LoopFragmentInsideFrom extends LoopFragmentInside {
 
-public class LoopFragmentInsideFrom extends LoopFragmentInside {
     private final FixedNode point;
 
     public LoopFragmentInsideFrom(LoopEx loop, FixedNode point) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopFragmentWhole.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.cfg.*;
 
-
 public class LoopFragmentWhole extends LoopFragment {
 
     public LoopFragmentWhole(LoopEx loop) {
@@ -68,6 +67,7 @@
         final FixedNode entry = loop().entryPoint();
         final Graph graph = this.graph();
         return new DuplicationReplacement() {
+
             @Override
             public Node replacement(Node o) {
                 if (o == entry) {
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.*;
 
+public abstract class LoopPolicies {
 
-public abstract class LoopPolicies {
     private LoopPolicies() {
         // does not need to be instantiated
     }
@@ -65,7 +65,10 @@
         double maxProbability = 0;
         for (Node successor : controlSplit.successors()) {
             BeginNode branch = (BeginNode) successor;
-            inBranchTotal += loop.nodesInLoopFrom(branch, postDom).cardinality(); //this may count twice because of fall-through in switches
+            inBranchTotal += loop.nodesInLoopFrom(branch, postDom).cardinality(); // this may count
+                                                                                  // twice because
+                                                                                  // of fall-through
+                                                                                  // in switches
             double probability = controlSplit.probability(branch);
             if (probability > maxProbability) {
                 maxProbability = probability;
@@ -78,5 +81,4 @@
         return netDiff <= maxDiff;
     }
 
-
 }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopTransformations.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,8 +32,8 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
 
+public abstract class LoopTransformations {
 
-public abstract class LoopTransformations {
     private static final int UNROLL_LIMIT = GraalOptions.FullUnrollMaxNodes * 2;
 
     private LoopTransformations() {
@@ -53,7 +53,7 @@
     }
 
     public static void fullUnroll(LoopEx loop, MetaAccessProvider runtime, Assumptions assumptions) {
-        //assert loop.isCounted(); //TODO (gd) strenghten : counted with known trip count
+        // assert loop.isCounted(); //TODO (gd) strenghten : counted with known trip count
         int iterations = 0;
         LoopBeginNode loopBegin = loop.loopBegin();
         StructuredGraph graph = (StructuredGraph) loopBegin.graph();
@@ -69,13 +69,13 @@
 
     public static void unswitch(LoopEx loop, ControlSplitNode controlSplitNode) {
         LoopFragmentWhole originalLoop = loop.whole();
-        //create new control split out of loop
+        // create new control split out of loop
         ControlSplitNode newControlSplit = (ControlSplitNode) controlSplitNode.copyWithInputs();
         originalLoop.entryPoint().replaceAtPredecessor(newControlSplit);
 
         NodeClassIterator successors = controlSplitNode.successors().iterator();
         assert successors.hasNext();
-        //original loop is used as first successor
+        // original loop is used as first successor
         Position firstPosition = successors.nextPosition();
         NodeClass controlSplitClass = controlSplitNode.getNodeClass();
         controlSplitClass.set(newControlSplit, firstPosition, BeginNode.begin(originalLoop.entryPoint()));
@@ -91,7 +91,7 @@
         }
         // original loop is simplified last to avoid deleting controlSplitNode too early
         graph.removeSplitPropagate(controlSplitNode, (BeginNode) controlSplitClass.get(controlSplitNode, firstPosition));
-        //TODO (gd) probabilities need some amount of fixup.. (probably also in other transforms)
+        // TODO (gd) probabilities need some amount of fixup.. (probably also in other transforms)
     }
 
     public static void unroll(LoopEx loop, int factor) {
@@ -103,12 +103,12 @@
         LoopFragmentWhole main = loop.whole();
         LoopFragmentWhole prologue = main.duplicate();
         prologue.insertBefore(loop);
-        //CountedLoopBeginNode counted = prologue.countedLoop();
-        //StructuredGraph graph = (StructuredGraph) counted.graph();
-        //ValueNode tripCountPrologue = counted.tripCount();
-        //ValueNode tripCountMain = counted.tripCount();
-        //graph.replaceFloating(tripCountPrologue, "tripCountPrologue % factor");
-        //graph.replaceFloating(tripCountMain, "tripCountMain - (tripCountPrologue % factor)");
+        // CountedLoopBeginNode counted = prologue.countedLoop();
+        // StructuredGraph graph = (StructuredGraph) counted.graph();
+        // ValueNode tripCountPrologue = counted.tripCount();
+        // ValueNode tripCountMain = counted.tripCount();
+        // graph.replaceFloating(tripCountPrologue, "tripCountPrologue % factor");
+        // graph.replaceFloating(tripCountMain, "tripCountMain - (tripCountPrologue % factor)");
         LoopFragmentInside inside = loop.inside();
         for (int i = 0; i < factor; i++) {
             inside.duplicate().appendInside(loop);
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopsData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
 import com.oracle.graal.nodes.cfg.*;
 
 public class LoopsData {
+
     private Map<Loop, LoopEx> lirLoopToEx = new IdentityHashMap<>();
     private Map<LoopBeginNode, LoopEx> loopBeginToEx = new IdentityHashMap<>();
     private ControlFlowGraph cfg;
@@ -40,6 +41,7 @@
     public LoopsData(final StructuredGraph graph) {
 
         cfg = Debug.scope("ControlFlowGraph", new Callable<ControlFlowGraph>() {
+
             @Override
             public ControlFlowGraph call() throws Exception {
                 return ControlFlowGraph.compute(graph, true, true, true, true);
@@ -67,6 +69,7 @@
     public List<LoopEx> outterFirst() {
         ArrayList<LoopEx> loops = new ArrayList<>(loops());
         Collections.sort(loops, new Comparator<LoopEx>() {
+
             @Override
             public int compare(LoopEx o1, LoopEx o2) {
                 return o1.lirLoop().depth - o2.lirLoop().depth;
@@ -145,7 +148,8 @@
                             continue;
                         }
                         break;
-                    default: throw GraalInternalError.shouldNotReachHere();
+                    default:
+                        throw GraalInternalError.shouldNotReachHere();
                 }
                 loop.setCounted(new CountedLoopInfo(loop, iv, limit, oneOff));
             }
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopFullUnrollPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 
+public class LoopFullUnrollPhase extends Phase {
 
-public class LoopFullUnrollPhase extends Phase {
     private static final DebugMetric FULLY_UNROLLED_LOOPS = Debug.metric("FullUnrolls");
     private final GraalCodeCacheProvider runtime;
     private final Assumptions assumptions;
@@ -58,7 +58,7 @@
                         break;
                     }
                 }
-            } while(peeled);
+            } while (peeled);
         }
     }
 
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopTransformLowPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/phases/LoopTransformLowPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
 import com.oracle.graal.phases.*;
 
 public class LoopTransformLowPhase extends Phase {
+
     private static final DebugMetric UNSWITCHED = Debug.metric("Unswitched");
 
     @Override
@@ -37,6 +38,7 @@
             if (GraalOptions.ReassociateInvariants) {
                 final LoopsData dataReassociate = new LoopsData(graph);
                 Debug.scope("ReassociateInvariants", new Runnable() {
+
                     @Override
                     public void run() {
                         for (LoopEx loop : dataReassociate.loops()) {
@@ -65,7 +67,7 @@
                             }
                         }
                     }
-                } while(unswitched);
+                } while (unswitched);
             }
         }
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/AbstractStateSplit.java	Fri Feb 01 17:06:26 2013 +0100
@@ -48,4 +48,9 @@
     public AbstractStateSplit(Stamp stamp) {
         super(stamp);
     }
+
+    public AbstractStateSplit(Stamp stamp, FrameState stateAfter) {
+        super(stamp);
+        this.stateAfter = stateAfter;
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.nodes.type.*;
 
 public class BeginNode extends FixedWithNextNode implements StateSplit, LIRLowerable, Simplifiable, Node.IterableNodeType {
+
     @Input(notDataflow = true) private FrameState stateAfter;
 
     public FrameState stateAfter() {
@@ -56,7 +57,7 @@
         if (with instanceof BeginNode) {
             return (BeginNode) with;
         }
-        BeginNode begin =  with.graph().add(new BeginNode());
+        BeginNode begin = with.graph().add(new BeginNode());
         begin.setNext(with);
         return begin;
     }
@@ -139,6 +140,7 @@
 
     public NodeIterable<FixedNode> getBlockNodes() {
         return new AbstractNodeIterable<FixedNode>() {
+
             @Override
             public Iterator<FixedNode> iterator() {
                 return new BlockNodeIterator(BeginNode.this);
@@ -147,6 +149,7 @@
     }
 
     private class BlockNodeIterator implements Iterator<FixedNode> {
+
         private FixedNode current;
 
         public BlockNodeIterator(FixedNode next) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginStateSplitNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,9 +23,9 @@
 package com.oracle.graal.nodes;
 
 /**
- * Base class for {@link BeginNode}s that are associated with a frame state.
- * TODO (dnsimon) this not needed until {@link BeginNode} no longer implements {@link StateSplit}
- * which is not possible until loop peeling works without requiring begin nodes to have frames states
+ * Base class for {@link BeginNode}s that are associated with a frame state. TODO (dnsimon) this not
+ * needed until {@link BeginNode} no longer implements {@link StateSplit} which is not possible
+ * until loop peeling works without requiring begin nodes to have frames states
  */
 public abstract class BeginStateSplitNode extends BeginNode implements StateSplit {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BooleanNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BooleanNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
-
 public abstract class BooleanNode extends FloatingNode {
 
     public BooleanNode(Stamp stamp) {
@@ -39,7 +38,8 @@
     }
 
     /**
-     * Tells all usages of this node to negate their effect. For example, IfNodes should switch their true and false successors.
+     * Tells all usages of this node to negate their effect. For example, IfNodes should switch
+     * their true and false successors.
      */
     public void negateUsages() {
         for (Node n : usages().snapshot()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BreakpointNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,27 +27,26 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A node that results in a platform dependent breakpoint instruction being emitted.
- * A number of arguments can be associated with such a node for placing values of
- * interest in the Java ABI specified parameter locations corresponding to the
- * kinds of the values. That is, the arguments are set up as if the breakpoint instruction
- * was a call to a compiled Java method.
+ * A node that results in a platform dependent breakpoint instruction being emitted. A number of
+ * arguments can be associated with such a node for placing values of interest in the Java ABI
+ * specified parameter locations corresponding to the kinds of the values. That is, the arguments
+ * are set up as if the breakpoint instruction was a call to a compiled Java method.
  * <p>
  * A breakpoint is usually place by defining a node intrinsic method as follows:
+ * 
  * <pre>
  *     {@literal @}NodeIntrinsic(BreakpointNode.class)
  *     static void breakpoint(Object object, Word mark, Word value) {
  *          throw new GraalInternalError("");
  *     }
  * </pre>
- *
- * Note that the signature is arbitrary. It's sole purpose is to capture values you
- * may want to inspect in the native debugger when the breakpoint is hit.
+ * 
+ * Note that the signature is arbitrary. It's sole purpose is to capture values you may want to
+ * inspect in the native debugger when the breakpoint is hit.
  */
 public final class BreakpointNode extends FixedWithNextNode implements LIRLowerable {
 
-    @Input
-    public final NodeInputList<ValueNode> arguments;
+    @Input public final NodeInputList<ValueNode> arguments;
 
     public BreakpointNode(ValueNode... arguments) {
         super(StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code ConstantNode} represents a constant such as an integer value,
- * long, float, object reference, address, etc.
+ * The {@code ConstantNode} represents a constant such as an integer value, long, float, object
+ * reference, address, etc.
  */
 @NodeInfo(shortName = "Const", nameTemplate = "Const({p#rawvalue})")
 public class ConstantNode extends BooleanNode implements LIRLowerable {
@@ -46,6 +46,7 @@
 
     /**
      * Constructs a new ConstantNode representing the specified constant.
+     * 
      * @param value the constant
      */
     protected ConstantNode(Constant value, MetaAccessProvider runtime) {
@@ -76,6 +77,7 @@
 
     /**
      * Returns a node for a double constant.
+     * 
      * @param d the double value for which to create the instruction
      * @param graph
      * @return a node for a double constant
@@ -86,6 +88,7 @@
 
     /**
      * Returns a node for a float constant.
+     * 
      * @param f the float value for which to create the instruction
      * @param graph
      * @return a node for a float constant
@@ -96,6 +99,7 @@
 
     /**
      * Returns a node for an long constant.
+     * 
      * @param i the long value for which to create the instruction
      * @param graph
      * @return a node for an long constant
@@ -106,6 +110,7 @@
 
     /**
      * Returns a node for an integer constant.
+     * 
      * @param i the integer value for which to create the instruction
      * @param graph
      * @return a node for an integer constant
@@ -116,6 +121,7 @@
 
     /**
      * Returns a node for a boolean constant.
+     * 
      * @param i the boolean value for which to create the instruction
      * @param graph
      * @return a node representing the boolean
@@ -126,6 +132,7 @@
 
     /**
      * Returns a node for a byte constant.
+     * 
      * @param i the byte value for which to create the instruction
      * @param graph
      * @return a node representing the byte
@@ -136,6 +143,7 @@
 
     /**
      * Returns a node for a char constant.
+     * 
      * @param i the char value for which to create the instruction
      * @param graph
      * @return a node representing the char
@@ -146,6 +154,7 @@
 
     /**
      * Returns a node for a short constant.
+     * 
      * @param i the short value for which to create the instruction
      * @param graph
      * @return a node representing the short
@@ -156,6 +165,7 @@
 
     /**
      * Returns a node for an address (jsr/ret address) constant.
+     * 
      * @param i the address value for which to create the instruction
      * @param graph
      * @return a node representing the address
@@ -166,6 +176,7 @@
 
     /**
      * Returns a node for an object constant.
+     * 
      * @param o the object value for which to create the instruction
      * @param graph
      * @return a node representing the object
@@ -200,7 +211,7 @@
     }
 
     public static ConstantNode defaultForKind(Kind kind, Graph graph) {
-        switch(kind) {
+        switch (kind) {
             case Boolean:
                 return ConstantNode.forBoolean(false, graph);
             case Byte:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code ControlSplitNode} is a base class for all instructions that split the control flow (ie. have more than one successor).
+ * The {@code ControlSplitNode} is a base class for all instructions that split the control flow
+ * (ie. have more than one successor).
  */
 public abstract class ControlSplitNode extends FixedNode {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/DeoptimizeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,6 @@
     private final DeoptimizationReason reason;
     private final long leafGraphId;
 
-
     public DeoptimizeNode(DeoptimizationAction action, DeoptimizationReason reason) {
         this(action, reason, -1);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EndNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -50,7 +50,7 @@
     }
 
     @Override
-    public Iterable< ? extends Node> cfgSuccessors() {
+    public Iterable<? extends Node> cfgSuccessors() {
         return Arrays.asList(merge());
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/EntryMarkerNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,8 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * This node will be inserted at point specified by {@link StructuredGraph#getEntryBCI()}, usually by the graph builder.
+ * This node will be inserted at point specified by {@link StructuredGraph#getEntryBCI()}, usually
+ * by the graph builder.
  */
 public class EntryMarkerNode extends BeginNode implements Node.IterableNodeType, Simplifiable, LIRLowerable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedWithNextNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Base class of all nodes that are fixed within the control flow graph and have an immediate successor.
+ * Base class of all nodes that are fixed within the control flow graph and have an immediate
+ * successor.
  */
 public abstract class FixedWithNextNode extends FixedNode {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FrameState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,15 +28,14 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.iterators.*;
-import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
- * The {@code FrameState} class encapsulates the frame state (i.e. local variables and
- * operand stack) at a particular point in the abstract interpretation.
+ * The {@code FrameState} class encapsulates the frame state (i.e. local variables and operand
+ * stack) at a particular point in the abstract interpretation.
  */
 @NodeInfo(nameTemplate = "FrameState@{p#method/s}:{p#bci}")
-public final class FrameState extends VirtualState implements Node.IterableNodeType, LIRLowerable {
+public final class FrameState extends VirtualState implements Node.IterableNodeType {
 
     protected final int localsSize;
 
@@ -52,22 +51,20 @@
     public static final int UNKNOWN_BCI = -4;
 
     /**
-     * When a node whose frame state has this BCI value is inlined, its frame state
-     * will be replaced with the frame state before the inlined invoke node.
+     * When a node whose frame state has this BCI value is inlined, its frame state will be replaced
+     * with the frame state before the inlined invoke node.
      */
     public static final int BEFORE_BCI = -1;
 
     /**
-     * When a node whose frame state has this BCI value is inlined, its frame state
-     * will be replaced with the frame state {@linkplain Invoke#stateAfter() after}
-     * the inlined invoke node.
+     * When a node whose frame state has this BCI value is inlined, its frame state will be replaced
+     * with the frame state {@linkplain Invoke#stateAfter() after} the inlined invoke node.
      */
     public static final int AFTER_BCI = -2;
 
     /**
-     * When a node whose frame state has this BCI value is inlined, its frame state
-     * will be replaced with the frame state at the exception edge of the inlined
-     * invoke node.
+     * When a node whose frame state has this BCI value is inlined, its frame state will be replaced
+     * with the frame state at the exception edge of the inlined invoke node.
      */
     public static final int AFTER_EXCEPTION_BCI = -3;
 
@@ -85,14 +82,17 @@
     private final ResolvedJavaMethod method;
 
     /**
-     * Creates a {@code FrameState} for the given scope and maximum number of stack and local variables.
-     *
+     * Creates a {@code FrameState} for the given scope and maximum number of stack and local
+     * variables.
+     * 
      * @param method the method for this frame state
      * @param bci the bytecode index of the frame state
      * @param stackSize size of the stack
-     * @param rethrowException if true the VM should re-throw the exception on top of the stack when deopt'ing using this framestate
+     * @param rethrowException if true the VM should re-throw the exception on top of the stack when
+     *            deopt'ing using this framestate
      */
-    public FrameState(ResolvedJavaMethod method, int bci, List<ValueNode> values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall, List<EscapeObjectState> virtualObjectMappings) {
+    public FrameState(ResolvedJavaMethod method, int bci, List<ValueNode> values, int localsSize, int stackSize, boolean rethrowException, boolean duringCall,
+                    List<EscapeObjectState> virtualObjectMappings) {
         assert stackSize >= 0;
         assert (bci >= 0 && method != null) || (bci < 0 && method == null && values.isEmpty());
         this.method = method;
@@ -108,10 +108,11 @@
 
     /**
      * Simple constructor used to create marker FrameStates.
+     * 
      * @param bci marker bci, needs to be < 0
      */
     public FrameState(int bci) {
-        this(null, bci, Collections.<ValueNode>emptyList(), 0, 0, false, false, Collections.<EscapeObjectState>emptyList());
+        this(null, bci, Collections.<ValueNode> emptyList(), 0, 0, false, false, Collections.<EscapeObjectState> emptyList());
     }
 
     public FrameState(ResolvedJavaMethod method, int bci, ValueNode[] locals, List<ValueNode> stack, ValueNode[] locks, boolean rethrowException, boolean duringCall) {
@@ -202,8 +203,8 @@
     }
 
     /**
-     * Duplicates a FrameState, along with a deep copy of all connected VirtualState (outer FrameStates,
-     * VirtualObjectStates, ...).
+     * Duplicates a FrameState, along with a deep copy of all connected VirtualState (outer
+     * FrameStates, VirtualObjectStates, ...).
      */
     @Override
     public FrameState duplicateWithVirtualState() {
@@ -221,9 +222,9 @@
     }
 
     /**
-     * Creates a copy of this frame state with one stack element of type popKind popped from the stack and the
-     * values in pushedValues pushed on the stack. The pushedValues are expected to be in slot encoding: a long
-     * or double is followed by a null slot.
+     * Creates a copy of this frame state with one stack element of type popKind popped from the
+     * stack and the values in pushedValues pushed on the stack. The pushedValues are expected to be
+     * in slot encoding: a long or double is followed by a null slot.
      */
     public FrameState duplicateModified(int newBci, boolean newRethrowException, Kind popKind, ValueNode... pushedValues) {
         ArrayList<ValueNode> copy = new ArrayList<>(values.subList(0, localsSize + stackSize));
@@ -267,7 +268,7 @@
 
     /**
      * Gets the value in the local variables at the specified index.
-     *
+     * 
      * @param i the index into the locals
      * @return the instruction that produced the value for the specified local
      */
@@ -278,7 +279,7 @@
 
     /**
      * Get the value on the stack at the specified stack index.
-     *
+     * 
      * @param i the index into the stack, with {@code 0} being the bottom of the stack
      * @return the instruction at the specified position in the stack
      */
@@ -289,7 +290,7 @@
 
     /**
      * Get the monitor owner at the specified index.
-     *
+     * 
      * @param i the index into the list of locked monitors.
      * @return the lock owner at the given index.
      */
@@ -302,11 +303,6 @@
         return usages().filter(FrameState.class);
     }
 
-    @Override
-    public void generate(LIRGeneratorTool gen) {
-        // Nothing to do, frame states are processed as part of the handling of StateSplit nodes.
-    }
-
     private static String toString(FrameState frameState) {
         StringBuilder sb = new StringBuilder();
         String nl = CodeUtil.NEW_LINE;
@@ -346,7 +342,7 @@
     public Map<Object, Object> getDebugProperties(Map<Object, Object> map) {
         Map<Object, Object> properties = super.getDebugProperties(map);
         if (method != null) {
-            //properties.put("method", MetaUtil.format("%H.%n(%p):%r", method));
+            // properties.put("method", MetaUtil.format("%H.%n(%p):%r", method));
             StackTraceElement ste = method.asStackTraceElement(bci);
             if (ste.getFileName() != null && ste.getLineNumber() >= 0) {
                 properties.put("sourceFile", ste.getFileName());
@@ -367,7 +363,7 @@
     }
 
     @Override
-    public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) {
+    public void applyToNonVirtual(NodeClosure<? super ValueNode> closure) {
         for (ValueNode value : values.nonNull()) {
             closure.apply(this, value);
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,15 +30,16 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to a certain frame
- * state, they can move around freely and will always use the correct frame state when the nodes are scheduled (i.e.,
- * the last emitted frame state). The node that is guarded has a data dependency on the guard and the guard in turn has
- * a data dependency on the condition. A guard may only be executed if it is guaranteed that the guarded node is
- * executed too (if no exceptions are thrown). Therefore, an anchor is placed after a control
- * flow split and the guard has a data dependency to the anchor. The anchor is the most distant node that is
- * post-dominated by the guarded node and the guard can be scheduled anywhere between those two nodes. This ensures
- * maximum flexibility for the guard node and guarantees that deoptimization occurs only if the control flow would have
- * reached the guarded node (without taking exceptions into account).
+ * A guard is a node that deoptimizes based on a conditional expression. Guards are not attached to
+ * a certain frame state, they can move around freely and will always use the correct frame state
+ * when the nodes are scheduled (i.e., the last emitted frame state). The node that is guarded has a
+ * data dependency on the guard and the guard in turn has a data dependency on the condition. A
+ * guard may only be executed if it is guaranteed that the guarded node is executed too (if no
+ * exceptions are thrown). Therefore, an anchor is placed after a control flow split and the guard
+ * has a data dependency to the anchor. The anchor is the most distant node that is post-dominated
+ * by the guarded node and the guard can be scheduled anywhere between those two nodes. This ensures
+ * maximum flexibility for the guard node and guarantees that deoptimization occurs only if the
+ * control flow would have reached the guarded node (without taking exceptions into account).
  */
 @NodeInfo(nameTemplate = "Guard(!={p#negated}) {p#reason/s}")
 public final class GuardNode extends FloatingNode implements Canonicalizable, LIRLowerable, Node.IterableNodeType, Negatable {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,10 +35,11 @@
 import com.oracle.graal.nodes.util.*;
 
 /**
- * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome of a
- * comparison.
+ * The {@code IfNode} represents a branch that can go one of two directions depending on the outcome
+ * of a comparison.
  */
 public final class IfNode extends ControlSplitNode implements Simplifiable, LIRLowerable, Negatable {
+
     private final long leafGraphId;
     @Successor private BeginNode trueSuccessor;
     @Successor private BeginNode falseSuccessor;
@@ -74,7 +75,7 @@
 
     /**
      * Gets the true successor.
-     *
+     * 
      * @return the true successor
      */
     public BeginNode trueSuccessor() {
@@ -83,7 +84,7 @@
 
     /**
      * Gets the false successor.
-     *
+     * 
      * @return the false successor
      */
     public BeginNode falseSuccessor() {
@@ -102,7 +103,7 @@
 
     /**
      * Gets the node corresponding to the specified outcome of the branch.
-     *
+     * 
      * @param istrue {@code true} if the true successor is requested, {@code false} otherwise
      * @return the corresponding successor
      */
@@ -168,7 +169,7 @@
 
     /**
      * Tries to remove an empty if construct or replace an if construct with a materialization.
-     *
+     * 
      * @return true if a transformation was made, false otherwise
      */
     private boolean removeOrMaterializeIf(SimplifierTool tool) {
@@ -185,7 +186,8 @@
                 } else {
                     PhiNode singlePhi = phis.next();
                     if (!phis.hasNext()) {
-                        // one phi at the merge of an otherwise empty if construct: try to convert into a MaterializeNode
+                        // one phi at the merge of an otherwise empty if construct: try to convert
+                        // into a MaterializeNode
                         boolean inverted = trueEnd == merge.forwardEndAt(1);
                         ValueNode trueValue = singlePhi.valueAt(inverted ? 1 : 0);
                         ValueNode falseValue = singlePhi.valueAt(inverted ? 0 : 1);
@@ -209,9 +211,9 @@
     }
 
     /**
-     * Tries to connect code that initializes a variable directly with the successors of an if construct
-     * that switches on the variable. For example, the pseudo code below:
-     *
+     * Tries to connect code that initializes a variable directly with the successors of an if
+     * construct that switches on the variable. For example, the pseudo code below:
+     * 
      * <pre>
      * contains(list, e, yes, no) {
      *     if (list == null || e == null) {
@@ -232,7 +234,9 @@
      *     }
      * }
      * </pre>
+     * 
      * will be transformed into:
+     * 
      * <pre>
      * contains(list, e, yes, no) {
      *     if (list == null || e == null) {
@@ -248,7 +252,7 @@
      *     }
      * }
      * </pre>
-     *
+     * 
      * @return true if a transformation was made, false otherwise
      */
     private boolean removeIntermediateMaterialization(SimplifierTool tool) {
@@ -270,7 +274,8 @@
             return false;
         }
 
-        // Only consider merges with a single usage that is both a phi and an operand of the comparison
+        // Only consider merges with a single usage that is both a phi and an operand of the
+        // comparison
         NodeIterable<Node> mergeUsages = merge.usages();
         if (mergeUsages.count() != 1) {
             return false;
@@ -341,11 +346,11 @@
     }
 
     /**
-     * Connects a set of ends to a given successor, inserting a merge node if
-     * there is more than one end. If {@code ends} is empty, then {@code successor}
-     * is {@linkplain GraphUtil#killCFG(FixedNode) killed} otherwise it is added to {@code tool}'s
+     * Connects a set of ends to a given successor, inserting a merge node if there is more than one
+     * end. If {@code ends} is empty, then {@code successor} is
+     * {@linkplain GraphUtil#killCFG(FixedNode) killed} otherwise it is added to {@code tool}'s
      * {@linkplain SimplifierTool#addToWorkList(com.oracle.graal.graph.Node) work list}.
-     *
+     * 
      * @param oldMerge the merge being removed
      * @param phiValues the values of the phi at the merge, keyed by the merge ends
      */
@@ -362,7 +367,8 @@
                 oldMerge.removeEnd(end);
                 GraphUtil.killCFG(end);
             } else {
-                // Need a new phi in case the frame state is used by more than the merge being removed
+                // Need a new phi in case the frame state is used by more than the merge being
+                // removed
                 MergeNode newMerge = graph().add(new MergeNode());
                 PhiNode oldPhi = (PhiNode) oldMerge.usages().first();
                 PhiNode newPhi = graph().add(new PhiNode(oldPhi.stamp(), newMerge));
@@ -392,11 +398,12 @@
     }
 
     /**
-     * Gets an array of constants derived from a node that is either a {@link ConstantNode}
-     * or a {@link PhiNode} whose input values are all constants. The length of the returned
-     * array is equal to the number of ends terminating in a given merge node.
-     *
-     * @return null if {@code node} is neither a {@link ConstantNode} nor a {@link PhiNode} whose input values are all constants
+     * Gets an array of constants derived from a node that is either a {@link ConstantNode} or a
+     * {@link PhiNode} whose input values are all constants. The length of the returned array is
+     * equal to the number of ends terminating in a given merge node.
+     * 
+     * @return null if {@code node} is neither a {@link ConstantNode} nor a {@link PhiNode} whose
+     *         input values are all constants
      */
     private static Constant[] constantValues(ValueNode node, MergeNode merge) {
         if (node.isConstant()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,7 +35,7 @@
  * The {@code InvokeNode} represents all kinds of method calls.
  */
 @NodeInfo(nameTemplate = "Invoke#{p#targetMethod/s}")
-public final class InvokeNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Invoke, LIRLowerable, MemoryCheckpoint  {
+public final class InvokeNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Invoke, LIRLowerable, MemoryCheckpoint {
 
     @Input private final CallTargetNode callTarget;
     private final int bci;
@@ -46,7 +46,7 @@
 
     /**
      * Constructs a new Invoke instruction.
-     *
+     * 
      * @param bci the bytecode index of the original invoke (used for debug infos)
      * @param callTarget the target method being called
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/InvokeWithExceptionNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
 
 @NodeInfo(nameTemplate = "Invoke!#{p#targetMethod/s}")
 public class InvokeWithExceptionNode extends ControlSplitNode implements Node.IterableNodeType, Invoke, MemoryCheckpoint, LIRLowerable {
+
     @Successor private BeginNode next;
     @Successor private DispatchBeginNode exceptionEdge;
     @Input private final CallTargetNode callTarget;
@@ -217,6 +218,7 @@
     }
 
     private static final double EXCEPTION_PROBA = 1e-5;
+
     @Override
     public double probability(BeginNode successor) {
         return successor == next ? 1 - EXCEPTION_PROBA : EXCEPTION_PROBA;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LocalNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LocalNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,7 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code Local} instruction is a placeholder for an incoming argument
- * to a function call.
+ * The {@code Local} instruction is a placeholder for an incoming argument to a function call.
  */
 @NodeInfo(nameTemplate = "Local({p#index})")
 public final class LocalNode extends FloatingNode implements Node.IterableNodeType {
@@ -42,6 +41,7 @@
 
     /**
      * Gets the index of this local in the array of parameters. This is NOT the JVM local index.
+     * 
      * @return the index
      */
     public int index() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 import com.oracle.graal.graph.iterators.*;
 import com.oracle.graal.nodes.spi.*;
 
+public class LoopBeginNode extends MergeNode implements Node.IterableNodeType, LIRLowerable {
 
-public class LoopBeginNode extends MergeNode implements Node.IterableNodeType, LIRLowerable {
     private double loopFrequency;
     private int nextEndIndex;
     private int unswitches;
@@ -49,8 +49,10 @@
     }
 
     /**
-     * Returns the <b>unordered</b> set of {@link LoopEndNode} that correspond to back-edges for this loop.
-     * The order of the back-edges is unspecified, if you need to get an ordering compatible for {@link PhiNode} creation, use {@link #orderedLoopEnds()}.
+     * Returns the <b>unordered</b> set of {@link LoopEndNode} that correspond to back-edges for
+     * this loop. The order of the back-edges is unspecified, if you need to get an ordering
+     * compatible for {@link PhiNode} creation, use {@link #orderedLoopEnds()}.
+     * 
      * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop
      */
     public NodeIterable<LoopEndNode> loopEnds() {
@@ -67,13 +69,16 @@
     }
 
     /**
-     * Returns the set of {@link LoopEndNode} that correspond to back-edges for this loop, ordered in increasing {@link #phiPredecessorIndex}.
-     * This method is suited to create new loop {@link PhiNode}.
+     * Returns the set of {@link LoopEndNode} that correspond to back-edges for this loop, ordered
+     * in increasing {@link #phiPredecessorIndex}. This method is suited to create new loop
+     * {@link PhiNode}.
+     * 
      * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop
      */
     public List<LoopEndNode> orderedLoopEnds() {
         List<LoopEndNode> snapshot = loopEnds().snapshot();
         Collections.sort(snapshot, new Comparator<LoopEndNode>() {
+
             @Override
             public int compare(LoopEndNode o1, LoopEndNode o2) {
                 return o1.endIndex() - o2.endIndex();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopEndNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.spi.*;
 
-
 public final class LoopEndNode extends EndNode {
 
     @Input(notDataflow = true) private LoopBeginNode loopBegin;
@@ -56,7 +55,6 @@
         this.loopBegin = x;
     }
 
-
     public void disableSafepoint() {
         this.canSafepoint = false;
     }
@@ -82,9 +80,10 @@
     }
 
     /**
-     * Returns the 0-based index of this loop end. This is <b>not</b> the index into {@link PhiNode} values at the loop
-     * begin. Use {@link MergeNode#phiPredecessorIndex(EndNode)} for this purpose.
-     *
+     * Returns the 0-based index of this loop end. This is <b>not</b> the index into {@link PhiNode}
+     * values at the loop begin. Use {@link MergeNode#phiPredecessorIndex(EndNode)} for this
+     * purpose.
+     * 
      * @return The 0-based index of this loop end.
      */
     public int endIndex() {
@@ -96,7 +95,7 @@
     }
 
     @Override
-    public Iterable< ? extends Node> cfgSuccessors() {
+    public Iterable<? extends Node> cfgSuccessors() {
         return Collections.emptyList();
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopExitNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,9 @@
 import com.oracle.graal.nodes.spi.*;
 
 public class LoopExitNode extends BeginStateSplitNode {
+
     @Input(notDataflow = true) private LoopBeginNode loopBegin;
+
     public LoopExitNode(LoopBeginNode loop) {
         assert loop != null;
         loopBegin = loop;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/MergeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -65,7 +65,7 @@
 
     /**
      * Determines if a given node is a phi whose {@linkplain PhiNode#merge() merge} is this node.
-     *
+     * 
      * @param value the instruction to test
      * @return {@code true} if {@code value} is a phi and its merge is {@code this}
      */
@@ -74,7 +74,9 @@
     }
 
     /**
-     * Removes the given end from the merge, along with the entries corresponding to this end in the phis connected to the merge.
+     * Removes the given end from the merge, along with the entries corresponding to this end in the
+     * phis connected to the merge.
+     * 
      * @param pred the end to remove
      */
     public void removeEnd(EndNode pred) {
@@ -119,6 +121,7 @@
 
     public NodeIterable<PhiNode> phis() {
         return this.usages().filter(PhiNode.class).filter(new NodePredicate() {
+
             @Override
             public boolean apply(Node n) {
                 return ((PhiNode) n).merge() == MergeNode.this;
@@ -129,6 +132,7 @@
     @Override
     public NodeIterable<Node> anchored() {
         return super.anchored().filter(isNotA(PhiNode.class).or(new NodePredicate() {
+
             @Override
             public boolean apply(Node n) {
                 return ((PhiNode) n).merge() != MergeNode.this;
@@ -145,7 +149,8 @@
             if (merge instanceof LoopBeginNode && !(origLoopEnd instanceof LoopEndNode)) {
                 return;
             }
-            // in order to move anchored values to the other merge we would need to check if the anchors are used by phis of the other merge
+            // in order to move anchored values to the other merge we would need to check if the
+            // anchors are used by phis of the other merge
             if (this.anchored().isNotEmpty()) {
                 return;
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,16 +29,15 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code PhiNode} represents the merging of dataflow in the graph. It refers to a merge
- * and a variable.
+ * The {@code PhiNode} represents the merging of dataflow in the graph. It refers to a merge and a
+ * variable.
  */
 @NodeInfo(nameTemplate = "{p#type/s}Phi({i#values})")
 public final class PhiNode extends FloatingNode implements Canonicalizable, Node.IterableNodeType {
 
     public static enum PhiType {
         Value(null), // normal value phis
-        Guard(StampFactory.dependency()),
-        Memory(StampFactory.dependency());
+        Guard(StampFactory.dependency()), Memory(StampFactory.dependency());
 
         public final Stamp stamp;
 
@@ -53,6 +52,7 @@
 
     /**
      * Create a value phi ({@link PhiType#Value}) with the specified kind.
+     * 
      * @param kind the kind of the value
      * @param merge the merge that the new phi belongs to
      */
@@ -69,6 +69,7 @@
 
     /**
      * Create a non-value phi ({@link PhiType#Memory} with the specified kind.
+     * 
      * @param type the type of the new phi
      * @param merge the merge that the new phi belongs to
      */
@@ -122,8 +123,9 @@
     }
 
     /**
-     * Get the instruction that produces the value associated with the i'th predecessor of the merge.
-     *
+     * Get the instruction that produces the value associated with the i'th predecessor of the
+     * merge.
+     * 
      * @param i the index of the predecessor
      * @return the instruction that produced the value in the i'th predecessor
      */
@@ -133,6 +135,7 @@
 
     /**
      * Sets the value at the given index and makes sure that the values list is large enough.
+     * 
      * @param i the index at which to set the value
      * @param x the new phi input value for the given location
      */
@@ -153,7 +156,7 @@
 
     /**
      * Get the number of inputs to this phi (i.e. the number of predecessors to the merge).
-     *
+     * 
      * @return the number of inputs in this phi
      */
     public int valueCount() {
@@ -185,7 +188,7 @@
     }
 
     public void addInput(ValueNode x) {
-        assert !(x instanceof PhiNode) || ((PhiNode) x).merge() instanceof LoopBeginNode ||  ((PhiNode) x).merge() != this.merge();
+        assert !(x instanceof PhiNode) || ((PhiNode) x).merge() instanceof LoopBeginNode || ((PhiNode) x).merge() != this.merge();
         values.add(x);
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PiNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,12 +25,10 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
- * A node that changes the type of its input, usually narrowing it.
- * For example, a PI node refines the type of a receiver during
- * type-guarded inlining to be the type tested by the guard.
+ * A node that changes the type of its input, usually narrowing it. For example, a PI node refines
+ * the type of a receiver during type-guarded inlining to be the type tested by the guard.
  */
 public class PiNode extends FloatingNode implements LIRLowerable, Virtualizable {
 
@@ -59,7 +57,8 @@
     @Override
     public boolean inferStamp() {
         if (object().objectStamp().alwaysNull() && objectStamp().nonNull()) {
-            // a null value flowing into a nonNull PiNode should be guarded by a type/isNull guard, but the
+            // a null value flowing into a nonNull PiNode should be guarded by a type/isNull guard,
+            // but the
             // compiler might see this situation before the branch is deleted
             return false;
         }
@@ -68,9 +67,9 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            tool.replaceWithVirtual(virtual);
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            tool.replaceWithVirtual(state.getVirtualObject());
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,8 +36,9 @@
 
     /**
      * Constructs a new Return instruction.
-     *
-     * @param result the instruction producing the result for this return; {@code null} if this is a void return
+     * 
+     * @param result the instruction producing the result for this return; {@code null} if this is a
+     *            void return
      */
     public ReturnNode(ValueNode result) {
         super(StampFactory.forVoid());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StartNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,6 +27,6 @@
 /**
  * The start node of a graph.
  */
-public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint{
+public class StartNode extends BeginStateSplitNode implements MemoryCheckpoint {
 
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StateSplit.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StateSplit.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,9 +38,9 @@
     void setStateAfter(FrameState x);
 
     /**
-     * Determines if this node has a side-effect. Execution of such a node changes
-     * state visible to other threads. These nodes denote boundaries across which deoptimization
-     * points cannot be moved.
+     * Determines if this node has a side-effect. Execution of such a node changes state visible to
+     * other threads. These nodes denote boundaries across which deoptimization points cannot be
+     * moved.
      */
     boolean hasSideEffect();
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,10 +31,9 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.util.*;
 
-
 /**
- * A graph that contains at least one distinguished node : the {@link #start() start} node.
- * This node is the start of the control flow of the graph.
+ * A graph that contains at least one distinguished node : the {@link #start() start} node. This
+ * node is the start of the control flow of the graph.
  */
 public class StructuredGraph extends Graph {
 
@@ -140,6 +139,7 @@
     public Iterable<Invoke> getInvokes() {
         final Iterator<MethodCallTargetNode> callTargets = getNodes(MethodCallTargetNode.class).iterator();
         return new Iterable<Invoke>() {
+
             private Invoke next;
 
             @Override
@@ -196,9 +196,9 @@
     }
 
     /**
-     * Unlinks a node from all its control flow neighbours and then removes it from its graph.
-     * The node must have no {@linkplain Node#usages() usages}.
-     *
+     * Unlinks a node from all its control flow neighbours and then removes it from its graph. The
+     * node must have no {@linkplain Node#usages() usages}.
+     * 
      * @param node the node to be unlinked and removed
      */
     public void removeFixed(FixedWithNextNode node) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/UnwindNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,7 +30,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Unwind takes an exception object, destroys the current stack frame and passes the exception object to the system's exception dispatch code.
+ * 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 {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,8 +32,8 @@
 import com.oracle.graal.nodes.util.*;
 
 /**
- * This class represents a value within the graph, including local variables, phis, and
- * all other instructions.
+ * This class represents a value within the graph, including local variables, phis, and all other
+ * instructions.
  */
 public abstract class ValueNode extends ScheduledNode implements StampProvider {
 
@@ -76,9 +76,10 @@
     }
 
     /**
-     * Checks if the given stamp is different than the current one ({@code newStamp.equals(oldStamp) == false}). If it
-     * is different then the new stamp will become the current stamp for this node.
-     *
+     * Checks if the given stamp is different than the current one (
+     * {@code newStamp.equals(oldStamp) == false}). If it is different then the new stamp will
+     * become the current stamp for this node.
+     * 
      * @return true if the stamp has changed, false otherwise.
      */
     protected final boolean updateStamp(Stamp newStamp) {
@@ -91,10 +92,11 @@
     }
 
     /**
-     * This method can be overridden by subclasses of {@link ValueNode} if they need to recompute their stamp if their
-     * inputs change. A typical implementation will compute the stamp and pass it to {@link #updateStamp(Stamp)}, whose
-     * return value can be used as the result of this method.
-     *
+     * This method can be overridden by subclasses of {@link ValueNode} if they need to recompute
+     * their stamp if their inputs change. A typical implementation will compute the stamp and pass
+     * it to {@link #updateStamp(Stamp)}, whose return value can be used as the result of this
+     * method.
+     * 
      * @return true if the stamp has changed, false otherwise.
      */
     public boolean inferStamp() {
@@ -107,7 +109,7 @@
 
     /**
      * Checks whether this value is a constant (i.e. it is of type {@link ConstantNode}.
-     *
+     * 
      * @return {@code true} if this value is a constant
      */
     public final boolean isConstant() {
@@ -115,6 +117,7 @@
     }
 
     private static final NodePredicate IS_CONSTANT = new NodePredicate() {
+
         @Override
         public boolean apply(Node n) {
             return n instanceof ValueNode && ((ValueNode) n).isConstant();
@@ -127,7 +130,7 @@
 
     /**
      * Checks whether this value represents the null constant.
-     *
+     * 
      * @return {@code true} if this value represents the null constant
      */
     public final boolean isNullConstant() {
@@ -136,8 +139,9 @@
 
     /**
      * Convert this value to a constant if it is a constant, otherwise return null.
-     *
-     * @return the {@link Constant} represented by this value if it is a constant; {@code null} otherwise
+     * 
+     * @return the {@link Constant} represented by this value if it is a constant; {@code null}
+     *         otherwise
      */
     public final Constant asConstant() {
         if (this instanceof ConstantNode) {
@@ -148,8 +152,8 @@
 
     public <T extends Stamp> boolean verifyStamp(Class<T> stampClass) {
         assert stamp() != null;
-        assert stampClass.isInstance(stamp()) : this + " (" + GraphUtil.approxSourceLocation(this) + ") has unexpected stamp type: expected " + stampClass.getName() +
-            ", got " + stamp().getClass().getName() + ", usages=" + usages();
+        assert stampClass.isInstance(stamp()) : this + " (" + GraphUtil.approxSourceLocation(this) + ") has unexpected stamp type: expected " + stampClass.getName() + ", got " +
+                        stamp().getClass().getName() + ", usages=" + usages();
         return true;
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueNodeUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.graph.Node.Verbosity;
 
-
 public class ValueNodeUtil {
 
     public static ValueNode assertKind(Kind kind, ValueNode x) {
@@ -82,7 +81,6 @@
         return y == null || x == null || x.kind() != y.kind();
     }
 
-
     @SuppressWarnings("unchecked")
     public static <T extends Node> Collection<T> filter(Iterable<Node> nodes, Class<T> clazz) {
         ArrayList<T> phis = new ArrayList<>();
@@ -95,11 +93,12 @@
     }
 
     /**
-     * Converts a given instruction to a value string. The representation of an node as
-     * a value is formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character} denoting its
-     * {@linkplain ValueNode#kind kind} and its id. For example, {@code "i13"}.
-     *
-     * @param value the instruction to convert to a value string. If {@code value == null}, then "-" is returned.
+     * Converts a given instruction to a value string. The representation of an node as a value is
+     * formed by concatenating the {@linkplain com.oracle.graal.api.meta.Kind#getTypeChar character}
+     * denoting its {@linkplain ValueNode#kind kind} and its id. For example, {@code "i13"}.
+     * 
+     * @param value the instruction to convert to a value string. If {@code value == null}, then "-"
+     *            is returned.
      * @return the instruction representation as a string
      */
     public static String valueString(ValueNode value) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ValueProxyNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,14 +28,14 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
- * A value proxy that is inserted in the frame state of a loop exit for any value that is
- * created inside the loop (i.e. was not live on entry to the loop) and is (potentially)
- * used after the loop.
+ * A value proxy that is inserted in the frame state of a loop exit for any value that is created
+ * inside the loop (i.e. was not live on entry to the loop) and is (potentially) used after the
+ * loop.
  */
 public class ValueProxyNode extends FloatingNode implements Node.IterableNodeType, ValueNumberable, Canonicalizable, Virtualizable {
+
     @Input(notDataflow = true) private BeginNode proxyPoint;
     @Input private ValueNode value;
     private final PhiType type;
@@ -87,9 +87,9 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(value());
-        if (virtual != null) {
-            tool.replaceWithVirtual(virtual);
+        State state = tool.getObjectState(value);
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            tool.replaceWithVirtual(state.getVirtualObject());
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/VirtualState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,10 +31,12 @@
 public abstract class VirtualState extends Node {
 
     public interface NodeClosure<T extends Node> {
+
         void apply(Node usage, T node);
     }
 
     public interface VirtualClosure {
+
         void apply(VirtualState node);
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ArithmeticNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ArithmeticNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,8 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction, etc.
+ * The {@code ArithmeticOp} class represents arithmetic operations such as addition, subtraction,
+ * etc.
  */
 public abstract class ArithmeticNode extends BinaryNode {
 
@@ -34,6 +35,7 @@
 
     /**
      * Creates a new arithmetic operation.
+     * 
      * @param kind the result kind of the operation
      * @param x the first input instruction
      * @param y the second input instruction
@@ -46,6 +48,7 @@
 
     /**
      * Checks whether this instruction has strict fp semantics.
+     * 
      * @return {@code true} if this instruction has strict fp semantics
      */
     public boolean isStrictFP() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/BinaryNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -46,6 +46,7 @@
 
     /**
      * Creates a new BinaryNode instance.
+     * 
      * @param kind the result type of this instruction
      * @param x the first input instruction
      * @param y the second input instruction
@@ -57,33 +58,33 @@
     }
 
     public enum ReassociateMatch {
-        x,
-        y;
+        x, y;
 
         public ValueNode getValue(BinaryNode binary) {
-            switch(this) {
+            switch (this) {
                 case x:
                     return binary.x();
                 case y:
                     return binary.y();
-                default: throw GraalInternalError.shouldNotReachHere();
+                default:
+                    throw GraalInternalError.shouldNotReachHere();
             }
         }
 
         public ValueNode getOtherValue(BinaryNode binary) {
-            switch(this) {
+            switch (this) {
                 case x:
                     return binary.y();
                 case y:
                     return binary.x();
-                default: throw GraalInternalError.shouldNotReachHere();
+                default:
+                    throw GraalInternalError.shouldNotReachHere();
             }
         }
     }
 
     public static boolean canTryReassociate(BinaryNode node) {
-        return node instanceof IntegerAddNode || node instanceof IntegerSubNode || node instanceof IntegerMulNode
-                        || node instanceof AndNode || node instanceof OrNode || node instanceof XorNode;
+        return node instanceof IntegerAddNode || node instanceof IntegerSubNode || node instanceof IntegerMulNode || node instanceof AndNode || node instanceof OrNode || node instanceof XorNode;
     }
 
     public static ReassociateMatch findReassociate(BinaryNode binary, NodePredicate criterion) {
@@ -98,22 +99,19 @@
         return null;
     }
 
-    /* In reassociate, complexity comes from the handling of IntegerSub (non commutative) which can be mixed with IntegerAdd.
-     * if first tries to find m1, m2 which match the criterion :
-     * (a o m2) o m1
-     * (m2 o a) o m1
-     * m1 o (a o m2)
-     * m1 o (m2 o a)
-     * It then produces 4 boolean for the -/+ case
-     *  invertA : should the final expression be like *-a (rather than a+*)
-     *  aSub : should the final expression be like a-* (rather than a+*)
-     *  invertM1 : should the final expression contain -m1
-     *  invertM2 : should the final expression contain -m2
+    /*
+     * In reassociate, complexity comes from the handling of IntegerSub (non commutative) which can
+     * be mixed with IntegerAdd. if first tries to find m1, m2 which match the criterion : (a o m2)
+     * o m1 (m2 o a) o m1 m1 o (a o m2) m1 o (m2 o a) It then produces 4 boolean for the -/+ case
+     * invertA : should the final expression be like *-a (rather than a+*) aSub : should the final
+     * expression be like a-* (rather than a+*) invertM1 : should the final expression contain -m1
+     * invertM2 : should the final expression contain -m2
      */
     /**
-     * Tries to re-associate values which satisfy the criterion.
-     * For example with a constantness criterion : (a + 2) + 1 => a + (1 + 2)<br>
-     * This method accepts only reassociable operations (see {@linkplain #canTryReassociate(BinaryNode)}) such as +, -, *, &, | and ^
+     * Tries to re-associate values which satisfy the criterion. For example with a constantness
+     * criterion : (a + 2) + 1 => a + (1 + 2)<br>
+     * This method accepts only reassociable operations (see
+     * {@linkplain #canTryReassociate(BinaryNode)}) such as +, -, *, &, | and ^
      */
     public static BinaryNode reassociate(BinaryNode node, NodePredicate criterion) {
         assert canTryReassociate(node);
@@ -139,7 +137,7 @@
             return node;
         }
         boolean invertA = false;
-        boolean aSub =  false;
+        boolean aSub = false;
         boolean invertM1 = false;
         boolean invertM2 = false;
         if (addSub) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -49,7 +49,7 @@
 
     /**
      * Constructs a new Compare instruction.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
@@ -62,14 +62,14 @@
 
     /**
      * Gets the condition (comparison operation) for this instruction.
-     *
+     * 
      * @return the condition
      */
     public abstract Condition condition();
 
     /**
      * Checks whether unordered inputs mean true or false (only applies to float operations).
-     *
+     * 
      * @return {@code true} if unordered inputs produce true
      */
     public abstract boolean unorderedIsTrue();
@@ -78,7 +78,6 @@
     public void generate(LIRGeneratorTool gen) {
     }
 
-
     private ValueNode optimizeConditional(Constant constant, ConditionalNode conditionalNode, MetaAccessProvider runtime, Condition cond) {
         Constant trueConstant = conditionalNode.trueValue().asConstant();
         Constant falseConstant = conditionalNode.falseValue().asConstant();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java	Fri Feb 01 17:06:26 2013 +0100
@@ -88,97 +88,149 @@
 
     public boolean check(int left, int right) {
         switch (this) {
-            case EQ: return left == right;
-            case NE: return left != right;
-            case LT: return left < right;
-            case LE: return left <= right;
-            case GT: return left > right;
-            case GE: return left >= right;
-            case AE: return UnsignedMath.aboveOrEqual(left, right);
-            case BE: return UnsignedMath.belowOrEqual(left, right);
-            case AT: return UnsignedMath.aboveThan(left, right);
-            case BT: return UnsignedMath.belowThan(left, right);
-        }
-        throw new IllegalArgumentException(this.toString());
-    }
-
-    /**
-     * Given a condition and its negation, this method returns true for one of the two and false for the other one.
-     * This can be used to keep comparisons in a canonical form.
-     * @return true if this condition is considered to be the canonical form, false otherwise.
-     */
-    public boolean isCanonical() {
-        switch (this) {
-            case EQ: return true;
-            case NE: return false;
-            case LT: return true;
-            case LE: return false;
-            case GT: return false;
-            case GE: return false;
-            case BT: return true;
-            case BE: return false;
-            case AT: return false;
-            case AE: return false;
+            case EQ:
+                return left == right;
+            case NE:
+                return left != right;
+            case LT:
+                return left < right;
+            case LE:
+                return left <= right;
+            case GT:
+                return left > right;
+            case GE:
+                return left >= right;
+            case AE:
+                return UnsignedMath.aboveOrEqual(left, right);
+            case BE:
+                return UnsignedMath.belowOrEqual(left, right);
+            case AT:
+                return UnsignedMath.aboveThan(left, right);
+            case BT:
+                return UnsignedMath.belowThan(left, right);
         }
         throw new IllegalArgumentException(this.toString());
     }
 
     /**
-     * Returns true if the condition needs to be mirrored to get to a canonical condition.
-     * The result of the mirroring operation might still need to be negated to achieve a canonical form.
+     * Given a condition and its negation, this method returns true for one of the two and false for
+     * the other one. This can be used to keep comparisons in a canonical form.
+     * 
+     * @return true if this condition is considered to be the canonical form, false otherwise.
      */
-    public boolean canonicalMirror() {
+    public boolean isCanonical() {
         switch (this) {
-            case EQ: return false;
-            case NE: return false;
-            case LT: return false;
-            case LE: return true;
-            case GT: return true;
-            case GE: return false;
-            case BT: return false;
-            case BE: return true;
-            case AT: return true;
-            case AE: return false;
+            case EQ:
+                return true;
+            case NE:
+                return false;
+            case LT:
+                return true;
+            case LE:
+                return false;
+            case GT:
+                return false;
+            case GE:
+                return false;
+            case BT:
+                return true;
+            case BE:
+                return false;
+            case AT:
+                return false;
+            case AE:
+                return false;
         }
         throw new IllegalArgumentException(this.toString());
     }
 
     /**
-     * Returns true if the condition needs to be negated to get to a canonical condition.
-     * The result of the negation might still need to be mirrored to achieve a canonical form.
+     * Returns true if the condition needs to be mirrored to get to a canonical condition. The
+     * result of the mirroring operation might still need to be negated to achieve a canonical form.
+     */
+    public boolean canonicalMirror() {
+        switch (this) {
+            case EQ:
+                return false;
+            case NE:
+                return false;
+            case LT:
+                return false;
+            case LE:
+                return true;
+            case GT:
+                return true;
+            case GE:
+                return false;
+            case BT:
+                return false;
+            case BE:
+                return true;
+            case AT:
+                return true;
+            case AE:
+                return false;
+        }
+        throw new IllegalArgumentException(this.toString());
+    }
+
+    /**
+     * Returns true if the condition needs to be negated to get to a canonical condition. The result
+     * of the negation might still need to be mirrored to achieve a canonical form.
      */
     public boolean canonicalNegate() {
         switch (this) {
-            case EQ: return false;
-            case NE: return true;
-            case LT: return false;
-            case LE: return true;
-            case GT: return false;
-            case GE: return true;
-            case BT: return false;
-            case BE: return true;
-            case AT: return false;
-            case AE: return true;
+            case EQ:
+                return false;
+            case NE:
+                return true;
+            case LT:
+                return false;
+            case LE:
+                return true;
+            case GT:
+                return false;
+            case GE:
+                return true;
+            case BT:
+                return false;
+            case BE:
+                return true;
+            case AT:
+                return false;
+            case AE:
+                return true;
         }
         throw new IllegalArgumentException(this.toString());
     }
 
     /**
      * Negate this conditional.
+     * 
      * @return the condition that represents the negation
      */
     public final Condition negate() {
         switch (this) {
-            case EQ: return NE;
-            case NE: return EQ;
-            case LT: return GE;
-            case LE: return GT;
-            case GT: return LE;
-            case GE: return LT;
-            case BT: return AE;
-            case BE: return AT;
-            case AT: return BE;
-            case AE: return BT;
+            case EQ:
+                return NE;
+            case NE:
+                return EQ;
+            case LT:
+                return GE;
+            case LE:
+                return GT;
+            case GT:
+                return LE;
+            case GE:
+                return LT;
+            case BT:
+                return AE;
+            case BE:
+                return AT;
+            case AT:
+                return BE;
+            case AE:
+                return BT;
         }
         throw new IllegalArgumentException(this.toString());
     }
@@ -188,42 +240,64 @@
             return true;
         }
         switch (this) {
-            case EQ: return other == LE || other == GE || other == BE || other == AE;
-            case NE: return false;
-            case LT: return other == LE || other == NE;
-            case LE: return false;
-            case GT: return other == GE || other == NE;
-            case GE: return false;
-            case BT: return other == BE || other == NE;
-            case BE: return false;
-            case AT: return other == AE || other == NE;
-            case AE: return false;
+            case EQ:
+                return other == LE || other == GE || other == BE || other == AE;
+            case NE:
+                return false;
+            case LT:
+                return other == LE || other == NE;
+            case LE:
+                return false;
+            case GT:
+                return other == GE || other == NE;
+            case GE:
+                return false;
+            case BT:
+                return other == BE || other == NE;
+            case BE:
+                return false;
+            case AT:
+                return other == AE || other == NE;
+            case AE:
+                return false;
         }
         throw new IllegalArgumentException(this.toString());
     }
 
     /**
      * Mirror this conditional (i.e. commute "a op b" to "b op' a")
+     * 
      * @return the condition representing the equivalent commuted operation
      */
     public final Condition mirror() {
         switch (this) {
-            case EQ: return EQ;
-            case NE: return NE;
-            case LT: return GT;
-            case LE: return GE;
-            case GT: return LT;
-            case GE: return LE;
-            case BT: return AT;
-            case BE: return AE;
-            case AT: return BT;
-            case AE: return BE;
+            case EQ:
+                return EQ;
+            case NE:
+                return NE;
+            case LT:
+                return GT;
+            case LE:
+                return GE;
+            case GT:
+                return LT;
+            case GE:
+                return LE;
+            case BT:
+                return AT;
+            case BE:
+                return AE;
+            case AT:
+                return BT;
+            case AE:
+                return BE;
         }
         throw new IllegalArgumentException();
     }
 
     /**
-     * Returns true if this condition represents an unsigned comparison. EQ and NE are not considered to be unsigned.
+     * Returns true if this condition represents an unsigned comparison. EQ and NE are not
+     * considered to be unsigned.
      */
     public final boolean isUnsigned() {
         return this == Condition.BT || this == Condition.BE || this == Condition.AT || this == Condition.AE;
@@ -231,6 +305,7 @@
 
     /**
      * Checks if this conditional operation is commutative.
+     * 
      * @return {@code true} if this operation is commutative
      */
     public final boolean isCommutative() {
@@ -239,12 +314,12 @@
 
     /**
      * Attempts to fold a comparison between two constants and return the result.
-     *
+     * 
      * @param lt the constant on the left side of the comparison
      * @param rt the constant on the right side of the comparison
      * @param runtime needed to compare runtime-specific types
-     * @return {@link Boolean#TRUE} if the comparison is known to be true,
-     * {@link Boolean#FALSE} if the comparison is known to be false
+     * @return {@link Boolean#TRUE} if the comparison is known to be true, {@link Boolean#FALSE} if
+     *         the comparison is known to be false
      */
     public boolean foldCondition(Constant lt, Constant rt, CodeCacheProvider runtime) {
         assert lt.getKind() != Kind.Double && lt.getKind() != Kind.Float && rt.getKind() != Kind.Double && rt.getKind() != Kind.Float;
@@ -253,12 +328,13 @@
 
     /**
      * Attempts to fold a comparison between two constants and return the result.
-     *
+     * 
      * @param lt the constant on the left side of the comparison
      * @param rt the constant on the right side of the comparison
      * @param runtime needed to compare runtime-specific types
      * @param unorderedIsTrue true if an undecided float comparison should result in "true"
-     * @return true if the comparison is known to be true, false if the comparison is known to be false
+     * @return true if the comparison is known to be true, false if the comparison is known to be
+     *         false
      */
     public boolean foldCondition(Constant lt, Constant rt, MetaAccessProvider runtime, boolean unorderedIsTrue) {
         switch (lt.getKind()) {
@@ -271,41 +347,66 @@
                 int x = lt.asInt();
                 int y = rt.asInt();
                 switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                    case AE: return UnsignedMath.aboveOrEqual(x, y);
-                    case BE: return UnsignedMath.belowOrEqual(x, y);
-                    case AT: return UnsignedMath.aboveThan(x, y);
-                    case BT: return UnsignedMath.belowThan(x, y);
-                    default: throw new GraalInternalError("expected condition: %s", this);
+                    case EQ:
+                        return x == y;
+                    case NE:
+                        return x != y;
+                    case LT:
+                        return x < y;
+                    case LE:
+                        return x <= y;
+                    case GT:
+                        return x > y;
+                    case GE:
+                        return x >= y;
+                    case AE:
+                        return UnsignedMath.aboveOrEqual(x, y);
+                    case BE:
+                        return UnsignedMath.belowOrEqual(x, y);
+                    case AT:
+                        return UnsignedMath.aboveThan(x, y);
+                    case BT:
+                        return UnsignedMath.belowThan(x, y);
+                    default:
+                        throw new GraalInternalError("expected condition: %s", this);
                 }
             }
             case Long: {
                 long x = lt.asLong();
                 long y = rt.asLong();
                 switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                    case AE: return UnsignedMath.aboveOrEqual(x, y);
-                    case BE: return UnsignedMath.belowOrEqual(x, y);
-                    case AT: return UnsignedMath.aboveThan(x, y);
-                    case BT: return UnsignedMath.belowThan(x, y);
-                    default: throw new GraalInternalError("expected condition: %s", this);
+                    case EQ:
+                        return x == y;
+                    case NE:
+                        return x != y;
+                    case LT:
+                        return x < y;
+                    case LE:
+                        return x <= y;
+                    case GT:
+                        return x > y;
+                    case GE:
+                        return x >= y;
+                    case AE:
+                        return UnsignedMath.aboveOrEqual(x, y);
+                    case BE:
+                        return UnsignedMath.belowOrEqual(x, y);
+                    case AT:
+                        return UnsignedMath.aboveThan(x, y);
+                    case BT:
+                        return UnsignedMath.belowThan(x, y);
+                    default:
+                        throw new GraalInternalError("expected condition: %s", this);
                 }
             }
             case Object: {
                 switch (this) {
-                    case EQ: return runtime.constantEquals(lt, rt);
-                    case NE: return !runtime.constantEquals(lt, rt);
-                    default: throw new GraalInternalError("expected condition: %s", this);
+                    case EQ:
+                        return runtime.constantEquals(lt, rt);
+                    case NE:
+                        return !runtime.constantEquals(lt, rt);
+                    default:
+                        throw new GraalInternalError("expected condition: %s", this);
                 }
             }
             case Float: {
@@ -315,13 +416,20 @@
                     return unorderedIsTrue;
                 }
                 switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                    default: throw new GraalInternalError("expected condition: %s", this);
+                    case EQ:
+                        return x == y;
+                    case NE:
+                        return x != y;
+                    case LT:
+                        return x < y;
+                    case LE:
+                        return x <= y;
+                    case GT:
+                        return x > y;
+                    case GE:
+                        return x >= y;
+                    default:
+                        throw new GraalInternalError("expected condition: %s", this);
                 }
             }
             case Double: {
@@ -331,16 +439,24 @@
                     return unorderedIsTrue;
                 }
                 switch (this) {
-                    case EQ: return x == y;
-                    case NE: return x != y;
-                    case LT: return x < y;
-                    case LE: return x <= y;
-                    case GT: return x > y;
-                    case GE: return x >= y;
-                    default: throw new GraalInternalError("expected condition: %s", this);
+                    case EQ:
+                        return x == y;
+                    case NE:
+                        return x != y;
+                    case LT:
+                        return x < y;
+                    case LE:
+                        return x <= y;
+                    case GT:
+                        return x > y;
+                    case GE:
+                        return x >= y;
+                    default:
+                        throw new GraalInternalError("expected condition: %s", this);
                 }
             }
-            default: throw new GraalInternalError("expected value kind %s while folding condition: %s", lt.getKind(), this);
+            default:
+                throw new GraalInternalError("expected value kind %s while folding condition: %s", lt.getKind(), this);
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note that these nodes are not
- * built directly from the bytecode but are introduced by canonicalization.
+ * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note
+ * that these nodes are not built directly from the bytecode but are introduced by canonicalization.
  */
 public class ConditionalNode extends BinaryNode implements Canonicalizable, LIRLowerable, Negatable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,26 +35,9 @@
 public final class ConvertNode extends FloatingNode implements Canonicalizable, LIRLowerable {
 
     public enum Op {
-        I2L(Int, Long),
-        L2I(Long, Int),
-        I2B(Int, Byte),
-        I2C(Int, Char),
-        I2S(Int, Short),
-        F2D(Float, Double),
-        D2F(Double, Float),
-        I2F(Int, Float),
-        I2D(Int, Double),
-        F2I(Float, Int),
-        D2I(Double, Int),
-        L2F(Long, Float),
-        L2D(Long, Double),
-        F2L(Float, Long),
-        D2L(Double, Long),
-        UNSIGNED_I2L(Int, Long),
-        MOV_I2F(Int, Float),
-        MOV_L2D(Long, Double),
-        MOV_F2I(Float, Int),
-        MOV_D2L(Double, Long);
+        I2L(Int, Long), L2I(Long, Int), I2B(Int, Byte), I2C(Int, Char), I2S(Int, Short), F2D(Float, Double), D2F(Double, Float), I2F(Int, Float), I2D(Int, Double), F2I(Float, Int), D2I(Double, Int), L2F(
+                        Long, Float), L2D(Long, Double), F2L(Float, Long), D2L(Double, Long), UNSIGNED_I2L(Int, Long), MOV_I2F(Int, Float), MOV_L2D(Long, Double), MOV_F2I(Float, Int), MOV_D2L(Double,
+                        Long);
 
         public final Kind from;
         public final Kind to;
@@ -75,6 +58,7 @@
 
     /**
      * Constructs a new Convert instance.
+     * 
      * @param opcode the operation
      * @param value the instruction producing the input value
      */
@@ -90,26 +74,46 @@
         if (value instanceof ConstantNode) {
             Constant c = ((ConstantNode) value).asConstant();
             switch (opcode) {
-                case I2L: return ConstantNode.forLong(c.asInt(), graph());
-                case L2I: return ConstantNode.forInt((int) c.asLong(), graph());
-                case I2B: return ConstantNode.forByte((byte) c.asInt(), graph());
-                case I2C: return ConstantNode.forChar((char) c.asInt(), graph());
-                case I2S: return ConstantNode.forShort((short) c.asInt(), graph());
-                case F2D: return ConstantNode.forDouble(c.asFloat(), graph());
-                case D2F: return ConstantNode.forFloat((float) c.asDouble(), graph());
-                case I2F: return ConstantNode.forFloat(c.asInt(), graph());
-                case I2D: return ConstantNode.forDouble(c.asInt(), graph());
-                case F2I: return ConstantNode.forInt((int) c.asFloat(), graph());
-                case D2I: return ConstantNode.forInt((int) c.asDouble(), graph());
-                case L2F: return ConstantNode.forFloat(c.asLong(), graph());
-                case L2D: return ConstantNode.forDouble(c.asLong(), graph());
-                case F2L: return ConstantNode.forLong((long) c.asFloat(), graph());
-                case D2L: return ConstantNode.forLong((long) c.asDouble(), graph());
-                case UNSIGNED_I2L: return ConstantNode.forLong(c.asInt() & 0xffffffffL, graph());
-                case MOV_I2F: return ConstantNode.forFloat(java.lang.Float.intBitsToFloat(c.asInt()), graph());
-                case MOV_L2D: return ConstantNode.forDouble(java.lang.Double.longBitsToDouble(c.asLong()), graph());
-                case MOV_F2I: return ConstantNode.forInt(java.lang.Float.floatToRawIntBits(c.asFloat()), graph());
-                case MOV_D2L: return ConstantNode.forLong(java.lang.Double.doubleToRawLongBits(c.asDouble()), graph());
+                case I2L:
+                    return ConstantNode.forLong(c.asInt(), graph());
+                case L2I:
+                    return ConstantNode.forInt((int) c.asLong(), graph());
+                case I2B:
+                    return ConstantNode.forByte((byte) c.asInt(), graph());
+                case I2C:
+                    return ConstantNode.forChar((char) c.asInt(), graph());
+                case I2S:
+                    return ConstantNode.forShort((short) c.asInt(), graph());
+                case F2D:
+                    return ConstantNode.forDouble(c.asFloat(), graph());
+                case D2F:
+                    return ConstantNode.forFloat((float) c.asDouble(), graph());
+                case I2F:
+                    return ConstantNode.forFloat(c.asInt(), graph());
+                case I2D:
+                    return ConstantNode.forDouble(c.asInt(), graph());
+                case F2I:
+                    return ConstantNode.forInt((int) c.asFloat(), graph());
+                case D2I:
+                    return ConstantNode.forInt((int) c.asDouble(), graph());
+                case L2F:
+                    return ConstantNode.forFloat(c.asLong(), graph());
+                case L2D:
+                    return ConstantNode.forDouble(c.asLong(), graph());
+                case F2L:
+                    return ConstantNode.forLong((long) c.asFloat(), graph());
+                case D2L:
+                    return ConstantNode.forLong((long) c.asDouble(), graph());
+                case UNSIGNED_I2L:
+                    return ConstantNode.forLong(c.asInt() & 0xffffffffL, graph());
+                case MOV_I2F:
+                    return ConstantNode.forFloat(java.lang.Float.intBitsToFloat(c.asInt()), graph());
+                case MOV_L2D:
+                    return ConstantNode.forDouble(java.lang.Double.longBitsToDouble(c.asLong()), graph());
+                case MOV_F2I:
+                    return ConstantNode.forInt(java.lang.Float.floatToRawIntBits(c.asFloat()), graph());
+                case MOV_D2L:
+                    return ConstantNode.forLong(java.lang.Double.doubleToRawLongBits(c.asDouble()), graph());
             }
         }
         return this;
@@ -119,12 +123,23 @@
     public boolean inferStamp() {
         Stamp newStamp;
         switch (opcode) {
-            case I2L: newStamp = StampTool.intToLong(value().integerStamp()); break;
-            case L2I: newStamp = StampTool.longToInt(value().integerStamp()); break;
-            case I2B: newStamp = StampTool.intToByte(value().integerStamp()); break;
-            case I2C: newStamp = StampTool.intToChar(value().integerStamp()); break;
-            case I2S: newStamp = StampTool.intToShort(value().integerStamp()); break;
-            default: return false;
+            case I2L:
+                newStamp = StampTool.intToLong(value().integerStamp());
+                break;
+            case L2I:
+                newStamp = StampTool.longToInt(value().integerStamp());
+                break;
+            case I2B:
+                newStamp = StampTool.intToByte(value().integerStamp());
+                break;
+            case I2C:
+                newStamp = StampTool.intToChar(value().integerStamp());
+                break;
+            case I2S:
+                newStamp = StampTool.intToShort(value().integerStamp());
+                break;
+            default:
+                return false;
         }
         return updateStamp(newStamp);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatEqualsNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,7 +31,7 @@
 
     /**
      * Constructs a new floating point equality comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/FloatLessThanNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,10 +34,11 @@
 
     /**
      * Constructs a new floating point comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
-     * @param unorderedIsTrue whether a comparison that is undecided (involving NaNs, etc.) leads to a "true" result
+     * @param unorderedIsTrue whether a comparison that is undecided (involving NaNs, etc.) leads to
+     *            a "true" result
      */
     public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) {
         super(x, y);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerArithmeticNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 
-
 public abstract class IntegerArithmeticNode extends ArithmeticNode {
 
     public IntegerArithmeticNode(Kind kind, ValueNode x, ValueNode y) {
@@ -37,7 +36,7 @@
     public static IntegerAddNode add(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new IntegerAddNode(Kind.Int, v1, v2));
             case Long:
@@ -50,7 +49,7 @@
     public static IntegerMulNode mul(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new IntegerMulNode(Kind.Int, v1, v2));
             case Long:
@@ -63,7 +62,7 @@
     public static IntegerSubNode sub(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new IntegerSubNode(Kind.Int, v1, v2));
             case Long:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerBelowThanNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 
     /**
      * Constructs a new unsigned integer comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerEqualsNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,7 @@
 
     /**
      * Constructs a new integer equality comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerLessThanNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 
     /**
      * Constructs a new integer comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerSubNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -74,7 +74,7 @@
             if (c == 0) {
                 return graph().unique(new NegateNode(y()));
             }
-           return BinaryNode.reassociate(this, ValueNode.isConstantPredicate());
+            return BinaryNode.reassociate(this, ValueNode.isConstantPredicate());
         }
         return this;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IsNullNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -40,7 +40,7 @@
 
     /**
      * Constructs a new IsNullNode instruction.
-     *
+     * 
      * @param object the instruction producing the object to check against null
      */
     public IsNullNode(ValueNode object) {
@@ -76,7 +76,7 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        if (tool.getVirtualState(object()) != null || tool.getMaterializedValue(object()) != null) {
+        if (tool.getObjectState(object) != null) {
             tool.replaceWithValue(ConstantNode.forBoolean(false, graph()));
         }
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LogicNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/LogicNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
 
     /**
      * Constructs a new logic operation node.
+     * 
      * @param x the first input into this node
      * @param y the second input into this node
      */
@@ -44,7 +45,7 @@
     public static LogicNode and(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new AndNode(Kind.Int, v1, v2));
             case Long:
@@ -57,7 +58,7 @@
     public static LogicNode or(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new OrNode(Kind.Int, v1, v2));
             case Long:
@@ -70,7 +71,7 @@
     public static LogicNode xor(ValueNode v1, ValueNode v2) {
         assert v1.kind() == v2.kind() && v1.graph() == v2.graph();
         Graph graph = v1.graph();
-        switch(v1.kind()) {
+        switch (v1.kind()) {
             case Int:
                 return graph.unique(new XorNode(Kind.Int, v1, v2));
             case Long:
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NegateNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -44,7 +44,7 @@
 
     /**
      * Creates new NegateNode instance.
-     *
+     * 
      * @param x the instruction producing the value that is input to this instruction
      */
     public NegateNode(ValueNode x) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/NormalizeCompareNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,17 +27,20 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * Returns -1, 0, or 1 if either x < y, x == y, or x > y. If the comparison is undecided (one of the inputs is NaN), the
- * result is 1 if isUnorderedLess is false and -1 if isUnorderedLess is true.
+ * Returns -1, 0, or 1 if either x < y, x == y, or x > y. If the comparison is undecided (one of the
+ * inputs is NaN), the result is 1 if isUnorderedLess is false and -1 if isUnorderedLess is true.
  */
 public final class NormalizeCompareNode extends BinaryNode implements Lowerable {
+
     public final boolean isUnorderedLess;
 
     /**
      * Creates a new compare operation.
+     * 
      * @param x the first input
      * @param y the second input
-     * @param isUnorderedLess true when an unordered floating point comparison is interpreted as less, false when greater.
+     * @param isUnorderedLess true when an unordered floating point comparison is interpreted as
+     *            less, false when greater.
      */
     public NormalizeCompareNode(ValueNode x, ValueNode y, boolean isUnorderedLess) {
         super(Kind.Int, x, y);
@@ -59,7 +62,7 @@
         }
 
         MaterializeNode equalValue = MaterializeNode.create(equalComp, ConstantNode.forInt(0, graph), ConstantNode.forInt(1, graph));
-        MaterializeNode value =  MaterializeNode.create(lessComp, ConstantNode.forInt(-1, graph), equalValue);
+        MaterializeNode value = MaterializeNode.create(lessComp, ConstantNode.forInt(-1, graph), equalValue);
 
         graph.replaceFloating(this, value);
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,14 +26,13 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.virtual.*;
 
 @NodeInfo(shortName = "==")
 public final class ObjectEqualsNode extends CompareNode implements Virtualizable {
 
     /**
      * Constructs a new object equality comparison node.
-     *
+     * 
      * @param x the instruction producing the first input to the instruction
      * @param y the instruction that produces the second input to this instruction
      */
@@ -73,17 +72,17 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtualX = tool.getVirtualState(x());
-        VirtualObjectNode virtualY = tool.getVirtualState(y());
-        boolean xVirtual = virtualX != null;
-        boolean yVirtual = virtualY != null;
+        State stateX = tool.getObjectState(x());
+        State stateY = tool.getObjectState(y());
+        boolean xVirtual = stateX != null && stateX.getState() == EscapeState.Virtual;
+        boolean yVirtual = stateY != null && stateY.getState() == EscapeState.Virtual;
 
         if (xVirtual ^ yVirtual) {
             // one of them is virtual: they can never be the same objects
             tool.replaceWithValue(ConstantNode.forBoolean(false, graph()));
         } else if (xVirtual && yVirtual) {
             // both are virtual: check if they refer to the same object
-            tool.replaceWithValue(ConstantNode.forBoolean(virtualX == virtualY, graph()));
+            tool.replaceWithValue(ConstantNode.forBoolean(stateX == stateY, graph()));
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ShiftNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,6 +32,7 @@
 
     /**
      * Creates a new shift operation.
+     * 
      * @param x the first input value
      * @param s the second input value
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/XorNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.type.*;
 
 @NodeInfo(shortName = "^")
 public final class XorNode extends LogicNode implements Canonicalizable, LIRLowerable {
@@ -35,6 +36,11 @@
     }
 
     @Override
+    public boolean inferStamp() {
+        return updateStamp(StampTool.xor(x().integerStamp(), y().integerStamp()));
+    }
+
+    @Override
     public ValueNode canonical(CanonicalizerTool tool) {
         if (x() == y()) {
             return ConstantNode.forIntegerKind(kind(), 0, graph());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/Block.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,14 +27,13 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.java.*;
 
-public class Block {
+public final class Block {
 
     protected int id;
 
     protected BeginNode beginNode;
     protected FixedNode endNode;
     protected Loop loop;
-    protected double probability;
 
     protected List<Block> predecessors;
     protected List<Block> successors;
@@ -43,9 +42,8 @@
     protected List<Block> dominated;
     protected Block postdominator;
 
-    // Fields that still need to be worked on, try to remove them later.
-    public boolean align;
-    public int linearScanNumber;
+    private boolean align;
+    private int linearScanNumber;
 
     protected Block() {
         id = ControlFlowGraph.BLOCK_ID_INITIAL;
@@ -83,10 +81,18 @@
         return getBeginNode().next() instanceof ExceptionObjectNode;
     }
 
+    public Block getFirstPredecessor() {
+        return predecessors.get(0);
+    }
+
     public List<Block> getPredecessors() {
         return predecessors;
     }
 
+    public Block getFirstSuccessor() {
+        return successors.get(0);
+    }
+
     public List<Block> getSuccessors() {
         return successors;
     }
@@ -120,6 +126,7 @@
     }
 
     private class NodeIterator implements Iterator<FixedNode> {
+
         private FixedNode cur;
 
         public NodeIterator() {
@@ -151,6 +158,7 @@
 
     public Iterable<FixedNode> getNodes() {
         return new Iterable<FixedNode>() {
+
             @Override
             public Iterator<FixedNode> iterator() {
                 return new NodeIterator();
@@ -175,25 +183,14 @@
         return "B" + id;
     }
 
-
-// to be inlined later on
-    public int numberOfPreds() {
+    public int getPredecessorCount() {
         return getPredecessors().size();
     }
 
-    public int numberOfSux() {
+    public int getSuccessorCount() {
         return getSuccessors().size();
     }
 
-    public Block predAt(int i) {
-        return getPredecessors().get(i);
-    }
-
-    public Block suxAt(int i) {
-        return getSuccessors().get(i);
-    }
-// end to be inlined later on
-
     public boolean dominates(Block block) {
         return block.isDominatedBy(this);
     }
@@ -207,4 +204,24 @@
         }
         return dominator.isDominatedBy(block);
     }
+
+    public double getProbability() {
+        return getBeginNode().probability();
+    }
+
+    public int getLinearScanNumber() {
+        return linearScanNumber;
+    }
+
+    public void setLinearScanNumber(int linearScanNumber) {
+        this.linearScanNumber = linearScanNumber;
+    }
+
+    public boolean isAligned() {
+        return align;
+    }
+
+    public void setAlign(boolean align) {
+        this.align = align;
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.nodes.cfg;
 
 public class BlockMap<T> {
+
     private final T[] data;
 
     @SuppressWarnings("unchecked")
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/CFGVerifier.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,6 +23,7 @@
 package com.oracle.graal.nodes.cfg;
 
 public class CFGVerifier {
+
     public static boolean verify(ControlFlowGraph cfg) {
         for (Block block : cfg.getBlocks()) {
             assert block.getId() >= 0;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/ControlFlowGraph.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,6 @@
     private Block[] reversePostOrder;
     private Loop[] loops;
 
-
     public static ControlFlowGraph compute(StructuredGraph graph, boolean connectBlocks, boolean computeLoops, boolean computeDominators, boolean computePostdominators) {
         ControlFlowGraph cfg = new ControlFlowGraph(graph);
         cfg.identifyBlocks();
@@ -71,10 +70,13 @@
 
     public Iterable<Block> postOrder() {
         return new Iterable<Block>() {
+
             @Override
             public Iterator<Block> iterator() {
                 return new Iterator<Block>() {
+
                     private int nextIndex = reversePostOrder.length - 1;
+
                     @Override
                     public boolean hasNext() {
                         return nextIndex >= 0;
@@ -131,13 +133,6 @@
                         }
                     }
 
-                    if (cur instanceof FixedNode) {
-                        double probability = ((FixedNode) cur).probability();
-                        if (probability > block.probability) {
-                            block.probability = probability;
-                        }
-                    }
-
                     last = cur;
                     cur = cur.successors().first();
                 } while (cur != null && !(cur instanceof BeginNode));
@@ -163,7 +158,8 @@
                 }
                 block.id = BLOCK_ID_VISITED;
             } else if (block.id == BLOCK_ID_VISITED) {
-                // Second time we see this block: All successors have been processed, so add block to postorder list.
+                // Second time we see this block: All successors have been processed, so add block
+                // to postorder list.
                 stack.remove(stack.size() - 1);
                 postOrder.add(block);
             } else {
@@ -233,9 +229,8 @@
 
                 for (LoopExitNode exit : loopBegin.loopExits()) {
                     Block exitBlock = nodeToBlock.get(exit);
-                    List<Block> predecessors = exitBlock.getPredecessors();
-                    assert predecessors.size() == 1;
-                    computeLoopBlocks(predecessors.get(0), loop);
+                    assert exitBlock.getPredecessorCount() == 1;
+                    computeLoopBlocks(exitBlock.getFirstPredecessor(), loop);
                     loop.exits.add(exitBlock);
                 }
                 List<Block> unexpected = new LinkedList<>();
@@ -287,15 +282,12 @@
     }
 
     private void computeDominators() {
-        assert reversePostOrder[0].getPredecessors().size() == 0 : "start block has no predecessor and therefore no dominator";
+        assert reversePostOrder[0].getPredecessorCount() == 0 : "start block has no predecessor and therefore no dominator";
         for (int i = 1; i < reversePostOrder.length; i++) {
             Block block = reversePostOrder[i];
-            List<Block> predecessors = block.getPredecessors();
-            assert predecessors.size() > 0;
-
-            Block dominator = predecessors.get(0);
-            for (int j = 1; j < predecessors.size(); j++) {
-                Block pred = predecessors.get(j);
+            assert block.getPredecessorCount() > 0;
+            Block dominator = null;
+            for (Block pred : block.getPredecessors()) {
                 if (!pred.isLoopEnd()) {
                     dominator = commonDominator(dominator, pred);
                 }
@@ -313,6 +305,12 @@
     }
 
     public static Block commonDominator(Block a, Block b) {
+        if (a == null) {
+            return b;
+        }
+        if (b == null) {
+            return a;
+        }
         Block iterA = a;
         Block iterB = b;
         while (iterA != iterB) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractCallNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AbstractCallNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,7 @@
 
 public abstract class AbstractCallNode extends AbstractStateSplit implements StateSplit, MemoryCheckpoint {
 
-    @Input
-    protected final NodeInputList<ValueNode> arguments;
+    @Input protected final NodeInputList<ValueNode> arguments;
 
     public AbstractCallNode(Stamp stamp, ValueNode[] arguments) {
         super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/AccessNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,9 +27,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Accesses a value at an memory address specified by an {@linkplain #object object}
- * and a {@linkplain #location() location}. The access does not include a null check
- * on the object.
+ * Accesses a value at an memory address specified by an {@linkplain #object object} and a
+ * {@linkplain #location() location}. The access does not include a null check on the object.
  */
 public abstract class AccessNode extends FixedWithNextNode implements Access {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/BoxNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,12 +30,11 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
-
 public final class BoxNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, Canonicalizable {
 
     @Input private ValueNode source;
-    private int bci;
-    private Kind sourceKind;
+    private final int bci;
+    private final Kind sourceKind;
 
     public BoxNode(ValueNode value, ResolvedJavaType type, Kind sourceKind, int bci) {
         super(StampFactory.exactNonNull(type));
@@ -49,14 +48,14 @@
         return source;
     }
 
-
     public Kind getSourceKind() {
         return sourceKind;
     }
 
     public void expand(BoxingMethodPool pool) {
         ResolvedJavaMethod boxingMethod = pool.getBoxingMethod(sourceKind);
-        MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.getSignature().getReturnType(boxingMethod.getDeclaringClass())));
+        MethodCallTargetNode callTarget = graph().add(
+                        new MethodCallTargetNode(InvokeKind.Static, boxingMethod, new ValueNode[]{source}, boxingMethod.getSignature().getReturnType(boxingMethod.getDeclaringClass())));
         InvokeNode invokeNode = graph().add(new InvokeNode(callTarget, bci, -1));
         invokeNode.setProbability(this.probability());
         invokeNode.setStateAfter(stateAfter());
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/FloatingReadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A floating read of a value from memory specified in terms of an object base and an object relative location.
- * This node does not null check the object.
+ * A floating read of a value from memory specified in terms of an object base and an object
+ * relative location. This node does not null check the object.
  */
 public final class FloatingReadNode extends FloatingAccessNode implements Node.IterableNodeType, LIRLowerable, Canonicalizable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IndexedLocationNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,12 +28,14 @@
 import com.oracle.graal.nodes.spi.*;
 
 /**
- * Extension of a {@linkplain LocationNode location} to include a scaled index or an additional offset.
+ * Extension of a {@linkplain LocationNode location} to include a scaled index or an additional
+ * offset.
  */
 public final class IndexedLocationNode extends LocationNode implements Canonicalizable {
 
     /**
-     * An offset or index depending on whether {@link #indexScalingEnabled} is true or false respectively.
+     * An offset or index depending on whether {@link #indexScalingEnabled} is true or false
+     * respectively.
      */
     @Input private ValueNode index;
     private final boolean indexScalingEnabled;
@@ -50,7 +52,8 @@
     }
 
     /**
-     * @return whether scaling of the index by the value kind's size is enabled (the default) or disabled.
+     * @return whether scaling of the index by the value kind's size is enabled (the default) or
+     *         disabled.
      */
     public boolean indexScalingEnabled() {
         return indexScalingEnabled;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,17 +31,17 @@
 import com.oracle.graal.nodes.util.*;
 
 /**
- * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key values.
- * The actual implementation of the switch will be decided by the backend.
+ * The {@code IntegerSwitchNode} represents a switch on integer keys, with a sorted array of key
+ * values. The actual implementation of the switch will be decided by the backend.
  */
 public final class IntegerSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable {
 
     private final int[] keys;
 
     /**
-     * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain key.length + 1
-     * entries, the last entry describes the default (fall through) case.
-     *
+     * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain
+     * key.length + 1 entries, the last entry describes the default (fall through) case.
+     * 
      * @param value the instruction producing the value being switched on
      * @param successors the list of successors
      * @param keys the sorted list of keys
@@ -56,9 +56,9 @@
     }
 
     /**
-     * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain key.length + 1
-     * entries, the last entry describes the default (fall through) case.
-     *
+     * Constructs a integer switch instruction. The keyProbabilities and keySuccessors array contain
+     * key.length + 1 entries, the last entry describes the default (fall through) case.
+     * 
      * @param value the instruction producing the value being switched on
      * @param successorCount the number of successors
      * @param keys the sorted list of keys
@@ -71,6 +71,7 @@
 
     /**
      * Gets the key at the specified index.
+     * 
      * @param i the index
      * @return the key at that index
      */
@@ -125,7 +126,7 @@
                 } else if (validKeys != keys.length) {
                     ArrayList<BeginNode> newSuccessors = new ArrayList<>(blockSuccessorCount());
                     int[] newKeys = new int[validKeys];
-                    int[] newKeySuccessors = new int [validKeys + 1];
+                    int[] newKeySuccessors = new int[validKeys + 1];
                     double[] newKeyProbabilities = new double[validKeys + 1];
                     double totalProbability = 0;
                     int current = 0;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LoadHubNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,12 +27,12 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * Loads an object's {@linkplain Representation#ObjectHub hub}, null-checking the object first.
  */
 public final class LoadHubNode extends FixedWithNextNode implements Lowerable, Canonicalizable, Virtualizable {
+
     @Input private ValueNode object;
 
     public ValueNode object() {
@@ -76,9 +76,10 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            tool.replaceWithValue(ConstantNode.forConstant(virtual.type().getEncoding(Representation.ObjectHub), tool.getMetaAccessProvider(), graph()));
+        State state = tool.getObjectState(object);
+        if (state != null) {
+            Constant constantHub = state.getVirtualObject().type().getEncoding(Representation.ObjectHub);
+            tool.replaceWithValue(ConstantNode.forConstant(constantHub, tool.getMetaAccessProvider(), graph()));
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/LocationNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A location for a memory access in terms of the kind of value accessed and the displacement
- * (in bytes) from a base object or address.
+ * A location for a memory access in terms of the kind of value accessed and the displacement (in
+ * bytes) from a base object or address.
  */
 @NodeInfo(nameTemplate = "Loc {p#locationIdentity/s}")
 public class LocationNode extends FloatingNode implements LIRLowerable, ValueNumberable {
@@ -41,10 +41,11 @@
     private Object locationIdentity;
 
     /**
-     * Denotes any location. A write to such a location kills all values in a memory map
-     * during an analysis of memory accesses in a graph.
+     * Denotes any location. A write to such a location kills all values in a memory map during an
+     * analysis of memory accesses in a graph.
      */
     public static final Object ANY_LOCATION = new Object() {
+
         @Override
         public String toString() {
             return "ANY_LOCATION";
@@ -55,6 +56,7 @@
      * Denotes the location of a value that is guaranteed to be final.
      */
     public static final Object FINAL_LOCATION = new Object() {
+
         @Override
         public String toString() {
             return "FINAL_LOCATION";
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MemoryCheckpoint.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-
 public interface MemoryCheckpoint {
 
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorEnter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorEnter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-
 /**
  * Denotes monitor locking transition.
  */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorExit.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/MonitorExit.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  */
 package com.oracle.graal.nodes.extended;
 
-
 /**
  * Denotes monitor unlocking transition.
  */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,12 +38,13 @@
         super(object, location, stamp);
     }
 
-    public ReadNode(ValueNode object, int displacement, Object locationIdentity, Kind kind) {
+    private ReadNode(ValueNode object, int displacement, Object locationIdentity, Kind kind) {
         super(object, object.graph().add(new LocationNode(locationIdentity, kind, displacement)), StampFactory.forKind(kind));
     }
 
-    public ReadNode(ValueNode object, ValueNode location) {
-        // Used by node intrinsics. Since the initial value for location is a parameter, i.e., a LocalNode, the
+    private ReadNode(ValueNode object, ValueNode location) {
+        // Used by node intrinsics. Since the initial value for location is a parameter, i.e., a
+        // LocalNode, the
         // constructor cannot use the declared type LocationNode
         this(object, location, StampFactory.forNodeIntrinsic());
     }
@@ -60,7 +61,7 @@
 
     /**
      * Utility function for reading a value of this kind using a base address and a displacement.
-     *
+     * 
      * @param base the base address from which the value is read
      * @param displacement the displacement within the object in bytes
      * @return the read value encapsulated in a {@link Constant} object
@@ -92,7 +93,12 @@
 
     public static ValueNode canonicalizeRead(Access read, CanonicalizerTool tool) {
         MetaAccessProvider runtime = tool.runtime();
-        if (runtime != null && read.object() != null && read.object().isConstant()/* && read.object().kind() == Kind.Object*/) {
+        if (runtime != null && read.object() != null && read.object().isConstant()/*
+                                                                                   * &&
+                                                                                   * read.object()
+                                                                                   * .kind() ==
+                                                                                   * Kind.Object
+                                                                                   */) {
             if (read.location().locationIdentity() == LocationNode.FINAL_LOCATION && read.location().getClass() == LocationNode.class) {
                 long displacement = read.location().displacement();
                 Kind kind = read.location().getValueKind();
@@ -116,7 +122,7 @@
 
     /**
      * Reads a value from memory.
-     *
+     * 
      * @param base the base pointer for the memory access
      * @param displacement the displacement of the access
      * @param locationIdentity the identity of the access
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeAccessNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeAccessNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * An analog to {@link AccessNode} with the additional semantics of null-checking
- * the receiver object before the access.
+ * An analog to {@link AccessNode} with the additional semantics of null-checking the receiver
+ * object before the access.
  */
 public abstract class SafeAccessNode extends FixedWithNextNode {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeReadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeReadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * An analog to {@link ReadNode} with the additional semantics of null-checking
- * the receiver object before reading from it.
+ * An analog to {@link ReadNode} with the additional semantics of null-checking the receiver object
+ * before reading from it.
  */
 public class SafeReadNode extends SafeAccessNode implements Lowerable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeWriteNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SafeWriteNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * An analog to {@link WriteNode} with the additional semantics of null-checking
- * the receiver object before writing to it.
+ * An analog to {@link WriteNode} with the additional semantics of null-checking the receiver object
+ * before writing to it.
  */
 public class SafeWriteNode extends SafeAccessNode implements StateSplit, Lowerable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
  * The {@code SwitchNode} class is the base of both lookup and table switches.
  */
 public abstract class SwitchNode extends ControlSplitNode {
+
     @Successor protected final NodeSuccessorList<BeginNode> successors;
     protected double[] successorProbabilities;
     @Input private ValueNode value;
@@ -41,6 +42,7 @@
 
     /**
      * Constructs a new Switch.
+     * 
      * @param value the instruction that provides the value to be switched over
      * @param successors the list of successors of this switch
      */
@@ -121,6 +123,7 @@
 
     /**
      * Gets the successor corresponding to the default (fall through) case.
+     * 
      * @return the default successor
      */
     public BeginNode defaultSuccessor() {
@@ -132,6 +135,7 @@
 
     /**
      * Helper function that sums up the probabilities of all keys that lead to a specific successor.
+     * 
      * @return an array of size successorCount with the accumulated probability for each successor.
      */
     public static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,6 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
-
 public final class UnboxNode extends FixedWithNextNode implements Node.IterableNodeType, Canonicalizable {
 
     @Input private ValueNode source;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeAccessNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.type.*;
 
+public abstract class UnsafeAccessNode extends FixedWithNextNode {
 
-public abstract class UnsafeAccessNode extends FixedWithNextNode {
     @Input private ValueNode object;
     @Input private ValueNode offset;
     private final int displacement;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeArrayCastNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeArrayCastNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,7 @@
  */
 public final class UnsafeArrayCastNode extends UnsafeCastNode implements ArrayLengthProvider {
 
-    @Input
-    private ValueNode length;
+    @Input private ValueNode length;
 
     public ValueNode length() {
         return length;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeCastNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,8 +33,7 @@
  */
 public class UnsafeCastNode extends FloatingNode implements Canonicalizable, LIRLowerable {
 
-    @Input
-    private ValueNode object;
+    @Input private ValueNode object;
 
     public ValueNode object() {
         return object;
@@ -55,7 +54,8 @@
             return false;
         }
         if (object().objectStamp().alwaysNull() && objectStamp().nonNull()) {
-            // a null value flowing into a nonNull UnsafeCastNode should be guarded by a type/isNull guard, but the
+            // a null value flowing into a nonNull UnsafeCastNode should be guarded by a type/isNull
+            // guard, but the
             // compiler might see this situation before the branch is deleted
             return false;
         }
@@ -96,7 +96,8 @@
             generator.emitMove(generator.operand(object), result);
             generator.setResult(this, result);
         } else {
-            // The LIR only cares about the kind of an operand, not the actual type of an object. So we do not have to
+            // The LIR only cares about the kind of an operand, not the actual type of an object. So
+            // we do not have to
             // introduce a new operand when the kind is the same.
             generator.setResult(this, generator.operand(object));
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeLoadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,11 +28,10 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
- * Load of a value from a location specified as an offset relative to an object.
- * No null check is performed before the load.
+ * Load of a value from a location specified as an offset relative to an object. No null check is
+ * performed before the load.
  */
 public class UnsafeLoadNode extends UnsafeAccessNode implements Lowerable, Virtualizable, Canonicalizable {
 
@@ -55,19 +54,14 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
+        State state = tool.getObjectState(object());
+        if (state != null && state.getState() == EscapeState.Virtual) {
             ValueNode indexValue = tool.getReplacedValue(offset());
             if (indexValue.isConstant()) {
-                int fieldIndex = virtual.fieldIndexForOffset(indexValue.asConstant().asLong());
-                if (fieldIndex != -1) {
-                    ValueNode result = tool.getVirtualEntry(virtual, fieldIndex);
-                    VirtualObjectNode virtualResult = tool.getVirtualState(result);
-                    if (virtualResult != null) {
-                        tool.replaceWithVirtual(virtualResult);
-                    } else {
-                        tool.replaceWithValue(result);
-                    }
+                long offset = indexValue.asConstant().asLong() + displacement();
+                int entryIndex = state.getVirtualObject().entryIndexForOffset(offset);
+                if (entryIndex != -1 && state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
+                    tool.replaceWith(state.getEntry(entryIndex));
                 }
             }
         }
@@ -83,7 +77,9 @@
                     Graph graph = this.graph();
                     return graph.add(new UnsafeLoadNode(this.stamp(), object(), intDisplacement, graph.unique(ConstantNode.forInt(0, graph)), accessKind()));
                 }
-            } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once UnsafeAccess only have an object base
+            } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once
+                                                                  // UnsafeAccess only have an
+                                                                  // object base
                 ObjectStamp receiverStamp = object().objectStamp();
                 if (receiverStamp.nonNull()) {
                     ResolvedJavaType receiverType = receiverStamp.type();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnsafeStoreNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,11 +28,10 @@
 import com.oracle.graal.nodes.java.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
- * Store of a value at a location specified as an offset relative to an object.
- * No null check is performed before the store.
+ * Store of a value at a location specified as an offset relative to an object. No null check is
+ * performed before the store.
  */
 public class UnsafeStoreNode extends UnsafeAccessNode implements StateSplit, Lowerable, Virtualizable, Canonicalizable {
 
@@ -74,13 +73,14 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
+        State state = tool.getObjectState(object());
+        if (state != null && state.getState() == EscapeState.Virtual) {
             ValueNode indexValue = tool.getReplacedValue(offset());
             if (indexValue.isConstant()) {
-                int fieldIndex = virtual.fieldIndexForOffset(indexValue.asConstant().asLong());
-                if (fieldIndex != -1) {
-                    tool.setVirtualEntry(virtual, fieldIndex, value());
+                long offset = indexValue.asConstant().asLong() + displacement();
+                int entryIndex = state.getVirtualObject().entryIndexForOffset(offset);
+                if (entryIndex != -1 && state.getVirtualObject().entryKind(entryIndex) == accessKind()) {
+                    tool.setVirtualEntry(state, entryIndex, value());
                     tool.delete();
                 }
             }
@@ -97,7 +97,9 @@
                     Graph graph = this.graph();
                     return graph.add(new UnsafeStoreNode(this.stamp(), object(), intDisplacement, graph.unique(ConstantNode.forInt(0, graph)), value(), accessKind()));
                 }
-            } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once UnsafeAccess only have an object base
+            } else if (object().stamp() instanceof ObjectStamp) { // TODO (gd) remove that once
+                                                                  // UnsafeAccess only have an
+                                                                  // object base
                 ObjectStamp receiverStamp = object().objectStamp();
                 if (receiverStamp.nonNull()) {
                     ResolvedJavaType receiverType = receiverStamp.type();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ValueAnchorNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -96,7 +96,8 @@
             }
         }
         for (ValueNode node : dependencies().nonNull().and(isNotA(BeginNode.class))) {
-            if (tool.getVirtualState(node) == null) {
+            State state = tool.getObjectState(node);
+            if (state == null || state.getState() != EscapeState.Virtual) {
                 return;
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteMemoryCheckpointNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
-
 public final class WriteMemoryCheckpointNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint {
 
     public WriteMemoryCheckpointNode() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,11 +26,11 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
-
 /**
  * Writes a given {@linkplain #value() value} a {@linkplain AccessNode memory location}.
  */
 public final class WriteNode extends AccessNode implements StateSplit, LIRLowerable {
+
     @Input private ValueNode value;
     @Input(notDataflow = true) private FrameState stateAfter;
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,6 +38,7 @@
 
     /**
      * Creates a new AccessArrayNode.
+     * 
      * @param array the instruction that produces the array object value
      */
     public AccessArrayNode(Stamp stamp, ValueNode array) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessFieldNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,6 +45,7 @@
 
     /**
      * Constructs a new access field object.
+     * 
      * @param object the instruction producing the receiver object
      * @param field the compiler interface representation of the field
      */
@@ -58,6 +59,7 @@
 
     /**
      * Gets the compiler interface field for this field access.
+     * 
      * @return the compiler interface field for this field access
      */
     public ResolvedJavaField field() {
@@ -70,6 +72,7 @@
 
     /**
      * Checks whether this field access is an access to a static field.
+     * 
      * @return {@code true} if this field access is to a static field
      */
     public boolean isStatic() {
@@ -78,6 +81,7 @@
 
     /**
      * Checks whether this field is declared volatile.
+     * 
      * @return {@code true} if the field is resolved and declared volatile
      */
     public boolean isVolatile() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessIndexedNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code AccessIndexedNode} class is the base class of instructions that read or write
- * elements of an array.
+ * The {@code AccessIndexedNode} class is the base class of instructions that read or write elements
+ * of an array.
  */
 public abstract class AccessIndexedNode extends AccessArrayNode implements Lowerable {
 
@@ -43,6 +43,7 @@
 
     /**
      * Create an new AccessIndexedNode.
+     * 
      * @param stamp the result kind of the access
      * @param array the instruction producing the array
      * @param index the instruction producing the index
@@ -57,6 +58,7 @@
 
     /**
      * Gets the element type of the array.
+     * 
      * @return the element type
      */
     public Kind elementKind() {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/AccessMonitorNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,20 +28,19 @@
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * The {@code AccessMonitorNode} is the base class of both monitor acquisition and release.
- * <br>
+ * <p>
  * The VM needs information about monitors in the debug information. This information is built from
  * the nesting level of {@link MonitorEnterNode} when the LIR is constructed. Therefore, monitor
- * nodes must not be removed from the graph unless it is guaranteed that the nesting level does not change.
- * For example, you must not remove a {@link MonitorEnterNode} for a thread-local object or for a recursive locking.
- * Instead, mark the node as {@link #eliminated}. This makes sure that the meta data still contains the complete
- * locking hierarchy.
- * <br>
- * The Java bytecode specification allows non-balanced locking. Graal does not handle such cases and throws a
- * {@link BailoutException} instead during graph building.
+ * nodes must not be removed from the graph unless it is guaranteed that the nesting level does not
+ * change. For example, you must not remove a {@link MonitorEnterNode} for a thread-local object or
+ * for a recursive locking. Instead, mark the node as {@link #eliminated}. This makes sure that the
+ * meta data still contains the complete locking hierarchy.
+ * <p>
+ * The Java bytecode specification allows non-balanced locking. Graal does not handle such cases and
+ * throws a {@link BailoutException} instead during graph building.
  */
 public abstract class AccessMonitorNode extends AbstractStateSplit implements StateSplit, MemoryCheckpoint, Virtualizable {
 
@@ -62,7 +61,7 @@
 
     /**
      * Creates a new AccessMonitor instruction.
-     *
+     * 
      * @param object the instruction producing the object
      */
     public AccessMonitorNode(ValueNode object) {
@@ -72,13 +71,14 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            Debug.log("monitor operation %s on %s\n", this, virtual);
-            int newLockCount = tool.getVirtualLockCount(virtual) + (this instanceof MonitorEnterNode ? 1 : -1);
-            tool.setVirtualLockCount(virtual,  newLockCount);
-            tool.replaceFirstInput(object(), virtual);
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            Debug.log("monitor operation %s on %s\n", this, state);
+            int newLockCount = state.getLockCount() + (this instanceof MonitorEnterNode ? 1 : -1);
+            state.setLockCount(newLockCount);
+            tool.replaceFirstInput(object(), state.getVirtualObject());
             tool.customAction(new Runnable() {
+
                 @Override
                 public void run() {
                     eliminate();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * The {@code ArrayLength} instruction gets the length of an array.
@@ -71,10 +70,10 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(array());
-        if (virtual != null) {
-            assert virtual instanceof VirtualArrayNode : virtual;
-            tool.replaceWithValue(ConstantNode.forInt(virtual.entryCount(), graph()));
+        State state = tool.getObjectState(array());
+        if (state != null) {
+            assert state.getVirtualObject().type().isArray();
+            tool.replaceWithValue(ConstantNode.forInt(state.getVirtualObject().entryCount(), graph()));
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastDynamicNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Implements a type check where the type being checked is loaded at runtime.
- * This is used, for instance, to implement an object array store check.
+ * Implements a type check where the type being checked is loaded at runtime. This is used, for
+ * instance, to implement an object array store check.
  */
 public final class CheckCastDynamicNode extends FixedWithNextNode implements Canonicalizable, Lowerable, Node.IterableNodeType {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * Implements a type check against a compile-time known type.
@@ -40,7 +39,7 @@
 
     /**
      * Creates a new CheckCast instruction.
-     *
+     * 
      * @param type the type being cast to
      * @param object the instruction producing the object
      */
@@ -72,7 +71,8 @@
         if (type != null) {
             ResolvedJavaType objectType = object().objectStamp().type();
             if (objectType != null && type.isAssignableFrom(objectType)) {
-                // we don't have to check for null types here because they will also pass the checkcast.
+                // we don't have to check for null types here because they will also pass the
+                // checkcast.
                 return object();
             }
         }
@@ -100,9 +100,9 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null && type().isAssignableFrom(virtual.type())) {
-            tool.replaceWithVirtual(virtual);
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            tool.replaceWithVirtual(state.getVirtualObject());
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CompareAndSwapNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * Represents an atomic compare-and-swap operation
- * The result is a boolean that contains whether the value matched the expected value.
+ * Represents an atomic compare-and-swap operation The result is a boolean that contains whether the
+ * value matched the expected value.
  */
 public class CompareAndSwapNode extends AbstractStateSplit implements StateSplit, LIRLowerable, Lowerable, MemoryCheckpoint {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ExceptionObjectNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code ExceptionObject} instruction represents the incoming exception object to an exception handler.
+ * The {@code ExceptionObject} instruction represents the incoming exception object to an exception
+ * handler.
  */
 public class ExceptionObjectNode extends AbstractStateSplit implements StateSplit, LIRLowerable, MemoryCheckpoint {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfDynamicNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,9 +30,9 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code InstanceOfDynamicNode} represents a type check where the type being checked
- * is not known at compile time.
- * This is used, for instance, to intrinsify {@link Class#isInstance(Object)}.
+ * The {@code InstanceOfDynamicNode} represents a type check where the type being checked is not
+ * known at compile time. This is used, for instance, to intrinsify {@link Class#isInstance(Object)}
+ * .
  */
 public final class InstanceOfDynamicNode extends BooleanNode implements Canonicalizable, Lowerable {
 
@@ -41,8 +41,9 @@
 
     /**
      * Constructs a new InstanceOfNode.
-     *
-     * @param mirror the {@link Class} value representing the target target type of the instanceof check
+     * 
+     * @param mirror the {@link Class} value representing the target target type of the instanceof
+     *            check
      * @param object the object being tested by the instanceof
      */
     public InstanceOfDynamicNode(ValueNode mirror, ValueNode object) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/InstanceOfNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,6 @@
 import com.oracle.graal.nodes.calc.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * The {@code InstanceOfNode} represents an instanceof test.
@@ -41,7 +40,7 @@
 
     /**
      * Constructs a new InstanceOfNode.
-     *
+     * 
      * @param type the target type of the instanceof check
      * @param object the object being tested by the instanceof
      */
@@ -73,12 +72,14 @@
                     // the instanceOf matches, so return true
                     return ConstantNode.forBoolean(true, graph());
                 } else {
-                    // the instanceof matches if the object is non-null, so return true depending on the null-ness.
+                    // the instanceof matches if the object is non-null, so return true depending on
+                    // the null-ness.
                     negateUsages();
                     return graph().unique(new IsNullNode(object()));
                 }
             } else {
-                // since this type check failed for an exact type we know that it can never succeed at run time.
+                // since this type check failed for an exact type we know that it can never succeed
+                // at run time.
                 // we also don't care about null values, since they will also make the check fail.
                 return ConstantNode.forBoolean(false, graph());
             }
@@ -90,12 +91,14 @@
                     // the instanceOf matches, so return true
                     return ConstantNode.forBoolean(true, graph());
                 } else {
-                    // the instanceof matches if the object is non-null, so return true depending on the null-ness.
+                    // the instanceof matches if the object is non-null, so return true depending on
+                    // the null-ness.
                     negateUsages();
                     return graph().unique(new IsNullNode(object()));
                 }
             } else {
-                // since the subtype comparison was only performed on a declared type we don't really know if it might be true at run time...
+                // since the subtype comparison was only performed on a declared type we don't
+                // really know if it might be true at run time...
             }
         }
         if (object().objectStamp().alwaysNull()) {
@@ -129,9 +132,9 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            tool.replaceWithValue(ConstantNode.forBoolean(type().isAssignableFrom(virtual.type()), graph()));
+        State state = tool.getObjectState(object);
+        if (state != null) {
+            tool.replaceWithValue(ConstantNode.forBoolean(type().isAssignableFrom(state.getVirtualObject().type()), graph()));
         }
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadFieldNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,7 +37,7 @@
 
     /**
      * Creates a new LoadFieldNode instance.
-     *
+     * 
      * @param object the receiver object
      * @param field the compiler interface field
      */
@@ -73,17 +73,11 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            int fieldIndex = ((VirtualInstanceNode) virtual).fieldIndex(field());
+        State state = tool.getObjectState(object());
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            int fieldIndex = ((VirtualInstanceNode) state.getVirtualObject()).fieldIndex(field());
             if (fieldIndex != -1) {
-                ValueNode result = tool.getVirtualEntry(virtual, fieldIndex);
-                VirtualObjectNode virtualResult = tool.getVirtualState(result);
-                if (virtualResult != null) {
-                    tool.replaceWithVirtual(virtualResult);
-                } else {
-                    tool.replaceWithValue(result);
-                }
+                tool.replaceWith(state.getEntry(fieldIndex));
             }
         }
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoadIndexedNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * The {@code LoadIndexedNode} represents a read from an element of an array.
@@ -36,6 +35,7 @@
 
     /**
      * Creates a new LoadIndexedNode.
+     * 
      * @param array the instruction producing the array
      * @param index the instruction producing the index
      * @param elementKind the element type
@@ -54,18 +54,12 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtualArray = tool.getVirtualState(array());
-        if (virtualArray != null) {
+        State arrayState = tool.getObjectState(array());
+        if (arrayState != null && arrayState.getState() == EscapeState.Virtual) {
             ValueNode indexValue = tool.getReplacedValue(index());
             int index = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1;
-            if (index >= 0 && index < virtualArray.entryCount()) {
-                ValueNode result = tool.getVirtualEntry(virtualArray, index);
-                VirtualObjectNode virtualResult = tool.getVirtualState(result);
-                if (virtualResult != null) {
-                    tool.replaceWithVirtual(virtualResult);
-                } else {
-                    tool.replaceWithValue(result);
-                }
+            if (index >= 0 && index < arrayState.getVirtualObject().entryCount()) {
+                tool.replaceWith(arrayState.getEntry(index));
             }
         }
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,11 +29,9 @@
 import com.oracle.graal.nodes.type.*;
 
 public class MethodCallTargetNode extends CallTargetNode implements Node.IterableNodeType, Canonicalizable {
+
     public enum InvokeKind {
-        Interface,
-        Special,
-        Static,
-        Virtual
+        Interface, Special, Static, Virtual
     }
 
     private final JavaType returnType;
@@ -52,6 +50,7 @@
 
     /**
      * Gets the target method for this invocation instruction.
+     * 
      * @return the target method
      */
     public ResolvedJavaMethod targetMethod() {
@@ -72,8 +71,9 @@
 
     /**
      * Gets the instruction that produces the receiver object for this invocation, if any.
-     * @return the instruction that produces the receiver object for this invocation if any, {@code null} if this
-     *         invocation does not take a receiver object
+     * 
+     * @return the instruction that produces the receiver object for this invocation if any,
+     *         {@code null} if this invocation does not take a receiver object
      */
     public ValueNode receiver() {
         return isStatic() ? null : arguments().get(0);
@@ -81,6 +81,7 @@
 
     /**
      * Checks whether this is an invocation of a static method.
+     * 
      * @return {@code true} if the invocation is a static invocation
      */
     public boolean isStatic() {
@@ -95,7 +96,6 @@
         return (Invoke) this.usages().first();
     }
 
-
     @Override
     public boolean verify() {
         assert usages().count() <= 1 : "call target may only be used by a single invoke";
@@ -131,6 +131,10 @@
         return this;
     }
 
+    public JavaType returnType() {
+        return returnType;
+    }
+
     @Override
     public Stamp returnStamp() {
         Kind returnKind = targetMethod.getSignature().getReturnKind();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorEnterNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 
     /**
      * Creates a new MonitorEnterNode.
-     *
+     * 
      * @param object the instruction producing the object
      */
     public MonitorEnterNode(ValueNode object) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MonitorExitNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,7 +34,7 @@
 
     /**
      * Creates a new MonitorExitNode.
-     *
+     * 
      * @param object the instruction produces the object value
      */
     public MonitorExitNode(ValueNode object) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,13 +31,12 @@
 /**
  * The {@code NewArrayNode} class is the base of all instructions that allocate arrays.
  */
-public abstract class NewArrayNode extends FixedWithNextNode implements Lowerable, EscapeAnalyzable, ArrayLengthProvider {
+public abstract class NewArrayNode extends FixedWithNextNode implements Canonicalizable, Lowerable, VirtualizableAllocation, ArrayLengthProvider {
 
     @Input private ValueNode length;
     private final ResolvedJavaType elementType;
     private final boolean fillContents;
 
-    public static final int MaximumEscapeAnalysisArrayLength = 32;
     private final boolean locked;
 
     @Override
@@ -47,8 +46,9 @@
 
     /**
      * Constructs a new NewArrayNode.
-     *
-     * @param elementType the the type of the elements of the newly created array (not the type of the array itself).
+     * 
+     * @param elementType the the type of the elements of the newly created array (not the type of
+     *            the array itself).
      * @param length the node that produces the length for this allocation.
      * @param fillContents determines whether the array elements should be initialized to zero/null.
      * @param locked determines whether the array should be locked immediately.
@@ -85,7 +85,7 @@
 
     /**
      * Gets the element type of the array.
-     *
+     * 
      * @return the element type of the array
      */
     public ResolvedJavaType elementType() {
@@ -100,24 +100,33 @@
     }
 
     @Override
+    public ValueNode canonical(CanonicalizerTool tool) {
+        if (usages().isEmpty() && length.integerStamp().isPositive()) {
+            return null;
+        } else {
+            return this;
+        }
+    }
+
+    @Override
     public void lower(LoweringTool tool) {
         tool.getRuntime().lower(this, tool);
     }
 
     @Override
-    public ObjectDesc[] getAllocations(long nextVirtualId, MetaAccessProvider metaAccess) {
+    public void virtualize(VirtualizerTool tool) {
         if (length().asConstant() != null) {
             final int constantLength = length().asConstant().asInt();
-            if (constantLength >= 0 && constantLength < MaximumEscapeAnalysisArrayLength) {
+            if (constantLength >= 0 && constantLength < tool.getMaximumEntryCount()) {
                 ValueNode[] state = new ValueNode[constantLength];
                 ConstantNode defaultForKind = constantLength == 0 ? null : ConstantNode.defaultForKind(elementType().getKind(), graph());
                 for (int i = 0; i < constantLength; i++) {
                     state[i] = defaultForKind;
                 }
-                VirtualObjectNode virtualObject = new VirtualArrayNode(nextVirtualId, elementType, constantLength);
-                return new ObjectDesc[]{new ObjectDesc(virtualObject, state, 0)};
+                VirtualObjectNode virtualObject = new VirtualArrayNode(tool.getNextVirtualId(), elementType, constantLength);
+                tool.createVirtualObject(virtualObject, state, 0);
+                tool.replaceWithVirtual(virtualObject);
             }
         }
-        return null;
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewInstanceNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
  * The {@code NewInstanceNode} represents the allocation of an instance class object.
  */
 @NodeInfo(nameTemplate = "New {p#instanceClass/s}")
-public final class NewInstanceNode extends FixedWithNextNode implements EscapeAnalyzable, Lowerable, Node.IterableNodeType {
+public final class NewInstanceNode extends FixedWithNextNode implements Node.IterableNodeType, Canonicalizable, Lowerable, VirtualizableAllocation {
 
     private final ResolvedJavaType instanceClass;
     private final boolean fillContents;
@@ -41,9 +41,10 @@
 
     /**
      * Constructs a NewInstanceNode.
-     *
+     * 
      * @param type the class being allocated
-     * @param fillContents determines whether the new object's fields should be initialized to zero/null.
+     * @param fillContents determines whether the new object's fields should be initialized to
+     *            zero/null.
      * @param locked determines whether the new object should be locked immediately.
      */
     public NewInstanceNode(ResolvedJavaType type, boolean fillContents, boolean locked) {
@@ -55,7 +56,7 @@
 
     /**
      * Gets the instance class being allocated by this node.
-     *
+     * 
      * @return the instance class allocated
      */
     public ResolvedJavaType instanceClass() {
@@ -77,12 +78,21 @@
     }
 
     @Override
+    public ValueNode canonical(CanonicalizerTool tool) {
+        if (usages().isEmpty()) {
+            return null;
+        } else {
+            return this;
+        }
+    }
+
+    @Override
     public void lower(LoweringTool tool) {
         tool.getRuntime().lower(this, tool);
     }
 
     @Override
-    public ObjectDesc[] getAllocations(long nextVirtualId, MetaAccessProvider metaAccess) {
+    public void virtualize(VirtualizerTool tool) {
         if (instanceClass != null) {
             assert !instanceClass().isArray();
             ResolvedJavaField[] fields = instanceClass().getInstanceFields(true);
@@ -90,9 +100,9 @@
             for (int i = 0; i < state.length; i++) {
                 state[i] = ConstantNode.defaultForKind(fields[i].getType().getKind(), graph());
             }
-            VirtualObjectNode virtualObject = new VirtualInstanceNode(nextVirtualId, instanceClass(), fields);
-            return new ObjectDesc[]{new ObjectDesc(virtualObject, state, 0)};
+            VirtualObjectNode virtualObject = new VirtualInstanceNode(tool.getNextVirtualId(), instanceClass(), fields);
+            tool.createVirtualObject(virtualObject, state, 0);
+            tool.replaceWithVirtual(virtualObject);
         }
-        return null;
     }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewMultiArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,7 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object
- * array.
+ * The {@code NewMultiArrayNode} represents an allocation of a multi-dimensional object array.
  */
 public final class NewMultiArrayNode extends FixedWithNextNode implements Lowerable {
 
@@ -51,6 +50,7 @@
 
     /**
      * Constructs a new NewMultiArrayNode.
+     * 
      * @param type the element type of the array
      * @param dimensions the node which produce the dimensions for this array
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewObjectArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 
     /**
      * Constructs a new NewObjectArrayNode.
+     * 
      * @param elementClass the class of elements in this array
      * @param length the node producing the length of the array
      * @param fillContents determines whether the array elements should be initialized to null.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/NewPrimitiveArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 
     /**
      * Constructs a new NewPrimitiveArrayNode.
+     * 
      * @param elementType the type of elements in this array
      * @param length the node producing the length of the array
      * @param fillContents determines whether the array elements should be initialized to zero.
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/RegisterFinalizerNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,8 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * This node is used to perform the finalizer registration at the end of the java.lang.Object constructor.
+ * This node is used to perform the finalizer registration at the end of the java.lang.Object
+ * constructor.
  */
 public final class RegisterFinalizerNode extends AbstractStateSplit implements StateSplit, Canonicalizable, LIRLowerable {
 
@@ -60,7 +61,8 @@
         if (stamp.isExactType()) {
             needsCheck = stamp.type().hasFinalizer();
         } else if (stamp.type() != null && !stamp.type().hasFinalizableSubclass()) {
-            // if either the declared type of receiver or the holder can be assumed to have no finalizers
+            // if either the declared type of receiver or the holder can be assumed to have no
+            // finalizers
             if (tool.assumptions().useOptimisticAssumptions() && tool.assumptions().recordNoFinalizableSubclassAssumption(stamp.type())) {
                 needsCheck = false;
             }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreFieldNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -58,6 +58,7 @@
 
     /**
      * Creates a new StoreFieldNode.
+     * 
      * @param object the receiver object
      * @param field the compiler interface field
      * @param value the node representing the value to store to the field
@@ -69,11 +70,11 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            int fieldIndex = ((VirtualInstanceNode) virtual).fieldIndex(field());
+        State state = tool.getObjectState(object());
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            int fieldIndex = ((VirtualInstanceNode) state.getVirtualObject()).fieldIndex(field());
             if (fieldIndex != -1) {
-                tool.setVirtualEntry(virtual, fieldIndex, value());
+                tool.setVirtualEntry(state, fieldIndex, value());
                 tool.delete();
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/StoreIndexedNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
-import com.oracle.graal.nodes.virtual.*;
 
 /**
  * The {@code StoreIndexedNode} represents a write to an array element.
@@ -56,6 +55,7 @@
 
     /**
      * Creates a new StoreIndexedNode.
+     * 
      * @param array the node producing the array
      * @param index the node producing the index
      * @param elementKind the element type
@@ -68,12 +68,12 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtualArray = tool.getVirtualState(array());
-        if (virtualArray != null) {
+        State arrayState = tool.getObjectState(array());
+        if (arrayState != null && arrayState.getState() == EscapeState.Virtual) {
             ValueNode indexValue = tool.getReplacedValue(index());
             int index = indexValue.isConstant() ? indexValue.asConstant().asInt() : -1;
-            if (index >= 0 && index < virtualArray.entryCount()) {
-                tool.setVirtualEntry(virtualArray, index, value());
+            if (index >= 0 && index < arrayState.getVirtualObject().entryCount()) {
+                tool.setVirtualEntry(arrayState, index, value());
                 tool.delete();
             }
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/TypeSwitchNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,8 +33,8 @@
 import com.oracle.graal.nodes.util.*;
 
 /**
- * The {@code TypeSwitchNode} performs a lookup based on the type of the input value.
- * The type comparison is an exact type comparison, not an instanceof.
+ * The {@code TypeSwitchNode} performs a lookup based on the type of the input value. The type
+ * comparison is an exact type comparison, not an instanceof.
  */
 public final class TypeSwitchNode extends SwitchNode implements LIRLowerable, Simplifiable {
 
@@ -43,7 +43,7 @@
     /**
      * Constructs a type switch instruction. The keyProbabilities array contain key.length + 1
      * entries. The last entry in every array describes the default case.
-     *
+     * 
      * @param value the instruction producing the value being switched on
      * @param successors the list of successors
      * @param keys the list of types
@@ -108,7 +108,7 @@
                 } else if (validKeys != keys.length) {
                     ArrayList<BeginNode> newSuccessors = new ArrayList<>(blockSuccessorCount());
                     ResolvedJavaType[] newKeys = new ResolvedJavaType[validKeys];
-                    int[] newKeySuccessors = new int [validKeys + 1];
+                    int[] newKeySuccessors = new int[validKeys + 1];
                     double[] newKeyProbabilities = new double[validKeys + 1];
                     double totalProbability = 0;
                     int current = 0;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/CanonicalizerTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,13 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 
+public interface CanonicalizerTool {
 
-public interface CanonicalizerTool {
     TargetDescription target();
+
     Assumptions assumptions();
+
     MetaAccessProvider runtime();
+
     void removeIfUnused(Node node);
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/EscapeAnalyzable.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +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.nodes.spi;
-
-import com.oracle.graal.api.meta.*;
-import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.virtual.*;
-
-public interface EscapeAnalyzable {
-
-    public static class ObjectDesc {
-
-        public final VirtualObjectNode virtualObject;
-        public final ValueNode[] entryState;
-        public final int lockCount;
-
-        public ObjectDesc(VirtualObjectNode virtualObject, ValueNode[] entryState, int lockCount) {
-            this.virtualObject = virtualObject;
-            this.entryState = entryState;
-            this.lockCount = lockCount;
-        }
-    }
-
-    ObjectDesc[] getAllocations(long nextVirtualId, MetaAccessProvider metaAccess);
-}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,6 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.nodes.*;
 
-
 public interface GraphCache {
 
     void put(StructuredGraph graph);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LIRGeneratorTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,82 +30,116 @@
 import com.oracle.graal.nodes.java.*;
 
 public abstract class LIRGeneratorTool {
+
     public abstract TargetDescription target();
 
     public abstract CodeCacheProvider getRuntime();
 
     /**
-     * Checks whether the supplied constant can be used without loading it into a register
-     * for most operations, i.e., for commonly used arithmetic, logical, and comparison operations.
+     * Checks whether the supplied constant can be used without loading it into a register for most
+     * operations, i.e., for commonly used arithmetic, logical, and comparison operations.
+     * 
      * @param c The constant to check.
-     * @return True if the constant can be used directly, false if the constant needs to be in a register.
+     * @return True if the constant can be used directly, false if the constant needs to be in a
+     *         register.
      */
     public abstract boolean canInlineConstant(Constant c);
 
     /**
-     * Checks whether the supplied constant can be used without loading it into a register
-     * for store operations, i.e., on the right hand side of a memory access.
+     * Checks whether the supplied constant can be used without loading it into a register for store
+     * operations, i.e., on the right hand side of a memory access.
+     * 
      * @param c The constant to check.
-     * @return True if the constant can be used directly, false if the constant needs to be in a register.
+     * @return True if the constant can be used directly, false if the constant needs to be in a
+     *         register.
      */
     public abstract boolean canStoreConstant(Constant c);
 
     public abstract RegisterAttributes attributes(Register register);
 
     public abstract Value operand(ValueNode object);
+
     public abstract Value newVariable(Kind kind);
+
     public abstract Value setResult(ValueNode x, Value operand);
 
     public abstract Address makeAddress(LocationNode location, ValueNode object);
 
     public abstract Value emitMove(Value input);
+
     public abstract void emitMove(Value src, Value dst);
+
     public abstract Value emitLoad(Value loadAddress, boolean canTrap);
+
     public abstract void emitStore(Value storeAddress, Value input, boolean canTrap);
+
     public abstract Value emitLea(Value address);
 
     public abstract Value emitNegate(Value input);
+
     public abstract Value emitAdd(Value a, Value b);
+
     public abstract Value emitSub(Value a, Value b);
+
     public abstract Value emitMul(Value a, Value b);
+
     public abstract Value emitDiv(Value a, Value b);
+
     public abstract Value emitRem(Value a, Value b);
+
     public abstract Value emitUDiv(Value a, Value b);
+
     public abstract Value emitURem(Value a, Value b);
 
     public abstract Value emitAnd(Value a, Value b);
+
     public abstract Value emitOr(Value a, Value b);
+
     public abstract Value emitXor(Value a, Value b);
 
     public abstract Value emitShl(Value a, Value b);
+
     public abstract Value emitShr(Value a, Value b);
+
     public abstract Value emitUShr(Value a, Value b);
 
     public abstract Value emitConvert(ConvertNode.Op opcode, Value inputVal);
+
     public abstract void emitMembar(int barriers);
+
     public abstract void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo);
+
     public abstract void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo, long leafGraphId);
+
     public abstract Value emitCall(RuntimeCallTarget callTarget, CallingConvention cc, boolean canTrap, Value... args);
 
     public abstract void emitIf(IfNode i);
+
     public abstract void emitConditional(ConditionalNode i);
+
     public abstract void emitGuardCheck(BooleanNode comp, DeoptimizationReason deoptReason, DeoptimizationAction deoptAction, boolean negated, long leafGraphId);
 
     public abstract void emitSwitch(SwitchNode i);
 
     public abstract void emitInvoke(Invoke i);
+
     public abstract void visitRuntimeCall(RuntimeCallNode i);
 
     // Handling of block-end nodes still needs to be unified in the LIRGenerator.
     public abstract void visitMerge(MergeNode i);
+
     public abstract void visitEndNode(EndNode i);
+
     public abstract void visitLoopEnd(LoopEndNode i);
 
     public abstract void visitCompareAndSwap(CompareAndSwapNode i);
 
     // These methods define the contract a runtime specific backend must provide.
     public abstract void visitExceptionObject(ExceptionObjectNode i);
+
     public abstract void visitReturn(ReturnNode i);
+
     public abstract void visitSafepointNode(SafepointNode i);
+
     public abstract void visitBreakpointNode(BreakpointNode i);
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/LoweringTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,10 +29,17 @@
 import com.oracle.graal.nodes.cfg.*;
 
 public interface LoweringTool {
+
+    TargetDescription getTarget();
+
     GraalCodeCacheProvider getRuntime();
+
     ValueNode createNullCheckGuard(ValueNode object, long leafGraphId);
+
     ValueNode createGuard(BooleanNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, long leafGraphId);
+
     ValueNode createGuard(BooleanNode condition, DeoptimizationReason deoptReason, DeoptimizationAction action, boolean negated, long leafGraphId);
+
     Assumptions assumptions();
 
     Block getBlockFor(Node node);
@@ -42,4 +49,3 @@
      */
     FixedWithNextNode lastFixedNode();
 }
-
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,16 +25,18 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * This interface marks a node as being able to negate its effect, this is intended for nodes that depend on a
- * BooleanNode condition. The canonical representation of has, for example, no way to represent a != b. If such an
- * expression appears during canonicalization the negated expression will be created (a == b) and the usages will be
- * negated, using this interface's {@link #negate()} method.
+ * This interface marks a node as being able to negate its effect, this is intended for nodes that
+ * depend on a BooleanNode condition. The canonical representation of has, for example, no way to
+ * represent a != b. If such an expression appears during canonicalization the negated expression
+ * will be created (a == b) and the usages will be negated, using this interface's {@link #negate()}
+ * method.
  */
 public interface Negatable {
 
     /**
-     * Tells this node that a condition it depends has been negated, and that it thus needs to invert its own effect.
-     * For example, an {@link IfNode} would switch its true and false successors.
+     * Tells this node that a condition it depends has been negated, and that it thus needs to
+     * invert its own effect. For example, an {@link IfNode} would switch its true and false
+     * successors.
      */
     Negatable negate();
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Simplifiable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Simplifiable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,11 +23,13 @@
 package com.oracle.graal.nodes.spi;
 
 /**
- * This interface allows nodes to perform more complicated simplifications, in contrast to {@link Canonicalizable},
- * which supports only replacing the current node.
- *
- * Implementors of this interface need to be aware that they need to call {@link SimplifierTool#addToWorkList(com.oracle.graal.graph.Node)} for each node that might
- * be influenced (in terms of simplification and canonicalization) by the actions performed in simplify.
+ * This interface allows nodes to perform more complicated simplifications, in contrast to
+ * {@link Canonicalizable}, which supports only replacing the current node.
+ * 
+ * Implementors of this interface need to be aware that they need to call
+ * {@link SimplifierTool#addToWorkList(com.oracle.graal.graph.Node)} for each node that might be
+ * influenced (in terms of simplification and canonicalization) by the actions performed in
+ * simplify.
  */
 public interface Simplifiable {
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/SimplifierTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/SimplifierTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
  * @see Simplifiable
  */
 public interface SimplifierTool extends CanonicalizerTool {
+
     void deleteBranch(FixedNode branch);
 
     /**
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Virtualizable.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,18 +22,45 @@
  */
 package com.oracle.graal.nodes.spi;
 
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.virtual.*;
+
 /**
- * This interface allows a node to convey information about what its effect would be if some of its inputs were
- * virtualized.
+ * This interface allows a node to convey information about what its effect would be if some of its
+ * inputs were virtualized. The {@link #virtualize(VirtualizerTool)} method will only be called for
+ * nodes that have some interaction with virtualized nodes. However, the virtualized nodes might
+ * have been re-materialized in the meantime.
  */
 public interface Virtualizable {
 
+    public static enum EscapeState {
+        Virtual, ThreadLocal, Global
+    }
+
+    public abstract static class State {
+
+        public abstract EscapeState getState();
+
+        public abstract VirtualObjectNode getVirtualObject();
+
+        public abstract void setEntry(int index, ValueNode value);
+
+        public abstract ValueNode getEntry(int index);
+
+        public abstract int getLockCount();
+
+        public abstract void setLockCount(int lockCount);
+
+        public abstract ValueNode getMaterializedValue();
+    }
+
     /**
-     * A node class can implement this method to convey information about what its effect would be if some of its inputs
-     * were virtualized. All modifications must be made through the supplied tool, and not directly on the node, because
-     * by the time this method is called the virtualized/non-virtualized state is still speculative and might not hold
-     * because of loops, etc.
-     *
+     * A node class can implement this method to convey information about what its effect would be
+     * if some of its inputs were virtualized. All modifications must be made through the supplied
+     * tool, and not directly on the node, because by the time this method is called the
+     * virtualized/non-virtualized state is still speculative and might not hold because of loops,
+     * etc.
+     * 
      * @param tool the tool used to describe the effects of this node
      */
     void virtualize(VirtualizerTool tool);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizableAllocation.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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.nodes.spi;
+
+/**
+ * This interface allows a node to convey information about what its effect would be if some of its
+ * inputs were virtualized.
+ * 
+ * The difference to {@link Virtualizable} is that the {@link #virtualize(VirtualizerTool)} method
+ * will be called regardless of whether this node had any interaction with virtualized nodes. This
+ * interface can therefore be used for object allocations, for which virtualization introduces new
+ * virtualized objects.
+ * 
+ */
+public interface VirtualizableAllocation extends Virtualizable {
+
+}
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/VirtualizerTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,82 +25,82 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.Virtualizable.State;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
- * This tool can be used to query the current state (normal/virtualized/re-materialized) of values and to describe the
- * actions that would be taken for this state.
- *
+ * This tool can be used to query the current state (normal/virtualized/re-materialized) of values
+ * and to describe the actions that would be taken for this state.
+ * 
  * See also {@link Virtualizable}.
  */
 public interface VirtualizerTool {
 
     /**
-     * @return the {@link MetaAccessProvider} associated with the current compilation, which might be required for
-     *         creating constants, etc.
+     * @return the {@link MetaAccessProvider} associated with the current compilation, which might
+     *         be required for creating constants, etc.
      */
     MetaAccessProvider getMetaAccessProvider();
 
+    /**
+     * This method should be used to query the maximum size of virtualized objects before attempting
+     * virtualization.
+     * 
+     * @return the maximum number of entries for virtualized objects.
+     */
+    int getMaximumEntryCount();
+
+    /**
+     * @return the next id for virtual objects (can be used for the VirtualObject constructor).
+     */
+    int getNextVirtualId();
+
     // methods working on virtualized/materialized objects
 
     /**
-     * Queries the current state of the given value: if it is virtualized (thread-local and the compiler knows all
-     * entries) or not.
-     *
-     * @param value the value whose state should be queried.
-     * @return the {@link VirtualObjectNode} representing the value if it is virtualized, null otherwise.
+     * Introduces a new virtual object to the current state.
+     * 
+     * @param virtualObject the new virtual object.
+     * @param entryState the initial state of the virtual object's fields.
+     * @param lockCount the initial locking depth.
      */
-    VirtualObjectNode getVirtualState(ValueNode value);
+    void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, int lockCount);
 
     /**
-     * Retrieves the entry (field or array element) with the given index in the virtualized object.
-     *
-     * @param virtual the virtualized object
-     * @param index the index to be queried.
-     * @return the entry at the given index.
+     * Queries the current state of the given value: if it is virtualized (thread-local and the
+     * compiler knows all entries) or not.
+     * 
+     * @param value the value whose state should be queried.
+     * @return the {@link State} representing the value if it has been virtualized at some point,
+     *         null otherwise.
      */
-    ValueNode getVirtualEntry(VirtualObjectNode virtual, int index);
+    State getObjectState(ValueNode value);
 
     /**
      * Sets the entry (field or array element) with the given index in the virtualized object.
-     *
-     * @param virtual the virtualized object.
+     * 
+     * @param state the state.
      * @param index the index to be set.
      * @param value the new value for the given index.
      */
-    void setVirtualEntry(VirtualObjectNode virtual, int index, ValueNode value);
-
-    /**
-     * Retrieves the lock count of the given virtualized object.
-     *
-     * @param virtual the virtualized object.
-     * @return the number of locks.
-     */
-    int getVirtualLockCount(VirtualObjectNode virtual);
-
-    /**
-     * Sets the lock count of the given virtualized object.
-     *
-     * @param virtual the virtualized object.
-     * @param lockCount the new lock count.
-     */
-    void setVirtualLockCount(VirtualObjectNode virtual, int lockCount);
+    void setVirtualEntry(State state, int index, ValueNode value);
 
     /**
      * Queries the current state of the given value: if it was materialized or not.
-     *
+     * 
      * @param value the value whose state should be queried.
-     * @return the materialized value (usually a MaterializeObjectNode or a {@link PhiNode}) if it was materialized,
-     *         null otherwise.
+     * @return the materialized value (usually a MaterializeObjectNode or a {@link PhiNode}) if it
+     *         was materialized, null otherwise.
      */
     ValueNode getMaterializedValue(ValueNode value);
 
     // scalar replacement
 
     /**
-     * Replacements via {@link #replaceWithValue(ValueNode)} are not immediately committed. This method can be used to
-     * determine if a value was replaced by another one (e.g., a load field by the loaded value).
-     *
+     * Replacements via {@link #replaceWithValue(ValueNode)} are not immediately committed. This
+     * method can be used to determine if a value was replaced by another one (e.g., a load field by
+     * the loaded value).
+     * 
      * @param original the original input value.
      * @return the replacement value, or the original value if there is no replacement.
      */
@@ -110,14 +110,14 @@
 
     /**
      * Deletes the current node and replaces it with the given virtualized object.
-     *
+     * 
      * @param virtual the virtualized object that should replace the current node.
      */
     void replaceWithVirtual(VirtualObjectNode virtual);
 
     /**
      * Deletes the current node and replaces it with the given value.
-     *
+     * 
      * @param replacement the value that should replace the current node.
      */
     void replaceWithValue(ValueNode replacement);
@@ -129,17 +129,25 @@
 
     /**
      * Replaces an input of the current node.
-     *
+     * 
      * @param oldInput the old input value.
      * @param replacement the new input value.
      */
     void replaceFirstInput(Node oldInput, Node replacement);
 
     /**
-     * Performs a custom action on the current node. This action will only be performed when, and if, the changes are
-     * committed. Custom actions must not modify inputs of nodes.
-     *
+     * Performs a custom action on the current node. This action will only be performed when, and
+     * if, the changes are committed. Custom actions must not modify inputs of nodes.
+     * 
      * @param action the custom action.
      */
     void customAction(Runnable action);
+
+    /**
+     * This method performs either {@link #replaceWithValue(ValueNode)} or
+     * {@link #replaceWithVirtual(VirtualObjectNode)}, depending on the given value.
+     * 
+     * @param value the replacement value
+     */
+    void replaceWith(ValueNode value);
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/FloatStamp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 public class FloatStamp extends Stamp {
 
     private final double lowerBound;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/IntegerStamp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,7 @@
 
 /**
  * Describes the possible values of a {@link ValueNode} that produces an int or long result.
- *
+ * 
  * The description consists of (inclusive) lower and upper bounds and a bit-mask.
  */
 public class IntegerStamp extends Stamp {
@@ -38,7 +38,7 @@
     private final long mask;
 
     public IntegerStamp(Kind kind) {
-        this(kind, kind.getMinValue(), kind.getMaxValue(), defaultMask(kind));
+        this(kind.getStackKind(), kind.getMinValue(), kind.getMaxValue(), defaultMask(kind));
     }
 
     public IntegerStamp(Kind kind, long lowerBound, long upperBound, long mask) {
@@ -72,8 +72,8 @@
     }
 
     /**
-     * This bit-mask describes the bits that can be set in the value described by this stamp. It is primarily used to
-     * represent values that are multiples of a known power of two.
+     * This bit-mask describes the bits that can be set in the value described by this stamp. It is
+     * primarily used to represent values that are multiples of a known power of two.
      */
     public long mask() {
         return mask;
@@ -191,14 +191,21 @@
 
     public static long defaultMask(Kind kind) {
         switch (kind) {
-            case Boolean: return 0x01L;
-            case Byte: return 0xffL;
-            case Char: return 0xffffL;
-            case Short: return 0xffffL;
+            case Boolean:
+                return 0x01L;
+            case Byte:
+                return 0xffL;
+            case Char:
+                return 0xffffL;
+            case Short:
+                return 0xffffL;
             case Jsr:
-            case Int: return 0xffffffffL;
-            case Long: return 0xffffffffffffffffL;
-            default: throw GraalInternalError.shouldNotReachHere();
+            case Int:
+                return 0xffffffffL;
+            case Long:
+                return 0xffffffffffffffffL;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
     }
 
@@ -212,9 +219,11 @@
     }
 
     /**
-     * Checks if the 2 stamps represent values of the same sign.
-     * Returns true if the two stamps are both positive of null or if they are both strictly negative
-     * @return true if the two stamps are both positive of null or if they are both strictly negative
+     * Checks if the 2 stamps represent values of the same sign. Returns true if the two stamps are
+     * both positive of null or if they are both strictly negative
+     * 
+     * @return true if the two stamps are both positive of null or if they are both strictly
+     *         negative
      */
     public static boolean sameSign(IntegerStamp s1, IntegerStamp s2) {
         return s1.isPositive() && s2.isPositive() || s1.isStrictlyNegative() && s2.isStrictlyNegative();
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import com.oracle.graal.api.meta.*;
 
-
 public class ObjectStamp extends Stamp {
 
     private final ResolvedJavaType type;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/Stamp.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,8 +41,8 @@
     }
 
     /**
-     * Returns the type of the stamp, guaranteed to be non-null. In some cases, this requires the lookup of class meta
-     * data, therefore the {@link MetaAccessProvider} is mandatory.
+     * Returns the type of the stamp, guaranteed to be non-null. In some cases, this requires the
+     * lookup of class meta data, therefore the {@link MetaAccessProvider} is mandatory.
      */
     public abstract ResolvedJavaType javaType(MetaAccessProvider metaAccess);
 
@@ -53,8 +53,9 @@
     public abstract boolean alwaysDistinct(Stamp other);
 
     /**
-     * Returns the union of this stamp and the given stamp. Typically used to create stamps for {@link PhiNode}s.
-     *
+     * Returns the union of this stamp and the given stamp. Typically used to create stamps for
+     * {@link PhiNode}s.
+     * 
      * @param other The stamp that will enlarge this stamp.
      * @return The union of this stamp and the given stamp.
      */
@@ -62,7 +63,7 @@
 
     /**
      * Returns the intersection of this stamp and the given stamp.
-     *
+     * 
      * @param other The stamp that will tighten this stamp.
      * @return The intersection of this stamp and the given stamp.
      */
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.type.GenericStamp.GenericStampType;
 
+public class StampFactory {
 
-public class StampFactory {
     private static final Stamp[] stampCache = new Stamp[Kind.values().length];
     private static final Stamp objectStamp = new ObjectStamp(null, false, false, false);
     private static final Stamp objectNonNullStamp = new ObjectStamp(null, false, true, false);
@@ -64,8 +64,8 @@
     }
 
     public static Stamp forKind(Kind kind) {
-        assert stampCache[kind.getStackKind().ordinal()] != null : "unexpected forKind(" + kind + ")";
-        return stampCache[kind.getStackKind().ordinal()];
+        assert stampCache[kind.ordinal()] != null : "unexpected forKind(" + kind + ")";
+        return stampCache[kind.ordinal()];
     }
 
     public static Stamp forVoid() {
@@ -73,16 +73,16 @@
     }
 
     /**
-     * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by an actual stamp when the
-     * intrinsic is used, i.e., when the snippet template is instantiated.
+     * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by an
+     * actual stamp when the intrinsic is used, i.e., when the snippet template is instantiated.
      */
     public static Stamp forNodeIntrinsic() {
         return nodeIntrinsicStamp;
     }
 
     /**
-     * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by the actual primitive type
-     * stamp for the target-specific {@link TargetDescription#wordKind}.
+     * A stamp used only in the graph of intrinsics, e.g., snippets. It is then replaced by the
+     * actual primitive type stamp for the target-specific {@link TargetDescription#wordKind}.
      */
     public static Stamp forWord() {
         return wordStamp;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampProvider.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampProvider.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,7 @@
  */
 package com.oracle.graal.nodes.type;
 
+public interface StampProvider {
 
-public interface StampProvider {
     Stamp stamp();
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampTool.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,7 +45,7 @@
     }
 
     public static Stamp meet(Collection<? extends StampProvider> values) {
-        Iterator< ? extends StampProvider> iterator = values.iterator();
+        Iterator<? extends StampProvider> iterator = values.iterator();
         if (iterator.hasNext()) {
             Stamp stamp = iterator.next().stamp();
             while (iterator.hasNext()) {
@@ -130,6 +130,12 @@
         return stampForMask(kind, mask);
     }
 
+    public static Stamp xor(IntegerStamp stamp1, IntegerStamp stamp2) {
+        Kind kind = stamp1.kind();
+        long mask = stamp1.mask() | stamp2.mask();
+        return stampForMask(kind, mask);
+    }
+
     public static Stamp unsignedRightShift(IntegerStamp value, IntegerStamp shift) {
         Kind kind = value.kind();
         if (shift.lowerBound() == shift.upperBound()) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/ComputeImmediateDominator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/ComputeImmediateDominator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,8 +27,8 @@
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
 
+public final class ComputeImmediateDominator {
 
-public final class ComputeImmediateDominator {
     private final MergeNode dominated;
     private final Queue<FixedNode> toExplore;
     private final Queue<FixedNode> speculativeExplore;
@@ -73,7 +73,7 @@
         if (info.isExplored()) {
             return;
         }
-        //TTY.println("exploreUp(" + from + ") with " + info);
+        // TTY.println("exploreUp(" + from + ") with " + info);
         info.setExplored();
         while (p != null) {
             if (p instanceof MergeNode) {
@@ -89,7 +89,7 @@
     }
 
     private void processControlSplit(ControlSplitNode cs, DominatorInfo info) {
-        //TTY.println("processControlSplit(" + cs + ", " + info + ")");
+        // TTY.println("processControlSplit(" + cs + ", " + info + ")");
         DominatorInfo csInfo = infoMap.get(cs);
         if (csInfo == null) {
             csInfo = new DominatorInfo(cs, false);
@@ -101,15 +101,16 @@
             return;
         }
         if (csInfo.isExplored()) {
-            //TTY.println("  Already explored, propagate update");
+            // TTY.println("  Already explored, propagate update");
             propagateUpdate(csInfo);
         } else {
-            if (csInfo.parentCount() == cs.successors().count()) { // all paths leading to this CS have been explored
-                //TTY.println("  All parents explored, Enqueue");
+            if (csInfo.parentCount() == cs.successors().count()) { // all paths leading to this CS
+                                                                   // have been explored
+                // TTY.println("  All parents explored, Enqueue");
                 toExplore.add(next);
                 speculativeExplore.remove(next);
             } else {
-                //TTY.println("  Not all parents explored : Enqueue speculative");
+                // TTY.println("  Not all parents explored : Enqueue speculative");
                 speculativeExplore.add(next);
             }
         }
@@ -117,12 +118,12 @@
     }
 
     private boolean propagateUpdate(DominatorInfo di) {
-        //TTY.println("   propagateUpdate(" + di + ")");
+        // TTY.println("   propagateUpdate(" + di + ")");
         for (DominatorInfo child : di.children()) {
-            //TTY.println("      add to child " + child);
+            // TTY.println("      add to child " + child);
             if (child.add(di, false)) {
                 if (child.equals(fullInfo)) {
-                    //TTY.println("   Found DOM!");
+                    // TTY.println("   Found DOM!");
                     dominator = child.node();
                     return true;
                 }
@@ -135,25 +136,26 @@
     }
 
     private boolean checkControlSplitInfo(DominatorInfo di) {
-        //TTY.println("   checkControlSplitInfo(" + di + ")");
+        // TTY.println("   checkControlSplitInfo(" + di + ")");
         if (di.equals(fullInfo)) {
             dominator = di.node();
-            //TTY.println("   Found DOM!");
+            // TTY.println("   Found DOM!");
             return true;
         }
         return false;
     }
 
     private void processMerge(MergeNode merge, DominatorInfo info) {
-        //TTY.println("processMerge(" + merge + ", " + info + ")");
+        // TTY.println("processMerge(" + merge + ", " + info + ")");
         for (EndNode end : merge.cfgPredecessors()) {
             toExplore.add(end);
             infoMap.set(end, info.createChild(end));
-            //TTY.println("  Enqueue end : " + end + " with " + infoMap.get(end));
+            // TTY.println("  Enqueue end : " + end + " with " + infoMap.get(end));
         }
     }
 
     private class DominatorInfo {
+
         private final FixedNode node;
         private final BitSet bits;
         private final BitSet ownBits;
@@ -231,7 +233,6 @@
             return parents.size();
         }
 
-
         public FixedNode node() {
             return node;
         }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/GraphUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,9 +34,10 @@
 public class GraphUtil {
 
     private static final NodePredicate FLOATING = new NodePredicate() {
+
         @Override
-        public final boolean  apply(Node n) {
-            //isA(FloatingNode.class).or(VirtualState.class).or(CallTargetNode.class)
+        public final boolean apply(Node n) {
+            // isA(FloatingNode.class).or(VirtualState.class).or(CallTargetNode.class)
             return n instanceof FloatingNode || n instanceof VirtualState || n instanceof CallTargetNode;
         }
     };
@@ -49,9 +50,11 @@
             killEnd(end);
         } else {
             // Normal control flow node.
-            /* We do not take a successor snapshot because this iterator supports concurrent modifications
-             * as long as they do not change the size of the successor list. Not taking a snapshot allows
-             * us to see modifications to other branches that may happen while processing one branch.
+            /*
+             * We do not take a successor snapshot because this iterator supports concurrent
+             * modifications as long as they do not change the size of the successor list. Not
+             * taking a snapshot allows us to see modifications to other branches that may happen
+             * while processing one branch.
              */
             for (Node successor : node.successors()) {
                 killCFG((FixedNode) successor);
@@ -65,7 +68,7 @@
         if (merge != null) {
             merge.removeEnd(end);
             StructuredGraph graph = (StructuredGraph) end.graph();
-            if (merge instanceof LoopBeginNode && merge.forwardEndCount() == 0) { //dead loop
+            if (merge instanceof LoopBeginNode && merge.forwardEndCount() == 0) { // dead loop
                 for (PhiNode phi : merge.phis().snapshot()) {
                     propagateKill(phi);
                 }
@@ -77,11 +80,15 @@
                 }
                 begin.removeExits();
                 FixedNode loopBody = begin.next();
-                if (loopBody != null) { // for small infinite loops, the body may be killed while killing the loop ends
+                if (loopBody != null) { // for small infinite loops, the body may be killed while
+                                        // killing the loop ends
                     killCFG(loopBody);
                 }
                 begin.safeDelete();
-            } else if (merge instanceof LoopBeginNode && ((LoopBeginNode) merge).loopEnds().isEmpty()) { // not a loop anymore
+            } else if (merge instanceof LoopBeginNode && ((LoopBeginNode) merge).loopEnds().isEmpty()) { // not
+                                                                                                         // a
+                                                                                                         // loop
+                                                                                                         // anymore
                 graph.reduceDegenerateLoopBegin((LoopBeginNode) merge);
             } else if (merge.phiPredecessorCount() == 1) { // not a merge anymore
                 graph.reduceTrivialMerge(merge);
@@ -172,7 +179,8 @@
     }
 
     public static void normalizeLoopBegin(LoopBeginNode begin) {
-        // Delete unnecessary loop phi functions, i.e., phi functions where all inputs are either the same or the phi itself.
+        // Delete unnecessary loop phi functions, i.e., phi functions where all inputs are either
+        // the same or the phi itself.
         for (PhiNode phi : begin.phis().snapshot()) {
             GraphUtil.checkRedundantPhi(phi);
         }
@@ -185,7 +193,7 @@
 
     /**
      * Gets an approximate source code location for a node if possible.
-     *
+     * 
      * @return the StackTraceElements if an approximate source location is found, null otherwise
      */
     public static StackTraceElement[] approxSourceStackTraceElement(Node node) {
@@ -213,10 +221,9 @@
         return elements.toArray(new StackTraceElement[elements.size()]);
     }
 
-
     /**
      * Gets an approximate source code location for a node, encoded as an exception, if possible.
-     *
+     * 
      * @return the exception with the location
      */
     public static RuntimeException approxSourceException(Node node, Throwable cause) {
@@ -235,9 +242,9 @@
 
     /**
      * Gets an approximate source code location for a node if possible.
-     *
-     * @return a file name and source line number in stack trace format (e.g. "String.java:32") if an approximate source
-     *         location is found, null otherwise
+     * 
+     * @return a file name and source line number in stack trace format (e.g. "String.java:32") if
+     *         an approximate source location is found, null otherwise
      */
     public static String approxSourceLocation(Node node) {
         StackTraceElement[] stackTraceElements = approxSourceStackTraceElement(node);
@@ -260,11 +267,11 @@
 
     /**
      * Returns a string representation of the given collection of objects.
-     *
+     * 
      * @param objects The {@link Iterable} that will be used to iterate over the objects.
      * @return A string of the format "[a, b, ...]".
      */
-    public static String toString(Iterable< ? > objects) {
+    public static String toString(Iterable<?> objects) {
         StringBuilder str = new StringBuilder();
         str.append("[");
         for (Object o : objects) {
@@ -278,8 +285,9 @@
     }
 
     /**
-     * Tries to find an original value of the given node by traversing through proxies and unambiguous phis.
-     *
+     * Tries to find an original value of the given node by traversing through proxies and
+     * unambiguous phis.
+     * 
      * @param proxy The node whose original value should be determined.
      */
     public static ValueNode originalValue(ValueNode proxy) {
@@ -294,7 +302,8 @@
             }
         } while (v != null);
 
-        // if the simple check fails (this can happen for complicated phi/proxy/phi constructs), we do an exhaustive search
+        // if the simple check fails (this can happen for complicated phi/proxy/phi constructs), we
+        // do an exhaustive search
         if (v == null) {
             NodeWorkList worklist = proxy.graph().createNodeWorkList();
             worklist.add(proxy);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/NodeIterators.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/NodeIterators.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,10 +31,13 @@
 
     public static NodeIterable<FixedNode> dominators(final FixedNode n) {
         return new AbstractNodeIterable<FixedNode>() {
+
             @Override
             public Iterator<FixedNode> iterator() {
-                return new NodeIterator<FixedNode>(){
+                return new NodeIterator<FixedNode>() {
+
                     FixedNode p = n;
+
                     @Override
                     protected void forward() {
                         if (current == null) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/TreeIterators.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/util/TreeIterators.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,8 @@
 
 public class TreeIterators {
 
-    public abstract static class PrefixTreeIterator<T> implements Iterator<T>{
+    public abstract static class PrefixTreeIterator<T> implements Iterator<T> {
+
         private Deque<T> stack = new LinkedList<>();
 
         public PrefixTreeIterator(T root) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/BoxedVirtualObjectNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/BoxedVirtualObjectNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,15 +27,16 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.nodes.spi.*;
 
-
 public class BoxedVirtualObjectNode extends VirtualObjectNode implements LIRLowerable, Node.ValueNumberable {
 
     @Input ValueNode unboxedValue;
     private final ResolvedJavaType type;
+    private final Kind kind;
 
-    public BoxedVirtualObjectNode(int virtualId, ResolvedJavaType type, ValueNode unboxedValue) {
+    public BoxedVirtualObjectNode(int virtualId, ResolvedJavaType type, Kind kind, ValueNode unboxedValue) {
         super(virtualId);
         this.type = type;
+        this.kind = kind;
         this.unboxedValue = unboxedValue;
     }
 
@@ -60,8 +61,14 @@
     }
 
     @Override
-    public int fieldIndexForOffset(long constantOffset) {
-        // (lstadler) unsafe access to a newly created boxing object should only ever touch the value field
+    public int entryIndexForOffset(long constantOffset) {
+        // (lstadler) unsafe access to a newly created boxing object should only ever touch the
+        // value field
         return 0;
     }
+
+    @Override
+    public Kind entryKind(int index) {
+        return kind;
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/EscapeObjectState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,9 +24,8 @@
 
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
 
-public abstract class EscapeObjectState extends VirtualState implements Node.IterableNodeType, LIRLowerable {
+public abstract class EscapeObjectState extends VirtualState implements Node.IterableNodeType {
 
     @Input private VirtualObjectNode object;
 
@@ -39,11 +38,6 @@
     }
 
     @Override
-    public void generate(LIRGeneratorTool generator) {
-        // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes.
-    }
-
-    @Override
     public abstract EscapeObjectState duplicateWithVirtualState();
 
     @Override
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualArrayNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -74,7 +74,7 @@
     }
 
     @Override
-    public int fieldIndexForOffset(long constantOffset) {
+    public int entryIndexForOffset(long constantOffset) {
         int baseOffset;
         int indexScale;
         switch (componentType.getKind()) {
@@ -127,4 +127,10 @@
         }
         return (int) elementIndex;
     }
+
+    @Override
+    public Kind entryKind(int index) {
+        assert index >= 0 && index < length;
+        return componentType.getKind();
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -77,7 +77,13 @@
     }
 
     @Override
-    public int fieldIndexForOffset(long constantOffset) {
+    public int entryIndexForOffset(long constantOffset) {
         return fieldIndex(type.findInstanceFieldWithOffset(constantOffset));
     }
+
+    @Override
+    public Kind entryKind(int index) {
+        assert index >= 0 && index < fields.length;
+        return fields[index].getKind();
+    }
 }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualObjectNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -58,5 +58,7 @@
         // nothing to do in here - this method allows subclasses to respond to materialization
     }
 
-    public abstract int fieldIndexForOffset(long constantOffset);
+    public abstract int entryIndexForOffset(long constantOffset);
+
+    public abstract Kind entryKind(int index);
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/BoxingEliminationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/BoxingEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -80,7 +80,7 @@
                     StructuredGraph graph = (StructuredGraph) phiNode.graph();
                     result = graph.add(new PhiNode(kind, phiNode.merge()));
                     phiReplacements.put(phiNode, result);
-                    virtualizeUsages(phiNode, result, type);
+                    virtualizeUsages(phiNode, result, type, kind);
                     int i = 0;
                     for (ValueNode n : phiNode.values()) {
                         ValueNode unboxedValue = unboxedValue(n, kind, phiReplacements);
@@ -116,7 +116,7 @@
     private void tryEliminate(BoxNode boxNode) {
 
         assert boxNode.objectStamp().isExactType();
-        virtualizeUsages(boxNode, boxNode.source(), boxNode.objectStamp().type());
+        virtualizeUsages(boxNode, boxNode.source(), boxNode.objectStamp().type(), boxNode.getSourceKind());
 
         if (boxNode.usages().filter(isNotA(VirtualState.class)).isNotEmpty()) {
             // Elimination failed, because boxing object escapes.
@@ -130,12 +130,12 @@
         ((StructuredGraph) boxNode.graph()).removeFixed(boxNode);
     }
 
-    private void virtualizeUsages(ValueNode boxNode, ValueNode replacement, ResolvedJavaType exactType) {
+    private void virtualizeUsages(ValueNode boxNode, ValueNode replacement, ResolvedJavaType exactType, Kind sourceKind) {
         ValueNode virtualValueNode = null;
         VirtualObjectNode virtualObjectNode = null;
         for (Node n : boxNode.usages().filter(NodePredicates.isA(VirtualState.class)).snapshot()) {
             if (virtualValueNode == null) {
-                virtualObjectNode = n.graph().unique(new BoxedVirtualObjectNode(virtualIds++, exactType, replacement));
+                virtualObjectNode = n.graph().unique(new BoxedVirtualObjectNode(virtualIds++, exactType, sourceKind, replacement));
             }
             n.replaceFirstInput(boxNode, virtualObjectNode);
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CanonicalizerPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,6 +38,7 @@
 import com.oracle.graal.phases.*;
 
 public class CanonicalizerPhase extends Phase {
+
     private static final int MAX_ITERATION_PER_NODE = 10;
     private static final DebugMetric METRIC_CANONICALIZED_NODES = Debug.metric("CanonicalizedNodes");
     private static final DebugMetric METRIC_CANONICALIZATION_CONSIDERED_NODES = Debug.metric("CanonicalizationConsideredNodes");
@@ -58,6 +59,7 @@
     private List<Node> snapshotTemp;
 
     public interface CustomCanonicalizer {
+
         ValueNode canonicalize(Node node);
     }
 
@@ -69,7 +71,8 @@
      * @param target
      * @param runtime
      * @param assumptions
-     * @param workingSet the initial working set of nodes on which the canonicalizer works, should be an auto-grow node bitmap
+     * @param workingSet the initial working set of nodes on which the canonicalizer works, should
+     *            be an auto-grow node bitmap
      * @param customCanonicalizer
      */
     public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, Iterable<Node> workingSet, CustomCanonicalizer customCanonicalizer) {
@@ -77,8 +80,8 @@
     }
 
     /**
-     * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by
-     *            this mark are processed otherwise all nodes in the graph are processed
+     * @param newNodesMark only the {@linkplain Graph#getNewNodes(int) new nodes} specified by this
+     *            mark are processed otherwise all nodes in the graph are processed
      */
     public CanonicalizerPhase(TargetDescription target, MetaAccessProvider runtime, Assumptions assumptions, int newNodesMark, CustomCanonicalizer customCanonicalizer) {
         this(target, runtime, assumptions, null, newNodesMark, customCanonicalizer);
@@ -111,6 +114,7 @@
 
     private void processWorkSet(StructuredGraph graph) {
         graph.trackInputChange(new InputChangedListener() {
+
             @Override
             public void inputChanged(Node node) {
                 workList.addAgain(node);
@@ -192,9 +196,11 @@
         if (node instanceof Canonicalizable) {
             assert !(node instanceof Simplifiable);
             METRIC_CANONICALIZATION_CONSIDERED_NODES.increment();
-            return Debug.scope("CanonicalizeNode", node, new Callable<Boolean>(){
+            return Debug.scope("CanonicalizeNode", node, new Callable<Boolean>() {
+
                 public Boolean call() {
                     ValueNode canonical = ((Canonicalizable) node).canonical(tool);
+// @formatter:off
 //     cases:                                           original node:
 //                                         |Floating|Fixed-unconnected|Fixed-connected|
 //                                         --------------------------------------------
@@ -207,7 +213,7 @@
 //                          Fixed-connected|   2    |        X        |       6       |
 //                                         --------------------------------------------
 //       X: must not happen (checked with assertions)
-
+// @formatter:on
 
                     return performReplacement(node, graph, canonical);
                 }
@@ -216,6 +222,7 @@
             Debug.log("Canonicalizer: simplifying %s", node);
             METRIC_SIMPLIFICATION_CONSIDERED_NODES.increment();
             Debug.scope("SimplifyNode", node, new Runnable() {
+
                 public void run() {
                     ((Simplifiable) node).simplify(tool);
                 }
@@ -245,7 +252,8 @@
                 assert node instanceof FixedWithNextNode && node.predecessor() != null : node + " -> " + canonical + " : node should be fixed & connected (" + node.predecessor() + ")";
                 FixedWithNextNode fixedWithNext = (FixedWithNextNode) node;
 
-                // When removing a fixed node, new canonicalization opportunities for its successor may arise
+                // When removing a fixed node, new canonicalization opportunities for its successor
+                // may arise
                 assert fixedWithNext.next() != null;
                 tool.addToWorkList(fixedWithNext.next());
 
@@ -274,9 +282,10 @@
     }
 
     /**
-     * Calls {@link ValueNode#inferStamp()} on the node and, if it returns true (which means that the stamp has
-     * changed), re-queues the node's usages . If the stamp has changed then this method also checks if the stamp
-     * now describes a constant integer value, in which case the node is replaced with a constant.
+     * Calls {@link ValueNode#inferStamp()} on the node and, if it returns true (which means that
+     * the stamp has changed), re-queues the node's usages . If the stamp has changed then this
+     * method also checks if the stamp now describes a constant integer value, in which case the
+     * node is replaced with a constant.
      */
     private void tryInferStamp(Node node, StructuredGraph graph) {
         if (node.isAlive() && node instanceof ValueNode) {
@@ -318,7 +327,8 @@
         }
 
         /**
-         * @return the current target or {@code null} if no target is available in the current context.
+         * @return the current target or {@code null} if no target is available in the current
+         *         context.
          */
         @Override
         public TargetDescription target() {
@@ -326,7 +336,8 @@
         }
 
         /**
-         * @return an object that can be used for recording assumptions or {@code null} if assumptions are not allowed in the current context.
+         * @return an object that can be used for recording assumptions or {@code null} if
+         *         assumptions are not allowed in the current context.
          */
         @Override
         public Assumptions assumptions() {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ComputeProbabilityPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,22 +31,27 @@
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
 
+/**
+ * Computes probabilities for nodes in a graph.
+ * <p>
+ * The computation of absolute probabilities works in three steps:
+ * <ol>
+ * <li>{@link PropagateProbability} traverses the graph in post order (merges after their ends, ...)
+ * and keeps track of the "probability state". Whenever it encounters a {@link ControlSplitNode} it
+ * uses the split's probability information to divide the probability upon the successors. Whenever
+ * it encounters an {@link Invoke} it assumes that the exception edge is unlikely and propagates the
+ * whole probability to the normal successor. Whenever it encounters a {@link MergeNode} it sums up
+ * the probability of all predecessors. It also maintains a set of active loops (whose
+ * {@link LoopBeginNode} has been visited) and builds def/use information for step 2.</li>
+ * <li></li>
+ * <li>{@link PropagateLoopFrequency} propagates the loop frequencies and multiplies each
+ * {@link FixedNode}'s probability with its loop frequency.</li>
+ * </ol>
+ * TODO: add exception probability information to Invokes
+ */
 public class ComputeProbabilityPhase extends Phase {
-    private static final double EPSILON = 1d / Integer.MAX_VALUE;
 
-    /*
-     * The computation of absolute probabilities works in three steps:
-     *
-     * - The first step, "PropagateProbability", traverses the graph in post order (merges after their ends, ...) and keeps track of the "probability state".
-     *   Whenever it encounters a ControlSplit it uses the split's probability information to divide the probability upon the successors.
-     *   Whenever it encounters an Invoke it assumes that the exception edge is unlikely and propagates the whole probability to the normal successor.
-     *   Whenever it encounters a Merge it sums up the probability of all predecessors.
-     *   It also maintains a set of active loops (whose LoopBegin has been visited) and builds def/use information for the second step.
-     *
-     * - The third step propagates the loop frequencies and multiplies each FixedNode's probability with its loop frequency.
-     *
-     *   TODO: add exception probability information to Invokes
-     */
+    private static final double EPSILON = 1d / Integer.MAX_VALUE;
 
     @Override
     protected void run(StructuredGraph graph) {
@@ -71,6 +76,7 @@
     }
 
     public static class LoopInfo {
+
         public final LoopBeginNode loopBegin;
 
         public final NodeMap<Set<LoopInfo>> requires;
@@ -113,6 +119,7 @@
     public Map<MergeNode, Set<LoopInfo>> mergeLoops = new IdentityHashMap<>();
 
     private class Probability implements MergeableState<Probability> {
+
         public double probability;
         public HashSet<LoopInfo> loops;
         public LoopInfo loopInfo;
@@ -224,6 +231,7 @@
     }
 
     private class LoopCount implements MergeableState<LoopCount> {
+
         public double count;
 
         public LoopCount(double count) {
@@ -388,7 +396,7 @@
             double maxProbability = 0.0;
 
             // TODO (chaeubl): process recursively if we have multiple successors with same probability
-            for (Node sux: controlSplit.successors()) {
+            for (Node sux : controlSplit.successors()) {
                 double probability = controlSplit.probability((BeginNode) sux);
                 if (probability > maxProbability) {
                     maxProbability = probability;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -162,7 +162,8 @@
                 }
             }
 
-            // this piece of code handles phis (merges the types and knownNull/knownNotNull of the values)
+            // this piece of code handles phis (merges the types and knownNull/knownNotNull of the
+            // values)
             if (!(merge instanceof LoopBeginNode)) {
                 for (PhiNode phi : merge.phis()) {
                     if (phi.type() == PhiType.Value && phi.kind() == Kind.Object) {
@@ -250,6 +251,7 @@
     }
 
     public class ConditionalElimination extends PostOrderNodeIterator<State> {
+
         private BeginNode lastBegin = null;
 
         public ConditionalElimination(FixedNode start, State initialState) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertDeoptimizeToGuardPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -81,7 +81,8 @@
             BeginNode otherBegin = ifNode.trueSuccessor();
             BooleanNode conditionNode = ifNode.condition();
             if (conditionNode instanceof InstanceOfNode) {
-                // TODO The lowering currently does not support a FixedGuard as the usage of an InstanceOfNode. Relax this restriction.
+                // TODO The lowering currently does not support a FixedGuard as the usage of an
+                // InstanceOfNode. Relax this restriction.
                 return;
             }
             boolean negated = false;
@@ -90,7 +91,8 @@
                 otherBegin = ifNode.falseSuccessor();
             }
             BeginNode ifBlockBegin = findBeginNode(ifNode);
-            Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s. IfBegin=%s", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin, ifBlockBegin);
+            Debug.log("Converting %s on %-5s branch of %s to guard for remaining branch %s. IfBegin=%s", deopt, deoptBegin == ifNode.trueSuccessor() ? "true" : "false", ifNode, otherBegin,
+                            ifBlockBegin);
             FixedGuardNode guard = graph.add(new FixedGuardNode(conditionNode, deopt.reason(), deopt.action(), negated, deopt.leafGraphId()));
             otherBegin.replaceAtUsages(ifBlockBegin);
             FixedNode next = otherBegin.next();
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConvertUnreachedToGuardPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,8 +30,8 @@
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 
+public class ConvertUnreachedToGuardPhase extends Phase {
 
-public class ConvertUnreachedToGuardPhase extends Phase {
     private OptimisticOptimizations opt;
 
     public ConvertUnreachedToGuardPhase(OptimisticOptimizations opt) {
@@ -58,7 +58,8 @@
                     delete = ifNode.falseSuccessor();
                 }
                 if (insertGuard != null) {
-                    GuardNode guard = graph.unique(new GuardNode(ifNode.condition(), BeginNode.prevBegin(ifNode), DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile, inverted, ifNode.leafGraphId()));
+                    GuardNode guard = graph.unique(new GuardNode(ifNode.condition(), BeginNode.prevBegin(ifNode), DeoptimizationReason.UnreachedCode, DeoptimizationAction.InvalidateReprofile,
+                                    inverted, ifNode.leafGraphId()));
                     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.common/src/com/oracle/graal/phases/common/CullFrameStatesPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/CullFrameStatesPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.phases.graph.*;
 
 /**
- * This phase culls unused FrameStates from the graph.
- * It does a post order iteration over the graph, and
+ * This phase culls unused FrameStates from the graph. It does a post order iteration over the
+ * graph, and
  */
 public class CullFrameStatesPhase extends Phase {
 
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/DeadCodeEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 
-
 public class DeadCodeEliminationPhase extends Phase {
 
     // Metrics
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/EliminatePartiallyRedundantGuardsPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,6 @@
 import com.oracle.graal.nodes.PhiNode.PhiType;
 import com.oracle.graal.phases.*;
 
-
 public class EliminatePartiallyRedundantGuardsPhase extends Phase {
 
     private static final DebugMetric metricPRGuardsEliminatedAtMerge = Debug.metric("PRGuardsEliminatedAtMerge");
@@ -50,12 +49,15 @@
     }
 
     private static class Condition {
+
         final BooleanNode conditionNode;
         final boolean negated;
+
         public Condition(BooleanNode conditionNode, boolean negated) {
             this.conditionNode = conditionNode;
             this.negated = negated;
         }
+
         @Override
         public int hashCode() {
             final int prime = 31;
@@ -64,6 +66,7 @@
             result = prime * result + (negated ? 1231 : 1237);
             return result;
         }
+
         @Override
         public boolean equals(Object obj) {
             if (this == obj) {
@@ -105,7 +108,7 @@
                     hits |= eliminateAtControlSplit(controlSplit);
                 }
             }
-        } while(hits);
+        } while (hits);
     }
 
     private static boolean eliminateAtMerge(MergeNode merge) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FloatingReadPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,10 +35,12 @@
     private IdentityHashMap<LoopBeginNode, List<MemoryMap>> loopEndStatesMap;
 
     private static class LoopState {
+
         public LoopBeginNode loopBegin;
         public MemoryMap state;
         public IdentityHashMap<PhiNode, Object> loopPhiLocations = new IdentityHashMap<>();
         public ValueNode loopEntryAnyLocation;
+
         public LoopState(LoopBeginNode loopBegin, MemoryMap state, ValueNode loopEntryAnyLocation) {
             this.loopBegin = loopBegin;
             this.state = state;
@@ -52,6 +54,7 @@
     }
 
     private class MemoryMap implements MergeableState<MemoryMap> {
+
         private IdentityHashMap<Object, ValueNode> lastMemorySnapshot;
         private LinkedList<LoopState> loops;
 
@@ -171,6 +174,7 @@
     protected void run(StructuredGraph graph) {
         loopEndStatesMap = new IdentityHashMap<>();
         new PostOrderNodeIterator<MemoryMap>(graph.start(), new MemoryMap()) {
+
             @Override
             protected void node(FixedNode node) {
                 processNode(node, state);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,10 +39,12 @@
 import com.oracle.graal.phases.common.InliningUtil.InliningPolicy;
 
 public class InliningPhase extends Phase implements InliningCallback {
+
     /*
-     * - Detect method which only call another method with some parameters set to constants: void foo(a) -> void foo(a, b) -> void foo(a, b, c) ...
-     *   These should not be taken into account when determining inlining depth.
-     * - honor the result of overrideInliningDecision(0, caller, invoke.bci, method, true);
+     * - Detect method which only call another method with some parameters set to constants: void
+     * foo(a) -> void foo(a, b) -> void foo(a, b, c) ... These should not be taken into account when
+     * determining inlining depth. - honor the result of overrideInliningDecision(0, caller,
+     * invoke.bci, method, true);
      */
 
     private final TargetDescription target;
@@ -61,7 +63,8 @@
     private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize");
     private static final DebugMetric metricInliningRuns = Debug.metric("Runs");
 
-    public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Collection<Invoke> hints, Assumptions assumptions, GraphCache cache, PhasePlan plan, OptimisticOptimizations optimisticOpts) {
+    public InliningPhase(TargetDescription target, GraalCodeCacheProvider runtime, Collection<Invoke> hints, Assumptions assumptions, GraphCache cache, PhasePlan plan,
+                    OptimisticOptimizations optimisticOpts) {
         this(target, runtime, assumptions, cache, plan, createInliningPolicy(runtime, assumptions, optimisticOpts, hints), optimisticOpts);
     }
 
@@ -151,6 +154,7 @@
     }
 
     private interface InliningDecision {
+
         boolean isWorthInlining(InlineInfo info);
     }
 
@@ -294,6 +298,7 @@
                         moreSpecificArgumentInfo++;
                     }
                 }
+
             }
 
             return moreSpecificArgumentInfo;
@@ -334,6 +339,7 @@
     }
 
     private static class CFInliningPolicy implements InliningPolicy {
+
         private final InliningDecision inliningDecision;
         private final Collection<Invoke> hints;
         private final Assumptions assumptions;
@@ -343,7 +349,7 @@
         private FixedNode invokePredecessor;
 
         public CFInliningPolicy(InliningDecision inliningPolicy, Collection<Invoke> hints,
-                        Assumptions assumptions, OptimisticOptimizations optimisticOpts) {
+                        OptimisticOptimizations optimisticOpts) {
             this.inliningDecision = inliningPolicy;
             this.hints = hints;
             this.assumptions = assumptions;
@@ -397,6 +403,7 @@
                 Invoke invoke = invokes.get(i);
                 assert !sortedInvokes.contains(invoke);
                 sortedInvokes.addFirst(invoke);
+
             }
 
             return invokes.size();
@@ -414,6 +421,7 @@
     }
 
     private static class InliningIterator {
+
         private final FixedNode start;
         private final Deque<FixedNode> nodeQueue;
         private final NodeBitMap queuedNodes;
@@ -510,7 +518,7 @@
     }
 
     private static InliningPolicy createInliningPolicy(GraalCodeCacheProvider runtime, Assumptions assumptions, OptimisticOptimizations optimisticOpts, Collection<Invoke> hints) {
-        InliningDecision inliningDecision = new GreedySizeBasedInliningDecision(runtime, hints);
+       InliningDecision inliningDecision = new GreedySizeBasedInliningDecision(runtime, hints);
         return new CFInliningPolicy(inliningDecision, hints, assumptions, optimisticOpts);
     }
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -44,22 +44,38 @@
 import com.oracle.graal.phases.*;
 
 public class InliningUtil {
+
     private static final DebugMetric metricInliningTailDuplication = Debug.metric("InliningTailDuplication");
     private static final String inliningDecisionsScopeString = "InliningDecisions";
 
+    /**
+     * Meters the size (in bytecodes) of all methods processed during compilation (i.e., top level and all
+     * inlined methods), irrespective of how many bytecodes in each method are actually parsed
+     * (which may be none for methods whose IR is retrieved from a cache).
+     */
+    public static final DebugMetric InlinedBytecodes = Debug.metric("InlinedBytecodes");
+
     public interface InliningCallback {
+
         StructuredGraph buildGraph(final ResolvedJavaMethod method);
     }
 
     public interface InliningPolicy {
+
         void initialize(StructuredGraph graph);
+
         boolean continueInlining(StructuredGraph graph);
+
         InlineInfo next();
+
         void scanInvokes(Iterable<? extends Node> newNodes);
+
+
         boolean isWorthInlining(InlineInfo info);
     }
 
     public static boolean logNotInlinedMethod(InlineInfo info, String msg, Object... args) {
+
         logInliningDecision(info, false, msg, args);
         return false;
     }
@@ -72,6 +88,7 @@
 
     public static void logInliningDecision(final String msg, final Object... args) {
         Debug.scope(inliningDecisionsScopeString, new Runnable() {
+
             public void run() {
                 Debug.log(msg, args);
             }
@@ -121,6 +138,7 @@
 
     public static boolean shouldLogInliningDecision() {
         return Debug.scope(inliningDecisionsScopeString, new Callable<Boolean>() {
+
             public Boolean call() {
                 return Debug.isLogEnabled();
             }
@@ -158,22 +176,28 @@
 
     /**
      * Represents an opportunity for inlining at the given invoke, with the given weight and level.
-     * The weight is the amortized weight of the additional code - so smaller is better.
-     * The level is the number of nested inlinings that lead to this invoke.
+     * The weight is the amortized weight of the additional code - so smaller is better. The level
+     * is the number of nested inlinings that lead to this invoke.
      */
     public interface InlineInfo {
+
         Invoke invoke();
+
+
         int level();
 
         int numberOfMethods();
         ResolvedJavaMethod methodAt(int index);
 
+
         /**
-         * Performs the inlining described by this object and returns the node that represents the return value of the
-         * inlined method (or null for void methods and methods that have no non-exceptional exit).
-         */
+         * Performs the inlining described by this object and returns the node that represents the
+         * return value of the inlined method (or null for void methods and methods that have no
+         * non-exceptional exit).
+         **/
         void inline(StructuredGraph graph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions);
 
+
         /**
          * Try to make the call static bindable to avoid interface and virtual method calls.
          */
@@ -181,6 +205,7 @@
     }
 
     public abstract static class AbstractInlineInfo implements InlineInfo {
+
         protected final Invoke invoke;
 
         public AbstractInlineInfo(Invoke invoke) {
@@ -197,16 +222,44 @@
             return computeInliningLevel(invoke);
         }
 
-        protected static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
+        protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, InliningCallback callback, Assumptions assumptions, boolean receiverNullCheck) {
+            Class<? extends FixedWithNextNode> macroNodeClass = getMacroNodeClass(concrete);
+            if (macroNodeClass != null) {
+                StructuredGraph graph = (StructuredGraph) invoke.graph();
+                FixedWithNextNode macroNode;
+                try {
+                    macroNode = macroNodeClass.getConstructor(Invoke.class).newInstance(invoke);
+                } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
+                    throw new GraalInternalError(e).addContext(invoke.node()).addContext("macroSubstitution", macroNodeClass);
+                }
+                macroNode.setProbability(invoke.node().probability());
+                CallTargetNode callTarget = invoke.callTarget();
+                if (invoke instanceof InvokeNode) {
+                    graph.replaceFixedWithFixed((InvokeNode) invoke, graph.add(macroNode));
+                } else {
+                    InvokeWithExceptionNode invokeWithException = (InvokeWithExceptionNode) invoke;
+                    invokeWithException.killExceptionEdge();
+                    graph.replaceSplitWithFixed(invokeWithException, graph.add(macroNode), invokeWithException.next());
+                }
+                GraphUtil.killWithUnusedFloatingInputs(callTarget);
+            } else {
+                StructuredGraph calleeGraph = getIntrinsicGraph(concrete);
+                if (calleeGraph == null) {
+                    calleeGraph = getGraph(concrete, callback);
+                }
+                InlinedBytecodes.add(concrete.getCodeSize());
+                assumptions.recordMethodContents(concrete);
+                InliningUtil.inline(invoke, calleeGraph, receiverNullCheck);
+            }
+        }
+
+        private static StructuredGraph getGraph(final ResolvedJavaMethod concrete, final InliningCallback callback) {
             return Debug.scope("GetInliningGraph", concrete, new Callable<StructuredGraph>() {
+
                 @Override
                 public StructuredGraph call() throws Exception {
-                    StructuredGraph result = getIntrinsicGraph(concrete);
-                    if (result == null) {
-                        assert !Modifier.isNative(concrete.getModifiers());
-                        result = callback.buildGraph(concrete);
-                    }
-                    return result;
+                    assert !Modifier.isNative(concrete.getModifiers());
+                    return callback.buildGraph(concrete);
                 }
             });
         }
@@ -219,10 +272,11 @@
     }
 
     /**
-     * Represents an inlining opportunity where the compiler can statically determine a monomorphic target method and
-     * therefore is able to determine the called method exactly.
+     * Represents an inlining opportunity where the compiler can statically determine a monomorphic
+     * target method and therefore is able to determine the called method exactly.
      */
     private static class ExactInlineInfo extends AbstractInlineInfo {
+
         public final ResolvedJavaMethod concrete;
 
         public ExactInlineInfo(Invoke invoke, ResolvedJavaMethod concrete) {
@@ -232,9 +286,7 @@
 
         @Override
         public void inline(StructuredGraph compilerGraph, GraalCodeCacheProvider runtime, InliningCallback callback, Assumptions assumptions) {
-            StructuredGraph graph = getGraph(concrete, callback);
-            assumptions.recordMethodContents(concrete);
-            InliningUtil.inline(invoke, graph, true);
+            inline(invoke, concrete, callback, assumptions, true);
         }
 
         @Override
@@ -260,10 +312,12 @@
     }
 
     /**
-     * Represents an inlining opportunity for which profiling information suggests a monomorphic receiver, but for which
-     * the receiver type cannot be proven. A type check guard will be generated if this inlining is performed.
+     * Represents an inlining opportunity for which profiling information suggests a monomorphic
+     * receiver, but for which the receiver type cannot be proven. A type check guard will be
+     * generated if this inlining is performed.
      */
     private static class TypeGuardInlineInfo extends AbstractInlineInfo {
+
         public final ResolvedJavaMethod concrete;
         public final ResolvedJavaType type;
 
@@ -290,7 +344,7 @@
 
             StructuredGraph calleeGraph = getGraph(concrete, callback);
             assumptions.recordMethodContents(concrete);
-            InliningUtil.inline(invoke, calleeGraph, false);
+            inline(invoke, calleeGraph, false);
         }
 
         @Override
@@ -324,17 +378,18 @@
     }
 
     /**
-     * Polymorphic inlining of m methods with n type checks (n >= m) in case that the profiling information suggests a reasonable
-     * amounts of different receiver types and different methods. If an unknown type is encountered a deoptimization is triggered.
+     * Polymorphic inlining of m methods with n type checks (n >= m) in case that the profiling
+     * information suggests a reasonable amounts of different receiver types and different methods.
+     * If an unknown type is encountered a deoptimization is triggered.
      */
     private static class MultiTypeGuardInlineInfo extends AbstractInlineInfo {
+
         public final List<ResolvedJavaMethod> concretes;
         public final ArrayList<ProfiledType> ptypes;
         public final int[] typesToConcretes;
         public final double notRecordedTypeProbability;
 
-        public MultiTypeGuardInlineInfo(Invoke invoke, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes,
-                        int[] typesToConcretes, double notRecordedTypeProbability) {
+        public MultiTypeGuardInlineInfo(Invoke invoke, double weight, ArrayList<ResolvedJavaMethod> concretes, ArrayList<ProfiledType> ptypes, int[] typesToConcretes, double notRecordedTypeProbability) {
             super(invoke);
             assert concretes.size() > 0 && concretes.size() <= ptypes.size() : "must have at least one method but no more than types methods";
             assert ptypes.size() == typesToConcretes.length : "array lengths must match";
@@ -438,14 +493,7 @@
                 GraphUtil.killCFG(invokeWithExceptionNode.exceptionEdge());
             }
 
-            // get all graphs and record assumptions
             assert invoke.node().isAlive();
-            StructuredGraph[] calleeGraphs = new StructuredGraph[numberOfMethods];
-            for (int i = 0; i < numberOfMethods; i++) {
-                ResolvedJavaMethod concrete = concretes.get(i);
-                calleeGraphs[i] = getGraph(concrete, callback);
-                assumptions.recordMethodContents(concrete);
-            }
 
             // replace the invoke with a switch on the type of the actual receiver
             createDispatchOnTypeBeforeInvoke(graph, successors, false);
@@ -469,8 +517,8 @@
                 PiNode anchoredReceiver = createAnchoredReceiver(graph, node, commonType, receiver, exact);
                 invokeForInlining.callTarget().replaceFirstInput(receiver, anchoredReceiver);
 
-                StructuredGraph calleeGraph = calleeGraphs[i];
-                InliningUtil.inline(invokeForInlining, calleeGraph, false);
+                inline(invokeForInlining, concretes.get(i), callback, assumptions, false);
+
                 replacements.add(anchoredReceiver);
             }
             if (shouldFallbackToInvoke()) {
@@ -478,8 +526,8 @@
             }
             if (GraalOptions.OptTailDuplication) {
                 /*
-                 * We might want to perform tail duplication at the merge after a type switch, if there are invokes that would
-                 * benefit from the improvement in type information.
+                 * We might want to perform tail duplication at the merge after a type switch, if
+                 * there are invokes that would benefit from the improvement in type information.
                  */
                 FixedNode current = returnMerge;
                 int opportunities = 0;
@@ -539,15 +587,13 @@
             calleeEntryNode.setProbability(invoke.probability());
 
             BeginNode unknownTypeSux = createUnknownTypeSuccessor(graph);
-            BeginNode[] successors = new BeginNode[] {calleeEntryNode, unknownTypeSux};
+            BeginNode[] successors = new BeginNode[]{calleeEntryNode, unknownTypeSux};
             createDispatchOnTypeBeforeInvoke(graph, successors, false);
 
             calleeEntryNode.setNext(invoke.node());
 
             ResolvedJavaMethod concrete = concretes.get(0);
-            StructuredGraph calleeGraph = getGraph(concrete, callback);
-            assumptions.recordMethodContents(concrete);
-            InliningUtil.inline(invoke, calleeGraph, false);
+            inline(invoke, concrete, callback, assumptions, false);
         }
 
         private void createDispatchOnTypeBeforeInvoke(StructuredGraph graph, BeginNode[] successors, boolean invokeIsOnlySuccessor) {
@@ -575,8 +621,8 @@
             pred.setNext(typeSwitch);
         }
 
-        private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi,
-                        MergeNode exceptionMerge, PhiNode exceptionObjectPhi, double probability, boolean useForInlining) {
+        private static BeginNode createInvocationBlock(StructuredGraph graph, Invoke invoke, MergeNode returnMerge, PhiNode returnValuePhi, MergeNode exceptionMerge, PhiNode exceptionObjectPhi,
+                        double probability, boolean useForInlining) {
             Invoke duplicatedInvoke = duplicateInvokeForInlining(graph, invoke, exceptionMerge, exceptionObjectPhi, useForInlining, probability);
             BeginNode calleeEntryNode = graph.add(new BeginNode());
             calleeEntryNode.setNext(duplicatedInvoke.node());
@@ -705,12 +751,12 @@
         }
     }
 
-
     /**
-     * Represents an inlining opportunity where the current class hierarchy leads to a monomorphic target method,
-     * but for which an assumption has to be registered because of non-final classes.
+     * Represents an inlining opportunity where the current class hierarchy leads to a monomorphic
+     * target method, but for which an assumption has to be registered because of non-final classes.
      */
     private static class AssumptionInlineInfo extends ExactInlineInfo {
+
         private final Assumption takenAssumption;
 
         public AssumptionInlineInfo(Invoke invoke, ResolvedJavaMethod concrete, Assumption takenAssumption) {
@@ -740,6 +786,7 @@
 
     /**
      * Determines if inlining is possible at the given invoke node.
+     * 
      * @param invoke the invoke that should be inlined
      * @return an instance of InlineInfo, or null if no inlining is possible at the given invoke
      */
@@ -760,7 +807,8 @@
         ResolvedJavaType holder = targetMethod.getDeclaringClass();
         ObjectStamp receiverStamp = callTarget.receiver().objectStamp();
         if (receiverStamp.type() != null) {
-            // the invoke target might be more specific than the holder (happens after inlining: locals lose their declared type...)
+            // the invoke target might be more specific than the holder (happens after inlining:
+            // locals lose their declared type...)
             ResolvedJavaType receiverType = receiverStamp.type();
             if (receiverType != null && holder.isAssignableFrom(receiverType)) {
                 holder = receiverType;
@@ -776,7 +824,8 @@
             return getExactInlineInfo(invoke, optimisticOpts, holder.resolveMethod(targetMethod));
         }
 
-        // TODO (chaeubl): we could also use the type determined after assumptions for the type-checked inlining case as it might have an effect on type filtering
+        // TODO (chaeubl): we could also use the type determined after assumptions for the
+        // type-checked inlining case as it might have an effect on type filtering
         if (assumptions.useOptimisticAssumptions()) {
             ResolvedJavaType uniqueSubtype = holder.findUniqueConcreteSubtype();
             if (uniqueSubtype != null) {
@@ -812,7 +861,7 @@
     }
 
     private static InlineInfo getTypeCheckedInlineInfo(Invoke invoke, ResolvedJavaMethod caller,
-                    ResolvedJavaType holder, ResolvedJavaMethod targetMethod, OptimisticOptimizations optimisticOpts) {
+                    OptimisticOptimizations optimisticOpts) {
         ProfilingInfo profilingInfo = caller.getProfilingInfo();
         JavaTypeProfile typeProfile = profilingInfo.getTypeProfile(invoke.bci());
         if (typeProfile == null) {
@@ -844,16 +893,19 @@
                 return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining polymorphic calls is disabled (%d types)", ptypes.size());
             }
             if (!optimisticOpts.inlineMegamorphicCalls() && notRecordedTypeProbability > 0) {
-                // due to filtering impossible types, notRecordedTypeProbability can be > 0 although the number of types is lower than what can be recorded in a type profile
-                return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining megamorphic calls is disabled (%d types, %f %% not recorded types)", ptypes.size(), notRecordedTypeProbability * 100);
+                // due to filtering impossible types, notRecordedTypeProbability can be > 0 although
+                // the number of types is lower than what can be recorded in a type profile
+                return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "inlining megamorphic calls is disabled (%d types, %f %% not recorded types)", ptypes.size(),
+                                notRecordedTypeProbability * 100);
             }
 
             // TODO (chaeubl) inlining of multiple methods should work differently
             // 1. check which methods can be inlined
-            // 2. for those methods, use weight and probability to compute which of them should be inlined
+            // 2. for those methods, use weight and probability to compute which of them should be
+            // inlined
             // 3. do the inlining
-            //    a) all seen methods can be inlined -> do so and guard with deopt
-            //    b) some methods can be inlined -> inline them and fall back to invocation if violated
+            // a) all seen methods can be inlined -> do so and guard with deopt
+            // b) some methods can be inlined -> inline them and fall back to invocation if violated
 
             // determine concrete methods and map type to specific method
             ArrayList<ResolvedJavaMethod> concreteMethods = new ArrayList<>();
@@ -869,7 +921,7 @@
                 typesToConcretes[i] = index;
             }
 
-            for (ResolvedJavaMethod concrete: concreteMethods) {
+            for (ResolvedJavaMethod concrete : concreteMethods) {
                 if (!checkTargetConditions(invoke, concrete, optimisticOpts)) {
                     return logNotInlinedMethodAndReturnNull(invoke, targetMethod, "it is a polymorphic method call and at least one invoked method cannot be inlined");
                 }
@@ -878,7 +930,6 @@
         }
     }
 
-
     private static ArrayList<ProfiledType> getCompatibleTypes(ProfiledType[] types, ResolvedJavaType holder) {
         ArrayList<ProfiledType> result = new ArrayList<>();
         for (int i = 0; i < types.length; i++) {
@@ -967,10 +1018,11 @@
 
     /**
      * Performs an actual inlining, thereby replacing the given invoke with the given inlineGraph.
-     *
+     * 
      * @param invoke the invoke that will be replaced
      * @param inlineGraph the graph that the invoke will be replaced with
-     * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings, false if no such check is required
+     * @param receiverNullCheck true if a null check needs to be generated for non-static inlinings,
+     *            false if no such check is required
      */
     public static Map<Node, Node> inline(Invoke invoke, StructuredGraph inlineGraph, boolean receiverNullCheck) {
         NodeInputList<ValueNode> parameters = invoke.callTarget().arguments();
@@ -1001,7 +1053,10 @@
                 }
             }
         }
-        replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); // ensure proper anchoring of things that were anchored to the StartNode
+        replacements.put(entryPointNode, BeginNode.prevBegin(invoke.node())); // ensure proper
+                                                                              // anchoring of things
+                                                                              // that were anchored
+                                                                              // to the StartNode
 
         assert invoke.node().successors().first() != null : invoke;
         assert invoke.node().predecessor() != null;
@@ -1035,7 +1090,8 @@
                 UnwindNode unwindDuplicate = (UnwindNode) duplicates.get(unwindNode);
                 DeoptimizeNode deoptimizeNode = new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, DeoptimizationReason.NotCompiledExceptionHandler, invoke.leafGraphId());
                 unwindDuplicate.replaceAndDelete(graph.add(deoptimizeNode));
-                // move the deopt upwards if there is a monitor exit that tries to use the "after exception" frame state
+                // move the deopt upwards if there is a monitor exit that tries to use the
+                // "after exception" frame state
                 // (because there is no "after exception" frame state!)
                 if (deoptimizeNode.predecessor() instanceof MonitorExitNode) {
                     MonitorExitNode monitorExit = (MonitorExitNode) deoptimizeNode.predecessor();
@@ -1122,16 +1178,21 @@
         NodeInputList<ValueNode> parameters = callTarget.arguments();
         ValueNode firstParam = parameters.size() <= 0 ? null : parameters.get(0);
         if (!callTarget.isStatic() && firstParam.kind() == Kind.Object && !firstParam.objectStamp().nonNull()) {
-            graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true, invoke.leafGraphId())));
+            graph.addBeforeFixed(invoke.node(), graph.add(new FixedGuardNode(graph.unique(new IsNullNode(firstParam)), DeoptimizationReason.NullCheckException,
+                            DeoptimizationAction.InvalidateReprofile, true, invoke.leafGraphId())));
         }
     }
 
     public static boolean canIntrinsify(ResolvedJavaMethod target) {
-        StructuredGraph intrinsicGraph = getIntrinsicGraph(target);
-        return intrinsicGraph != null;
+        return getIntrinsicGraph(target) != null || getMacroNodeClass(target) != null;
     }
 
     public static StructuredGraph getIntrinsicGraph(ResolvedJavaMethod target) {
         return (StructuredGraph) target.getCompilerStorage().get(Graph.class);
     }
+    }
+
+    public static Class<? extends FixedWithNextNode> getMacroNodeClass(ResolvedJavaMethod target) {
+        Object result = target.getCompilerStorage().get(Node.class);
+        return result == null ? null : ((Class<?>) result).asSubclass(FixedWithNextNode.class);
 }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,6 +31,7 @@
 public class InsertStateAfterPlaceholderPhase extends Phase {
 
     private static class PlaceholderNode extends AbstractStateSplit implements StateSplit, Node.IterableNodeType, LIRLowerable, Canonicalizable {
+
         public PlaceholderNode() {
             super(StampFactory.forVoid());
         }
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/IterativeConditionalEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.*;
 import com.oracle.graal.phases.*;
 
+public class IterativeConditionalEliminationPhase extends Phase {
 
-public class IterativeConditionalEliminationPhase extends Phase {
     private final TargetDescription target;
     private final MetaAccessProvider runtime;
     private final Assumptions assumptions;
@@ -61,10 +61,13 @@
     }
 
     private static class Listener implements InputChangedListener {
+
         private final Set<Node> canonicalizationRoots;
+
         public Listener(Set<Node> canonicalizationRoots) {
             this.canonicalizationRoots = canonicalizationRoots;
         }
+
         @Override
         public void inputChanged(Node node) {
             canonicalizationRoots.add(node);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LockEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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.phases.common;
+
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.util.*;
+import com.oracle.graal.phases.*;
+
+public class LockEliminationPhase extends Phase {
+
+    @Override
+    protected void run(StructuredGraph graph) {
+        for (MonitorExitNode node : graph.getNodes(MonitorExitNode.class)) {
+            FixedNode next = node.next();
+            if (next instanceof MonitorEnterNode) {
+                MonitorEnterNode monitorEnterNode = (MonitorEnterNode) next;
+                if (monitorEnterNode.object() == node.object()) {
+                    FixedNode monitorEnterSuccessor = monitorEnterNode.next();
+                    monitorEnterNode.setNext(null);
+                    ((FixedWithNextNode) node.predecessor()).setNext(monitorEnterSuccessor);
+                    FrameState stateAfterFirst = node.stateAfter();
+                    FrameState stateAfterSecond = monitorEnterNode.stateAfter();
+                    node.safeDelete();
+                    monitorEnterNode.safeDelete();
+                    if (stateAfterFirst.usages().isEmpty()) {
+                        GraphUtil.killWithUnusedFloatingInputs(stateAfterFirst);
+                    }
+                    if (stateAfterSecond.usages().isEmpty()) {
+                        GraphUtil.killWithUnusedFloatingInputs(stateAfterSecond);
+                    }
+                }
+            }
+        }
+    }
+}
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoopSafepointInsertionPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,13 +34,13 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        nextLoop:
-        for (LoopEndNode loopEnd : graph.getNodes(LoopEndNode.class)) {
+        nextLoop: for (LoopEndNode loopEnd : graph.getNodes(LoopEndNode.class)) {
             if (!loopEnd.canSafepoint()) {
                 continue;
             }
             if (GraalOptions.OptSafepointElimination) {
-                // We 'eliminate' safepoints by simply never placing them into loops that have at least one call
+                // We 'eliminate' safepoints by simply never placing them into loops that have at
+                // least one call
                 NodeIterable<FixedNode> it = NodeIterators.dominators(loopEnd).until(loopEnd.loopBegin());
                 for (FixedNode n : it) {
                     if (n instanceof Invoke) {
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -43,10 +43,10 @@
 
     final class LoweringToolImpl implements LoweringTool {
 
-        final FixedNode guardAnchor;
-        final NodeBitMap activeGuards;
-        FixedWithNextNode lastFixedNode;
-        ControlFlowGraph cfg;
+        private final FixedNode guardAnchor;
+        private final NodeBitMap activeGuards;
+        private FixedWithNextNode lastFixedNode;
+        private ControlFlowGraph cfg;
 
         public LoweringToolImpl(FixedNode guardAnchor, NodeBitMap activeGuards, ControlFlowGraph cfg) {
             this.guardAnchor = guardAnchor;
@@ -55,6 +55,11 @@
         }
 
         @Override
+        public TargetDescription getTarget() {
+            return target;
+        }
+
+        @Override
         public GraalCodeCacheProvider getRuntime() {
             return runtime;
         }
@@ -101,12 +106,14 @@
         }
     }
 
+    private final TargetDescription target;
     private final GraalCodeCacheProvider runtime;
     private final Assumptions assumptions;
 
     private boolean deferred;
 
-    public LoweringPhase(GraalCodeCacheProvider runtime, Assumptions assumptions) {
+    public LoweringPhase(TargetDescription target, GraalCodeCacheProvider runtime, Assumptions assumptions) {
+        this.target = target;
         this.runtime = runtime;
         this.assumptions = assumptions;
     }
@@ -122,7 +129,7 @@
 
     @Override
     protected void run(final StructuredGraph graph) {
-        int  i = 0;
+        int i = 0;
         NodeBitMap processed = graph.createNodeBitMap();
         while (true) {
             int mark = graph.getMark();
@@ -189,9 +196,12 @@
 
             if (node.isAlive() && !processed.isMarked(node) && node instanceof Lowerable) {
                 if (loweringTool.lastFixedNode == null) {
-                    // We cannot lower the node now because we don't have a fixed node to anchor the replacements.
-                    // This can happen when previous lowerings in this lowering iteration deleted the BeginNode of this block.
-                    // In the next iteration, we will have the new BeginNode available, and we can lower this node.
+                    // We cannot lower the node now because we don't have a fixed node to anchor the
+                    // replacements.
+                    // This can happen when previous lowerings in this lowering iteration deleted
+                    // the BeginNode of this block.
+                    // In the next iteration, we will have the new BeginNode available, and we can
+                    // lower this node.
                     deferred = true;
                 } else {
                     processed.mark(node);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/PhiStampPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
 import com.oracle.graal.phases.*;
 
 public class PhiStampPhase extends Phase {
+
     @Override
     protected void run(StructuredGraph graph) {
         // Infer phis stopping at loop phis.
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ReadEliminationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,6 +32,7 @@
 import com.oracle.graal.phases.*;
 
 public class ReadEliminationPhase extends Phase {
+
     private Queue<PhiNode> newPhis;
 
     @Override
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,14 +31,15 @@
 import com.oracle.graal.nodes.VirtualState.NodeClosure;
 import com.oracle.graal.nodes.extended.*;
 import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 import com.oracle.graal.nodes.util.*;
 import com.oracle.graal.phases.*;
 
 /**
  * This class is a phase that looks for opportunities for tail duplication. The static method
- * {@link #tailDuplicate(MergeNode, TailDuplicationDecision, List)} can also be used to drive tail duplication from
- * other places, e.g., inlining.
+ * {@link #tailDuplicate(MergeNode, TailDuplicationDecision, List)} can also be used to drive tail
+ * duplication from other places, e.g., inlining.
  */
 public class TailDuplicationPhase extends Phase {
 
@@ -52,24 +53,28 @@
     private static final DebugMetric metricDuplicationOtherPerformed = Debug.metric("DuplicationOtherPerformed");
 
     /**
-     * This interface is used by tail duplication to let clients decide if tail duplication should be performed.
+     * This interface is used by tail duplication to let clients decide if tail duplication should
+     * be performed.
      */
     public interface TailDuplicationDecision {
 
         /**
-         * Queries if tail duplication should be performed at the given merge. If this method returns true then the tail
-         * duplication will be performed, because all other checks have happened before.
-         *
+         * Queries if tail duplication should be performed at the given merge. If this method
+         * returns true then the tail duplication will be performed, because all other checks have
+         * happened before.
+         * 
          * @param merge The merge at which tail duplication can be performed.
-         * @param fixedNodeCount The size of the set of fixed nodes that forms the base for the duplicated set of nodes.
+         * @param fixedNodeCount The size of the set of fixed nodes that forms the base for the
+         *            duplicated set of nodes.
          * @return true if the tail duplication should be performed, false otherwise.
          */
         boolean doTransform(MergeNode merge, int fixedNodeCount);
     }
 
     /**
-     * A tail duplication decision closure that employs the default algorithm: Check if there are any phis on the merge
-     * whose stamps improve and that have usages within the duplicated set of fixed nodes.
+     * A tail duplication decision closure that employs the default algorithm: Check if there are
+     * any phis on the merge whose stamps improve and that have usages within the duplicated set of
+     * fixed nodes.
      */
     public static final TailDuplicationDecision DEFAULT_DECISION = new TailDuplicationDecision() {
 
@@ -94,6 +99,9 @@
             int opportunities = 0;
             while (current instanceof FixedWithNextNode) {
                 current = ((FixedWithNextNode) current).next();
+                if (current instanceof VirtualizableAllocation) {
+                    return false;
+                }
                 for (PhiNode phi : improvements) {
                     for (Node input : current.inputs()) {
                         if (input == phi) {
@@ -122,7 +130,8 @@
 
     @Override
     protected void run(StructuredGraph graph) {
-        // A snapshot is taken here, so that new MergeNode instances aren't considered for tail duplication.
+        // A snapshot is taken here, so that new MergeNode instances aren't considered for tail
+        // duplication.
         for (MergeNode merge : graph.getNodes(MergeNode.class).snapshot()) {
             if (!(merge instanceof LoopBeginNode) && merge.probability() >= GraalOptions.TailDuplicationProbability) {
                 tailDuplicate(merge, DEFAULT_DECISION, null);
@@ -131,18 +140,20 @@
     }
 
     /**
-     * This method attempts to duplicate the tail of the given merge. The merge must not be a {@link LoopBeginNode}. If
-     * the merge is eligible for duplication (at least one fixed node in its tail, no {@link MonitorEnterNode}/
-     * {@link MonitorExitNode}, non-null {@link MergeNode#stateAfter()}) then the decision callback is used to determine
-     * whether the tail duplication should actually be performed. If replacements is non-null, then this list of
+     * This method attempts to duplicate the tail of the given merge. The merge must not be a
+     * {@link LoopBeginNode}. If the merge is eligible for duplication (at least one fixed node in
+     * its tail, no {@link MonitorEnterNode}/ {@link MonitorExitNode}, non-null
+     * {@link MergeNode#stateAfter()}) then the decision callback is used to determine whether the
+     * tail duplication should actually be performed. If replacements is non-null, then this list of
      * {@link PiNode}s is used to replace one value per merge end.
-     *
+     * 
      * @param merge The merge whose tail should be duplicated.
-     * @param decision A callback that can make the final decision if tail duplication should occur or not.
-     * @param replacements A list of {@link PiNode}s, or null. If this list is non-null then its size needs to match the
-     *            merge's end count. Each entry can either be null or a {@link PiNode}, and is used to replace
-     *            {@link PiNode#object()} with the {@link PiNode} in the duplicated branch that corresponds to the
-     *            entry.
+     * @param decision A callback that can make the final decision if tail duplication should occur
+     *            or not.
+     * @param replacements A list of {@link PiNode}s, or null. If this list is non-null then its
+     *            size needs to match the merge's end count. Each entry can either be null or a
+     *            {@link PiNode}, and is used to replace {@link PiNode#object()} with the
+     *            {@link PiNode} in the duplicated branch that corresponds to the entry.
      */
     public static void tailDuplicate(MergeNode merge, TailDuplicationDecision decision, List<PiNode> replacements) {
         assert !(merge instanceof LoopBeginNode);
@@ -159,7 +170,8 @@
         }
         if (containsMonitor) {
             // cannot currently be handled
-            // TODO (ls) re-evaluate this limitation after changes to the lock representation and the LIR generator
+            // TODO (ls) re-evaluate this limitation after changes to the lock representation and
+            // the LIR generator
             metricDuplicationMonitors.increment();
         } else if (fixedCount > 1) {
             if (fixed instanceof EndNode && !(((EndNode) fixed).merge() instanceof LoopBeginNode)) {
@@ -191,10 +203,10 @@
 
         /**
          * Initializes the tail duplication operation without actually performing any work.
-         *
+         * 
          * @param merge The merge whose tail should be duplicated.
-         * @param replacements A list of replacement {@link PiNode}s, or null. If this is non-null, then the size of the
-         *            list needs to match the number of end nodes at the merge.
+         * @param replacements A list of replacement {@link PiNode}s, or null. If this is non-null,
+         *            then the size of the list needs to match the number of end nodes at the merge.
          */
         public DuplicationOperation(MergeNode merge, List<PiNode> replacements) {
             this.merge = merge;
@@ -205,8 +217,8 @@
         /**
          * Performs the actual tail duplication:
          * <ul>
-         * <li>Creates a new {@link ValueAnchorNode} at the beginning of the duplicated area, an transfers all
-         * dependencies from the merge to this anchor.</li>
+         * <li>Creates a new {@link ValueAnchorNode} at the beginning of the duplicated area, an
+         * transfers all dependencies from the merge to this anchor.</li>
          * <li>Determines the set of fixed nodes to be duplicated.</li>
          * <li>Creates the new merge at the bottom of the duplicated area.</li>
          * <li>Determines the complete set of duplicated nodes.</li>
@@ -218,7 +230,8 @@
 
             ValueAnchorNode anchor = addValueAnchor();
 
-            // determine the fixed nodes that should be duplicated (currently: all nodes up until the first control
+            // determine the fixed nodes that should be duplicated (currently: all nodes up until
+            // the first control
             // split, end node, deopt or return.
             ArrayList<FixedNode> fixedNodes = new ArrayList<>();
             FixedNode fixed = merge.next();
@@ -257,7 +270,8 @@
                 }
                 mergeAfter.addForwardEnd((EndNode) duplicates.get(endAfter));
 
-                // re-wire the duplicated ValueAnchorNode to the predecessor of the corresponding EndNode
+                // re-wire the duplicated ValueAnchorNode to the predecessor of the corresponding
+                // EndNode
                 FixedNode anchorDuplicate = (FixedNode) duplicates.get(anchor);
                 ((FixedWithNextNode) forwardEnd.predecessor()).setNext(anchorDuplicate);
                 // move dependencies on the ValueAnchorNode to the previous BeginNode
@@ -282,7 +296,8 @@
                 forwardEnd.safeDelete();
             }
             for (PhiNode phi : phiSnapshot) {
-                // these phis should go away, but they still need to be anchored to a merge to be valid...
+                // these phis should go away, but they still need to be anchored to a merge to be
+                // valid...
                 if (phi.isAlive()) {
                     phi.setMerge(mergeAfter);
                 }
@@ -291,9 +306,9 @@
         }
 
         /**
-         * Inserts a new ValueAnchorNode after the merge and transfers all dependency-usages (not phis) to this
-         * ValueAnchorNode.
-         *
+         * Inserts a new ValueAnchorNode after the merge and transfers all dependency-usages (not
+         * phis) to this ValueAnchorNode.
+         * 
          * @return The new {@link ValueAnchorNode} that was created.
          */
         private ValueAnchorNode addValueAnchor() {
@@ -310,12 +325,14 @@
         }
 
         /**
-         * Given a set of fixed nodes, this method determines the set of fixed and floating nodes that needs to be
-         * duplicated, i.e., all nodes that due to data flow and other dependencies needs to be duplicated.
-         *
+         * Given a set of fixed nodes, this method determines the set of fixed and floating nodes
+         * that needs to be duplicated, i.e., all nodes that due to data flow and other dependencies
+         * needs to be duplicated.
+         * 
          * @param fixedNodes The set of fixed nodes that should be duplicated.
-         * @param stateAfter The frame state of the merge that follows the set of fixed nodes. All {@link ValueNode}s
-         *            reachable from this state are considered to be reachable from within the duplicated set of nodes.
+         * @param stateAfter The frame state of the merge that follows the set of fixed nodes. All
+         *            {@link ValueNode}s reachable from this state are considered to be reachable
+         *            from within the duplicated set of nodes.
          * @return The set of nodes that need to be duplicated.
          */
         private HashSet<Node> buildDuplicatedNodeSet(final ArrayList<FixedNode> fixedNodes, FrameState stateAfter) {
@@ -325,7 +342,8 @@
             final Deque<Node> worklist = new ArrayDeque<>();
 
             // Build the set of nodes that have (transitive) usages within the duplicatedNodes.
-            // This is achieved by iterating all nodes that are reachable via inputs from the the fixed nodes.
+            // This is achieved by iterating all nodes that are reachable via inputs from the the
+            // fixed nodes.
             aboveBound.markAll(fixedNodes);
             worklist.addAll(fixedNodes);
 
@@ -342,7 +360,8 @@
                     if (node instanceof PhiNode && !fixedNodes.contains(((PhiNode) node).merge())) {
                         // stop iterating: phis belonging to outside merges are known to be outside.
                     } else if (node instanceof FixedNode) {
-                        // stop iterating: fixed nodes within the given set are traversal roots anyway, and all other
+                        // stop iterating: fixed nodes within the given set are traversal roots
+                        // anyway, and all other
                         // fixed nodes are known to be outside.
                     } else if (!aboveBound.isMarked(node)) {
                         worklist.add(node);
@@ -362,7 +381,8 @@
             }
 
             // Build the set of nodes that have (transitive) inputs within the duplicatedNodes.
-            // This is achieved by iterating all nodes that are reachable via usages from the fixed nodes.
+            // This is achieved by iterating all nodes that are reachable via usages from the fixed
+            // nodes.
             belowBound.markAll(fixedNodes);
             worklist.addAll(fixedNodes);
 
@@ -378,7 +398,8 @@
                     if (usage instanceof PhiNode && !fixedNodes.contains(((PhiNode) usage).merge())) {
                         // stop iterating: phis belonging to outside merges are known to be outside.
                     } else if (usage instanceof FixedNode) {
-                        // stop iterating: fixed nodes within the given set are traversal roots anyway, and all other
+                        // stop iterating: fixed nodes within the given set are traversal roots
+                        // anyway, and all other
                         // fixed nodes are known to be outside.
                     } else if (!belowBound.isMarked(usage)) {
                         worklist.add(usage);
@@ -397,11 +418,11 @@
         }
 
         /**
-         * Creates a new merge and end node construct at the end of the duplicated area. While it is useless in itself
-         * (merge with only one end) it simplifies the later duplication step.
-         *
-         * @param successor The successor of the duplicated set of nodes, i.e., the first node that should not be
-         *            duplicated.
+         * Creates a new merge and end node construct at the end of the duplicated area. While it is
+         * useless in itself (merge with only one end) it simplifies the later duplication step.
+         * 
+         * @param successor The successor of the duplicated set of nodes, i.e., the first node that
+         *            should not be duplicated.
          * @param stateAfterMerge The frame state that should be used for the merge.
          * @return The newly created end node.
          */
@@ -420,21 +441,26 @@
         /**
          * Expands the set of nodes to be duplicated by looking at a number of conditions:
          * <ul>
-         * <li>{@link ValueNode}s that have usages on the outside need to be replaced with phis for the outside usages.</li>
-         * <li>Non-{@link ValueNode} nodes that have outside usages (frame states, virtual object states, ...) need to
-         * be cloned immediately for the outside usages.</li>
-         * <li>Nodes that have a {@link StampFactory#extension()} or {@link StampFactory#condition()} stamp need to be
-         * cloned immediately for the outside usages.</li>
-         * <li>Dependencies into the duplicated nodes will be replaced with dependencies on the merge.</li>
-         * <li>Outside non-{@link ValueNode}s with usages within the duplicated set of nodes need to also be duplicated.
-         * </li>
-         * <li>Outside {@link ValueNode}s with {@link StampFactory#extension()} or {@link StampFactory#condition()}
-         * stamps that have usages within the duplicated set of nodes need to also be duplicated.</li>
+         * <li>{@link ValueNode}s that have usages on the outside need to be replaced with phis for
+         * the outside usages.</li>
+         * <li>Non-{@link ValueNode} nodes that have outside usages (frame states, virtual object
+         * states, ...) need to be cloned immediately for the outside usages.</li>
+         * <li>Nodes that have a {@link StampFactory#extension()} or
+         * {@link StampFactory#condition()} stamp need to be cloned immediately for the outside
+         * usages.</li>
+         * <li>Dependencies into the duplicated nodes will be replaced with dependencies on the
+         * merge.</li>
+         * <li>Outside non-{@link ValueNode}s with usages within the duplicated set of nodes need to
+         * also be duplicated.</li>
+         * <li>Outside {@link ValueNode}s with {@link StampFactory#extension()} or
+         * {@link StampFactory#condition()} stamps that have usages within the duplicated set of
+         * nodes need to also be duplicated.</li>
          * </ul>
-         *
+         * 
          * @param duplicatedNodes The set of duplicated nodes that will be modified (expanded).
-         * @param newBottomMerge The merge that follows the duplicated set of nodes. It will be used for newly created
-         *            phis and to as a target for dependencies that pointed into the duplicated set of nodes.
+         * @param newBottomMerge The merge that follows the duplicated set of nodes. It will be used
+         *            for newly created phis and to as a target for dependencies that pointed into
+         *            the duplicated set of nodes.
          */
         private void expandDuplicated(HashSet<Node> duplicatedNodes, MergeNode newBottomMerge) {
             Deque<Node> worklist = new ArrayDeque<>(duplicatedNodes);
@@ -468,7 +494,8 @@
                         // clone the offending node to the outside
                         Node newOutsideClone = duplicated.copyWithInputs();
                         replaceUsagesOutside(duplicated, newOutsideClone, duplicatedNodes);
-                        // this might cause other nodes to have outside usages, we need to look at those as well
+                        // this might cause other nodes to have outside usages, we need to look at
+                        // those as well
                         for (Node input : newOutsideClone.inputs()) {
                             if (duplicatedNodes.contains(input)) {
                                 worklist.add(input);
@@ -498,10 +525,12 @@
         }
 
         /**
-         * Moves all depdendencies that point outside the duplicated area to the supplied value anchor node.
-         *
+         * Moves all depdendencies that point outside the duplicated area to the supplied value
+         * anchor node.
+         * 
          * @param duplicatedNodes The set of duplicated nodes.
-         * @param anchor The node that will be the new target for all dependencies that point outside the duplicated set of nodes.
+         * @param anchor The node that will be the new target for all dependencies that point
+         *            outside the duplicated set of nodes.
          */
         private static void retargetDependencies(HashSet<Node> duplicatedNodes, ValueAnchorNode anchor) {
             for (Node node : duplicatedNodes) {
@@ -520,7 +549,7 @@
 
         /**
          * Checks if the given node has usages that are not within the given set of nodes.
-         *
+         * 
          * @param node The node whose usages are checked.
          * @param nodeSet The set of nodes that are considered to be "within".
          * @return true if the given node has usages on the outside, false otherwise.
@@ -535,8 +564,9 @@
         }
 
         /**
-         * Replaces the given node with the given replacement at all usages that are not within the given set of nodes.
-         *
+         * Replaces the given node with the given replacement at all usages that are not within the
+         * given set of nodes.
+         * 
          * @param node The node to be replaced at outside usages.
          * @param replacement The node that replaced the given node at outside usages.
          * @param nodeSet The set of nodes that are considered to be "within".
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,13 +22,12 @@
  */
 package com.oracle.graal.phases;
 
-
-
 /**
  * This class encapsulates options that control the behavior of the Graal compiler.
- *
+ * 
  * (thomaswue) WARNING: Fields of this class are treated as final by Graal.
  */
+// @formatter:off
 public final class GraalOptions {
 
     // Checkstyle: stop
@@ -68,6 +67,7 @@
     public static boolean EscapeAnalysisHistogram            = ____;
     public static int     EscapeAnalysisIterations           = 2;
     public static String  EscapeAnalyzeOnly                  = null;
+    public static int     MaximumEscapeAnalysisArrayLength   = 32;
 
     public static double  TailDuplicationProbability         = 0.5;
     public static int     TailDuplicationTrivialSize         = 1;
@@ -98,8 +98,8 @@
     public static boolean ReassociateInvariants              = true;
     public static boolean FullUnroll                         = true;
     public static boolean LoopUnswitch                       = true;
-    public static int     FullUnrollMaxNodes                 = 150;
-    public static int     ExactFullUnrollMaxNodes            = 600;
+    public static int     FullUnrollMaxNodes                 = 300;
+    public static int     ExactFullUnrollMaxNodes            = 1200;
     public static float   MinimumPeelProbability             = 0.35f;
     public static int     LoopMaxUnswitch                    = 3;
     public static int     LoopUnswitchMaxIncrease            = 50;
@@ -185,7 +185,6 @@
     public static boolean OptReadElimination                 = true;
     public static boolean OptCanonicalizer                   = true;
     public static boolean OptScheduleOutOfLoops              = true;
-    public static boolean OptReorderLoops                    = true;
     public static boolean OptEliminateGuards                 = true;
     public static boolean OptImplicitNullChecks              = true;
     public static boolean OptLivenessAnalysis                = true;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/OptimisticOptimizations.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,18 +27,14 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
 
-
+public final class OptimisticOptimizations {
 
-public final class OptimisticOptimizations {
     public static final OptimisticOptimizations ALL = new OptimisticOptimizations(EnumSet.allOf(Optimization.class));
     public static final OptimisticOptimizations NONE = new OptimisticOptimizations(EnumSet.noneOf(Optimization.class));
     private static final DebugMetric disabledOptimisticOptsMetric = Debug.metric("DisabledOptimisticOpts");
 
     private static enum Optimization {
-        RemoveNeverExecutedCode,
-        UseTypeCheckedInlining,
-        UseTypeCheckHints,
-        UseExceptionProbability
+        RemoveNeverExecutedCode, UseTypeCheckedInlining, UseTypeCheckHints, UseExceptionProbability
     }
 
     private final Set<Optimization> enabledOpts;
@@ -56,7 +52,9 @@
         if (checkDeoptimizations(method.getProfilingInfo(), deoptReason)) {
             enabledOpts.add(optimization);
         } else {
-            // TODO (chaeubl): change to Debug.log when we are sure that optimistic optimizations are not disabled unnecessarily
+            // TODO (chaeubl): change to Debug.log when we are sure that optimistic optimizations
+            // are not disabled
+            // unnecessarily
             TTY.println("WARN: deactivated optimistic optimization %s for %s", optimization.name(), MetaUtil.format("%H.%n(%p)", method));
             disabledOptimisticOptsMetric.increment();
         }
@@ -95,7 +93,7 @@
     }
 
     public boolean lessOptimisticThan(OptimisticOptimizations other) {
-        for (Optimization opt: Optimization.values()) {
+        for (Optimization opt : Optimization.values()) {
             if (!enabledOpts.contains(opt) && other.enabledOpts.contains(opt)) {
                 return true;
             }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/Phase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/Phase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -52,6 +52,7 @@
 
     public final void apply(final StructuredGraph graph, final boolean dumpGraph) {
         Debug.scope(name, this, new Runnable() {
+
             public void run() {
                 Phase.this.run(graph);
                 metricPhaseRuns.increment();
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/PhasePlan.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,8 @@
  * Tells the compiler about additional phases that need to be executed during compilation.
  */
 public class PhasePlan {
+
+    // @formatter:off
     /**
      * The compilation is split into the following sections:
      * ========================================================================
@@ -52,9 +54,9 @@
         MID_LEVEL,
         LOW_LEVEL
     }
+    // @formatter:on
 
-    @SuppressWarnings("unchecked")
-    private final ArrayList<Phase>[] phases = new ArrayList[PhasePosition.values().length];
+    @SuppressWarnings("unchecked") private final ArrayList<Phase>[] phases = new ArrayList[PhasePosition.values().length];
     private final Set<Class<? extends Phase>> disabledPhases = new HashSet<>();
 
     public void addPhase(PhasePosition pos, Phase phase) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,15 @@
 
 import com.oracle.graal.nodes.*;
 
-public interface MergeableState <T> {
+public interface MergeableState<T> {
+
     T clone();
+
     boolean merge(MergeNode merge, List<T> withStates);
+
     void loopBegin(LoopBeginNode loopBegin);
+
     void loopEnds(LoopBeginNode loopBegin, List<T> loopEndStates);
+
     void afterSplit(BeginNode node);
 }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/PostOrderNodeIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/PostOrderNodeIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,11 +28,16 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * A PostOrderNodeIterator iterates the fixed nodes of the graph in post order starting from a specified fixed node.<br>
- * For this iterator the CFG is defined by the classical CFG nodes ({@link ControlSplitNode}, {@link MergeNode}...) and the {@link FixedWithNextNode#next() next} pointers
- * of {@link FixedWithNextNode}.<br>
- * While iterating it maintains a user-defined state by calling the methods available in {@link MergeableState}.
- *
+ * A PostOrderNodeIterator iterates the fixed nodes of the graph in post order starting from a
+ * specified fixed node.
+ * <p>
+ * For this iterator the CFG is defined by the classical CFG nodes ({@link ControlSplitNode},
+ * {@link MergeNode}...) and the {@link FixedWithNextNode#next() next} pointers of
+ * {@link FixedWithNextNode}.
+ * <p>
+ * While iterating it maintains a user-defined state by calling the methods available in
+ * {@link MergeableState}.
+ * 
  * @param <T> the type of {@link MergeableState} handled by this PostOrderNodeIterator
  */
 public abstract class PostOrderNodeIterator<T extends MergeableState<T>> {
@@ -100,7 +105,7 @@
             } else {
                 assert false : current;
             }
-        } while(current != null);
+        } while (current != null);
     }
 
     private void queueSuccessors(FixedNode x, Set<Node> successors) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ReentrantBlockIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ReentrantBlockIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -64,8 +64,8 @@
             info.endStates.add(blockEndStates.get(predecessors.get(i).getEndNode()));
         }
         for (Block loopExit : loop.exits) {
-            assert loopExit.getPredecessors().size() == 1;
-            T exitState = blockEndStates.get(loopExit.getPredecessors().get(0).getEndNode());
+            assert loopExit.getPredecessorCount() == 1;
+            T exitState = blockEndStates.get(loopExit.getFirstPredecessor().getEndNode());
             assert exitState != null;
             info.exitStates.add(exitState);
         }
@@ -89,7 +89,8 @@
                     Block successor = current.getSuccessors().get(0);
                     if (successor.isLoopHeader()) {
                         if (current.isLoopEnd()) {
-                            // nothing to do... loop ends only lead to loop begins we've already visited
+                            // nothing to do... loop ends only lead to loop begins we've already
+                            // visited
                             blockEndStates.put(current.getEndNode(), state);
                         } else {
                             // recurse into the loop
@@ -102,7 +103,7 @@
                             int i = 0;
                             assert loop.exits.size() == exitStates.size();
                             for (Block exit : loop.exits) {
-                                blockEndStates.put(exit.getPredecessors().get(0).getEndNode(), exitStates.get(i++));
+                                blockEndStates.put(exit.getFirstPredecessor().getEndNode(), exitStates.get(i++));
                                 blockQueue.addFirst(exit);
                             }
                         }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ScopedPostOrderNodeIterator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
 import com.oracle.graal.nodes.*;
 
 public abstract class ScopedPostOrderNodeIterator {
+
     private final Deque<FixedNode> nodeQueue;
     private final NodeBitMap queuedNodes;
     private final Deque<FixedNode> scopes;
@@ -92,7 +93,7 @@
         } else if (currentScopeStart instanceof LoopBeginNode) {
             // so we are currently processing loop A and found another loop B
             // -> queue all loop exits of B except those that also exit loop A
-            for (LoopExitNode loopExit: node.loopExits()) {
+            for (LoopExitNode loopExit : node.loopExits()) {
                 if (!((LoopBeginNode) currentScopeStart).loopExits().contains(loopExit)) {
                     queue(loopExit);
                 }
@@ -111,7 +112,7 @@
     protected Deque<FixedNode> getScopes(StructuredGraph graph) {
         Deque<FixedNode> result = new ArrayDeque<>();
         result.push(graph.start());
-        for (LoopBeginNode loopBegin: graph.getNodes(LoopBeginNode.class)) {
+        for (LoopBeginNode loopBegin : graph.getNodes(LoopBeginNode.class)) {
             result.push(loopBegin);
         }
         return result;
@@ -161,5 +162,6 @@
     }
 
     protected abstract void initializeScope();
+
     protected abstract void invoke(Invoke invoke);
 }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,3 +25,4 @@
  *
  */
 package com.oracle.graal.phases.graph;
+
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,3 +27,4 @@
  * Graal is intended to be used with multiple JVM's so makes no use of or reference to classes for a specific JVM.
  */
 package com.oracle.graal.phases;
+
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/BlockClosure.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/BlockClosure.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,5 +28,6 @@
  * The {@code BlockClosure} interface represents a closure for iterating over blocks.
  */
 public interface BlockClosure {
+
     void apply(Block block);
 }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
 import com.oracle.graal.phases.*;
 
 public class SchedulePhase extends Phase {
+
     private ControlFlowGraph cfg;
     private NodeMap<Block> earliestCache;
 
@@ -57,8 +58,9 @@
     }
 
     /**
-     * Sets {@link ScheduledNode#scheduledNext} on all scheduled nodes in all blocks using the scheduling built by @link {@link #run(StructuredGraph)}.
-     * This method should thus only be called when run has been successfully executed.
+     * Sets {@link ScheduledNode#scheduledNext} on all scheduled nodes in all blocks using the
+     * scheduling built by @link {@link #run(StructuredGraph)}. This method should thus only be
+     * called when run has been successfully executed.
      */
     public void scheduleGraph() {
         assert blockToNodesMap != null : "cannot set scheduledNext before run has been executed";
@@ -110,7 +112,8 @@
     }
 
     /**
-     * Assigns a block to the given node. This method expects that PhiNodes and FixedNodes are already assigned to a block.
+     * Assigns a block to the given node. This method expects that PhiNodes and FixedNodes are
+     * already assigned to a block.
      */
     private void assignBlockToNode(ScheduledNode node) {
         assert !node.isDeleted();
@@ -119,7 +122,8 @@
         if (prevBlock != null) {
             return;
         }
-        // PhiNodes and FixedNodes should already have been placed in blocks by ControlFlowGraph.identifyBlocks
+        // PhiNodes and FixedNodes should already have been placed in blocks by
+        // ControlFlowGraph.identifyBlocks
         assert !(node instanceof PhiNode) : node;
         assert !(node instanceof FixedNode) : node;
         // if in CFG, schedule at the latest position possible in the outermost loop possible
@@ -139,8 +143,8 @@
     }
 
     /**
-     * Calculates the last block that the given node could be scheduled in, i.e., the common dominator of all usages.
-     * To do so all usages are also assigned to blocks.
+     * Calculates the last block that the given node could be scheduled in, i.e., the common
+     * dominator of all usages. To do so all usages are also assigned to blocks.
      */
     private Block latestBlock(ScheduledNode node) {
         CommonDominatorBlockClosure cdbc = new CommonDominatorBlockClosure(null);
@@ -156,13 +160,17 @@
     }
 
     /**
-     * A closure that will calculate the common dominator of all blocks passed to its {@link #apply(Block)} method.
+     * A closure that will calculate the common dominator of all blocks passed to its
+     * {@link #apply(Block)} method.
      */
     private static class CommonDominatorBlockClosure implements BlockClosure {
+
         public Block block;
+
         public CommonDominatorBlockClosure(Block block) {
             this.block = block;
         }
+
         @Override
         public void apply(Block newBlock) {
             this.block = getCommonDominator(this.block, newBlock);
@@ -182,13 +190,14 @@
             return earliest;
         }
         /*
-         * All inputs must be in a dominating block, otherwise the graph cannot be scheduled. This implies that the
-         * inputs' blocks have a total ordering via their dominance relation. So in order to find the earliest block
-         * placement for this node we need to find the input block that is dominated by all other input blocks.
-         *
-         * While iterating over the inputs a set of dominator blocks of the current earliest placement is maintained.
-         * When the block of an input is not within this set, it becomes the current earliest placement and the list of
-         * dominator blocks is updated.
+         * All inputs must be in a dominating block, otherwise the graph cannot be scheduled. This
+         * implies that the inputs' blocks have a total ordering via their dominance relation. So in
+         * order to find the earliest block placement for this node we need to find the input block
+         * that is dominated by all other input blocks.
+         * 
+         * While iterating over the inputs a set of dominator blocks of the current earliest
+         * placement is maintained. When the block of an input is not within this set, it becomes
+         * the current earliest placement and the list of dominator blocks is updated.
          */
         BitSet dominators = new BitSet(cfg.getBlocks().length);
 
@@ -201,7 +210,7 @@
                 do {
                     dominators.set(inputEarliest.getId());
                     inputEarliest = inputEarliest.getDominator();
-                } while(inputEarliest != null && !dominators.get(inputEarliest.getId()));
+                } while (inputEarliest != null && !dominators.get(inputEarliest.getId()));
             }
         }
         if (earliest == null) {
@@ -211,7 +220,6 @@
         return earliest;
     }
 
-
     private static Block scheduleOutOfLoops(Node n, Block latestBlock, Block earliest) {
         assert latestBlock != null : "no latest : " + n;
         Block cur = latestBlock;
@@ -227,9 +235,9 @@
     }
 
     /**
-     * Passes all blocks that a specific usage of a node is in to a given closure.
-     * This is more complex than just taking the usage's block because of of PhiNodes and FrameStates.
-     *
+     * Passes all blocks that a specific usage of a node is in to a given closure. This is more
+     * complex than just taking the usage's block because of of PhiNodes and FrameStates.
+     * 
      * @param node the node that needs to be scheduled
      * @param usage the usage whose blocks need to be considered
      * @param closure the closure that will be called for each block
@@ -238,15 +246,17 @@
         assert !(node instanceof PhiNode);
 
         if (usage instanceof PhiNode) {
-            // An input to a PhiNode is used at the end of the predecessor block that corresponds to the PhiNode input.
-            // One PhiNode can use an input multiple times, the closure will be called for each usage.
+            // An input to a PhiNode is used at the end of the predecessor block that corresponds to
+            // the PhiNode input.
+            // One PhiNode can use an input multiple times, the closure will be called for each
+            // usage.
             PhiNode phi = (PhiNode) usage;
             MergeNode merge = phi.merge();
             Block mergeBlock = cfg.getNodeToBlock().get(merge);
             assert mergeBlock != null : "no block for merge " + merge.toString(Verbosity.Id);
             for (int i = 0; i < phi.valueCount(); ++i) {
                 if (phi.valueAt(i) == node) {
-                    if (mergeBlock.getPredecessors().size() <= i) {
+                    if (mergeBlock.getPredecessorCount() <= i) {
                         TTY.println(merge.toString());
                         TTY.println(phi.toString());
                         TTY.println(merge.cfgPredecessors().toString());
@@ -258,15 +268,18 @@
                 }
             }
         } else if (usage instanceof VirtualState) {
-            // The following logic does not work if node is a PhiNode, but this method is never called for PhiNodes.
+            // The following logic does not work if node is a PhiNode, but this method is never
+            // called for PhiNodes.
             for (Node unscheduledUsage : usage.usages()) {
                 if (unscheduledUsage instanceof VirtualState) {
-                    // If a FrameState is an outer FrameState this method behaves as if the inner FrameState was the actual usage, by recursing.
+                    // If a FrameState is an outer FrameState this method behaves as if the inner
+                    // FrameState was the actual usage, by recursing.
                     blocksForUsage(node, unscheduledUsage, closure);
                 } else if (unscheduledUsage instanceof MergeNode) {
                     // Only FrameStates can be connected to MergeNodes.
                     assert usage instanceof FrameState;
-                    // If a FrameState belongs to a MergeNode then it's inputs will be placed at the common dominator of all EndNodes.
+                    // If a FrameState belongs to a MergeNode then it's inputs will be placed at the
+                    // common dominator of all EndNodes.
                     for (Node pred : unscheduledUsage.cfgPredecessors()) {
                         closure.apply(cfg.getNodeToBlock().get(pred));
                     }
@@ -311,8 +324,9 @@
     }
 
     /**
-     * Sorts the nodes within a block by adding the nodes to a list in a post-order iteration over all inputs.
-     * This means that a node is added to the list after all its inputs have been processed.
+     * Sorts the nodes within a block by adding the nodes to a list in a post-order iteration over
+     * all inputs. This means that a node is added to the list after all its inputs have been
+     * processed.
      */
     private void sortNodesWithinBlock(Block b, NodeBitMap visited) {
         List<ScheduledNode> instructions = blockToNodesMap.get(b);
@@ -325,7 +339,8 @@
             addToSorting(b, i, sortedInstructions, visited);
         }
 
-        // Make sure that last node gets really last (i.e. when a frame state successor hangs off it).
+        // Make sure that last node gets really last (i.e. when a frame state successor hangs off
+        // it).
         Node lastSorted = sortedInstructions.get(sortedInstructions.size() - 1);
         if (lastSorted != b.getEndNode()) {
             int idx = sortedInstructions.indexOf(b.getEndNode());
@@ -338,12 +353,11 @@
             }
             if (canNotMove) {
                 if (b.getEndNode() instanceof ControlSplitNode) {
-                    throw new GraalInternalError("Schedule is not possible : needs to move a node after the last node of the block which can not be move").
-                    addContext(lastSorted).
-                    addContext(b.getEndNode());
+                    throw new GraalInternalError("Schedule is not possible : needs to move a node after the last node of the block which can not be move").addContext(lastSorted).addContext(
+                                    b.getEndNode());
                 }
 
-                //b.setLastNode(lastSorted);
+                // b.setLastNode(lastSorted);
             } else {
                 sortedInstructions.remove(b.getEndNode());
                 sortedInstructions.add(b.getEndNode());
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/ArrayMap.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/ArrayMap.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,10 +23,10 @@
 package com.oracle.graal.phases.util;
 
 /**
- * The {@code ArrayMap} class implements an efficient one-level map which is implemented
- * as an array. Note that because of the one-level array inside, this data structure performs best
- * when the range of integer keys is small and densely used. Note that the implementation can
- * handle arbitrary intervals, including negative numbers, up to intervals of size 2^31 - 1.
+ * The {@code ArrayMap} class implements an efficient one-level map which is implemented as an
+ * array. Note that because of the one-level array inside, this data structure performs best when
+ * the range of integer keys is small and densely used. Note that the implementation can handle
+ * arbitrary intervals, including negative numbers, up to intervals of size 2^31 - 1.
  */
 public class ArrayMap<T> {
 
@@ -43,8 +43,9 @@
     }
 
     /**
-     * Constructs a new {@code ArrayMap} that initially covers the specified interval.
-     * Note that this map will automatically expand if necessary later.
+     * Constructs a new {@code ArrayMap} that initially covers the specified interval. Note that
+     * this map will automatically expand if necessary later.
+     * 
      * @param low the low index, inclusive
      * @param high the high index, exclusive
      */
@@ -55,6 +56,7 @@
 
     /**
      * Puts a new value in the map at the specified index.
+     * 
      * @param i the index at which to store the value
      * @param value the value to store at the specified index
      */
@@ -79,9 +81,10 @@
 
     /**
      * Gets the value at the specified index in the map.
+     * 
      * @param i the index
-     * @return the value at the specified index; {@code null} if there is no value at the specified index,
-     * or if the index is out of the currently stored range
+     * @return the value at the specified index; {@code null} if there is no value at the specified
+     *         index, or if the index is out of the currently stored range
      */
     public T get(int i) {
         int index = i - low;
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BitMap2D.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BitMap2D.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,13 +32,13 @@
     private BitSet map;
     private final int bitsPerSlot;
 
-    private int bitIndex(int slotIndex, int bitWithinSlotIndex)  {
-      return slotIndex * bitsPerSlot + bitWithinSlotIndex;
+    private int bitIndex(int slotIndex, int bitWithinSlotIndex) {
+        return slotIndex * bitsPerSlot + bitWithinSlotIndex;
     }
 
-    private boolean verifyBitWithinSlotIndex(int index)  {
-      assert index < bitsPerSlot : "index " + index + " is out of bounds " + bitsPerSlot;
-      return true;
+    private boolean verifyBitWithinSlotIndex(int index) {
+        assert index < bitsPerSlot : "index " + index + " is out of bounds " + bitsPerSlot;
+        return true;
     }
 
     public BitMap2D(int sizeInSlots, int bitsPerSlot) {
@@ -47,50 +47,50 @@
     }
 
     public int sizeInBits() {
-      return map.size();
+        return map.size();
     }
 
     // Returns number of full slots that have been allocated
     public int sizeInSlots() {
-      return map.size() / bitsPerSlot;
+        return map.size() / bitsPerSlot;
     }
 
     public boolean isValidIndex(int slotIndex, int bitWithinSlotIndex) {
-      assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
-      return (bitIndex(slotIndex, bitWithinSlotIndex) < sizeInBits());
+        assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
+        return (bitIndex(slotIndex, bitWithinSlotIndex) < sizeInBits());
     }
 
-    public boolean at(int slotIndex, int bitWithinSlotIndex)  {
-      assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
-      return map.get(bitIndex(slotIndex, bitWithinSlotIndex));
+    public boolean at(int slotIndex, int bitWithinSlotIndex) {
+        assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
+        return map.get(bitIndex(slotIndex, bitWithinSlotIndex));
     }
 
     public void setBit(int slotIndex, int bitWithinSlotIndex) {
-      assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
-      map.set(bitIndex(slotIndex, bitWithinSlotIndex));
+        assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
+        map.set(bitIndex(slotIndex, bitWithinSlotIndex));
     }
 
     public void clearBit(int slotIndex, int bitWithinSlotIndex) {
-      assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
-      map.clear(bitIndex(slotIndex, bitWithinSlotIndex));
+        assert verifyBitWithinSlotIndex(bitWithinSlotIndex);
+        map.clear(bitIndex(slotIndex, bitWithinSlotIndex));
     }
 
     public void atPutGrow(int slotIndex, int bitWithinSlotIndex, boolean value) {
-       int size = sizeInSlots();
-       if (size <= slotIndex) {
-           while (size <= slotIndex) {
-               size *= 2;
-           }
-           BitSet newBitMap = new BitSet(size * bitsPerSlot);
-           newBitMap.or(map);
-           map = newBitMap;
-       }
+        int size = sizeInSlots();
+        if (size <= slotIndex) {
+            while (size <= slotIndex) {
+                size *= 2;
+            }
+            BitSet newBitMap = new BitSet(size * bitsPerSlot);
+            newBitMap.or(map);
+            map = newBitMap;
+        }
 
-       if (value) {
-           setBit(slotIndex, bitWithinSlotIndex);
-       } else {
-           clearBit(slotIndex, bitWithinSlotIndex);
-       }
+        if (value) {
+            setBit(slotIndex, bitWithinSlotIndex);
+        } else {
+            clearBit(slotIndex, bitWithinSlotIndex);
+        }
     }
 
     public void clear() {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/BlockWorkList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,18 +25,19 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * This class implements a worklist for dealing with blocks. The worklist can
- * operate either as a stack (i.e. first-in / last-out), or as a sorted list,
- * where blocks can be sorted by a supplied number. The latter usage lends itself
- * naturally to iterative dataflow analysis problems.
+ * This class implements a worklist for dealing with blocks. The worklist can operate either as a
+ * stack (i.e. first-in / last-out), or as a sorted list, where blocks can be sorted by a supplied
+ * number. The latter usage lends itself naturally to iterative dataflow analysis problems.
  */
 public class BlockWorkList {
+
     MergeNode[] workList;
     int[] workListNumbers;
     int workListIndex;
 
     /**
      * Adds a block to this list in an unsorted fashion, like a stack.
+     * 
      * @param block the block to add
      */
     public void add(MergeNode block) {
@@ -52,8 +53,9 @@
     }
 
     /**
-     * Adds a block to this list, sorted by the supplied number. The block
-     * with the lowest number is returned upon subsequent removes.
+     * Adds a block to this list, sorted by the supplied number. The block with the lowest number is
+     * returned upon subsequent removes.
+     * 
      * @param block the block to add
      * @param number the number used to sort the block
      */
@@ -84,9 +86,10 @@
     }
 
     /**
-     * Removes the next block from this work list. If the blocks have been added
-     * in a sorted order, then the block with the lowest number is returned. Otherwise,
-     * the last block added is returned.
+     * Removes the next block from this work list. If the blocks have been added in a sorted order,
+     * then the block with the lowest number is returned. Otherwise, the last block added is
+     * returned.
+     * 
      * @return the next block in the list
      */
     public MergeNode removeFromWorkList() {
@@ -98,6 +101,7 @@
 
     /**
      * Checks whether the list is empty.
+     * 
      * @return {@code true} if this list is empty
      */
     public boolean isEmpty() {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/IntList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/IntList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,7 @@
 
 /**
  * An expandable and indexable list of {@code int}s.
- *
+ * 
  * This class avoids the boxing/unboxing incurred by {@code ArrayList<Integer>}.
  */
 public final class IntList {
@@ -36,7 +36,7 @@
 
     /**
      * Creates an int list with a specified initial capacity.
-     *
+     * 
      * @param initialCapacity
      */
     public IntList(int initialCapacity) {
@@ -45,9 +45,10 @@
 
     /**
      * Creates an int list with a specified initial array.
-     *
+     * 
      * @param array the initial array used for the list (no copy is made)
-     * @param initialSize the initial {@linkplain #size() size} of the list (must be less than or equal to {@code array.length}
+     * @param initialSize the initial {@linkplain #size() size} of the list (must be less than or
+     *            equal to {@code array.length}
      */
     public IntList(int[] array, int initialSize) {
         assert initialSize <= array.length;
@@ -57,7 +58,7 @@
 
     /**
      * Makes a new int list by copying a range from a given int list.
-     *
+     * 
      * @param other the list from which a range of values is to be copied into the new list
      * @param startIndex the index in {@code other} at which to start copying
      * @param length the number of values to copy from {@code other}
@@ -69,11 +70,12 @@
 
     /**
      * Makes a new int list by copying a range from a given int list.
-     *
+     * 
      * @param other the list from which a range of values is to be copied into the new list
      * @param startIndex the index in {@code other} at which to start copying
      * @param length the number of values to copy from {@code other}
-     * @param initialCapacity the initial capacity of the new int list (must be greater or equal to {@code length})
+     * @param initialCapacity the initial capacity of the new int list (must be greater or equal to
+     *            {@code length})
      * @return a new int list whose {@linkplain #size() size} is {@code length}
      */
     public static IntList copy(IntList other, int startIndex, int length, int initialCapacity) {
@@ -89,7 +91,7 @@
 
     /**
      * Appends a value to the end of this list, increasing its {@linkplain #size() size} by 1.
-     *
+     * 
      * @param value the value to append
      */
     public void add(int value) {
@@ -102,7 +104,7 @@
 
     /**
      * Gets the value in this list at a given index.
-     *
+     * 
      * @param index the index of the element to return
      * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()}
      */
@@ -122,7 +124,7 @@
 
     /**
      * Sets a value at a given index in this list.
-     *
+     * 
      * @param index the index of the element to update
      * @param value the new value of the element
      * @throws IndexOutOfBoundsException if {@code index < 0 || index >= size()}
@@ -136,11 +138,11 @@
 
     /**
      * Adjusts the {@linkplain #size() size} of this int list.
-     *
-     * If {@code newSize < size()}, the size is changed to {@code newSize}.
-     * If {@code newSize > size()}, sufficient 0 elements are {@linkplain #add(int) added}
-     * until {@code size() == newSize}.
-     *
+     * 
+     * If {@code newSize < size()}, the size is changed to {@code newSize}. If
+     * {@code newSize > size()}, sufficient 0 elements are {@linkplain #add(int) added} until
+     * {@code size() == newSize}.
+     * 
      * @param newSize the new size of this int list
      */
     public void setSize(int newSize) {
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Util.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/Util.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,7 +31,8 @@
 import com.oracle.graal.nodes.calc.*;
 
 /**
- * The {@code Util} class contains a motley collection of utility methods used throughout the compiler.
+ * The {@code Util} class contains a motley collection of utility methods used throughout the
+ * compiler.
  */
 public class Util {
 
@@ -69,7 +70,7 @@
 
     /**
      * Utility method to combine a base hash with the identity hash of one or more objects.
-     *
+     * 
      * @param hash the base hash
      * @param x the object to add to the hash
      * @return the combined hash
@@ -81,7 +82,7 @@
 
     /**
      * Utility method to combine a base hash with the identity hash of one or more objects.
-     *
+     * 
      * @param hash the base hash
      * @param x the first object to add to the hash
      * @param y the second object to add to the hash
@@ -94,7 +95,7 @@
 
     /**
      * Utility method to combine a base hash with the identity hash of one or more objects.
-     *
+     * 
      * @param hash the base hash
      * @param x the first object to add to the hash
      * @param y the second object to add to the hash
@@ -108,7 +109,7 @@
 
     /**
      * Utility method to combine a base hash with the identity hash of one or more objects.
-     *
+     * 
      * @param hash the base hash
      * @param x the first object to add to the hash
      * @param y the second object to add to the hash
@@ -150,13 +151,15 @@
     }
 
     /**
-     * Sets the element at a given position of a list and ensures that this position exists. If the list is current
-     * shorter than the position, intermediate positions are filled with a given value.
-     *
+     * Sets the element at a given position of a list and ensures that this position exists. If the
+     * list is current shorter than the position, intermediate positions are filled with a given
+     * value.
+     * 
      * @param list the list to put the element into
      * @param pos the position at which to insert the element
      * @param x the element that should be inserted
-     * @param filler the filler element that is used for the intermediate positions in case the list is shorter than pos
+     * @param filler the filler element that is used for the intermediate positions in case the list
+     *            is shorter than pos
      */
     public static <T> void atPutGrow(List<T> list, int pos, T x, T filler) {
         if (list.size() < pos + 1) {
@@ -214,8 +217,9 @@
 
     /**
      * Prints entries in a byte array as space separated hex values to {@link TTY}.
-     *
-     * @param address an address at which the bytes are located. This is used to print an address prefix per line of output.
+     * 
+     * @param address an address at which the bytes are located. This is used to print an address
+     *            prefix per line of output.
      * @param array the array containing all the bytes to print
      * @param bytesPerLine the number of values to print per line of output
      */
@@ -225,8 +229,9 @@
 
     /**
      * Prints entries in a byte array as space separated hex values to {@link TTY}.
-     *
-     * @param address an address at which the bytes are located. This is used to print an address prefix per line of output.
+     * 
+     * @param address an address at which the bytes are located. This is used to print an address
+     *            prefix per line of output.
      * @param array the array containing the bytes to print
      * @param offset the offset in {@code array} of the values to print
      * @param length the number of values from {@code array} print
@@ -297,6 +302,7 @@
     public static boolean isInt(long l) {
         return (int) l == l;
     }
+
     /**
      * Determines if a given {@code int} value is the range of signed short values.
      */
@@ -322,14 +328,14 @@
     }
 
     /**
-     * Creates an array of integers of length "size", in which each number from 0 to (size - 1) occurs exactly once. The
-     * integers are sorted using the given comparator. This can be used to create a sorting for arrays that cannot be
-     * modified directly.
-     *
+     * Creates an array of integers of length "size", in which each number from 0 to (size - 1)
+     * occurs exactly once. The integers are sorted using the given comparator. This can be used to
+     * create a sorting for arrays that cannot be modified directly.
+     * 
      * @param size The size of the range to be sorted.
      * @param comparator A comparator that is used to compare indexes.
-     * @return An array of integers that contains each number from 0 to (size - 1) exactly once, sorted using the
-     *         comparator.
+     * @return An array of integers that contains each number from 0 to (size - 1) exactly once,
+     *         sorted using the comparator.
      */
     public static Integer[] createSortedPermutation(int size, Comparator<Integer> comparator) {
         Integer[] indexes = new Integer[size];
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BasicIdealGraphPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,8 @@
 import java.util.Map.Entry;
 
 /**
- * Elementary, generic generator of Ideal Graph Visualizer input for use in printers for specific data structures.
+ * Elementary, generic generator of Ideal Graph Visualizer input for use in printers for specific
+ * data structures.
  */
 class BasicIdealGraphPrinter {
 
@@ -35,6 +36,7 @@
      * Edge between two nodes.
      */
     protected static class Edge {
+
         final String from;
         final int fromIndex;
         final String to;
@@ -68,11 +70,8 @@
             }
             if (obj instanceof Edge) {
                 Edge other = (Edge) obj;
-                return from.equals(other.from)
-                        && fromIndex == other.fromIndex
-                        && to.equals(other.to)
-                        && toIndex == other.toIndex
-                        && (label == other.label || (label != null && label.equals(other.label)));
+                return from.equals(other.from) && fromIndex == other.fromIndex && to.equals(other.to) && toIndex == other.toIndex &&
+                                (label == other.label || (label != null && label.equals(other.label)));
             }
             return false;
         }
@@ -278,7 +277,6 @@
         return !stream.checkError();
     }
 
-
     private static String escape(String s) {
         StringBuilder str = null;
         for (int i = 0; i < s.length(); i++) {
@@ -293,7 +291,7 @@
                         str = new StringBuilder();
                         str.append(s, 0, i);
                     }
-                    switch(c) {
+                    switch (c) {
                         case '&':
                             str.append("&amp;");
                             break;
@@ -313,13 +311,34 @@
                             assert false;
                     }
                     break;
-                case '\u0000': case '\u0001': case '\u0002': case '\u0003':
-                case '\u0004': case '\u0005': case '\u0006': case '\u0007':
-                case '\u0008': case '\u000b': case '\u000c': case '\u000e':
-                case '\u000f': case '\u0010': case '\u0011': case '\u0012':
-                case '\u0013': case '\u0014': case '\u0015': case '\u0016':
-                case '\u0017': case '\u0018': case '\u0019': case '\u001a':
-                case '\u001b': case '\u001c': case '\u001d': case '\u001e':
+                case '\u0000':
+                case '\u0001':
+                case '\u0002':
+                case '\u0003':
+                case '\u0004':
+                case '\u0005':
+                case '\u0006':
+                case '\u0007':
+                case '\u0008':
+                case '\u000b':
+                case '\u000c':
+                case '\u000e':
+                case '\u000f':
+                case '\u0010':
+                case '\u0011':
+                case '\u0012':
+                case '\u0013':
+                case '\u0014':
+                case '\u0015':
+                case '\u0016':
+                case '\u0017':
+                case '\u0018':
+                case '\u0019':
+                case '\u001a':
+                case '\u001b':
+                case '\u001c':
+                case '\u001d':
+                case '\u001e':
                 case '\u001f':
                     if (str == null) {
                         str = new StringBuilder();
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/BinaryGraphPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,8 @@
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.phases.schedule.*;
 
-public class BinaryGraphPrinter implements GraphPrinter{
+public class BinaryGraphPrinter implements GraphPrinter {
+
     private static final int CONSTANT_POOL_MAX_SIZE = 2000;
 
     private static final int BEGIN_GROUP = 0x00;
@@ -66,13 +67,16 @@
     private static final int ENUM_KLASS = 0x01;
 
     private static final class ConstantPool extends LinkedHashMap<Object, Integer> {
+
         private final LinkedList<Integer> availableIds;
         private int nextId;
         private static final long serialVersionUID = -2676889957907285681L;
+
         public ConstantPool() {
             super(50, 0.65f);
             availableIds = new LinkedList<>();
         }
+
         @Override
         protected boolean removeEldestEntry(java.util.Map.Entry<Object, Integer> eldest) {
             if (size() > CONSTANT_POOL_MAX_SIZE) {
@@ -115,7 +119,7 @@
             } catch (Throwable t) {
             }
         }
-        ControlFlowGraph cfg =  schedule == null ? null : schedule.getCFG();
+        ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG();
         BlockMap<List<ScheduledNode>> blockToNodes = schedule == null ? null : schedule.getBlockToNodesMap();
         Block[] blocks = cfg == null ? null : cfg.getBlocks();
         writeByte(BEGIN_GRAPH);
@@ -249,7 +253,7 @@
         writeByte(POOL_NEW);
         writeInt(index);
         if (object instanceof Class<?>) {
-            Class<?> klass = (Class< ? >) object;
+            Class<?> klass = (Class<?>) object;
             writeByte(POOL_CLASS);
             writeString(getClassName(klass));
             if (klass.isEnum()) {
@@ -336,7 +340,7 @@
                 writeByte(PROPERTY_FALSE);
             }
         } else if (obj != null && obj.getClass().isArray()) {
-            Class< ? > componentType = obj.getClass().getComponentType();
+            Class<?> componentType = obj.getClass().getComponentType();
             if (componentType.isPrimitive()) {
                 if (componentType == Double.TYPE) {
                     writeByte(PROPERTY_ARRAY);
@@ -391,7 +395,7 @@
                 writeInt(sux.getId());
                 writeShort((char) pos.index);
             }
-            //inputs
+            // inputs
             NodeClassIterable inputs = node.inputs();
             writeShort((char) inputs.count());
             NodeClassIterator inIt = inputs.iterator();
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -54,7 +54,7 @@
 
     /**
      * Creates a control flow graph printer.
-     *
+     * 
      * @param out where the output generated via this printer shown be written
      */
     public CFGPrinter(OutputStream out) {
@@ -63,9 +63,10 @@
 
     /**
      * Prints the control flow graph denoted by a given block map.
-     *
+     * 
      * @param label A label describing the compilation phase that produced the control flow graph.
-     * @param blockMap A data structure describing the blocks in a method and how they are connected.
+     * @param blockMap A data structure describing the blocks in a method and how they are
+     *            connected.
      */
     public void printCFG(String label, BciBlockMapping blockMap) {
         begin("cfg");
@@ -113,7 +114,6 @@
         out.print("loop_depth ").println(Long.bitCount(block.loops));
     }
 
-
     private NodeMap<Block> latestScheduling;
     private NodeBitMap printedNodes;
 
@@ -123,7 +123,7 @@
 
     /**
      * Prints the specified list of blocks.
-     *
+     * 
      * @param label A label describing the compilation phase that produced the control flow graph.
      * @param blocks The list of blocks to be printed.
      */
@@ -241,7 +241,7 @@
         out.println("HIR");
         out.disableIndentation();
 
-        if (block.getPredecessors().size() == 0) {
+        if (block.getPredecessorCount() == 0) {
             // Currently method parameters are not in the schedule, so print them separately here.
             for (ValueNode param : block.getBeginNode().graph().getNodes(LocalNode.class)) {
                 printNode(param, false);
@@ -421,7 +421,7 @@
 
     /**
      * Prints the LIR for each instruction in a given block.
-     *
+     * 
      * @param block the block to print
      */
     private void printLIR(Block block) {
@@ -442,6 +442,7 @@
 
             final StringBuilder stateString = new StringBuilder();
             inst.forEachState(new LIRInstruction.StateProcedure() {
+
                 @Override
                 protected void doState(LIRFrameState state) {
                     if (state.hasDebugInfo()) {
@@ -486,16 +487,18 @@
 
     private String blockToString(Block block) {
         if (lir == null) {
-            // During all the front-end phases, the block schedule is built only for the debug output.
-            // Therefore, the block numbers would be different for every CFG printed -> use the id of the first instruction.
+            // During all the front-end phases, the block schedule is built only for the debug
+            // output.
+            // Therefore, the block numbers would be different for every CFG printed -> use the id
+            // of the first instruction.
             return "B" + block.getBeginNode().toString(Verbosity.Id);
         } else {
-            // LIR instructions contain references to blocks and these blocks are printed as the blockID -> use the blockID.
+            // LIR instructions contain references to blocks and these blocks are printed as the
+            // blockID -> use the blockID.
             return "B" + block.getId();
         }
     }
 
-
     public void printIntervals(String label, Interval[] intervals) {
         begin("intervals");
         out.println(String.format("name \"%s\"", label));
@@ -543,4 +546,3 @@
         out.println();
     }
 }
-
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinterObserver.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,8 +39,8 @@
 import com.oracle.graal.nodes.cfg.*;
 
 /**
- * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the <a
- * href="http://java.net/projects/c1visualizer/">C1 Visualizer</a>.
+ * Observes compilation events and uses {@link CFGPrinter} to produce a control flow graph for the
+ * <a href="http://java.net/projects/c1visualizer/">C1 Visualizer</a>.
  */
 public class CFGPrinterObserver implements DebugDumpHandler {
 
@@ -59,9 +59,9 @@
     }
 
     /**
-     * Looks for the outer most method and its {@link DebugDumpScope#decorator}s
-     * in the current debug scope and opens a new compilation scope if this pair
-     * does not match the current method and decorator pair.
+     * Looks for the outer most method and its {@link DebugDumpScope#decorator}s in the current
+     * debug scope and opens a new compilation scope if this pair does not match the current method
+     * and decorator pair.
      */
     private boolean checkMethodScope() {
         ResolvedJavaMethod method = null;
@@ -153,15 +153,19 @@
             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;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CompilationPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,11 +32,12 @@
 import com.oracle.graal.debug.*;
 
 /**
- * Utility for printing compilation related data structures at various compilation phases.
- * The output format is such that it can then be fed to the
- * <a href="https://c1visualizer.dev.java.net/">C1 Visualizer</a>.
+ * Utility for printing compilation related data structures at various compilation phases. The
+ * output format is such that it can then be fed to the <a
+ * href="https://c1visualizer.dev.java.net/">C1 Visualizer</a>.
  */
 public class CompilationPrinter implements Closeable {
+
     public static final String COLUMN_END = " <|@";
     public static final String HOVER_START = "<@";
     public static final String HOVER_SEP = "|@";
@@ -45,11 +46,12 @@
     private static OutputStream globalOut;
 
     /**
-     * Gets a global output stream on a file in the current working directory.
-     * This stream is first opened if necessary. The name of the file
-     * is {@code "compilations-" + System.currentTimeMillis() + ".cfg"}.
-     *
-     * @return the global output stream or {@code null} if there was an error opening the file for writing
+     * Gets a global output stream on a file in the current working directory. This stream is first
+     * opened if necessary. The name of the file is
+     * {@code "compilations-" + System.currentTimeMillis() + ".cfg"}.
+     * 
+     * @return the global output stream or {@code null} if there was an error opening the file for
+     *         writing
      */
     public static synchronized OutputStream globalOut() {
         if (globalOut == null) {
@@ -67,7 +69,7 @@
 
     /**
      * Creates a control flow graph printer.
-     *
+     * 
      * @param os where the output generated via this printer will be sent
      */
     public CompilationPrinter(OutputStream os) {
@@ -98,7 +100,7 @@
 
     /**
      * Prints a compilation timestamp for a given method.
-     *
+     * 
      * @param method the method for which a timestamp will be printed
      */
     public void printCompilation(JavaMethod method) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/DebugEnvironment.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,6 @@
 import com.oracle.graal.debug.*;
 import com.oracle.graal.phases.*;
 
-
 public class DebugEnvironment {
 
     public static void initialize(PrintStream log) {
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,13 +29,16 @@
 import com.oracle.graal.phases.schedule.*;
 
 interface GraphPrinter extends Closeable {
+
     /**
-     * Starts a new group of graphs with the given name, short name and method byte code index (BCI) as properties.
+     * Starts a new group of graphs with the given name, short name and method byte code index (BCI)
+     * as properties.
      */
     void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) throws IOException;
 
     /**
-     * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes.
+     * Prints an entire {@link Graph} with the specified title, optionally using short names for
+     * nodes.
      */
     void print(Graph graph, String title, SchedulePhase predefinedSchedule) throws IOException;
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -35,8 +35,9 @@
 import com.oracle.graal.phases.*;
 
 /**
- * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation that can be
- * inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
+ * Observes compilation events and uses {@link IdealGraphPrinter} to generate a graph representation
+ * that can be inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph
+ * Visualizer</a>.
  */
 public class GraphPrinterDumpHandler implements DebugDumpHandler {
 
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,40 +32,41 @@
 import com.oracle.graal.api.code.CompilationResult.JumpTable;
 import com.oracle.graal.api.code.CompilationResult.LookupTable;
 
-
 /**
- * A HexCodeFile is a textual format for representing a chunk of machine code along
- * with extra information that can be used to enhance a disassembly of the code.
- *
+ * A HexCodeFile is a textual format for representing a chunk of machine code along with extra
+ * information that can be used to enhance a disassembly of the code.
+ * 
  * A pseudo grammar for a HexCodeFile is given below.
+ * 
  * <pre>
  *     HexCodeFile ::= Platform Delim HexCode Delim (OptionalSection Delim)*
- *
+ * 
  *     OptionalSection ::= Comment | OperandComment | JumpTable | LookupTable
- *
+ * 
  *     Platform ::= "Platform" ISA WordWidth
- *
+ * 
  *     HexCode ::= "HexCode" StartAddress HexDigits
- *
+ * 
  *     Comment ::= "Comment" Position String
- *
+ * 
  *     OperandComment ::= "OperandComment" Position String
- *
+ * 
  *     JumpTable ::= "JumpTable" Position EntrySize Low High
- *
+ * 
  *     LookupTable ::= "LookupTable" Position NPairs KeySize OffsetSize
- *
+ * 
  *     Position, EntrySize, Low, High, NPairs KeySize OffsetSize ::= int
- *
+ * 
  *     Delim := "<||@"
  * </pre>
- *
- * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits must be even
- * as each pair of digits represents a single byte.
+ * 
+ * There must be exactly one HexCode and Platform part in a HexCodeFile. The length of HexDigits
+ * must be even as each pair of digits represents a single byte.
  * <p>
  * Below is an example of a valid Code input:
+ * 
  * <pre>
- *
+ * 
  *  Platform AMD64 64  <||@
  *  HexCode 0 e8000000009090904883ec084889842410d0ffff48893c24e800000000488b3c24488bf0e8000000004883c408c3  <||@
  *  Comment 24 frame-ref-map: +0 {0}
@@ -81,7 +82,7 @@
  *     locals:  |stack:0:a
  *    <||@
  *  OperandComment 36 {java.lang.String.toLowerCase(Locale)}  <||@
- *
+ * 
  * </pre>
  */
 public class HexCodeFile {
@@ -112,7 +113,8 @@
     public final Map<Integer, List<String>> comments = new TreeMap<>();
 
     /**
-     * Map from a machine code position to a comment for the operands of the instruction at the position.
+     * Map from a machine code position to a comment for the operands of the instruction at the
+     * position.
      */
     public final Map<Integer, String> operandComments = new TreeMap<>();
 
@@ -136,14 +138,16 @@
     }
 
     /**
-     * Parses a string in the format produced by {@link #toString()} to produce a {@link HexCodeFile} object.
+     * Parses a string in the format produced by {@link #toString()} to produce a
+     * {@link HexCodeFile} object.
      */
     public static HexCodeFile parse(String input, int sourceOffset, String source, String sourceName) {
         return new Parser(input, sourceOffset, source, sourceName).hcf;
     }
 
     /**
-     * Formats this HexCodeFile as a string that can be parsed with {@link #parse(String, int, String, String)}.
+     * Formats this HexCodeFile as a string that can be parsed with
+     * {@link #parse(String, int, String, String)}.
      */
     @Override
     public String toString() {
@@ -158,7 +162,7 @@
 
     public void writeTo(OutputStream out) {
         PrintStream ps = out instanceof PrintStream ? (PrintStream) out : new PrintStream(out);
-        ps.printf("Platform %s %d %s%n",  isa, wordWidth, SECTION_DELIM);
+        ps.printf("Platform %s %d %s%n", isa, wordWidth, SECTION_DELIM);
         ps.printf("HexCode %x %s %s%n", startAddress, HexCodeFile.hexCodeString(code), SECTION_DELIM);
 
         for (JumpTable table : jumpTables) {
@@ -182,7 +186,6 @@
         ps.flush();
     }
 
-
     /**
      * Formats a byte array as a string of hex digits.
      */
@@ -212,7 +215,7 @@
 
     /**
      * Sets an operand comment for a given position.
-     *
+     * 
      * @return the previous operand comment for {@code pos}
      */
     public String addOperandComment(int pos, String comment) {
@@ -253,8 +256,8 @@
     }
 
     /**
-     * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()}
-     * and produce a {@link HexCodeFile} object.
+     * Helper class to parse a string in the format produced by {@link HexCodeFile#toString()} and
+     * produce a {@link HexCodeFile} object.
      */
     static class Parser {
 
@@ -308,8 +311,10 @@
         }
 
         static class InputPos {
+
             final int line;
             final int col;
+
             public InputPos(int line, int col) {
                 this.line = line;
                 this.col = col;
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/IdealGraphPrinter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,10 +37,11 @@
 import com.oracle.graal.phases.schedule.*;
 
 /**
- * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the <a
- * href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
+ * Generates a representation of {@link Graph Graphs} that can be visualized and inspected with the
+ * <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>.
  */
 class IdealGraphPrinter extends BasicIdealGraphPrinter implements GraphPrinter {
+
     /**
      * Creates a new {@link IdealGraphPrinter} that writes to the specified output stream.
      */
@@ -50,7 +51,8 @@
     }
 
     /**
-     * Starts a new group of graphs with the given name, short name and method byte code index (BCI) as properties.
+     * Starts a new group of graphs with the given name, short name and method byte code index (BCI)
+     * as properties.
      */
     @Override
     public void beginGroup(String name, String shortName, ResolvedJavaMethod method, int bci) {
@@ -70,7 +72,8 @@
     }
 
     /**
-     * Prints an entire {@link Graph} with the specified title, optionally using short names for nodes.
+     * Prints an entire {@link Graph} with the specified title, optionally using short names for
+     * nodes.
      */
     @Override
     public void print(Graph graph, String title, SchedulePhase predefinedSchedule) {
@@ -84,7 +87,7 @@
             } catch (Throwable t) {
             }
         }
-        ControlFlowGraph cfg =  schedule == null ? null : schedule.getCFG();
+        ControlFlowGraph cfg = schedule == null ? null : schedule.getCFG();
 
         beginNodes();
         List<Edge> edges = printNodes(graph, cfg == null ? null : cfg.getNodeToBlock(), noBlockNodes);
@@ -131,9 +134,10 @@
             Block block = nodeToBlock == null ? null : nodeToBlock.get(node);
             if (block != null) {
                 printProperty("block", Integer.toString(block.getId()));
-//                if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof LocalNode) && !block.nodes().contains(node)) {
-//                    printProperty("notInOwnBlock", "true");
-//                }
+                // if (!(node instanceof PhiNode || node instanceof FrameState || node instanceof
+                // LocalNode) && !block.nodes().contains(node)) {
+                // printProperty("notInOwnBlock", "true");
+                // }
             } else {
                 printProperty("block", "noBlock");
                 noBlockNodes.add(node);
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/CheckCastTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,8 +29,7 @@
 import com.oracle.graal.nodes.java.*;
 
 /**
- * Tests the implementation of checkcast, allowing profiling information to
- * be manually specified.
+ * Tests the implementation of checkcast, allowing profiling information to be manually specified.
  */
 public class CheckCastTest extends TypeCheckTest {
 
@@ -45,26 +44,26 @@
 
     @Test
     public void test1() {
-        test("asNumber",    profile(),                        111);
-        test("asNumber",    profile(Integer.class),           111);
-        test("asNumber",    profile(Long.class, Short.class), 111);
-        test("asNumberExt", profile(),                        111);
-        test("asNumberExt", profile(Integer.class),           111);
+        test("asNumber", profile(), 111);
+        test("asNumber", profile(Integer.class), 111);
+        test("asNumber", profile(Long.class, Short.class), 111);
+        test("asNumberExt", profile(), 111);
+        test("asNumberExt", profile(Integer.class), 111);
         test("asNumberExt", profile(Long.class, Short.class), 111);
     }
 
     @Test
     public void test2() {
-        test("asString",    profile(),             "111");
-        test("asString",    profile(String.class), "111");
-        test("asString",    profile(String.class), "111");
+        test("asString", profile(), "111");
+        test("asString", profile(String.class), "111");
+        test("asString", profile(String.class), "111");
 
         final String nullString = null;
-        test("asString",    profile(),             nullString);
-        test("asString",    profile(String.class), nullString);
-        test("asString",    profile(String.class), nullString);
+        test("asString", profile(), nullString);
+        test("asString", profile(String.class), nullString);
+        test("asString", profile(String.class), nullString);
 
-        test("asStringExt", profile(),             "111");
+        test("asStringExt", profile(), "111");
         test("asStringExt", profile(String.class), "111");
         test("asStringExt", profile(String.class), "111");
     }
@@ -92,9 +91,9 @@
     @Test
     public void test7() {
         Throwable throwable = new Exception();
-        test("asThrowable",   profile(),                             throwable);
-        test("asThrowable",   profile(Throwable.class),              throwable);
-        test("asThrowable",   profile(Exception.class, Error.class), throwable);
+        test("asThrowable", profile(), throwable);
+        test("asThrowable", profile(Throwable.class), throwable);
+        test("asThrowable", profile(Exception.class, Error.class), throwable);
     }
 
     @Test
@@ -145,20 +144,47 @@
         return arr;
     }
 
-    static class Depth1 implements Cloneable {}
-    static class Depth2 extends Depth1 {}
-    static class Depth3 extends Depth2 {}
-    static class Depth4 extends Depth3 {}
-    static class Depth5 extends Depth4 {}
-    static class Depth6 extends Depth5 {}
-    static class Depth7 extends Depth6 {}
-    static class Depth8 extends Depth7 {}
-    static class Depth9 extends Depth8 {}
-    static class Depth10 extends Depth9 {}
-    static class Depth11 extends Depth10 {}
-    static class Depth12 extends Depth11 {}
-    static class Depth13 extends Depth12 {}
-    static class Depth14 extends Depth12 {}
+    static class Depth1 implements Cloneable {
+    }
+
+    static class Depth2 extends Depth1 {
+    }
+
+    static class Depth3 extends Depth2 {
+    }
+
+    static class Depth4 extends Depth3 {
+    }
+
+    static class Depth5 extends Depth4 {
+    }
+
+    static class Depth6 extends Depth5 {
+    }
+
+    static class Depth7 extends Depth6 {
+    }
+
+    static class Depth8 extends Depth7 {
+    }
+
+    static class Depth9 extends Depth8 {
+    }
+
+    static class Depth10 extends Depth9 {
+    }
+
+    static class Depth11 extends Depth10 {
+    }
+
+    static class Depth12 extends Depth11 {
+    }
+
+    static class Depth13 extends Depth12 {
+    }
+
+    static class Depth14 extends Depth12 {
+    }
 
     public static Depth12 asDepth12(Object o) {
         return (Depth12) o;
@@ -175,9 +201,9 @@
     @Test
     public void test9() {
         Object o = new Depth13();
-        test("asDepth12",   profile(), o);
-        test("asDepth12",   profile(Depth13.class), o);
-        test("asDepth12",   profile(Depth13.class, Depth14.class), o);
+        test("asDepth12", profile(), o);
+        test("asDepth12", profile(Depth13.class), o);
+        test("asDepth12", profile(Depth13.class, Depth14.class), o);
     }
 
     @Test
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InstanceOfTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,8 +39,7 @@
 import com.oracle.graal.snippets.CheckCastTest.Depth14;
 
 /**
- * Tests the implementation of instanceof, allowing profiling information to
- * be manually specified.
+ * Tests the implementation of instanceof, allowing profiling information to be manually specified.
  */
 public class InstanceOfTest extends TypeCheckTest {
 
@@ -60,112 +59,112 @@
 
     @Test
     public void test1() {
-        test("isString",    profile(),                        "object");
-        test("isString",    profile(String.class),            "object");
+        test("isString", profile(), "object");
+        test("isString", profile(String.class), "object");
 
-        test("isString",    profile(),                        Object.class);
-        test("isString",    profile(String.class),            Object.class);
+        test("isString", profile(), Object.class);
+        test("isString", profile(String.class), Object.class);
     }
 
     @Test
     public void test2() {
-        test("isStringInt",    profile(),                        "object");
-        test("isStringInt",    profile(String.class),            "object");
+        test("isStringInt", profile(), "object");
+        test("isStringInt", profile(String.class), "object");
 
-        test("isStringInt",    profile(),                        Object.class);
-        test("isStringInt",    profile(String.class),            Object.class);
+        test("isStringInt", profile(), Object.class);
+        test("isStringInt", profile(String.class), Object.class);
     }
 
     @Test
     public void test2_1() {
-        test("isStringIntComplex",    profile(),                        "object");
-        test("isStringIntComplex",    profile(String.class),            "object");
+        test("isStringIntComplex", profile(), "object");
+        test("isStringIntComplex", profile(String.class), "object");
 
-        test("isStringIntComplex",    profile(),                        Object.class);
-        test("isStringIntComplex",    profile(String.class),            Object.class);
+        test("isStringIntComplex", profile(), Object.class);
+        test("isStringIntComplex", profile(String.class), Object.class);
     }
 
     @Test
     public void test3() {
         Throwable throwable = new Exception();
-        test("isThrowable",    profile(),                             throwable);
-        test("isThrowable",    profile(Throwable.class),              throwable);
-        test("isThrowable",    profile(Exception.class, Error.class), throwable);
+        test("isThrowable", profile(), throwable);
+        test("isThrowable", profile(Throwable.class), throwable);
+        test("isThrowable", profile(Exception.class, Error.class), throwable);
 
-        test("isThrowable",    profile(),                             Object.class);
-        test("isThrowable",    profile(Throwable.class),              Object.class);
-        test("isThrowable",    profile(Exception.class, Error.class), Object.class);
+        test("isThrowable", profile(), Object.class);
+        test("isThrowable", profile(Throwable.class), Object.class);
+        test("isThrowable", profile(Exception.class, Error.class), Object.class);
     }
 
     @Test
     public void test3_1() {
         onlyFirstIsException(new Exception(), new Error());
-        test("onlyFirstIsException",    profile(),                             new Exception(), new Error());
-        test("onlyFirstIsException",    profile(),                             new Error(), new Exception());
-        test("onlyFirstIsException",    profile(),                             new Exception(), new Exception());
-        test("onlyFirstIsException",    profile(),                             new Error(), new Error());
+        test("onlyFirstIsException", profile(), new Exception(), new Error());
+        test("onlyFirstIsException", profile(), new Error(), new Exception());
+        test("onlyFirstIsException", profile(), new Exception(), new Exception());
+        test("onlyFirstIsException", profile(), new Error(), new Error());
     }
 
     @Test
     public void test4() {
         Throwable throwable = new Exception();
-        test("isThrowableInt",    profile(),                             throwable);
-        test("isThrowableInt",    profile(Throwable.class),              throwable);
-        test("isThrowableInt",    profile(Exception.class, Error.class), throwable);
+        test("isThrowableInt", profile(), throwable);
+        test("isThrowableInt", profile(Throwable.class), throwable);
+        test("isThrowableInt", profile(Exception.class, Error.class), throwable);
 
-        test("isThrowableInt",    profile(),                             Object.class);
-        test("isThrowableInt",    profile(Throwable.class),              Object.class);
-        test("isThrowableInt",    profile(Exception.class, Error.class), Object.class);
+        test("isThrowableInt", profile(), Object.class);
+        test("isThrowableInt", profile(Throwable.class), Object.class);
+        test("isThrowableInt", profile(Exception.class, Error.class), Object.class);
     }
 
     @Test
     public void test5() {
         Map map = new HashMap<>();
-        test("isMap",    profile(),                             map);
-        test("isMap",    profile(HashMap.class),                map);
-        test("isMap",    profile(TreeMap.class, HashMap.class), map);
+        test("isMap", profile(), map);
+        test("isMap", profile(HashMap.class), map);
+        test("isMap", profile(TreeMap.class, HashMap.class), map);
 
-        test("isMap",    profile(),                             Object.class);
-        test("isMap",    profile(HashMap.class),                Object.class);
-        test("isMap",    profile(TreeMap.class, HashMap.class), Object.class);
+        test("isMap", profile(), Object.class);
+        test("isMap", profile(HashMap.class), Object.class);
+        test("isMap", profile(TreeMap.class, HashMap.class), Object.class);
     }
 
     @Test
     public void test6() {
         Map map = new HashMap<>();
-        test("isMapInt",    profile(),                             map);
-        test("isMapInt",    profile(HashMap.class),                map);
-        test("isMapInt",    profile(TreeMap.class, HashMap.class), map);
+        test("isMapInt", profile(), map);
+        test("isMapInt", profile(HashMap.class), map);
+        test("isMapInt", profile(TreeMap.class, HashMap.class), map);
 
-        test("isMapInt",    profile(),                             Object.class);
-        test("isMapInt",    profile(HashMap.class),                Object.class);
-        test("isMapInt",    profile(TreeMap.class, HashMap.class), Object.class);
+        test("isMapInt", profile(), Object.class);
+        test("isMapInt", profile(HashMap.class), Object.class);
+        test("isMapInt", profile(TreeMap.class, HashMap.class), Object.class);
     }
 
     @Test
     public void test7() {
         Object o = new Depth13();
-        test("isDepth12",   profile(), o);
-        test("isDepth12",   profile(Depth13.class), o);
-        test("isDepth12",   profile(Depth13.class, Depth14.class), o);
+        test("isDepth12", profile(), o);
+        test("isDepth12", profile(Depth13.class), o);
+        test("isDepth12", profile(Depth13.class, Depth14.class), o);
 
         o = "not a depth";
-        test("isDepth12",   profile(), o);
-        test("isDepth12",   profile(Depth13.class), o);
-        test("isDepth12",   profile(Depth13.class, Depth14.class), o);
+        test("isDepth12", profile(), o);
+        test("isDepth12", profile(Depth13.class), o);
+        test("isDepth12", profile(Depth13.class, Depth14.class), o);
     }
 
     @Test
     public void test8() {
         Object o = new Depth13();
-        test("isDepth12Int",   profile(), o);
-        test("isDepth12Int",   profile(Depth13.class), o);
-        test("isDepth12Int",   profile(Depth13.class, Depth14.class), o);
+        test("isDepth12Int", profile(), o);
+        test("isDepth12Int", profile(Depth13.class), o);
+        test("isDepth12Int", profile(Depth13.class, Depth14.class), o);
 
         o = "not a depth";
-        test("isDepth12Int",   profile(), o);
-        test("isDepth12Int",   profile(Depth13.class), o);
-        test("isDepth12Int",   profile(Depth13.class, Depth14.class), o);
+        test("isDepth12Int", profile(), o);
+        test("isDepth12Int", profile(Depth13.class), o);
+        test("isDepth12Int", profile(Depth13.class, Depth14.class), o);
     }
 
     public static boolean isString(Object o) {
@@ -232,25 +231,30 @@
     }
 
     abstract static class MySite {
+
         final int offset;
+
         MySite(int offset) {
             this.offset = offset;
         }
     }
 
     static class MyMark extends MySite {
+
         MyMark(int offset) {
             super(offset);
         }
     }
 
     abstract static class MySafepoint extends MySite {
+
         MySafepoint(int offset) {
             super(offset);
         }
     }
 
     static class MyCall extends MySafepoint {
+
         MyCall(int offset) {
             super(offset);
         }
@@ -260,10 +264,10 @@
     public void test9() {
         MyCall callAt63 = new MyCall(63);
         MyMark markAt63 = new MyMark(63);
-        test("compareMySites",  callAt63, callAt63);
-        test("compareMySites",  callAt63, markAt63);
-        test("compareMySites",  markAt63, callAt63);
-        test("compareMySites",  markAt63, markAt63);
+        test("compareMySites", callAt63, callAt63);
+        test("compareMySites", callAt63, markAt63);
+        test("compareMySites", markAt63, callAt63);
+        test("compareMySites", markAt63, markAt63);
     }
 
     public static int compareMySites(MySite s1, MySite s2) {
@@ -278,10 +282,10 @@
         Mark[] noMarks = {};
         Call callAt63 = new Call("ignore", 63, 5, true, null);
         Mark markAt63 = new Mark(63, "1", noMarks);
-        test("compareSites",  callAt63, callAt63);
-        test("compareSites",  callAt63, markAt63);
-        test("compareSites",  markAt63, callAt63);
-        test("compareSites",  markAt63, markAt63);
+        test("compareSites", callAt63, callAt63);
+        test("compareSites", callAt63, markAt63);
+        test("compareSites", markAt63, callAt63);
+        test("compareSites", markAt63, markAt63);
     }
 
     public static int compareSites(Site s1, Site s2) {
@@ -295,15 +299,15 @@
      * This test exists to show the kind of pattern that is be optimizable by
      * {@code removeIntermediateMaterialization()} in {@link IfNode}.
      * <p>
-     * 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}.
+     * 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
     public void test_removeIntermediateMaterialization() {
         List<String> list = Arrays.asList("1", "2", "3", "4");
-        test("removeIntermediateMaterialization",    profile(),                        list, "2", "yes", "no");
-        test("removeIntermediateMaterialization",    profile(),                        list, null, "yes", "no");
-        test("removeIntermediateMaterialization",    profile(),                        null, "2", "yes", "no");
+        test("removeIntermediateMaterialization", profile(), list, "2", "yes", "no");
+        test("removeIntermediateMaterialization", profile(), list, null, "yes", "no");
+        test("removeIntermediateMaterialization", profile(), null, "2", "yes", "no");
     }
 
     public static String removeIntermediateMaterialization(List<Object> list, Object e, String a, String b) {
@@ -325,10 +329,17 @@
         return b;
     }
 
-    abstract static class A {}
-    static class B extends A {}
-    static class C extends B {}
-    abstract static class D extends C {}
+    abstract static class A {
+    }
+
+    static class B extends A {
+    }
+
+    static class C extends B {
+    }
+
+    abstract static class D extends C {
+    }
 
     public static boolean isArrayOfA(Object o) {
         return o instanceof A[];
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/IntrinsificationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/IntrinsificationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,11 +41,12 @@
 import com.oracle.graal.snippets.nodes.*;
 
 /**
- * Tests if compiler intrinsics are inlined correctly. Most test cases only assert that there are no remaining
- * invocations in the graph. This is sufficient if the method that is being intrinsified is a native method.
- * For Java methods, additional checks are necessary.
+ * Tests if compiler intrinsics are inlined correctly. Most test cases only assert that there are no
+ * remaining invocations in the graph. This is sufficient if the method that is being intrinsified
+ * is a native method. For Java methods, additional checks are necessary.
  */
 public class IntrinsificationTest extends GraalCompilerTest {
+
     @Test
     public void testObjectIntrinsics() {
         test("getClassSnippet");
@@ -56,12 +57,12 @@
     public static boolean getClassSnippet(Object obj, Class<?> clazz) {
         return obj.getClass() == clazz;
     }
+
     @SuppressWarnings("all")
     public static int objectHashCodeSnippet(TestClassA obj) {
         return obj.hashCode();
     }
 
-
     @Test
     public void testClassIntrinsics() {
         test("getModifiersSnippet");
@@ -77,32 +78,37 @@
     public static int getModifiersSnippet(Class<?> clazz) {
         return clazz.getModifiers();
     }
+
     @SuppressWarnings("all")
     public static boolean isInstanceSnippet(Class<?> clazz) {
         return clazz.isInstance(Number.class);
     }
+
     @SuppressWarnings("all")
     public static boolean isInterfaceSnippet(Class<?> clazz) {
         return clazz.isInterface();
     }
+
     @SuppressWarnings("all")
     public static boolean isArraySnippet(Class<?> clazz) {
         return clazz.isArray();
     }
+
     @SuppressWarnings("all")
     public static boolean isPrimitiveSnippet(Class<?> clazz) {
         return clazz.isPrimitive();
     }
+
     @SuppressWarnings("all")
     public static Class<?> getSuperClassSnippet(Class<?> clazz) {
         return clazz.getSuperclass();
     }
+
     @SuppressWarnings("all")
     public static Class<?> getComponentTypeSnippet(Class<?> clazz) {
         return clazz.getComponentType();
     }
 
-
     @Test
     public void testThreadIntrinsics() {
         test("currentThreadSnippet");
@@ -114,16 +120,17 @@
     public static Thread currentThreadSnippet() {
         return Thread.currentThread();
     }
+
     @SuppressWarnings("all")
     public static boolean threadIsInterruptedSnippet(Thread thread) {
         return thread.isInterrupted();
     }
+
     @SuppressWarnings("all")
     public static boolean threadInterruptedSnippet() {
         return Thread.interrupted();
     }
 
-
     @Test
     public void testSystemIntrinsics() {
         test("systemTimeSnippet");
@@ -132,15 +139,14 @@
 
     @SuppressWarnings("all")
     public static long systemTimeSnippet() {
-        return System.currentTimeMillis() +
-               System.nanoTime();
+        return System.currentTimeMillis() + System.nanoTime();
     }
+
     @SuppressWarnings("all")
     public static int systemIdentityHashCode(Object obj) {
         return System.identityHashCode(obj);
     }
 
-
     @Test
     public void testUnsafeIntrinsics() {
         test("unsafeCompareAndSwapIntSnippet");
@@ -173,117 +179,125 @@
     public static boolean unsafeCompareAndSwapIntSnippet(Unsafe unsafe, Object obj, long offset) {
         return unsafe.compareAndSwapInt(obj, offset, 0, 1);
     }
+
     @SuppressWarnings("all")
     public static boolean unsafeCompareAndSwapLongSnippet(Unsafe unsafe, Object obj, long offset) {
         return unsafe.compareAndSwapLong(obj, offset, 0, 1);
     }
+
     @SuppressWarnings("all")
     public static boolean unsafeCompareAndSwapObjectSnippet(Unsafe unsafe, Object obj, long offset) {
         return unsafe.compareAndSwapObject(obj, offset, null, new Object());
     }
+
     @SuppressWarnings("all")
     public static boolean unsafeGetBooleanSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getBoolean(obj, offset) &&
-               unsafe.getBooleanVolatile(obj, offset);
+        return unsafe.getBoolean(obj, offset) && unsafe.getBooleanVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static int unsafeGetByteSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getByte(obj, offset) +
-               unsafe.getByteVolatile(obj, offset);
+        return unsafe.getByte(obj, offset) + unsafe.getByteVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static int unsafeGetShortSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getShort(obj, offset) +
-               unsafe.getShortVolatile(obj, offset);
+        return unsafe.getShort(obj, offset) + unsafe.getShortVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static int unsafeGetCharSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getChar(obj, offset) +
-               unsafe.getCharVolatile(obj, offset);
+        return unsafe.getChar(obj, offset) + unsafe.getCharVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static int unsafeGetIntSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getInt(obj, offset) +
-               unsafe.getIntVolatile(obj, offset);
+        return unsafe.getInt(obj, offset) + unsafe.getIntVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static long unsafeGetLongSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getLong(obj, offset) +
-               unsafe.getLongVolatile(obj, offset);
+        return unsafe.getLong(obj, offset) + unsafe.getLongVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static float unsafeGetFloatSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getFloat(obj, offset) +
-               unsafe.getFloatVolatile(obj, offset);
+        return unsafe.getFloat(obj, offset) + unsafe.getFloatVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static double unsafeGetDoubleSnippet(Unsafe unsafe, Object obj, long offset) {
-        return unsafe.getDouble(obj, offset) +
-               unsafe.getDoubleVolatile(obj, offset);
+        return unsafe.getDouble(obj, offset) + unsafe.getDoubleVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static boolean unsafeGetObjectSnippet(Unsafe unsafe, Object obj, long offset) {
         return unsafe.getObject(obj, offset) == unsafe.getObjectVolatile(obj, offset);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutBooleanSnippet(Unsafe unsafe, Object obj, long offset, boolean value) {
         unsafe.putBoolean(obj, offset, value);
         unsafe.putBooleanVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutByteSnippet(Unsafe unsafe, Object obj, long offset, byte value) {
         unsafe.putByte(obj, offset, value);
         unsafe.putByteVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutShortSnippet(Unsafe unsafe, Object obj, long offset, short value) {
         unsafe.putShort(obj, offset, value);
         unsafe.putShortVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutCharSnippet(Unsafe unsafe, Object obj, long offset, char value) {
         unsafe.putChar(obj, offset, value);
         unsafe.putCharVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutIntSnippet(Unsafe unsafe, Object obj, long offset, int value) {
         unsafe.putInt(obj, offset, value);
         unsafe.putIntVolatile(obj, offset, value);
         unsafe.putOrderedInt(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutLongSnippet(Unsafe unsafe, Object obj, long offset, long value) {
         unsafe.putLong(obj, offset, value);
         unsafe.putLongVolatile(obj, offset, value);
         unsafe.putOrderedLong(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutFloatSnippet(Unsafe unsafe, Object obj, long offset, float value) {
         unsafe.putFloat(obj, offset, value);
         unsafe.putFloatVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutDoubleSnippet(Unsafe unsafe, Object obj, long offset, double value) {
         unsafe.putDouble(obj, offset, value);
         unsafe.putDoubleVolatile(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static void unsafePutObjectSnippet(Unsafe unsafe, Object obj, long offset, Object value) {
         unsafe.putObject(obj, offset, value);
         unsafe.putObjectVolatile(obj, offset, value);
         unsafe.putOrderedObject(obj, offset, value);
     }
+
     @SuppressWarnings("all")
     public static double unsafeDirectMemoryReadSnippet(Unsafe unsafe, long address) {
         // Unsafe.getBoolean(long) and Unsafe.getObject(long) do not exist
-        return unsafe.getByte(address) +
-               unsafe.getShort(address) +
-               unsafe.getChar(address) +
-               unsafe.getInt(address) +
-               unsafe.getLong(address) +
-               unsafe.getFloat(address) +
-               unsafe.getDouble(address);
+        return unsafe.getByte(address) + unsafe.getShort(address) + unsafe.getChar(address) + unsafe.getInt(address) + unsafe.getLong(address) + unsafe.getFloat(address) + unsafe.getDouble(address);
     }
+
     @SuppressWarnings("all")
     public static void unsafeDirectMemoryWriteSnippet(Unsafe unsafe, long address, byte value) {
         // Unsafe.putBoolean(long) and Unsafe.putObject(long) do not exist
@@ -296,7 +310,6 @@
         unsafe.putDouble(address, value);
     }
 
-
     @Test
     public void testMathIntrinsics() {
         assertInGraph(assertNotInGraph(test("mathAbsSnippet"), IfNode.class), MathIntrinsicNode.class);     // Java
@@ -307,19 +320,14 @@
     public static double mathAbsSnippet(double value) {
         return Math.abs(value);
     }
+
     @SuppressWarnings("all")
     public static double mathSnippet(double value) {
-        return Math.sqrt(value) +
-               Math.log(value) +
-               Math.log10(value) +
-               Math.sin(value) +
-               Math.cos(value) +
-               Math.tan(value);
-//               Math.exp(value) +
-//               Math.pow(value, 13);
+        return Math.sqrt(value) + Math.log(value) + Math.log10(value) + Math.sin(value) + Math.cos(value) + Math.tan(value);
+        // Math.exp(value) +
+        // Math.pow(value, 13);
     }
 
-
     @Test
     public void testIntegerIntrinsics() {
         assertInGraph(test("integerReverseBytesSnippet"), ReverseBytesNode.class);              // Java
@@ -332,20 +340,22 @@
     public static int integerReverseBytesSnippet(int value) {
         return Integer.reverseBytes(value);
     }
+
     @SuppressWarnings("all")
     public static int integerNumberOfLeadingZerosSnippet(int value) {
         return Integer.numberOfLeadingZeros(value);
     }
+
     @SuppressWarnings("all")
     public static int integerNumberOfTrailingZerosSnippet(int value) {
         return Integer.numberOfTrailingZeros(value);
     }
+
     @SuppressWarnings("all")
     public static int integerBitCountSnippet(int value) {
         return Integer.bitCount(value);
     }
 
-
     @Test
     public void testLongIntrinsics() {
         assertInGraph(test("longReverseBytesSnippet"), ReverseBytesNode.class);              // Java
@@ -358,20 +368,22 @@
     public static long longReverseBytesSnippet(long value) {
         return Long.reverseBytes(value);
     }
+
     @SuppressWarnings("all")
     public static long longNumberOfLeadingZerosSnippet(long value) {
         return Long.numberOfLeadingZeros(value);
     }
+
     @SuppressWarnings("all")
     public static long longNumberOfTrailingZerosSnippet(long value) {
         return Long.numberOfTrailingZeros(value);
     }
+
     @SuppressWarnings("all")
     public static int longBitCountSnippet(long value) {
         return Long.bitCount(value);
     }
 
-
     @Test
     public void testFloatIntrinsics() {
         assertInGraph(test("floatToIntBitsSnippet"), ConvertNode.class); // Java
@@ -382,12 +394,12 @@
     public static int floatToIntBitsSnippet(float value) {
         return Float.floatToIntBits(value);
     }
+
     @SuppressWarnings("all")
     public static float intBitsToFloatSnippet(int value) {
         return Float.intBitsToFloat(value);
     }
 
-
     @Test
     public void testDoubleIntrinsics() {
         assertInGraph(test("doubleToLongBitsSnippet"), ConvertNode.class); // Java
@@ -398,14 +410,15 @@
     public static long doubleToLongBitsSnippet(double value) {
         return Double.doubleToLongBits(value);
     }
+
     @SuppressWarnings("all")
     public static double longBitsToDoubleSnippet(long value) {
         return Double.longBitsToDouble(value);
     }
 
-
     private StructuredGraph test(final String snippet) {
         return Debug.scope("IntrinsificationTest", runtime.lookupJavaMethod(getMethod(snippet)), new Callable<StructuredGraph>() {
+
             @Override
             public StructuredGraph call() {
                 StructuredGraph graph = parse(snippet);
@@ -425,7 +438,7 @@
     }
 
     private static StructuredGraph assertNotInGraph(StructuredGraph graph, Class<?> clazz) {
-        for (Node node: graph.getNodes()) {
+        for (Node node : graph.getNodes()) {
             if (clazz.isInstance(node)) {
                 fail(node.toString());
             }
@@ -434,7 +447,7 @@
     }
 
     private static StructuredGraph assertInGraph(StructuredGraph graph, Class<?> clazz) {
-        for (Node node: graph.getNodes()) {
+        for (Node node : graph.getNodes()) {
             if (clazz.isInstance(node)) {
                 return graph;
             }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InvokeTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/InvokeTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,11 +41,14 @@
     }
 
     public interface I {
+
         String virtualMethod(String s);
     }
 
     public static class A implements I {
+
         final String name = "A";
+
         public String virtualMethod(String s) {
             return name + s;
         }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -161,11 +161,13 @@
     }
 
     static class Chars {
+
         final char[] data;
 
         public Chars(int size) {
             this.data = new char[size];
         }
+
         public Chars(char[] data) {
             this.data = data;
         }
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewArrayTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -59,7 +59,7 @@
 
     @Test
     public void test1() {
-        for (String type : new String[] {"Byte", "Char", "Short", "Int", "Float", "Long", "Double", "String"}) {
+        for (String type : new String[]{"Byte", "Char", "Short", "Int", "Float", "Long", "Double", "String"}) {
             test("new" + type + "Array7");
             test("new" + type + "ArrayMinus7");
             test("new" + type + "Array", 7);
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewInstanceTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -139,10 +139,10 @@
     }
 
     static class SomeObject {
+
         String name = "o1";
         HashMap<String, Object> map = new HashMap<>();
 
-
         public SomeObject() {
             map.put(name, this.getClass());
         }
@@ -163,6 +163,7 @@
     }
 
     static class BigObject {
+
         Object f01;
         Object f02;
         Object f03;
@@ -210,12 +211,12 @@
     }
 
     /**
-     * Tests that an earlier bug does not occur. The issue was that the loading of the TLAB
-     * 'top' and 'end' values was being GVN'ed from each branch of the 'if' statement.
-     * This meant that the allocated B object in the true branch overwrote the allocated
-     * array. The cause is that RegisterNode was a floating node and the reads from it
-     * were UnsafeLoads which are also floating. The fix was to make RegisterNode a fixed
-     * node (which it should have been in the first place).
+     * Tests that an earlier bug does not occur. The issue was that the loading of the TLAB 'top'
+     * and 'end' values was being GVN'ed from each branch of the 'if' statement. This meant that the
+     * allocated B object in the true branch overwrote the allocated array. The cause is that
+     * RegisterNode was a floating node and the reads from it were UnsafeLoads which are also
+     * floating. The fix was to make RegisterNode a fixed node (which it should have been in the
+     * first place).
      */
     public static Object newRegression(boolean condition) {
         Object result;
@@ -237,6 +238,7 @@
     }
 
     static class B {
+
         long f1 = 0xdeadbeefdeadbe01L;
         long f2 = 0xdeadbeefdeadbe02L;
         long f3 = 0xdeadbeefdeadbe03L;
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/NewMultiArrayTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -89,11 +89,11 @@
 
     @Test
     public void test1() {
-        for (Class clazz : new Class[] {byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) {
+        for (Class clazz : new Class[]{byte.class, char.class, short.class, int.class, float.class, long.class, double.class, String.class}) {
             bottomClass = clazz;
             bottomType = runtime.lookupJavaType(clazz);
             arrayType = bottomType;
-            for (int rank : new int[] {1, 2, 10, 50, 100, 200, 254, 255}) {
+            for (int rank : new int[]{1, 2, 10, 50, 100, 200, 254, 255}) {
                 while (rank(arrayType) != rank) {
                     arrayType = arrayType.getArrayClass();
                 }
@@ -113,7 +113,8 @@
     public static Object newMultiArray() {
         // This is merely a template - the NewMultiArrayNode is replaced in getCode() above.
         // This also means we need a separate test for correct handling of negative dimensions
-        // as deoptimization won't do what we want for a graph modified to be different from the source bytecode.
+        // as deoptimization won't do what we want for a graph modified to be different from the
+        // source bytecode.
         return new Object[10][9][8];
     }
 
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -106,10 +106,10 @@
 
     @Test
     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};
+        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) {
             for (long word2 : words) {
-                for (String method : new String[] {"aboveOrEqual", "above", "belowOrEqual", "below"}) {
+                for (String method : new String[]{"aboveOrEqual", "above", "belowOrEqual", "below"}) {
                     test(method, word1, word2);
                     test(method, word2, word1);
                 }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/ClassSubstitution.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,10 +25,12 @@
 import java.lang.annotation.*;
 
 import com.oracle.graal.api.meta.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.snippets.nodes.*;
 
 /**
- * Denotes a class that substitutes methods of another specified class.
- * The substitute methods are exactly those annotated by {@link MethodSubstitution}.
+ * Denotes a class that substitutes methods of another specified class. The substitute methods are
+ * exactly those annotated by {@link MethodSubstitution}.
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.TYPE)
@@ -37,34 +39,35 @@
     /**
      * Specifies the original class.
      * <p>
-     * If the default value is specified for this element, then a non-default
-     * value must be given for the {@link #className()} element.
-      */
+     * If the default value is specified for this element, then a non-default value must be given
+     * for the {@link #className()} element.
+     */
     Class<?> value() default ClassSubstitution.class;
 
     /**
      * Specifies the original class.
      * <p>
-     * This method is provided for cases where the original class
-     * is not accessible (according to Java language access control rules).
+     * This method is provided for cases where the original class is not accessible (according to
+     * Java language access control rules).
      * <p>
-     * If the default value is specified for this element, then a non-default
-     * value must be given for the {@link #value()} element.
+     * If the default value is specified for this element, then a non-default value must be given
+     * for the {@link #value()} element.
      */
     String className() default "";
 
     /**
-     * Denotes a substitute method. A substitute method can call the original/substituted
-     * method by making a recursive call to itself.
+     * Denotes a substitute method. A substitute method can call the original/substituted method by
+     * making a recursive call to itself.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.METHOD)
     public @interface MethodSubstitution {
+
         /**
          * Gets the name of the original method.
          * <p>
-         * If the default value is specified for this element, then the
-         * name of the original method is same as the substitute method.
+         * If the default value is specified for this element, then the name of the original method
+         * is same as the substitute method.
          */
         String value() default "";
 
@@ -76,9 +79,51 @@
         /**
          * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the original method.
          * <p>
-         * If the default value is specified for this element, then the
-         * signature of the original method is the same as the substitute method.
+         * If the default value is specified for this element, then the signature of the original
+         * method is the same as the substitute method.
          */
         String signature() default "";
     }
+
+    /**
+     * Denotes a macro substitute method. This replaces a method invocation with an instance of the
+     * specified node class.
+     * 
+     * A macro substitution can be combined with a normal substitution, so that the macro node can
+     * be replaced with the actual substitution code during lowering.
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.METHOD)
+    public @interface MacroSubstitution {
+
+        /**
+         * Gets the name of the substituted method.
+         * <p>
+         * If the default value is specified for this element, then the name of the substituted
+         * method is same as the substitute method.
+         */
+        String value() default "";
+
+        /**
+         * Determines if the substituted method is static.
+         */
+        boolean isStatic() default true;
+
+        /**
+         * Gets the {@linkplain Signature#getMethodDescriptor() signature} of the substituted
+         * method.
+         * <p>
+         * If the default value is specified for this element, then the signature of the substituted
+         * method is the same as the substitute method.
+         */
+        String signature() default "";
+
+        /**
+         * The node class with which the method invocation should be replaced. It needs to be a
+         * subclass of {@link FixedWithNextNode}, and it is expected to provide a public constructor
+         * that takes an InvokeNode as a parameter. For most cases this class should subclass
+         * {@link MacroNode} and use its constructor.
+         */
+        Class<? extends FixedWithNextNode> macro();
+    }
 }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/GraalIntrinsics.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
  * Definition of the snippets that are VM-independent and can be intrinsified by Graal in any VM.
  */
 public class GraalIntrinsics {
+
     public static void installIntrinsics(SnippetInstaller installer) {
         if (GraalOptions.Intrinsify) {
             installer.installSubstitutions(MathSubstitutionsX86.class);
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/InstanceOfSnippetsTemplates.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/InstanceOfSnippetsTemplates.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,19 +39,18 @@
 import com.oracle.graal.snippets.SnippetTemplate.Key;
 import com.oracle.graal.snippets.SnippetTemplate.UsageReplacer;
 
-
 /**
- * Helper class for lowering {@link InstanceOfNode}s with snippets. The majority of the
- * complexity in such a lowering derives from the fact that {@link InstanceOfNode}
- * is a floating node. A snippet used to lower an {@link InstanceOfNode} will almost always
- * incorporate control flow and replacing a floating node with control flow is not trivial.
+ * Helper class for lowering {@link InstanceOfNode}s with snippets. The majority of the complexity
+ * in such a lowering derives from the fact that {@link InstanceOfNode} is a floating node. A
+ * snippet used to lower an {@link InstanceOfNode} will almost always incorporate control flow and
+ * replacing a floating node with control flow is not trivial.
  * <p>
- * The mechanism implemented in this class ensures that the graph for an instanceof snippet
- * is instantiated once per {@link InstanceOfNode} being lowered. The result produced the graph
- * is then re-used by all usages of the node. Additionally, if there is a single usage that
- * is an {@link IfNode}, the control flow in the snippet is connected directly to the true
- * and false successors of the {@link IfNode}. This avoids materializating the instanceof
- * test as a boolean which is then retested by the {@link IfNode}.
+ * The mechanism implemented in this class ensures that the graph for an instanceof snippet is
+ * instantiated once per {@link InstanceOfNode} being lowered. The result produced the graph is then
+ * re-used by all usages of the node. Additionally, if there is a single usage that is an
+ * {@link IfNode}, the control flow in the snippet is connected directly to the true and false
+ * successors of the {@link IfNode}. This avoids materializating the instanceof test as a boolean
+ * which is then retested by the {@link IfNode}.
  */
 public abstract class InstanceOfSnippetsTemplates<T extends SnippetsInterface> extends AbstractTemplates<T> {
 
@@ -63,8 +62,10 @@
      * The key and arguments used to retrieve and instantiate an instanceof snippet template.
      */
     public static class KeyAndArguments {
+
         public final Key key;
         public final Arguments arguments;
+
         public KeyAndArguments(Key key, Arguments arguments) {
             this.key = key;
             this.arguments = arguments;
@@ -105,8 +106,8 @@
     }
 
     /**
-     * Gets the specific replacer object used to replace the usage of an instanceof node
-     * with the result of an instantiated instanceof snippet.
+     * Gets the specific replacer object used to replace the usage of an instanceof node with the
+     * result of an instantiated instanceof snippet.
      */
     protected InstanceOfUsageReplacer createReplacer(FloatingNode instanceOf, LoweringTool tool, int nUsages, Instantiation instantiation, Node usage, final StructuredGraph graph) {
         InstanceOfUsageReplacer replacer;
@@ -121,10 +122,11 @@
     }
 
     /**
-     * The result of an instantiating an instanceof snippet.
-     * This enables a snippet instantiation to be re-used which reduces compile time and produces better code.
+     * The result of an instantiating an instanceof snippet. This enables a snippet instantiation to
+     * be re-used which reduces compile time and produces better code.
      */
     public static final class Instantiation {
+
         private PhiNode result;
         private CompareNode condition;
         private ValueNode trueValue;
@@ -146,7 +148,7 @@
 
         /**
          * Gets the result of this instantiation as a condition.
-         *
+         * 
          * @param testValue the returned condition is true if the result is equal to this value
          */
         CompareNode asCondition(ValueNode testValue) {
@@ -160,7 +162,7 @@
 
         /**
          * Gets the result of the instantiation as a materialized value.
-         *
+         * 
          * @param t the true value for the materialization
          * @param f the false value for the materialization
          */
@@ -179,6 +181,7 @@
      * Replaces a usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}.
      */
     public abstract static class InstanceOfUsageReplacer implements UsageReplacer {
+
         public final Instantiation instantiation;
         public final FloatingNode instanceOf;
         public final ValueNode trueValue;
@@ -199,7 +202,8 @@
     }
 
     /**
-     * Replaces an {@link IfNode} usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}.
+     * Replaces an {@link IfNode} usage of an {@link InstanceOfNode} or
+     * {@link InstanceOfDynamicNode}.
      */
     public static class IfUsageReplacer extends InstanceOfUsageReplacer {
 
@@ -233,8 +237,8 @@
         }
 
         /**
-         * Directly wires the incoming edges of the merge at the end of the snippet to
-         * the outgoing edges of the IfNode that uses the materialized result.
+         * Directly wires the incoming edges of the merge at the end of the snippet to the outgoing
+         * edges of the IfNode that uses the materialized result.
          */
         private void removeIntermediateMaterialization(ValueNode newNode) {
             IfNode ifNode = usage;
@@ -276,7 +280,8 @@
 
         private static void connectEnds(MergeNode merge, List<EndNode> ends, BeginNode successor) {
             if (ends.size() == 0) {
-                // InstanceOf has been lowered to always true or always false - this successor is therefore unreachable.
+                // InstanceOf has been lowered to always true or always false - this successor is
+                // therefore unreachable.
                 GraphUtil.killCFG(successor);
             } else if (ends.size() == 1) {
                 EndNode end = ends.get(0);
@@ -296,7 +301,8 @@
     }
 
     /**
-     * Replaces a {@link ConditionalNode} usage of an {@link InstanceOfNode} or {@link InstanceOfDynamicNode}.
+     * Replaces a {@link ConditionalNode} usage of an {@link InstanceOfNode} or
+     * {@link InstanceOfDynamicNode}.
      */
     public static class ConditionalUsageReplacer extends InstanceOfUsageReplacer {
 
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/JavacBug.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/JavacBug.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,11 +23,14 @@
 package com.oracle.graal.snippets;
 
 /**
- * Used to indicate that an otherwise strange looking code pattern is required to work around a bug in javac.
+ * Used to indicate that an otherwise strange looking code pattern is required to work around a bug
+ * in javac.
  */
 public @interface JavacBug {
+
     /**
-     * A description of the bug. Only really useful if there is no existing entry for the bug in the <a href="http://bugs.sun.com/bugdatabase/">Bug Database</a>.
+     * A description of the bug. Only really useful if there is no existing entry for the bug in the
+     * <a href="http://bugs.sun.com/bugdatabase/">Bug Database</a>.
      */
     String value() default "";
 
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Log.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,8 @@
 //JaCoCo Exclude
 
 /**
- * Provides {@link PrintStream}-like logging facility. This should only be used in {@linkplain Snippet snippets}.
+ * Provides {@link PrintStream}-like logging facility. This should only be used in
+ * {@linkplain Snippet snippets}.
  */
 public final class Log {
 
@@ -43,7 +44,7 @@
 
     // Note: Must be kept in sync with constants in c1_Runtime1.hpp
     private static final int LOG_OBJECT_NEWLINE = 0x01;
-    private static final int LOG_OBJECT_STRING  = 0x02;
+    private static final int LOG_OBJECT_STRING = 0x02;
     private static final int LOG_OBJECT_ADDRESS = 0x04;
 
     @NodeIntrinsic(RuntimeCallNode.class)
@@ -81,17 +82,19 @@
 
     /**
      * Prints a formatted string to the log stream.
-     *
-     * @param format a C style printf format value that can contain at most one conversion specifier (i.e., a sequence
-     *            of characters starting with '%').
+     * 
+     * @param format a C style printf format value that can contain at most one conversion specifier
+     *            (i.e., a sequence of characters starting with '%').
      * @param value the value associated with the conversion specifier
      */
     public static void printf(String format, long value) {
         printf(LOG_PRINTF, format, value, 0L, 0L);
     }
+
     public static void printf(String format, long v1, long v2) {
         printf(LOG_PRINTF, format, v1, v2, 0L);
     }
+
     public static void printf(String format, long v1, long v2, long v3) {
         printf(LOG_PRINTF, format, v1, v2, v3);
     }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSubstitutionsX86.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/MathSubstitutionsX86.java	Fri Feb 01 17:06:26 2013 +0100
@@ -59,10 +59,10 @@
     }
 
     // NOTE on snippets below:
-    //   Math.sin(), .cos() and .tan() guarantee a value within 1 ULP of the
-    //   exact result, but x87 trigonometric FPU instructions are only that
-    //   accurate within [-pi/4, pi/4]. Examine the passed value and provide
-    //   a slow path for inputs outside of that interval.
+    // Math.sin(), .cos() and .tan() guarantee a value within 1 ULP of the
+    // exact result, but x87 trigonometric FPU instructions are only that
+    // accurate within [-pi/4, pi/4]. Examine the passed value and provide
+    // a slow path for inputs outside of that interval.
 
     @MethodSubstitution
     public static double sin(double x) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/NodeClassSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,11 +28,11 @@
 import com.oracle.graal.snippets.ClassSubstitution.*;
 
 /**
- * Substitutions for improving the performance of some critical methods in {@link NodeClass} methods.
- * These substitutions improve the performance by forcing the relevant methods to be inlined
- * (intrinsification being a special form of inlining) and removing a checked cast.
- * The latter cannot be done directly in Java code as {@link UnsafeCastNode}
- * is not available to the project containing {@link NodeClass}.
+ * Substitutions for improving the performance of some critical methods in {@link NodeClass}
+ * methods. These substitutions improve the performance by forcing the relevant methods to be
+ * inlined (intrinsification being a special form of inlining) and removing a checked cast. The
+ * latter cannot be done directly in Java code as {@link UnsafeCastNode} is not available to the
+ * project containing {@link NodeClass}.
  */
 @ClassSubstitution(NodeClass.class)
 public class NodeClassSubstitutions {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Snippet.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,8 @@
  * A snippet is a Graal graph expressed as a Java source method. Graal snippets can be used for:
  * <ul>
  * <li>intrinsifying native JDK methods (see {@link ClassSubstitution})</li>
- * <li>lowering operations that have runtime dependent semantics (e.g. the {@code CHECKCAST} bytecode) </li>
+ * <li>lowering operations that have runtime dependent semantics (e.g. the {@code CHECKCAST}
+ * bytecode)</li>
  * <li>replacing a method call with a single graph node (see {@link NodeIntrinsic})</li>
  * </ul>
  */
@@ -45,8 +46,8 @@
 public @interface Snippet {
 
     /**
-     * Specifies the class defining the inlining policy for this snippet.
-     * A {@linkplain DefaultSnippetInliningPolicy default} policy is used if none is supplied.
+     * Specifies the class defining the inlining policy for this snippet. A
+     * {@linkplain DefaultSnippetInliningPolicy default} policy is used if none is supplied.
      */
     Class<? extends SnippetInliningPolicy> inlining() default SnippetInliningPolicy.class;
 
@@ -54,6 +55,7 @@
      * Guides inlining decisions used when installing a snippet.
      */
     public interface SnippetInliningPolicy {
+
         /**
          * Determines if {@code method} should be inlined into {@code caller}.
          */
@@ -61,8 +63,8 @@
     }
 
     /**
-     * The default inlining policy which inlines everything except for methods
-     * in any of the following categories.
+     * The default inlining policy which inlines everything except for methods in any of the
+     * following categories.
      * <ul>
      * <li>{@linkplain Fold foldable} methods</li>
      * <li>{@linkplain NodeIntrinsic node intrinsics}</li>
@@ -71,6 +73,7 @@
      * </ul>
      */
     public static class DefaultSnippetInliningPolicy implements SnippetInliningPolicy {
+
         private final MetaAccessProvider metaAccess;
         private final BoxingMethodPool pool;
 
@@ -106,12 +109,11 @@
     }
 
     /**
-     * Annotates a method replaced by a compile-time constant.
-     * A (resolved) call to the annotated method is replaced
-     * with a constant obtained by calling the annotated method via reflection.
-     *
-     * All arguments to such a method (including the receiver if applicable)
-     * must be compile-time constants.
+     * Annotates a method replaced by a compile-time constant. A (resolved) call to the annotated
+     * method is replaced with a constant obtained by calling the annotated method via reflection.
+     * 
+     * All arguments to such a method (including the receiver if applicable) must be compile-time
+     * constants.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.METHOD)
@@ -119,12 +121,13 @@
     }
 
     /**
-     * Denotes a snippet parameter that will be bound during snippet
-     * template {@linkplain SnippetTemplate#instantiate instantiation}.
+     * Denotes a snippet parameter that will be bound during snippet template
+     * {@linkplain SnippetTemplate#instantiate instantiation}.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.PARAMETER)
     public @interface Parameter {
+
         /**
          * The name of this parameter.
          */
@@ -132,18 +135,20 @@
     }
 
     /**
-     * Denotes a snippet parameter representing 0 or more arguments that will be bound during snippet
-     * template {@linkplain SnippetTemplate#instantiate instantiation}. During snippet template creation,
-     * its value must be an array whose length specifies the number of arguments (the contents
-     * of the array are ignored) bound to the parameter during {@linkplain SnippetTemplate#instantiate instantiation}.
-     *
-     * Such a parameter must be used in a counted loop in the snippet preceded by a call
-     * to {@link ExplodeLoopNode#explodeLoop()}. The counted looped must be a
-     * standard iteration over all the loop's elements (i.e. {@code for (T e : arr) ... }).
+     * Denotes a snippet parameter representing 0 or more arguments that will be bound during
+     * snippet template {@linkplain SnippetTemplate#instantiate instantiation}. During snippet
+     * template creation, its value must be an array whose length specifies the number of arguments
+     * (the contents of the array are ignored) bound to the parameter during
+     * {@linkplain SnippetTemplate#instantiate instantiation}.
+     * 
+     * Such a parameter must be used in a counted loop in the snippet preceded by a call to
+     * {@link ExplodeLoopNode#explodeLoop()}. The counted looped must be a standard iteration over
+     * all the loop's elements (i.e. {@code for (T e : arr) ... }).
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.PARAMETER)
     public @interface VarargsParameter {
+
         /**
          * The name of this parameter.
          */
@@ -151,12 +156,13 @@
     }
 
     /**
-     * Denotes a snippet parameter that will bound to a constant value during
-     * snippet template {@linkplain SnippetTemplate#instantiate instantiation}.
+     * Denotes a snippet parameter that will bound to a constant value during snippet template
+     * {@linkplain SnippetTemplate#instantiate instantiation}.
      */
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.PARAMETER)
     public @interface ConstantParameter {
+
         /**
          * The name of this constant.
          */
@@ -167,6 +173,7 @@
      * Wrapper for the prototype value of a {@linkplain VarargsParameter varargs} parameter.
      */
     public static class Varargs {
+
         private final Object args;
         private final Class argType;
         private final int length;
@@ -189,8 +196,7 @@
         public boolean equals(Object obj) {
             if (obj instanceof Varargs) {
                 Varargs other = (Varargs) obj;
-                return other.argType == argType &&
-                        other.length == length;
+                return other.argType == argType && other.length == length;
             }
             return false;
         }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetCounter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetCounter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,8 +34,8 @@
 import com.oracle.graal.snippets.nodes.*;
 
 /**
- * A counter that can be safely {@linkplain #inc() incremented} from within a
- * snippet for gathering snippet specific metrics.
+ * A counter that can be safely {@linkplain #inc() incremented} from within a snippet for gathering
+ * snippet specific metrics.
  */
 public class SnippetCounter implements Comparable<SnippetCounter> {
 
@@ -43,6 +43,7 @@
      * A group of related counters.
      */
     public static class Group {
+
         final String name;
         final List<SnippetCounter> counters;
 
@@ -104,9 +105,9 @@
 
     /**
      * Creates a counter.
-     *
-     * @param group the group to which the counter belongs. If this is null, the newly created counter is disabled and
-     *            {@linkplain #inc() incrementing} is a no-op.
+     * 
+     * @param group the group to which the counter belongs. If this is null, the newly created
+     *            counter is disabled and {@linkplain #inc() incrementing} is a no-op.
      * @param name the name of the counter
      * @param description a brief comment describing the metric represented by the counter
      */
@@ -127,8 +128,8 @@
     }
 
     /**
-     * Increments the value of this counter. This method can be safely used in a snippet
-     * if it is invoked on a compile-time constant {@link SnippetCounter} object.
+     * Increments the value of this counter. This method can be safely used in a snippet if it is
+     * invoked on a compile-time constant {@link SnippetCounter} object.
      */
     public void inc() {
         if (group != null) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetFrameStateCleanupPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetFrameStateCleanupPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,8 @@
 import com.oracle.graal.phases.*;
 
 /**
- * Removes frame states from {@linkplain StateSplit#hasSideEffect() non-side-effecting} nodes in a snippet.
+ * Removes frame states from {@linkplain StateSplit#hasSideEffect() non-side-effecting} nodes in a
+ * snippet.
  */
 public class SnippetFrameStateCleanupPhase extends Phase {
 
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetInstaller.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,6 +41,7 @@
 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
+import com.oracle.graal.snippets.ClassSubstitution.MacroSubstitution;
 import com.oracle.graal.snippets.ClassSubstitution.MethodSubstitution;
 import com.oracle.graal.snippets.Snippet.DefaultSnippetInliningPolicy;
 import com.oracle.graal.snippets.Snippet.SnippetInliningPolicy;
@@ -59,10 +60,9 @@
     private final Thread owner;
 
     /**
-     * A graph cache used by this installer to avoid using the compiler
-     * storage for each method processed during snippet installation.
-     * Without this, all processed methods are to be determined as
-     * {@linkplain InliningUtil#canIntrinsify intrinsifiable}.
+     * A graph cache used by this installer to avoid using the compiler storage for each method
+     * processed during snippet installation. Without this, all processed methods are to be
+     * determined as {@linkplain InliningUtil#canIntrinsify intrinsifiable}.
      */
     private final Map<ResolvedJavaMethod, StructuredGraph> graphCache;
 
@@ -76,11 +76,11 @@
     }
 
     /**
-     * Finds all the snippet methods in a given class, builds a graph for them and
-     * installs the graph with the key value of {@code Graph.class} in the
+     * Finds all the snippet methods in a given class, builds a graph for them and installs the
+     * graph with the key value of {@code Graph.class} in the
      * {@linkplain ResolvedJavaMethod#getCompilerStorage() compiler storage} of each method.
      */
-    public void installSnippets(Class< ? extends SnippetsInterface> clazz) {
+    public void installSnippets(Class<? extends SnippetsInterface> clazz) {
         for (Method method : clazz.getDeclaredMethods()) {
             if (method.getAnnotation(Snippet.class) != null) {
                 int modifiers = method.getModifiers();
@@ -90,38 +90,50 @@
                 ResolvedJavaMethod snippet = runtime.lookupJavaMethod(method);
                 assert snippet.getCompilerStorage().get(Graph.class) == null : method;
                 StructuredGraph graph = makeGraph(snippet, inliningPolicy(snippet), false);
-                //System.out.println("snippet: " + graph);
+                // System.out.println("snippet: " + graph);
                 snippet.getCompilerStorage().put(Graph.class, graph);
             }
         }
     }
 
     /**
-     * Finds all the {@linkplain MethodSubstitution substitution} methods in a given class,
-     * builds a graph for them. If the original class is resolvable, then the
-     * graph is installed with the key value of {@code Graph.class} in the
-     * {@linkplain ResolvedJavaMethod#getCompilerStorage() compiler storage} of each original method.
+     * Finds all the {@linkplain MethodSubstitution substitution} methods in a given class, builds a
+     * graph for them. If the original class is resolvable, then the graph is installed with the key
+     * value of {@code Graph.class} in the {@linkplain ResolvedJavaMethod#getCompilerStorage()
+     * compiler storage} of each original method.
      */
     public void installSubstitutions(Class<?> substitutions) {
         assert owner == Thread.currentThread() : "substitution installation must be single threaded";
         ClassSubstitution classSubstitution = substitutions.getAnnotation(ClassSubstitution.class);
+        assert classSubstitution != null;
+        assert !SnippetsInterface.class.isAssignableFrom(substitutions);
         for (Method substituteMethod : substitutions.getDeclaredMethods()) {
             MethodSubstitution methodSubstitution = substituteMethod.getAnnotation(MethodSubstitution.class);
-            if (methodSubstitution == null) {
+            MacroSubstitution macroSubstitution = substituteMethod.getAnnotation(MacroSubstitution.class);
+            if (methodSubstitution == null && macroSubstitution == null) {
                 continue;
             }
 
             int modifiers = substituteMethod.getModifiers();
             if (!Modifier.isStatic(modifiers)) {
                 throw new RuntimeException("Substitution methods must be static: " + substituteMethod);
-            } else if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
-                throw new RuntimeException("Substitution method must not be abstract or native: " + substituteMethod);
             }
 
-            String originalName = originalName(substituteMethod, methodSubstitution);
-            Class[] originalParameters = originalParameters(substituteMethod, methodSubstitution);
-            Method originalMethod = originalMethod(classSubstitution, originalName, originalParameters);
-            installSubstitution(originalMethod, substituteMethod);
+            if (methodSubstitution != null) {
+                if (Modifier.isAbstract(modifiers) || Modifier.isNative(modifiers)) {
+                    throw new RuntimeException("Substitution method must not be abstract or native: " + substituteMethod);
+                }
+                String originalName = originalName(substituteMethod, methodSubstitution.value());
+                Class[] originalParameters = originalParameters(substituteMethod, methodSubstitution.signature(), methodSubstitution.isStatic());
+                Method 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);
+                installMacroSubstitution(originalMethod, macroSubstitution.macro());
+            }
         }
     }
 
@@ -132,15 +144,16 @@
 
     /**
      * Installs a method substitution.
-     *
+     * 
      * @param originalMethod a method being substituted
      * @param substituteMethod the substitute method
      */
-    protected void installSubstitution(Method originalMethod, Method substituteMethod) {
+    protected void installMethodSubstitution(Method originalMethod, Method substituteMethod) {
         substitute = runtime.lookupJavaMethod(substituteMethod);
         original = runtime.lookupJavaMethod(originalMethod);
         try {
-            //System.out.println("substitution: " + MetaUtil.format("%H.%n(%p)", original) + " --> " + MetaUtil.format("%H.%n(%p)", substitute));
+            // System.out.println("substitution: " + MetaUtil.format("%H.%n(%p)", original) +
+            // " --> " + MetaUtil.format("%H.%n(%p)", substitute));
             StructuredGraph graph = makeGraph(substitute, inliningPolicy(substitute), true);
             Object oldValue = original.getCompilerStorage().put(Graph.class, graph);
             assert oldValue == null;
@@ -151,6 +164,18 @@
         }
     }
 
+    /**
+     * Installs a macro substitution.
+     * 
+     * @param originalMethod a method being substituted
+     * @param macro the substitute macro node class
+     */
+    protected void installMacroSubstitution(Method originalMethod, Class<? extends FixedWithNextNode> macro) {
+        ResolvedJavaMethod originalJavaMethod = runtime.lookupJavaMethod(originalMethod);
+        Object oldValue = originalJavaMethod.getCompilerStorage().put(Node.class, macro);
+        assert oldValue == null;
+    }
+
     private SnippetInliningPolicy inliningPolicy(ResolvedJavaMethod method) {
         Class<? extends SnippetInliningPolicy> policyClass = SnippetInliningPolicy.class;
         Snippet snippet = method.getAnnotation(Snippet.class);
@@ -168,7 +193,8 @@
     }
 
     public StructuredGraph makeGraph(final ResolvedJavaMethod method, final SnippetInliningPolicy policy, final boolean isSubstitution) {
-        return Debug.scope("BuildSnippetGraph", new Object[] {method}, new Callable<StructuredGraph>() {
+        return Debug.scope("BuildSnippetGraph", new Object[]{method}, new Callable<StructuredGraph>() {
+
             @Override
             public StructuredGraph call() throws Exception {
                 StructuredGraph graph = parseGraph(method, policy);
@@ -195,7 +221,7 @@
         StructuredGraph graph = graphCache.get(method);
         if (graph == null) {
             graph = buildGraph(method, policy == null ? inliningPolicy(method) : policy);
-            //System.out.println("built " + graph);
+            // System.out.println("built " + graph);
             graphCache.put(method, graph);
         }
         return graph;
@@ -222,7 +248,8 @@
                 new GraphBuilderPhase(runtime, GraphBuilderConfiguration.getSnippetDefault(), OptimisticOptimizations.NONE).apply(originalGraph);
                 InliningUtil.inline(invoke, originalGraph, true);
 
-                // TODO the inlined frame states still show the call from the substitute to the original.
+                // TODO the inlined frame states still show the call from the substitute to the
+                // original.
                 // If this poses a problem, a phase should added to fix up these frame states.
 
                 Debug.dump(graph, "after inlining %s", callee);
@@ -263,12 +290,12 @@
         return graph;
     }
 
-    private static String originalName(Method substituteMethod, MethodSubstitution methodSubstitution) {
-        String name = substituteMethod.getName();
-        if (!methodSubstitution.value().isEmpty()) {
-            name = methodSubstitution.value();
+    private static String originalName(Method substituteMethod, String methodSubstitution) {
+        if (methodSubstitution.isEmpty()) {
+            return substituteMethod.getName();
+        } else {
+            return methodSubstitution;
         }
-        return name;
     }
 
     private static Class resolveType(String className) {
@@ -294,16 +321,16 @@
         return dimensions == 0 ? baseClass : Array.newInstance(baseClass, new int[dimensions]).getClass();
     }
 
-    private Class[] originalParameters(Method substituteMethod, MethodSubstitution methodSubstitution) {
+    private Class[] originalParameters(Method substituteMethod, String methodSubstitution, boolean isStatic) {
         Class[] parameters;
-        if (methodSubstitution.signature().isEmpty()) {
+        if (methodSubstitution.isEmpty()) {
             parameters = substituteMethod.getParameterTypes();
-            if (!methodSubstitution.isStatic()) {
+            if (!isStatic) {
                 assert parameters.length > 0 : "must be a static method with the 'this' object as its first parameter";
                 parameters = Arrays.copyOfRange(parameters, 1, parameters.length);
             }
         } else {
-            Signature signature = runtime.parseMethodDescriptor(methodSubstitution.signature());
+            Signature signature = runtime.parseMethodDescriptor(methodSubstitution);
             parameters = new Class[signature.getParameterCount(false)];
             for (int i = 0; i < parameters.length; i++) {
                 parameters[i] = resolveType(signature.getParameterType(i, null));
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetIntrinsificationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,8 @@
     private final boolean intrinsificationOrFoldingCanBeDeferred;
 
     /**
-     * @param intrinsificationOrFoldingCanBeDeferred if true, then {@link NonConstantParameterError}s are not fatal
+     * @param intrinsificationOrFoldingCanBeDeferred if true, then {@link NonConstantParameterError}
+     *            s are not fatal
      */
     public SnippetIntrinsificationPhase(MetaAccessProvider runtime, BoxingMethodPool pool, boolean intrinsificationOrFoldingCanBeDeferred) {
         this.runtime = runtime;
@@ -70,8 +71,8 @@
     }
 
     /**
-     * Exception raised when an argument to a {@linkplain Fold foldable} or
-     * {@link NodeIntrinsic} method is not a constant.
+     * Exception raised when an argument to a {@linkplain Fold foldable} or {@link NodeIntrinsic}
+     * method is not a constant.
      */
     @SuppressWarnings("serial")
     public static class NonConstantParameterError extends Error {
@@ -83,7 +84,7 @@
 
     public static Class<?>[] signatureToTypes(Signature signature, ResolvedJavaType accessingClass) {
         int count = signature.getParameterCount(false);
-        Class<?>[] result = new Class< ? >[count];
+        Class<?>[] result = new Class<?>[count];
         for (int i = 0; i < result.length; ++i) {
             result[i] = getMirrorOrFail(signature.getParameterType(i, accessingClass).resolve(accessingClass), Thread.currentThread().getContextClassLoader());
         }
@@ -98,14 +99,14 @@
             assert target.getAnnotation(Fold.class) == null;
             assert Modifier.isNative(target.getModifiers()) : "node intrinsic " + target + " should be native";
 
-            Class< ? >[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass);
+            Class<?>[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass);
             ResolvedJavaType returnType = target.getSignature().getReturnType(declaringClass).resolve(declaringClass);
 
             // Prepare the arguments for the reflective constructor call on the node class.
             Object[] nodeConstructorArguments = prepareArguments(invoke, parameterTypes, target, false);
 
             // Create the new node instance.
-            Class< ? > c = getNodeClass(target, intrinsic);
+            Class<?> c = getNodeClass(target, intrinsic);
             Node newInstance = createNodeInstance(c, parameterTypes, returnType, intrinsic.setStampFromReturnType(), nodeConstructorArguments);
 
             // Replace the invoke with the new node.
@@ -115,7 +116,7 @@
             // Clean up checkcast instructions inserted by javac if the return type is generic.
             cleanUpReturnCheckCast(newInstance);
         } else if (target.getAnnotation(Fold.class) != null) {
-            Class< ? >[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass);
+            Class<?>[] parameterTypes = signatureToTypes(target.getSignature(), declaringClass);
 
             // Prepare the arguments for the reflective method call
             Object[] arguments = prepareArguments(invoke, parameterTypes, target, true);
@@ -126,7 +127,8 @@
             }
 
             // Call the method
-            Constant constant = callMethod(target.getSignature().getReturnKind(), getMirrorOrFail(declaringClass, Thread.currentThread().getContextClassLoader()), target.getName(), parameterTypes, receiver, arguments);
+            Constant constant = callMethod(target.getSignature().getReturnKind(), getMirrorOrFail(declaringClass, Thread.currentThread().getContextClassLoader()), target.getName(), parameterTypes,
+                            receiver, arguments);
 
             if (constant != null) {
                 // Replace the invoke with the result of the call
@@ -145,10 +147,10 @@
     /**
      * Converts the arguments of an invoke node to object values suitable for use as the arguments
      * to a reflective invocation of a Java constructor or method.
-     *
+     * 
      * @param folding specifies if the invocation is for handling a {@link Fold} annotation
      */
-    private Object[] prepareArguments(Invoke invoke, Class< ? >[] parameterTypes, ResolvedJavaMethod target, boolean folding) {
+    private Object[] prepareArguments(Invoke invoke, Class<?>[] parameterTypes, ResolvedJavaMethod target, boolean folding) {
         NodeInputList<ValueNode> arguments = invoke.callTarget().arguments();
         Object[] reflectionCallArguments = new Object[arguments.size()];
         for (int i = 0; i < reflectionCallArguments.length; ++i) {
@@ -159,13 +161,14 @@
             ValueNode argument = tryBoxingElimination(parameterIndex, target, arguments.get(i));
             if (folding || MetaUtil.getParameterAnnotation(ConstantNodeParameter.class, parameterIndex, target) != null) {
                 if (!(argument instanceof ConstantNode)) {
-                    throw new NonConstantParameterError("parameter " + parameterIndex + " must be a compile time constant for calling " + invoke.methodCallTarget().targetMethod() + " at " + sourceLocation(invoke.node()) + ": " + argument);
+                    throw new NonConstantParameterError("parameter " + parameterIndex + " must be a compile time constant for calling " + invoke.methodCallTarget().targetMethod() + " at " +
+                                    sourceLocation(invoke.node()) + ": " + argument);
                 }
                 ConstantNode constantNode = (ConstantNode) argument;
                 Constant constant = constantNode.asConstant();
                 Object o = constant.asBoxedValue();
-                if (o instanceof Class< ? >) {
-                    reflectionCallArguments[i] = runtime.lookupJavaType((Class< ? >) o);
+                if (o instanceof Class<?>) {
+                    reflectionCallArguments[i] = runtime.lookupJavaType((Class<?>) o);
                     parameterTypes[i] = ResolvedJavaType.class;
                 } else {
                     if (parameterTypes[i] == boolean.class) {
@@ -188,8 +191,8 @@
         return reflectionCallArguments;
     }
 
-    private static Class< ? > getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) {
-        Class< ? > result = intrinsic.value();
+    private static Class<?> getNodeClass(ResolvedJavaMethod target, NodeIntrinsic intrinsic) {
+        Class<?> result = intrinsic.value();
         if (result == NodeIntrinsic.class) {
             return getMirrorOrFail(target.getDeclaringClass(), Thread.currentThread().getContextClassLoader());
         }
@@ -270,11 +273,10 @@
 
     static final int VARARGS = 0x00000080;
 
-    private static Node createNodeInstance(Class< ? > nodeClass, Class< ? >[] parameterTypes, ResolvedJavaType returnType, boolean setStampFromReturnType, Object[] nodeConstructorArguments) {
+    private static Node createNodeInstance(Class<?> nodeClass, Class<?>[] parameterTypes, ResolvedJavaType returnType, boolean setStampFromReturnType, Object[] nodeConstructorArguments) {
         Object[] arguments = null;
-        Constructor< ? > constructor = null;
-        nextConstructor:
-        for (Constructor c : nodeClass.getDeclaredConstructors()) {
+        Constructor<?> constructor = null;
+        nextConstructor: for (Constructor c : nodeClass.getDeclaredConstructors()) {
             Class[] signature = c.getParameterTypes();
             if ((c.getModifiers() & VARARGS) != 0) {
                 int fixedArgs = signature.length - 1;
@@ -334,7 +336,7 @@
     /**
      * Calls a Java method via reflection.
      */
-    private static Constant callMethod(Kind returnKind, Class< ? > holder, String name, Class< ? >[] parameterTypes, Object receiver, Object[] arguments) {
+    private static Constant callMethod(Kind returnKind, Class<?> holder, String name, Class<?>[] parameterTypes, Object receiver, Object[] arguments) {
         Method method;
         try {
             method = holder.getDeclaredMethod(name, parameterTypes);
@@ -371,9 +373,8 @@
                         graph.removeFixed(valueAnchorNode);
                     } else if (checkCastUsage instanceof MethodCallTargetNode) {
                         MethodCallTargetNode checkCastCallTarget = (MethodCallTargetNode) checkCastUsage;
-                        assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod()) :
-                            "checkcast at " + sourceLocation(checkCastNode) + " not used by an unboxing method but by a call at " +
-                            sourceLocation(checkCastCallTarget.usages().first()) + " to " + checkCastCallTarget.targetMethod();
+                        assert pool.isUnboxingMethod(checkCastCallTarget.targetMethod()) : "checkcast at " + sourceLocation(checkCastNode) + " not used by an unboxing method but by a call at " +
+                                        sourceLocation(checkCastCallTarget.usages().first()) + " to " + checkCastCallTarget.targetMethod();
                         Invoke invokeNode = checkCastCallTarget.invoke();
                         invokeNode.node().replaceAtUsages(newInstance);
                         if (invokeNode instanceof InvokeWithExceptionNode) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetProvider.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetProvider.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,7 @@
 
 import com.oracle.graal.api.code.*;
 
+public interface SnippetProvider {
 
-public interface SnippetProvider {
     void installSnippets(SnippetInstaller installer, Assumptions assumptions);
 }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/SnippetTemplate.java	Fri Feb 01 17:06:26 2013 +0100
@@ -48,20 +48,21 @@
 import com.oracle.graal.word.phases.*;
 
 /**
- * A snippet template is a graph created by parsing a snippet method and then
- * specialized by binding constants to the snippet's {@link ConstantParameter} parameters.
- *
+ * A snippet template is a graph created by parsing a snippet method and then specialized by binding
+ * constants to the snippet's {@link ConstantParameter} parameters.
+ * 
  * Snippet templates can be managed in a {@link Cache}.
  */
 public class SnippetTemplate {
 
     /**
-     * A snippet template key encapsulates the method from which a snippet was built
-     * and the arguments used to specialize the snippet.
-     *
+     * A snippet template key encapsulates the method from which a snippet was built and the
+     * arguments used to specialize the snippet.
+     * 
      * @see Cache
      */
     public static class Key implements Iterable<Map.Entry<String, Object>> {
+
         public final ResolvedJavaMethod method;
         private final HashMap<String, Object> map = new HashMap<>();
         private int hash;
@@ -122,6 +123,7 @@
      * Arguments used to instantiate a template.
      */
     public static class Arguments implements Iterable<Map.Entry<String, Object>> {
+
         private final HashMap<String, Object> map = new HashMap<>();
 
         public static Arguments arguments(String name, Object value) {
@@ -158,7 +160,6 @@
         private final MetaAccessProvider runtime;
         private final TargetDescription target;
 
-
         public Cache(MetaAccessProvider runtime, TargetDescription target) {
             this.runtime = runtime;
             this.target = target;
@@ -171,12 +172,13 @@
             SnippetTemplate template = templates.get(key);
             if (template == null) {
                 template = Debug.scope("SnippetSpecialization", key.method, new Callable<SnippetTemplate>() {
+
                     @Override
                     public SnippetTemplate call() throws Exception {
                         return new SnippetTemplate(runtime, assumptions, target, key);
                     }
                 });
-                //System.out.println(key + " -> " + template);
+                // System.out.println(key + " -> " + template);
                 templates.put(key, template);
             }
             return template;
@@ -184,6 +186,7 @@
     }
 
     public abstract static class AbstractTemplates<T extends SnippetsInterface> {
+
         protected final Cache cache;
         protected final MetaAccessProvider runtime;
         protected final Assumptions assumptions;
@@ -334,7 +337,8 @@
         do {
             exploded = false;
             ExplodeLoopNode explodeLoop = snippetCopy.getNodes().filter(ExplodeLoopNode.class).first();
-            if (explodeLoop != null) { // Earlier canonicalization may have removed the loop altogether
+            if (explodeLoop != null) { // Earlier canonicalization may have removed the loop
+                                       // altogether
                 LoopBeginNode loopBegin = explodeLoop.findLoopBegin();
                 if (loopBegin != null) {
                     LoopEx loop = new LoopsData(snippetCopy).loop(loopBegin);
@@ -353,18 +357,17 @@
 
         // Remove all frame states from inlined snippet graph. Snippets must be atomic (i.e. free
         // of side-effects that prevent deoptimizing to a point before the snippet).
-        List<Node> curSideEffectNodes = new ArrayList<>();
-        Node curStampNode = null;
+        ArrayList<StateSplit> curSideEffectNodes = new ArrayList<>();
+        ArrayList<ValueNode> curStampNodes = new ArrayList<>();
         for (Node node : snippetCopy.getNodes()) {
             if (node instanceof ValueNode && ((ValueNode) node).stamp() == StampFactory.forNodeIntrinsic()) {
-                assert curStampNode == null : "Currently limited to one stamp node (but this can be converted to a List if necessary)";
-                curStampNode = node;
+                curStampNodes.add((ValueNode) node);
             }
             if (node instanceof StateSplit) {
                 StateSplit stateSplit = (StateSplit) node;
                 FrameState frameState = stateSplit.stateAfter();
                 if (stateSplit.hasSideEffect()) {
-                    curSideEffectNodes.add(node);
+                    curSideEffectNodes.add((StateSplit) node);
                 }
                 if (frameState != null) {
                     stateSplit.setStateAfter(null);
@@ -395,7 +398,7 @@
         }
 
         this.sideEffectNodes = curSideEffectNodes;
-        this.stampNode = curStampNode;
+        this.stampNodes = curStampNodes;
         this.returnNode = retNode;
     }
 
@@ -415,11 +418,10 @@
             return true;
         }
         if (kind == Kind.Object) {
-            assert arg == null || type.isInstance(Constant.forObject(arg)) :
-                method + ": wrong value type for " + name + ": expected " + type.getName() + ", got " + arg.getClass().getName();
+            assert arg == null || type.isInstance(Constant.forObject(arg)) : method + ": wrong value type for " + name + ": expected " + type.getName() + ", got " + arg.getClass().getName();
         } else {
-            assert arg != null && kind.toBoxedJavaClass() == arg.getClass() :
-                method + ": wrong value kind for " + name + ": expected " + kind + ", got " + (arg == null ? "null" : arg.getClass().getSimpleName());
+            assert arg != null && kind.toBoxedJavaClass() == arg.getClass() : method + ": wrong value kind for " + name + ": expected " + kind + ", got " +
+                            (arg == null ? "null" : arg.getClass().getSimpleName());
         }
         return true;
     }
@@ -438,10 +440,10 @@
     private final StructuredGraph snippet;
 
     /**
-     * The named parameters of this template that must be bound to values during instantiation.
-     * For a parameter that is still live after specialization, the value in this map is either
-     * a {@link LocalNode} instance or a {@link LocalNode} array. For an eliminated parameter,
-     * the value is identical to the key.
+     * The named parameters of this template that must be bound to values during instantiation. For
+     * a parameter that is still live after specialization, the value in this map is either a
+     * {@link LocalNode} instance or a {@link LocalNode} array. For an eliminated parameter, the
+     * value is identical to the key.
      */
     private final Map<String, Object> parameters;
 
@@ -451,14 +453,15 @@
     private final ReturnNode returnNode;
 
     /**
-     * Nodes that inherit the {@link StateSplit#stateAfter()} from the replacee during instantiation.
+     * Nodes that inherit the {@link StateSplit#stateAfter()} from the replacee during
+     * instantiation.
      */
-    private final List<Node> sideEffectNodes;
+    private final ArrayList<StateSplit> sideEffectNodes;
 
     /**
-     * Node that inherits the {@link ValueNode#stamp()} from the replacee during instantiation.
+     * The nodes that inherit the {@link ValueNode#stamp()} from the replacee during instantiation.
      */
-    private final Node stampNode;
+    private final ArrayList<ValueNode> stampNodes;
 
     /**
      * The nodes to be inlined when this specialization is instantiated.
@@ -467,7 +470,7 @@
 
     /**
      * Gets the instantiation-time bindings to this template's parameters.
-     *
+     * 
      * @return the map that will be used to bind arguments to parameters when inlining this template
      */
     private IdentityHashMap<Node, Node> bind(StructuredGraph replaceeGraph, MetaAccessProvider runtime, SnippetTemplate.Arguments args) {
@@ -521,13 +524,13 @@
     }
 
     /**
-     * Logic for replacing a snippet-lowered node at its usages with the return value
-     * of the snippet. An alternative to the
-     * {@linkplain SnippetTemplate#DEFAULT_REPLACER default} replacement logic can be used to
-     * handle mismatches between the stamp of the node being lowered and the
-     * stamp of the snippet's return value.
+     * Logic for replacing a snippet-lowered node at its usages with the return value of the
+     * snippet. An alternative to the {@linkplain SnippetTemplate#DEFAULT_REPLACER default}
+     * replacement logic can be used to handle mismatches between the stamp of the node being
+     * lowered and the stamp of the snippet's return value.
      */
     public interface UsageReplacer {
+
         /**
          * Replaces all usages of {@code oldNode} with direct or indirect usages of {@code newNode}.
          */
@@ -535,10 +538,11 @@
     }
 
     /**
-     * Represents the default {@link UsageReplacer usage replacer} logic which
-     * simply delegates to {@link Node#replaceAtUsages(Node)}.
+     * Represents the default {@link UsageReplacer usage replacer} logic which simply delegates to
+     * {@link Node#replaceAtUsages(Node)}.
      */
     public static final UsageReplacer DEFAULT_REPLACER = new UsageReplacer() {
+
         @Override
         public void replace(ValueNode oldNode, ValueNode newNode) {
             oldNode.replaceAtUsages(newNode);
@@ -547,17 +551,14 @@
 
     /**
      * Replaces a given fixed node with this specialized snippet.
-     *
+     * 
      * @param runtime
      * @param replacee the node that will be replaced
      * @param replacer object that replaces the usages of {@code replacee}
      * @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, FixedWithNextNode 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}";
@@ -576,13 +577,13 @@
         replacee.setNext(null);
 
         if (replacee instanceof StateSplit) {
-            for (Node sideEffectNode : sideEffectNodes) {
+            for (StateSplit sideEffectNode : sideEffectNodes) {
                 assert ((StateSplit) replacee).hasSideEffect();
                 Node sideEffectDup = duplicates.get(sideEffectNode);
                 ((StateSplit) sideEffectDup).setStateAfter(((StateSplit) replacee).stateAfter());
             }
         }
-        if (stampNode != null) {
+        for (ValueNode stampNode : stampNodes) {
             Node stampDup = duplicates.get(stampNode);
             ((ValueNode) stampDup).setStamp(((ValueNode) replacee).stamp());
         }
@@ -623,17 +624,14 @@
 
     /**
      * Replaces a given floating node with this specialized snippet.
-     *
+     * 
      * @param runtime
      * @param replacee the node that will be replaced
      * @param replacer object that replaces the usages of {@code replacee}
      * @param lastFixedNode the CFG of the snippet is inserted after this node
      * @param args the arguments to be bound to the flattened positional parameters of the snippet
      */
-    public void instantiate(MetaAccessProvider runtime,
-                    FloatingNode replacee,
-                    UsageReplacer replacer,
-                    FixedWithNextNode lastFixedNode, SnippetTemplate.Arguments args) {
+    public void instantiate(MetaAccessProvider runtime, FloatingNode replacee, UsageReplacer replacer, FixedWithNextNode lastFixedNode, 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}";
@@ -652,13 +650,13 @@
         replaceeGraph.addAfterFixed(lastFixedNode, firstCFGNodeDuplicate);
 
         if (replacee instanceof StateSplit) {
-            for (Node sideEffectNode : sideEffectNodes) {
+            for (StateSplit sideEffectNode : sideEffectNodes) {
                 assert ((StateSplit) replacee).hasSideEffect();
                 Node sideEffectDup = duplicates.get(sideEffectNode);
                 ((StateSplit) sideEffectDup).setStateAfter(((StateSplit) replacee).stateAfter());
             }
         }
-        if (stampNode != null) {
+        for (ValueNode stampNode : stampNodes) {
             Node stampDup = duplicates.get(stampNode);
             ((ValueNode) stampDup).setStamp(((ValueNode) replacee).stamp());
         }
@@ -692,7 +690,7 @@
             Object value = e.getValue();
             buf.append(sep);
             sep = ", ";
-            if (value == UNUSED_PARAMETER)  {
+            if (value == UNUSED_PARAMETER) {
                 buf.append("<unused> ").append(name);
             } else if (value instanceof LocalNode) {
                 LocalNode local = (LocalNode) value;
@@ -728,10 +726,8 @@
                 Varargs varargs = (Varargs) key.get(name);
                 assert checkVarargs(method, signature, i, name, varargs);
             } else {
-                assert p != null : method + ": parameter " + i + " must be annotated with exactly one of " +
-                    "@" + ConstantParameter.class.getSimpleName() + " or " +
-                    "@" + VarargsParameter.class.getSimpleName() + " or " +
-                    "@" + Parameter.class.getSimpleName();
+                assert p != null : method + ": parameter " + i + " must be annotated with exactly one of " + "@" + ConstantParameter.class.getSimpleName() + " or " + "@" +
+                                VarargsParameter.class.getSimpleName() + " or " + "@" + Parameter.class.getSimpleName();
             }
         }
         if (!key.names().containsAll(expected)) {
@@ -741,8 +737,8 @@
         if (!expected.containsAll(key.names())) {
             Set<String> namesCopy = new HashSet<>(key.names());
             namesCopy.removeAll(expected);
-            assert false : "parameter(s) " + namesCopy + " should be annotated with @" + ConstantParameter.class.getSimpleName() +
-                " or @" + VarargsParameter.class.getSimpleName() + " in " + MetaUtil.format("%H.%n(%p)", method);
+            assert false : "parameter(s) " + namesCopy + " should be annotated with @" + ConstantParameter.class.getSimpleName() + " or @" + VarargsParameter.class.getSimpleName() + " in " +
+                            MetaUtil.format("%H.%n(%p)", method);
         }
         return true;
     }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/UnsafeSubstitutions.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,6 +34,7 @@
  */
 @ClassSubstitution(sun.misc.Unsafe.class)
 public class UnsafeSubstitutions {
+
     @MethodSubstitution(isStatic = false)
     public static boolean compareAndSwapObject(@SuppressWarnings("unused") final Object thisObj, Object o, long offset, Object expected, Object x) {
         return CompareAndSwapNode.compareAndSwap(o, 0, offset, expected, x);
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitCountNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitCountNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
+public class BitCountNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
 
-public class BitCountNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
     @Input private ValueNode value;
 
     public BitCountNode(ValueNode value) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanForwardNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
+public class BitScanForwardNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
 
-public class BitScanForwardNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
     @Input private ValueNode value;
 
     public BitScanForwardNode(ValueNode value) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BitScanReverseNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
+public class BitScanReverseNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
 
-public class BitScanReverseNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
     @Input private ValueNode value;
 
     public BitScanReverseNode(ValueNode value) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BranchProbabilityNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/BranchProbabilityNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,12 +28,24 @@
 import com.oracle.graal.nodes.util.*;
 
 /**
- * Instances of this node class will look for a preceding if node and put the given probability into the if node's taken
- * probability. Then the branch probability node will be removed. This node is intended primarily for snippets, so that
- * they can define their fast and slow paths.
+ * Instances of this node class will look for a preceding if node and put the given probability into
+ * the if node's taken probability. Then the branch probability node will be removed. This node is
+ * intended primarily for snippets, so that they can define their fast and slow paths.
  */
 public class BranchProbabilityNode extends FixedWithNextNode implements Simplifiable {
 
+    public static final double LIKELY_PROBABILITY = 0.6;
+    public static final double NOT_LIKELY_PROBABILITY = 1 - LIKELY_PROBABILITY;
+
+    public static final double FREQUENT_PROBABILITY = 0.9;
+    public static final double NOT_FREQUENT_PROBABILITY = 1 - FREQUENT_PROBABILITY;
+
+    public static final double FAST_PATH_PROBABILITY = 0.99;
+    public static final double SLOW_PATH_PROBABILITY = 1 - FAST_PATH_PROBABILITY;
+
+    public static final double NOT_DEOPT_PATH_PROBABILITY = 0.999;
+    public static final double DEOPT_PATH_PROBABILITY = 1 - NOT_DEOPT_PATH_PROBABILITY;
+
     private final double probability;
 
     public BranchProbabilityNode(double probability) {
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectObjectStoreNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectObjectStoreNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,10 +29,11 @@
 import com.oracle.graal.word.*;
 
 /**
- * A special purpose store node that differs from {@link UnsafeStoreNode} in that
- * it is not a {@link StateSplit} and does not include a write barrier.
+ * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
+ * {@link StateSplit} and does not include a write barrier.
  */
 public class DirectObjectStoreNode extends FixedWithNextNode implements Lowerable {
+
     @Input private ValueNode object;
     @Input private ValueNode value;
     @Input private ValueNode offset;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectReadNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectReadNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,10 +30,11 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A special purpose store node that differs from {@link UnsafeStoreNode} in that
- * it is not a {@link StateSplit} and takes a computed address instead of an object.
+ * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
+ * {@link StateSplit} and takes a computed address instead of an object.
  */
 public class DirectReadNode extends FixedWithNextNode implements LIRLowerable {
+
     @Input private ValueNode address;
     private final Kind readKind;
 
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/DirectStoreNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,10 +30,11 @@
 import com.oracle.graal.nodes.type.*;
 
 /**
- * A special purpose store node that differs from {@link UnsafeStoreNode} in that
- * it is not a {@link StateSplit} and takes a computed address instead of an object.
+ * A special purpose store node that differs from {@link UnsafeStoreNode} in that it is not a
+ * {@link StateSplit} and takes a computed address instead of an object.
  */
 public class DirectStoreNode extends FixedWithNextNode implements LIRLowerable {
+
     @Input private ValueNode address;
     @Input private ValueNode value;
 
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ExplodeLoopNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ExplodeLoopNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,9 +30,9 @@
 import com.oracle.graal.snippets.Snippet.VarargsParameter;
 
 /**
- * Placeholder node to denote to snippet preparation that the following loop
- * must be completely unrolled.
- *
+ * Placeholder node to denote to snippet preparation that the following loop must be completely
+ * unrolled.
+ * 
  * @see VarargsParameter
  */
 public final class ExplodeLoopNode extends FixedWithNextNode {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MacroNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,69 @@
+/*
+ * 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.snippets.nodes;
+
+import java.lang.reflect.*;
+
+import com.oracle.graal.api.meta.*;
+import com.oracle.graal.graph.*;
+import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind;
+import com.oracle.graal.nodes.spi.*;
+
+public class MacroNode extends AbstractStateSplit implements Lowerable {
+
+    @Input protected final NodeInputList<ValueNode> arguments;
+
+    private final int bci;
+    private final ResolvedJavaMethod targetMethod;
+    private final JavaType returnType;
+
+    protected MacroNode(Invoke invoke) {
+        super(invoke.node().stamp(), invoke.stateAfter());
+        this.arguments = new NodeInputList<>(this, invoke.methodCallTarget().arguments());
+        this.bci = invoke.bci();
+        this.targetMethod = invoke.methodCallTarget().targetMethod();
+        this.returnType = invoke.methodCallTarget().returnType();
+    }
+
+    @Override
+    public void lower(LoweringTool tool) {
+        replaceWithInvoke();
+    }
+
+    public InvokeNode replaceWithInvoke() {
+        InvokeNode invoke = createInvoke();
+
+        ((StructuredGraph) graph()).replaceFixedWithFixed(this, invoke);
+        return invoke;
+    }
+
+    protected InvokeNode createInvoke() {
+        InvokeKind invokeKind = Modifier.isStatic(targetMethod.getModifiers()) ? InvokeKind.Static : InvokeKind.Special;
+        MethodCallTargetNode callTarget = graph().add(new MethodCallTargetNode(invokeKind, targetMethod, arguments.toArray(new ValueNode[arguments.size()]), returnType));
+        InvokeNode invoke = graph().add(new InvokeNode(callTarget, bci, StructuredGraph.INVALID_GRAPH_ID));
+        invoke.setStateAfter(stateAfter());
+        return invoke;
+    }
+}
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/MathIntrinsicNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -61,14 +61,29 @@
         Variable input = gen.load(gen.operand(x()));
         Variable result = gen.newVariable(kind());
         switch (operation()) {
-            case ABS:   gen.emitMathAbs(result, input); break;
-            case SQRT:  gen.emitMathSqrt(result, input); break;
-            case LOG:   gen.emitMathLog(result, input, false); break;
-            case LOG10: gen.emitMathLog(result, input, true); break;
-            case SIN:   gen.emitMathSin(result, input); break;
-            case COS:   gen.emitMathCos(result, input); break;
-            case TAN:   gen.emitMathTan(result, input); break;
-            default:    throw GraalInternalError.shouldNotReachHere();
+            case ABS:
+                gen.emitMathAbs(result, input);
+                break;
+            case SQRT:
+                gen.emitMathSqrt(result, input);
+                break;
+            case LOG:
+                gen.emitMathLog(result, input, false);
+                break;
+            case LOG10:
+                gen.emitMathLog(result, input, true);
+                break;
+            case SIN:
+                gen.emitMathSin(result, input);
+                break;
+            case COS:
+                gen.emitMathCos(result, input);
+                break;
+            case TAN:
+                gen.emitMathTan(result, input);
+                break;
+            default:
+                throw GraalInternalError.shouldNotReachHere();
         }
         gen.setResult(this, result);
     }
@@ -78,13 +93,20 @@
         if (x().isConstant()) {
             double value = x().asConstant().asDouble();
             switch (operation()) {
-                case ABS:   return ConstantNode.forDouble(Math.abs(value), graph());
-                case SQRT:  return ConstantNode.forDouble(Math.sqrt(value), graph());
-                case LOG:   return ConstantNode.forDouble(Math.log(value), graph());
-                case LOG10: return ConstantNode.forDouble(Math.log10(value), graph());
-                case SIN:   return ConstantNode.forDouble(Math.sin(value), graph());
-                case COS:   return ConstantNode.forDouble(Math.cos(value), graph());
-                case TAN:   return ConstantNode.forDouble(Math.tan(value), graph());
+                case ABS:
+                    return ConstantNode.forDouble(Math.abs(value), graph());
+                case SQRT:
+                    return ConstantNode.forDouble(Math.sqrt(value), graph());
+                case LOG:
+                    return ConstantNode.forDouble(Math.log(value), graph());
+                case LOG10:
+                    return ConstantNode.forDouble(Math.log10(value), graph());
+                case SIN:
+                    return ConstantNode.forDouble(Math.sin(value), graph());
+                case COS:
+                    return ConstantNode.forDouble(Math.cos(value), graph());
+                case TAN:
+                    return ConstantNode.forDouble(Math.tan(value), graph());
             }
         }
         return this;
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/ReverseBytesNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,8 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.type.*;
 
+public class ReverseBytesNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
 
-public class ReverseBytesNode extends FloatingNode implements LIRGenLowerable, Canonicalizable {
     @Input private ValueNode value;
 
     public ReverseBytesNode(ValueNode value) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/CyclicMaterializeStoreNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/CyclicMaterializeStoreNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -86,12 +86,12 @@
 
     @Override
     public void virtualize(VirtualizerTool tool) {
-        VirtualObjectNode virtual = tool.getVirtualState(object());
-        if (virtual != null) {
-            if (virtual instanceof VirtualArrayNode) {
-                tool.setVirtualEntry(virtual, targetIndex(), value());
+        State state = tool.getObjectState(object);
+        if (state != null && state.getState() == EscapeState.Virtual) {
+            if (state.getVirtualObject() instanceof VirtualArrayNode) {
+                tool.setVirtualEntry(state, targetIndex(), value());
             } else {
-                tool.setVirtualEntry(virtual, ((VirtualInstanceNode) virtual).fieldIndex(targetField()), value());
+                tool.setVirtualEntry(state, ((VirtualInstanceNode) state.getVirtualObject()).fieldIndex(targetField()), value());
             }
             tool.delete();
         }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializeObjectNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,7 +31,7 @@
 import com.oracle.graal.nodes.virtual.*;
 
 @NodeInfo(nameTemplate = "Materialize {i#virtualObject}")
-public final class MaterializeObjectNode extends FixedWithNextNode implements EscapeAnalyzable, Lowerable, Node.IterableNodeType, Canonicalizable {
+public final class MaterializeObjectNode extends FixedWithNextNode implements VirtualizableAllocation, Lowerable, Node.IterableNodeType, Canonicalizable, ArrayLengthProvider {
 
     @Input private final NodeInputList<ValueNode> values;
     @Input private final VirtualObjectNode virtualObject;
@@ -49,23 +49,48 @@
     }
 
     @Override
+    public ValueNode length() {
+        assert virtualObject.type().isArray();
+        return ConstantNode.forInt(values.size(), graph());
+    }
+
+    /**
+     * @return true if the object that will be created is without locks and has only entries that
+     *         are {@link Constant#defaultForKind(Kind)}, false otherwise.
+     */
+    public boolean isDefault() {
+        boolean defaultEntries = true;
+        if (lockCount > 0) {
+            defaultEntries = false;
+        } else {
+            for (ValueNode value : values) {
+                if (!value.isConstant() || !value.asConstant().isDefaultForKind()) {
+                    defaultEntries = false;
+                    break;
+                }
+            }
+        }
+        return defaultEntries;
+    }
+
+    @Override
     public void lower(LoweringTool tool) {
         StructuredGraph graph = (StructuredGraph) graph();
+
+        boolean defaultEntries = isDefault();
+
         if (virtualObject instanceof VirtualInstanceNode) {
             VirtualInstanceNode virtual = (VirtualInstanceNode) virtualObject;
 
-            NewInstanceNode newInstance = graph.add(new NewInstanceNode(virtual.type(), false, lockCount > 0));
+            NewInstanceNode newInstance = graph.add(new NewInstanceNode(virtual.type(), defaultEntries, lockCount > 0));
             this.replaceAtUsages(newInstance);
-            graph.addAfterFixed(this, newInstance);
+            graph.addBeforeFixed(this, newInstance);
 
-            FixedWithNextNode position = newInstance;
-            for (int i = 0; i < virtual.entryCount(); i++) {
-                StoreFieldNode store = graph.add(new StoreFieldNode(newInstance, virtual.field(i), values.get(i), -1));
-                graph.addAfterFixed(position, store);
-                position = store;
+            if (!defaultEntries) {
+                for (int i = 0; i < virtual.entryCount(); i++) {
+                    graph.addBeforeFixed(this, graph.add(new StoreFieldNode(newInstance, virtual.field(i), values.get(i), -1)));
+                }
             }
-
-            graph.removeFixed(this);
         } else {
             assert virtualObject instanceof VirtualArrayNode;
             VirtualArrayNode virtual = (VirtualArrayNode) virtualObject;
@@ -73,22 +98,20 @@
             ResolvedJavaType element = virtual.componentType();
             NewArrayNode newArray;
             if (element.getKind() == Kind.Object) {
-                newArray = graph.add(new NewObjectArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), false, lockCount > 0));
+                newArray = graph.add(new NewObjectArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), defaultEntries, lockCount > 0));
             } else {
-                newArray = graph.add(new NewPrimitiveArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), false, lockCount > 0));
+                newArray = graph.add(new NewPrimitiveArrayNode(element, ConstantNode.forInt(virtual.entryCount(), graph), defaultEntries, lockCount > 0));
             }
             this.replaceAtUsages(newArray);
-            graph.addAfterFixed(this, newArray);
+            graph.addBeforeFixed(this, newArray);
 
-            FixedWithNextNode position = newArray;
-            for (int i = 0; i < virtual.entryCount(); i++) {
-                StoreIndexedNode store = graph.add(new StoreIndexedNode(newArray, ConstantNode.forInt(i, graph), element.getKind(), values.get(i), -1));
-                graph.addAfterFixed(position, store);
-                position = store;
+            if (!defaultEntries) {
+                for (int i = 0; i < virtual.entryCount(); i++) {
+                    graph.addBeforeFixed(this, graph.add(new StoreIndexedNode(newArray, ConstantNode.forInt(i, graph), element.getKind(), values.get(i), -1)));
+                }
             }
-
-            graph.removeFixed(this);
         }
+        graph.removeFixed(this);
     }
 
     @Override
@@ -101,7 +124,8 @@
     }
 
     @Override
-    public ObjectDesc[] getAllocations(long nextVirtualId, MetaAccessProvider metaAccess) {
-        return new ObjectDesc[] {new ObjectDesc(virtualObject, values.toArray(new ValueNode[values.size()]), lockCount)};
+    public void virtualize(VirtualizerTool tool) {
+        tool.createVirtualObject(virtualObject, values.toArray(new ValueNode[values.size()]), lockCount);
+        tool.replaceWithVirtual(virtualObject);
     }
 }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/MaterializedObjectState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,13 +24,12 @@
 
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
  * This class encapsulated the materialized state of an escape analyzed object.
  */
-public final class MaterializedObjectState extends EscapeObjectState implements Node.IterableNodeType, LIRLowerable, Node.ValueNumberable {
+public final class MaterializedObjectState extends EscapeObjectState implements Node.IterableNodeType, Node.ValueNumberable {
 
     @Input private ValueNode materializedValue;
 
@@ -44,17 +43,12 @@
     }
 
     @Override
-    public void generate(LIRGeneratorTool generator) {
-        // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes.
-    }
-
-    @Override
     public MaterializedObjectState duplicateWithVirtualState() {
         return graph().add(new MaterializedObjectState(object(), materializedValue));
     }
 
     @Override
-    public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) {
+    public void applyToNonVirtual(NodeClosure<? super ValueNode> closure) {
         closure.apply(this, materializedValue);
     }
 }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/nodes/VirtualObjectState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,13 +26,12 @@
 
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
  * This class encapsulated the virtual state of an escape analyzed object.
  */
-public final class VirtualObjectState extends EscapeObjectState implements Node.IterableNodeType, LIRLowerable, Node.ValueNumberable {
+public final class VirtualObjectState extends EscapeObjectState implements Node.IterableNodeType, Node.ValueNumberable {
 
     @Input private final NodeInputList<ValueNode> fieldValues;
 
@@ -53,17 +52,12 @@
     }
 
     @Override
-    public void generate(LIRGeneratorTool generator) {
-        // Nothing to do, virtual object states are processed as part of the handling of StateSplit nodes.
-    }
-
-    @Override
     public VirtualObjectState duplicateWithVirtualState() {
         return graph().add(new VirtualObjectState(object(), fieldValues));
     }
 
     @Override
-    public void applyToNonVirtual(NodeClosure< ? super ValueNode> closure) {
+    public void applyToNonVirtual(NodeClosure<? super ValueNode> closure) {
         for (ValueNode value : fieldValues) {
             closure.apply(this, value);
         }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/BlockState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/BlockState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,7 +30,7 @@
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
-import com.oracle.graal.nodes.java.*;
+import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
 import com.oracle.graal.nodes.virtual.*;
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.MergeableBlockState;
 import com.oracle.graal.virtual.nodes.*;
@@ -75,14 +75,16 @@
         return new BlockState(this);
     }
 
-    public void materializeBefore(FixedNode fixed, VirtualObjectNode virtual, GraphEffectList materializeEffects) {
+    public void materializeBefore(FixedNode fixed, VirtualObjectNode virtual, EscapeState state, GraphEffectList materializeEffects) {
+        PartialEscapeClosure.METRIC_MATERIALIZATIONS.increment();
         HashSet<VirtualObjectNode> deferred = new HashSet<>();
         GraphEffectList deferredStores = new GraphEffectList();
-        materializeChangedBefore(fixed, virtual, deferred, deferredStores, materializeEffects);
+        materializeChangedBefore(fixed, virtual, state, deferred, deferredStores, materializeEffects);
         materializeEffects.addAll(deferredStores);
     }
 
-    private void materializeChangedBefore(FixedNode fixed, VirtualObjectNode virtual, HashSet<VirtualObjectNode> deferred, GraphEffectList deferredStores, GraphEffectList materializeEffects) {
+    private void materializeChangedBefore(FixedNode fixed, VirtualObjectNode virtual, EscapeState state, HashSet<VirtualObjectNode> deferred, GraphEffectList deferredStores,
+                    GraphEffectList materializeEffects) {
         trace("materializing %s at %s", virtual, fixed);
         ObjectState obj = getObjectState(virtual);
         if (obj.getLockCount() > 0 && obj.virtual.type().isArray()) {
@@ -91,70 +93,42 @@
 
         ValueNode[] fieldState = obj.getEntries();
 
-        // determine if all entries are default constants
-        boolean allDefault = true;
+        // some entries are not default constants - do the materialization
+        virtual.materializeAt(fixed);
+        MaterializeObjectNode materialize = new MaterializeObjectNode(virtual, obj.getLockCount());
+        ValueNode[] values = new ValueNode[obj.getEntries().length];
+        materialize.setProbability(fixed.probability());
+        obj.escape(materialize, state);
+        deferred.add(virtual);
         for (int i = 0; i < fieldState.length; i++) {
-            if (!fieldState[i].isConstant() || !fieldState[i].asConstant().isDefaultForKind()) {
-                allDefault = false;
-                break;
+            ObjectState valueObj = getObjectState(fieldState[i]);
+            if (valueObj != null) {
+                if (valueObj.isVirtual()) {
+                    materializeChangedBefore(fixed, valueObj.virtual, state, deferred, deferredStores, materializeEffects);
+                }
+                if (deferred.contains(valueObj.virtual)) {
+                    Kind fieldKind;
+                    CyclicMaterializeStoreNode store;
+                    if (virtual instanceof VirtualArrayNode) {
+                        store = new CyclicMaterializeStoreNode(materialize, valueObj.getMaterializedValue(), i);
+                        fieldKind = ((VirtualArrayNode) virtual).componentType().getKind();
+                    } else {
+                        VirtualInstanceNode instanceObject = (VirtualInstanceNode) virtual;
+                        store = new CyclicMaterializeStoreNode(materialize, valueObj.getMaterializedValue(), instanceObject.field(i));
+                        fieldKind = instanceObject.field(i).getType().getKind();
+                    }
+                    deferredStores.addFixedNodeBefore(store, fixed);
+                    values[i] = ConstantNode.defaultForKind(fieldKind, fixed.graph());
+                } else {
+                    values[i] = valueObj.getMaterializedValue();
+                }
+            } else {
+                values[i] = fieldState[i];
             }
         }
+        deferred.remove(virtual);
 
-        if (allDefault && obj.getLockCount() == 0) {
-            // create an ordinary NewInstance/NewArray node if all entries are default constants
-            FixedWithNextNode newObject;
-            if (virtual instanceof VirtualInstanceNode) {
-                newObject = new NewInstanceNode(virtual.type(), true, false);
-            } else {
-                assert virtual instanceof VirtualArrayNode;
-                ResolvedJavaType element = ((VirtualArrayNode) virtual).componentType();
-                if (element.getKind() == Kind.Object) {
-                    newObject = new NewObjectArrayNode(element, ConstantNode.forInt(virtual.entryCount(), fixed.graph()), true, false);
-                } else {
-                    newObject = new NewPrimitiveArrayNode(element, ConstantNode.forInt(virtual.entryCount(), fixed.graph()), true, false);
-                }
-            }
-            newObject.setProbability(fixed.probability());
-            obj.setMaterializedValue(newObject);
-            materializeEffects.addFixedNodeBefore(newObject, fixed);
-        } else {
-            // some entries are not default constants - do the materialization
-            virtual.materializeAt(fixed);
-            MaterializeObjectNode materialize = new MaterializeObjectNode(virtual, obj.getLockCount());
-            ValueNode[] values = new ValueNode[obj.getEntries().length];
-            materialize.setProbability(fixed.probability());
-            obj.setMaterializedValue(materialize);
-            deferred.add(virtual);
-            for (int i = 0; i < fieldState.length; i++) {
-                ObjectState valueObj = getObjectState(fieldState[i]);
-                if (valueObj != null) {
-                    if (valueObj.isVirtual()) {
-                        materializeChangedBefore(fixed, valueObj.virtual, deferred, deferredStores, materializeEffects);
-                    }
-                    if (deferred.contains(valueObj.virtual)) {
-                        Kind fieldKind;
-                        CyclicMaterializeStoreNode store;
-                        if (virtual instanceof VirtualArrayNode) {
-                            store = new CyclicMaterializeStoreNode(materialize, valueObj.getMaterializedValue(), i);
-                            fieldKind = ((VirtualArrayNode) virtual).componentType().getKind();
-                        } else {
-                            VirtualInstanceNode instanceObject = (VirtualInstanceNode) virtual;
-                            store = new CyclicMaterializeStoreNode(materialize, valueObj.getMaterializedValue(), instanceObject.field(i));
-                            fieldKind = instanceObject.field(i).getType().getKind();
-                        }
-                        deferredStores.addFixedNodeBefore(store, fixed);
-                        values[i] = ConstantNode.defaultForKind(fieldKind, fixed.graph());
-                    } else {
-                        values[i] = valueObj.getMaterializedValue();
-                    }
-                } else {
-                    values[i] = fieldState[i];
-                }
-            }
-            deferred.remove(virtual);
-
-            materializeEffects.addMaterialization(materialize, fixed, values);
-        }
+        materializeEffects.addMaterialization(materialize, fixed, values);
     }
 
     void addAndMarkAlias(VirtualObjectNode virtual, ValueNode node, NodeBitMap usages) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/EffectList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,9 +29,9 @@
 import com.oracle.graal.nodes.*;
 
 /**
- * An {@link EffectList} can be used to maintain a list of {@link Effect}s and backtrack to a previous state by
- * truncating the list. It can also maintain a level for each effect, which helps in creating a string representation
- * for the list.
+ * An {@link EffectList} can be used to maintain a list of {@link Effect}s and backtrack to a
+ * previous state by truncating the list. It can also maintain a level for each effect, which helps
+ * in creating a string representation for the list.
  */
 public class EffectList implements Iterable<EffectList.Effect> {
 
@@ -87,7 +87,7 @@
         effects[size++] = effect;
     }
 
-    public void addAll(Collection< ? extends Effect> list) {
+    public void addAll(Collection<? extends Effect> list) {
         int length = effects.length;
         if (size + list.size() > length) {
             while (size + list.size() > length) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/GraphEffectList.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,9 +34,9 @@
 public class GraphEffectList extends EffectList {
 
     /**
-     * Adds the given fixed node to the graph's control flow, before position (so that the original predecessor of
-     * position will then be node's predecessor).
-     *
+     * Adds the given fixed node to the graph's control flow, before position (so that the original
+     * predecessor of position will then be node's predecessor).
+     * 
      * @param node The fixed node to be added to the graph.
      * @param position The fixed node before which the node should be added.
      */
@@ -59,7 +59,7 @@
 
     /**
      * Add the given floating node to the graph.
-     *
+     * 
      * @param node The floating node to be added.
      */
     public void addFloatingNode(final FloatingNode node) {
@@ -79,8 +79,9 @@
     }
 
     /**
-     * Add the materialization node to the graph's control flow at the given position, and then sets its values.
-     *
+     * Add the materialization node to the graph's control flow at the given position, and then sets
+     * its values.
+     * 
      * @param node The materialization node that should be added.
      * @param position The fixed node before which the materialization node should be added.
      * @param values The values for the materialization node's entries.
@@ -107,7 +108,7 @@
 
     /**
      * Adds an value to the given phi node.
-     *
+     * 
      * @param node The phi node to which the value should be added.
      * @param value The value that will be added to the phi node.
      */
@@ -129,7 +130,7 @@
 
     /**
      * Sets the phi node's input at the given index to the given value.
-     *
+     * 
      * @param node The phi node whose input should be changed.
      * @param index The index of the phi input to be changed.
      * @param value The new value for the phi input.
@@ -151,14 +152,13 @@
     }
 
     /**
-     * Adds a virtual object's state to the given frame state. If the given reusedVirtualObjects set contains the
-     * virtual object then old states for this object will be removed.
-     *
+     * Adds a virtual object's state to the given frame state. If the given reusedVirtualObjects set
+     * contains the virtual object then old states for this object will be removed.
+     * 
      * @param node The frame state to which the state should be added.
      * @param state The virtual object state to add.
-     * @param reusedVirtualObjects A set of all reused virtual objects.
      */
-    public void addVirtualMapping(final FrameState node, final EscapeObjectState state, final HashSet<VirtualObjectNode> reusedVirtualObjects) {
+    public void addVirtualMapping(final FrameState node, final EscapeObjectState state) {
         add(new Effect() {
 
             @Override
@@ -172,11 +172,7 @@
                 FrameState stateAfter = node;
                 for (int i = 0; i < stateAfter.virtualObjectMappingCount(); i++) {
                     if (stateAfter.virtualObjectMappingAt(i).object() == state.object()) {
-                        if (reusedVirtualObjects.contains(state.object())) {
-                            stateAfter.virtualObjectMappings().remove(i);
-                        } else {
-                            throw new GraalInternalError("unexpected duplicate virtual state at: %s for %s", stateAfter, state.object());
-                        }
+                        stateAfter.virtualObjectMappings().remove(i);
                     }
                 }
                 stateAfter.addVirtualObjectMapping(graph.add(state));
@@ -191,7 +187,7 @@
 
     /**
      * Removes the given fixed node from the control flow and deletes it.
-     *
+     * 
      * @param node The fixed node that should be deleted.
      */
     public void deleteFixedNode(final FixedWithNextNode node) {
@@ -214,13 +210,14 @@
     }
 
     /**
-     * Replaces the given node at its usages without deleting it. If the current node is a fixed node it will be
-     * disconnected from the control flow, so that it will be deleted by a subsequent {@link DeadCodeEliminationPhase}
-     *
+     * Replaces the given node at its usages without deleting it. If the current node is a fixed
+     * node it will be disconnected from the control flow, so that it will be deleted by a
+     * subsequent {@link DeadCodeEliminationPhase}
+     * 
      * @param node The node to be replaced.
-     * @param replacement The node that should replace the original value. If the replacement is a non-connected
-     *            {@link FixedWithNextNode} it will be added to the control flow.
-     *
+     * @param replacement The node that should replace the original value. If the replacement is a
+     *            non-connected {@link FixedWithNextNode} it will be added to the control flow.
+     * 
      */
     public void replaceAtUsages(final ValueNode node, final ValueNode replacement) {
         add(new Effect() {
@@ -250,7 +247,7 @@
 
     /**
      * Replaces the first occurrence of oldInput in node with newInput.
-     *
+     * 
      * @param node The node whose input should be changed.
      * @param oldInput The value to look for.
      * @param newInput The value to replace with.
@@ -278,7 +275,7 @@
 
     /**
      * Performs a custom action.
-     *
+     * 
      * @param action The action that should be performed when the effects are applied.
      */
     public void customAction(final Runnable action) {
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ObjectState.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,29 +23,35 @@
 package com.oracle.graal.virtual.phases.ea;
 
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
 import com.oracle.graal.nodes.virtual.*;
 
 /**
- * This class describes the state of a virtual object while iterating over the graph.
- * It describes the fields or array elements (called "entries") and the lock count if the object is still virtual.
- * If the object was materialized, it contains the current materialized value.
+ * This class describes the state of a virtual object while iterating over the graph. It describes
+ * the fields or array elements (called "entries") and the lock count if the object is still
+ * virtual. If the object was materialized, it contains the current materialized value.
  */
-class ObjectState {
+class ObjectState extends Virtualizable.State {
 
     public final VirtualObjectNode virtual;
+
+    private EscapeState state;
     private ValueNode[] entries;
     private ValueNode materializedValue;
     private int lockCount;
 
-    public ObjectState(VirtualObjectNode virtual, ValueNode[] entries, int lockCount) {
+    public ObjectState(VirtualObjectNode virtual, ValueNode[] entries, EscapeState state, int lockCount) {
         this.virtual = virtual;
         this.entries = entries;
+        this.state = state;
         this.lockCount = lockCount;
     }
 
-    public ObjectState(VirtualObjectNode virtual, ValueNode materializedValue, int lockCount) {
+    public ObjectState(VirtualObjectNode virtual, ValueNode materializedValue, EscapeState state, int lockCount) {
         this.virtual = virtual;
         this.materializedValue = materializedValue;
+        this.state = state;
         this.lockCount = lockCount;
     }
 
@@ -54,41 +60,56 @@
         entries = other.entries == null ? null : other.entries.clone();
         materializedValue = other.materializedValue;
         lockCount = other.lockCount;
+        state = other.state;
     }
 
     public ObjectState cloneState() {
         return new ObjectState(this);
     }
 
+    @Override
+    public EscapeState getState() {
+        return state;
+    }
+
+    @Override
+    public VirtualObjectNode getVirtualObject() {
+        return virtual;
+    }
+
     public boolean isVirtual() {
-        assert (entries == null) ^ (materializedValue == null);
-        return materializedValue == null;
+        return state == EscapeState.Virtual;
     }
 
     public ValueNode[] getEntries() {
-        assert isVirtual();
+        assert isVirtual() && entries != null;
         return entries;
     }
 
+    @Override
     public ValueNode getEntry(int index) {
         assert isVirtual();
         return entries[index];
     }
 
+    @Override
     public void setEntry(int index, ValueNode value) {
         assert isVirtual();
         entries[index] = value;
     }
 
-    public ValueNode getMaterializedValue() {
+    public void escape(ValueNode materialized, EscapeState newState) {
+        assert state == EscapeState.Virtual || (state == EscapeState.ThreadLocal && newState == EscapeState.Global);
+        state = newState;
+        materializedValue = materialized;
+        entries = null;
         assert !isVirtual();
-        return materializedValue;
     }
 
-    public void setMaterializedValue(ValueNode value) {
-        assert isVirtual();
-        materializedValue = value;
-        entries = null;
+    @Override
+    public ValueNode getMaterializedValue() {
+        assert state == EscapeState.ThreadLocal || state == EscapeState.Global;
+        return materializedValue;
     }
 
     public void updateMaterializedValue(ValueNode value) {
@@ -96,10 +117,12 @@
         materializedValue = value;
     }
 
+    @Override
     public int getLockCount() {
         return lockCount;
     }
 
+    @Override
     public void setLockCount(int lockCount) {
         this.lockCount = lockCount;
     }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeAnalysisPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.common.*;
-import com.oracle.graal.phases.common.CanonicalizerPhase.*;
+import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer;
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.schedule.*;
 import com.oracle.graal.virtual.phases.ea.EffectList.Effect;
@@ -75,7 +75,7 @@
 
         boolean analyzableNodes = false;
         for (Node node : graph.getNodes()) {
-            if (node instanceof EscapeAnalyzable) {
+            if (node instanceof VirtualizableAllocation) {
                 analyzableNodes = true;
                 break;
             }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,6 @@
 import static com.oracle.graal.virtual.phases.ea.PartialEscapeAnalysisPhase.*;
 
 import java.util.*;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.*;
 
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.debug.*;
@@ -36,9 +34,8 @@
 import com.oracle.graal.nodes.VirtualState.NodeClosure;
 import com.oracle.graal.nodes.cfg.*;
 import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.nodes.spi.EscapeAnalyzable.ObjectDesc;
+import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
 import com.oracle.graal.nodes.virtual.*;
-import com.oracle.graal.phases.*;
 import com.oracle.graal.phases.graph.*;
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.BlockIteratorClosure;
 import com.oracle.graal.phases.graph.ReentrantBlockIterator.LoopInfo;
@@ -47,37 +44,24 @@
 
 class PartialEscapeClosure extends BlockIteratorClosure<BlockState> {
 
-    public static final ConcurrentHashMap<Class<? extends Node>, AtomicLong> materializeReasons = new ConcurrentHashMap<>();
-
-    static {
-        if (GraalOptions.EscapeAnalysisHistogram) {
-            Runtime.getRuntime().addShutdownHook(new Thread() {
-                @Override
-                public void run() {
-                    for (Map.Entry<Class<? extends Node>, AtomicLong> entry : materializeReasons.entrySet()) {
-                        System.out.println(entry.getKey() + ": " + entry.getValue());
-                    }
-                }
-            });
-        }
-    }
-
-    private static final DebugMetric metricAllocationRemoved = Debug.metric("AllocationRemoved ");
+    public static final DebugMetric METRIC_MATERIALIZATIONS = Debug.metric("Materializations");
+    public static final DebugMetric METRIC_MATERIALIZATIONS_PHI = Debug.metric("MaterializationsPhi");
+    public static final DebugMetric METRIC_MATERIALIZATIONS_MERGE = Debug.metric("MaterializationsMerge");
+    public static final DebugMetric METRIC_MATERIALIZATIONS_UNHANDLED = Debug.metric("MaterializationsUnhandled");
+    public static final DebugMetric METRIC_MATERIALIZATIONS_LOOP_REITERATION = Debug.metric("MaterializationsLoopReiteration");
+    public static final DebugMetric METRIC_MATERIALIZATIONS_LOOP_END = Debug.metric("MaterializationsLoopEnd");
+    public static final DebugMetric METRIC_ALLOCATION_REMOVED = Debug.metric("AllocationsRemoved");
 
     private final NodeBitMap usages;
     private final SchedulePhase schedule;
 
     private final GraphEffectList effects = new GraphEffectList();
-    private final HashSet<VirtualObjectNode> reusedVirtualObjects = new HashSet<>();
-    private int virtualIds = 0;
 
     private final VirtualizerToolImpl tool;
-    private final MetaAccessProvider metaAccess;
 
     public PartialEscapeClosure(NodeBitMap usages, SchedulePhase schedule, MetaAccessProvider metaAccess) {
         this.usages = usages;
         this.schedule = schedule;
-        this.metaAccess = metaAccess;
         tool = new VirtualizerToolImpl(effects, usages, metaAccess);
     }
 
@@ -86,7 +70,7 @@
     }
 
     public int getVirtualIdCount() {
-        return virtualIds;
+        return tool.getNextVirtualId();
     }
 
     @Override
@@ -96,39 +80,11 @@
 
         FixedWithNextNode lastFixedNode = null;
         for (Node node : nodeList) {
-            ObjectDesc[] newAllocations = null;
-            if (node instanceof EscapeAnalyzable) {
-                newAllocations = ((EscapeAnalyzable) node).getAllocations(virtualIds, metaAccess);
-            }
-
-            if (newAllocations != null) {
-                trace("{{%s}} ", node);
-                for (ObjectDesc desc : newAllocations) {
-                    VirtualObjectNode virtualObject = desc.virtualObject;
-                    if (virtualObject.isAlive()) {
-                        reusedVirtualObjects.add(virtualObject);
-                        state.addAndMarkAlias(virtualObject, virtualObject, usages);
-                    } else {
-                        effects.addFloatingNode(virtualObject);
-                    }
-                    ValueNode[] fieldState = desc.entryState;
-                    for (int i = 0; i < fieldState.length; i++) {
-                        fieldState[i] = state.getScalarAlias(fieldState[i]);
-                    }
-                    state.addObject(virtualObject, new ObjectState(virtualObject, fieldState, desc.lockCount));
-                    state.addAndMarkAlias(virtualObject, virtualObject, usages);
-                }
-                state.addAndMarkAlias(newAllocations[0].virtualObject, (ValueNode) node, usages);
-                effects.deleteFixedNode((FixedWithNextNode) node);
-                metricAllocationRemoved.add(newAllocations.length);
-                virtualIds += newAllocations.length;
+            if (usages.isMarked(node) || node instanceof VirtualizableAllocation) {
+                trace("[[%s]] ", node);
+                processNode((ValueNode) node, lastFixedNode == null ? null : lastFixedNode.next(), state);
             } else {
-                if (usages.isMarked(node)) {
-                    trace("[[%s]] ", node);
-                    processNode((ValueNode) node, lastFixedNode == null ? null : lastFixedNode.next(), state);
-                } else {
-                    trace("%s ", node);
-                }
+                trace("%s ", node);
             }
 
             if (node instanceof FixedWithNextNode && node.isAlive()) {
@@ -138,7 +94,6 @@
         trace(")\n    end state: %s\n", state);
     }
 
-
     private void processNode(final ValueNode node, FixedNode insertBefore, final BlockState state) {
         tool.reset(state, node);
         if (node instanceof Virtualizable) {
@@ -217,7 +172,7 @@
                     } else {
                         v = new MaterializedObjectState(obj.virtual, obj.getMaterializedValue());
                     }
-                    effects.addVirtualMapping(stateAfter, v, reusedVirtualObjects);
+                    effects.addVirtualMapping(stateAfter, v);
                 }
             }
         }
@@ -228,29 +183,24 @@
             ObjectState obj = state.getObjectState(input);
             if (obj != null) {
                 trace("replacing input %s at %s: %s", input, node, obj);
-                if (GraalOptions.EscapeAnalysisHistogram && obj.isVirtual()) {
-                    AtomicLong counter = materializeReasons.get(node.getClass());
-                    if (counter == null) {
-                        counter = new AtomicLong();
-                        materializeReasons.put(node.getClass(), counter);
-                    }
-                    counter.incrementAndGet();
-                }
-                replaceWithMaterialized(input, node, insertBefore, state, obj);
+                replaceWithMaterialized(input, node, insertBefore, state, obj, METRIC_MATERIALIZATIONS_UNHANDLED);
             }
         }
     }
 
-    private void ensureMaterialized(BlockState state, ObjectState obj, FixedNode materializeBefore) {
+    private void ensureMaterialized(BlockState state, ObjectState obj, FixedNode materializeBefore, DebugMetric metric) {
         assert obj != null;
-        if (obj.isVirtual()) {
-            state.materializeBefore(materializeBefore, obj.virtual, effects);
+        if (obj.getState() == EscapeState.Virtual) {
+            metric.increment();
+            state.materializeBefore(materializeBefore, obj.virtual, EscapeState.Global, effects);
+        } else {
+            assert obj.getState() == EscapeState.Global;
         }
         assert !obj.isVirtual();
     }
 
-    private void replaceWithMaterialized(ValueNode value, Node usage, FixedNode materializeBefore, BlockState state, ObjectState obj) {
-        ensureMaterialized(state, obj, materializeBefore);
+    private void replaceWithMaterialized(ValueNode value, Node usage, FixedNode materializeBefore, BlockState state, ObjectState obj, DebugMetric metric) {
+        ensureMaterialized(state, obj, materializeBefore, metric);
         effects.replaceFirstInput(usage, value, obj.getMaterializedValue());
     }
 
@@ -260,7 +210,8 @@
         BlockState newState = BlockState.meetAliases(states);
 
         // Iterative processing:
-        // Merging the materialized/virtual state of virtual objects can lead to new materializations, which can
+        // Merging the materialized/virtual state of virtual objects can lead to new
+        // materializations, which can
         // lead to new materializations because of phis, and so on.
 
         boolean materialized;
@@ -298,12 +249,12 @@
                                 BlockState state = states.get(i);
                                 ObjectState obj = state.getObjectState(object);
                                 materialized |= obj.isVirtual();
-                                ensureMaterialized(state, obj, merge.forwardEndAt(i));
+                                ensureMaterialized(state, obj, merge.forwardEndAt(i), METRIC_MATERIALIZATIONS_MERGE);
                                 effects.addPhiInput(materializedValuePhi, obj.getMaterializedValue());
                             }
-                            newState.addObject(object, new ObjectState(object, materializedValuePhi, lockCount));
+                            newState.addObject(object, new ObjectState(object, materializedValuePhi, EscapeState.Global, lockCount));
                         } else {
-                            newState.addObject(object, new ObjectState(object, singleValue, lockCount));
+                            newState.addObject(object, new ObjectState(object, singleValue, EscapeState.Global, lockCount));
                         }
                     } else {
                         assert virtual == states.size();
@@ -330,7 +281,7 @@
                                         ObjectState obj = state.getObjectState(fields[index]);
                                         if (obj != null) {
                                             materialized |= obj.isVirtual();
-                                            ensureMaterialized(state, obj, merge.forwardEndAt(i));
+                                            ensureMaterialized(state, obj, merge.forwardEndAt(i), METRIC_MATERIALIZATIONS_MERGE);
                                             fields[index] = obj.getMaterializedValue();
                                         }
                                         effects.addPhiInput(phis[index], fields[index]);
@@ -343,7 +294,7 @@
                                 }
                             }
                         }
-                        newState.addObject(object, new ObjectState(object, values, lockCount));
+                        newState.addObject(object, new ObjectState(object, values, EscapeState.Virtual, lockCount));
                     }
                 }
             }
@@ -413,7 +364,7 @@
                 ObjectState obj = states.get(i).getObjectState(value);
                 if (obj != null) {
                     materialized |= obj.isVirtual();
-                    replaceWithMaterialized(value, phi, merge.forwardEndAt(i), states.get(i), obj);
+                    replaceWithMaterialized(value, phi, merge.forwardEndAt(i), states.get(i), obj, METRIC_MATERIALIZATIONS_PHI);
                 }
             }
         }
@@ -492,7 +443,10 @@
                 for (VirtualObjectNode virtualObject : additionalMaterializations) {
                     ObjectState obj = initialState.getObjectState(virtualObject);
                     if (obj.isVirtual()) {
-                        initialState.materializeBefore(loop.loopBegin().forwardEnd(), virtualObject, effects);
+                        METRIC_MATERIALIZATIONS_LOOP_REITERATION.increment();
+                        initialState.materializeBefore(loop.loopBegin().forwardEnd(), virtualObject, EscapeState.Global, effects);
+                    } else {
+                        assert obj.getState() == EscapeState.Global;
                     }
                 }
             }
@@ -596,7 +550,8 @@
                                     if (endValueObj == null || !endValueObj.isVirtual() || valueObj.virtual != endValueObj.virtual) {
                                         additionalMaterializations.add(valueObj.virtual);
                                     } else {
-                                        // endValue is also virtual and refers to the same virtual object, so we're
+                                        // endValue is also virtual and refers to the same virtual
+                                        // object, so we're
                                         // good.
                                     }
                                 }
@@ -604,7 +559,8 @@
                                 if (value instanceof PhiNode && ((PhiNode) value).merge() == loopBegin) {
                                     if (endValueObj != null) {
                                         if (endValueObj.isVirtual()) {
-                                            loopEndState.materializeBefore(loopEnd, endValueObj.virtual, successEffects);
+                                            METRIC_MATERIALIZATIONS_LOOP_END.increment();
+                                            loopEndState.materializeBefore(loopEnd, endValueObj.virtual, EscapeState.Global, successEffects);
                                             materialized = true;
                                         }
                                     }
@@ -631,7 +587,7 @@
                         }
                     } else {
                         if (initialMaterialized) {
-                            loopEndState.materializeBefore(loopEnd, loopEndObj.virtual, successEffects);
+                            loopEndState.materializeBefore(loopEnd, loopEndObj.virtual, EscapeState.Global, successEffects);
                             materialized = true;
                         } else {
                             if (loopEndObj.virtual != initialObj.virtual) {
@@ -659,14 +615,17 @@
                                 if (endValueObj == null || !endValueObj.isVirtual() || valueObj.virtual != endValueObj.virtual) {
                                     assert !additionalMaterializations.isEmpty();
                                 } else {
-                                    // endValue is also virtual and refers to the same virtual object, so we're
+                                    // endValue is also virtual and refers to the same virtual
+                                    // object, so we're
                                     // good.
                                 }
                             } else {
-                                if ((endValueObj != null && endValueObj.getMaterializedValue() != valueObj.getMaterializedValue()) || (endValueObj == null && valueObj.getMaterializedValue() != endValue)) {
+                                if ((endValueObj != null && endValueObj.getMaterializedValue() != valueObj.getMaterializedValue()) ||
+                                                (endValueObj == null && valueObj.getMaterializedValue() != endValue)) {
                                     phis.add(new PhiDesc(state.virtual, i));
                                 } else {
-                                    // either endValue has the same materialized value as value or endValue is the
+                                    // either endValue has the same materialized value as value or
+                                    // endValue is the
                                     // same as the materialized value, so we're good.
                                 }
                             }
@@ -695,7 +654,8 @@
                     // throw new GraalInternalError("un-materialized object state at %s", loopEnd);
                 } else {
                     if (state.getMaterializedValue() != endState.getMaterializedValue()) {
-                        // throw new GraalInternalError("changed materialized value during loop: %s vs %s",
+                        // throw new
+                        // GraalInternalError("changed materialized value during loop: %s vs %s",
                         // state.materializedValue, endState.materializedValue);
                     }
                 }
--- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/VirtualizerToolImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,11 +22,16 @@
  */
 package com.oracle.graal.virtual.phases.ea;
 
+import static com.oracle.graal.virtual.phases.ea.PartialEscapeAnalysisPhase.*;
+
 import com.oracle.graal.api.meta.*;
 import com.oracle.graal.graph.*;
 import com.oracle.graal.nodes.*;
+import com.oracle.graal.nodes.spi.Virtualizable.EscapeState;
+import com.oracle.graal.nodes.spi.Virtualizable.State;
 import com.oracle.graal.nodes.spi.*;
 import com.oracle.graal.nodes.virtual.*;
+import com.oracle.graal.phases.*;
 
 class VirtualizerToolImpl implements VirtualizerTool {
 
@@ -44,6 +49,7 @@
     private boolean customAction;
     private BlockState state;
     private ValueNode current;
+    private int virtualIds = 0;
 
     @Override
     public MetaAccessProvider getMetaAccessProvider() {
@@ -66,51 +72,32 @@
     }
 
     @Override
-    public VirtualObjectNode getVirtualState(ValueNode value) {
-        ObjectState obj = state.getObjectState(value);
-        return obj != null && obj.isVirtual() ? obj.virtual : null;
+    public int getNextVirtualId() {
+        return virtualIds;
     }
 
     @Override
-    public ValueNode getVirtualEntry(VirtualObjectNode virtual, int index) {
-        ObjectState obj = state.getObjectState(virtual);
-        assert obj != null && obj.isVirtual() : "not virtual: " + obj;
-        ValueNode result = obj.getEntry(index);
-        ValueNode materialized = getMaterializedValue(result);
-        return materialized != null ? materialized : result;
+    public State getObjectState(ValueNode value) {
+        return state.getObjectState(value);
     }
 
     @Override
-    public void setVirtualEntry(VirtualObjectNode virtual, int index, ValueNode value) {
-        ObjectState obj = state.getObjectState(virtual);
+    public void setVirtualEntry(State objectState, int index, ValueNode value) {
+        ObjectState obj = (ObjectState) objectState;
         assert obj != null && obj.isVirtual() : "not virtual: " + obj;
-        if (getVirtualState(value) == null) {
-            ValueNode materialized = getMaterializedValue(value);
-            if (materialized != null) {
-                obj.setEntry(index, materialized);
+        ObjectState valueState = state.getObjectState(value);
+        if (valueState == null) {
+            obj.setEntry(index, getReplacedValue(value));
+        } else {
+            if (valueState.getState() == EscapeState.Virtual) {
+                obj.setEntry(index, value);
             } else {
-                obj.setEntry(index, getReplacedValue(value));
+                obj.setEntry(index, valueState.getMaterializedValue());
             }
-        } else {
-            obj.setEntry(index, value);
         }
     }
 
     @Override
-    public int getVirtualLockCount(VirtualObjectNode virtual) {
-        ObjectState obj = state.getObjectState(virtual);
-        assert obj != null && obj.isVirtual() : "not virtual: " + obj;
-        return obj.getLockCount();
-    }
-
-    @Override
-    public void setVirtualLockCount(VirtualObjectNode virtual, int lockCount) {
-        ObjectState obj = state.getObjectState(virtual);
-        assert obj != null && obj.isVirtual() : "not virtual: " + obj;
-        obj.setLockCount(lockCount);
-    }
-
-    @Override
     public ValueNode getMaterializedValue(ValueNode value) {
         ObjectState obj = state.getObjectState(value);
         return obj != null && !obj.isVirtual() ? obj.getMaterializedValue() : null;
@@ -154,4 +141,40 @@
         effects.customAction(action);
         customAction = true;
     }
+
+    @Override
+    public void createVirtualObject(VirtualObjectNode virtualObject, ValueNode[] entryState, int lockCount) {
+        trace("{{%s}} ", current);
+        if (virtualObject.isAlive()) {
+            state.addAndMarkAlias(virtualObject, virtualObject, usages);
+        } else {
+            effects.addFloatingNode(virtualObject);
+        }
+        for (int i = 0; i < entryState.length; i++) {
+            entryState[i] = state.getScalarAlias(entryState[i]);
+        }
+        state.addObject(virtualObject, new ObjectState(virtualObject, entryState, EscapeState.Virtual, lockCount));
+        state.addAndMarkAlias(virtualObject, virtualObject, usages);
+        PartialEscapeClosure.METRIC_ALLOCATION_REMOVED.increment();
+        virtualIds++;
+    }
+
+    @Override
+    public int getMaximumEntryCount() {
+        return GraalOptions.MaximumEscapeAnalysisArrayLength;
+    }
+
+    @Override
+    public void replaceWith(ValueNode node) {
+        State resultState = getObjectState(node);
+        if (resultState == null) {
+            replaceWithValue(node);
+        } else {
+            if (resultState.getState() == EscapeState.Virtual) {
+                replaceWithVirtual(resultState.getVirtualObject());
+            } else {
+                replaceWithValue(resultState.getMaterializedValue());
+            }
+        }
+    }
 }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Pointer.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,474 +25,556 @@
 public interface Pointer extends Unsigned {
 
     /**
-     * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type checks are performed.
-     * The caller must ensure that the Pointer contains a valid Java object that can i.e., processed by the garbage
-     * collector.
-     *
+     * Unsafe conversion of this Pointer to a Java language object. No correctness checks or type
+     * checks are performed. The caller must ensure that the Pointer contains a valid Java object
+     * that can i.e., processed by the garbage collector.
+     * 
      * @return this Pointer cast to Object.
      */
     Object toObject();
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     byte readByte(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     char readChar(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     short readShort(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     int readInt(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     long readLong(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     float readFloat(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     double readDouble(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Word readWord(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Object readObject(WordBase offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     byte readByte(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     char readChar(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     short readShort(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     int readInt(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     long readLong(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     float readFloat(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     double readDouble(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Word readWord(int offset);
 
     /**
-     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Object readObject(int offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     byte readFinalByte(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     char readFinalChar(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     short readFinalShort(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     int readFinalInt(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     long readFinalLong(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     float readFinalFloat(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     double readFinalDouble(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Word readFinalWord(WordBase offset);
 
     /**
-     * Reads the constant memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The caller guarantees that the memory content is final, i.e., never changing. The compiler can therefore
-     * eliminate memory accesses more aggressively. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Reads the constant memory at address {@code (this + offset)}. Both the base address and
+     * offset are in bytes.
+     * <p>
+     * The caller guarantees that the memory content is final, i.e., never changing. The compiler
+     * can therefore eliminate memory accesses more aggressively.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @return the result of the memory access
      */
     Object readFinalObject(WordBase offset);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeByte(WordBase offset, byte val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeChar(WordBase offset, char val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeShort(WordBase offset, Short val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeInt(WordBase offset, int val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeLong(WordBase offset, long val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeFloat(WordBase offset, float val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeDouble(WordBase offset, double val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeWord(WordBase offset, WordBase val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes. <br>
-     * The offset is always treated as a {@link Signed} value. However, the static type is {@link WordBase} to avoid the
-     * frequent casts to of {@link Unsigned} values (where the caller knows that the highest-order bit of the unsigned
-     * value is never used).
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * <p>
+     * The offset is always treated as a {@link Signed} value. However, the static type is
+     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
+     * knows that the highest-order bit of the unsigned value is never used).
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeObject(WordBase offset, Object val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeByte(int offset, byte val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeChar(int offset, char val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeShort(int offset, short val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeInt(int offset, int val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeLong(int offset, long val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeFloat(int offset, float val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeDouble(int offset, double val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeWord(int offset, WordBase val);
 
     /**
-     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in bytes.
-     *
+     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
+     * bytes.
+     * 
      * @param offset the signed offset for the memory access
      * @param val the value to be written to memory
      */
     void writeObject(int offset, Object val);
 
-    // Math functions that are defined in Unsigned, but known to preserve the pointer-characteristics.
+    // Math functions that are defined in Unsigned, but known to preserve the
+    // pointer-characteristics.
     // It is therefore safe that they return a static type of Pointer instead of Unsigned.
 
     @Override
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Signed.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this + val)}.
-     *
+     * 
      * @param val value to be added to this Signed.
      * @return {@code this + val}
      */
@@ -34,7 +34,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this - val)}.
-     *
+     * 
      * @param val value to be subtracted from this Signed.
      * @return {@code this - val}
      */
@@ -42,7 +42,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this * val)}.
-     *
+     * 
      * @param val value to be multiplied by this Signed.
      * @return {@code this * val}
      */
@@ -50,7 +50,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this / val)}.
-     *
+     * 
      * @param val value by which this Signed is to be divided.
      * @return {@code this / val}
      */
@@ -58,7 +58,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this % val)}.
-     *
+     * 
      * @param val value by which this Signed is to be divided, and the remainder computed.
      * @return {@code this % val}
      */
@@ -66,7 +66,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this << n)}.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this << n}
      */
@@ -74,50 +74,50 @@
 
     /**
      * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this >> n}
      */
     Signed signedShiftRight(Unsigned n);
 
     /**
-     * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed if and only if this
-     * and val are both negative.)
-     *
+     * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
+     * if and only if this and val are both negative.)
+     * 
      * @param val value to be AND'ed with this Signed.
      * @return {@code this & val}
      */
     Signed and(Signed val);
 
     /**
-     * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed if and only if
-     * either this or val is negative.)
-     *
+     * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
+     * if and only if either this or val is negative.)
+     * 
      * @param val value to be OR'ed with this Signed.
      * @return {@code this | val}
      */
     Signed or(Signed val);
 
     /**
-     * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed if and only if
-     * exactly one of this and val are negative.)
-     *
+     * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
+     * if and only if exactly one of this and val are negative.)
+     * 
      * @param val value to be XOR'ed with this Signed.
      * @return {@code this ^ val}
      */
     Signed xor(Signed val);
 
     /**
-     * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and only if this Signed
-     * is non-negative.)
-     *
+     * Returns a Signed whose value is {@code (~this)}. (This method returns a negative value if and
+     * only if this Signed is non-negative.)
+     * 
      * @return {@code ~this}
      */
     Signed not();
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this < val}
      */
@@ -125,7 +125,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this <= val}
      */
@@ -133,7 +133,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this > val}
      */
@@ -141,17 +141,15 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this >= val}
      */
     boolean greaterOrEqual(Signed val);
 
-
-
     /**
      * Returns a Signed whose value is {@code (this + val)}.
-     *
+     * 
      * @param val value to be added to this Signed.
      * @return {@code this + val}
      */
@@ -159,7 +157,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this - val)}.
-     *
+     * 
      * @param val value to be subtracted from this Signed.
      * @return {@code this - val}
      */
@@ -167,7 +165,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this * val)}.
-     *
+     * 
      * @param val value to be multiplied by this Signed.
      * @return {@code this * val}
      */
@@ -175,7 +173,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this / val)}.
-     *
+     * 
      * @param val value by which this Signed is to be divided.
      * @return {@code this / val}
      */
@@ -183,7 +181,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this % val)}.
-     *
+     * 
      * @param val value by which this Signed is to be divided, and the remainder computed.
      * @return {@code this % val}
      */
@@ -191,7 +189,7 @@
 
     /**
      * Returns a Signed whose value is {@code (this << n)}.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this << n}
      */
@@ -199,34 +197,34 @@
 
     /**
      * Returns a Signed whose value is {@code (this >> n)}. Sign extension is performed.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this >> n}
      */
     Signed signedShiftRight(int n);
 
     /**
-     * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed if and only if this
-     * and val are both negative.)
-     *
+     * Returns a Signed whose value is {@code (this & val)}. (This method returns a negative Signed
+     * if and only if this and val are both negative.)
+     * 
      * @param val value to be AND'ed with this Signed.
      * @return {@code this & val}
      */
     Signed and(int val);
 
     /**
-     * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed if and only if
-     * either this or val is negative.)
-     *
+     * Returns a Signed whose value is {@code (this | val)}. (This method returns a negative Signed
+     * if and only if either this or val is negative.)
+     * 
      * @param val value to be OR'ed with this Signed.
      * @return {@code this | val}
      */
     Signed or(int val);
 
     /**
-     * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed if and only if
-     * exactly one of this and val are negative.)
-     *
+     * Returns a Signed whose value is {@code (this ^ val)}. (This method returns a negative Signed
+     * if and only if exactly one of this and val are negative.)
+     * 
      * @param val value to be XOR'ed with this Signed.
      * @return {@code this ^ val}
      */
@@ -234,7 +232,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this < val}
      */
@@ -242,7 +240,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this <= val}
      */
@@ -250,7 +248,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this > val}
      */
@@ -258,7 +256,7 @@
 
     /**
      * Compares this Signed with the specified value.
-     *
+     * 
      * @param val value to which this Signed is to be compared.
      * @return {@code this >= val}
      */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Unsigned.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this + val)}.
-     *
+     * 
      * @param val value to be added to this Unsigned.
      * @return {@code this + val}
      */
@@ -34,7 +34,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this - val)}.
-     *
+     * 
      * @param val value to be subtracted from this Unsigned.
      * @return {@code this - val}
      */
@@ -42,7 +42,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this * val)}.
-     *
+     * 
      * @param val value to be multiplied by this Unsigned.
      * @return {@code this * val}
      */
@@ -50,7 +50,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this / val)}.
-     *
+     * 
      * @param val value by which this Unsigned is to be divided.
      * @return {@code this / val}
      */
@@ -58,7 +58,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this % val)}.
-     *
+     * 
      * @param val value by which this Unsigned is to be divided, and the remainder computed.
      * @return {@code this % val}
      */
@@ -66,7 +66,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this << n)}.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this << n}
      */
@@ -74,7 +74,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
-     *
+     * 
      * @param n shift distance, in bits.
      * @return {@code this >> n}
      */
@@ -82,7 +82,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this & val)}.
-     *
+     * 
      * @param val value to be AND'ed with this Unsigned.
      * @return {@code this & val}
      */
@@ -90,7 +90,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this | val)}.
-     *
+     * 
      * @param val value to be OR'ed with this Unsigned.
      * @return {@code this | val}
      */
@@ -98,7 +98,7 @@
 
     /**
      * Returns a Unsigned whose value is {@code (this ^ val)}.
-     *
+     * 
      * @param val value to be XOR'ed with this Unsigned.
      * @return {@code this ^ val}
      */
@@ -106,14 +106,14 @@
 
     /**
      * Returns a Unsigned whose value is {@code (~this)}.
-     *
+     * 
      * @return {@code ~this}
      */
     Unsigned not();
 
     /**
      * Compares this Unsigned with the specified value.
-     *
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this < val}
      */
@@ -121,7 +121,7 @@
 
     /**
      * Compares this Unsigned with the specified value.
-     *
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this <= val}
      */
@@ -129,7 +129,7 @@
 
     /**
      * Compares this Unsigned with the specified value.
-     *
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this > val}
      */
@@ -137,147 +137,161 @@
 
     /**
      * Compares this Unsigned with the specified value.
-     *
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this >= val}
      */
     boolean aboveOrEqual(Unsigned val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this + val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this + val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be added to this Unsigned.
      * @return {@code this + val}
      */
     Unsigned add(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this - val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this - val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be subtracted from this Unsigned.
      * @return {@code this - val}
      */
     Unsigned subtract(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this * val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this * val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be multiplied by this Unsigned.
      * @return {@code this * val}
      */
     Unsigned multiply(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this / val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this / val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value by which this Unsigned is to be divided.
      * @return {@code this / val}
      */
     Unsigned unsignedDivide(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this % val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this % val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value by which this Unsigned is to be divided, and the remainder computed.
      * @return {@code this % val}
      */
     Unsigned unsignedRemainder(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this << n)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this << n)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param n shift distance, in bits.
      * @return {@code this << n}
      */
     Unsigned shiftLeft(int n);
 
     /**
-     * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this >>> n)}. No sign extension is performed.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param n shift distance, in bits.
      * @return {@code this >> n}
      */
     Unsigned unsignedShiftRight(int n);
 
     /**
-     * Returns a Unsigned whose value is {@code (this & val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this & val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be AND'ed with this Unsigned.
      * @return {@code this & val}
      */
     Unsigned and(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this | val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this | val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be OR'ed with this Unsigned.
      * @return {@code this | val}
      */
     Unsigned or(int val);
 
     /**
-     * Returns a Unsigned whose value is {@code (this ^ val)}. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Returns a Unsigned whose value is {@code (this ^ val)}.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to be XOR'ed with this Unsigned.
      * @return {@code this ^ val}
      */
     Unsigned xor(int val);
 
     /**
-     * Compares this Unsigned with the specified value. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this < val}
      */
     boolean belowThan(int val);
 
     /**
-     * Compares this Unsigned with the specified value. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this <= val}
      */
     boolean belowOrEqual(int val);
 
     /**
-     * Compares this Unsigned with the specified value. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this > val}
      */
     boolean aboveThan(int val);
 
     /**
-     * Compares this Unsigned with the specified value. <br>
-     * Note that the right operand is a signed value, while the operation is performed unsigned. Therefore, the result
-     * is only well-defined for positive right operands.
-     *
+     * Compares this Unsigned with the specified value.
+     * <p>
+     * Note that the right operand is a signed value, while the operation is performed unsigned.
+     * Therefore, the result is only well-defined for positive right operands.
+     * 
      * @param val value to which this Unsigned is to be compared.
      * @return {@code this >= val}
      */
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/Word.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,21 +32,27 @@
 import com.oracle.graal.nodes.calc.*;
 
 public abstract class Word implements Signed, Unsigned, Pointer {
-      /**
-      * Links a method to a canonical operation represented by an {@link Opcode} val.
-      */
-     @Retention(RetentionPolicy.RUNTIME)
-     @Target(ElementType.METHOD)
-     public @interface Operation {
-         Class<? extends ValueNode> node() default ValueNode.class;
-         boolean rightOperandIsInt() default false;
-         Opcode opcode() default Opcode.NODE_CLASS;
-         Condition condition() default Condition.EQ;
-     }
+
+    /**
+     * Links a method to a canonical operation represented by an {@link Opcode} val.
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target(ElementType.METHOD)
+    public @interface Operation {
+
+        Class<? extends ValueNode> node() default ValueNode.class;
 
-     /**
-      * The canonical {@link Operation} represented by a method in the {@link Word} class.
-      */
+        boolean rightOperandIsInt() default false;
+
+        Opcode opcode() default Opcode.NODE_CLASS;
+
+        Condition condition() default Condition.EQ;
+    }
+
+    /**
+     * The canonical {@link Operation} represented by a method in the {@link Word} class.
+     */
+    // @formatter:off
      public enum Opcode {
          NODE_CLASS,
          COMPARISON,
@@ -61,6 +67,7 @@
          TO_OBJECT,
          TO_RAW_VALUE,
     }
+     // @formatter:on
 
     private static Word box(long val) {
         return HostedWord.box(val);
@@ -72,9 +79,10 @@
         return box(val);
     }
 
-
     /**
-     * The constant 0, i.e., the word with no bits set. There is no difference between a signed and unsigned zero.
+     * The constant 0, i.e., the word with no bits set. There is no difference between a signed and
+     * unsigned zero.
+     * 
      * @return the constant 0.
      */
     @Operation(opcode = Opcode.ZERO)
@@ -83,7 +91,9 @@
     }
 
     /**
-     * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned 64-bit value (in contrast to the semantics of a Java long).
+     * Unsafe conversion from a Java long value to a Word. The parameter is treated as an unsigned
+     * 64-bit value (in contrast to the semantics of a Java long).
+     * 
      * @param val a 64 bit unsigned value
      * @return the value cast to Word
      */
@@ -93,7 +103,9 @@
     }
 
     /**
-     * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned 32-bit value (in contrast to the semantics of a Java int).
+     * Unsafe conversion from a Java int value to a Word. The parameter is treated as an unsigned
+     * 32-bit value (in contrast to the semantics of a Java int).
+     * 
      * @param val a 32 bit unsigned value
      * @return the value cast to Word
      */
@@ -103,7 +115,9 @@
     }
 
     /**
-     * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed 64-bit value (unchanged semantics of a Java long).
+     * Unsafe conversion from a Java long value to a Word. The parameter is treated as a signed
+     * 64-bit value (unchanged semantics of a Java long).
+     * 
      * @param val a 64 bit signed value
      * @return the value cast to Word
      */
@@ -113,7 +127,9 @@
     }
 
     /**
-     * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed 32-bit value (unchanged semantics of a Java int).
+     * Unsafe conversion from a Java int value to a Word. The parameter is treated as a signed
+     * 32-bit value (unchanged semantics of a Java int).
+     * 
      * @param val a 32 bit signed value
      * @return the value cast to Word
      */
@@ -135,22 +151,24 @@
     @Operation(opcode = Opcode.TO_OBJECT)
     public native Object toObject();
 
-
     @Override
     @Operation(node = IntegerAddNode.class)
     public Word add(Signed val) {
         return add((Word) val);
     }
+
     @Override
     @Operation(node = IntegerAddNode.class)
     public Word add(Unsigned val) {
         return add((Word) val);
     }
+
     @Override
     @Operation(node = IntegerAddNode.class)
     public Word add(int val) {
         return add(intParam(val));
     }
+
     @Operation(node = IntegerAddNode.class)
     public Word add(Word val) {
         return box(unbox() + val.unbox());
@@ -161,16 +179,19 @@
     public Word subtract(Signed val) {
         return subtract((Word) val);
     }
+
     @Override
     @Operation(node = IntegerSubNode.class)
     public Word subtract(Unsigned val) {
         return subtract((Word) val);
     }
+
     @Override
     @Operation(node = IntegerSubNode.class)
     public Word subtract(int val) {
         return subtract(intParam(val));
     }
+
     @Operation(node = IntegerSubNode.class)
     public Word subtract(Word val) {
         return box(unbox() - val.unbox());
@@ -181,16 +202,19 @@
     public Word multiply(Signed val) {
         return multiply((Word) val);
     }
+
     @Override
     @Operation(node = IntegerMulNode.class)
     public Word multiply(Unsigned val) {
         return multiply((Word) val);
     }
+
     @Override
     @Operation(node = IntegerMulNode.class)
     public Word multiply(int val) {
         return multiply(intParam(val));
     }
+
     @Operation(node = IntegerMulNode.class)
     public Word multiply(Word val) {
         return box(unbox() * val.unbox());
@@ -201,11 +225,13 @@
     public Word signedDivide(Signed val) {
         return signedDivide((Word) val);
     }
+
     @Override
     @Operation(node = IntegerDivNode.class)
     public Word signedDivide(int val) {
         return signedDivide(intParam(val));
     }
+
     @Operation(node = IntegerDivNode.class)
     public Word signedDivide(Word val) {
         return box(unbox() / val.unbox());
@@ -216,11 +242,13 @@
     public Word unsignedDivide(Unsigned val) {
         return unsignedDivide((Word) val);
     }
+
     @Override
     @Operation(node = UnsignedDivNode.class)
     public Word unsignedDivide(int val) {
         return signedDivide(intParam(val));
     }
+
     @Operation(node = UnsignedDivNode.class)
     public Word unsignedDivide(Word val) {
         return box(UnsignedMath.divide(unbox(), val.unbox()));
@@ -231,11 +259,13 @@
     public Word signedRemainder(Signed val) {
         return signedRemainder((Word) val);
     }
+
     @Override
     @Operation(node = IntegerRemNode.class)
     public Word signedRemainder(int val) {
         return signedRemainder(intParam(val));
     }
+
     @Operation(node = IntegerRemNode.class)
     public Word signedRemainder(Word val) {
         return box(unbox() % val.unbox());
@@ -246,11 +276,13 @@
     public Word unsignedRemainder(Unsigned val) {
         return unsignedRemainder((Word) val);
     }
+
     @Override
     @Operation(node = UnsignedRemNode.class)
     public Word unsignedRemainder(int val) {
         return signedRemainder(intParam(val));
     }
+
     @Operation(node = UnsignedRemNode.class)
     public Word unsignedRemainder(Word val) {
         return box(UnsignedMath.remainder(unbox(), val.unbox()));
@@ -261,11 +293,13 @@
     public Word shiftLeft(Unsigned val) {
         return shiftLeft((Word) val);
     }
+
     @Override
     @Operation(node = LeftShiftNode.class, rightOperandIsInt = true)
     public Word shiftLeft(int val) {
         return shiftLeft(intParam(val));
     }
+
     @Operation(node = LeftShiftNode.class, rightOperandIsInt = true)
     public Word shiftLeft(Word val) {
         return box(unbox() << val.unbox());
@@ -276,11 +310,13 @@
     public Word signedShiftRight(Unsigned val) {
         return signedShiftRight((Word) val);
     }
+
     @Override
     @Operation(node = RightShiftNode.class, rightOperandIsInt = true)
     public Word signedShiftRight(int val) {
         return signedShiftRight(intParam(val));
     }
+
     @Operation(node = RightShiftNode.class, rightOperandIsInt = true)
     public Word signedShiftRight(Word val) {
         return box(unbox() >> val.unbox());
@@ -291,11 +327,13 @@
     public Word unsignedShiftRight(Unsigned val) {
         return unsignedShiftRight((Word) val);
     }
+
     @Override
     @Operation(node = UnsignedRightShiftNode.class, rightOperandIsInt = true)
     public Word unsignedShiftRight(int val) {
         return unsignedShiftRight(intParam(val));
     }
+
     @Operation(node = UnsignedRightShiftNode.class, rightOperandIsInt = true)
     public Word unsignedShiftRight(Word val) {
         return box(unbox() >>> val.unbox());
@@ -306,16 +344,19 @@
     public Word and(Signed val) {
         return and((Word) val);
     }
+
     @Override
     @Operation(node = AndNode.class)
     public Word and(Unsigned val) {
         return and((Word) val);
     }
+
     @Override
     @Operation(node = AndNode.class)
     public Word and(int val) {
         return and(intParam(val));
     }
+
     @Operation(node = AndNode.class)
     public Word and(Word val) {
         return box(unbox() & val.unbox());
@@ -326,16 +367,19 @@
     public Word or(Signed val) {
         return or((Word) val);
     }
+
     @Override
     @Operation(node = OrNode.class)
     public Word or(Unsigned val) {
         return or((Word) val);
     }
+
     @Override
     @Operation(node = OrNode.class)
     public Word or(int val) {
         return or(intParam(val));
     }
+
     @Operation(node = OrNode.class)
     public Word or(Word val) {
         return box(unbox() | val.unbox());
@@ -346,16 +390,19 @@
     public Word xor(Signed val) {
         return xor((Word) val);
     }
+
     @Override
     @Operation(node = XorNode.class)
     public Word xor(Unsigned val) {
         return xor((Word) val);
     }
+
     @Override
     @Operation(node = XorNode.class)
     public Word xor(int val) {
         return xor(intParam(val));
     }
+
     @Operation(node = XorNode.class)
     public Word xor(Word val) {
         return box(unbox() ^ val.unbox());
@@ -372,11 +419,13 @@
     public boolean lessThan(Signed val) {
         return lessThan((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.LT)
     public boolean lessThan(int val) {
         return lessThan(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.LT)
     public boolean lessThan(Word val) {
         return unbox() < val.unbox();
@@ -387,11 +436,13 @@
     public boolean lessOrEqual(Signed val) {
         return lessOrEqual((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.LE)
     public boolean lessOrEqual(int val) {
         return lessOrEqual(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.LE)
     public boolean lessOrEqual(Word val) {
         return unbox() <= val.unbox();
@@ -402,11 +453,13 @@
     public boolean greaterThan(Signed val) {
         return greaterThan((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.GT)
     public boolean greaterThan(int val) {
         return greaterThan(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.GT)
     public boolean greaterThan(Word val) {
         return unbox() > val.unbox();
@@ -417,27 +470,30 @@
     public boolean greaterOrEqual(Signed val) {
         return greaterOrEqual((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.GE)
     public boolean greaterOrEqual(int val) {
         return greaterOrEqual(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.GE)
     public boolean greaterOrEqual(Word val) {
         return unbox() >= val.unbox();
     }
 
-
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT)
     public boolean belowThan(Unsigned val) {
         return belowThan((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT)
     public boolean belowThan(int val) {
         return belowThan(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.BT)
     public boolean belowThan(Word val) {
         return UnsignedMath.belowThan(unbox(), val.unbox());
@@ -448,11 +504,13 @@
     public boolean belowOrEqual(Unsigned val) {
         return belowOrEqual((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.BE)
     public boolean belowOrEqual(int val) {
         return belowOrEqual(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.BE)
     public boolean belowOrEqual(Word val) {
         return UnsignedMath.belowOrEqual(unbox(), val.unbox());
@@ -463,11 +521,13 @@
     public boolean aboveThan(Unsigned val) {
         return aboveThan((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.AT)
     public boolean aboveThan(int val) {
         return aboveThan(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.AT)
     public boolean aboveThan(Word val) {
         return UnsignedMath.aboveThan(unbox(), val.unbox());
@@ -478,57 +538,66 @@
     public boolean aboveOrEqual(Unsigned val) {
         return aboveOrEqual((Word) val);
     }
+
     @Override
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.AE)
     public boolean aboveOrEqual(int val) {
         return aboveOrEqual(intParam(val));
     }
+
     @Operation(opcode = Opcode.COMPARISON, condition = Condition.AE)
     public boolean aboveOrEqual(Word val) {
         return UnsignedMath.aboveOrEqual(unbox(), val.unbox());
     }
 
-
     @Override
     @Operation(opcode = Opcode.READ)
     public byte readByte(WordBase offset) {
         return unsafe.getByte(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public char readChar(WordBase offset) {
         return unsafe.getChar(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public short readShort(WordBase offset) {
         return unsafe.getShort(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public int readInt(WordBase offset) {
         return unsafe.getInt(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public long readLong(WordBase offset) {
         return unsafe.getLong(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public float readFloat(WordBase offset) {
         return unsafe.getFloat(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public double readDouble(WordBase offset) {
         return unsafe.getDouble(add((Word) offset).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public Word readWord(WordBase offset) {
         return box(unsafe.getAddress(add((Word) offset).unbox()));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public native Object readObject(WordBase offset);
@@ -538,41 +607,49 @@
     public byte readByte(int offset) {
         return readByte(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public char readChar(int offset) {
         return readChar(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public short readShort(int offset) {
         return readShort(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public int readInt(int offset) {
         return readInt(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public long readLong(int offset) {
         return readLong(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public float readFloat(int offset) {
         return readFloat(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public double readDouble(int offset) {
         return readDouble(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public Word readWord(int offset) {
         return readWord(signed(offset));
     }
+
     @Override
     @Operation(opcode = Opcode.READ)
     public Object readObject(int offset) {
@@ -584,41 +661,49 @@
     public byte readFinalByte(WordBase offset) {
         return readByte(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public char readFinalChar(WordBase offset) {
         return readChar(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public short readFinalShort(WordBase offset) {
         return readShort(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public int readFinalInt(WordBase offset) {
         return readInt(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public long readFinalLong(WordBase offset) {
         return readLong(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public float readFinalFloat(WordBase offset) {
         return readFloat(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public double readFinalDouble(WordBase offset) {
         return readDouble(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public Word readFinalWord(WordBase offset) {
         return readWord(offset);
     }
+
     @Override
     @Operation(opcode = Opcode.READ_FINAL)
     public Object readFinalObject(WordBase offset) {
@@ -630,41 +715,49 @@
     public void writeByte(WordBase offset, byte val) {
         unsafe.putByte(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeChar(WordBase offset, char val) {
         unsafe.putChar(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeShort(WordBase offset, Short val) {
         unsafe.putShort(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeInt(WordBase offset, int val) {
         unsafe.putInt(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeLong(WordBase offset, long val) {
         unsafe.putLong(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeFloat(WordBase offset, float val) {
         unsafe.putFloat(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeDouble(WordBase offset, double val) {
         unsafe.putDouble(add((Word) offset).unbox(), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeWord(WordBase offset, WordBase val) {
         unsafe.putAddress(add((Word) offset).unbox(), ((Word) val).unbox());
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public native void writeObject(WordBase offset, Object val);
@@ -674,41 +767,49 @@
     public void writeByte(int offset, byte val) {
         writeByte(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeChar(int offset, char val) {
         writeChar(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeShort(int offset, short val) {
         writeShort(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeInt(int offset, int val) {
         writeInt(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeLong(int offset, long val) {
         writeLong(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeFloat(int offset, float val) {
         writeFloat(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeDouble(int offset, double val) {
         writeDouble(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeWord(int offset, WordBase val) {
         writeWord(signed(offset), val);
     }
+
     @Override
     @Operation(opcode = Opcode.WRITE)
     public void writeObject(int offset, Object val) {
@@ -717,6 +818,7 @@
 }
 
 final class HostedWord extends Word {
+
     private static final int SMALL_FROM = -1;
     private static final int SMALL_TO = 100;
 
@@ -732,7 +834,7 @@
     private final long rawValue;
 
     private HostedWord(long rawValue) {
-       this.rawValue = rawValue;
+        this.rawValue = rawValue;
     }
 
     protected static Word box(long val) {
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeRewriterPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,8 +38,8 @@
 import com.oracle.graal.word.Word.Operation;
 
 /**
- * Transforms all uses of the {@link Word} class into unsigned operations on {@code int} or {@code long} values,
- * depending on the word kind of the underlying platform.
+ * Transforms all uses of the {@link Word} class into unsigned operations on {@code int} or
+ * {@code long} values, depending on the word kind of the underlying platform.
  */
 public class WordTypeRewriterPhase extends Phase {
 
@@ -87,7 +87,8 @@
             }
         }
 
-        // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are words
+        // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are
+        // words
         for (ObjectEqualsNode objectEqualsNode : graph.getNodes().filter(ObjectEqualsNode.class).snapshot()) {
             ValueNode x = objectEqualsNode.x();
             ValueNode y = objectEqualsNode.y();
@@ -98,7 +99,8 @@
             }
         }
 
-        // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are words
+        // Replace ObjectEqualsNodes with IntegerEqualsNodes where the values being compared are
+        // words
         for (LoadIndexedNode load : graph.getNodes().filter(LoadIndexedNode.class).snapshot()) {
             if (isWord(load)) {
                 load.setStamp(StampFactory.forKind(wordKind));
@@ -217,7 +219,7 @@
 
     private ValueNode nodeClassOp(StructuredGraph graph, Class<? extends ValueNode> nodeClass, ValueNode left, ValueNode right, Invoke invoke) {
         try {
-            Constructor< ? extends ValueNode> constructor = nodeClass.getConstructor(Kind.class, ValueNode.class, ValueNode.class);
+            Constructor<? extends ValueNode> constructor = nodeClass.getConstructor(Kind.class, ValueNode.class, ValueNode.class);
             ValueNode result = graph.add(constructor.newInstance(wordKind, left, right));
             if (result instanceof FixedWithNextNode) {
                 graph.addBeforeFixed(invoke.node(), (FixedWithNextNode) result);
@@ -237,7 +239,6 @@
         ValueNode a = mirror ? right : left;
         ValueNode b = mirror ? left : right;
 
-
         CompareNode comparison;
         if (condition == Condition.EQ || condition == Condition.NE) {
             comparison = new IntegerEqualsNode(a, b);
@@ -261,7 +262,8 @@
         IndexedLocationNode location = IndexedLocationNode.create(locationIdentity, invoke.node().kind(), 0, offset, graph, false);
         ReadNode read = graph.add(new ReadNode(base, location, invoke.node().stamp()));
         graph.addBeforeFixed(invoke.node(), read);
-        // The read must not float outside its block otherwise it may float above an explicit zero check on its base address
+        // The read must not float outside its block otherwise it may float above an explicit zero
+        // check on its base address
         read.dependencies().add(BeginNode.prevBegin(invoke.node()));
         return read;
     }
@@ -289,7 +291,8 @@
         if (node instanceof LoadIndexedNode) {
             ValueNode array = ((LoadIndexedNode) node).array();
             if (array.objectStamp().type() == null) {
-                // There are cases where the array does not have a known type yet. Assume it is not a word type.
+                // There are cases where the array does not have a known type yet. Assume it is not
+                // a word type.
                 // TODO disallow LoadIndexedNode for word arrays?
                 return false;
             }
--- a/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.graal.word/src/com/oracle/graal/word/phases/WordTypeVerificationPhase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,8 +36,8 @@
 import com.oracle.graal.word.Word.Operation;
 
 /**
- * Verifies invariants that must hold for snippet code above and beyond normal
- * bytecode verification.
+ * Verifies invariants that must hold for snippet code above and beyond normal bytecode
+ * verification.
  */
 public class WordTypeVerificationPhase extends Phase {
 
@@ -130,9 +130,7 @@
     }
 
     private static void error(Node node, Node usage, String message) {
-        throw new GraalInternalError(String.format("Snippet verification error: %s" +
-                        "%n   node: %s (%s)" +
-                        "%n  usage: %s (%s)", message, node, sourceLocation(node), usage, sourceLocation(usage)));
+        throw new GraalInternalError(String.format("Snippet verification error: %s" + "%n   node: %s (%s)" + "%n  usage: %s (%s)", message, node, sourceLocation(node), usage, sourceLocation(usage)));
     }
 
     private static String sourceLocation(Node n) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExecuteChildren.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, 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.truffle.api.codegen;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE})
+public @interface ExecuteChildren {
+
+    String[] value();
+
+}
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExtensionAnnotation.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/ExtensionAnnotation.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import java.lang.annotation.*;
 
-
 @Retention(RetentionPolicy.CLASS)
 @Target({ElementType.ANNOTATION_TYPE})
 public @interface ExtensionAnnotation {
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GeneratedBy.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GeneratedBy.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,6 +31,6 @@
 @Target({ElementType.TYPE})
 public @interface GeneratedBy {
 
-    Class< ? > value();
+    Class<?> value();
 
 }
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GuardCheck.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/GuardCheck.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,7 @@
 
 /**
  * 
- *
+ * 
  * @see SpecializationGuard
  */
 @Retention(RetentionPolicy.CLASS)
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/Operation.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.api.codegen;
-
-import java.lang.annotation.*;
-import com.oracle.truffle.api.nodes.*;
-
-@Retention(RetentionPolicy.CLASS)
-@Target({ElementType.TYPE})
-public @interface Operation {
-
-    Class< ? > typeSystem();
-
-    Class<? extends Node> baseClass() default Node.class;
-
-    String[] values() default {};
-
-    String[] shortCircuitValues() default {};
-
-}
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationGuard.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationGuard.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,8 +32,8 @@
 public @interface SpecializationGuard {
 
     /**
-     * Specifies the name of the guard method annotated by {@link GuardCheck} specified as method in the
-     * {@link TypeSystem} or {@link Operation} class.
+     * Specifies the name of the guard method annotated by {@link GuardCheck} specified as method in
+     * the {@link TypeSystem} class.
      */
     String methodName();
 
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationThrows.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/SpecializationThrows.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,7 @@
 @Target({ElementType.METHOD})
 public @interface SpecializationThrows {
 
-    Class< ? extends Throwable> javaClass();
+    Class<? extends Throwable> javaClass();
 
     String transitionTo();
 }
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCast.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCast.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import java.lang.annotation.*;
 
-
 /**
  *
  *
@@ -34,5 +33,4 @@
 @Target({ElementType.METHOD})
 public @interface TypeCast {
 
-
 }
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCheck.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeCheck.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,51 +26,52 @@
 
 /**
  * <p>
- * Provides a way to define a custom type check for a defined type. The name of the annotated method must fit to the
- * pattern is${typeName} (eg. isInteger), where ${typeName} must be a valid type defined in the parent
- * {@link TypeSystem}. The annotated method must have exactly one argument where the type of the argument is the generic
- * type {@link Object} or a more specific one from the {@link TypeSystem}. You can define multiple overloaded
- * {@link TypeCheck} methods for the same type. This can be used to reduce the boxing overhead in type conversions.
+ * Provides a way to define a custom type check for a defined type. The name of the annotated method
+ * must fit to the pattern is${typeName} (eg. isInteger), where ${typeName} must be a valid type
+ * defined in the parent {@link TypeSystem}. The annotated method must have exactly one argument
+ * where the type of the argument is the generic type {@link Object} or a more specific one from the
+ * {@link TypeSystem}. You can define multiple overloaded {@link TypeCheck} methods for the same
+ * type. This can be used to reduce the boxing overhead in type conversions.
  * </p>
- *
+ * 
  * <p>
- * By default the system generates type checks for all types in the parent {@link TypeSystem} which look like the
- * follows:
- *
+ * By default the system generates type checks for all types in the parent {@link TypeSystem} which
+ * look like the follows:
+ * 
  * <pre>
- * &#064;TypeCheck
+ * {@literal @}TypeCheck
  * boolean is${typeName}(Object value) {
  *         return value instanceof ${typeName};
  * }
  * </pre>
- *
+ * 
  * </p>
- *
+ * 
  * <b>Example:</b>
  * <p>
  * A type check for BigInteger with one overloaded optimized variant to reduce boxing.
  * </p>
- *
+ * 
  * <pre>
- *
- *
- * &#064;TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
+ * 
+ * 
+ * {@literal @}TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
  * public abstract class Types {
- *
- *     &#064;TypeCheck
+ * 
+ *     {@literal @}TypeCheck
  *     public boolean isBigInteger(Object value) {
  *         return value instanceof Integer || value instanceof BigInteger;
  *     }
- *
- *     &#064;TypeCheck
+ * 
+ *     {@literal @}TypeCheck
  *     public boolean isBigInteger(int value) {
  *         return true;
  *     }
- *
+ * 
  * }
  * </pre>
- *
- *
+ * 
+ * 
  */
 @Retention(RetentionPolicy.CLASS)
 @Target({ElementType.METHOD})
--- a/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystem.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystem.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,33 +24,32 @@
 
 import java.lang.annotation.*;
 
-import com.oracle.truffle.api.nodes.*;
-
 /**
  * <p>
- * Annotates a type system class that represents type information for a node. Generates code for converting and managing
- * types. Methods contained in the type system may be annotated with {@link TypeCast}, {@link TypeCheck} or
- * {@link GuardCheck}. These methods alter the default behavior of the type system.
+ * Annotates a type system class that represents type information for a node. Generates code for
+ * converting and managing types. Methods contained in the type system may be annotated with
+ * {@link TypeCast}, {@link TypeCheck} or {@link GuardCheck}. These methods alter the default
+ * behavior of the type system.
  * </p>
- *
- *
+ * 
+ * 
  * <b>Example:</b>
  * <p>
- * Shows a <code>@TypeSystem</code> definition with three types. In this example BigIntegers can be also treated as
- * integers if their bit width is less than 32.
+ * Shows a <code>@TypeSystem</code> definition with three types. In this example BigIntegers can be
+ * also treated as integers if their bit width is less than 32.
  * </p>
- *
+ * 
  * <pre>
- *
- * &#064;TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
+ * 
+ * {@literal @}TypeSystem(types = {int.class, BigInteger.class, String.class}, nodeBaseClass = TypedNode.class)
  * public abstract class Types {
- *
- *     &#064;TypeCheck
+ * 
+ *     {@literal @}TypeCheck
  *     public boolean isInteger(Object value) {
  *         return value instanceof Integer || (value instanceof BigInteger &amp;&amp; ((BigInteger) value).bitLength() &lt; Integer.SIZE);
  *     }
- *
- *     &#064;TypeCast
+ * 
+ *     {@literal @}TypeCast
  *     public int asInteger(Object value) {
  *         if (value instanceof Integer) {
  *             return (int) value;
@@ -60,7 +59,7 @@
  *     }
  * }
  * </pre>
- *
+ * 
  * @see TypeCast
  * @see TypeCheck
  * @see GuardCheck
@@ -70,21 +69,9 @@
 public @interface TypeSystem {
 
     /**
-     * Sets the types contained by this type system. The order of types also determines the order of specialization.
-     */
-    Class[] types();
-
-    /**
-     * Specifies whether the node base class has an executeVoid method or not. Operations derived from this type system
-     * will automatically implement executeVoid for all generated nodes. Defaults to false.
+     * Sets the types contained by this type system. The order of types also determines the order of
+     * specialization.
      */
-    boolean hasVoid() default false;
-
-    /**
-     * Specifies the node base class used for generated code that uses this type system. The node base class must extend
-     * {@link Node} and provide a public non-final method <code>${type} execute${typeName}(VirtualFrame)</code> for all
-     * types specified in the types attribute.
-     */
-    Class< ? extends Node> nodeBaseClass();
+    Class[] value();
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.api.codegen/src/com/oracle/truffle/api/codegen/TypeSystemReference.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, 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.truffle.api.codegen;
+
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.CLASS)
+@Target({ElementType.TYPE})
+public @interface TypeSystemReference {
+
+    Class<?> value();
+
+}
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ArgumentsTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,25 +28,26 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-
 /**
  * <h3>Passing Arguments</h3>
- *
+ * 
  * <p>
- * A guest language can pass its own custom arguments when invoking a Truffle method by creating a subclass of
- * {@link Arguments}. When invoking a call target with {@link CallTarget#call(Arguments)}, the arguments can be passed.
- * A Truffle node can access the arguments passed into the Truffle method by using {@link VirtualFrame#getArguments()}.
+ * A guest language can pass its own custom arguments when invoking a Truffle method by creating a
+ * subclass of {@link Arguments}. When invoking a call target with
+ * {@link CallTarget#call(Arguments)}, the arguments can be passed. A Truffle node can access the
+ * arguments passed into the Truffle method by using {@link VirtualFrame#getArguments()}.
  * </p>
- *
+ * 
  * <p>
- * The arguments class should only contain fields that are declared as final. This allows the Truffle runtime to improve
- * optimizations around guest language method calls. Also, the arguments object must never be stored into a field. It
- * should be created immediately before invoking {@link CallTarget#call(Arguments)} and no longer be accessed
- * afterwards.
+ * The arguments class should only contain fields that are declared as final. This allows the
+ * Truffle runtime to improve optimizations around guest language method calls. Also, the arguments
+ * object must never be stored into a field. It should be created immediately before invoking
+ * {@link CallTarget#call(Arguments)} and no longer be accessed afterwards.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FrameTest}.
+ * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FrameTest}
+ * .
  * </p>
  */
 public class ArgumentsTest {
@@ -61,7 +62,9 @@
     }
 
     class TestArguments extends Arguments {
+
         final int[] values;
+
         TestArguments(int... values) {
             this.values = values;
         }
@@ -86,6 +89,7 @@
     }
 
     class TestArgumentNode extends Node {
+
         private final int index;
 
         TestArgumentNode(int index) {
@@ -97,4 +101,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/CallTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,17 +28,18 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-
 /**
  * <h3>Calling Another Tree</h3>
- *
+ * 
  * <p>
- * A guest language implementation can create multiple call targets using the {@link TruffleRuntime#createCallTarget(RootNode)} method.
- * Those call targets can be passed around as normal Java objects and used for calling guest language methods.
+ * A guest language implementation can create multiple call targets using the
+ * {@link TruffleRuntime#createCallTarget(RootNode)} method. Those call targets can be passed around
+ * as normal Java objects and used for calling guest language methods.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ArgumentsTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.ArgumentsTest}.
  * </p>
  */
 public class CallTest {
@@ -70,6 +71,7 @@
     }
 
     class ConstantRootNode extends RootNode {
+
         private final int value;
 
         public ConstantRootNode(int value) {
@@ -82,4 +84,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildNodeTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,20 +33,24 @@
 
 /**
  * <h3>Creating a Child Node</h3>
- *
+ * 
  * <p>
- * Child nodes are stored in the class of the parent node in fields that are marked with the {@link Child} annotation.
- * Before such a field is assigned, {@link Node#adoptChild} must be called. This method automatically establishes a link
- * from the child to the parent. The {@link Node#getParent()} method allows access to this field. Every node also
- * provides the ability to iterate over its children using {@link Node#getChildren()}.</p>
- *
- * <p>A child node field must be declared private and non-final. It may only be assigned in the constructor of the parent
- * node. For changing the structure of the tree at run time, the method {@link Node#replace(Node)} must be used (see
- * {@link ReplaceTest}).
+ * Child nodes are stored in the class of the parent node in fields that are marked with the
+ * {@link Child} annotation. Before such a field is assigned, {@link Node#adoptChild} must be
+ * called. This method automatically establishes a link from the child to the parent. The
+ * {@link Node#getParent()} method allows access to this field. Every node also provides the ability
+ * to iterate over its children using {@link Node#getChildren()}.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ChildrenNodesTest}.
+ * A child node field must be declared private and non-final. It may only be assigned in the
+ * constructor of the parent node. For changing the structure of the tree at run time, the method
+ * {@link Node#replace(Node)} must be used (see {@link ReplaceTest}).
+ * </p>
+ * 
+ * <p>
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.ChildrenNodesTest}.
  * </p>
  */
 public class ChildNodeTest {
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ChildrenNodesTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,17 +32,19 @@
 
 /**
  * <h3>Creating an Array of Children Nodes</h3>
- *
+ * 
  * <p>
- * An array of children nodes can be used as a field in a parent node. The field has to be annotated with
- * {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final. Before assigning the field
- * in the parent node constructor, {@link Node#adoptChildren} must be called in order to update the parent pointers in
- * the child nodes. After filling the array with its first values, it must never be changed. It is only possible to call
- * {@link Node#replace} on a child node.
+ * An array of children nodes can be used as a field in a parent node. The field has to be annotated
+ * with {@link com.oracle.truffle.api.nodes.Node.Children} and must be declared private and final.
+ * Before assigning the field in the parent node constructor, {@link Node#adoptChildren} must be
+ * called in order to update the parent pointers in the child nodes. After filling the array with
+ * its first values, it must never be changed. It is only possible to call {@link Node#replace} on a
+ * child node.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.FinalFieldTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.FinalFieldTest}.
  * </p>
  */
 public class ChildrenNodesTest {
@@ -83,9 +85,9 @@
     }
 
     class TestChildNode extends Node {
+
         public int execute() {
             return 21;
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FinalFieldTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,22 +30,23 @@
 
 /**
  * <h3>Using Final Fields in Node Classes</h3>
- *
+ * 
  * <p>
- * The usage of final fields in node classes is highly encouraged. It is beneficial for performance to declare every
- * field that is not pointing to a child node as final. This gives the Truffle runtime an increased opportunity to
- * optimize this node.
+ * The usage of final fields in node classes is highly encouraged. It is beneficial for performance
+ * to declare every field that is not pointing to a child node as final. This gives the Truffle
+ * runtime an increased opportunity to optimize this node.
  * </p>
- *
+ * 
  * <p>
- * If a node has a value which may change at run time, but will rarely do so, it is recommended to speculate on the
- * field being final. This involves starting executing with a node where this field is final and only if this
- * turns out to be no longer the case, the node is replaced with an alternative implementation of the operation (see
- * {@link ReplaceTest}).
+ * If a node has a value which may change at run time, but will rarely do so, it is recommended to
+ * speculate on the field being final. This involves starting executing with a node where this field
+ * is final and only if this turns out to be no longer the case, the node is replaced with an
+ * alternative implementation of the operation (see {@link ReplaceTest}).
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ReplaceTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.ReplaceTest}.
  * </p>
  */
 public class FinalFieldTest {
@@ -78,6 +79,7 @@
     }
 
     class TestChildNode extends Node {
+
         private final int value;
 
         public TestChildNode(int value) {
@@ -89,4 +91,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameSlotTypeSpecializationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,22 +28,23 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-
 /**
  * <h3>Specializing Frame Slot Types</h3>
- *
+ * 
  * <p>
- * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run time to a more
- * generic type if necessary. The new type of a frame slot can be set using the {@link FrameSlot#setType(Class)} method.
- * It is the responsibility of the language implementor to update the content of currently active frames (using
- * {@link Frame#updateToLatestVersion()}). Also, nodes that depend a specific type of a frame slot must be replaced.
- * Such node can register a listener that implements {@link FrameSlotTypeListener} using
- * {@link FrameSlot#registerOneShotTypeListener(FrameSlotTypeListener)}. The event of a type change on the frame slot
- * will fire only once for the next upcoming change.
+ * Dynamically typed languages can speculate on the type of a frame slot and only fall back at run
+ * time to a more generic type if necessary. The new type of a frame slot can be set using the
+ * {@link FrameSlot#setType(Class)} method. It is the responsibility of the language implementor to
+ * update the content of currently active frames (using {@link Frame#updateToLatestVersion()}).
+ * Also, nodes that depend a specific type of a frame slot must be replaced. Such node can register
+ * a listener that implements {@link FrameSlotTypeListener} using
+ * {@link FrameSlot#registerOneShotTypeListener(FrameSlotTypeListener)}. The event of a type change
+ * on the frame slot will fire only once for the next upcoming change.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.ReturnTypeSpecializationTest}.
  * </p>
  */
 public class FrameSlotTypeSpecializationTest {
@@ -79,10 +80,12 @@
     }
 
     abstract class TestChildNode extends Node {
+
         abstract Object execute(VirtualFrame frame);
     }
 
     abstract class FrameSlotNode extends TestChildNode {
+
         protected final FrameSlot slot;
 
         public FrameSlotNode(FrameSlot slot) {
@@ -100,6 +103,7 @@
     }
 
     class IntAssignLocal extends FrameSlotNode implements FrameSlotTypeListener {
+
         @Child private TestChildNode value;
 
         IntAssignLocal(FrameSlot slot, TestChildNode value) {
@@ -122,7 +126,7 @@
         }
 
         @Override
-        public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) {
+        public void typeChanged(FrameSlot changedSlot, Class<?> oldType) {
             if (changedSlot.getType() == Object.class) {
                 this.replace(new ObjectAssignLocal(changedSlot, value));
             }
@@ -130,6 +134,7 @@
     }
 
     class ObjectAssignLocal extends FrameSlotNode {
+
         @Child private TestChildNode value;
 
         ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
@@ -146,6 +151,7 @@
     }
 
     class IntReadLocal extends FrameSlotNode implements FrameSlotTypeListener {
+
         IntReadLocal(FrameSlot slot) {
             super(slot);
             slot.registerOneShotTypeListener(this);
@@ -157,7 +163,7 @@
         }
 
         @Override
-        public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) {
+        public void typeChanged(FrameSlot changedSlot, Class<?> oldType) {
             if (changedSlot.getType() == Object.class) {
                 this.replace(new ObjectReadLocal(changedSlot));
             }
@@ -165,6 +171,7 @@
     }
 
     class ObjectReadLocal extends FrameSlotNode {
+
         ObjectReadLocal(FrameSlot slot) {
             super(slot);
         }
@@ -175,4 +182,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/FrameTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,26 +30,29 @@
 
 /**
  * <h3>Storing Values in Frame Slots</h3>
- *
+ * 
  * <p>
- * The frame is the preferred data structure for passing values between nodes. It can in particular be used for storing
- * the values of local variables of the guest language. The {@link FrameDescriptor} represents the current structure of
- * the frame. The method {@link FrameDescriptor#addFrameSlot(String, Class)} can be used to create predefined frame
- * slots. The setter and getter methods in the {@link Frame} class can be used to access the current value of a
- * particular frame slot.
+ * The frame is the preferred data structure for passing values between nodes. It can in particular
+ * be used for storing the values of local variables of the guest language. The
+ * {@link FrameDescriptor} represents the current structure of the frame. The method
+ * {@link FrameDescriptor#addFrameSlot(String, Class)} can be used to create predefined frame slots.
+ * The setter and getter methods in the {@link Frame} class can be used to access the current value
+ * of a particular frame slot.
  * </p>
- *
+ * 
  * <p>
- * There are five primitive types for slots available: {@link java.lang.Boolean}, @{link java.lang.Integer},
- * {@link java.lang.Long}, {@link java.lang.Float}, and {@link java.lang.Double}. It is encouraged to use those types
- * whenever possible. Dynamically typed languages can speculate on the type of a value fitting into a primitive (see
- * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular primitive types, its value
- * may only be accessed with the repectively typed getter method ({@link Frame#getBoolean}, {@link Frame#getInt},
- * {@link Frame#getLong}, {@link Frame#getFloat}, or {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean},
- * {@link Frame#setInt}, {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the
- * {@link Frame} class.
+ * There are five primitive types for slots available: {@link java.lang.Boolean}, @{link
+ * java.lang.Integer}, {@link java.lang.Long}, {@link java.lang.Float}, and {@link java.lang.Double}
+ * . It is encouraged to use those types whenever possible. Dynamically typed languages can
+ * speculate on the type of a value fitting into a primitive (see
+ * {@link FrameSlotTypeSpecializationTest}). When a frame slot is of one of those particular
+ * primitive types, its value may only be accessed with the repectively typed getter method (
+ * {@link Frame#getBoolean}, {@link Frame#getInt}, {@link Frame#getLong}, {@link Frame#getFloat}, or
+ * {@link Frame#getDouble}) or setter method ({@link Frame#setBoolean}, {@link Frame#setInt},
+ * {@link Frame#setLong}, {@link Frame#setFloat}, or {@link Frame#setDouble}) in the {@link Frame}
+ * class.
  * </p>
- *
+ * 
  * <p>
  * The next part of the Truffle API introduction is at
  * {@link com.oracle.truffle.api.test.FrameSlotTypeSpecializationTest}.
@@ -85,10 +88,12 @@
     }
 
     abstract class TestChildNode extends Node {
+
         abstract int execute(VirtualFrame frame);
     }
 
     abstract class FrameSlotNode extends TestChildNode {
+
         protected final FrameSlot slot;
 
         public FrameSlotNode(FrameSlot slot) {
@@ -97,6 +102,7 @@
     }
 
     class AssignLocal extends FrameSlotNode {
+
         AssignLocal(FrameSlot slot) {
             super(slot);
         }
@@ -109,6 +115,7 @@
     }
 
     class ReadLocal extends FrameSlotNode {
+
         ReadLocal(FrameSlot slot) {
             super(slot);
         }
@@ -119,4 +126,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReplaceTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,22 +32,21 @@
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
 
-
 /**
  * <h3>Replacing Nodes at Run Time</h3>
- *
+ * 
  * <p>
- * The structure of the Truffle tree can be changed at run time by replacing nodes using the {@link Node#replace(Node)}
- * method. This method will automatically change the child pointer in the parent of the node and replace it with a
- * pointer to the new node.
+ * The structure of the Truffle tree can be changed at run time by replacing nodes using the
+ * {@link Node#replace(Node)} method. This method will automatically change the child pointer in the
+ * parent of the node and replace it with a pointer to the new node.
  * </p>
- *
+ * 
  * <p>
- * Replacing nodes is a costly operation, so it should not happen too often. The convention is that the implementation
- * of the Truffle nodes should ensure that there are maximal a small (and constant) number of node replacements per
- * Truffle node.
+ * Replacing nodes is a costly operation, so it should not happen too often. The convention is that
+ * the implementation of the Truffle nodes should ensure that there are maximal a small (and
+ * constant) number of node replacements per Truffle node.
  * </p>
- *
+ * 
  * <p>
  * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.CallTest}.
  * </p>
@@ -99,10 +98,12 @@
     }
 
     abstract class ValueNode extends Node {
+
         abstract int execute();
     }
 
     class UnresolvedNode extends ValueNode {
+
         private final String value;
 
         public UnresolvedNode(String value) {
@@ -118,6 +119,7 @@
     }
 
     class ResolvedNode extends ValueNode {
+
         private final int value;
 
         ResolvedNode(int value) {
@@ -130,4 +132,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/ReturnTypeSpecializationTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,14 +30,15 @@
 
 /**
  * <h3>Specializing Return Types</h3>
- *
+ * 
  * <p>
- * In order to avoid boxing and/or type casts on the return value of a node, the return value the method for executing a
- * node can have a specific type and need not be of type {@link java.lang.Object}. For dynamically typed languages, this
- * return type is something that should be speculated on. When the speculation fails and the child node cannot return
- * the appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the result to the
- * caller. In such a case, the caller must rewrite itself to a more general version in oder to avoid future failures of
- * this kind.
+ * In order to avoid boxing and/or type casts on the return value of a node, the return value the
+ * method for executing a node can have a specific type and need not be of type
+ * {@link java.lang.Object}. For dynamically typed languages, this return type is something that
+ * should be speculated on. When the speculation fails and the child node cannot return the
+ * appropriate type of value, it can use an {@link UnexpectedResultException} to still pass the
+ * result to the caller. In such a case, the caller must rewrite itself to a more general version in
+ * oder to avoid future failures of this kind.
  * </p>
  */
 public class ReturnTypeSpecializationTest {
@@ -73,6 +74,7 @@
     }
 
     abstract class TestChildNode extends Node {
+
         abstract Object execute(VirtualFrame frame);
 
         int executeInt(VirtualFrame frame) throws UnexpectedResultException {
@@ -85,6 +87,7 @@
     }
 
     abstract class FrameSlotNode extends TestChildNode {
+
         protected final FrameSlot slot;
 
         public FrameSlotNode(FrameSlot slot) {
@@ -102,6 +105,7 @@
     }
 
     class IntAssignLocal extends FrameSlotNode implements FrameSlotTypeListener {
+
         @Child private TestChildNode value;
 
         IntAssignLocal(FrameSlot slot, TestChildNode value) {
@@ -123,7 +127,7 @@
         }
 
         @Override
-        public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) {
+        public void typeChanged(FrameSlot changedSlot, Class<?> oldType) {
             if (changedSlot.getType() == Object.class) {
                 this.replace(new ObjectAssignLocal(changedSlot, value));
             }
@@ -131,6 +135,7 @@
     }
 
     class ObjectAssignLocal extends FrameSlotNode {
+
         @Child private TestChildNode value;
 
         ObjectAssignLocal(FrameSlot slot, TestChildNode value) {
@@ -147,6 +152,7 @@
     }
 
     class IntReadLocal extends FrameSlotNode implements FrameSlotTypeListener {
+
         IntReadLocal(FrameSlot slot) {
             super(slot);
             slot.registerOneShotTypeListener(this);
@@ -163,7 +169,7 @@
         }
 
         @Override
-        public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) {
+        public void typeChanged(FrameSlot changedSlot, Class<?> oldType) {
             if (changedSlot.getType() == Object.class) {
                 this.replace(new ObjectReadLocal(changedSlot));
             }
@@ -171,6 +177,7 @@
     }
 
     class ObjectReadLocal extends FrameSlotNode {
+
         ObjectReadLocal(FrameSlot slot) {
             super(slot);
         }
@@ -181,4 +188,3 @@
         }
     }
 }
-
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/RootNodeTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,18 +30,20 @@
 
 /**
  * <h3>Creating a Root Node</h3>
- *
+ * 
  * <p>
- * A Truffle root node is the entry point into a Truffle tree that represents a guest language method. It contains a
- * {@link RootNode#execute(VirtualFrame)} method that can return a {@link java.lang.Object} value as the result of the
- * guest language method invocation. This method must however never be called directly. Instead, the Truffle runtime
- * must be used to create a {@link CallTarget} object from a root node using the
- * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be executed using the
- * {@link CallTarget#call()} method or one of its overloads.
+ * A Truffle root node is the entry point into a Truffle tree that represents a guest language
+ * method. It contains a {@link RootNode#execute(VirtualFrame)} method that can return a
+ * {@link java.lang.Object} value as the result of the guest language method invocation. This method
+ * must however never be called directly. Instead, the Truffle runtime must be used to create a
+ * {@link CallTarget} object from a root node using the
+ * {@link TruffleRuntime#createCallTarget(RootNode)} method. This call target object can then be
+ * executed using the {@link CallTarget#call()} method or one of its overloads.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.ChildNodeTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.ChildNodeTest}.
  * </p>
  */
 public class RootNodeTest {
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/TruffleRuntimeTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,16 +28,18 @@
 
 /**
  * <h3>Accessing the Truffle Runtime</h3>
- *
+ * 
  * <p>
  * The Truffle runtime can be accessed at any point in time globally using the static method
- * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime object with an
- * identifying name. A Java Virtual Machine implementation can chose to replace the default implementation of the
- * {@link TruffleRuntime} interface with its own implementation for providing improved performance.
+ * {@link Truffle#getRuntime()}. This method is guaranteed to return a non-null Truffle runtime
+ * object with an identifying name. A Java Virtual Machine implementation can chose to replace the
+ * default implementation of the {@link TruffleRuntime} interface with its own implementation for
+ * providing improved performance.
  * </p>
- *
+ * 
  * <p>
- * The next part of the Truffle API introduction is at {@link com.oracle.truffle.api.test.RootNodeTest}.
+ * The next part of the Truffle API introduction is at
+ * {@link com.oracle.truffle.api.test.RootNodeTest}.
  * </p>
  */
 public class TruffleRuntimeTest {
--- a/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/package-info.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/package-info.java	Fri Feb 01 17:06:26 2013 +0100
@@ -51,4 +51,3 @@
  */
 package com.oracle.truffle.api.test;
 
-
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Arguments.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/Arguments.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,22 +24,23 @@
 
 /**
  * Base class for arguments passed to guest language methods via the
- * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} method. A guest language create a
- * subclass with immutable fields representing the arguments passed to a guest language method. The {@link Arguments}
- * object must be created immediately before a method call and it must not be stored in a field or cast to
- * {@link java.lang.Object}.
+ * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} method. A guest
+ * language create a subclass with immutable fields representing the arguments passed to a guest
+ * language method. The {@link Arguments} object must be created immediately before a method call
+ * and it must not be stored in a field or cast to {@link java.lang.Object}.
  */
 public class Arguments {
 
     /**
      * Constant that can be used as an argument to
-     * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} in case no arguments should be
-     * supplied.
+     * {@link CallTarget#call(com.oracle.truffle.api.frame.PackedFrame, Arguments)} in case no
+     * arguments should be supplied.
      */
     public static final Arguments EMPTY_ARGUMENTS = new Arguments();
 
     /**
-     * Constructs an empty {@link Arguments} instance. Guest languages should create a subclass to specify their own arguments.
+     * Constructs an empty {@link Arguments} instance. Guest languages should create a subclass to
+     * specify their own arguments.
      */
     protected Arguments() {
     }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CallTarget.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,12 +26,14 @@
 
 /**
  * Represents the target of a call. Instances of this interface can be created using the
- * {@link TruffleRuntime#createCallTarget(com.oracle.truffle.api.nodes.RootNode, FrameDescriptor)} method.
+ * {@link TruffleRuntime#createCallTarget(com.oracle.truffle.api.nodes.RootNode, FrameDescriptor)}
+ * method.
  */
 public abstract class CallTarget {
 
     /**
      * Calls this target as a root method and without arguments.
+     * 
      * @return the return result of the call
      */
     public final Object call() {
@@ -40,6 +42,7 @@
 
     /**
      * Calls this target with a caller frame and no arguments.
+     * 
      * @param caller the caller frame
      * @return the return result of the call
      */
@@ -49,6 +52,7 @@
 
     /**
      * Calls this target as a root method passing arguments.
+     * 
      * @param arguments the arguments that should be passed to the callee
      * @return the return result of the call
      */
@@ -58,6 +62,7 @@
 
     /**
      * Calls this target passing a caller frame and arguments.
+     * 
      * @param caller the caller frame
      * @param arguments the arguments that should be passed to the callee
      * @return the return result of the call
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,25 +26,34 @@
 import com.oracle.truffle.api.nodes.*;
 
 /**
- * Interface representing a Truffle runtime object. The runtime is responsible for creating call targets and performing optimizations for them.
+ * Interface representing a Truffle runtime object. The runtime is responsible for creating call
+ * targets and performing optimizations for them.
  */
 public interface TruffleRuntime {
+
     /**
      * Name describing this runtime implementation for debugging purposes.
+     * 
      * @return the name as a String
      */
     String getName();
 
     /**
      * Creates a new call target for a given root node.
-     * @param rootNode the root node whose {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method represents the entry point
+     * 
+     * @param rootNode the root node whose
+     *            {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method
+     *            represents the entry point
      * @return the new call target object
      */
     CallTarget createCallTarget(RootNode rootNode);
 
     /**
      * Creates a new call target for a given root node and a given frame descriptor.
-     * @param rootNode the root node whose {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method represents the entry point
+     * 
+     * @param rootNode the root node whose
+     *            {@link RootNode#execute(com.oracle.truffle.api.frame.VirtualFrame)} method
+     *            represents the entry point
      * @param frameDescriptor the descriptor used for creating a new frame at each invocation
      * @return the new call target object
      */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/DefaultTypeConversion.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/DefaultTypeConversion.java	Fri Feb 01 17:06:26 2013 +0100
@@ -38,12 +38,12 @@
     }
 
     @Override
-    public Class< ? > getTopType() {
+    public Class<?> getTopType() {
         return Object.class;
     }
 
     @Override
-    public Object convertTo(Class< ? > targetType, Object value) {
+    public Object convertTo(Class<?> targetType, Object value) {
         return value;
     }
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/Frame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,8 @@
 import com.oracle.truffle.api.*;
 
 /**
- * Represents a frame containing values of local variables of the guest language. Instances of this type must not be
- * stored in a field or cast to {@link java.lang.Object}.
+ * Represents a frame containing values of local variables of the guest language. Instances of this
+ * type must not be stored in a field or cast to {@link java.lang.Object}.
  */
 public interface Frame {
 
@@ -37,7 +37,7 @@
 
     /**
      * Read access to a local variable of type {@link Object}.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -45,7 +45,7 @@
 
     /**
      * Write access to a local variable of type {@link Object}.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
@@ -53,7 +53,7 @@
 
     /**
      * Read access to a local variable of type boolean.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -61,7 +61,7 @@
 
     /**
      * Write access to a local variable of type boolean.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
@@ -69,7 +69,7 @@
 
     /**
      * Read access to a local variable of type int.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -77,7 +77,7 @@
 
     /**
      * Write access to a local variable of type int.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
@@ -85,7 +85,7 @@
 
     /**
      * Read access to a local variable of type long.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -93,7 +93,7 @@
 
     /**
      * Write access to a local variable of type long.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
@@ -101,7 +101,7 @@
 
     /**
      * Read access to a local variable of type float.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -109,7 +109,7 @@
 
     /**
      * Write access to a local variable of type float.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
@@ -117,7 +117,7 @@
 
     /**
      * Read access to a local variable of type double.
-     *
+     * 
      * @param slot the slot of the local variable
      * @return the current value of the local variable
      */
@@ -125,7 +125,7 @@
 
     /**
      * Write access to a local variable of type double.
-     *
+     * 
      * @param slot the slot of the local variable
      * @param value the new value of the local variable
      */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameDescriptor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import java.util.*;
 
 /**
- * Descriptor of the slots of frame objects. Multiple frame instances are associated with one such descriptor.
+ * Descriptor of the slots of frame objects. Multiple frame instances are associated with one such
+ * descriptor.
  */
 public final class FrameDescriptor {
 
@@ -77,7 +78,7 @@
         return slots.size();
     }
 
-    public List< ? extends FrameSlot> getSlots() {
+    public List<? extends FrameSlot> getSlots() {
         return Collections.unmodifiableList(slots);
     }
 
@@ -100,10 +101,10 @@
 class TypeChangeFrameVersionImpl extends FrameVersionImpl implements FrameVersion.TypeChange {
 
     private final FrameSlotImpl slot;
-    private final Class< ? > oldType;
-    private final Class< ? > newType;
+    private final Class<?> oldType;
+    private final Class<?> newType;
 
-    protected TypeChangeFrameVersionImpl(FrameSlotImpl slot, Class< ? > oldType, Class< ? > newType) {
+    protected TypeChangeFrameVersionImpl(FrameSlotImpl slot, Class<?> oldType, Class<?> newType) {
         this.slot = slot;
         this.oldType = oldType;
         this.newType = newType;
@@ -121,10 +122,10 @@
     private final FrameDescriptor descriptor;
     private final String name;
     private final int index;
-    private Class< ? > type;
+    private Class<?> type;
     private ArrayList<FrameSlotTypeListener> listeners;
 
-    protected FrameSlotImpl(FrameDescriptor descriptor, String name, int index, Class< ? > type) {
+    protected FrameSlotImpl(FrameDescriptor descriptor, String name, int index, Class<?> type) {
         this.descriptor = descriptor;
         this.name = name;
         this.index = index;
@@ -140,11 +141,11 @@
         return index;
     }
 
-    public Class< ? > getType() {
+    public Class<?> getType() {
         return type;
     }
 
-    protected Object getValue(Class< ? > accessType, Frame frame) {
+    protected Object getValue(Class<?> accessType, Frame frame) {
         if (accessType == Integer.class) {
             return frame.getInt(this);
         } else if (accessType == Long.class) {
@@ -158,7 +159,7 @@
         }
     }
 
-    protected void setValue(Class< ? > accessType, Frame frame, Object value) {
+    protected void setValue(Class<?> accessType, Frame frame, Object value) {
         Object newValue = descriptor.typeConversion.convertTo(accessType, value);
         if (accessType == Integer.class) {
             frame.setInt(this, (Integer) newValue);
@@ -173,8 +174,8 @@
         }
     }
 
-    public void setType(final Class< ? > type) {
-        final Class< ? > oldType = this.type;
+    public void setType(final Class<?> type) {
+        final Class<?> oldType = this.type;
         this.type = type;
         ArrayList<FrameSlotTypeListener> oldListeners = this.listeners;
         this.listeners = null;
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlot.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,9 +26,14 @@
  * A slot in a frame that can store a value of a given type.
  */
 public interface FrameSlot {
+
     String getName();
+
     int getIndex();
-    Class< ? > getType();
-    void setType(Class< ? > type);
+
+    Class<?> getType();
+
+    void setType(Class<?> type);
+
     void registerOneShotTypeListener(FrameSlotTypeListener listener);
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotTypeListener.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/FrameSlotTypeListener.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,5 +26,6 @@
  * Listener for the event of a type change of a frame slot.
  */
 public interface FrameSlotTypeListener {
-    void typeChanged(FrameSlot slot, Class< ? > oldType);
+
+    void typeChanged(FrameSlot slot, Class<?> oldType);
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/MaterializedFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/MaterializedFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,10 +23,11 @@
 package com.oracle.truffle.api.frame;
 
 /**
- * Represents a materialized frame containing values of local variables of the guest language. It can be created using
- * the {@link VirtualFrame#materialize()} method. Instances of this type are the only frame instances that may be stored
- * in fields or cast to {@link java.lang.Object}. In contrast to a {@link VirtualFrame}, a {@link MaterializedFrame} can
- * no longer be packed and it also does not provide access to the caller frame.
+ * Represents a materialized frame containing values of local variables of the guest language. It
+ * can be created using the {@link VirtualFrame#materialize()} method. Instances of this type are
+ * the only frame instances that may be stored in fields or cast to {@link java.lang.Object}. In
+ * contrast to a {@link VirtualFrame}, a {@link MaterializedFrame} can no longer be packed and it
+ * also does not provide access to the caller frame.
  */
 public interface MaterializedFrame extends Frame {
 }
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/NativeFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,8 +25,8 @@
 import com.oracle.truffle.api.*;
 
 /**
- * Represents a native frame without any local variables. Instances of this type must not be stored in a field or cast
- * to {@link java.lang.Object}.
+ * Represents a native frame without any local variables. Instances of this type must not be stored
+ * in a field or cast to {@link java.lang.Object}.
  */
 public class NativeFrame implements VirtualFrame, PackedFrame {
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/PackedFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,14 +23,16 @@
 package com.oracle.truffle.api.frame;
 
 /**
- * Represents a packed frame that represents a virtual frame. A packed frame instance can be retrieved with the
- * {@link VirtualFrame#pack()} method. It can be converted back into a virtual frame using {@link PackedFrame#unpack()}.
- * Instances of this type must not be stored in a field or cast to {@link java.lang.Object}.
+ * Represents a packed frame that represents a virtual frame. A packed frame instance can be
+ * retrieved with the {@link VirtualFrame#pack()} method. It can be converted back into a virtual
+ * frame using {@link PackedFrame#unpack()}. Instances of this type must not be stored in a field or
+ * cast to {@link java.lang.Object}.
  */
 public interface PackedFrame {
 
     /**
      * Unpacks this frame and converts it back to a virtual frame.
+     * 
      * @return the virtual frame that was the content of this packed frame
      */
     VirtualFrame unpack();
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/TypeConversion.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/TypeConversion.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
  * Interface for defining type conversions for frame slot values.
  */
 public interface TypeConversion {
+
     Class<?> getTopType();
 
     Object convertTo(Class<?> targetType, Object value);
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/frame/VirtualFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,35 +25,38 @@
 import com.oracle.truffle.api.*;
 
 /**
- * Represents a frame containing values of local variables of the guest language. Instances of this type must not be
- * stored in a field or cast to {@link java.lang.Object}. If this is necessary, the frame must be explicitly converted
- * into a materialized frame using the {@link VirtualFrame#materialize()} method. Whenever fast access to the local
- * variables of a frame is no longer necessary, a virtual frame should be converted into a packed frame using the
+ * Represents a frame containing values of local variables of the guest language. Instances of this
+ * type must not be stored in a field or cast to {@link java.lang.Object}. If this is necessary, the
+ * frame must be explicitly converted into a materialized frame using the
+ * {@link VirtualFrame#materialize()} method. Whenever fast access to the local variables of a frame
+ * is no longer necessary, a virtual frame should be converted into a packed frame using the
  * {@link VirtualFrame#pack()} method.
  */
 public interface VirtualFrame extends Frame {
 
     /**
-     * Converts this virtual frame into a packed frame that has no longer direct access to the local variables. This
-     * packing is an important hint to the Truffle optimizer and therefore passing around a {@link PackedFrame} should
-     * be preferred over passing around a {@link VirtualFrame} when the probability that an unpacking will occur is low.
-     *
+     * Converts this virtual frame into a packed frame that has no longer direct access to the local
+     * variables. This packing is an important hint to the Truffle optimizer and therefore passing
+     * around a {@link PackedFrame} should be preferred over passing around a {@link VirtualFrame}
+     * when the probability that an unpacking will occur is low.
+     * 
      * @return the packed frame
      */
     PackedFrame pack();
 
     /**
-     * Accesses the caller frame passed in via {@link CallTarget#call}. To get full access, it must be first unpacked
-     * using {@link PackedFrame#unpack()}.
-     *
+     * Accesses the caller frame passed in via {@link CallTarget#call}. To get full access, it must
+     * be first unpacked using {@link PackedFrame#unpack()}.
+     * 
      * @return the caller frame or null if this was a root method call
      */
     PackedFrame getCaller();
 
     /**
-     * Materializes this frame, which allows it to be stored in a field or cast to {@link java.lang.Object}. The frame
-     * however looses the ability to be packed or to access the caller frame.
-     *
+     * Materializes this frame, which allows it to be stored in a field or cast to
+     * {@link java.lang.Object}. The frame however looses the ability to be packed or to access the
+     * caller frame.
+     * 
      * @return the new materialized frame
      */
     MaterializedFrame materialize();
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultMaterializedFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,6 +26,7 @@
 import com.oracle.truffle.api.frame.*;
 
 final class DefaultMaterializedFrame implements MaterializedFrame {
+
     private final DefaultVirtualFrame wrapped;
 
     protected DefaultMaterializedFrame(DefaultVirtualFrame wrapped) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultPackedFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultPackedFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 import com.oracle.truffle.api.frame.*;
 
 final class DefaultPackedFrame implements PackedFrame {
+
     private final DefaultVirtualFrame wrapped;
 
     protected DefaultPackedFrame(DefaultVirtualFrame wrapped) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultTruffleRuntime.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,8 @@
 import com.oracle.truffle.api.nodes.*;
 
 /**
- * Default implementation of the Truffle runtime if the virtual machine does not provide a better performing alternative.
+ * Default implementation of the Truffle runtime if the virtual machine does not provide a better
+ * performing alternative.
  */
 public final class DefaultTruffleRuntime implements TruffleRuntime {
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/impl/DefaultVirtualFrame.java	Fri Feb 01 17:06:26 2013 +0100
@@ -49,7 +49,8 @@
         this.arguments = arguments;
         this.currentVersion = descriptor.getCurrentVersion();
         this.locals = new Object[descriptor.getSize()];
-        // The tags are only needed for assertion checking, so initialize the field only when assertions are enabled
+        // The tags are only needed for assertion checking, so initialize the field only when
+        // assertions are enabled
         assert (this.tags = new Class[descriptor.getSize()]) != null;
     }
 
@@ -133,7 +134,7 @@
         set(slot, Double.class, value);
     }
 
-    private Object get(FrameSlot slot, Class< ? > accessType, Object defaultValue) {
+    private Object get(FrameSlot slot, Class<?> accessType, Object defaultValue) {
         Object value = locals[slot.getIndex()];
         assert verifyGet(slot, accessType, value);
         if (value == null) {
@@ -143,9 +144,9 @@
         }
     }
 
-    private boolean verifyGet(FrameSlot slot, Class< ? > accessType, Object value) {
+    private boolean verifyGet(FrameSlot slot, Class<?> accessType, Object value) {
         assert descriptor.getSlots().get(slot.getIndex()) == slot;
-        Class< ? > tag = tags[slot.getIndex()];
+        Class<?> tag = tags[slot.getIndex()];
         if (value == null) {
             assert tag == null || tag == Object.class;
         } else {
@@ -154,12 +155,12 @@
         return true;
     }
 
-    private void set(FrameSlot slot, Class< ? > accessType, Object value) {
+    private void set(FrameSlot slot, Class<?> accessType, Object value) {
         assert verifySet(slot, accessType, value);
         locals[slot.getIndex()] = value;
     }
 
-    private boolean verifySet(FrameSlot slot, Class< ? > accessType, Object value) {
+    private boolean verifySet(FrameSlot slot, Class<?> accessType, Object value) {
         assert descriptor.getSlots().get(slot.getIndex()) == slot;
         tags[slot.getIndex()] = accessType;
         assert accessType.isAssignableFrom(slot.getType()) : "Local variable " + slot + ": " + accessType + " is not assignable from " + slot.getType();
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/ExactMath.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/ExactMath.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,8 +23,9 @@
 package com.oracle.truffle.api.intrinsics;
 
 /**
- * This class contains methods that will be part of java.lang.Math starting with JDK 8. Until JDK 8 is release, we
- * duplicate them here because they are generally useful for dynamic language implementations.
+ * This class contains methods that will be part of java.lang.Math starting with JDK 8. Until JDK 8
+ * is release, we duplicate them here because they are generally useful for dynamic language
+ * implementations.
  */
 public class ExactMath {
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/intrinsics/TruffleIntrinsics.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,14 +28,16 @@
 public final class TruffleIntrinsics {
 
     /**
-     * Specifies that the compiler should put a deoptimization point at this position that will continue execution in the interpreter.
-     * Should be used to cut off cold paths that should not be part of the compiled machine code.
+     * Specifies that the compiler should put a deoptimization point at this position that will
+     * continue execution in the interpreter. Should be used to cut off cold paths that should not
+     * be part of the compiled machine code.
      */
     public static void deoptimize() {
     }
 
     /**
-     * Checks whether the Thread has been interrupted in the interpreter in order to avoid endless loops. The compiled code may choose a more efficient implementation.
+     * Checks whether the Thread has been interrupted in the interpreter in order to avoid endless
+     * loops. The compiled code may choose a more efficient implementation.
      */
     public static void checkThreadInterrupted() {
         if (Thread.currentThread().isInterrupted()) {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ExplodeLoop.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/ExplodeLoop.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,8 @@
 import java.lang.annotation.*;
 
 /**
- * Specifies for a method that the loops with constant number of invocations should be fully unrolled.
+ * Specifies for a method that the loops with constant number of invocations should be fully
+ * unrolled.
  */
 @Retention(RetentionPolicy.RUNTIME)
 @Target(ElementType.METHOD)
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/GraphPrintVisitor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -235,7 +235,8 @@
 
     protected void setNodeProperty(Object node, String propertyName, Object value) {
         Element nodeElem = getElementByObject(node);
-        Element propElem = getPropertyElement(node, propertyName); // if property exists, replace its value
+        Element propElem = getPropertyElement(node, propertyName); // if property exists, replace
+                                                                   // its value
         if (null == propElem) { // if property doesn't exist, create one
             propElem = dom.createElement("p");
             propElem.setAttribute("name", propertyName);
@@ -347,37 +348,46 @@
     }
 
     public class GraphPrintAdapter {
+
         public void createElementForNode(Object node) {
             GraphPrintVisitor.this.createElementForNode(node);
         }
+
         public void visit(Object node) {
             GraphPrintVisitor.this.visit(node);
         }
+
         public void connectNodes(Object node, Object child) {
             GraphPrintVisitor.this.connectNodes(node, child);
         }
+
         public void setNodeProperty(Object node, String propertyName, Object value) {
             GraphPrintVisitor.this.setNodeProperty(node, propertyName, value);
         }
     }
 
     public interface GraphPrintHandler {
+
         void visit(Object node, GraphPrintAdapter gPrinter);
     }
 
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.TYPE)
     public @interface CustomGraphPrintHandler {
+
         Class<? extends GraphPrintHandler> handler();
     }
+
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.TYPE)
     public @interface NullGraphPrintHandler {
     }
+
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.TYPE)
     public @interface GraphDuplicate {
     }
+
     @Retention(RetentionPolicy.RUNTIME)
     @Target(ElementType.FIELD)
     public @interface HiddenField {
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Fri Feb 01 17:06:26 2013 +0100
@@ -54,8 +54,9 @@
     }
 
     /**
-     * Method that updates the link to the parent in the array of specified new child nodes to this node.
-     *
+     * Method that updates the link to the parent in the array of specified new child nodes to this
+     * node.
+     * 
      * @param newChildren the array of new children whose parent should be updated
      * @return the array of new children
      */
@@ -70,7 +71,7 @@
 
     /**
      * Method that updates the link to the parent in the specified new child node to this node.
-     *
+     * 
      * @param newChild the new child whose parent should be updated
      * @return the new child
      */
@@ -82,9 +83,9 @@
     }
 
     /**
-     * Returns properties of this node interesting for debugging and can be overwritten by subclasses to add their own
-     * custom properties.
-     *
+     * Returns properties of this node interesting for debugging and can be overwritten by
+     * subclasses to add their own custom properties.
+     * 
      * @return the properties as a key/value hash map
      */
     public Map<String, Object> getDebugProperties() {
@@ -94,7 +95,7 @@
 
     /**
      * The current parent node of this node.
-     *
+     * 
      * @return the parent node
      */
     public final Node getParent() {
@@ -103,7 +104,7 @@
 
     /**
      * Replaces one child of this node with another node.
-     *
+     * 
      * @param oldChild the old child
      * @param newChild the new child that should replace the old child
      * @return the new child
@@ -116,7 +117,7 @@
 
     /**
      * Replaces this node with another node.
-     *
+     * 
      * @param newNode the new node that is the replacement
      * @param reason a description of the reason for the replacement
      * @return the new node
@@ -129,7 +130,7 @@
 
     /**
      * Replaces this node with another node.
-     *
+     * 
      * @param newNode the new node that is the replacement
      * @return the new node
      */
@@ -138,8 +139,9 @@
     }
 
     /**
-     * Invokes the {@link NodeVisitor#visit(Node)} method for this node and recursively also for all child nodes.
-     *
+     * Invokes the {@link NodeVisitor#visit(Node)} method for this node and recursively also for all
+     * child nodes.
+     * 
      * @param nodeVisitor the visitor
      */
     public final void accept(NodeVisitor nodeVisitor) {
@@ -154,7 +156,7 @@
 
     /**
      * Iterator over the children of this node.
-     *
+     * 
      * @return the iterator
      */
     public final Iterable<Node> getChildren() {
@@ -169,7 +171,7 @@
 
     /**
      * Creates a shallow copy of this node.
-     *
+     * 
      * @return the new copy
      */
     public Node copy() {
@@ -181,8 +183,8 @@
     }
 
     /**
-     * This method must never be called. It enforces that {@link Object#clone} is not directly called by subclasses.
-     * Use the {@link #copy()} method instead.
+     * This method must never be called. It enforces that {@link Object#clone} is not directly
+     * called by subclasses. Use the {@link #copy()} method instead.
      */
     @Override
     @Deprecated
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeInfo.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeInfo.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
 
     /**
      * Short name representing the node that can be used for debugging.
+     * 
      * @return the short name
      */
     String shortName() default "";
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java	Fri Feb 01 17:06:26 2013 +0100
@@ -43,11 +43,11 @@
         private final Class[] nodeArrayFieldClasses;
         private final long parentOffset;
         private final long[] nodeDataFieldOffsets;
-        private final Class< ? >[] nodeDataFieldClasses;
+        private final Class<?>[] nodeDataFieldClasses;
 
-        private static final Map<Class< ? >, NodeClass> nodeClasses = new IdentityHashMap<>();
+        private static final Map<Class<?>, NodeClass> nodeClasses = new IdentityHashMap<>();
 
-        public static NodeClass get(Class< ? > clazz) {
+        public static NodeClass get(Class<?> clazz) {
             NodeClass nodeClass = nodeClasses.get(clazz);
             if (nodeClass == null) {
                 nodeClass = new NodeClass(clazz);
@@ -56,15 +56,15 @@
             return nodeClass;
         }
 
-        private NodeClass(Class< ? > clazz) {
+        private NodeClass(Class<?> clazz) {
             // scan object fields
-            Class< ? > parentClassTmp = null;
+            Class<?> parentClassTmp = null;
             List<Long> nodeFieldOffsetsList = new ArrayList<>();
-            List<Class< ? >> nodeFieldClassesList = new ArrayList<>();
+            List<Class<?>> nodeFieldClassesList = new ArrayList<>();
             List<Long> nodeArrayFieldOffsetsList = new ArrayList<>();
-            List<Class< ? >> nodeArrayFieldClassesList = new ArrayList<>();
+            List<Class<?>> nodeArrayFieldClassesList = new ArrayList<>();
             List<Long> nodeDataFieldOffsetList = new ArrayList<>();
-            List<Class< ? >> nodeDataFieldClassList = new ArrayList<>();
+            List<Class<?>> nodeDataFieldClassList = new ArrayList<>();
             Field[] fields = getAllFields(clazz);
             long parentOffsetTemp = -1;
             for (Field field : fields) {
@@ -95,7 +95,7 @@
             this.nodeArrayFieldOffsets = toLongArray(nodeArrayFieldOffsetsList);
             this.nodeArrayFieldClasses = nodeArrayFieldClassesList.toArray(new Class[nodeArrayFieldClassesList.size()]);
             this.nodeDataFieldOffsets = toLongArray(nodeDataFieldOffsetList);
-            this.nodeDataFieldClasses = nodeDataFieldClassList.toArray(new Class< ? >[nodeDataFieldClassList.size()]);
+            this.nodeDataFieldClasses = nodeDataFieldClassList.toArray(new Class<?>[nodeDataFieldClassList.size()]);
 
             this.parentOffset = parentOffsetTemp;
         }
@@ -198,7 +198,7 @@
 
     @SuppressWarnings("unchecked")
     public static <T extends Node> T cloneNode(T orig) {
-        Class< ? extends Node> clazz = orig.getClass();
+        Class<? extends Node> clazz = orig.getClass();
         NodeClass nodeClass = NodeClass.get(clazz);
         Node clone = orig.copy();
         if (clone == null) {
@@ -279,49 +279,49 @@
         }
     }
 
-    public static long[] getNodeDataFieldOffsets(Class< ? > nodeClass) {
+    public static long[] getNodeDataFieldOffsets(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeDataFieldOffsets, clazz.nodeDataFieldClasses.length);
     }
 
-    public static Class[] getNodeDataFieldClasses(Class< ? > nodeClass) {
+    public static Class[] getNodeDataFieldClasses(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeDataFieldClasses, clazz.nodeDataFieldClasses.length);
     }
 
-    public static long getNodeParentOffset(Class< ? > nodeClass) {
+    public static long getNodeParentOffset(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return clazz.parentOffset;
     }
 
     /** Returns the number of Node field declarations in the class hierarchy. */
-    public static long[] getNodeFieldOffsets(Class< ? > nodeClass) {
+    public static long[] getNodeFieldOffsets(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeFieldOffsets, clazz.nodeFieldOffsets.length);
     }
 
     /** Returns the number of Node[] declaration in the class hierarchy. */
-    public static long[] getNodeFieldArrayOffsets(Class< ? > nodeClass) {
+    public static long[] getNodeFieldArrayOffsets(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeArrayFieldOffsets, clazz.nodeArrayFieldOffsets.length);
     }
 
-    public static Class[] getNodeFieldArrayClasses(Class< ? > nodeClass) {
+    public static Class[] getNodeFieldArrayClasses(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeArrayFieldClasses, clazz.nodeArrayFieldClasses.length);
     }
 
-    public static Class getNodeParentClass(Class< ? > nodeClass) {
+    public static Class getNodeParentClass(Class<?> nodeClass) {
         return NodeClass.get(nodeClass).parentClass;
     }
 
-    public static Class[] getNodeFieldClasses(Class< ? > nodeClass) {
+    public static Class[] getNodeFieldClasses(Class<?> nodeClass) {
         NodeClass clazz = NodeClass.get(nodeClass);
         return Arrays.copyOf(clazz.nodeFieldClasses, clazz.nodeFieldClasses.length);
     }
 
     /** Returns all declared fields in the class hierarchy. */
-    public static Field[] getAllFields(Class< ? extends Object> clazz) {
+    public static Field[] getAllFields(Class<? extends Object> clazz) {
         Field[] declaredFields = clazz.getDeclaredFields();
         if (clazz.getSuperclass() != null) {
             return concat(getAllFields(clazz.getSuperclass()), declaredFields);
@@ -336,11 +336,11 @@
     }
 
     /** find annotation in class/interface hierarchy. */
-    public static <T extends Annotation> T findAnnotation(Class< ? > clazz, Class<T> annotationClass) {
+    public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClass) {
         if (clazz.getAnnotation(annotationClass) != null) {
             return clazz.getAnnotation(annotationClass);
         } else {
-            for (Class< ? > intf : clazz.getInterfaces()) {
+            for (Class<?> intf : clazz.getInterfaces()) {
                 if (intf.getAnnotation(annotationClass) != null) {
                     return intf.getAnnotation(annotationClass);
                 }
@@ -468,9 +468,9 @@
     }
 
     /**
-     * Prints a human readable form of a {@link Node} AST to the given {@link PrintStream}. This print method does not
-     * check for cycles in the node structure.
-     *
+     * Prints a human readable form of a {@link Node} AST to the given {@link PrintStream}. This
+     * print method does not check for cycles in the node structure.
+     * 
      * @param p the {@link PrintStream} to print to.
      * @param node the root node to write
      */
@@ -479,9 +479,10 @@
     }
 
     /**
-     * Prints a human readable form of a tree to the given {@link PrintStream}. The {@link TreeResolver} interface needs
-     * to be implemented to specify how the method can read the tree from plain a object.
-     *
+     * Prints a human readable form of a tree to the given {@link PrintStream}. The
+     * {@link TreeResolver} interface needs to be implemented to specify how the method can read the
+     * tree from plain a object.
+     * 
      * @param p the {@link PrintStream} to print to.
      * @param o the root object to be printed.
      * @param resolver an implementation of a tree resolver
@@ -537,7 +538,7 @@
         // I refetch the fields to get declaration order.
         for (int i = 0; i < childFields.size(); i++) {
             Field field = childFields.get(i);
-            Class< ? > fieldClass = field.getType();
+            Class<?> fieldClass = field.getType();
             String name = field.getName();
 
             long offset = unsafe.objectFieldOffset(field);
@@ -576,7 +577,7 @@
         }
     }
 
-    private static Object getObjectValue(Object base, Class< ? > fieldClass, long offset) {
+    private static Object getObjectValue(Object base, Class<?> fieldClass, long offset) {
         if (fieldClass == boolean.class) {
             return unsafe.getBoolean(base, offset);
         } else if (fieldClass == byte.class) {
@@ -648,42 +649,42 @@
 
         /**
          * Returns true if a {@link Field} is filtered from the tree.
-         *
+         * 
          * @param f the field to check
          */
         boolean isFiltered(Field f);
 
         /**
-         * Returns true if a {@link Field} is a field that contains a data value which should not be traversed
-         * recursively.
-         *
+         * Returns true if a {@link Field} is a field that contains a data value which should not be
+         * traversed recursively.
+         * 
          * @param f the field to check
          * @return true if a the given field is a data field else false.
          */
         boolean isDataField(Field f);
 
         /**
-         * Returns true if a {@link Field} is a field that contains an {@link Object} which should be recursively
-         * visited.
-         *
+         * Returns true if a {@link Field} is a field that contains an {@link Object} which should
+         * be recursively visited.
+         * 
          * @param f the field to check
          * @return true if a the given field is a child field else false.
          */
         boolean isChildObject(Field f);
 
         /**
-         * Returns true if a {@link Field} is a field that contains any kind of list/array structure which itself holds
-         * values that should be recursively visited.
-         *
+         * Returns true if a {@link Field} is a field that contains any kind of list/array structure
+         * which itself holds values that should be recursively visited.
+         * 
          * @param f the field to check
          * @return true if a the given field is a child array/list field else false.
          */
         boolean isChildArrayObject(Field f);
 
         /**
-         * Converts an given child array object to array which can be traversed. This is especially useful to convert
-         * any kind of list structure to a traversable array.
-         *
+         * Converts an given child array object to array which can be traversed. This is especially
+         * useful to convert any kind of list structure to a traversable array.
+         * 
          * @param f the field for meta data needed to convert the data {@link Object}.
          * @param value the actual value of the child array/list object.
          * @return the converted {@link Object} array.
@@ -692,7 +693,7 @@
 
         /**
          * Returns a human readable string for any data field object in the tree.
-         *
+         * 
          * @param o the object to convert to string.
          * @return the converted string
          */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeVisitor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,9 +28,9 @@
 public interface NodeVisitor {
 
     /**
-     * This visitor method is called for every node in the tree. Its return value determines if the children of this
-     * node should be excluded in the iteration.
-     *
+     * This visitor method is called for every node in the tree. Its return value determines if the
+     * children of this node should be excluded in the iteration.
+     * 
      * @param node the node that is currently visited
      * @return {@code true} if the children should be visited too, {@code false} otherwise
      */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/RootNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,12 +26,15 @@
 import com.oracle.truffle.api.frame.*;
 
 /**
- * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a root node can be used to create a call target using {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}.
+ * A root node is a node with a method to execute it given only a frame as a parameter. Therefore, a
+ * root node can be used to create a call target using
+ * {@link TruffleRuntime#createCallTarget(RootNode, FrameDescriptor)}.
  */
 public abstract class RootNode extends Node {
 
     /**
      * Executes this function using the specified frame and returns the result value.
+     * 
      * @param frame the frame of the currently executing guest language method
      * @return the value of the execution
      */
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/SlowPathException.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,8 +23,8 @@
 package com.oracle.truffle.api.nodes;
 
 /**
- * An exception thrown to enter a slow path. The Truffle optimizer has special knowledge of this exception class and
- * will never compile a catch block that catches this exception type.
+ * An exception thrown to enter a slow path. The Truffle optimizer has special knowledge of this
+ * exception class and will never compile a catch block that catches this exception type.
  */
 public class SlowPathException extends Exception {
 
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/UnexpectedResultException.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,9 +23,9 @@
 package com.oracle.truffle.api.nodes;
 
 /**
- * An exception that should be thrown if the return value cannot be represented as a value of the return type. The
- * Truffle optimizer has special knowledge of this exception class and will never compile a catch block that catches this
- * exception type.
+ * An exception that should be thrown if the return value cannot be represented as a value of the
+ * return type. The Truffle optimizer has special knowledge of this exception class and will never
+ * compile a catch block that catches this exception type.
  */
 public final class UnexpectedResultException extends SlowPathException {
 
@@ -33,7 +33,9 @@
     private final Object result;
 
     /**
-     * Creates the exception with the alternative result that cannot be respresented as a value of the return type.
+     * Creates the exception with the alternative result that cannot be respresented as a value of
+     * the return type.
+     * 
      * @param result the alternative result
      */
     public UnexpectedResultException(Object result) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AbstractParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,6 +23,7 @@
 package com.oracle.truffle.codegen.processor;
 
 import java.lang.annotation.*;
+import java.util.*;
 
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
@@ -49,7 +50,11 @@
     public final M parse(RoundEnvironment env, Element element) {
         this.roundEnv = env;
         try {
-            AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), getAnnotationType());
+            AnnotationMirror mirror = null;
+            if (getAnnotationType() != null) {
+                mirror = Utils.findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), getAnnotationType());
+            }
+
             if (!context.getTruffleTypes().verify(context, element, mirror)) {
                 return null;
             }
@@ -61,6 +66,23 @@
 
     protected abstract M parse(Element element, AnnotationMirror mirror);
 
-    public abstract Class< ? extends Annotation> getAnnotationType();
+    public abstract Class<? extends Annotation> getAnnotationType();
+
+    public boolean isDelegateToRootDeclaredType() {
+        return false;
+    }
+
+    public List<Class<? extends Annotation>> getAllAnnotationTypes() {
+        List<Class<? extends Annotation>> list = new ArrayList<>();
+        if (getAnnotationType() != null) {
+            list.add(getAnnotationType());
+        }
+        list.addAll(getTypeDelegatedAnnotationTypes());
+        return list;
+    }
+
+    public List<Class<? extends Annotation>> getTypeDelegatedAnnotationTypes() {
+        return Collections.emptyList();
+    }
 
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AnnotationProcessor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/AnnotationProcessor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -84,7 +84,7 @@
             context.registerTemplate(type, model);
 
             if (model != null) {
-                CodeCompilationUnit unit = (CodeCompilationUnit) factory.process(model);
+                CodeCompilationUnit unit = factory.process(null, model);
                 unit.setGeneratorAnnotationMirror(model.getTemplateTypeAnnotation());
                 unit.setGeneratorElement(model.getTemplateType());
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Log.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,11 +39,11 @@
         this.processingEnv = env;
     }
 
-    public void warning(Element element, String format, Object ... args) {
+    public void warning(Element element, String format, Object... args) {
         message(Kind.WARNING, element, null, null, format, args);
     }
 
-    public void warning(Element element, AnnotationMirror mirror, String format, Object ... args) {
+    public void warning(Element element, AnnotationMirror mirror, String format, Object... args) {
         message(Kind.WARNING, element, mirror, null, format, args);
     }
 
@@ -51,6 +51,10 @@
         message(Kind.ERROR, element, null, null, format, args);
     }
 
+    public void error(String format, Object... args) {
+        message(Kind.ERROR, null, null, null, format, args);
+    }
+
     public void error(Element element, AnnotationMirror mirror, String format, Object... args) {
         message(Kind.ERROR, element, mirror, null, format, args);
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ProcessorContext.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,18 +45,16 @@
 
     private final ProcessCallback callback;
     private final Log log;
-    private TruffleTypes truffleTypes;
+    private final TruffleTypes truffleTypes;
 
     public ProcessorContext(ProcessingEnvironment env, ProcessCallback callback) {
         this.environment = env;
         this.callback = callback;
         this.log = new Log(environment);
+        this.truffleTypes = new TruffleTypes(this);
     }
 
     public TruffleTypes getTruffleTypes() {
-        if (truffleTypes == null) {
-            truffleTypes = new TruffleTypes(this);
-        }
         return truffleTypes;
     }
 
@@ -149,7 +147,7 @@
         return null;
     }
 
-    public TypeMirror getType(Class< ? > element) {
+    public TypeMirror getType(Class<?> element) {
         TypeMirror mirror;
         if (element.isPrimitive()) {
             if (element == boolean.class) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/TruffleProcessor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -30,38 +30,55 @@
 import javax.lang.model.element.*;
 
 import com.oracle.truffle.codegen.processor.ProcessorContext.ProcessCallback;
-import com.oracle.truffle.codegen.processor.operation.*;
+import com.oracle.truffle.codegen.processor.node.*;
 import com.oracle.truffle.codegen.processor.typesystem.*;
 
 /**
  * THIS IS NOT PUBLIC API.
  */
-//@SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation", "com.oracle.truffle.codegen.TypeLattice"})
+// @SupportedAnnotationTypes({"com.oracle.truffle.codegen.Operation",
+// "com.oracle.truffle.codegen.TypeLattice"})
 @SupportedSourceVersion(SourceVersion.RELEASE_7)
 public class TruffleProcessor extends AbstractProcessor implements ProcessCallback {
 
     private ProcessorContext context;
-    private List<AnnotationProcessor< ? >> generators;
+    private List<AnnotationProcessor<?>> generators;
 
     private RoundEnvironment round;
 
     @Override
-    public boolean process(Set< ? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
         if (!roundEnv.processingOver()) {
             processImpl(roundEnv);
         }
         return false;
     }
 
-    @SuppressWarnings("unchecked")
     private void processImpl(RoundEnvironment env) {
         this.round = env;
-        // TODO run verifications that other annotations are not processed out of scope of the operation or typelattice.
+        // TODO run verifications that other annotations are not processed out of scope of the
+        // operation or typelattice.
         try {
             for (AnnotationProcessor generator : getGenerators()) {
-                for (Element e : env.getElementsAnnotatedWith(generator.getParser().getAnnotationType())) {
-                    processElement(env, generator, e, false);
+                AbstractParser<?> parser = generator.getParser();
+                if (parser.getAnnotationType() != null) {
+                    for (Element e : env.getElementsAnnotatedWith(parser.getAnnotationType())) {
+                        processElement(env, generator, e, false);
+                    }
                 }
+
+                for (Class<? extends Annotation> annotationType : parser.getTypeDelegatedAnnotationTypes()) {
+                    for (Element e : env.getElementsAnnotatedWith(annotationType)) {
+                        TypeElement processedType;
+                        if (parser.isDelegateToRootDeclaredType()) {
+                            processedType = Utils.findRootEnclosingType(e);
+                        } else {
+                            processedType = Utils.findNearestEnclosingType(e);
+                        }
+                        processElement(env, generator, processedType, false);
+                    }
+                }
+
             }
         } finally {
             this.round = null;
@@ -85,9 +102,12 @@
     @Override
     public void callback(TypeElement template) {
         for (AnnotationProcessor generator : generators) {
-            Annotation annotation = template.getAnnotation(generator.getParser().getAnnotationType());
-            if (annotation != null) {
-                processElement(round, generator, template, true);
+            Class annotationType = generator.getParser().getAnnotationType();
+            if (annotationType != null) {
+                Annotation annotation = template.getAnnotation(annotationType);
+                if (annotation != null) {
+                    processElement(round, generator, template, true);
+                }
             }
         }
     }
@@ -95,17 +115,20 @@
     @Override
     public Set<String> getSupportedAnnotationTypes() {
         Set<String> annotations = new HashSet<>();
-        for (AnnotationProcessor< ? > generator : getGenerators()) {
-            annotations.add(generator.getParser().getAnnotationType().getCanonicalName());
+        List<Class<? extends Annotation>> annotationsTypes = new ArrayList<>();
+        annotationsTypes.addAll(NodeParser.ANNOTATIONS);
+        annotationsTypes.addAll(TypeSystemParser.ANNOTATIONS);
+        for (Class<? extends Annotation> type : annotationsTypes) {
+            annotations.add(type.getCanonicalName());
         }
         return annotations;
     }
 
-    private List<AnnotationProcessor< ? >> getGenerators() {
+    private List<AnnotationProcessor<?>> getGenerators() {
         if (generators == null && processingEnv != null) {
             generators = new ArrayList<>();
             generators.add(new AnnotationProcessor<>(getContext(), new TypeSystemParser(getContext()), new TypeSystemCodeGenerator(getContext())));
-            generators.add(new AnnotationProcessor<>(getContext(), new OperationParser(getContext()), new OperationCodeGenerator(getContext())));
+            generators.add(new AnnotationProcessor<>(getContext(), new NodeParser(getContext()), new NodeCodeGenerator(getContext())));
         }
         return generators;
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/Utils.java	Fri Feb 01 17:06:26 2013 +0100
@@ -47,10 +47,8 @@
         }
     }
 
-    public static List<AnnotationMirror> collectAnnotations(
-                    ProcessorContext context,
-                    AnnotationMirror markerAnnotation, String elementName, Element element,
-                    Class< ? extends Annotation> annotationClass) {
+    public static List<AnnotationMirror> collectAnnotations(ProcessorContext context, AnnotationMirror markerAnnotation, String elementName, Element element,
+                    Class<? extends Annotation> annotationClass) {
         List<AnnotationMirror> result = Utils.getAnnotationValueList(markerAnnotation, elementName);
         AnnotationMirror explicit = Utils.findAnnotationMirror(context.getEnvironment(), element, annotationClass);
         if (explicit != null) {
@@ -63,6 +61,11 @@
         return result;
     }
 
+    public static String getReadableSignature(ExecutableElement method) {
+        // TODO toString does not guarantee a good signature
+        return method.toString();
+    }
+
     public static boolean hasError(TypeMirror mirror) {
         switch (mirror.getKind()) {
             case BOOLEAN:
@@ -155,7 +158,6 @@
         }
     }
 
-
     private static String getGenericName(TypeElement element) {
         String simpleName = element.getSimpleName().toString();
 
@@ -243,13 +245,41 @@
         return null;
     }
 
-    public static TypeElement findEnclosingType(Element element) {
-        Element enclosing = element.getEnclosingElement();
-        while (enclosing.getKind() != ElementKind.CLASS && enclosing.getKind() != ElementKind.ENUM && enclosing.getKind() != ElementKind.INTERFACE) {
-            enclosing = element.getEnclosingElement();
+    public static TypeElement findRootEnclosingType(Element element) {
+        List<Element> elements = getElementHierarchy(element);
+
+        for (int i = elements.size() - 1; i >= 0; i--) {
+            if (elements.get(i).getKind().isClass()) {
+                return (TypeElement) elements.get(i);
+            }
         }
 
-        return (TypeElement) enclosing;
+        return null;
+    }
+
+    private static List<Element> getElementHierarchy(Element e) {
+        List<Element> elements = new ArrayList<>();
+        elements.add(e);
+
+        Element enclosing = e.getEnclosingElement();
+        while (enclosing != null && enclosing.getKind() != ElementKind.PACKAGE) {
+            elements.add(enclosing);
+            enclosing = enclosing.getEnclosingElement();
+        }
+        if (enclosing != null) {
+            elements.add(enclosing);
+        }
+        return elements;
+    }
+
+    public static TypeElement findNearestEnclosingType(Element element) {
+        List<Element> elements = getElementHierarchy(element);
+        for (Element e : elements) {
+            if (e.getKind().isClass()) {
+                return (TypeElement) e;
+            }
+        }
+        return null;
     }
 
     public static List<TypeElement> getSuperTypes(TypeElement element) {
@@ -313,7 +343,7 @@
     }
 
     public static String createConstantName(String simpleName) {
-        //TODO use camel case to produce underscores.
+        // TODO use camel case to produce underscores.
         return simpleName.toString().toUpperCase();
     }
 
@@ -331,7 +361,7 @@
     @SuppressWarnings("unchecked")
     public static <T> List<T> getAnnotationValueList(AnnotationMirror mirror, String name) {
         List<T> result = new ArrayList<>();
-        List< ? extends AnnotationValue> values = (List< ? extends AnnotationValue>) getAnnotationValue(mirror, name).getValue();
+        List<? extends AnnotationValue> values = (List<? extends AnnotationValue>) getAnnotationValue(mirror, name).getValue();
         for (AnnotationValue value : values) {
             result.add((T) value.getValue());
         }
@@ -386,12 +416,12 @@
         return e.getMessage() + "\r\n" + string.toString();
     }
 
-    public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, Element element, Class< ? > annotationClass) {
+    public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, Element element, Class<?> annotationClass) {
         return findAnnotationMirror(processingEnv, element.getAnnotationMirrors(), annotationClass);
     }
 
-    public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List< ? extends AnnotationMirror> mirrors, Class< ? > annotationClass) {
-        TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getName());
+    public static AnnotationMirror findAnnotationMirror(ProcessingEnvironment processingEnv, List<? extends AnnotationMirror> mirrors, Class<?> annotationClass) {
+        TypeElement expectedAnnotationType = processingEnv.getElementUtils().getTypeElement(annotationClass.getCanonicalName());
         for (AnnotationMirror mirror : mirrors) {
             DeclaredType annotationType = mirror.getAnnotationType();
             TypeElement actualAnnotationType = (TypeElement) annotationType.asElement();
@@ -403,11 +433,13 @@
     }
 
     private static PackageElement findPackageElement(Element type) {
-        Element searchType = type;
-        while (searchType.getEnclosingElement() != null && searchType.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
-            searchType = type.getEnclosingElement();
+        List<Element> hierarchy = getElementHierarchy(type);
+        for (Element element : hierarchy) {
+            if (element.getKind() == ElementKind.PACKAGE) {
+                return (PackageElement) element;
+            }
         }
-        return (PackageElement) searchType.getEnclosingElement();
+        return null;
     }
 
     public static String firstLetterUpperCase(String name) {
@@ -491,7 +523,6 @@
         return qualified1.equals(qualified2);
     }
 
-
     public static int compareByTypeHierarchy(TypeMirror t1, TypeMirror t2) {
         if (typeEquals(t1, t2)) {
             return 0;
@@ -508,7 +539,6 @@
         return 0;
     }
 
-
     public static boolean canThrowType(List<? extends TypeMirror> thrownTypes, TypeMirror exceptionType) {
         if (Utils.containsType(thrownTypes, exceptionType)) {
             return true;
@@ -530,6 +560,19 @@
         return false;
     }
 
+    public static Modifier getVisibility(Set<Modifier> modifier) {
+        for (Modifier mod : modifier) {
+            if (mod == Modifier.PUBLIC) {
+                return mod;
+            } else if (mod == Modifier.PRIVATE) {
+                return mod;
+            } else if (mod == Modifier.PROTECTED) {
+                return mod;
+            }
+        }
+        return null;
+    }
+
     private static boolean isRuntimeException(TypeMirror type) {
         Set<String> typeSuperSet = new HashSet<>(getQualifiedSuperTypeNames(fromTypeMirror(type)));
         String typeName = getQualifiedName(type);
@@ -548,4 +591,12 @@
         return false;
     }
 
+    public static boolean isTopLevelClass(TypeMirror importType) {
+        TypeElement type = fromTypeMirror(importType);
+        if (type != null && type.getEnclosingElement() != null) {
+            return !type.getEnclosingElement().getKind().isClass();
+        }
+        return true;
+    }
+
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionContext.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionContext.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,7 +26,6 @@
 
 import com.oracle.truffle.codegen.processor.api.element.*;
 
-
 public interface ExtensionContext {
 
     ProcessingEnvironment getProcessingEnvironment();
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionProcessor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/ExtensionProcessor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import javax.lang.model.element.*;
 
-
 public interface ExtensionProcessor {
 
     void process(ExtensionContext context, AnnotationMirror mirror, Element element);
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import javax.lang.model.element.*;
 
-
 public interface WritableElement extends Element {
 
     void addAnnotationMirror(AnnotationMirror annotationMirror);
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElementFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableElementFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,19 +25,24 @@
 import javax.lang.model.element.*;
 import javax.lang.model.type.*;
 
-
 public interface WritableElementFactory {
 
     WritableExecutableElement cloneExecutableElement(ExecutableElement method);
+
     WritableVariableElement cloneVariableElement(VariableElement parameter);
+
     WritableAnnotationMirror cloneAnnotationMirror(AnnotationMirror mirror);
 
     WritableVariableElement createParameter(TypeMirror type, String simpleName);
+
     WritableExecutableElement createExecutableElement(TypeMirror returnType, String methodName);
+
     WritableAnnotationMirror createAnnotationMirror(DeclaredType annotationClass);
 
     Name createName(String name);
+
     AnnotationValue createAnnotationValue(Object value);
+
     TypeMirror createTypeMirror(Class<?> javaClass);
 
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableExecutableElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableExecutableElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,17 +28,22 @@
 public interface WritableExecutableElement extends ExecutableElement, WritableElement {
 
     void setReturnType(TypeMirror type);
+
     void setDefaultValue(AnnotationValue defaultValue);
 
     void addParameter(VariableElement parameter);
-    void removeParamter(VariableElement parameter);
+
+    void removeParameter(VariableElement parameter);
 
     void addThrownType(TypeMirror thrownType);
+
     void removeThrownType(TypeMirror thrownType);
 
     void setSimpleName(Name name);
+
     void setVarArgs(boolean varargs);
 
     void setBody(String body);
+
     String getBody();
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableVariableElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/api/element/WritableVariableElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,6 +28,7 @@
 public interface WritableVariableElement extends VariableElement, WritableElement {
 
     void setSimpleName(Name name);
+
     void setType(TypeMirror type);
 
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationMirror.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,7 +45,7 @@
     }
 
     @Override
-    public Map< ? extends ExecutableElement, ? extends AnnotationValue> getElementValues() {
+    public Map<? extends ExecutableElement, ? extends AnnotationValue> getElementValues() {
         return values;
     }
 
@@ -77,5 +77,4 @@
         return copy;
     }
 
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeAnnotationValue.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,6 +31,7 @@
 
     private final Object value;
 
+    // @formatter:off
     public CodeAnnotationValue(Object value) {
         Objects.requireNonNull(value);
         if ((value instanceof AnnotationMirror) || (value instanceof List< ? >)
@@ -45,6 +46,7 @@
             throw new IllegalArgumentException("Invalid annotation value type " + value.getClass().getName());
         }
     }
+    // @formatter:on
 
     @Override
     public Object getValue() {
@@ -56,8 +58,8 @@
     public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
         if (value instanceof AnnotationMirror) {
             return v.visitAnnotation((AnnotationMirror) value, p);
-        } else if (value instanceof List< ? >) {
-            return v.visitArray((List< ? extends AnnotationValue>) value, p);
+        } else if (value instanceof List<?>) {
+            return v.visitArray((List<? extends AnnotationValue>) value, p);
         } else if (value instanceof Boolean) {
             return v.visitBoolean((boolean) value, p);
         } else if (value instanceof Byte) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeCompilationUnit.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeCompilationUnit.java	Fri Feb 01 17:06:26 2013 +0100
@@ -50,8 +50,12 @@
 
     @Override
     public <R, P> R accept(ElementVisitor<R, P> v, P p) {
-        for (TypeElement type : getEnclosedElements()) {
-            type.accept(v, p);
+        for (Element type : getEnclosedElements()) {
+            if (type.getKind().isClass()) {
+                type.accept(v, p);
+            } else {
+                throw new ClassCastException(type.getClass().getName());
+            }
         }
         return null;
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,6 @@
         this.modifiers = new LinkedHashSet<>();
     }
 
-
     @Override
     public void setGeneratorAnnotationMirror(AnnotationMirror mirror) {
         this.generatorAnnotationMirror = mirror;
@@ -119,9 +118,6 @@
     }
 
     void setEnclosingElement(Element parent) {
-        if (this.enclosingElement != null && parent != null) {
-            throw new IllegalStateException("Element already added to " + parent);
-        }
         this.enclosingElement = parent;
     }
 
@@ -131,8 +127,7 @@
 
     public CodeTypeElement getEnclosingClass() {
         Element p = enclosingElement;
-        while (p != null && p.getKind() != ElementKind.CLASS
-                        && p.getKind() != ElementKind.ENUM) {
+        while (p != null && p.getKind() != ElementKind.CLASS && p.getKind() != ElementKind.ENUM) {
             p = p.getEnclosingElement();
         }
         return (CodeTypeElement) p;
@@ -142,7 +137,6 @@
         return new ParentableList<>(parent, list);
     }
 
-
     @Override
     public String toString() {
         StringBuilderCodeWriter codeWriter = new StringBuilderCodeWriter();
@@ -160,13 +154,13 @@
         protected Writer createWriter(CodeTypeElement clazz) throws IOException {
             return writer;
         }
+
         public String getString() {
-            return new String(((CharArrayWriter) writer).toCharArray());
+            return new String(((CharArrayWriter) writer).toCharArray()).trim();
         }
 
     }
 
-
     private static class ParentableList<T> implements List<T> {
 
         private final Element parent;
@@ -237,12 +231,12 @@
         }
 
         @Override
-        public boolean containsAll(Collection< ? > c) {
+        public boolean containsAll(Collection<?> c) {
             return delegate.containsAll(c);
         }
 
         @Override
-        public boolean addAll(Collection< ? extends T> c) {
+        public boolean addAll(Collection<? extends T> c) {
             if (c != null) {
                 for (T t : c) {
                     addImpl(t);
@@ -252,7 +246,7 @@
         }
 
         @Override
-        public boolean addAll(int index, Collection< ? extends T> c) {
+        public boolean addAll(int index, Collection<? extends T> c) {
             if (c != null) {
                 for (T t : c) {
                     addImpl(t);
@@ -262,7 +256,7 @@
         }
 
         @Override
-        public boolean removeAll(Collection< ? > c) {
+        public boolean removeAll(Collection<?> c) {
             if (c != null) {
                 for (Object t : c) {
                     removeImpl(t);
@@ -277,7 +271,7 @@
         }
 
         @Override
-        public boolean retainAll(Collection< ? > c) {
+        public boolean retainAll(Collection<?> c) {
             throw new UnsupportedOperationException("Not supported by parentable list");
         }
 
@@ -341,5 +335,4 @@
 
     }
 
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElementScanner.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeElementScanner.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,7 @@
 import javax.lang.model.element.*;
 import javax.lang.model.util.*;
 
-public abstract class CodeElementScanner<R, P> extends ElementScanner7<R, P>{
+public abstract class CodeElementScanner<R, P> extends ElementScanner7<R, P> {
 
     @Override
     public final R visitExecutable(ExecutableElement e, P p) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeExecutableElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -71,11 +71,15 @@
 
     @Override
     public ElementKind getKind() {
-        return ElementKind.METHOD;
+        if (getReturnType() == null) {
+            return ElementKind.CONSTRUCTOR;
+        } else {
+            return ElementKind.METHOD;
+        }
     }
 
     @Override
-    public List< ? extends TypeParameterElement> getTypeParameters() {
+    public List<? extends TypeParameterElement> getTypeParameters() {
         return Collections.emptyList();
     }
 
@@ -108,6 +112,7 @@
         CodeTreeBuilder builder = new CodeTreeBuilder();
         this.bodyTree = builder.getTree();
         this.bodyTree.setEnclosingElement(this);
+        this.body = null;
         return builder;
     }
 
@@ -147,10 +152,23 @@
     }
 
     @Override
-    public void removeParamter(VariableElement parameter) {
+    public void removeParameter(VariableElement parameter) {
         parameters.remove(parameter);
     }
 
+    public void removeParameter(String varName) {
+        VariableElement remove = null;
+        for (VariableElement var : getParameters()) {
+            if (var.getSimpleName().toString().equals(varName)) {
+                remove = var;
+                break;
+            }
+        }
+        if (remove != null) {
+            parameters.remove(remove);
+        }
+    }
+
     @Override
     public void addThrownType(TypeMirror thrownType) {
         throwables.add(thrownType);
@@ -181,7 +199,6 @@
         return v.visitExecutable(this, p);
     }
 
-
     public static CodeExecutableElement clone(ProcessingEnvironment env, ExecutableElement method) {
         CodeExecutableElement copy = new CodeExecutableElement(method.getReturnType(), method.getSimpleName().toString());
         for (TypeMirror thrownType : method.getThrownTypes()) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTreeBuilder.java	Fri Feb 01 17:06:26 2013 +0100
@@ -137,7 +137,7 @@
     }
 
     public CodeTreeBuilder startStaticCall(ExecutableElement method) {
-        return startStaticCall(Utils.findEnclosingType(method).asType(), method.getSimpleName().toString());
+        return startStaticCall(Utils.findNearestEnclosingType(method).asType(), method.getSimpleName().toString());
     }
 
     public CodeTreeBuilder staticReference(TypeMirror type, String fieldName) {
@@ -197,9 +197,11 @@
         startGroup();
         string("(").startGroup();
         registerCallBack(new EndCallback() {
+
             @Override
             public void beforeEnd() {
             }
+
             @Override
             public void afterEnd() {
                 string(")");
@@ -212,9 +214,11 @@
     public CodeTreeBuilder startDoubleQuote() {
         startGroup().string("\"");
         registerCallBack(new EndCallback() {
+
             @Override
             public void beforeEnd() {
             }
+
             @Override
             public void afterEnd() {
                 string("\"");
@@ -295,10 +299,12 @@
     public CodeTreeBuilder startCase() {
         startGroup().string("case ");
         registerCallBack(new EndCallback() {
+
             @Override
             public void beforeEnd() {
                 string(" :").newLine();
             }
+
             @Override
             public void afterEnd() {
             }
@@ -317,7 +323,19 @@
     public CodeTreeBuilder startReturn() {
         ExecutableElement method = findMethod();
         if (method != null && Utils.isVoid(method.getReturnType())) {
-            startStatement();
+            startGroup();
+            registerCallBack(new EndCallback() {
+
+                @Override
+                public void beforeEnd() {
+                    string(";").newLine(); // complete statement to execute
+                }
+
+                @Override
+                public void afterEnd() {
+                    string("return").string(";").newLine(); // emit a return;
+                }
+            });
             return this;
         } else {
             return startStatement().string("return ");
@@ -366,9 +384,11 @@
         startGroup();
         string("{").newLine().startIndention();
         registerCallBack(new EndCallback() {
+
             @Override
             public void beforeEnd() {
             }
+
             @Override
             public void afterEnd() {
                 string("}").newLine();
@@ -471,7 +491,7 @@
         return statement("return");
     }
 
-    private ExecutableElement findMethod() {
+    public ExecutableElement findMethod() {
         Element element = currentElement;
         while (element != null && (element.getKind() != ElementKind.METHOD)) {
             element = element.getEnclosingElement();
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -103,7 +103,7 @@
     }
 
     @Override
-    public List< ? extends TypeParameterElement> getTypeParameters() {
+    public List<? extends TypeParameterElement> getTypeParameters() {
         return Collections.emptyList();
     }
 
@@ -182,6 +182,15 @@
         return ElementFilter.fieldsIn(getEnclosedElements());
     }
 
+    public ExecutableElement getMethod(String name) {
+        for (Element element : getEnclosedElements()) {
+            if (element.getKind() == ElementKind.METHOD && element.getSimpleName().toString().equals(name)) {
+                return (ExecutableElement) element;
+            }
+        }
+        return null;
+    }
+
     public List<ExecutableElement> getMethods() {
         return ElementFilter.methodsIn(getEnclosedElements());
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeMirror.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeTypeMirror.java	Fri Feb 01 17:06:26 2013 +0100
@@ -81,7 +81,7 @@
         }
 
         @Override
-        public List< ? extends TypeMirror> getTypeArguments() {
+        public List<? extends TypeMirror> getTypeArguments() {
             return Collections.emptyList();
         }
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeVariableElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/CodeVariableElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -140,5 +140,4 @@
         return copy;
     }
 
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/GeneratedElement.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ast/GeneratedElement.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,13 +24,14 @@
 
 import javax.lang.model.element.*;
 
-
 public interface GeneratedElement {
 
     AnnotationMirror getGeneratorAnnotationMirror();
+
     void setGeneratorAnnotationMirror(AnnotationMirror mirror);
 
     Element getGeneratorElement();
+
     void setGeneratorElement(Element element);
 
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/AbstractCodeWriter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -175,6 +175,10 @@
             writeEmptyLn();
         }
 
+        for (ExecutableElement method : ElementFilter.constructorsIn(e.getEnclosedElements())) {
+            method.accept(this, null);
+        }
+
         for (ExecutableElement method : getInstanceMethods(e)) {
             method.accept(this, null);
         }
@@ -246,7 +250,6 @@
             init = ((CodeVariableElement) f).getInit();
         }
 
-
         if (parent.getKind() == ElementKind.ENUM && f.getModifiers().contains(Modifier.STATIC)) {
             write(f.getSimpleName());
             if (init != null) {
@@ -290,6 +293,7 @@
                 }
 
                 Collections.sort(methodsList, new Comparator<ExecutableElement>() {
+
                     @Override
                     public int compare(ExecutableElement o1, ExecutableElement o2) {
                         return o1.getSimpleName().toString().compareTo(o2.getSimpleName().toString());
@@ -318,46 +322,55 @@
     }
 
     private class AnnotationValueWriterVisitor extends AbstractAnnotationValueVisitor7<Void, Void> {
+
         @Override
         public Void visitBoolean(boolean b, Void p) {
             write(Boolean.toString(b));
             return null;
         }
+
         @Override
         public Void visitByte(byte b, Void p) {
             write(Byte.toString(b));
             return null;
         }
+
         @Override
         public Void visitChar(char c, Void p) {
             write(Character.toString(c));
             return null;
         }
+
         @Override
         public Void visitDouble(double d, Void p) {
             write(Double.toString(d));
             return null;
         }
+
         @Override
         public Void visitFloat(float f, Void p) {
             write(Float.toString(f));
             return null;
         }
+
         @Override
         public Void visitInt(int i, Void p) {
             write(Integer.toString(i));
             return null;
         }
+
         @Override
         public Void visitLong(long i, Void p) {
             write(Long.toString(i));
             return null;
         }
+
         @Override
         public Void visitShort(short s, Void p) {
             write(Short.toString(s));
             return null;
         }
+
         @Override
         public Void visitString(String s, Void p) {
             write("\"");
@@ -365,12 +378,14 @@
             write("\"");
             return null;
         }
+
         @Override
         public Void visitType(TypeMirror t, Void p) {
             write(typeSimpleName(t));
             write(".class");
             return null;
         }
+
         @Override
         public Void visitEnumConstant(VariableElement c, Void p) {
             write(typeSimpleName(c.asType()));
@@ -378,13 +393,15 @@
             write(c.getSimpleName().toString());
             return null;
         }
+
         @Override
         public Void visitAnnotation(AnnotationMirror a, Void p) {
             AbstractCodeWriter.this.visitAnnotation(a);
             return null;
         }
+
         @Override
-        public Void visitArray(List< ? extends AnnotationValue> vals, Void p) {
+        public Void visitArray(List<? extends AnnotationValue> vals, Void p) {
             write("{");
             for (int i = 0; i < vals.size(); i++) {
                 AnnotationValue value = vals.get(i);
@@ -417,15 +434,15 @@
         }
     }
 
-//    @Override
-//    public void visitParameter(CodeVariableElement e) {
-//        for (CodeAnnotationMirror annotation : e.getAnnotationMirrors()) {
-//            annotation.accept(this);
-//        }
-//        write(typeSimpleName(e.getType()));
-//        write(" ");
-//        write(e.getSimpleName());
-//    }
+    // @Override
+    // public void visitParameter(CodeVariableElement e) {
+    // for (CodeAnnotationMirror annotation : e.getAnnotationMirrors()) {
+    // annotation.accept(this);
+    // }
+    // write(typeSimpleName(e.getType()));
+    // write(" ");
+    // write(e.getSimpleName());
+    // }
 
     @Override
     public Void visitExecutable(CodeExecutableElement e, Void p) {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/FixWarningsVisitor.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/FixWarningsVisitor.java	Fri Feb 01 17:06:26 2013 +0100
@@ -34,9 +34,7 @@
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.ast.*;
 
-
-public class FixWarningsVisitor extends CodeElementScanner<Void, Void>{
-
+public class FixWarningsVisitor extends CodeElementScanner<Void, Void> {
 
     private final Set<String> symbolsUsed = new HashSet<>();
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/codewriter/OrganizedImports.java	Fri Feb 01 17:06:26 2013 +0100
@@ -143,7 +143,8 @@
     private static boolean processStaticImportElements(Set<String> newElements, Set<String> ambiguousElements, Set<String> declaredElements) {
         boolean allAmbiguous = false;
         if (declaredElements.containsAll(newElements)) {
-            // all types already declared -> we can remove the import completely -> they will all get ambiguous
+            // all types already declared -> we can remove the import completely -> they will all
+            // get ambiguous
             allAmbiguous = true;
         }
         Set<String> newAmbiguous = new HashSet<>();
@@ -182,7 +183,7 @@
                 continue; // java.lang is automatically imported
             }
 
-            if (importTypePackageName.equals(getPackageName(e))) {
+            if (importTypePackageName.equals(getPackageName(e)) && Utils.isTopLevelClass(importType)) {
                 continue; // same package name -> no import
             }
 
@@ -199,8 +200,8 @@
     }
 
     private static void collectInnerTypeImports(TypeElement e, Set<String> autoImportedTypes) {
+        autoImportedTypes.add(getQualifiedName(e));
         for (TypeElement innerClass : ElementFilter.typesIn(e.getEnclosedElements())) {
-            collectSuperTypeImports(innerClass, autoImportedTypes);
             collectInnerTypeImports(innerClass, autoImportedTypes);
         }
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/AbstractCompiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/AbstractCompiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,17 +24,15 @@
 
 import java.lang.reflect.*;
 
-
 public abstract class AbstractCompiler implements Compiler {
 
-
     protected static Object method(Object o, String methodName) throws Exception {
         Method method = o.getClass().getMethod(methodName);
         method.setAccessible(true);
         return method.invoke(o);
     }
 
-    protected static Object method(Object o, String methodName, Class[] paramTypes, Object ... values) throws Exception {
+    protected static Object method(Object o, String methodName, Class[] paramTypes, Object... values) throws Exception {
         Method method = o.getClass().getMethod(methodName, paramTypes);
         method.setAccessible(true);
         return method.invoke(o, values);
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/Compiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/Compiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,7 +25,6 @@
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
 
-
 public interface Compiler {
 
     String getMethodBody(ProcessingEnvironment env, ExecutableElement method);
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/CompilerFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/CompilerFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,6 +45,4 @@
         }
     }
 
-
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JDTCompiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -48,10 +48,10 @@
             }
 
             /*
-            AbstractMethodDeclaration decl = ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod();
-            int bodyStart = decl.bodyStart;
-            int bodyEnd = decl.bodyEnd;
-            */
+             * AbstractMethodDeclaration decl =
+             * ((MethodBinding)(((ElementImpl)method)._binding)).sourceMethod(); int bodyStart =
+             * decl.bodyStart; int bodyEnd = decl.bodyEnd;
+             */
             Object decl = method(field(method, "_binding"), "sourceMethod");
             int bodyStart = (int) field(decl, "bodyStart");
             int bodyEnd = (int) field(decl, "bodyEnd");
@@ -66,18 +66,15 @@
         }
     }
 
-
     private static char[] getSource(Element element) throws Exception {
         /*
-        Binding binding = ((ElementImpl)element)._binding;
-        char[] source = null;
-        if (binding instanceof MethodBinding) {
-            source = ((MethodBinding) binding).sourceMethod().compilationResult.getCompilationUnit().getContents();
-        } else if (binding instanceof SourceTypeBinding) {
-            source = ((SourceTypeBinding)binding).scope.referenceContext.compilationResult.compilationUnit.getContents();
-        }
-        return source;
-        */
+         * Binding binding = ((ElementImpl)element)._binding; char[] source = null; if (binding
+         * instanceof MethodBinding) { source = ((MethodBinding)
+         * binding).sourceMethod().compilationResult.getCompilationUnit().getContents(); } else if
+         * (binding instanceof SourceTypeBinding) { source =
+         * ((SourceTypeBinding)binding).scope.referenceContext
+         * .compilationResult.compilationUnit.getContents(); } return source;
+         */
 
         Object binding = field(element, "_binding");
         Class<?> methodBindingClass = Class.forName("org.eclipse.jdt.internal.compiler.lookup.MethodBinding");
@@ -96,7 +93,6 @@
         return source;
     }
 
-
     @Override
     public String getHeaderComment(ProcessingEnvironment env, Element type) {
         try {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JavaCCompiler.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/compiler/JavaCCompiler.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,6 @@
 
 import com.oracle.truffle.codegen.processor.*;
 
-
 public class JavaCCompiler extends AbstractCompiler {
 
     public static boolean isValidElement(Element currentElement) {
@@ -46,15 +45,13 @@
     public String getMethodBody(ProcessingEnvironment env, ExecutableElement method) {
         try {
             /*
-            if (false) {
-            Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements) env.getElementUtils()).getTreeAndTopLevel(method, null, null);
-            JCBlock block = ((JCMethodDecl) treeAndTopLevel.fst).getBody();
-            int startPos = block.pos;
-            int endPos = block.endpos;
-            String methodBody = treeAndTopLevel.snd.getSourceFile().getCharContent(true).subSequence(startPos + 1, endPos).toString();
-            return methodBody;
-            }
-            */
+             * if (false) { Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements)
+             * env.getElementUtils()).getTreeAndTopLevel(method, null, null); JCBlock block =
+             * ((JCMethodDecl) treeAndTopLevel.fst).getBody(); int startPos = block.pos; int endPos
+             * = block.endpos; String methodBody =
+             * treeAndTopLevel.snd.getSourceFile().getCharContent(true).subSequence(startPos + 1,
+             * endPos).toString(); return methodBody; }
+             */
 
             Object treeAndTopLevel = getTreeAndTopLevel(env, method);
             Object block = method(field(treeAndTopLevel, "fst"), "getBody");
@@ -75,7 +72,8 @@
 
     private static Object getTreeAndTopLevel(ProcessingEnvironment env, Element element) throws Exception {
         /*
-         * Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements) env.getElementUtils()).getTreeAndTopLevel(method, null, null);
+         * Pair<JCTree, JCCompilationUnit> treeAndTopLevel = ((JavacElements)
+         * env.getElementUtils()).getTreeAndTopLevel(method, null, null);
          */
         return method(method(env, "getElementUtils"), "getTreeAndTopLevel", getTreeAndTopLevelSignature, element, null, null);
     }
@@ -90,6 +88,4 @@
         }
     }
 
-
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionCodeElementFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionCodeElementFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,6 @@
 import com.oracle.truffle.codegen.processor.api.element.*;
 import com.oracle.truffle.codegen.processor.ast.*;
 
-
 final class ExtensionCodeElementFactory implements WritableElementFactory {
 
     private final ProcessorContext context;
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionContextImpl.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionContextImpl.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,6 @@
 import com.oracle.truffle.codegen.processor.api.*;
 import com.oracle.truffle.codegen.processor.api.element.*;
 
-
 public class ExtensionContextImpl implements ExtensionContext {
 
     private final ProcessingEnvironment env;
@@ -44,7 +43,6 @@
         this.factory = factory;
     }
 
-
     List<WritableElement> returnElements() {
         List<WritableElement> returnElements = new ArrayList<>(this.elements);
         this.elements.clear();
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/ext/ExtensionParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -32,7 +32,6 @@
 import com.oracle.truffle.codegen.processor.api.*;
 import com.oracle.truffle.codegen.processor.api.element.*;
 
-
 public class ExtensionParser {
 
     private final Map<String, ExtensionProcessor> extensions = new HashMap<>();
@@ -46,11 +45,11 @@
         this.extensionContext = new ExtensionContextImpl(context.getEnvironment(), null, factory);
     }
 
-    public List<WritableElement> parseAll(TypeElement typeElement) {
+    public List<WritableElement> parseAll(TypeElement typeElement, List<? extends Element> elements) {
         List<WritableElement> generatedMethods = new ArrayList<>();
         parseElement(generatedMethods, typeElement);
 
-        List<? extends ExecutableElement> methods = ElementFilter.methodsIn(typeElement.getEnclosedElements());
+        List<? extends ExecutableElement> methods = ElementFilter.methodsIn(elements);
         for (ExecutableElement method : methods) {
             for (VariableElement var : method.getParameters()) {
                 parseElement(generatedMethods, var);
@@ -115,5 +114,4 @@
         return processor;
     }
 
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import javax.lang.model.element.*;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class ExecutableTypeData extends TemplateMethod {
+
+    private final TypeSystemData typeSystem;
+    private final TypeData type;
+
+    public ExecutableTypeData(TemplateMethod method, TypeSystemData typeSystem, TypeData type) {
+        super(method);
+        this.typeSystem = typeSystem;
+        this.type = type;
+    }
+
+    public TypeData getType() {
+        return type;
+    }
+
+    public TypeSystemData getTypeSystem() {
+        return typeSystem;
+    }
+
+    public boolean hasFrame() {
+        return getMethod().getParameters().size() > 0;
+    }
+
+    public boolean hasUnexpectedValue(ProcessorContext context) {
+        return Utils.canThrowType(getMethod().getThrownTypes(), context.getTruffleTypes().getUnexpectedValueException());
+    }
+
+    public boolean isFinal() {
+        return getMethod().getModifiers().contains(Modifier.FINAL);
+    }
+
+    @Override
+    public int hashCode() {
+        return type.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof ExecutableTypeData) {
+            return type.equals(((ExecutableTypeData) obj).type);
+        }
+        return super.equals(obj);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ExecutableTypeMethodParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class ExecutableTypeMethodParser extends MethodParser<ExecutableTypeData> {
+
+    public ExecutableTypeMethodParser(ProcessorContext context, NodeData node) {
+        super(context, node);
+        setEmitErrors(false);
+        setParseNullOnError(false);
+    }
+
+    @Override
+    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
+        List<TypeMirror> types = new ArrayList<>();
+        types.addAll(Arrays.asList(getNode().getTypeSystem().getPrimitiveTypeMirrors()));
+        types.add(getContext().getType(void.class));
+
+        ParameterSpec returnTypeSpec = new ParameterSpec("executedValue", types.toArray(new TypeMirror[types.size()]), getNode().getTypeSystem().getGenericType(), false, Cardinality.ONE);
+
+        List<ParameterSpec> parameters = new ArrayList<>();
+        parameters.add(new ParameterSpec("frame", getContext().getTruffleTypes().getFrame(), true));
+        return new MethodSpec(returnTypeSpec, parameters);
+    }
+
+    @Override
+    public final boolean isParsable(ExecutableElement method) {
+        boolean parsable = method.getSimpleName().toString().startsWith("execute");
+        return parsable;
+    }
+
+    @Override
+    public ExecutableTypeData create(TemplateMethod method) {
+        TypeData resolvedType = method.getReturnType().getActualTypeData(getNode().getTypeSystem());
+        if (resolvedType == null) {
+            return null;
+        }
+        return new ExecutableTypeData(method, getNode().getTypeSystem(), resolvedType);
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/GenericParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+
+import javax.lang.model.element.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+
+public class GenericParser extends MethodParser<SpecializationData> {
+
+    public GenericParser(ProcessorContext context, NodeData node) {
+        super(context, node);
+    }
+
+    @Override
+    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
+        return createDefaultMethodSpec(null);
+    }
+
+    @Override
+    protected ParameterSpec createValueParameterSpec(String valueName, NodeData nodeData) {
+        return new ParameterSpec(valueName, nodeData.findGenericExecutableType(getContext()).getType().getPrimitiveType(), false);
+    }
+
+    @Override
+    protected ParameterSpec createReturnParameterSpec() {
+        return super.createValueParameterSpec("returnValue", getNode());
+    }
+
+    @Override
+    public SpecializationData create(TemplateMethod method) {
+        return new SpecializationData(method, true, false);
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return Generic.class;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/MethodParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.util.*;
+
+import javax.lang.model.element.*;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
+
+public abstract class MethodParser<E extends TemplateMethod> extends TemplateMethodParser<NodeData, E> {
+
+    public MethodParser(ProcessorContext context, NodeData node) {
+        super(context, node);
+    }
+
+    public NodeData getNode() {
+        return template;
+    }
+
+    protected ParameterSpec createValueParameterSpec(String valueName, NodeData nodeData) {
+        return new ParameterSpec(valueName, nodeData, false, Cardinality.ONE);
+    }
+
+    protected ParameterSpec createReturnParameterSpec() {
+        return createValueParameterSpec("operation", getNode());
+    }
+
+    @Override
+    public boolean isParsable(ExecutableElement method) {
+        return Utils.findAnnotationMirror(getContext().getEnvironment(), method, getAnnotationType()) != null;
+    }
+
+    protected final MethodSpec createDefaultMethodSpec(String shortCircuitName) {
+        List<ParameterSpec> defaultParameters = new ArrayList<>();
+        ParameterSpec frameSpec = new ParameterSpec("frame", getContext().getTruffleTypes().getFrame(), true);
+        defaultParameters.add(frameSpec);
+
+        for (NodeFieldData field : getNode().getFields()) {
+            if (field.getExecutionKind() == ExecutionKind.IGNORE) {
+                continue;
+            }
+
+            if (field.getExecutionKind() == ExecutionKind.DEFAULT) {
+                defaultParameters.add(createValueParameterSpec(field.getName(), field.getNodeData()));
+            } else if (field.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) {
+                String valueName = field.getName();
+                if (shortCircuitName != null && valueName.equals(shortCircuitName)) {
+                    break;
+                }
+
+                defaultParameters.add(new ParameterSpec(shortCircuitValueName(valueName), getContext().getType(boolean.class), false));
+
+                defaultParameters.add(createValueParameterSpec(valueName, field.getNodeData()));
+            } else {
+                assert false;
+            }
+        }
+
+        return new MethodSpec(createReturnParameterSpec(), defaultParameters);
+    }
+
+    private static String shortCircuitValueName(String valueName) {
+        return "has" + Utils.firstLetterUpperCase(valueName);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeCodeGenerator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,851 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import static com.oracle.truffle.codegen.processor.Utils.*;
+import static javax.lang.model.element.Modifier.*;
+
+import java.util.*;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.ast.*;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class NodeCodeGenerator extends CompilationUnitFactory<NodeData> {
+
+    private static final String THIS_NODE_LOCAL_VAR_NAME = "thisNode";
+
+    public NodeCodeGenerator(ProcessorContext context) {
+        super(context);
+    }
+
+    private TypeMirror getUnexpectedValueException() {
+        return getContext().getTruffleTypes().getUnexpectedValueException();
+    }
+
+    private static String factoryClassName(NodeData node) {
+        return nodeClassName(node) + "Factory";
+    }
+
+    private static String nodeClassName(NodeData node) {
+        return Utils.getSimpleName(node.getTemplateType().asType());
+    }
+
+    private static String nodeClassName(SpecializationData specialization) {
+        String name = "";
+        if (specialization.getNode().getSpecializations().length > 1) {
+            name = specialization.getMethodName();
+            if (name.startsWith("do")) {
+                name = name.substring(2);
+            }
+        }
+        name += nodeClassName(specialization.getNode());
+        if (name.equals(Utils.getSimpleName(specialization.getNode().getNodeType())) || name.equals(Utils.getSimpleName(specialization.getNode().getTemplateType()))) {
+            name = name + "Impl";
+        }
+
+        return name;
+    }
+
+    private static String valueName(NodeFieldData field) {
+        return field.getName() + "Value";
+    }
+
+    private static String valueName(TemplateMethod method, ActualParameter param) {
+        NodeData node = (NodeData) method.getTemplate();
+        NodeFieldData field = node.findField(param.getSpecification().getName());
+        if (field != null) {
+            return valueName(field);
+        } else {
+            return param.getSpecification().getName();
+        }
+    }
+
+    private void addValueParameters(CodeExecutableElement method, TemplateMethod specialization, boolean forceFrame) {
+        if (forceFrame) {
+            method.addParameter(new CodeVariableElement(getContext().getTruffleTypes().getFrame(), "frame"));
+        }
+        for (ActualParameter parameter : specialization.getParameters()) {
+            ParameterSpec spec = parameter.getSpecification();
+            if (forceFrame && spec.getName().equals("frame")) {
+                continue;
+            }
+            method.addParameter(new CodeVariableElement(parameter.getActualType(), valueName(specialization, parameter)));
+        }
+    }
+
+    private static void addValueParameterNames(CodeTreeBuilder builder, TemplateMethod specialization, String unexpectedValueName, boolean forceFrame) {
+        if (forceFrame) {
+            builder.string("frame");
+        }
+        for (ActualParameter parameter : specialization.getParameters()) {
+            ParameterSpec spec = parameter.getSpecification();
+            if (forceFrame && spec.getName().equals("frame")) {
+                continue;
+            }
+
+            if (unexpectedValueName != null && spec.getName().equals(unexpectedValueName)) {
+                builder.string("ex.getResult()");
+            } else {
+                builder.string(valueName(specialization, parameter));
+            }
+        }
+    }
+
+    private static void addValueParameterNamesWithCasts(ProcessorContext context, CodeTreeBuilder body, SpecializationData specialization) {
+        for (ActualParameter param : specialization.getParameters()) {
+            TypeData typeData = param.getActualTypeData(specialization.getNode().getTypeSystem());
+            if (typeData == null || typeData.isGeneric()) {
+                body.string(valueName(specialization, param));
+            } else {
+                String methodName = TypeSystemCodeGenerator.asTypeMethodName(typeData);
+                startCallTypeSystemMethod(context, body, specialization.getNode(), methodName);
+                body.string(valueName(specialization, param));
+                body.end().end();
+            }
+        }
+    }
+
+    private static String genClassName(Template operation) {
+        return getSimpleName(operation.getTemplateType()) + "Gen";
+    }
+
+    private static void startCallOperationMethod(CodeTreeBuilder body, TemplateMethod method) {
+        body.startGroup();
+        if (body.findMethod().getModifiers().contains(STATIC)) {
+            body.string(THIS_NODE_LOCAL_VAR_NAME);
+        } else {
+            body.string("super");
+        }
+        body.string(".");
+        body.startCall(method.getMethodName());
+    }
+
+    private static void startCallTypeSystemMethod(ProcessorContext context, CodeTreeBuilder body, NodeData node, String methodName) {
+        VariableElement singleton = TypeSystemCodeGenerator.findSingleton(context, node.getTypeSystem());
+        assert singleton != null;
+
+        body.startGroup();
+        body.staticReference(singleton.getEnclosingElement().asType(), singleton.getSimpleName().toString());
+        body.string(".").startCall(methodName);
+    }
+
+    private static void emitGuards(ProcessorContext context, CodeTreeBuilder body, String prefix, SpecializationData specialization, boolean onSpecialization, boolean needsCast) {
+        TypeSystemData typeSystem = specialization.getNode().getTypeSystem();
+        // Implict guards based on method signature
+        String andOperator = prefix;
+        for (NodeFieldData field : specialization.getNode().getFields()) {
+            ActualParameter param = specialization.findParameter(field.getName());
+            TypeData type = param.getActualTypeData(typeSystem);
+            if (type == null || type.isGeneric()) {
+                continue;
+            }
+
+            body.string(andOperator);
+            startCallTypeSystemMethod(context, body, specialization.getNode(), TypeSystemCodeGenerator.isTypeMethodName(type));
+            body.string(valueName(specialization, param));
+            body.end().end(); // call
+            andOperator = " && ";
+        }
+
+        if (specialization.getGuards().length > 0) {
+            // Explicitly specified guards
+            for (SpecializationGuardData guard : specialization.getGuards()) {
+                if ((guard.isOnSpecialization() && onSpecialization) || (guard.isOnExecution() && !onSpecialization)) {
+                    body.string(andOperator);
+
+                    startCallOperationMethod(body, guard.getGuardDeclaration());
+
+                    if (needsCast) {
+                        addValueParameterNamesWithCasts(context, body, specialization);
+                    } else {
+                        addValueParameterNames(body, specialization, null, false);
+                    }
+                    body.end().end(); // call
+                    andOperator = " && ";
+                }
+            }
+        }
+    }
+
+    @Override
+    protected void createChildren(NodeData node) {
+        Map<NodeData, List<TypeElement>> childTypes = new LinkedHashMap<>();
+        if (node.getDeclaredChildren() != null && !node.getDeclaredChildren().isEmpty()) {
+            for (NodeData nodeChild : node.getDeclaredChildren()) {
+                NodeCodeGenerator generator = new NodeCodeGenerator(getContext());
+                childTypes.put(nodeChild, generator.process(null, nodeChild).getEnclosedElements());
+            }
+        }
+
+        if (node.getExtensionElements() != null && !node.getExtensionElements().isEmpty()) {
+            NodeGenFactory factory = new NodeGenFactory(context);
+            add(factory, node);
+        }
+
+        if (node.getSpecializations() == null) {
+            return;
+        }
+
+        if (node.needsFactory() || childTypes.size() > 0) {
+            add(new NodeFactoryFactory(context, childTypes), node);
+        }
+    }
+
+    private class NodeGenFactory extends ClassElementFactory<NodeData> {
+
+        public NodeGenFactory(ProcessorContext context) {
+            super(context);
+        }
+
+        @Override
+        protected CodeTypeElement create(NodeData node) {
+            CodeTypeElement clazz = createClass(node, modifiers(PUBLIC, ABSTRACT), genClassName(node), node.getTemplateType().asType(), false);
+
+            for (ExecutableElement executable : ElementFilter.constructorsIn(node.getTemplateType().getEnclosedElements())) {
+                CodeExecutableElement superConstructor = createSuperConstructor(clazz, executable);
+
+                if (superConstructor != null) {
+                    if (superConstructor.getParameters().size() == 1 && Utils.typeEquals(superConstructor.getParameters().get(0).asType(), node.getTemplateType().asType())) {
+                        String originalName = superConstructor.getParameters().get(0).getSimpleName().toString();
+                        superConstructor.getParameters().clear();
+                        superConstructor.getParameters().add(new CodeVariableElement(clazz.asType(), originalName));
+                    }
+                    clazz.add(superConstructor);
+                }
+            }
+
+            if (node.getExtensionElements() != null) {
+                clazz.getEnclosedElements().addAll(node.getExtensionElements());
+            }
+
+            node.setNodeType(clazz.asType());
+
+            return clazz;
+        }
+
+    }
+
+    private class NodeFactoryFactory extends ClassElementFactory<NodeData> {
+
+        private final Map<NodeData, List<TypeElement>> childTypes;
+
+        public NodeFactoryFactory(ProcessorContext context, Map<NodeData, List<TypeElement>> childElements) {
+            super(context);
+            this.childTypes = childElements;
+        }
+
+        @Override
+        protected CodeTypeElement create(NodeData node) {
+            Modifier visibility = Utils.getVisibility(node.getTemplateType().getModifiers());
+            CodeTypeElement clazz = createClass(node, modifiers(), factoryClassName(node), null, false);
+            if (visibility != null) {
+                clazz.getModifiers().add(visibility);
+            }
+            clazz.getModifiers().add(Modifier.FINAL);
+            clazz.add(createConstructorUsingFields(modifiers(PRIVATE), clazz));
+            return clazz;
+        }
+
+        @Override
+        protected void createChildren(NodeData node) {
+            CodeTypeElement clazz = getElement();
+
+            Modifier createVisibility = Utils.getVisibility(clazz.getModifiers());
+
+            if (node.needsFactory()) {
+                createFactoryMethods(node, clazz, createVisibility);
+
+                if (node.getSpecializations().length > 1) {
+                    clazz.add(createCreateSpecializedMethod(node, createVisibility));
+                }
+
+                if (node.needsRewrites(getContext())) {
+                    clazz.add(createSpecializeMethod(node));
+                    clazz.add(createGeneratedGenericMethod(node));
+                }
+
+                for (SpecializationData specialization : node.getSpecializations()) {
+                    add(new SpecializedNodeFactory(context), specialization);
+                }
+            }
+
+            for (NodeData childNode : childTypes.keySet()) {
+                if (childNode.getTemplateType().getModifiers().contains(Modifier.PRIVATE)) {
+                    continue;
+                }
+
+                for (TypeElement type : childTypes.get(childNode)) {
+                    Set<Modifier> typeModifiers = ((CodeTypeElement) type).getModifiers();
+                    Modifier visibility = Utils.getVisibility(type.getModifiers());
+                    typeModifiers.clear();
+                    if (visibility != null) {
+                        typeModifiers.add(visibility);
+                    }
+
+                    typeModifiers.add(Modifier.STATIC);
+                    typeModifiers.add(Modifier.FINAL);
+                    clazz.add(type);
+                }
+            }
+        }
+
+        private void createFactoryMethods(NodeData node, CodeTypeElement clazz, Modifier createVisibility) {
+            for (ExecutableElement constructor : ElementFilter.constructorsIn(Utils.fromTypeMirror(node.getNodeType()).getEnclosedElements())) {
+                if (constructor.getModifiers().contains(PRIVATE)) {
+                    continue;
+                }
+
+                // skip node rewrite constructor
+                if (constructor.getParameters().size() == 1 && typeEquals(constructor.getParameters().get(0).asType(), node.getNodeType())) {
+                    continue;
+                }
+
+                clazz.add(createCreateMethod(node, createVisibility, constructor));
+            }
+        }
+
+        private CodeExecutableElement createCreateMethod(NodeData node, Modifier visibility, ExecutableElement constructor) {
+            CodeExecutableElement method = CodeExecutableElement.clone(getContext().getEnvironment(), constructor);
+            method.setSimpleName(CodeNames.of("create"));
+            method.getModifiers().clear();
+            if (visibility != null) {
+                method.getModifiers().add(visibility);
+            }
+            method.getModifiers().add(Modifier.STATIC);
+            method.setReturnType(node.getNodeType());
+
+            CodeTreeBuilder body = method.createBuilder();
+            body.startReturn();
+            if (node.getSpecializations().length == 0) {
+                body.null_();
+            } else {
+                body.startNew(nodeClassName(node.getSpecializations()[0]));
+                for (VariableElement var : method.getParameters()) {
+                    body.string(var.getSimpleName().toString());
+                }
+                body.end();
+            }
+            body.end();
+            return method;
+        }
+
+        private CodeExecutableElement createCreateSpecializedMethod(NodeData node, Modifier visibility) {
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(), node.getNodeType(), "createSpecialized");
+            if (visibility != null) {
+                method.getModifiers().add(visibility);
+            }
+            method.getModifiers().add(Modifier.STATIC);
+
+            method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME));
+            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "specializationClass"));
+
+            CodeTreeBuilder body = method.createBuilder();
+            boolean first = true;
+            for (TypeData type : node.getTypeSystem().getTypes()) {
+                SpecializationData specialization = node.findUniqueSpecialization(type);
+                if (specialization != null && !type.isGeneric()) {
+                    if (first) {
+                        body.startIf();
+                        first = false;
+                    } else {
+                        body.startElseIf();
+                    }
+                    body.string("specializationClass == ").type(type.getBoxedType()).string(".class").end().startBlock();
+                    body.startReturn().startNew(nodeClassName(specialization));
+                    body.string(THIS_NODE_LOCAL_VAR_NAME);
+                    body.end().end(); // new, return
+
+                    body.end(); // if
+                }
+            }
+            body.startReturn().startNew(nodeClassName(node.getGenericSpecialization()));
+            body.string(THIS_NODE_LOCAL_VAR_NAME);
+            body.end().end();
+            return method;
+        }
+
+        private CodeExecutableElement createSpecializeMethod(NodeData node) {
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, STATIC), node.getNodeType(), "specialize");
+            method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME));
+            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "minimumState"));
+            addValueParameters(method, node.getGenericSpecialization(), false);
+
+            CodeTreeBuilder body = method.createBuilder();
+            body.startStatement().string("boolean allowed = (minimumState == ").string(nodeClassName(node.getSpecializations()[0])).string(".class)").end();
+
+            for (int i = 1; i < node.getSpecializations().length; i++) {
+                SpecializationData specialization = node.getSpecializations()[i];
+                body.startStatement().string("allowed = allowed || (minimumState == ").string(nodeClassName(specialization)).string(".class)").end();
+
+                if (specialization.isGeneric()) {
+                    body.startIf().string("allowed").end().startBlock();
+                } else {
+                    body.startIf().string("allowed");
+                    emitGuards(getContext(), body, " && ", specialization, true, true);
+                    body.end().startBlock();
+                }
+                body.startReturn().startNew(nodeClassName(specialization));
+                body.string(THIS_NODE_LOCAL_VAR_NAME);
+                body.end().end();
+                body.end(); // block
+            }
+            body.startThrow().startNew(getContext().getType(IllegalArgumentException.class)).end().end();
+
+            return method;
+        }
+
+        private CodeExecutableElement createGeneratedGenericMethod(NodeData node) {
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE, STATIC), node.getGenericSpecialization().getReturnType().getActualType(), "generatedGeneric");
+            method.addParameter(new CodeVariableElement(node.getNodeType(), THIS_NODE_LOCAL_VAR_NAME));
+            addValueParameters(method, node.getGenericSpecialization(), true);
+
+            CodeTreeBuilder builder = method.createBuilder();
+            boolean ifStarted = false;
+            for (int i = 0; i < node.getSpecializations().length; i++) {
+                SpecializationData specialization = node.getSpecializations()[i];
+                if (specialization.isUninitialized()) {
+                    continue;
+                }
+                if (!specialization.isGeneric()) {
+                    if (!ifStarted) {
+                        builder.startIf();
+                        ifStarted = true;
+                    } else {
+                        builder.startElseIf();
+                    }
+                    emitGuards(getContext(), builder, "", specialization, false, true);
+                    builder.end().startBlock();
+                } else {
+                    builder.startElseBlock();
+                }
+
+                emitInvokeDoMethod(builder, specialization, 0);
+                builder.end();
+            }
+            return method;
+        }
+
+        private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization, int level) {
+            if (specialization.getExceptions().length > 0) {
+                builder.startTryBlock();
+            }
+
+            builder.startReturn();
+            startCallOperationMethod(builder, specialization);
+            addValueParameterNamesWithCasts(context, builder, specialization);
+            builder.end().end(); // start call operation
+            builder.end(); // return
+
+            if (specialization.getExceptions().length > 0) {
+                for (SpecializationThrowsData exception : specialization.getExceptions()) {
+                    builder.end().startCatchBlock(exception.getJavaClass(), "ex" + level);
+                    emitInvokeDoMethod(builder, exception.getTransitionTo(), level + 1);
+                }
+                builder.end();
+            }
+        }
+    }
+
+    private class SpecializedNodeFactory extends ClassElementFactory<SpecializationData> {
+
+        public SpecializedNodeFactory(ProcessorContext context) {
+            super(context);
+        }
+
+        @Override
+        public CodeTypeElement create(SpecializationData specialization) {
+            NodeData node = specialization.getNode();
+            CodeTypeElement clazz = createClass(node, modifiers(PRIVATE, STATIC, FINAL), nodeClassName(specialization), node.getNodeType(), false);
+            return clazz;
+        }
+
+        @Override
+        protected void createChildren(SpecializationData specialization) {
+            CodeTypeElement clazz = getElement();
+            NodeData node = specialization.getNode();
+
+            TypeElement superTypeElement = Utils.fromTypeMirror(clazz.getSuperclass());
+            for (ExecutableElement constructor : ElementFilter.constructorsIn(superTypeElement.getEnclosedElements())) {
+                ExecutableElement superConstructor = createSuperConstructor(clazz, constructor);
+                if (superConstructor != null) {
+                    clazz.add(superConstructor);
+                }
+            }
+
+            for (ExecutableTypeData execType : node.getExecutableTypes()) {
+                if (execType.isFinal()) {
+                    continue;
+                }
+                CodeExecutableElement method = CodeExecutableElement.clone(getContext().getEnvironment(), execType.getMethod());
+                if (method.getParameters().size() == 1) {
+                    CodeVariableElement var = CodeVariableElement.clone(method.getParameters().get(0));
+                    var.setName("frame");
+                    method.getParameters().set(0, var);
+                }
+                method.getModifiers().remove(Modifier.ABSTRACT);
+                clazz.add(method);
+
+                TypeData primaryType = specialization.getReturnType().getActualTypeData(node.getTypeSystem());
+                if (primaryType == execType.getType()) {
+                    buildFunctionalExecuteMethod(method.createBuilder(), specialization);
+                } else {
+                    buildCastingExecuteMethod(method.createBuilder(), specialization, execType.getType());
+                }
+            }
+
+            if (node.needsRewrites(getContext()) && !specialization.isGeneric() && !specialization.isUninitialized()) {
+                buildSpecializeStateMethod(clazz, specialization);
+            }
+        }
+
+        private void buildCastingExecuteMethod(CodeTreeBuilder builder, SpecializationData specialization, TypeData type) {
+            NodeData node = specialization.getNode();
+            TypeSystemData typeSystem = node.getTypeSystem();
+
+            if (!type.isVoid()) {
+                builder.startStatement().type(specialization.getReturnType().getActualType()).string(" result").end();
+            }
+
+            TypeData primaryType = specialization.getReturnType().getActualTypeData(typeSystem);
+            ExecutableTypeData execType = specialization.getNode().findExecutableType(primaryType);
+
+            boolean needsTry = !specialization.getReturnType().getActualTypeData(typeSystem).isGeneric();
+            if (needsTry) {
+                builder.startTryBlock();
+            }
+
+            builder.startStatement();
+            if (!type.isVoid()) {
+                builder.string("result = ");
+            }
+            buildExecute(builder, null, execType);
+            builder.end(); // statement
+
+            if (needsTry) {
+                builder.end().startCatchBlock(getUnexpectedValueException(), "ex");
+
+                if (!type.isVoid()) {
+                    builder.startReturn();
+                    if (!type.isGeneric()) {
+                        startCallTypeSystemMethod(getContext(), builder, node, TypeSystemCodeGenerator.expectTypeMethodName(type));
+                    }
+
+                    builder.string("ex.getResult()");
+
+                    if (!type.isGeneric()) {
+                        builder.end().end();
+                    }
+                    builder.end(); // return
+                } else {
+                    builder.string("// ignore").newLine();
+                }
+            }
+            builder.end(); // try/catch
+
+            if (!type.isVoid()) {
+                builder.startReturn();
+                if (!type.isGeneric()) {
+                    startCallTypeSystemMethod(getContext(), builder, node, TypeSystemCodeGenerator.expectTypeMethodName(type));
+                }
+                builder.string("result");
+                if (!type.isGeneric()) {
+                    builder.end().end();
+                }
+                builder.end(); // return
+            }
+        }
+
+        private void buildFunctionalExecuteMethod(CodeTreeBuilder builder, SpecializationData specialization) {
+            NodeData node = specialization.getNode();
+            TypeSystemData typeSystem = node.getTypeSystem();
+
+            for (NodeFieldData field : node.getFields()) {
+                if (field.getExecutionKind() == ExecutionKind.IGNORE) {
+                    continue;
+                }
+
+                ActualParameter parameterType = specialization.findParameter(field.getName());
+
+                if (parameterType.getActualTypeData(typeSystem).isGeneric()) {
+                    buildGenericValueExecute(builder, specialization, field, null);
+                } else {
+                    buildSpecializedValueExecute(builder, specialization, field);
+                }
+            }
+
+            if (specialization.hasDynamicGuards()) {
+                builder.startIf();
+                emitGuards(getContext(), builder, "", specialization, false, false);
+                builder.end().startBlock();
+            }
+            if (specialization.getExceptions().length > 0) {
+                builder.startTryBlock();
+            }
+
+            if (specialization.isUninitialized()) {
+                for (TemplateMethod listener : node.getSpecializationListeners()) {
+                    builder.startStatement();
+                    startCallOperationMethod(builder, listener);
+                    addValueParameterNames(builder, listener, null, false);
+                    builder.end().end();
+                    builder.end(); // statement
+                }
+
+                builder.startStatement();
+                builder.startCall("replace");
+                if (node.needsRewrites(getContext())) {
+                    builder.startCall(factoryClassName(node), "specialize");
+                    builder.string("this");
+                    builder.typeLiteral(builder.getRoot().getEnclosingClass().asType());
+                    addValueParameterNames(builder, specialization, null, false);
+                    builder.end(); // call replace, call specialize
+                } else {
+                    builder.startCall(factoryClassName(node), "createSpecialized").string("this").string("null").end();
+                }
+                builder.end().end();
+            }
+
+            if ((specialization.isUninitialized() || specialization.isGeneric()) && node.needsRewrites(getContext())) {
+                builder.startReturn().startCall(factoryClassName(node), "generatedGeneric");
+                builder.string("this");
+                addValueParameterNames(builder, specialization, null, true);
+                builder.end().end();
+            } else {
+                builder.startReturn();
+
+                if (specialization.isUninitialized()) {
+                    startCallOperationMethod(builder, specialization.getNode().getGenericSpecialization());
+                } else {
+                    startCallOperationMethod(builder, specialization);
+                }
+                addValueParameterNames(builder, specialization, null, false);
+                builder.end().end(); // operation call
+                builder.end(); // return
+            }
+
+            if (specialization.getExceptions().length > 0) {
+                for (SpecializationThrowsData exception : specialization.getExceptions()) {
+                    builder.end().startCatchBlock(exception.getJavaClass(), "ex");
+                    buildThrowSpecialize(builder, exception.getTransitionTo(), null);
+                }
+                builder.end();
+            }
+            if (specialization.hasDynamicGuards()) {
+                builder.end().startElseBlock();
+                buildThrowSpecialize(builder, specialization.findNextSpecialization(), null);
+                builder.end();
+            }
+        }
+
+        private void buildGenericValueExecute(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData field, NodeFieldData exceptionSpec) {
+            ActualParameter specParameter = specialization.findParameter(field.getName());
+
+            boolean shortCircuit = startShortCircuit(builder, specialization, field, exceptionSpec);
+
+            builder.startStatement();
+            if (!shortCircuit) {
+                builder.type(specialization.getNode().getTypeSystem().getGenericType());
+                builder.string(" ");
+            }
+
+            builder.string(valueName(specialization, specParameter));
+            builder.string(" = ");
+            ExecutableTypeData genericExecutableType = field.getNodeData().findGenericExecutableType(getContext());
+            if (genericExecutableType == null) {
+                throw new AssertionError("Must have generic executable type. Parser validation most likely failed. " + Arrays.toString(field.getNodeData().getExecutableTypes()));
+            }
+            buildExecute(builder, field, genericExecutableType);
+            builder.end();
+
+            endShortCircuit(builder, shortCircuit);
+        }
+
+        private void buildExecute(CodeTreeBuilder builder, NodeFieldData field, ExecutableTypeData execType) {
+            if (field != null) {
+                Element accessElement = field.getAccessElement();
+                if (accessElement.getKind() == ElementKind.METHOD) {
+                    builder.startCall(accessElement.getSimpleName().toString()).end();
+                } else if (accessElement.getKind() == ElementKind.FIELD) {
+                    builder.string("this.").string(accessElement.getSimpleName().toString());
+                } else {
+                    throw new AssertionError();
+                }
+                builder.string(".");
+            }
+            builder.startCall(execType.getMethodName());
+            if (execType.getParameters().length == 1) {
+                builder.string("frame");
+            }
+            builder.end();
+        }
+
+        private void buildSpecializedValueExecute(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData field) {
+            ActualParameter param = specialization.findParameter(field.getName());
+            boolean shortCircuit = startShortCircuit(builder, specialization, field, null);
+
+            if (!shortCircuit) {
+                builder.startStatement().type(param.getActualType()).string(" ").string(valueName(specialization, param)).end();
+            }
+
+            ExecutableTypeData execType = field.getNodeData().findExecutableType(param.getActualTypeData(field.getNodeData().getTypeSystem()));
+
+            if (execType.hasUnexpectedValue(getContext())) {
+                builder.startTryBlock();
+            }
+
+            builder.startStatement().string(valueName(field)).string(" = ");
+            buildExecute(builder, field, execType);
+            builder.end();
+
+            if (execType.hasUnexpectedValue(getContext())) {
+                builder.end().startCatchBlock(getUnexpectedValueException(), "ex");
+                boolean execute = false;
+                for (NodeFieldData exField : specialization.getNode().getFields()) {
+                    if (exField.getExecutionKind() == ExecutionKind.IGNORE) {
+                        continue;
+                    }
+                    if (execute) {
+                        buildGenericValueExecute(builder, specialization.getNode().getGenericSpecialization(), exField, field);
+                    } else if (exField == field) {
+                        execute = true;
+                    }
+                }
+                buildThrowSpecialize(builder, specialization.findNextSpecialization(), param.getSpecification());
+                builder.end(); // catch block
+            }
+
+            endShortCircuit(builder, shortCircuit);
+            builder.newLine();
+        }
+
+        private boolean startShortCircuit(CodeTreeBuilder builder, SpecializationData specialization, NodeFieldData forField, NodeFieldData exceptionField) {
+            if (forField.getExecutionKind() != ExecutionKind.SHORT_CIRCUIT) {
+                return false;
+            }
+
+            ActualParameter parameter = specialization.findParameter(forField.getName());
+            ActualParameter shortCircuitParam = specialization.getPreviousParam(parameter);
+
+            int shortCircuitIndex = 0;
+            for (NodeFieldData field : specialization.getNode().getFields()) {
+                if (field.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) {
+                    if (field == forField) {
+                        break;
+                    }
+                    shortCircuitIndex++;
+                }
+            }
+
+            builder.startStatement().type(shortCircuitParam.getActualType()).string(" ").string(valueName(specialization, shortCircuitParam)).string(" = ");
+            ShortCircuitData shortCircuitData = specialization.getShortCircuits()[shortCircuitIndex];
+
+            startCallOperationMethod(builder, shortCircuitData);
+            addValueParameterNames(builder, shortCircuitData, exceptionField != null ? exceptionField.getName() : null, false);
+            builder.end().end(); // call operation
+
+            builder.end(); // statement
+
+            builder.declaration(parameter.getActualType(), valueName(specialization, parameter), CodeTreeBuilder.createBuilder().defaultValue(parameter.getActualType()));
+            builder.startIf().string(shortCircuitParam.getSpecification().getName()).end();
+            builder.startBlock();
+
+            return true;
+        }
+
+        private void endShortCircuit(CodeTreeBuilder builder, boolean shortCircuit) {
+            if (shortCircuit) {
+                builder.end();
+            }
+        }
+
+        private void buildThrowSpecialize(CodeTreeBuilder builder, SpecializationData nextSpecialization, ParameterSpec exceptionSpec) {
+            boolean canThrowUnexpected = Utils.canThrowType(builder.findMethod().getThrownTypes(), getContext().getTruffleTypes().getUnexpectedValueException());
+
+            CodeTreeBuilder specializeCall = CodeTreeBuilder.createBuilder();
+            specializeCall.startCall("specialize");
+            specializeCall.string(nodeClassName(nextSpecialization) + ".class");
+            addValueParameterNames(specializeCall, nextSpecialization.getNode().getGenericSpecialization(), exceptionSpec != null ? exceptionSpec.getName() : null, true);
+            specializeCall.end().end();
+
+            if (canThrowUnexpected) {
+                builder.startThrow();
+                builder.startNew(getContext().getTruffleTypes().getUnexpectedValueException());
+                builder.tree(specializeCall.getRoot());
+                builder.end().end();
+            } else {
+                builder.startReturn();
+                builder.tree(specializeCall.getRoot());
+                builder.end();
+            }
+
+        }
+
+        private void buildSpecializeStateMethod(CodeTypeElement clazz, SpecializationData specialization) {
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE), specialization.getNode().getTypeSystem().getGenericType(), "specialize");
+            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "minimumState"));
+            addValueParameters(method, specialization.getNode().getGenericSpecialization(), true);
+            clazz.add(method);
+
+            CodeTreeBuilder builder = method.createBuilder();
+            for (TemplateMethod listener : specialization.getNode().getSpecializationListeners()) {
+                builder.startStatement();
+                startCallOperationMethod(builder, listener);
+                addValueParameterNames(builder, listener, null, false);
+                builder.end().end(); // call operation
+                builder.end(); // statement
+            }
+
+            builder.startStatement();
+            builder.startCall("replace");
+            builder.startCall(factoryClassName(specialization.getNode()), "specialize").string("this").string("minimumState");
+            addValueParameterNames(builder, specialization.getNode().getGenericSpecialization(), null, false);
+            builder.end();
+            builder.end(); // call replace
+            builder.end(); // statement
+
+            ExecutableElement generatedGeneric = clazz.getEnclosingClass().getMethod("generatedGeneric");
+
+            CodeTreeBuilder genericBuilder = CodeTreeBuilder.createBuilder();
+            genericBuilder.startCall(factoryClassName(specialization.getNode()), "generatedGeneric");
+            genericBuilder.string("this");
+            addValueParameterNames(genericBuilder, specialization.getNode().getGenericSpecialization(), null, true);
+            genericBuilder.end(); // call generated generic
+
+            if (Utils.isVoid(generatedGeneric.getReturnType())) {
+                builder.declaration(generatedGeneric.getReturnType(), "genericResult", genericBuilder.getRoot());
+                builder.startReturn().string("null").end();
+            } else {
+                builder.startReturn().tree(genericBuilder.getRoot()).end();
+            }
+        }
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,329 @@
+/*
+ * 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.truffle.codegen.processor.node;
+
+import java.util.*;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.FieldKind;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class NodeData extends Template {
+
+    private NodeData parent;
+    private List<NodeData> declaredChildren;
+
+    private final TypeSystemData typeSystem;
+
+    private NodeFieldData[] fields;
+    private SpecializationData[] specializations;
+    private TemplateMethod[] specializationListeners;
+    private GuardData[] guards;
+    private ExecutableTypeData[] executableTypes;
+
+    private TypeMirror nodeType;
+
+    public NodeData(TypeElement type, TypeSystemData typeSystem) {
+        super(type, null);
+        this.typeSystem = typeSystem;
+    }
+
+    public TypeMirror getNodeType() {
+        if (nodeType != null) {
+            return nodeType;
+        }
+        return getTemplateType().asType();
+    }
+
+    public boolean needsFactory() {
+        if (specializations == null) {
+            return false;
+        }
+        boolean noSpecialization = true;
+        for (SpecializationData specialization : specializations) {
+            noSpecialization = noSpecialization && specialization.isGeneric() || specialization.isUninitialized();
+        }
+        return !noSpecialization;
+    }
+
+    void setDeclaredChildren(List<NodeData> declaredChildren) {
+        this.declaredChildren = declaredChildren;
+
+        for (NodeData child : declaredChildren) {
+            child.parent = this;
+        }
+    }
+
+    public NodeData getParent() {
+        return parent;
+    }
+
+    public List<NodeData> getDeclaredChildren() {
+        return declaredChildren;
+    }
+
+    public void setNodeType(TypeMirror nodeType) {
+        this.nodeType = nodeType;
+    }
+
+    public List<TemplateMethod> getAllTemplateMethods() {
+        List<TemplateMethod> methods = new ArrayList<>();
+
+        for (SpecializationData specialization : getSpecializations()) {
+            methods.add(specialization);
+            if (specialization.getShortCircuits() != null) {
+                methods.addAll(Arrays.asList(specialization.getShortCircuits()));
+            }
+        }
+
+        methods.addAll(Arrays.asList(getSpecializationListeners()));
+        methods.addAll(Arrays.asList(getExecutableTypes()));
+        methods.addAll(Arrays.asList(getGuards()));
+
+        return methods;
+    }
+
+    public TemplateMethod[] getSpecializationListeners() {
+        return specializationListeners;
+    }
+
+    public List<GuardData> findGuards(String name) {
+        List<GuardData> foundGuards = new ArrayList<>();
+        for (GuardData guardData : getGuards()) {
+            if (guardData.getMethodName().equals(name)) {
+                foundGuards.add(guardData);
+            }
+        }
+        return foundGuards;
+    }
+
+    public ExecutableTypeData[] getExecutableTypes() {
+        return executableTypes;
+    }
+
+    public ExecutableTypeData findGenericExecutableType(ProcessorContext context) {
+        List<ExecutableTypeData> types = findGenericExecutableTypes(context);
+        if (types.size() == 1) {
+            return types.get(0);
+        } else {
+            ExecutableTypeData execType = null;
+            for (ExecutableTypeData type : types) {
+                if (!type.getReturnType().getActualTypeData(getTypeSystem()).isVoid()) {
+                    if (execType != null) {
+                        // multiple generic types not allowed
+                        return null;
+                    }
+                    execType = type;
+                }
+            }
+            return execType;
+        }
+    }
+
+    private List<ExecutableTypeData> findGenericExecutableTypes(ProcessorContext context) {
+        List<ExecutableTypeData> types = new ArrayList<>();
+        for (ExecutableTypeData type : executableTypes) {
+            if (!type.hasUnexpectedValue(context)) {
+                types.add(type);
+            }
+        }
+        return types;
+    }
+
+    public ExecutableTypeData findExecutableType(TypeData prmitiveType) {
+        for (ExecutableTypeData type : executableTypes) {
+            if (Utils.typeEquals(type.getType().getPrimitiveType(), prmitiveType.getPrimitiveType())) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+    public SpecializationData findUniqueSpecialization(TypeData type) {
+        SpecializationData result = null;
+        for (SpecializationData specialization : specializations) {
+            if (specialization.getReturnType().getActualTypeData(getTypeSystem()) == type) {
+                if (result != null) {
+                    // Result not unique;
+                    return null;
+                }
+                result = specialization;
+            }
+        }
+        return result;
+    }
+
+    public TypeMirror[] getExecutablePrimitiveTypeMirrors() {
+        TypeMirror[] typeMirrors = new TypeMirror[executableTypes.length];
+        for (int i = 0; i < executableTypes.length; i++) {
+            typeMirrors[i] = executableTypes[i].getType().getPrimitiveType();
+        }
+        return typeMirrors;
+    }
+
+    void setExecutableTypes(ExecutableTypeData[] declaredExecuableTypes) {
+        this.executableTypes = declaredExecuableTypes;
+    }
+
+    void setFields(NodeFieldData[] fields) {
+        this.fields = fields;
+    }
+
+    void setSpecializations(SpecializationData[] specializations) {
+        this.specializations = specializations;
+    }
+
+    void setSpecializationListeners(TemplateMethod[] specializationListeners) {
+        this.specializationListeners = specializationListeners;
+    }
+
+    void setGuards(GuardData[] guards) {
+        this.guards = guards;
+    }
+
+    public GuardData[] getGuards() {
+        return guards;
+    }
+
+    public NodeFieldData[] filterFields(FieldKind fieldKind, ExecutionKind usage) {
+        List<NodeFieldData> filteredFields = new ArrayList<>();
+        NodeFieldData[] resolvedFields = getFields();
+        if (fields != null) {
+            for (NodeFieldData field : resolvedFields) {
+                if (usage == null || field.getExecutionKind() == usage) {
+                    if (fieldKind == null || field.getKind() == fieldKind) {
+                        filteredFields.add(field);
+                    }
+                }
+            }
+        }
+        return filteredFields.toArray(new NodeFieldData[filteredFields.size()]);
+    }
+
+    public boolean hasUnexpectedExecutableTypes(ProcessorContext context) {
+        for (ExecutableTypeData type : getExecutableTypes()) {
+            if (type.hasUnexpectedValue(context)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public boolean needsRewrites(ProcessorContext context) {
+        boolean needsRewrites = false;
+        for (NodeFieldData field : getFields()) {
+            if (field.getExecutionKind() == ExecutionKind.DEFAULT || field.getExecutionKind() == ExecutionKind.SHORT_CIRCUIT) {
+                if (!field.getNodeData().hasUnexpectedExecutableTypes(context)) {
+                    continue;
+                }
+
+                needsRewrites = true;
+                break;
+            }
+        }
+
+        needsRewrites &= specializations.length >= 2;
+        return needsRewrites;
+    }
+
+    public SpecializationData getGenericSpecialization() {
+        for (SpecializationData specialization : specializations) {
+            if (specialization.isGeneric()) {
+                return specialization;
+            }
+        }
+        return null;
+    }
+
+    public TypeSystemData getTypeSystem() {
+        if (typeSystem != null) {
+            return typeSystem;
+        } else {
+            return null;
+        }
+    }
+
+    public NodeFieldData[] getFields() {
+        return fields;
+    }
+
+    public NodeFieldData[] getDeclaredFields() {
+        return fields;
+    }
+
+    public SpecializationData[] getSpecializations() {
+        return specializations;
+    }
+
+    // @formatter:off
+    public String dump() {
+        StringBuilder b = new StringBuilder();
+        b.append(String.format("[name = %s\n" +
+                        "  typeSystem = %s\n" +
+                        "  fields = %s\n" +
+                        "  types = %s\n" +
+                        "  specializations = %s\n" +
+                        "  guards = %s\n" +
+                        "]", Utils.getQualifiedName(getTemplateType()),
+                            getTypeSystem(),
+                            dumpList(fields),
+                            dumpList(getExecutableTypes()),
+                            dumpList(getSpecializations()),
+                            dumpList(guards)
+                        ));
+        return b.toString();
+    }
+    // @formatter:on
+
+    private static String dumpList(Object[] array) {
+        if (array == null) {
+            return "null";
+        }
+
+        StringBuilder b = new StringBuilder();
+        b.append("[");
+        for (Object object : array) {
+            b.append("\n");
+            b.append("    ");
+            b.append(object);
+            b.append(", ");
+        }
+        b.append("\n  ]");
+        return b.toString();
+    }
+
+    public NodeFieldData findField(String name) {
+        for (NodeFieldData field : getFields()) {
+            if (field.getName().equals(name)) {
+                return field;
+            }
+        }
+        return null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeFieldData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,92 @@
+/*
+ * 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.truffle.codegen.processor.node;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+public class NodeFieldData {
+
+    public enum FieldKind {
+        FIELD, CHILD, CHILDREN
+    }
+
+    public enum ExecutionKind {
+        DEFAULT, IGNORE, SHORT_CIRCUIT
+    }
+
+    private final VariableElement fieldElement;
+    private final Element accessElement;
+    private final AnnotationMirror childAnnotationMirror;
+
+    private final FieldKind fieldKind;
+    private final ExecutionKind executionKind;
+    private final NodeData nodeData;
+
+    public NodeFieldData(NodeData typeNodeData, VariableElement fieldElement, Element accessElement, AnnotationMirror childAnnotationMirror, FieldKind fieldKind, ExecutionKind executionKind) {
+        this.fieldElement = fieldElement;
+        this.accessElement = accessElement;
+        this.childAnnotationMirror = childAnnotationMirror;
+        this.nodeData = typeNodeData;
+        this.fieldKind = fieldKind;
+        this.executionKind = executionKind;
+    }
+
+    public VariableElement getFieldElement() {
+        return fieldElement;
+    }
+
+    public Element getAccessElement() {
+        return accessElement;
+    }
+
+    public AnnotationMirror getChildAnnotationMirror() {
+        return childAnnotationMirror;
+    }
+
+    public TypeMirror getType() {
+        return fieldElement.asType();
+    }
+
+    public FieldKind getKind() {
+        return fieldKind;
+    }
+
+    public ExecutionKind getExecutionKind() {
+        return executionKind;
+    }
+
+    public NodeData getNodeData() {
+        return nodeData;
+    }
+
+    public String getName() {
+        return fieldElement.getSimpleName().toString();
+    }
+
+    @Override
+    public String toString() {
+        return "NodeFieldData[name=" + getName() + ", kind=" + fieldKind + ", execution=" + executionKind + "]";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/NodeParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,766 @@
+/*
+ * 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+import javax.lang.model.util.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.nodes.Node.Child;
+import com.oracle.truffle.api.nodes.Node.Children;
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.ast.*;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.FieldKind;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class NodeParser extends TemplateParser<NodeData> {
+
+    public static final List<Class<? extends Annotation>> ANNOTATIONS = Arrays.asList(Generic.class, GuardCheck.class, TypeSystemReference.class, ShortCircuit.class, Specialization.class,
+                    SpecializationGuard.class, SpecializationListener.class, SpecializationThrows.class);
+
+    private static final boolean DEBUG = false;
+
+    private Map<String, NodeData> parsedNodes;
+    private TypeElement originalType;
+
+    public NodeParser(ProcessorContext c) {
+        super(c);
+    }
+
+    @Override
+    protected NodeData parse(Element element, AnnotationMirror mirror) {
+        assert element instanceof TypeElement;
+        try {
+            parsedNodes = new HashMap<>();
+            originalType = (TypeElement) element;
+
+            return parseInnerClassHierarchy((TypeElement) element);
+        } finally {
+            if (DEBUG) {
+                NodeData parsed = parsedNodes.get(Utils.getQualifiedName(originalType));
+                if (parsed != null) {
+                    String dump = parsed.dump();
+                    log.error("Node parsed: %s", dump);
+                    System.out.println("Parsed: " + dump);
+                }
+            }
+            parsedNodes = null;
+            originalType = null;
+        }
+    }
+
+    @Override
+    public boolean isDelegateToRootDeclaredType() {
+        return true;
+    }
+
+    private NodeData parseInnerClassHierarchy(TypeElement rootType) {
+        List<? extends TypeElement> types = ElementFilter.typesIn(rootType.getEnclosedElements());
+        List<NodeData> children = new ArrayList<>();
+        for (TypeElement childElement : types) {
+            NodeData childNode = parseInnerClassHierarchy(childElement);
+            if (childNode != null) {
+                children.add(childNode);
+            }
+        }
+        NodeData rootNode = resolveNode(rootType);
+        if (rootNode == null && children.size() > 0) {
+            rootNode = new NodeData(rootType, null);
+        }
+        if (rootNode != null) {
+            rootNode.setDeclaredChildren(children);
+        }
+        return rootNode;
+    }
+
+    private NodeData resolveNode(TypeElement currentType) {
+        String typeName = Utils.getQualifiedName(currentType);
+        if (!parsedNodes.containsKey(typeName)) {
+            NodeData node = parseNode(currentType);
+            if (node != null) {
+                parsedNodes.put(typeName, node);
+            }
+            return node;
+        }
+        return parsedNodes.get(typeName);
+    }
+
+    private NodeData parseNode(TypeElement type) {
+        if (Utils.findAnnotationMirror(processingEnv, type, GeneratedBy.class) != null) {
+            // generated nodes get called again.
+            return null;
+        }
+        if (!Utils.isAssignable(type.asType(), context.getTruffleTypes().getNode())) {
+            return null; // not a node
+        }
+
+        List<Element> elements = new ArrayList<>(context.getEnvironment().getElementUtils().getAllMembers(type));
+        List<TypeElement> typeHierarchy = findSuperClasses(new ArrayList<TypeElement>(), type);
+        Collections.reverse(typeHierarchy);
+
+        AnnotationMirror typeSystemMirror = findFirstAnnotation(typeHierarchy, TypeSystemReference.class);
+        if (typeSystemMirror == null) {
+            log.error(originalType, "No @%s annotation found in type hierarchy.", TypeSystemReference.class.getSimpleName());
+            return null;
+        }
+
+        TypeMirror typeSytemType = Utils.getAnnotationValueType(typeSystemMirror, "value");
+        final TypeSystemData typeSystem = (TypeSystemData) context.getTemplate(typeSytemType, true);
+        if (typeSystem == null) {
+            log.error(originalType, "The used type system '%s' is invalid.", Utils.getQualifiedName(typeSytemType));
+            return null;
+        }
+
+        NodeData nodeData = new NodeData(type, typeSystem);
+
+        nodeData.setExtensionElements(getExtensionParser().parseAll(type, elements));
+        if (nodeData.getExtensionElements() != null) {
+            elements.addAll(nodeData.getExtensionElements());
+        }
+
+        List<ExecutableTypeData> executableTypes = filterExecutableTypes(new ExecutableTypeMethodParser(context, nodeData).parse(elements));
+
+        nodeData.setExecutableTypes(executableTypes.toArray(new ExecutableTypeData[executableTypes.size()]));
+
+        parsedNodes.put(Utils.getQualifiedName(type), nodeData); // node fields will resolve node
+                                                                 // types, to avoid endless loops
+
+        NodeFieldData[] fields = parseFields(nodeData, elements, typeHierarchy);
+        if (fields == null) {
+            return null;
+        }
+        nodeData.setFields(fields);
+
+        List<SpecializationData> genericSpecializations = new GenericParser(context, nodeData).parse(elements);
+        List<GuardData> guards = new GuardParser(context, nodeData, nodeData.getTypeSystem()).parse(elements);
+        nodeData.setGuards(guards.toArray(new GuardData[guards.size()]));
+
+        SpecializationMethodParser specializationParser = new SpecializationMethodParser(context, nodeData);
+        List<SpecializationData> specializations = specializationParser.parse(elements);
+        List<ShortCircuitData> shortCircuits = new ShortCircuitParser(context, nodeData).parse(elements);
+        List<TemplateMethod> listeners = new SpecializationListenerParser(context, nodeData).parse(elements);
+
+        if (specializations == null || genericSpecializations == null || shortCircuits == null || listeners == null || guards == null) {
+            return null;
+        }
+
+        SpecializationData genericSpecialization = null;
+        if (genericSpecializations.size() > 1) {
+            for (SpecializationData generic : genericSpecializations) {
+                log.error(generic.getMethod(), "Only one method with @%s is allowed per operation.", Generic.class.getSimpleName());
+            }
+            return null;
+        } else if (genericSpecializations.size() == 1) {
+            genericSpecialization = genericSpecializations.get(0);
+        }
+
+        if (specializations.size() > 1 && genericSpecialization == null) {
+            log.error(originalType, "Need a @%s method.", Generic.class.getSimpleName());
+            return null;
+        }
+
+        Collections.sort(specializations, new Comparator<SpecializationData>() {
+
+            @Override
+            public int compare(SpecializationData o1, SpecializationData o2) {
+                return compareSpecialization(typeSystem, o1, o2);
+            }
+        });
+
+        List<SpecializationData> allSpecializations = new ArrayList<>(specializations);
+        if (genericSpecialization != null) {
+            allSpecializations.add(genericSpecialization);
+            CodeExecutableElement uninitializedMethod = new CodeExecutableElement(Utils.modifiers(Modifier.PUBLIC), context.getType(void.class), "doUninitialized");
+            TemplateMethod uninializedMethod = new TemplateMethod(nodeData, genericSpecialization.getSpecification(), uninitializedMethod, genericSpecialization.getMarkerAnnotation(),
+                            genericSpecialization.getReturnType(), genericSpecialization.getParameters());
+            allSpecializations.add(0, new SpecializationData(uninializedMethod, false, true));
+        }
+
+        for (SpecializationData specialization : allSpecializations) {
+            specialization.setNode(nodeData);
+        }
+
+        // verify order is not ambiguous
+        if (!verifySpecializationOrder(typeSystem, specializations)) {
+            return null;
+        }
+
+        nodeData.setSpecializations(allSpecializations.toArray(new SpecializationData[allSpecializations.size()]));
+        nodeData.setSpecializationListeners(listeners.toArray(new TemplateMethod[listeners.size()]));
+
+        if (!verifyMissingAbstractMethods(nodeData, elements)) {
+            return null;
+        }
+
+        if (!assignShortCircuitsToSpecializations(nodeData, allSpecializations, shortCircuits)) {
+            return null;
+        }
+
+        if (!verifyConstructors(nodeData)) {
+            return null;
+        }
+
+        if (!verifyNamingConvention(specializations, "do")) {
+            return null;
+        }
+
+        if (!verifyNamesUnique(specializations)) {
+            return null;
+        }
+
+        if (!verifyNamingConvention(shortCircuits, "needs")) {
+            return null;
+        }
+
+        if (!verifySpecializationThrows(typeSystem, specializations)) {
+            return null;
+        }
+
+        return nodeData;
+    }
+
+    private boolean verifyMissingAbstractMethods(NodeData nodeData, List<Element> elements) {
+        if (nodeData.needsFactory()) {
+            // missing abstract methods only needs to be implemented
+            // if we need go generate factory for it.
+            return true;
+        }
+
+        Set<Element> unusedElements = new HashSet<>(elements);
+        for (TemplateMethod method : nodeData.getAllTemplateMethods()) {
+            unusedElements.remove(method.getMethod());
+        }
+        if (nodeData.getExtensionElements() != null) {
+            unusedElements.removeAll(nodeData.getExtensionElements());
+        }
+
+        boolean valid = true;
+        for (ExecutableElement unusedMethod : ElementFilter.methodsIn(unusedElements)) {
+            if (unusedMethod.getModifiers().contains(Modifier.ABSTRACT)) {
+                context.getLog().error(nodeData.getTemplateType(), "The type %s must implement the inherited abstract method %s.", Utils.getSimpleName(nodeData.getTemplateType()),
+                                Utils.getReadableSignature(unusedMethod));
+                valid = false;
+            }
+        }
+
+        return valid;
+    }
+
+    private boolean verifyConstructors(NodeData nodeData) {
+        TypeElement type = Utils.fromTypeMirror(nodeData.getNodeType());
+        if (!nodeData.needsRewrites(context)) {
+            // no specialization constructor is needed if the node never rewrites.
+            return true;
+        }
+
+        List<ExecutableElement> constructors = ElementFilter.constructorsIn(type.getEnclosedElements());
+        for (ExecutableElement e : constructors) {
+            if (e.getParameters().size() == 1) {
+                TypeMirror firstArg = e.getParameters().get(0).asType();
+                if (Utils.typeEquals(firstArg, nodeData.getNodeType())) {
+                    if (e.getModifiers().contains(Modifier.PRIVATE)) {
+                        context.getLog().error(e, "The specialization constructor must not be private.");
+                        return false;
+                    } else if (constructors.size() <= 1) {
+                        context.getLog().error(e, "The specialization constructor must not be the only constructor. The definition of an alternative constructor is required.");
+                        return false;
+                    }
+                    return true;
+                }
+            }
+        }
+
+        // not found
+        context.getLog().error(type, "Specialization constructor '%s(%s previousNode) { this(...); }' is required.", Utils.getSimpleName(type), Utils.getSimpleName(type));
+        return false;
+    }
+
+    private static List<ExecutableTypeData> filterExecutableTypes(List<ExecutableTypeData> executableTypes) {
+        List<ExecutableTypeData> filteredExecutableTypes = new ArrayList<>();
+        for (ExecutableTypeData t1 : executableTypes) {
+            boolean add = true;
+            for (ExecutableTypeData t2 : executableTypes) {
+                if (t1 == t2) {
+                    continue;
+                }
+                if (Utils.typeEquals(t1.getType().getPrimitiveType(), t2.getType().getPrimitiveType())) {
+                    if (t1.isFinal() && !t2.isFinal()) {
+                        add = false;
+                    }
+                }
+            }
+            if (add) {
+                filteredExecutableTypes.add(t1);
+            }
+        }
+        return filteredExecutableTypes;
+    }
+
+    private AnnotationMirror findFirstAnnotation(List<? extends Element> elements, Class<? extends Annotation> annotation) {
+        for (Element element : elements) {
+            AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, element, annotation);
+            if (mirror != null) {
+                return mirror;
+            }
+        }
+        return null;
+    }
+
+    private NodeFieldData[] parseFields(NodeData nodeData, List<? extends Element> elements, final List<TypeElement> typeHierarchy) {
+        AnnotationMirror executionOrderMirror = findFirstAnnotation(typeHierarchy, ExecuteChildren.class);
+        List<String> executionDefinition = null;
+        if (executionOrderMirror != null) {
+            executionDefinition = new ArrayList<>();
+            for (Object object : Utils.getAnnotationValueList(executionOrderMirror, "value")) {
+                executionDefinition.add((String) object);
+            }
+        }
+
+        Set<String> shortCircuits = new HashSet<>();
+        for (ExecutableElement method : ElementFilter.methodsIn(elements)) {
+            AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, method, ShortCircuit.class);
+            if (mirror != null) {
+                shortCircuits.add(Utils.getAnnotationValueString(mirror, "value"));
+            }
+        }
+
+        boolean valid = true;
+
+        List<NodeFieldData> fields = new ArrayList<>();
+        for (VariableElement var : ElementFilter.fieldsIn(elements)) {
+            if (var.getModifiers().contains(Modifier.STATIC)) {
+                continue;
+            }
+
+            if (executionDefinition != null) {
+                if (!executionDefinition.contains(var.getSimpleName().toString())) {
+                    continue;
+                }
+            }
+
+            NodeFieldData field = parseField(nodeData, var, shortCircuits);
+            if (field != null) {
+                if (field.getExecutionKind() != ExecutionKind.IGNORE) {
+                    fields.add(field);
+                }
+            } else {
+                valid = false;
+            }
+        }
+
+        // TODO parse getters
+        if (!valid) {
+            return null;
+        }
+
+        NodeFieldData[] fieldArray = fields.toArray(new NodeFieldData[fields.size()]);
+        sortByExecutionOrder(fieldArray, executionDefinition == null ? Collections.<String> emptyList() : executionDefinition, typeHierarchy);
+        return fieldArray;
+    }
+
+    private NodeFieldData parseField(NodeData parentNodeData, VariableElement var, Set<String> foundShortCircuits) {
+        AnnotationMirror childMirror = Utils.findAnnotationMirror(processingEnv, var, Child.class);
+        AnnotationMirror childrenMirror = Utils.findAnnotationMirror(processingEnv, var, Children.class);
+
+        FieldKind kind;
+
+        ExecutionKind execution;
+        if (foundShortCircuits.contains(var.getSimpleName().toString())) {
+            execution = ExecutionKind.SHORT_CIRCUIT;
+        } else {
+            execution = ExecutionKind.DEFAULT;
+        }
+
+        AnnotationMirror mirror;
+        TypeMirror nodeType;
+
+        if (childMirror != null) {
+            mirror = childMirror;
+            nodeType = var.asType();
+            kind = FieldKind.CHILD;
+        } else if (childrenMirror != null) {
+            mirror = childrenMirror;
+            nodeType = getComponentType(var.asType());
+            kind = FieldKind.CHILDREN;
+        } else {
+            mirror = null;
+            nodeType = null;
+            kind = FieldKind.FIELD;
+            execution = ExecutionKind.IGNORE;
+        }
+
+        NodeData fieldNodeData = null;
+        if (nodeType != null) {
+            fieldNodeData = resolveNode(Utils.fromTypeMirror(nodeType));
+            Element errorElement = Utils.typeEquals(parentNodeData.getTemplateType().asType(), var.getEnclosingElement().asType()) ? var : parentNodeData.getTemplateType();
+
+            if (fieldNodeData == null) {
+                // TODO redirect errors from resolve.
+                context.getLog().error(errorElement, "Node type '%s' is invalid.", Utils.getQualifiedName(nodeType));
+                return null;
+            } else if (fieldNodeData.findGenericExecutableType(context) == null) {
+                context.getLog().error(errorElement, "No executable generic type found for node '%s'.", Utils.getQualifiedName(nodeType));
+                return null;
+            }
+        }
+
+        // TODO correct handling of access elements
+        if (var.getModifiers().contains(Modifier.PRIVATE) && Utils.typeEquals(var.getEnclosingElement().asType(), parentNodeData.getTemplateType().asType())) {
+            execution = ExecutionKind.IGNORE;
+        }
+
+        return new NodeFieldData(fieldNodeData, var, findAccessElement(var), mirror, kind, execution);
+    }
+
+    private Element findAccessElement(VariableElement variableElement) {
+        Element enclosed = variableElement.getEnclosingElement();
+        if (!enclosed.getKind().isClass()) {
+            throw new IllegalArgumentException("Field must be enclosed in a class.");
+        }
+
+        String methodName;
+        if (Utils.typeEquals(variableElement.asType(), context.getType(boolean.class))) {
+            methodName = "is" + Utils.firstLetterUpperCase(variableElement.getSimpleName().toString());
+        } else {
+            methodName = "get" + Utils.firstLetterUpperCase(variableElement.getSimpleName().toString());
+        }
+
+        ExecutableElement getter = null;
+        for (ExecutableElement method : ElementFilter.methodsIn(enclosed.getEnclosedElements())) {
+            if (method.getSimpleName().toString().equals(methodName) && method.getParameters().size() == 0 && !Utils.typeEquals(method.getReturnType(), context.getType(void.class))) {
+                getter = method;
+                break;
+            }
+        }
+
+        if (getter != null) {
+            return getter;
+        } else {
+            return variableElement;
+        }
+    }
+
+    private static void sortByExecutionOrder(NodeFieldData[] fields, final List<String> executionOrder, final List<TypeElement> typeHierarchy) {
+        Arrays.sort(fields, new Comparator<NodeFieldData>() {
+
+            @Override
+            public int compare(NodeFieldData o1, NodeFieldData o2) {
+                // sort by execution order
+                int index1 = executionOrder.indexOf(o1.getName());
+                int index2 = executionOrder.indexOf(o2.getName());
+                if (index1 == -1 || index2 == -1) {
+                    // sort by type hierarchy
+                    index1 = typeHierarchy.indexOf(o1.getFieldElement().getEnclosingElement());
+                    index2 = typeHierarchy.indexOf(o2.getFieldElement().getEnclosingElement());
+
+                    // finally sort by name (will emit warning)
+                    if (index1 == -1 || index2 == -1) {
+                        return o1.getName().compareTo(o2.getName());
+                    }
+                }
+                return index1 - index2;
+            }
+        });
+    }
+
+    private boolean assignShortCircuitsToSpecializations(NodeData nodeData, List<SpecializationData> specializations, List<ShortCircuitData> shortCircuits) {
+
+        Map<String, List<ShortCircuitData>> groupedShortCircuits = groupShortCircuits(shortCircuits);
+
+        boolean valid = true;
+
+        for (NodeFieldData field : nodeData.filterFields(null, ExecutionKind.SHORT_CIRCUIT)) {
+            String valueName = field.getName();
+            List<ShortCircuitData> availableCircuits = groupedShortCircuits.get(valueName);
+
+            if (availableCircuits == null || availableCircuits.isEmpty()) {
+                log.error(nodeData.getTemplateType(), "@%s method for short cut value '%s' required.", ShortCircuit.class.getSimpleName(), valueName);
+                valid = false;
+                continue;
+            }
+
+            boolean sameMethodName = true;
+            String methodName = availableCircuits.get(0).getMethodName();
+            for (ShortCircuitData circuit : availableCircuits) {
+                if (!circuit.getMethodName().equals(methodName)) {
+                    sameMethodName = false;
+                }
+            }
+
+            if (!sameMethodName) {
+                for (ShortCircuitData circuit : availableCircuits) {
+                    log.error(circuit.getMethod(), circuit.getMarkerAnnotation(), "All short circuits for short cut value '%s' must have the same method name.", valueName);
+                }
+                valid = false;
+                continue;
+            }
+
+            ShortCircuitData genericCircuit = null;
+            for (ShortCircuitData circuit : availableCircuits) {
+                if (isGenericShortCutMethod(nodeData, circuit)) {
+                    genericCircuit = circuit;
+                    break;
+                }
+            }
+
+            if (genericCircuit == null) {
+                log.error(nodeData.getTemplateType(), "No generic @%s method available for short cut value '%s'.", ShortCircuit.class.getSimpleName(), valueName);
+                valid = false;
+                continue;
+            }
+
+            for (ShortCircuitData circuit : availableCircuits) {
+                if (circuit != genericCircuit) {
+                    circuit.setGenericShortCircuitMethod(genericCircuit);
+                }
+            }
+        }
+
+        if (!valid) {
+            return valid;
+        }
+
+        NodeFieldData[] fields = nodeData.filterFields(null, ExecutionKind.SHORT_CIRCUIT);
+        for (SpecializationData specialization : specializations) {
+            ShortCircuitData[] assignedShortCuts = new ShortCircuitData[fields.length];
+
+            for (int i = 0; i < fields.length; i++) {
+                List<ShortCircuitData> availableShortCuts = groupedShortCircuits.get(fields[i].getName());
+
+                ShortCircuitData genericShortCircuit = null;
+                for (ShortCircuitData circuit : availableShortCuts) {
+                    if (circuit.isGeneric()) {
+                        genericShortCircuit = circuit;
+                    } else if (circuit.isCompatibleTo(specialization)) {
+                        assignedShortCuts[i] = circuit;
+                    }
+                }
+
+                if (assignedShortCuts[i] == null) {
+                    assignedShortCuts[i] = genericShortCircuit;
+                }
+            }
+            specialization.setShortCircuits(assignedShortCuts);
+        }
+        return true;
+    }
+
+    private boolean verifyNamingConvention(List<? extends TemplateMethod> methods, String prefix) {
+        boolean valid = true;
+        for (int i = 0; i < methods.size(); i++) {
+            TemplateMethod m1 = methods.get(i);
+            if (m1.getMethodName().length() < 3 || !m1.getMethodName().startsWith(prefix)) {
+                log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Naming convention: method name must start with '%s'.", prefix);
+                valid = false;
+            }
+        }
+        return valid;
+    }
+
+    private boolean verifyNamesUnique(List<? extends TemplateMethod> methods) {
+        boolean valid = true;
+        for (int i = 0; i < methods.size(); i++) {
+            TemplateMethod m1 = methods.get(i);
+            for (int j = i + 1; j < methods.size(); j++) {
+                TemplateMethod m2 = methods.get(j);
+
+                if (m1.getMethodName().equalsIgnoreCase(m2.getMethodName())) {
+                    log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Method name '%s' used multiple times", m1.getMethodName());
+                    log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Method name '%s' used multiple times", m1.getMethodName());
+                    return false;
+                }
+            }
+        }
+        return valid;
+    }
+
+    private static boolean isGenericShortCutMethod(NodeData node, TemplateMethod method) {
+        for (NodeFieldData field : node.getFields()) {
+            ActualParameter parameter = method.findParameter(field.getName());
+            if (parameter == null) {
+                continue;
+            }
+            if (!Utils.typeEquals(node.getTypeSystem().getGenericType(), parameter.getActualType())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static Map<String, List<ShortCircuitData>> groupShortCircuits(List<ShortCircuitData> shortCircuits) {
+        Map<String, List<ShortCircuitData>> group = new HashMap<>();
+        for (ShortCircuitData shortCircuit : shortCircuits) {
+            List<ShortCircuitData> circuits = group.get(shortCircuit.getValueName());
+            if (circuits == null) {
+                circuits = new ArrayList<>();
+                group.put(shortCircuit.getValueName(), circuits);
+            }
+            circuits.add(shortCircuit);
+        }
+        return group;
+    }
+
+    private TypeMirror getComponentType(TypeMirror type) {
+        if (type instanceof ArrayType) {
+            return getComponentType(((ArrayType) type).getComponentType());
+        }
+        return type;
+    }
+
+    private static List<TypeElement> findSuperClasses(List<TypeElement> collection, TypeElement element) {
+        if (element.getSuperclass() != null) {
+            TypeElement superElement = Utils.fromTypeMirror(element.getSuperclass());
+            if (superElement != null) {
+                findSuperClasses(collection, superElement);
+            }
+        }
+        collection.add(element);
+        return collection;
+    }
+
+    private boolean verifySpecializationOrder(TypeSystemData typeSystem, List<SpecializationData> specializations) {
+        for (int i = 0; i < specializations.size(); i++) {
+            SpecializationData m1 = specializations.get(i);
+            for (int j = i + 1; j < specializations.size(); j++) {
+                SpecializationData m2 = specializations.get(j);
+                int inferredOrder = compareSpecializationWithoutOrder(typeSystem, m1, m2);
+
+                if (m1.getOrder() != Specialization.DEFAULT_ORDER && m2.getOrder() != Specialization.DEFAULT_ORDER) {
+                    int specOrder = m1.getOrder() - m2.getOrder();
+                    if (specOrder == 0) {
+                        log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Order value %d used multiple times", m1.getOrder());
+                        log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Order value %d used multiple times", m1.getOrder());
+                        return false;
+                    } else if ((specOrder < 0 && inferredOrder > 0) || (specOrder > 0 && inferredOrder < 0)) {
+                        log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Explicit order values %d and %d are inconsistent with type lattice ordering.", m1.getOrder(), m2.getOrder());
+                        log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Explicit order values %d and %d are inconsistent with type lattice ordering.", m1.getOrder(), m2.getOrder());
+                        return false;
+                    }
+                } else if (inferredOrder == 0) {
+                    SpecializationData m = (m1.getOrder() == Specialization.DEFAULT_ORDER ? m1 : m2);
+                    log.error(m.getMethod(), m.getMarkerAnnotation(), "Cannot calculate a consistent order for this specialization. Define the order attribute to resolve this.");
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    private boolean verifySpecializationThrows(TypeSystemData typeSystem, List<SpecializationData> specializations) {
+        Map<String, SpecializationData> specializationMap = new HashMap<>();
+        for (SpecializationData spec : specializations) {
+            specializationMap.put(spec.getMethodName(), spec);
+        }
+        boolean valid = true;
+        for (SpecializationData sourceSpecialization : specializations) {
+            if (sourceSpecialization.getExceptions() != null) {
+                for (SpecializationThrowsData throwsData : sourceSpecialization.getExceptions()) {
+                    SpecializationData targetSpecialization = specializationMap.get(throwsData.getTransitionToName());
+                    AnnotationValue value = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "transitionTo");
+
+                    if (targetSpecialization == null) {
+                        log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value, "Specialization with name '%s' not found.", throwsData.getTransitionToName());
+                        valid = false;
+                    } else if (compareSpecialization(typeSystem, sourceSpecialization, targetSpecialization) >= 0) {
+                        log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value,
+                                        "The order of the target specializalization must be higher than the source specialization.", throwsData.getTransitionToName());
+                        valid = false;
+                    }
+
+                    for (SpecializationThrowsData otherThrowsData : sourceSpecialization.getExceptions()) {
+                        if (otherThrowsData != throwsData && Utils.typeEquals(otherThrowsData.getJavaClass(), throwsData.getJavaClass())) {
+                            AnnotationValue javaClassValue = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "javaClass");
+                            log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), javaClassValue, "Duplicate exception type.", throwsData.getTransitionToName());
+                            valid = false;
+                        }
+                    }
+                }
+            }
+        }
+        return valid;
+    }
+
+    private static int compareSpecialization(TypeSystemData typeSystem, SpecializationData m1, SpecializationData m2) {
+        if (m1 == m2) {
+            return 0;
+        }
+        int result = compareSpecializationWithoutOrder(typeSystem, m1, m2);
+        if (result == 0) {
+            if (m1.getOrder() != Specialization.DEFAULT_ORDER && m2.getOrder() != Specialization.DEFAULT_ORDER) {
+                return m1.getOrder() - m2.getOrder();
+            }
+        }
+        return result;
+    }
+
+    private static int compareSpecializationWithoutOrder(TypeSystemData typeSystem, SpecializationData m1, SpecializationData m2) {
+        if (m1.getSpecification() != m2.getSpecification()) {
+            throw new UnsupportedOperationException("Cannot compare two specializations with different specifications.");
+        }
+
+        int result = compareActualParameter(typeSystem, m1.getReturnType(), m2.getReturnType());
+
+        for (ParameterSpec spec : m1.getSpecification().getParameters()) {
+            ActualParameter p1 = m1.findParameter(spec);
+            ActualParameter p2 = m2.findParameter(spec);
+
+            if (p1 != null && p2 != null && !Utils.typeEquals(p1.getActualType(), p2.getActualType())) {
+                int typeResult = compareActualParameter(typeSystem, p1, p2);
+                if (result == 0) {
+                    result = typeResult;
+                } else if (Math.signum(result) != Math.signum(typeResult)) {
+                    // We cannot define an order.
+                    return 0;
+                }
+            }
+        }
+        return result;
+    }
+
+    private static int compareActualParameter(TypeSystemData typeSystem, ActualParameter p1, ActualParameter p2) {
+        int index1 = typeSystem.findType(p1.getActualType());
+        int index2 = typeSystem.findType(p2.getActualType());
+
+        assert index1 != index2;
+        assert !(index1 == -1 ^ index2 == -1);
+
+        return index1 - index2;
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return null;
+    }
+
+    @Override
+    public List<Class<? extends Annotation>> getTypeDelegatedAnnotationTypes() {
+        return ANNOTATIONS;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+
+public class ShortCircuitData extends TemplateMethod {
+
+    private ShortCircuitData genericShortCircuitMethod;
+    private final String valueName;
+
+    public ShortCircuitData(TemplateMethod template, String valueName) {
+        super(template);
+        this.valueName = valueName;
+    }
+
+    public String getValueName() {
+        return valueName;
+    }
+
+    public void setGenericShortCircuitMethod(ShortCircuitData genericShortCircuitMethod) {
+        this.genericShortCircuitMethod = genericShortCircuitMethod;
+    }
+
+    public boolean isGeneric() {
+        return genericShortCircuitMethod == null;
+    }
+
+    public ShortCircuitData getGeneric() {
+        if (isGeneric()) {
+            return this;
+        } else {
+            return genericShortCircuitMethod;
+        }
+    }
+
+    public boolean isCompatibleTo(SpecializationData specialization) {
+        if (isGeneric() && specialization.isGeneric()) {
+            return true;
+        }
+
+        for (ActualParameter param : getParameters()) {
+            ParameterSpec paramSpec = param.getSpecification();
+            ActualParameter specializationParam = specialization.findParameter(paramSpec.getName());
+            if (!Utils.typeEquals(param.getActualType(), specializationParam.getActualType())) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/ShortCircuitParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import javax.lang.model.element.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.node.NodeFieldData.ExecutionKind;
+import com.oracle.truffle.codegen.processor.template.*;
+
+public class ShortCircuitParser extends MethodParser<ShortCircuitData> {
+
+    private final Set<String> shortCircuitValues;
+
+    public ShortCircuitParser(ProcessorContext context, NodeData node) {
+        super(context, node);
+
+        shortCircuitValues = new HashSet<>();
+        NodeFieldData[] shortCircuitFields = node.filterFields(null, ExecutionKind.SHORT_CIRCUIT);
+        for (NodeFieldData field : shortCircuitFields) {
+            shortCircuitValues.add(field.getName());
+        }
+    }
+
+    @Override
+    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
+        String shortCircuitValue = Utils.getAnnotationValueString(mirror, "value");
+
+        if (!shortCircuitValues.contains(shortCircuitValue)) {
+            getContext().getLog().error(method, mirror, "Invalid short circuit value %s.", shortCircuitValue);
+            return null;
+        }
+
+        return createDefaultMethodSpec(shortCircuitValue);
+    }
+
+    @Override
+    protected ParameterSpec createReturnParameterSpec() {
+        return new ParameterSpec("has", getContext().getType(boolean.class), false);
+    }
+
+    @Override
+    public ShortCircuitData create(TemplateMethod method) {
+        String shortCircuitValue = Utils.getAnnotationValueString(method.getMarkerAnnotation(), "value");
+        assert shortCircuitValue != null;
+        assert shortCircuitValues.contains(shortCircuitValue);
+        return new ShortCircuitData(method, shortCircuitValue);
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return ShortCircuit.class;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.codegen.processor.template.*;
+
+public class SpecializationData extends TemplateMethod {
+
+    private final int order;
+    private final boolean generic;
+    private final boolean uninitialized;
+    private final SpecializationThrowsData[] exceptions;
+    private SpecializationGuardData[] guards;
+    private ShortCircuitData[] shortCircuits;
+
+    private NodeData node;
+
+    public SpecializationData(TemplateMethod template, int order, SpecializationThrowsData[] exceptions) {
+        super(template);
+        this.order = order;
+        this.generic = false;
+        this.uninitialized = false;
+        this.exceptions = exceptions;
+
+        for (SpecializationThrowsData exception : exceptions) {
+            exception.setSpecialization(this);
+        }
+    }
+
+    public SpecializationData(TemplateMethod template, boolean generic, boolean uninitialized) {
+        super(template);
+        this.order = Specialization.DEFAULT_ORDER;
+        this.generic = generic;
+        this.uninitialized = uninitialized;
+        this.exceptions = new SpecializationThrowsData[0];
+        this.guards = new SpecializationGuardData[0];
+    }
+
+    public NodeData getNode() {
+        return node;
+    }
+
+    public void setNode(NodeData node) {
+        this.node = node;
+    }
+
+    public void setGuards(SpecializationGuardData[] guards) {
+        this.guards = guards;
+    }
+
+    public int getOrder() {
+        return order;
+    }
+
+    public boolean isGeneric() {
+        return generic;
+    }
+
+    public boolean isUninitialized() {
+        return uninitialized;
+    }
+
+    public SpecializationThrowsData[] getExceptions() {
+        return exceptions;
+    }
+
+    public SpecializationGuardData[] getGuards() {
+        return guards;
+    }
+
+    public void setShortCircuits(ShortCircuitData[] shortCircuits) {
+        this.shortCircuits = shortCircuits;
+    }
+
+    public ShortCircuitData[] getShortCircuits() {
+        return shortCircuits;
+    }
+
+    public SpecializationData findNextSpecialization() {
+        SpecializationData[] specializations = node.getSpecializations();
+        for (int i = 0; i < specializations.length - 1; i++) {
+            if (specializations[i] == this) {
+                return specializations[i + 1];
+            }
+        }
+        return null;
+    }
+
+    public boolean hasDynamicGuards() {
+        for (SpecializationGuardData guard : getGuards()) {
+            if (guard.isOnExecution()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public ActualParameter getPreviousParam(ActualParameter searchParam) {
+        ActualParameter prev = null;
+        for (ActualParameter param : getParameters()) {
+            if (param == searchParam) {
+                return prev;
+            }
+            prev = param;
+        }
+        return prev;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationGuardData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class SpecializationGuardData {
+
+    private final String guardMethod;
+    private final boolean onSpecialization;
+    private final boolean onExecution;
+
+    private GuardData guardDeclaration;
+
+    public SpecializationGuardData(String guardMethod, boolean onSpecialization, boolean onExecution) {
+        this.guardMethod = guardMethod;
+        this.onSpecialization = onSpecialization;
+        this.onExecution = onExecution;
+    }
+
+    public String getGuardMethod() {
+        return guardMethod;
+    }
+
+    public boolean isOnExecution() {
+        return onExecution;
+    }
+
+    public boolean isOnSpecialization() {
+        return onSpecialization;
+    }
+
+    public void setGuardDeclaration(GuardData compatibleGuard) {
+        this.guardDeclaration = compatibleGuard;
+    }
+
+    public GuardData getGuardDeclaration() {
+        return guardDeclaration;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationListenerParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+
+import javax.lang.model.element.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+
+public class SpecializationListenerParser extends MethodParser<TemplateMethod> {
+
+    private final MethodSpec specification;
+
+    public SpecializationListenerParser(ProcessorContext context, NodeData node) {
+        super(context, node);
+        this.specification = createDefaultMethodSpec(null);
+    }
+
+    @Override
+    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
+        return specification;
+    }
+
+    @Override
+    protected ParameterSpec createReturnParameterSpec() {
+        return new ParameterSpec("void", getContext().getType(void.class), false);
+    }
+
+    @Override
+    public TemplateMethod create(TemplateMethod method) {
+        return method;
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return SpecializationListener.class;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationMethodParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import java.lang.annotation.*;
+import java.util.*;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.template.*;
+import com.oracle.truffle.codegen.processor.typesystem.*;
+
+public class SpecializationMethodParser extends MethodParser<SpecializationData> {
+
+    private final MethodSpec specification;
+
+    public SpecializationMethodParser(ProcessorContext context, NodeData operation) {
+        super(context, operation);
+        this.specification = createDefaultMethodSpec(null);
+    }
+
+    @Override
+    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
+        return specification;
+    }
+
+    public MethodSpec getSpecification() {
+        return specification;
+    }
+
+    @Override
+    public SpecializationData create(TemplateMethod method) {
+        return parseSpecialization(method);
+    }
+
+    @Override
+    public Class<? extends Annotation> getAnnotationType() {
+        return Specialization.class;
+    }
+
+    private SpecializationData parseSpecialization(TemplateMethod method) {
+        int order = Utils.getAnnotationValueInt(method.getMarkerAnnotation(), "order");
+        if (order < 0 && order != Specialization.DEFAULT_ORDER) {
+            getContext().getLog().error(method.getMethod(), method.getMarkerAnnotation(), "Invalid order attribute %d. The value must be >= 0 or the default value.");
+            return null;
+        }
+
+        List<AnnotationMirror> exceptionDefs = Utils.collectAnnotations(getContext(), method.getMarkerAnnotation(), "exceptions", method.getMethod(), SpecializationThrows.class);
+        SpecializationThrowsData[] exceptionData = new SpecializationThrowsData[exceptionDefs.size()];
+        for (int i = 0; i < exceptionData.length; i++) {
+            AnnotationMirror mirror = exceptionDefs.get(i);
+            TypeMirror javaClass = Utils.getAnnotationValueType(mirror, "javaClass");
+            String transitionTo = Utils.getAnnotationValueString(mirror, "transitionTo");
+            exceptionData[i] = new SpecializationThrowsData(mirror, javaClass, transitionTo);
+
+            if (!Utils.canThrowType(method.getMethod().getThrownTypes(), javaClass)) {
+                getContext().getLog().error(method.getMethod(), "Method must specify a throws clause with the exception type '%s'.", Utils.getQualifiedName(javaClass));
+                return null;
+            }
+        }
+
+        Arrays.sort(exceptionData, new Comparator<SpecializationThrowsData>() {
+
+            @Override
+            public int compare(SpecializationThrowsData o1, SpecializationThrowsData o2) {
+                return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass());
+            }
+        });
+        SpecializationData specialization = new SpecializationData(method, order, exceptionData);
+        boolean valid = true;
+        List<AnnotationMirror> guardDefs = Utils.collectAnnotations(getContext(), method.getMarkerAnnotation(), "guards", method.getMethod(), SpecializationGuard.class);
+        SpecializationGuardData[] guardData = new SpecializationGuardData[guardDefs.size()];
+        for (int i = 0; i < guardData.length; i++) {
+            AnnotationMirror guardMirror = guardDefs.get(i);
+            String guardMethod = Utils.getAnnotationValueString(guardMirror, "methodName");
+            boolean onSpecialization = Utils.getAnnotationValueBoolean(guardMirror, "onSpecialization");
+            boolean onExecution = Utils.getAnnotationValueBoolean(guardMirror, "onExecution");
+
+            if (!onSpecialization && !onExecution) {
+                String message = "Either onSpecialization, onExecution or both must be enabled.";
+                getContext().getLog().error(method.getMethod(), guardMirror, message);
+                valid = false;
+                continue;
+            }
+
+            guardData[i] = new SpecializationGuardData(guardMethod, onSpecialization, onExecution);
+
+            GuardData compatibleGuard = matchSpecializationGuard(guardMirror, specialization, guardData[i]);
+            if (compatibleGuard != null) {
+                guardData[i].setGuardDeclaration(compatibleGuard);
+            } else {
+                valid = false;
+            }
+        }
+
+        if (!valid) {
+            return null;
+        }
+
+        specialization.setGuards(guardData);
+
+        return specialization;
+    }
+
+    private GuardData matchSpecializationGuard(AnnotationMirror mirror, SpecializationData specialization, SpecializationGuardData specializationGuard) {
+        List<GuardData> foundGuards = getNode().findGuards(specializationGuard.getGuardMethod());
+
+        GuardData compatibleGuard = null;
+        for (GuardData guardData : foundGuards) {
+            if (isGuardCompatible(specialization, guardData)) {
+                compatibleGuard = guardData;
+                break;
+            }
+        }
+
+        if (compatibleGuard == null) {
+            ParameterSpec returnTypeSpec = new ParameterSpec("returnValue", getContext().getType(boolean.class), false);
+            List<ParameterSpec> expectedParameterSpecs = new ArrayList<>();
+
+            for (ActualParameter param : specialization.getParameters()) {
+                ParameterSpec spec = param.getSpecification();
+                expectedParameterSpecs.add(new ParameterSpec(spec.getName(), param.getActualType(), false));
+            }
+            String expectedSignature = TemplateMethodParser.createExpectedSignature(specializationGuard.getGuardMethod(), returnTypeSpec, expectedParameterSpecs);
+            AnnotationValue value = Utils.getAnnotationValue(mirror, "methodName");
+            getContext().getLog().error(specialization.getMethod(), mirror, value, "No guard with signature '%s' found in type system.", expectedSignature);
+            return null;
+        }
+
+        return compatibleGuard;
+    }
+
+    private static boolean isGuardCompatible(SpecializationData specialization, GuardData guard) {
+        Iterator<ActualParameter> guardParameters = Arrays.asList(guard.getParameters()).iterator();
+        for (ActualParameter param : specialization.getParameters()) {
+            if (!guardParameters.hasNext()) {
+                return false;
+            }
+            ActualParameter guardParam = guardParameters.next();
+            if (!Utils.typeEquals(guardParam.getActualType(), param.getActualType())) {
+                return false;
+            }
+        }
+        if (guardParameters.hasNext()) {
+            return false;
+        }
+        return true;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/node/SpecializationThrowsData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2012, 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.truffle.codegen.processor.node;
+
+import javax.lang.model.element.*;
+import javax.lang.model.type.*;
+
+public class SpecializationThrowsData {
+
+    private final AnnotationMirror annotationMirror;
+    private final TypeMirror javaClass;
+    private final String transitionTo;
+    private SpecializationData specialization;
+
+    public SpecializationThrowsData(AnnotationMirror annotationMirror, TypeMirror javaClass, String transitionTo) {
+        this.annotationMirror = annotationMirror;
+        this.javaClass = javaClass;
+        this.transitionTo = transitionTo;
+    }
+
+    void setSpecialization(SpecializationData specialization) {
+        this.specialization = specialization;
+    }
+
+    public TypeMirror getJavaClass() {
+        return javaClass;
+    }
+
+    public SpecializationData getSpecialization() {
+        return specialization;
+    }
+
+    public AnnotationMirror getAnnotationMirror() {
+        return annotationMirror;
+    }
+
+    public String getTransitionToName() {
+        return transitionTo;
+    }
+
+    public SpecializationData getTransitionTo() {
+        for (SpecializationData s : specialization.getNode().getSpecializations()) {
+            if (s.getMethodName().equals(transitionTo)) {
+                return s;
+            }
+        }
+        return null;
+    }
+}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/GenericParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.lang.annotation.*;
-
-import javax.lang.model.element.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
-public class GenericParser extends OperationMethodParser<SpecializationData> {
-
-    public GenericParser(ProcessorContext context, OperationData operation) {
-        super(context, operation);
-    }
-
-    @Override
-    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
-        return createDefaultMethodSpec(null);
-    }
-
-    @Override
-    protected ParameterSpec createValueParameterSpec(String valueName) {
-        return new ParameterSpec(valueName, getOperation().getTypeSystem().getGenericType(), Kind.EXECUTE, false);
-    }
-
-    @Override
-    protected ParameterSpec createReturnParameterSpec() {
-        return new ParameterSpec("returnValue", getOperation().getTypeSystem(), Kind.EXECUTE, false, Cardinality.ONE);
-    }
-
-    @Override
-    public SpecializationData create(TemplateMethod method) {
-        return new SpecializationData(method, true, false);
-    }
-
-    @Override
-    public Class< ? extends Annotation> getAnnotationType() {
-        return Generic.class;
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationCodeGenerator.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,903 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import static com.oracle.truffle.codegen.processor.Utils.*;
-import static javax.lang.model.element.Modifier.*;
-
-import java.util.*;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.ast.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-import com.oracle.truffle.codegen.processor.typesystem.*;
-
-public class OperationCodeGenerator extends CompilationUnitFactory<OperationData> {
-
-    private static final String OPERATION_FIELD_NAME =  "operation";
-
-    public OperationCodeGenerator(ProcessorContext context) {
-        super(context);
-    }
-
-    private TypeMirror getUnexpectedValueException() {
-        return getContext().getTruffleTypes().getUnexpectedValueException();
-    }
-
-    private static String operationClassName(OperationData operation) {
-        return Utils.getSimpleName(operation.getTemplateType().asType());
-    }
-
-    private static String factoryClassName(OperationData operation) {
-        return operationClassName(operation) + "Factory";
-    }
-
-    private static String nodeClassName(OperationData operation) {
-        String name = operationClassName(operation);
-        if (name.length() > 2 && name.endsWith("Op")) {
-            name = name.substring(0, name.length() - 2);
-        }
-        return name + "Node";
-    }
-
-    private static String nodeClassName(SpecializationData specialization) {
-        String name = "";
-        if (specialization.getOperation().getAllMethods().length > 1) {
-            name = specialization.getMethodName();
-            if (name.startsWith("do")) {
-                name = name.substring(2);
-            }
-        }
-        return name + nodeClassName(specialization.getOperation());
-    }
-
-    private static String nodeVariableName(ParameterSpec spec) {
-        if (spec.getKind() == Kind.EXECUTE) {
-            return spec.getName() + "Node";
-        }
-        return spec.getName();
-    }
-
-    private static String nodeVariableName(ActualParameter param) {
-        return nodeVariableName(param.getSpecification());
-    }
-
-    private static String valueVariableName(ParameterSpec spec) {
-        if (spec.getKind() == Kind.EXECUTE) {
-            return spec.getName() + "Value";
-        }
-        return spec.getName();
-    }
-
-    private static String valueVariableName(ActualParameter param) {
-        return valueVariableName(param.getSpecification());
-    }
-
-    public static String executeMethodName(TypeData type) {
-        if (type.isGeneric()) {
-            return "executeGeneric";
-        }
-        return "execute" + Utils.getSimpleName(type.getBoxedType());
-    }
-
-    private static EnumSet<Kind> kinds(Kind... values) {
-        EnumSet<Kind> result = EnumSet.noneOf(Kind.class);
-        for (Kind value : values) {
-            result.add(value);
-        }
-        return result;
-    }
-
-    private static void addNodeParameters(CodeExecutableElement method, OperationData operation, EnumSet<Kind> included) {
-        for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-            if (included.contains(spec.getKind())) {
-                if (spec.getKind() == Kind.EXECUTE) {
-                    method.addParameter(new CodeVariableElement(operation.getTypeSystem().getNodeType(), nodeVariableName(spec)));
-                } else {
-                    method.addParameter(new CodeVariableElement(spec.getValueType(), nodeVariableName(spec)));
-                }
-            }
-        }
-        if (included.contains(Kind.CONSTRUCTOR_FIELD)) {
-            for (OperationFieldData field : operation.getConstructorFields()) {
-                method.addParameter(new CodeVariableElement(field.getJavaClass(), field.getName()));
-            }
-        }
-    }
-
-    private static void addValueParameters(CodeExecutableElement method, OperationData operation, EnumSet<Kind> included) {
-        for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-            if (included.contains(spec.getKind())) {
-                method.addParameter(new CodeVariableElement(spec.getValueType(), valueVariableName(spec)));
-            }
-        }
-        if (included.contains(Kind.CONSTRUCTOR_FIELD)) {
-            for (OperationFieldData field : operation.getConstructorFields()) {
-                method.addParameter(new CodeVariableElement(field.getJavaClass(), field.getName()));
-            }
-        }
-    }
-
-    private static void addOperationFieldName(CodeTreeBuilder body, OperationData operation) {
-        if (!operation.isUseSingleton()) {
-            body.string(OPERATION_FIELD_NAME);
-        }
-    }
-
-    private static void addOperationVariable(Set<Modifier> modifiers, Element element, OperationData operation, CodeTypeElement operationGen) {
-        if (!operation.isUseSingleton()) {
-            TypeMirror type = findOperationType(operation, operationGen);
-            if (element instanceof CodeExecutableElement) {
-                ((CodeExecutableElement) element).addParameter(new CodeVariableElement(modifiers, type, OPERATION_FIELD_NAME));
-            } else if (element instanceof CodeTypeElement) {
-                ((CodeTypeElement) element).add(new CodeVariableElement(modifiers, type, OPERATION_FIELD_NAME));
-            }
-        }
-    }
-
-    private static void addNodeNames(CodeTreeBuilder body, OperationData operation, EnumSet<Kind> included) {
-        for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-            if (included.contains(spec.getKind())) {
-                body.string(nodeVariableName(spec));
-            }
-        }
-        if (included.contains(Kind.CONSTRUCTOR_FIELD)) {
-            for (OperationFieldData field : operation.getConstructorFields()) {
-                body.string(field.getName());
-            }
-        }
-    }
-
-    private static void addValueNames(CodeTreeBuilder body, OperationData operation, EnumSet<Kind> included) {
-        for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-            if (included.contains(spec.getKind())) {
-                body.string(valueVariableName(spec));
-            }
-        }
-        if (included.contains(Kind.CONSTRUCTOR_FIELD)) {
-            for (OperationFieldData field : operation.getConstructorFields()) {
-                body.string(field.getName());
-            }
-        }
-    }
-
-    private static void addValueNamesWithCasts(ProcessorContext context, CodeTreeBuilder body, SpecializationData specialization, EnumSet<Kind> included) {
-        for (ActualParameter spec : specialization.getParameters()) {
-            if (included.contains(spec.getSpecification().getKind())) {
-                TypeData typeData = spec.getActualTypeData(specialization.getOperation().getTypeSystem());
-                if (typeData.isGeneric()) {
-                    body.string(valueVariableName(spec));
-                } else {
-                    String methodName = TypeSystemCodeGenerator.asTypeMethodName(typeData);
-                    startCallTypeSystemMethod(context, body, specialization.getOperation(), methodName);
-                    body.string(valueVariableName(spec));
-                    body.end().end();
-                }
-            }
-        }
-    }
-
-    public static VariableElement findSingleton(ProcessorContext context, OperationData operation) {
-        TypeMirror type = context.findGeneratedClassBySimpleName(OperationCodeGenerator.genClassName(operation), operation);
-        return Utils.findDeclaredField(type, OperationCodeGenerator.singletonName(operation));
-    }
-
-    private static TypeMirror findOperationType(OperationData operation, CodeTypeElement operationGen) {
-        if (operation.hasExtensions()) {
-            // return generated type
-            return operationGen.asType();
-        } else {
-            // return default type
-            return operation.getTemplateType().asType();
-        }
-    }
-
-    private static String genClassName(OperationData operation) {
-        String name = getSimpleName(operation.getTemplateType());
-        return name + "Gen";
-    }
-
-    private static String singletonName(OperationData operation) {
-        return createConstantName(getSimpleName(operation.getTemplateType().asType()));
-    }
-
-    private static void startCallOperationMethod(CodeTreeBuilder body, OperationData operation, TemplateMethod method) {
-        body.startGroup();
-
-        if (operation.isUseSingleton()) {
-            body.string(singletonName(operation));
-            body.string(".").startCall(method.getMethodName());
-        } else {
-            body.string(OPERATION_FIELD_NAME);
-            body.string(".");
-            body.startCall(method.getMethodName());
-        }
-    }
-
-    private static void startCallTypeSystemMethod(ProcessorContext context, CodeTreeBuilder body,  OperationData operation, String methodName) {
-        VariableElement singleton = TypeSystemCodeGenerator.findSingleton(context, operation.getTypeSystem());
-        assert singleton != null;
-
-        body.startGroup();
-        body.staticReference(singleton.getEnclosingElement().asType(), singleton.getSimpleName().toString());
-        body.string(".").startCall(methodName);
-    }
-
-    private static void emitGuards(ProcessorContext context, CodeTreeBuilder body, String prefix, SpecializationData specialization, boolean onSpecialization, boolean needsCast) {
-        // Implict guards based on method signature
-        String andOperator = prefix;
-        for (ActualParameter param : specialization.getParameters()) {
-            if (param.getSpecification().getKind() == Kind.EXECUTE && !param.getActualTypeData(specialization.getOperation().getTypeSystem()).isGeneric()) {
-                body.string(andOperator);
-                startCallTypeSystemMethod(context, body, specialization.getOperation(),
-                                TypeSystemCodeGenerator.isTypeMethodName(param.getActualTypeData(specialization.getOperation().getTypeSystem())));
-                body.string(valueVariableName(param));
-                body.end().end(); // call
-                andOperator = " && ";
-            }
-        }
-
-        if (specialization.getGuards().length > 0) {
-            // Explicitly specified guards
-            for (SpecializationGuardData guard : specialization.getGuards()) {
-                if ((guard.isOnSpecialization() && onSpecialization)
-                                || (guard.isOnExecution() && !onSpecialization)) {
-                    body.string(andOperator);
-
-                    if (guard.getGuardDeclaration().getOrigin() == specialization.getOperation()) {
-                        startCallOperationMethod(body, specialization.getOperation(), guard.getGuardDeclaration());
-                    } else {
-                        startCallTypeSystemMethod(context, body, specialization.getOperation(), guard.getGuardMethod());
-                    }
-
-                    if (needsCast) {
-                        addValueNamesWithCasts(context, body, specialization, kinds(Kind.EXECUTE, Kind.SHORT_CIRCUIT));
-                    } else {
-                        addValueNames(body, specialization.getOperation(), kinds(Kind.EXECUTE, Kind.SHORT_CIRCUIT));
-                    }
-                    body.end().end(); // call
-                    andOperator = " && ";
-                }
-            }
-        }
-    }
-
-    @Override
-    protected void createChildren(OperationData m) {
-        CodeTypeElement operationGen = null;
-        if (m.hasExtensions()) {
-            OperationGenFactory factory = new OperationGenFactory(context);
-            add(factory, m);
-            operationGen = (CodeTypeElement) factory.getElement();
-        }
-        if (m.generateFactory) {
-            add(new OperationNodeFactory(context, operationGen), m);
-        }
-    }
-
-    protected class OperationGenFactory extends ClassElementFactory<OperationData> {
-
-        public OperationGenFactory(ProcessorContext context) {
-            super(context);
-        }
-
-        @Override
-        protected CodeTypeElement create(OperationData operation) {
-            CodeTypeElement clazz = createClass(operation, modifiers(PUBLIC), genClassName(operation), operation.getTemplateType().asType(), false);
-
-            clazz.add(createConstructorUsingFields(modifiers(PUBLIC), clazz));
-
-            if (operation.getExtensionElements() != null) {
-                clazz.getEnclosedElements().addAll(operation.getExtensionElements());
-            }
-            return clazz;
-        }
-
-    }
-
-
-
-    protected class OperationNodeFactory extends ClassElementFactory<OperationData> {
-
-        private final CodeTypeElement operationGen;
-
-        public OperationNodeFactory(ProcessorContext context, CodeTypeElement operationGen) {
-            super(context);
-            this.operationGen = operationGen;
-        }
-
-        @Override
-        protected CodeTypeElement create(OperationData operation) {
-            CodeTypeElement clazz = createClass(operation, modifiers(PUBLIC, FINAL), factoryClassName(operation), null, false);
-
-            if (operation.isUseSingleton()) {
-                TypeMirror type = findOperationType(operation, operationGen);
-                CodeVariableElement singleton = new CodeVariableElement(modifiers(PRIVATE, STATIC, FINAL), type, singletonName(operation));
-                clazz.add(singleton);
-                CodeTreeBuilder singletonInit = singleton.createInitBuilder();
-                singletonInit.startNew(type).end();
-            }
-
-            clazz.add(createConstructorUsingFields(modifiers(PRIVATE), clazz));
-            clazz.add(createCreateMethod(operation));
-            if (operation.getAllMethods().length > 1) {
-                clazz.add(createCreateSpecializedMethod(operation));
-            }
-            if (operation.needsRewrites()) {
-                clazz.add(createSpecializeMethod(operation));
-                clazz.add(createGeneratedGenericMethod(operation));
-            }
-
-            return clazz;
-        }
-
-        @Override
-        protected void createChildren(OperationData operation) {
-            for (SpecializationData specialization : operation.getAllMethods()) {
-                add(new SpecializationNodeFactory(context, operationGen), specialization);
-            }
-        }
-
-        private CodeExecutableElement createCreateMethod(OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC, STATIC), operation.getNodeType(), "create");
-            addNodeParameters(method, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE, Kind.CONSTRUCTOR_FIELD));
-
-            CodeTreeBuilder body = method.createBuilder();
-            body.startReturn();
-            if (operation.getAllMethods().length == 0) {
-                body.null_();
-            } else {
-                body.startNew(nodeClassName(operation.getAllMethods()[0]));
-                emitNewOperation(body, operation);
-                addNodeNames(body, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-                body.end();
-            }
-            body.end();
-
-            return method;
-        }
-
-        private void emitNewOperation(CodeTreeBuilder body, OperationData operation) {
-            if (!operation.isUseSingleton()) {
-                body.startGroup();
-                if (operation.hasExtensions()) {
-                    body.startNew(genClassName(operation));
-                } else {
-                    body.startNew(operation.getTemplateType().asType());
-                }
-                addNodeNames(body, operation, kinds(Kind.CONSTRUCTOR_FIELD));
-                body.end();
-                body.end();
-            }
-        }
-
-        private CodeExecutableElement createCreateSpecializedMethod(OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED, STATIC), operation.getNodeType(), "createSpecialized");
-            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "specializationClass"));
-            addOperationVariable(modifiers(), method, operation, operationGen);
-            addNodeParameters(method, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-
-            CodeTreeBuilder body = method.createBuilder();
-
-            boolean first = true;
-            for (TypeData type : operation.getTypeSystem().getTypes()) {
-                SpecializationData specialization = operation.findUniqueSpecialization(type);
-                if (specialization != null && !type.isGeneric()) {
-                    if (first) {
-                        body.startIf();
-                        first = false;
-                    } else {
-                        body.startElseIf();
-                    }
-                    body.string("specializationClass == ").type(type.getBoxedType()).string(".class").end().startBlock();
-                    body.startReturn().startNew(nodeClassName(specialization));
-                    addOperationFieldName(body, operation);
-                    addNodeNames(body, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-                    body.end().end();
-                    body.end();
-                }
-            }
-            body.startReturn().startNew(nodeClassName(operation.getGenericSpecialization()));
-            addOperationFieldName(body, operation);
-            addNodeNames(body, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-            body.end().end();
-            return method;
-        }
-
-        private CodeExecutableElement createSpecializeMethod(OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED, STATIC), operation.getNodeType(), "specialize");
-            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "minimumState"));
-            addOperationVariable(modifiers(), method, operation, operationGen);
-            addValueParameters(method, operation, kinds(Kind.EXECUTE));
-            addNodeParameters(method, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-
-            CodeTreeBuilder body = method.createBuilder();
-            body.startStatement().string("boolean allowed = (minimumState == ").string(nodeClassName(operation.getAllMethods()[0])).string(".class)").end();
-
-            for (int i = 1; i < operation.getAllMethods().length; i++) {
-                SpecializationData specialization = operation.getAllMethods()[i];
-                body.startStatement().string("allowed = allowed || (minimumState == ").string(nodeClassName(specialization)).string(".class)").end();
-
-                if (specialization.isGeneric()) {
-                    body.startIf().string("allowed").end().startBlock();
-                } else {
-                    body.startIf().string("allowed");
-                    emitGuards(getContext(), body, " && ", specialization, true, true);
-                    body.end().startBlock();
-                }
-                body.startReturn().startNew(nodeClassName(specialization));
-
-                addOperationFieldName(body, operation);
-                addNodeNames(body, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-                body.end().end();
-                body.end(); // block
-            }
-            body.startThrow().startNew(getContext().getType(IllegalArgumentException.class)).end().end();
-
-            return method;
-        }
-
-
-        private void emitInvokeDoMethod(CodeTreeBuilder builder, SpecializationData specialization) {
-            if (specialization.getExceptions().length > 0) {
-                builder.startTryBlock();
-            }
-
-            builder.startReturn();
-            startCallOperationMethod(builder, specialization.getOperation(), specialization);
-            for (ActualParameter param : specialization.getParameters()) {
-                boolean needsCast = param.getSpecification().getKind() == Kind.EXECUTE && !param.getActualTypeData(specialization.getOperation().getTypeSystem()).isGeneric();
-                if (needsCast) {
-                    startCallTypeSystemMethod(getContext(), builder, specialization.getOperation(), TypeSystemCodeGenerator.asTypeMethodName(param.getActualTypeData(specialization.getOperation().getTypeSystem())));
-                }
-                builder.string(valueVariableName(param));
-                if (needsCast) {
-                    builder.end().end();
-                }
-            }
-            builder.end().end(); // start call operation
-            builder.end(); // return
-
-            if (specialization.getExceptions().length > 0) {
-                for (SpecializationThrowsData exception : specialization.getExceptions()) {
-                    builder.end().startCatchBlock(exception.getJavaClass(), "ex");
-                    emitInvokeDoMethod(builder, exception.getTransitionTo());
-                }
-                builder.end();
-            }
-        }
-
-        private CodeExecutableElement createGeneratedGenericMethod(OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED, STATIC), operation.getGenericSpecialization().getReturnType().getActualType(), "generatedGeneric");
-            addOperationVariable(modifiers(), method, operation, operationGen);
-            addValueParameters(method, operation, kinds(Kind.SIGNATURE, Kind.EXECUTE, Kind.SHORT_CIRCUIT, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-
-            CodeTreeBuilder builder = method.createBuilder();
-            boolean ifStarted = false;
-            for (int i = 0; i < operation.getSpecializations().length; i++) {
-                SpecializationData specialization = operation.getSpecializations()[i];
-                if (specialization.isUninitialized()) {
-                    continue;
-                }
-                if (!specialization.isGeneric()) {
-                    if (!ifStarted) {
-                        builder.startIf();
-                        ifStarted = true;
-                    } else {
-                        builder.startElseIf();
-                    }
-                    emitGuards(getContext(), builder, "", specialization, false, true);
-                    builder.end().startBlock();
-                } else {
-                    builder.startElseBlock();
-                }
-
-                emitInvokeDoMethod(builder, specialization);
-                builder.end();
-            }
-            return method;
-        }
-    }
-
-    protected class SpecializationNodeFactory extends ClassElementFactory<SpecializationData> {
-
-        private CodeTypeElement operationGen;
-
-        public SpecializationNodeFactory(ProcessorContext context, CodeTypeElement operationGen) {
-            super(context);
-            this.operationGen = operationGen;
-        }
-
-        @Override
-        public CodeTypeElement create(SpecializationData specialization) {
-            OperationData operation = specialization.getOperation();
-            CodeTypeElement clazz = createClass(operation, modifiers(PRIVATE, STATIC, FINAL), nodeClassName(specialization), operation.getNodeType(), false);
-
-
-            CodeExecutableElement constructor = new CodeExecutableElement(modifiers(PROTECTED), null, clazz.getSimpleName().toString());
-            clazz.add(constructor);
-
-            CodeTreeBuilder builder = constructor.createBuilder();
-            builder.startStatement().startSuperCall();
-            addNodeNames(builder, operation, kinds(Kind.SUPER_ATTRIBUTE));
-            builder.end().end();
-
-            if (!operation.isUseSingleton()) {
-                addOperationVariable(modifiers(), constructor, operation, operationGen);
-                addOperationVariable(modifiers(PRIVATE, FINAL), clazz, operation, operationGen);
-                builder.startStatement();
-                builder.string("this.");
-                addOperationFieldName(builder, operation);
-                builder.string(" = ");
-                addOperationFieldName(builder, operation);
-                builder.end();
-            }
-            addNodeParameters(constructor, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-
-
-            for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-                String name = nodeVariableName(spec);
-
-                boolean isNodeAttribute = spec.getKind() == Kind.ATTRIBUTE && getContext().getEnvironment().getTypeUtils().isAssignable(spec.getValueType(), getContext().getTruffleTypes().getNode());
-                boolean isNodeArrayAttribute = spec.getKind() == Kind.ATTRIBUTE &&
-                                getContext().getEnvironment().getTypeUtils().isAssignable(spec.getValueType(), getContext().getTruffleTypes().getNodeArray());
-                if (spec.getKind() == Kind.EXECUTE || isNodeAttribute || isNodeArrayAttribute) {
-                    CodeVariableElement field = new CodeVariableElement(modifiers(PRIVATE), operation.getTypeSystem().getNodeType(), name);
-                    clazz.add(field);
-                    field.addAnnotationMirror(new CodeAnnotationMirror((DeclaredType) getContext().getTruffleTypes().getStableAnnotation()));
-                    if (isNodeArrayAttribute) {
-                        field.addAnnotationMirror(new CodeAnnotationMirror((DeclaredType) getContext().getTruffleTypes().getContentStableAnnotation()));
-                    }
-                    builder.startStatement().string("this.").string(name).string(" = adoptChild(").string(name).string(")").end();
-                } else if (spec.getKind() == Kind.ATTRIBUTE) {
-                    clazz.add(new CodeVariableElement(modifiers(PRIVATE, FINAL), spec.getValueType(), name));
-                    builder.startStatement().string("this.").string(name).string(" = ").string(name).end();
-                }
-            }
-
-            TypeSystemData typeSystem = operation.getTypeSystem();
-            for (TypeData type : typeSystem.getTypes()) {
-                CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type.getPrimitiveType(), executeMethodName(type));
-                clazz.add(method);
-                addValueParameters(method, operation, kinds(Kind.SIGNATURE));
-                if (!type.isGeneric()) {
-                    method.addThrownType(getUnexpectedValueException());
-                }
-
-                if (specialization.getReturnType().getActualTypeData(typeSystem) == type) {
-                    buildFunctionalExecuteMethod(method.createBuilder(), operation, specialization);
-                } else {
-                    buildCastingExecuteMethod(method.createBuilder(), operation, specialization, type);
-                }
-            }
-
-            if (typeSystem.getVoidType() != null)  {
-                CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), typeSystem.getVoidType().getPrimitiveType(), executeMethodName(typeSystem.getVoidType()));
-                addValueParameters(method, operation, kinds(Kind.SIGNATURE));
-                buildCastingExecuteMethod(method.createBuilder(), operation, specialization, typeSystem.getVoidType());
-                clazz.add(method);
-            }
-
-            if (operation.needsRewrites() && !specialization.isGeneric() && !specialization.isUninitialized()) {
-                buildSpecializeStateMethod(clazz, operation);
-            }
-            buildSpecializeClassMethod(clazz, operation);
-
-            return clazz;
-        }
-
-        private void buildCastingExecuteMethod(CodeTreeBuilder builder, OperationData operation, SpecializationData specialization, TypeData type) {
-            if (!type.isVoid()) {
-                builder.startStatement().type(specialization.getReturnType().getActualType()).string(" result").end();
-            }
-
-            boolean needsTry = !specialization.getReturnType().getActualTypeData(operation.getTypeSystem()).isGeneric();
-            if (needsTry) {
-                builder.startTryBlock();
-            }
-
-            builder.startStatement();
-            if (!type.isVoid()) {
-                builder.string("result = ");
-            }
-            builder.startCall(executeMethodName(specialization.getReturnType().getActualTypeData(operation.getTypeSystem()))).string("frame").end();
-            builder.end(); // statement
-
-            if (needsTry) {
-                builder.end().startCatchBlock(getUnexpectedValueException(), "ex");
-
-                if (!type.isVoid()) {
-                    builder.startReturn();
-                    if (!type.isGeneric()) {
-                        startCallTypeSystemMethod(getContext(), builder, operation, TypeSystemCodeGenerator.expectTypeMethodName(type));
-                    }
-
-                    builder.string("ex.getResult()");
-
-                    if (!type.isGeneric()) {
-                        builder.end().end();
-                    }
-                    builder.end(); // return
-                } else {
-                    builder.string("// ignore").newLine();
-                }
-            }
-            builder.end(); // try/catch
-
-            if (!type.isVoid()) {
-                builder.startReturn();
-                if (!type.isGeneric()) {
-                    startCallTypeSystemMethod(getContext(), builder, operation, TypeSystemCodeGenerator.expectTypeMethodName(type));
-                }
-                builder.string("result");
-                if (!type.isGeneric()) {
-                    builder.end().end();
-                }
-                builder.end(); // return
-            }
-        }
-
-        private void buildFunctionalExecuteMethod(CodeTreeBuilder builder, OperationData operation, SpecializationData specialization) {
-            ActualParameter previousShortCircuitParameter = null;
-            for (ActualParameter param : specialization.getParameters()) {
-                if (param.getSpecification().getKind() != Kind.EXECUTE) {
-                    // Nothing to do.
-                } else if (param.getActualTypeData(operation.getTypeSystem()).isGeneric()) {
-                    buildGenericValueExecute(builder, operation, param, null);
-                } else {
-                    buildSpecializedValueExecute(builder, operation, specialization, param);
-                }
-
-                assert param.getSpecification().getKind() == Kind.SHORT_CIRCUIT || previousShortCircuitParameter == null;
-            }
-
-            if (specialization.hasDynamicGuards()) {
-                builder.startIf();
-                emitGuards(getContext(), builder, "", specialization, false, false);
-                builder.end().startBlock();
-            }
-            if (specialization.getExceptions().length > 0) {
-                builder.startTryBlock();
-            }
-
-            if (specialization.isUninitialized() && operation.needsRewrites()) {
-                for (TemplateMethod listener : operation.getSpecializationListeners()) {
-                    builder.startStatement();
-                    startCallOperationMethod(builder, operation, listener);
-                    for (ActualParameter param : listener.getParameters()) {
-                        builder.string(valueVariableName(param));
-                    }
-                    builder.end().end();
-                    builder.end(); // statement
-                }
-
-                builder.startStatement();
-                builder.startCall("replace");
-                builder.startCall(factoryClassName(operation), "specialize");
-                builder.typeLiteral(builder.getRoot().getEnclosingClass().asType());
-                addOperationFieldName(builder, operation);
-                addValueNames(builder, operation, kinds(Kind.EXECUTE));
-                addNodeNames(builder, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-                builder.end().end().end();
-            }
-
-            if ((specialization.isUninitialized() || specialization.isGeneric()) && operation.needsRewrites()) {
-                builder.startReturn().startCall(factoryClassName(specialization.getOperation()), "generatedGeneric");
-                addOperationFieldName(builder, operation);
-                addValueNames(builder, operation, kinds(Kind.SIGNATURE, Kind.EXECUTE, Kind.SHORT_CIRCUIT, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-                builder.end().end();
-            } else {
-                builder.startReturn();
-
-                if (specialization.isUninitialized()) {
-                    startCallOperationMethod(builder, specialization.getOperation(), specialization.getOperation().getGenericSpecialization());
-                } else {
-                    startCallOperationMethod(builder, specialization.getOperation(), specialization);
-                }
-                for (ActualParameter param : specialization.getParameters()) {
-                    builder.string(valueVariableName(param));
-                }
-                builder.end().end(); // operation call
-                builder.end(); // return
-            }
-
-            if (specialization.getExceptions().length > 0) {
-                for (SpecializationThrowsData exception : specialization.getExceptions()) {
-                    builder.end().startCatchBlock(exception.getJavaClass(), "ex");
-                    buildThrowSpecialize(builder, operation, exception.getTransitionTo(), null);
-                }
-                builder.end();
-            }
-            if (specialization.hasDynamicGuards()) {
-                builder.end().startElseBlock();
-                buildThrowSpecialize(builder, operation, specialization.findNextSpecialization(), null);
-                builder.end();
-            }
-        }
-
-        private void buildGenericValueExecute(CodeTreeBuilder builder, OperationData operation, ActualParameter param, ParameterSpec exceptionSpec) {
-            boolean shortCircuit = startShortCircuit(builder, operation.getGenericSpecialization(),
-                            operation.getGenericSpecialization().findParameter(param.getSpecification().getName()), exceptionSpec);
-
-            builder.startStatement();
-            if (!shortCircuit) {
-                builder.type(operation.getTypeSystem().getGenericType());
-                builder.string(" ");
-            }
-            builder.string(valueVariableName(param));
-            builder.string(" = ").startCall(nodeVariableName(param), executeMethodName(operation.getTypeSystem().getGenericTypeData())).string("frame").end();
-            builder.end();
-
-            endShortCircuit(builder, shortCircuit);
-        }
-
-        private boolean startShortCircuit(CodeTreeBuilder builder, SpecializationData specialization,
-                        ActualParameter forParam, ParameterSpec exceptionParam) {
-            ActualParameter shortCircuitParam = specialization.getPreviousParam(forParam);
-            if (shortCircuitParam == null || shortCircuitParam.getSpecification().getKind() != Kind.SHORT_CIRCUIT) {
-                return false;
-            }
-
-            int shortCircuitIndex = 0;
-            for (ActualParameter parameter : specialization.getParameters()) {
-                if (parameter.getSpecification().getKind() == Kind.SHORT_CIRCUIT) {
-                    if (parameter == shortCircuitParam) {
-                        break;
-                    }
-                    shortCircuitIndex++;
-                }
-            }
-
-            builder.startStatement().type(shortCircuitParam.getActualType()).string(" ").string(shortCircuitParam.getSpecification().getName()).string(" = ");
-            ShortCircuitData shortCircuitData = specialization.getShortCircuits()[shortCircuitIndex];
-
-            startCallOperationMethod(builder, specialization.getOperation(), shortCircuitData);
-            for (ActualParameter callParam : shortCircuitData.getParameters()) {
-                ParameterSpec spec = callParam.getSpecification();
-                if (spec.getKind() == Kind.EXECUTE || spec.getKind() == Kind.SHORT_CIRCUIT || spec.getKind() == Kind.SIGNATURE) {
-                    if (exceptionParam != null && callParam.getSpecification().getName().equals(exceptionParam.getName())) {
-                        builder.string("ex.getResult()");
-                    } else {
-                        builder.string(valueVariableName(spec));
-                    }
-                }
-            }
-            builder.end().end(); // call operation
-
-            builder.end(); // statement
-
-            builder.declaration(forParam.getActualType(), valueVariableName(forParam),
-                            CodeTreeBuilder.createBuilder().defaultValue(forParam.getActualType()));
-            builder.startIf().string(valueVariableName(shortCircuitParam)).end();
-            builder.startBlock();
-
-            return true;
-        }
-
-
-        private void endShortCircuit(CodeTreeBuilder builder, boolean shortCircuit) {
-            if (shortCircuit) {
-                builder.end();
-            }
-        }
-
-        private void buildSpecializedValueExecute(CodeTreeBuilder builder, OperationData operation, SpecializationData specialization, ActualParameter param) {
-            boolean shortCircuit = startShortCircuit(builder, specialization, param, null);
-
-            if (!shortCircuit) {
-                builder.startStatement().type(param.getActualType()).string(" ").string(valueVariableName(param)).end();
-            }
-
-            builder.startTryBlock();
-            builder.startStatement().string(valueVariableName(param)).string(" = ");
-            builder.startCall(nodeVariableName(param), executeMethodName(param.getActualTypeData(operation.getTypeSystem()))).string("frame").end();
-            builder.end();
-
-            builder.end().startCatchBlock(getUnexpectedValueException(), "ex");
-            boolean execute = false;
-            for (ActualParameter exParam : specialization.getParameters()) {
-                if (exParam.getSpecification().getKind() != Kind.EXECUTE) {
-                    // Nothing to do.
-                } else if (execute) {
-                    buildGenericValueExecute(builder, operation, exParam, param.getSpecification());
-                } else if (exParam == param) {
-                    execute = true;
-                }
-            }
-
-            buildThrowSpecialize(builder, operation, specialization.findNextSpecialization(), param.getSpecification());
-            builder.end(); // catch block
-
-            endShortCircuit(builder, shortCircuit);
-            builder.newLine();
-        }
-
-        private void buildThrowSpecialize(CodeTreeBuilder builder, OperationData operation, SpecializationData nextSpecialization, ParameterSpec exceptionSpec) {
-            builder.startThrow().startCall("specialize");
-            builder.string(nodeClassName(nextSpecialization) + ".class");
-            addValueNames(builder, operation, kinds(Kind.SIGNATURE));
-            for (ParameterSpec spec : operation.getSpecification().getParameters()) {
-                if (spec.getKind() == Kind.EXECUTE || spec.getKind() == Kind.SHORT_CIRCUIT) {
-                    if (spec == exceptionSpec) {
-                        builder.string("ex.getResult()");
-                    } else {
-                        builder.string(valueVariableName(spec));
-                    }
-                }
-            }
-            builder.end().end();
-        }
-
-        private void buildSpecializeStateMethod(CodeTypeElement clazz, OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PRIVATE), getUnexpectedValueException(), "specialize");
-            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "minimumState"));
-            addValueParameters(method, operation, kinds(Kind.SIGNATURE, Kind.EXECUTE, Kind.SHORT_CIRCUIT));
-            clazz.add(method);
-            CodeTreeBuilder builder = method.createBuilder();
-
-            for (TemplateMethod listener : operation.getSpecializationListeners()) {
-                builder.startStatement();
-                startCallOperationMethod(builder, operation, listener);
-                for (ActualParameter param : listener.getParameters()) {
-                    builder.string(valueVariableName(param));
-                }
-                builder.end().end();
-                builder.end(); // statement
-            }
-
-            builder.startStatement();
-            builder.startCall("replace");
-            builder.startCall(factoryClassName(operation), "specialize").string("minimumState");
-            addOperationFieldName(builder, operation);
-            addValueNames(builder, operation, kinds(Kind.EXECUTE));
-            addNodeNames(builder, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-            builder.end().end().end();
-
-            builder.startReturn().startNew(getUnexpectedValueException()).startCall(factoryClassName(operation), "generatedGeneric");
-            addOperationFieldName(builder, operation);
-            addValueNames(builder, operation, kinds(Kind.SIGNATURE, Kind.EXECUTE, Kind.SHORT_CIRCUIT, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-            builder.end().end().end();
-        }
-
-        private void buildSpecializeClassMethod(CodeTypeElement clazz, OperationData operation) {
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PROTECTED), getContext().getType(void.class), "specialize");
-            method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "specializationClass"));
-            if (!isDeclaredMethodInSuperType(clazz, method.getSimpleName().toString(), method.getParameterTypes())) {
-                return;
-            }
-            clazz.add(method);
-            CodeTreeBuilder builder = method.createBuilder();
-
-            builder.startStatement();
-            builder.startCall("replace");
-            builder.startCall(factoryClassName(operation), "createSpecialized").string("specializationClass");
-            addOperationFieldName(builder, operation);
-            addNodeNames(builder, operation, kinds(Kind.EXECUTE, Kind.ATTRIBUTE, Kind.SUPER_ATTRIBUTE));
-            builder.end().end().end();
-        }
-    }
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.util.*;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.typesystem.*;
-
-public class OperationData extends Template {
-
-    private final TypeSystemData typeSystem;
-    private final String[] values;
-    private final String[] shortCircuitValues;
-    private final OperationFieldData[] operationFields;
-    private final OperationFieldData[] constructorFields;
-    private final OperationFieldData[] superFields;
-    private final TypeMirror nodeType;
-
-    private MethodSpec specification;
-    private SpecializationData genericSpecialization;
-    private SpecializationData[] specializations;
-    private TemplateMethod[] specializationListeners;
-    private GuardData[] guards;
-
-    boolean generateFactory = true;
-
-    public OperationData(TypeElement templateType, AnnotationMirror templateTypeAnnotation,
-                    TypeSystemData typeSystem, TypeMirror nodeType,
-                    String[] values, String[] shortCircuitValues,
-                    OperationFieldData[] operationFields,
-                    OperationFieldData[] constructorFields,
-                    OperationFieldData[] superFields) {
-        super(templateType, templateTypeAnnotation);
-        this.nodeType = nodeType;
-        this.typeSystem = typeSystem;
-        this.values = values;
-        this.shortCircuitValues = shortCircuitValues;
-        this.operationFields = operationFields;
-        this.constructorFields = constructorFields;
-        this.superFields = superFields;
-    }
-
-    public boolean isUseSingleton() {
-        return constructorFields.length == 0;
-    }
-
-    public boolean hasExtensions() {
-        return !getExtensionElements().isEmpty();
-    }
-
-    public List<GuardData> findGuards(String name) {
-        List<GuardData> foundGuards = new ArrayList<>();
-        for (GuardData guardData : guards) {
-            if (guardData.getMethodName().equals(name)) {
-                foundGuards.add(guardData);
-            }
-        }
-        for (GuardData guardData : getTypeSystem().getGuards()) {
-            if (guardData.getMethodName().equals(name)) {
-                foundGuards.add(guardData);
-            }
-        }
-        return foundGuards;
-    }
-
-
-    void setGuards(GuardData[] guards) {
-        this.guards = guards;
-    }
-
-    void setSpecification(MethodSpec specification) {
-        this.specification = specification;
-    }
-
-    void setGenericSpecialization(SpecializationData genericSpecialization) {
-        this.genericSpecialization = genericSpecialization;
-    }
-
-    void setSpecializations(SpecializationData[] specializations) {
-        this.specializations = specializations;
-        for (SpecializationData specialization : specializations) {
-            specialization.setOperation(this);
-        }
-    }
-
-    void setSpecializationListeners(TemplateMethod[] specializationListeners) {
-        this.specializationListeners = specializationListeners;
-    }
-
-    public String[] getValues() {
-        return values;
-    }
-
-    public OperationFieldData[] getOperationFields() {
-        return operationFields;
-    }
-
-    public String[] getShortCircuitValues() {
-        return shortCircuitValues;
-    }
-
-    public TypeSystemData getTypeSystem() {
-        return typeSystem;
-    }
-
-    public TypeMirror getNodeType() {
-        return nodeType;
-    }
-
-    public SpecializationData[] getSpecializations() {
-        return specializations;
-    }
-
-    public SpecializationData getGenericSpecialization() {
-        return genericSpecialization;
-    }
-
-    public OperationFieldData[] getConstructorFields() {
-        return constructorFields;
-    }
-
-    public OperationFieldData[] getSuperFields() {
-        return superFields;
-    }
-
-    public MethodSpec getSpecification() {
-        return specification;
-    }
-
-    public SpecializationData[] getAllMethods() {
-        return specializations;
-    }
-
-    public boolean needsRewrites() {
-        boolean needsRewrites = getValues().length > 0 || getShortCircuitValues().length > 0;
-        needsRewrites &= specializations.length >= 2;
-        return needsRewrites;
-    }
-
-    public TemplateMethod[] getSpecializationListeners() {
-        return specializationListeners;
-    }
-
-    public GuardData[] getGuards() {
-        return guards;
-    }
-
-    public SpecializationData findUniqueSpecialization(TypeData type) {
-        SpecializationData result = null;
-        for (SpecializationData specialization : specializations) {
-            if (specialization.getReturnType().getActualTypeData(getTypeSystem()) == type) {
-                if (result != null) {
-                    // Result not unique;
-                    return null;
-                }
-                result = specialization;
-            }
-        }
-        return result;
-    }
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationFieldData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import javax.lang.model.type.*;
-
-import com.oracle.truffle.codegen.processor.*;
-
-public class OperationFieldData {
-
-    private final String name;
-    private final TypeMirror javaClass;
-
-    public OperationFieldData(String name, TypeMirror javaClass) {
-        this.name = name;
-        this.javaClass = javaClass;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public TypeMirror getJavaClass() {
-        return javaClass;
-    }
-
-    @Override
-    public String toString() {
-        return Utils.getSimpleName(javaClass);
-    }
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationMethodParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.util.*;
-
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
-
-public abstract class OperationMethodParser<E extends TemplateMethod> extends TemplateMethodParser<E>{
-
-    private final OperationData operation;
-
-    public OperationMethodParser(ProcessorContext context, OperationData operation) {
-        super(context);
-        this.operation = operation;
-    }
-
-    public OperationData getOperation() {
-        return operation;
-    }
-
-    protected ParameterSpec createValueParameterSpec(String valueName) {
-        return new ParameterSpec(valueName, operation.getTypeSystem(),
-                        Kind.EXECUTE, false, Cardinality.ONE);
-    }
-
-    protected ParameterSpec createReturnParameterSpec() {
-        return createValueParameterSpec("operation");
-    }
-
-    protected final MethodSpec createDefaultMethodSpec(String shortCircuitName) {
-        List<ParameterSpec> defaultParameters = new ArrayList<>();
-        ParameterSpec frameSpec = new ParameterSpec("frame", getContext().getTruffleTypes().getFrame(), Kind.SIGNATURE, true);
-        defaultParameters.add(frameSpec);
-
-        for (String valueName : operation.getValues()) {
-            defaultParameters.add(createValueParameterSpec(valueName));
-        }
-
-        for (String valueName : operation.getShortCircuitValues()) {
-            if (shortCircuitName != null && valueName.equals(shortCircuitName)) {
-                break;
-            }
-
-            defaultParameters.add(new ParameterSpec(shortCircuitValueName(valueName),
-                            getContext().getType(boolean.class), Kind.SHORT_CIRCUIT, false));
-
-            defaultParameters.add(createValueParameterSpec(valueName));
-        }
-
-        for (OperationFieldData field : operation.getSuperFields()) {
-            defaultParameters.add(new ParameterSpec(field.getName(), field.getJavaClass(), Kind.SUPER_ATTRIBUTE, true));
-        }
-
-        for (OperationFieldData field : operation.getOperationFields()) {
-            defaultParameters.add(new ParameterSpec(field.getName(), field.getJavaClass(), Kind.ATTRIBUTE, false));
-        }
-
-        return new MethodSpec(createReturnParameterSpec(), defaultParameters);
-    }
-
-    private static String shortCircuitValueName(String valueName) {
-        return "has" + Utils.firstLetterUpperCase(valueName) + "Value";
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/OperationParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,569 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.lang.annotation.*;
-import java.util.*;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-import javax.lang.model.util.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.ast.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-import com.oracle.truffle.codegen.processor.typesystem.*;
-
-public class OperationParser extends TemplateParser<OperationData> {
-
-    public OperationParser(ProcessorContext c) {
-        super(c);
-    }
-
-    @Override
-    public Class< ? extends Annotation> getAnnotationType() {
-        return com.oracle.truffle.api.codegen.Operation.class;
-    }
-
-    @Override
-    protected OperationData parse(Element element, AnnotationMirror templateTypeAnnotation) {
-        TypeElement templateType = (TypeElement) element;
-
-        if (!verifyTemplateType(templateType, templateTypeAnnotation)) {
-            return null;
-        }
-
-        TypeMirror typeSystemMirror = Utils.getAnnotationValueType(templateTypeAnnotation, "typeSystem");
-        final TypeSystemData typeSystem = (TypeSystemData) context.getTemplate(typeSystemMirror, true);
-        if (typeSystem == null) {
-            log.error(templateType, templateTypeAnnotation, "Type system '%s' is invalid.", Utils.getQualifiedName(typeSystemMirror));
-            return null;
-        }
-
-        TypeMirror nodeType = Utils.getAnnotationValueType(templateTypeAnnotation, "baseClass");
-        if (Utils.typeEquals(nodeType, context.getTruffleTypes().getNode())) {
-            nodeType = typeSystem.getNodeType();
-        }
-
-        if (!Utils.isAssignable(nodeType, typeSystem.getNodeType())) {
-            log.error(templateType, templateTypeAnnotation,
-                            Utils.getAnnotationValue(templateTypeAnnotation, "baseClass"),
-                            "The baseClass does not extend the base class of the type system '%s'.", Utils.getQualifiedName(typeSystem.getNodeType()));
-            return null;
-        }
-
-        for (VariableElement field : ElementFilter.fieldsIn(templateType.getEnclosedElements())) {
-            if (!field.getModifiers().contains(Modifier.STATIC)
-                            && !field.getModifiers().contains(Modifier.FINAL)) {
-                log.error(field, "Field must be final.");
-                return null;
-            }
-        }
-
-
-        List<String> valueNames = Utils.getAnnotationValueList(templateTypeAnnotation, "values");
-        List<String> shortCircuitNames = Utils.getAnnotationValueList(templateTypeAnnotation, "shortCircuitValues");
-
-        List<String> names = new ArrayList<>();
-        names.addAll(valueNames);
-        names.addAll(shortCircuitNames);
-
-        List<AnnotationMirror> fieldAnnotations = Collections.emptyList(); // call collectionAnnotations instead if you want OperationField support enabled.
-        List<OperationFieldData> fields = new ArrayList<>();
-        for (AnnotationMirror fieldMirror : fieldAnnotations) {
-            String name = Utils.getAnnotationValueString(fieldMirror, "name");
-            TypeMirror javaClass = Utils.getAnnotationValueType(fieldMirror, "javaClass");
-            fields.add(new OperationFieldData(name, javaClass));
-            names.add(name);
-        }
-
-        List<OperationFieldData> constructorFields = parseConstructorFields(templateType, true);
-        if (constructorFields == null) {
-            return null;
-        }
-
-        List<OperationFieldData> superConstructorFields = parseConstructorFields(Utils.fromTypeMirror(nodeType), false);
-        if (superConstructorFields == null) {
-            return null;
-        }
-
-        List<OperationFieldData> protectedSuperFields = parseProtectedFields(Utils.fromTypeMirror(nodeType));
-        if (protectedSuperFields == null) {
-            return null;
-        }
-
-        List<OperationFieldData> matchedSuperFields = matchFields(superConstructorFields, protectedSuperFields);
-        if (matchedSuperFields == null) {
-            log.error(templateType, templateTypeAnnotation, Utils.getAnnotationValue(templateTypeAnnotation, "baseClass"),
-                            "The signature of the protected fields (%s) and the first constructor(%s) in %s does not match.",
-                            protectedSuperFields.toString(),
-                            superConstructorFields.toString(),
-                            Utils.getQualifiedName(nodeType));
-            return null;
-        }
-
-        for (OperationFieldData field : constructorFields) {
-            names.add(field.getName());
-        }
-
-        for (OperationFieldData field : matchedSuperFields) {
-            names.add(field.getName());
-        }
-
-        if (!verifyNames(templateType, templateTypeAnnotation, names)) {
-            return null;
-        }
-
-        OperationData operationData = new OperationData(templateType, templateTypeAnnotation, typeSystem, nodeType,
-                        valueNames.toArray(new String[valueNames.size()]),
-                        shortCircuitNames.toArray(new String[shortCircuitNames.size()]),
-                        fields.toArray(new OperationFieldData[fields.size()]),
-                        constructorFields.toArray(new OperationFieldData[constructorFields.size()]),
-                        matchedSuperFields.toArray(new OperationFieldData[matchedSuperFields.size()]));
-
-        if (!verifyExclusiveMethodAnnotation(templateType,
-                        Specialization.class, Generic.class, SpecializationListener.class, ShortCircuit.class, GuardCheck.class)) {
-            return noFactory(operationData);
-        }
-
-        operationData.setExtensionElements(getExtensionParser().parseAll(templateType));
-
-        List<SpecializationData> genericSpecializations = parseMethods(operationData, new GenericParser(context, operationData));
-        List<GuardData> guards = parseMethods(operationData, new GuardParser(context, operationData.getTypeSystem(), operationData));
-        operationData.setGuards(guards.toArray(new GuardData[guards.size()]));
-
-        SpecializationParser specializationParser = new SpecializationParser(context, operationData);
-        operationData.setSpecification(specializationParser.getSpecification());
-        List<SpecializationData> specializations = parseMethods(operationData, specializationParser);
-        List<ShortCircuitData> shortCircuits = parseMethods(operationData, new ShortCircuitParser(context, operationData));
-        List<TemplateMethod> listeners = parseMethods(operationData, new SpecializationListenerParser(context, operationData));
-
-        if (specializations == null || genericSpecializations == null || shortCircuits == null  || listeners == null || guards == null) {
-            return noFactory(operationData);
-        }
-
-
-        SpecializationData genericSpecialization = null;
-        if (genericSpecializations.size() > 1) {
-            for (SpecializationData generic : genericSpecializations) {
-                log.error(generic.getMethod(), "Only one method with @%s is allowed per operation.", Generic.class.getSimpleName());
-            }
-            return noFactory(operationData);
-        } else if (genericSpecializations.size() == 1) {
-            genericSpecialization = genericSpecializations.get(0);
-        }
-
-        if (specializations.size() > 1 && genericSpecialization == null) {
-            log.error(templateType, "Need a @%s method.", Generic.class.getSimpleName());
-            return noFactory(operationData);
-        }
-
-        Collections.sort(specializations, new Comparator<SpecializationData>() {
-            @Override
-            public int compare(SpecializationData o1, SpecializationData o2) {
-                return compareSpecialization(typeSystem, o1, o2);
-            }
-        });
-
-        List<SpecializationData> allSpecializations = new ArrayList<>(specializations);
-        if (genericSpecialization != null) {
-            allSpecializations.add(genericSpecialization);
-            TemplateMethod uninializedMethod = new TemplateMethod(genericSpecialization.getSpecification(), new CodeExecutableElement(context.getType(void.class), "doUninialized"),
-                            genericSpecialization.getMarkerAnnotation(), genericSpecialization.getReturnType(), genericSpecialization.getParameters());
-            allSpecializations.add(0, new SpecializationData(uninializedMethod, false, true));
-        }
-
-        // verify order is not ambiguous
-        verifySpecializationOrder(typeSystem, specializations);
-
-        operationData.setGenericSpecialization(genericSpecialization);
-        operationData.setSpecializations(allSpecializations.toArray(new SpecializationData[allSpecializations.size()]));
-        operationData.setSpecializationListeners(listeners.toArray(new TemplateMethod[listeners.size()]));
-
-        if (!assignShortCircuitsToSpecializations(operationData, allSpecializations, shortCircuits)) {
-            return null;
-        }
-
-        if (!verifyNamingConvention(specializations, "do")) {
-            return noFactory(operationData);
-        }
-
-        if (!verifyNamesUnique(specializations)) {
-            return noFactory(operationData);
-        }
-
-        if (!verifyNamingConvention(shortCircuits, "needs")) {
-            return noFactory(operationData);
-        }
-
-        if (!verifySpecializationThrows(typeSystem, specializations)) {
-            return noFactory(operationData);
-        }
-
-        return operationData;
-    }
-
-    private static List<OperationFieldData> matchFields(List<OperationFieldData> params,
-                    List<OperationFieldData> fields) {
-
-        if (params.size() != fields.size()) {
-            return null;
-        }
-
-        List<OperationFieldData> matchedFields = new ArrayList<>();
-        for (int i = 0; i < params.size(); i++) {
-            OperationFieldData param = params.get(i);
-            OperationFieldData field = fields.get(i);
-            if (!Utils.typeEquals(param.getJavaClass(), field.getJavaClass())) {
-                return null;
-            }
-            matchedFields.add(new OperationFieldData(field.getName(), param.getJavaClass()));
-        }
-
-        return matchedFields;
-    }
-
-    private static List<OperationFieldData> parseProtectedFields(Element element) {
-        List<OperationFieldData> opFields = new ArrayList<>();
-        List<VariableElement> fields = ElementFilter.fieldsIn(element.getEnclosedElements());
-        for (VariableElement var : fields) {
-            if (var.getModifiers().contains(Modifier.STATIC)) {
-                continue;
-            }
-
-            if (var.getModifiers().contains(Modifier.PROTECTED)) {
-                opFields.add(new OperationFieldData(var.getSimpleName().toString(), var.asType()));
-            }
-        }
-        return opFields;
-
-    }
-
-    private List<OperationFieldData> parseConstructorFields(Element element, boolean failOnMultipleConstructors) {
-        if (element == null) {
-            return Collections.emptyList();
-        }
-
-        List<ExecutableElement> constructors = ElementFilter.constructorsIn(element.getEnclosedElements());
-        ExecutableElement constructor = null;
-        if (constructors.size() > 1) {
-            if (failOnMultipleConstructors) {
-                for (ExecutableElement c : constructors) {
-                    log.error(c, "The Operation annotated class must not define multiple constructors.");
-                }
-                return null;
-            } else {
-                // take first constructor
-                constructor = constructors.get(0);
-            }
-        } else if (constructors.size() == 1) {
-            constructor = constructors.get(0);
-        }
-
-        List<OperationFieldData> constructorFields = new ArrayList<>();
-        if (constructor != null) {
-            for (VariableElement var : constructor.getParameters()) {
-                constructorFields.add(new OperationFieldData(var.getSimpleName().toString(), var.asType()));
-            }
-        }
-        return constructorFields;
-    }
-
-    private static OperationData noFactory(OperationData data) {
-        data.generateFactory = false;
-        return data;
-    }
-
-    private boolean verifySpecializationThrows(TypeSystemData typeSystem, List<SpecializationData> specializations) {
-        Map<String, SpecializationData> specializationMap = new HashMap<>();
-        for (SpecializationData spec : specializations) {
-            specializationMap.put(spec.getMethodName(), spec);
-        }
-        boolean valid = true;
-        for (SpecializationData sourceSpecialization : specializations) {
-            if (sourceSpecialization.getExceptions() != null) {
-                for (SpecializationThrowsData throwsData : sourceSpecialization.getExceptions()) {
-                    SpecializationData targetSpecialization = specializationMap.get(throwsData.getTransitionToName());
-                    AnnotationValue value = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "transitionTo");
-                    if (targetSpecialization == null) {
-                        log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value,
-                                        "Specialization with name '%s' not found.", throwsData.getTransitionToName());
-                        valid = false;
-                    } else if (compareSpecialization(typeSystem, sourceSpecialization, targetSpecialization) >= 0) {
-                        log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), value,
-                                        "The order of the target specializalization must be higher than the source specialization.", throwsData.getTransitionToName());
-                        valid = false;
-                    }
-
-                    for (SpecializationThrowsData otherThrowsData : sourceSpecialization.getExceptions()) {
-                        if (otherThrowsData != throwsData
-                                        && Utils.typeEquals(otherThrowsData.getJavaClass(), throwsData.getJavaClass())) {
-                            AnnotationValue javaClassValue = Utils.getAnnotationValue(throwsData.getAnnotationMirror(), "javaClass");
-                            log.error(throwsData.getSpecialization().getMethod(), throwsData.getAnnotationMirror(), javaClassValue,
-                                            "Duplicate exception type.", throwsData.getTransitionToName());
-                            valid = false;
-                        }
-                    }
-                }
-            }
-        }
-        return valid;
-    }
-
-
-    private boolean assignShortCircuitsToSpecializations(OperationData operation,
-                    List<SpecializationData> specializations,
-                    List<ShortCircuitData> shortCircuits) {
-
-        Map<String, List<ShortCircuitData>> groupedShortCircuits = groupShortCircuits(shortCircuits);
-
-        boolean valid = true;
-
-        for (String valueName : operation.getShortCircuitValues()) {
-            List<ShortCircuitData> availableCircuits = groupedShortCircuits.get(valueName);
-
-            if (availableCircuits == null || availableCircuits.isEmpty()) {
-                log.error(operation.getTemplateType(), operation.getTemplateTypeAnnotation(),
-                                "@%s method for short cut value '%s' required.",
-                                ShortCircuit.class.getSimpleName(), valueName);
-                valid = false;
-                continue;
-            }
-
-
-            boolean sameMethodName = true;
-            String methodName = availableCircuits.get(0).getMethodName();
-            for (ShortCircuitData circuit : availableCircuits) {
-                if (!circuit.getMethodName().equals(methodName)) {
-                    sameMethodName = false;
-                }
-            }
-
-            if (!sameMethodName) {
-                for (ShortCircuitData circuit : availableCircuits) {
-                    log.error(circuit.getMethod(), circuit.getMarkerAnnotation(), "All short circuits for short cut value '%s' must have the same method name.", valueName);
-                }
-                valid = false;
-                continue;
-            }
-
-            ShortCircuitData genericCircuit = null;
-            for (ShortCircuitData circuit : availableCircuits) {
-                if (isGenericShortCutMethod(circuit, operation.getTypeSystem().getGenericType())) {
-                    genericCircuit = circuit;
-                    break;
-                }
-            }
-
-            if (genericCircuit == null) {
-                log.error(operation.getTemplateType(), operation.getTemplateTypeAnnotation(),
-                                "No generic @%s method available for short cut value '%s'.", ShortCircuit.class.getSimpleName(), valueName);
-                valid = false;
-                continue;
-            }
-
-            for (ShortCircuitData circuit : availableCircuits) {
-                if (circuit != genericCircuit) {
-                    circuit.setGenericShortCircuitMethod(genericCircuit);
-                }
-            }
-        }
-
-        if (!valid) {
-            return valid;
-        }
-
-        for (SpecializationData specialization : specializations) {
-            ShortCircuitData[] assignedShortCuts = new ShortCircuitData[operation.getShortCircuitValues().length];
-
-            for (int i = 0; i < operation.getShortCircuitValues().length; i++) {
-                List<ShortCircuitData> availableShortCuts = groupedShortCircuits.get(operation.getShortCircuitValues()[i]);
-
-                ShortCircuitData genericShortCircuit = null;
-                for (ShortCircuitData circuit : availableShortCuts) {
-                    if (circuit.isGeneric()) {
-                        genericShortCircuit = circuit;
-                    } else if (circuit.isCompatibleTo(specialization)) {
-                        assignedShortCuts[i] = circuit;
-                    }
-                }
-
-                if (assignedShortCuts[i] == null) {
-                    assignedShortCuts[i] = genericShortCircuit;
-                }
-            }
-            specialization.setShortCircuits(assignedShortCuts);
-        }
-        return true;
-    }
-
-    private static boolean isGenericShortCutMethod(TemplateMethod method, TypeMirror genericType) {
-        for (ActualParameter parameter : method.getParameters()) {
-            if (parameter.getSpecification().getKind() == Kind.EXECUTE) {
-                if (!Utils.typeEquals(genericType, parameter.getActualType())) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    private static Map<String, List<ShortCircuitData>> groupShortCircuits(List<ShortCircuitData> shortCircuits) {
-        Map<String, List<ShortCircuitData>> group = new HashMap<>();
-        for (ShortCircuitData shortCircuit : shortCircuits) {
-            List<ShortCircuitData> circuits = group.get(shortCircuit.getValueName());
-            if (circuits == null) {
-                circuits = new ArrayList<>();
-                group.put(shortCircuit.getValueName(), circuits);
-            }
-            circuits.add(shortCircuit);
-        }
-        return group;
-    }
-
-    private boolean verifyNamingConvention(List<? extends TemplateMethod> methods, String prefix) {
-        boolean valid = true;
-        for (int i = 0; i < methods.size(); i++) {
-            TemplateMethod m1 = methods.get(i);
-            if (m1.getMethodName().length() < 3 || !m1.getMethodName().startsWith(prefix)) {
-                log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Naming convention: method name must start with '%s'.", prefix);
-                valid = false;
-            }
-        }
-        return valid;
-    }
-
-    private boolean verifyNamesUnique(List<? extends TemplateMethod> methods) {
-        boolean valid = true;
-        for (int i = 0; i < methods.size(); i++) {
-            TemplateMethod m1 = methods.get(i);
-            for (int j = i + 1; j < methods.size(); j++) {
-                TemplateMethod m2 = methods.get(j);
-
-                if (m1.getMethodName().equalsIgnoreCase(m2.getMethodName())) {
-                    log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Method name '%s' used multiple times", m1.getMethodName());
-                    log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Method name '%s' used multiple times", m1.getMethodName());
-                    return false;
-                }
-            }
-        }
-        return valid;
-    }
-
-    private boolean verifySpecializationOrder(TypeSystemData typeSystem, List<SpecializationData> specializations) {
-        for (int i = 0; i < specializations.size(); i++) {
-            SpecializationData m1 = specializations.get(i);
-            for (int j = i + 1; j < specializations.size(); j++) {
-                SpecializationData m2 = specializations.get(j);
-                int inferredOrder = compareSpecializationWithoutOrder(typeSystem, m1, m2);
-
-                if (m1.getOrder() != Specialization.DEFAULT_ORDER && m2.getOrder() != Specialization.DEFAULT_ORDER) {
-                    int specOrder = m1.getOrder() - m2.getOrder();
-                    if (specOrder == 0) {
-                        log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Order value %d used multiple times", m1.getOrder());
-                        log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Order value %d used multiple times", m1.getOrder());
-                        return false;
-                    } else if ((specOrder < 0 && inferredOrder > 0) || (specOrder > 0 && inferredOrder < 0)) {
-                        log.error(m1.getMethod(), m1.getMarkerAnnotation(), "Explicit order values %d and %d are inconsistent with type lattice ordering.", m1.getOrder(), m2.getOrder());
-                        log.error(m2.getMethod(), m2.getMarkerAnnotation(), "Explicit order values %d and %d are inconsistent with type lattice ordering.", m1.getOrder(), m2.getOrder());
-                        return false;
-                    }
-                } else if (inferredOrder == 0) {
-                    SpecializationData m = (m1.getOrder() == Specialization.DEFAULT_ORDER ? m1 : m2);
-                    log.error(m.getMethod(), m.getMarkerAnnotation(), "Cannot calculate a consistent order for this specialization. Define the order attribute to resolve this.");
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    private static int compareSpecialization(TypeSystemData typeSystem, SpecializationData m1, SpecializationData m2) {
-        int result = compareSpecializationWithoutOrder(typeSystem, m1, m2);
-        if (result == 0) {
-            if (m1.getOrder() != Specialization.DEFAULT_ORDER && m2.getOrder() != Specialization.DEFAULT_ORDER) {
-                return m1.getOrder() - m2.getOrder();
-            }
-        }
-        return result;
-    }
-
-    private static int compareSpecializationWithoutOrder(TypeSystemData typeSystem, SpecializationData m1, SpecializationData m2) {
-        if (m1.getSpecification() != m2.getSpecification()) {
-            throw new UnsupportedOperationException("Cannot compare two specializations with different specifications.");
-        }
-
-        int result = compareActualParameter(typeSystem, m1.getReturnType(), m2.getReturnType());
-
-        for (ParameterSpec spec : m1.getSpecification().getParameters()) {
-            ActualParameter p1 = m1.findParameter(spec);
-            ActualParameter p2 = m2.findParameter(spec);
-
-            if (p1 != null && p2 != null && !Utils.typeEquals(p1.getActualType(), p2.getActualType())) {
-                int typeResult = compareActualParameter(typeSystem, p1, p2);
-                if (result == 0) {
-                    result = typeResult;
-                } else if (Math.signum(result) != Math.signum(typeResult)) {
-                    // We cannot define an order.
-                    return 0;
-                }
-            }
-        }
-        return result;
-    }
-
-    private static int compareActualParameter(TypeSystemData typeSystem, ActualParameter p1, ActualParameter p2) {
-        int index1 = typeSystem.findType(p1.getActualType());
-        int index2 = typeSystem.findType(p2.getActualType());
-
-        assert index1 != index2;
-        assert !(index1 == -1 ^ index2 == -1);
-
-        return index1 - index2;
-    }
-
-    private boolean verifyNames(TypeElement element, AnnotationMirror mirror, List<String> names) {
-        boolean valid = true;
-
-        for (int i = 0; i < names.size(); i++) {
-            String name = names.get(i);
-            if (!JavaName.isValid(name)) {
-                log.error(element, mirror, "Name '%s' is not a valid java identifier.", name);
-                valid = false;
-            } else if (JavaName.isReserved(name)) {
-                log.error(element, mirror, "Name '%s' is a reserved java identifier.", name);
-                valid = false;
-            }
-            for (int j = i + 1; j < names.size(); j++) {
-                String otherName = names.get(j);
-                if (name.equalsIgnoreCase(otherName)) {
-                    log.error(element, mirror, "Name '%s' is not unique.", name);
-                    valid = false;
-                }
-            }
-        }
-        return valid;
-    }
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/ShortCircuitData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
-
-public class ShortCircuitData extends TemplateMethod {
-
-    private ShortCircuitData genericShortCircuitMethod;
-
-    private final String valueName;
-
-    public ShortCircuitData(TemplateMethod template, String valueName) {
-        super(template);
-        this.valueName = valueName;
-    }
-
-    public String getValueName() {
-        return valueName;
-    }
-
-    public void setGenericShortCircuitMethod(ShortCircuitData genericShortCircuitMethod) {
-        this.genericShortCircuitMethod = genericShortCircuitMethod;
-    }
-
-    public boolean isGeneric() {
-        return genericShortCircuitMethod == null;
-    }
-
-    public ShortCircuitData getGeneric() {
-        if (isGeneric()) {
-            return this;
-        } else {
-            return genericShortCircuitMethod;
-        }
-    }
-
-    public boolean isCompatibleTo(SpecializationData specialization) {
-        if (isGeneric() && specialization.isGeneric()) {
-            return true;
-        }
-
-        for (ActualParameter param : getParameters()) {
-            ParameterSpec paramSpec = param.getSpecification();
-            if (paramSpec.getKind() == Kind.EXECUTE) {
-                ActualParameter specializationParam = specialization.findParameter(paramSpec.getName());
-                if (!Utils.typeEquals(param.getActualType(), specializationParam.getActualType())) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/ShortCircuitParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.lang.annotation.*;
-import java.util.*;
-
-import javax.lang.model.element.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
-
-public class ShortCircuitParser extends OperationMethodParser<ShortCircuitData> {
-
-    private final Set<String> shortCircuitValues;
-
-    public ShortCircuitParser(ProcessorContext context, OperationData operation) {
-        super(context, operation);
-        shortCircuitValues = new HashSet<>(Arrays.asList(operation.getShortCircuitValues()));
-    }
-
-    @Override
-    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
-        String shortCircuitValue = Utils.getAnnotationValueString(mirror, "value");
-
-        if (!shortCircuitValues.contains(shortCircuitValue)) {
-            getContext().getLog().error(method, mirror, "Invalid short circuit value %s.", shortCircuitValue);
-            return null;
-        }
-
-        return createDefaultMethodSpec(shortCircuitValue);
-    }
-
-    @Override
-    protected ParameterSpec createReturnParameterSpec() {
-        return new ParameterSpec("has", getContext().getType(boolean.class), Kind.SHORT_CIRCUIT, false);
-    }
-
-    @Override
-    public ShortCircuitData create(TemplateMethod method) {
-        String shortCircuitValue = Utils.getAnnotationValueString(method.getMarkerAnnotation(), "value");
-        assert shortCircuitValue != null;
-        assert shortCircuitValues.contains(shortCircuitValue);
-        return new ShortCircuitData(method, shortCircuitValue);
-    }
-
-    @Override
-    public Class< ? extends Annotation> getAnnotationType() {
-        return ShortCircuit.class;
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.template.*;
-
-public class SpecializationData extends TemplateMethod {
-
-    private final int order;
-    private final boolean generic;
-    private final boolean uninitialized;
-    private final SpecializationThrowsData[] exceptions;
-    private SpecializationGuardData[] guards;
-    private ShortCircuitData[] shortCircuits;
-
-    private OperationData operation;
-
-    public SpecializationData(TemplateMethod template, int order, SpecializationThrowsData[] exceptions) {
-        super(template.getSpecification(), template.getMethod(), template.getMarkerAnnotation(), template.getReturnType(), template.getParameters());
-        this.order = order;
-        this.generic = false;
-        this.uninitialized = false;
-        this.exceptions = exceptions;
-
-        for (SpecializationThrowsData exception : exceptions) {
-            exception.setSpecialization(this);
-        }
-    }
-
-    public SpecializationData(TemplateMethod template, boolean generic, boolean uninitialized) {
-        super(template.getSpecification(), template.getMethod(), template.getMarkerAnnotation(), template.getReturnType(), template.getParameters());
-        this.order = Specialization.DEFAULT_ORDER;
-        this.generic = generic;
-        this.uninitialized = uninitialized;
-        this.exceptions = new SpecializationThrowsData[0];
-        this.guards = new SpecializationGuardData[0];
-    }
-
-    public void setOperation(OperationData operation) {
-        this.operation = operation;
-    }
-
-    void setGuards(SpecializationGuardData[] guards) {
-        this.guards = guards;
-    }
-
-    public OperationData getOperation() {
-        return operation;
-    }
-
-    public int getOrder() {
-        return order;
-    }
-
-    public boolean isGeneric() {
-        return generic;
-    }
-
-    public boolean isUninitialized() {
-        return uninitialized;
-    }
-
-    public SpecializationThrowsData[] getExceptions() {
-        return exceptions;
-    }
-
-    public SpecializationGuardData[] getGuards() {
-        return guards;
-    }
-
-    public void setShortCircuits(ShortCircuitData[] shortCircuits) {
-        this.shortCircuits = shortCircuits;
-    }
-
-    public ShortCircuitData[] getShortCircuits() {
-        return shortCircuits;
-    }
-
-    public SpecializationData findNextSpecialization() {
-        SpecializationData[] allMethods = operation.getAllMethods();
-        for (int i = 0; i < allMethods.length - 1; i++) {
-            if (allMethods[i] == this) {
-                return allMethods[i + 1];
-            }
-        }
-        throw new IllegalArgumentException();
-    }
-
-    public boolean hasDynamicGuards() {
-        for (SpecializationGuardData guard : getGuards()) {
-            if (guard.isOnExecution()) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public ActualParameter getPreviousParam(ActualParameter searchParam) {
-        ActualParameter prev = null;
-        for (ActualParameter param : getParameters()) {
-            if (param == searchParam) {
-                return prev;
-            }
-            prev = param;
-        }
-        return prev;
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationGuardData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import com.oracle.truffle.codegen.processor.typesystem.*;
-
-public class SpecializationGuardData {
-
-    private final String guardMethod;
-    private final boolean onSpecialization;
-    private final boolean onExecution;
-
-    private GuardData guardDeclaration;
-
-    public SpecializationGuardData(String guardMethod, boolean onSpecialization, boolean onExecution) {
-        this.guardMethod = guardMethod;
-        this.onSpecialization = onSpecialization;
-        this.onExecution = onExecution;
-    }
-
-    public String getGuardMethod() {
-        return guardMethod;
-    }
-
-    public boolean isOnExecution() {
-        return onExecution;
-    }
-
-    public boolean isOnSpecialization() {
-        return onSpecialization;
-    }
-
-    void setGuardDeclaration(GuardData compatibleGuard) {
-        this.guardDeclaration = compatibleGuard;
-    }
-
-    public GuardData getGuardDeclaration() {
-        return guardDeclaration;
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationListenerParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.lang.annotation.*;
-
-import javax.lang.model.element.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
-
-public class SpecializationListenerParser extends OperationMethodParser<TemplateMethod> {
-
-    private final MethodSpec specification;
-
-    public SpecializationListenerParser(ProcessorContext context, OperationData operation) {
-        super(context, operation);
-        this.specification = createDefaultMethodSpec(null);
-    }
-
-    @Override
-    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
-        return specification;
-    }
-
-    @Override
-    protected ParameterSpec createReturnParameterSpec() {
-        return new ParameterSpec("void", getContext().getType(void.class), Kind.ATTRIBUTE, false);
-    }
-
-    @Override
-    public TemplateMethod create(TemplateMethod method) {
-        return method;
-    }
-
-    @Override
-    public Class< ? extends Annotation> getAnnotationType() {
-        return SpecializationListener.class;
-    }
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import java.lang.annotation.*;
-import java.util.*;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.template.*;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-import com.oracle.truffle.codegen.processor.typesystem.*;
-
-
-public class SpecializationParser extends OperationMethodParser<SpecializationData> {
-
-    private final MethodSpec specification;
-
-    public SpecializationParser(ProcessorContext context, OperationData operation) {
-        super(context, operation);
-        this.specification = createDefaultMethodSpec(null);
-    }
-
-    @Override
-    public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
-        return specification;
-    }
-    public MethodSpec getSpecification() {
-        return specification;
-    }
-
-    @Override
-    public SpecializationData create(TemplateMethod method) {
-        return parseSpecialization(method);
-    }
-
-    @Override
-    public Class< ? extends Annotation> getAnnotationType() {
-        return Specialization.class;
-    }
-
-    private SpecializationData parseSpecialization(TemplateMethod template) {
-        int order = Utils.getAnnotationValueInt(template.getMarkerAnnotation(), "order");
-        if (order < 0 && order != Specialization.DEFAULT_ORDER) {
-            getContext().getLog().error(template.getMethod(), template.getMarkerAnnotation(), "Invalid order attribute %d. The value must be >= 0 or the default value.");
-            return null;
-        }
-
-        List<AnnotationMirror> exceptionDefs = Utils.collectAnnotations(getContext(), template.getMarkerAnnotation(), "exceptions", template.getMethod(), SpecializationThrows.class);
-        SpecializationThrowsData[] exceptionData = new SpecializationThrowsData[exceptionDefs.size()];
-        for (int i = 0; i < exceptionData.length; i++) {
-            AnnotationMirror mirror = exceptionDefs.get(i);
-            TypeMirror javaClass = Utils.getAnnotationValueType(mirror, "javaClass");
-            String transitionTo = Utils.getAnnotationValueString(mirror, "transitionTo");
-            exceptionData[i] = new SpecializationThrowsData(mirror, javaClass, transitionTo);
-
-            if (!Utils.canThrowType(template.getMethod().getThrownTypes(), javaClass)) {
-                getContext().getLog().error(template.getMethod(), "Method must specify a throws clause with the exception type '%s'.", Utils.getQualifiedName(javaClass));
-                return null;
-            }
-        }
-
-        Arrays.sort(exceptionData, new Comparator<SpecializationThrowsData>() {
-            @Override
-            public int compare(SpecializationThrowsData o1, SpecializationThrowsData o2) {
-                return Utils.compareByTypeHierarchy(o1.getJavaClass(), o2.getJavaClass());
-            }
-        });
-        SpecializationData specialization = new SpecializationData(template, order, exceptionData);
-
-        boolean valid = true;
-        List<AnnotationMirror> guardDefs = Utils.collectAnnotations(getContext(), template.getMarkerAnnotation(), "guards", template.getMethod(), SpecializationGuard.class);
-        SpecializationGuardData[] guardData = new SpecializationGuardData[guardDefs.size()];
-        for (int i = 0; i < guardData.length; i++) {
-            AnnotationMirror guardMirror = guardDefs.get(i);
-            String guardMethod = Utils.getAnnotationValueString(guardMirror, "methodName");
-            boolean onSpecialization = Utils.getAnnotationValueBoolean(guardMirror, "onSpecialization");
-            boolean onExecution = Utils.getAnnotationValueBoolean(guardMirror, "onExecution");
-
-            if (!onSpecialization && !onExecution) {
-                String message = "Either onSpecialization, onExecution or both must be enabled.";
-                getContext().getLog().error(template.getMethod(), guardMirror, message);
-                valid = false;
-                continue;
-            }
-
-            guardData[i] = new SpecializationGuardData(guardMethod, onSpecialization, onExecution);
-
-            GuardData compatibleGuard = matchSpecializationGuard(guardMirror, specialization, guardData[i]);
-            if (compatibleGuard != null) {
-                guardData[i].setGuardDeclaration(compatibleGuard);
-            } else {
-                valid = false;
-            }
-        }
-
-        if (!valid) {
-            return null;
-        }
-
-        specialization.setGuards(guardData);
-
-        return specialization;
-    }
-
-    private GuardData matchSpecializationGuard(AnnotationMirror mirror, SpecializationData specialization, SpecializationGuardData specializationGuard)  {
-        List<GuardData> foundGuards = getOperation().findGuards(specializationGuard.getGuardMethod());
-        GuardData compatibleGuard = null;
-        for (GuardData guardData : foundGuards) {
-            if (isGuardCompatible(specialization, guardData)) {
-                compatibleGuard = guardData;
-                break;
-            }
-        }
-
-        if (compatibleGuard == null) {
-            ParameterSpec returnTypeSpec = new ParameterSpec("returnValue", getContext().getType(boolean.class), Kind.ATTRIBUTE, false);
-            List<ParameterSpec> expectedParameterSpecs = new ArrayList<>();
-
-            for (ActualParameter param : filterGuardParameters(specialization)) {
-                ParameterSpec spec = param.getSpecification();
-                expectedParameterSpecs.add(new ParameterSpec(spec.getName(), param.getActualType(), Kind.ATTRIBUTE, false));
-            }
-            String expectedSignature = TemplateMethodParser.createExpectedSignature(specializationGuard.getGuardMethod(), returnTypeSpec, expectedParameterSpecs);
-            AnnotationValue value = Utils.getAnnotationValue(mirror, "methodName");
-            getContext().getLog().error(specialization.getMethod(), mirror, value, "No guard with signature '%s' found in type system.", expectedSignature);
-            return null;
-        }
-
-        return compatibleGuard;
-    }
-
-    private static boolean isGuardCompatible(SpecializationData specialization, GuardData guard) {
-        Iterator<ActualParameter> guardParameters = Arrays.asList(guard.getParameters()).iterator();
-        for (ActualParameter param : filterGuardParameters(specialization)) {
-            if (!guardParameters.hasNext()) {
-                return false;
-            }
-            ActualParameter guardParam = guardParameters.next();
-            if (!Utils.typeEquals(guardParam.getActualType(), param.getActualType())) {
-                return false;
-            }
-        }
-        if (guardParameters.hasNext()) {
-            return false;
-        }
-        return true;
-    }
-
-    private static List<ActualParameter> filterGuardParameters(SpecializationData specialization) {
-        List<ActualParameter> parameters = new ArrayList<>();
-        for (ActualParameter param : specialization.getParameters()) {
-            if (param.getSpecification().getKind() != Kind.EXECUTE
-                            && param.getSpecification().getKind() != Kind.SHORT_CIRCUIT) {
-                continue;
-            }
-            parameters.add(param);
-        }
-        return parameters;
-    }
-
-
-}
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/operation/SpecializationThrowsData.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.codegen.processor.operation;
-
-import javax.lang.model.element.*;
-import javax.lang.model.type.*;
-
-public class SpecializationThrowsData {
-
-    private final AnnotationMirror annotationMirror;
-    private final TypeMirror javaClass;
-    private final String transitionTo;
-    private SpecializationData specialization;
-
-    public SpecializationThrowsData(AnnotationMirror annotationMirror, TypeMirror javaClass, String transitionTo) {
-        this.annotationMirror = annotationMirror;
-        this.javaClass = javaClass;
-        this.transitionTo = transitionTo;
-    }
-
-
-    void setSpecialization(SpecializationData specialization) {
-        this.specialization = specialization;
-    }
-
-    public TypeMirror getJavaClass() {
-        return javaClass;
-    }
-
-    public SpecializationData getSpecialization() {
-        return specialization;
-    }
-
-    public AnnotationMirror getAnnotationMirror() {
-        return annotationMirror;
-    }
-
-    public String getTransitionToName() {
-        return transitionTo;
-    }
-
-    public SpecializationData getTransitionTo() {
-        for (SpecializationData s : specialization.getOperation().getAllMethods()) {
-            if (s.getMethodName().equals(transitionTo)) {
-                return s;
-            }
-        }
-        throw new IllegalArgumentException();
-    }
-}
-
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ActualParameter.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ActualParameter.java	Fri Feb 01 17:06:26 2013 +0100
@@ -45,6 +45,6 @@
     }
 
     public TypeData getActualTypeData(TypeSystemData typeSystem) {
-        return typeSystem.getTypes()[typeSystem.findType(actualType)];
+        return typeSystem.findTypeData(actualType);
     }
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ClassElementFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ClassElementFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -44,6 +44,11 @@
     @Override
     protected abstract CodeTypeElement create(M m);
 
+    @Override
+    public CodeTypeElement getElement() {
+        return (CodeTypeElement) super.getElement();
+    }
+
     protected CodeExecutableElement createConstructorUsingFields(Set<Modifier> modifiers, CodeTypeElement clazz) {
         CodeExecutableElement method = new CodeExecutableElement(modifiers, null, clazz.getSimpleName().toString());
         CodeTreeBuilder builder = method.createBuilder();
@@ -90,6 +95,26 @@
         }
     }
 
+    protected CodeExecutableElement createSuperConstructor(TypeElement type, ExecutableElement element) {
+        if (element.getModifiers().contains(Modifier.PRIVATE)) {
+            return null;
+        }
+
+        CodeExecutableElement executable = CodeExecutableElement.clone(getContext().getEnvironment(), element);
+        executable.setReturnType(null);
+        executable.setSimpleName(CodeNames.of(type.getSimpleName().toString()));
+        CodeTreeBuilder b = executable.createBuilder();
+        b.startStatement();
+        b.startSuperCall();
+        for (VariableElement v : element.getParameters()) {
+            b.string(v.getSimpleName().toString());
+        }
+        b.end();
+        b.end();
+
+        return executable;
+    }
+
     protected CodeTypeElement createClass(Template model, Set<Modifier> modifiers, String simpleName, TypeMirror superType, boolean enumType) {
         TypeElement templateType = model.getTemplateType();
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CodeElementFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CodeElementFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -41,12 +41,16 @@
     protected abstract CodeElement<?> create(M m);
 
     @SuppressWarnings("unused")
-    protected void createChildren(M m) { }
+    protected void createChildren(M m) {
+    }
 
     @SuppressWarnings("unchecked")
-    public final CodeElement<?> process(M m) {
+    public CodeElement<?> process(CodeElement parent, M m) {
         model = m;
         element = (CodeElement<? super Element>) create(model);
+        if (parent != null) {
+            parent.add(element);
+        }
         if (element != null) {
             createChildren(model);
         }
@@ -58,7 +62,7 @@
     }
 
     protected <MO, K extends Element> void add(CodeElementFactory<MO> factory, MO m) {
-        this.element.add(factory.process(m));
+        factory.process(this.element, m);
     }
 
     public ProcessorContext getContext() {
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CompilationUnitFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/CompilationUnitFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -37,6 +37,11 @@
     }
 
     @Override
+    public CodeCompilationUnit process(CodeElement parent, M m) {
+        return (CodeCompilationUnit) super.process(parent, m);
+    }
+
+    @Override
     protected abstract void createChildren(M m);
 
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/JavaName.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/JavaName.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,13 +25,12 @@
 import java.util.*;
 import java.util.regex.*;
 
-
 public final class JavaName {
 
     private static final String[] RESERVED_NAMES = new String[]{"abstract", "continue", "for", "new", "switch", "assert", "default", "goto", "package", "synchronized", "boolean", "do", "if",
-        "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", "instanceof", "return", "transient",
-        "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super",
-        "while"};
+                    "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", "instanceof", "return", "transient",
+                    "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super",
+                    "while"};
 
     private static final Set<String> RESERVED_NAMES_SET = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(RESERVED_NAMES)));
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/ParameterSpec.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,17 +22,16 @@
  */
 package com.oracle.truffle.codegen.processor.template;
 
+import java.util.*;
+
 import javax.lang.model.type.*;
 
 import com.oracle.truffle.codegen.processor.*;
+import com.oracle.truffle.codegen.processor.node.*;
 import com.oracle.truffle.codegen.processor.typesystem.*;
 
 public class ParameterSpec {
 
-    public enum Kind {
-        EXECUTE, SIGNATURE, SUPER_ATTRIBUTE, ATTRIBUTE, CONSTRUCTOR_FIELD, SHORT_CIRCUIT
-    }
-
     public enum Cardinality {
         ONE, MULTIPLE;
     }
@@ -40,35 +39,48 @@
     private final String name;
     private final TypeMirror[] allowedTypes;
     private final TypeMirror valueType;
-    private final Kind kind;
     private final boolean optional;
     private final Cardinality cardinality;
 
-    public ParameterSpec(String name, TypeMirror[] allowedTypes, TypeMirror valueType, Kind kind, boolean optional, Cardinality cardinality) {
+    public ParameterSpec(String name, TypeMirror[] allowedTypes, TypeMirror valueType, boolean optional, Cardinality cardinality) {
         this.valueType = valueType;
         this.allowedTypes = allowedTypes;
         this.name = name;
-        this.kind = kind;
         this.optional = optional;
         this.cardinality = cardinality;
     }
 
-    public ParameterSpec(String name, TypeMirror singleFixedType, Kind kind, boolean optional) {
-        this(name, new TypeMirror[]{singleFixedType}, singleFixedType, kind, optional, Cardinality.ONE);
+    /** Type constructor. */
+    public ParameterSpec(String name, TypeMirror singleFixedType, boolean optional) {
+        this(name, new TypeMirror[]{singleFixedType}, singleFixedType, optional, Cardinality.ONE);
+    }
+
+    /** Type system value constructor. */
+    public ParameterSpec(String name, TypeSystemData typeSystem, boolean optional, Cardinality cardinality) {
+        this(name, typeSystem.getPrimitiveTypeMirrors(), typeSystem.getGenericType(), optional, cardinality);
     }
 
-    public ParameterSpec(String name, TypeSystemData typeSystem, Kind kind, boolean optional, Cardinality cardinality) {
-        this(name, typeSystem.getPrimitiveTypeMirrors(), typeSystem.getGenericType(), kind, optional, cardinality);
+    /** Node value constructor. */
+    public ParameterSpec(String name, NodeData nodeData, boolean optional, Cardinality cardinality) {
+        this(name, nodeTypeMirrors(nodeData), nodeData.getTypeSystem().getGenericType(), optional, cardinality);
+    }
+
+    private static TypeMirror[] nodeTypeMirrors(NodeData nodeData) {
+        List<TypeMirror> typeMirrors = new ArrayList<>();
+
+        for (ExecutableTypeData typeData : nodeData.getExecutableTypes()) {
+            typeMirrors.add(typeData.getType().getPrimitiveType());
+        }
+
+        typeMirrors.add(nodeData.getTypeSystem().getGenericType());
+
+        return typeMirrors.toArray(new TypeMirror[typeMirrors.size()]);
     }
 
     public final String getName() {
         return name;
     }
 
-    public Kind getKind() {
-        return kind;
-    }
-
     public final boolean isOptional() {
         return optional;
     }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/Template.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/Template.java	Fri Feb 01 17:06:26 2013 +0100
@@ -49,11 +49,11 @@
         return annotation;
     }
 
-    public List< ? extends WritableElement> getExtensionElements() {
+    public List<? extends WritableElement> getExtensionElements() {
         return extensionElements;
     }
 
-    public void setExtensionElements(List< ? extends WritableElement> extensionMethods) {
+    public void setExtensionElements(List<? extends WritableElement> extensionMethods) {
         this.extensionElements = extensionMethods;
     }
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethod.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethod.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,13 +26,15 @@
 
 public class TemplateMethod {
 
+    private final Template template;
     private final MethodSpec specification;
     private final ExecutableElement method;
     private final AnnotationMirror markerAnnotation;
     private final ActualParameter returnType;
     private final ActualParameter[] parameters;
 
-    public TemplateMethod(MethodSpec specification, ExecutableElement method, AnnotationMirror markerAnnotation, ActualParameter returnType, ActualParameter[] parameters) {
+    public TemplateMethod(Template template, MethodSpec specification, ExecutableElement method, AnnotationMirror markerAnnotation, ActualParameter returnType, ActualParameter[] parameters) {
+        this.template = template;
         this.specification = specification;
         this.method = method;
         this.markerAnnotation = markerAnnotation;
@@ -41,6 +43,7 @@
     }
 
     public TemplateMethod(TemplateMethod method) {
+        this.template = method.template;
         this.specification = method.specification;
         this.method = method.method;
         this.markerAnnotation = method.markerAnnotation;
@@ -48,6 +51,9 @@
         this.parameters = method.parameters;
     }
 
+    public Template getTemplate() {
+        return template;
+    }
 
     public MethodSpec getSpecification() {
         return specification;
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateMethodParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,18 +29,41 @@
 
 import javax.lang.model.element.*;
 import javax.lang.model.type.*;
+import javax.lang.model.util.*;
 
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
 
-public abstract class TemplateMethodParser<E extends TemplateMethod> {
+public abstract class TemplateMethodParser<T extends Template, E extends TemplateMethod> {
 
     private final ProcessorContext context;
 
-    public TemplateMethodParser(ProcessorContext context) {
+    protected final T template;
+
+    private boolean emitErrors = true;
+    private boolean parseNullOnError = true;
+
+    public TemplateMethodParser(ProcessorContext context, T template) {
+        this.template = template;
         this.context = context;
     }
 
+    public boolean isEmitErrors() {
+        return emitErrors;
+    }
+
+    public void setParseNullOnError(boolean nullOnError) {
+        this.parseNullOnError = nullOnError;
+    }
+
+    public boolean isParseNullOnError() {
+        return parseNullOnError;
+    }
+
+    public void setEmitErrors(boolean emitErrors) {
+        this.emitErrors = emitErrors;
+    }
+
     public ProcessorContext getContext() {
         return context;
     }
@@ -49,9 +72,49 @@
 
     public abstract E create(TemplateMethod method);
 
-    public abstract Class<? extends Annotation> getAnnotationType();
+    public abstract boolean isParsable(ExecutableElement method);
+
+    public Class<? extends Annotation> getAnnotationType() {
+        return null;
+    }
+
+    public final List<E> parse(List<? extends Element> elements) {
+        List<ExecutableElement> methods = new ArrayList<>();
+        methods.addAll(ElementFilter.methodsIn(elements));
+
+        List<E> parsedMethods = new ArrayList<>();
+        boolean valid = true;
+        for (ExecutableElement method : methods) {
+            if (!isParsable(method)) {
+                continue;
+            }
 
-    public final E parse(ExecutableElement method, AnnotationMirror annotation, Template template) {
+            Class<? extends Annotation> annotationType = getAnnotationType();
+            AnnotationMirror mirror = null;
+            if (annotationType != null) {
+                mirror = Utils.findAnnotationMirror(getContext().getEnvironment(), method, annotationType);
+            }
+
+            if (method.getModifiers().contains(Modifier.PRIVATE)) {
+                getContext().getLog().error(method, "Method must not be private.");
+                valid = false;
+                continue;
+            }
+
+            E parsedMethod = parse(method, mirror);
+            if (parsedMethod != null) {
+                parsedMethods.add(parsedMethod);
+            } else {
+                valid = false;
+            }
+        }
+        if (!valid && parseNullOnError) {
+            return null;
+        }
+        return parsedMethods;
+    }
+
+    private E parse(ExecutableElement method, AnnotationMirror annotation) {
         MethodSpec methodSpecification = createSpecification(method, annotation);
         if (methodSpecification == null) {
             return null;
@@ -63,18 +126,20 @@
 
         ActualParameter returnTypeMirror = resolveTypeMirror(returnTypeSpec, method.getReturnType(), template);
         if (returnTypeMirror == null) {
-            String expectedReturnType = createTypeSignature(returnTypeSpec, true);
-            String actualReturnType = Utils.getSimpleName(method.getReturnType());
+            if (isEmitErrors()) {
+                String expectedReturnType = createTypeSignature(returnTypeSpec, true);
+                String actualReturnType = Utils.getSimpleName(method.getReturnType());
 
-            String message = String.format("The provided return type \"%s\" does not match expected return type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
-                            createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                String message = String.format("The provided return type \"%s\" does not match expected return type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
+                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
 
-            context.getLog().error(method, annotation, message);
+                context.getLog().error(method, annotation, message);
+            }
             return null;
         }
 
-        Iterator< ? extends VariableElement> variableIterator = method.getParameters().iterator();
-        Iterator< ? extends ParameterSpec> specificationIterator = parameterSpecs.iterator();
+        Iterator<? extends VariableElement> variableIterator = method.getParameters().iterator();
+        Iterator<? extends ParameterSpec> specificationIterator = parameterSpecs.iterator();
 
         List<ActualParameter> resolvedMirrors = new ArrayList<>();
         VariableElement parameter = null;
@@ -93,13 +158,15 @@
                     specification = null;
                     continue;
                 } else if (!specification.isOptional()) {
-                    // non option type specification found -> argument missing
-                    String expectedType = createTypeSignature(specification, false);
+                    if (isEmitErrors()) {
+                        // non option type specification found -> argument missing
+                        String expectedType = createTypeSignature(specification, false);
 
-                    String message = String.format("Missing argument \"%s\".\nExpected signature: \n %s", expectedType,
-                                    createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                        String message = String.format("Missing argument \"%s\".\nExpected signature: \n %s", expectedType,
+                                        createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
 
-                    context.getLog().error(method, message);
+                        context.getLog().error(method, message);
+                    }
                     return null;
                 } else {
                     // specification is optional -> continue
@@ -116,13 +183,15 @@
                     continue;
                 }
 
-                String expectedReturnType = createTypeSignature(specification, false);
-                String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
+                if (isEmitErrors()) {
+                    String expectedReturnType = createTypeSignature(specification, false);
+                    String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
 
-                String message = String.format("The provided argument type \"%s\" does not match expected type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
-                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+                    String message = String.format("The provided argument type \"%s\" does not match expected type \"%s\".\nExpected signature: \n %s", actualReturnType, expectedReturnType,
+                                    createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
 
-                context.getLog().error(parameter, message);
+                    context.getLog().error(parameter, message);
+                }
                 return null;
             }
 
@@ -136,16 +205,18 @@
 
         if (variableIterator.hasNext()) {
             parameter = variableIterator.next();
-            String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
-            String message = String.format("No argument expected but found \"%s\".\nExpected signature: \n %s", actualReturnType,
-                            createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
+            if (isEmitErrors()) {
+                String actualReturnType = Utils.getSimpleName(parameter.asType()) + " " + parameter.getSimpleName();
+                String message = String.format("No argument expected but found \"%s\".\nExpected signature: \n %s", actualReturnType,
+                                createExpectedSignature(method.getSimpleName().toString(), returnTypeSpec, parameterSpecs));
 
-            context.getLog().error(parameter, message);
+                context.getLog().error(parameter, message);
+            }
             return null;
         }
 
         ActualParameter[] paramMirrors = resolvedMirrors.toArray(new ActualParameter[resolvedMirrors.size()]);
-        return create(new TemplateMethod(methodSpecification, method, annotation, returnTypeMirror, paramMirrors));
+        return create(new TemplateMethod(template, methodSpecification, method, annotation, returnTypeMirror, paramMirrors));
     }
 
     private ActualParameter resolveTypeMirror(ParameterSpec specification, TypeMirror mirror, Template typeSystem) {
@@ -160,7 +231,7 @@
         return new ActualParameter(specification, resolvedType);
     }
 
-    public static String createExpectedSignature(String methodName, ParameterSpec returnType, List< ? extends ParameterSpec> parameters) {
+    public static String createExpectedSignature(String methodName, ParameterSpec returnType, List<? extends ParameterSpec> parameters) {
         StringBuilder b = new StringBuilder();
 
         b.append("    ");
@@ -199,7 +270,7 @@
 
         TypeMirror[] types = null;
 
-        //TODO allowed types may differ so different <Any> must be generated.
+        // TODO allowed types may differ so different <Any> must be generated.
         if (returnType.getAllowedTypes().length > 1) {
             types = returnType.getAllowedTypes();
         }
@@ -237,5 +308,4 @@
         return builder.toString();
     }
 
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/TemplateParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,6 @@
 import javax.lang.model.util.*;
 
 import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.api.element.*;
 import com.oracle.truffle.codegen.processor.ext.*;
 
 public abstract class TemplateParser<M extends Template> extends AbstractParser<M> {
@@ -44,7 +43,7 @@
         return extensionParser;
     }
 
-    protected boolean verifyExclusiveMethodAnnotation(TypeElement type, Class<?> ... annotationTypes) {
+    protected boolean verifyExclusiveMethodAnnotation(TypeElement type, Class<?>... annotationTypes) {
         boolean valid = true;
         List<ExecutableElement> methods = ElementFilter.methodsIn(type.getEnclosedElements());
         for (ExecutableElement method : methods) {
@@ -92,42 +91,4 @@
         return valid;
     }
 
-    protected <E extends TemplateMethod> List<E> parseMethods(Template template, TemplateMethodParser<E> parser) {
-        TypeElement type = template.getTemplateType();
-
-        List<ExecutableElement> methods = new ArrayList<>();
-        methods.addAll(ElementFilter.methodsIn(type.getEnclosedElements()));
-        if (template.getExtensionElements() != null) {
-            for (WritableElement e : template.getExtensionElements()) {
-                if (e instanceof ExecutableElement) {
-                    methods.add((ExecutableElement) e);
-                }
-            }
-        }
-
-        List<E> parsedMethods = new ArrayList<>();
-        boolean valid = true;
-        for (ExecutableElement method : methods) {
-            AnnotationMirror mirror = Utils.findAnnotationMirror(processingEnv, method, parser.getAnnotationType());
-            if (mirror != null) {
-                if (method.getModifiers().contains(Modifier.PRIVATE)) {
-                    log.error(method, "Methods annotated with @%s must not be private.",  parser.getAnnotationType().getSimpleName());
-                    valid = false;
-                    continue;
-                }
-                E parsedMethod = parser.parse(method, mirror, template);
-                if (parsedMethod != null) {
-                    parsedMethods.add(parsedMethod);
-                } else {
-                    valid = false;
-                }
-            }
-        }
-        if (!valid) {
-            return null;
-        }
-        return parsedMethods;
-    }
-
-
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,7 +24,6 @@
 
 import com.oracle.truffle.codegen.processor.template.*;
 
-
 public class GuardData extends TemplateMethod {
 
     private final Template origin;
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/GuardParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,34 +31,37 @@
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.template.*;
 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
 
-
-public class GuardParser extends TypeSystemMethodParser<GuardData> {
+public class GuardParser extends TemplateMethodParser<Template, GuardData> {
 
-    private final Template origin;
+    private final TypeSystemData typeSystem;
 
-    public GuardParser(ProcessorContext context, TypeSystemData typeSystem, Template origin) {
-        super(context, typeSystem);
-        this.origin = origin;
+    public GuardParser(ProcessorContext context, Template template, TypeSystemData typeSystem) {
+        super(context, template);
+        this.typeSystem = typeSystem;
     }
 
     @Override
     public MethodSpec createSpecification(ExecutableElement method, AnnotationMirror mirror) {
         List<ParameterSpec> specs = new ArrayList<>();
-        specs.add(new ParameterSpec("value1", getTypeSystem(), Kind.EXECUTE, false, Cardinality.ONE));
-        specs.add(new ParameterSpec("valueN", getTypeSystem(), Kind.EXECUTE, false, Cardinality.MULTIPLE));
-        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", getContext().getType(boolean.class), Kind.ATTRIBUTE, false);
+        specs.add(new ParameterSpec("value1", typeSystem, false, Cardinality.ONE));
+        specs.add(new ParameterSpec("valueN", typeSystem, false, Cardinality.MULTIPLE));
+        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", getContext().getType(boolean.class), false);
         return new MethodSpec(returnTypeSpec, specs);
     }
 
     @Override
+    public boolean isParsable(ExecutableElement method) {
+        return Utils.findAnnotationMirror(getContext().getEnvironment(), method, getAnnotationType()) != null;
+    }
+
+    @Override
     public GuardData create(TemplateMethod method) {
-        return new GuardData(method, origin);
+        return new GuardData(method, template);
     }
 
     @Override
-    public Class< ? extends Annotation> getAnnotationType() {
+    public Class<? extends Annotation> getAnnotationType() {
         return GuardCheck.class;
     }
 
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCastParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCastParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,8 +31,6 @@
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.template.*;
 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
-
 
 class TypeCastParser extends TypeSystemMethodParser<TypeCastData> {
 
@@ -47,8 +45,8 @@
             return null;
         }
         List<ParameterSpec> specs = new ArrayList<>();
-        specs.add(new ParameterSpec("value", getTypeSystem(), Kind.EXECUTE, false, Cardinality.ONE));
-        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", targetType.getPrimitiveType(), Kind.ATTRIBUTE, false);
+        specs.add(new ParameterSpec("value", getTypeSystem(), false, Cardinality.ONE));
+        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", targetType.getPrimitiveType(), false);
         MethodSpec spec = new MethodSpec(returnTypeSpec, specs);
         return spec;
     }
@@ -61,7 +59,7 @@
     }
 
     @Override
-    public Class< ? extends Annotation> getAnnotationType() {
+    public Class<? extends Annotation> getAnnotationType() {
         return TypeCast.class;
     }
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCheckParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeCheckParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -31,7 +31,6 @@
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.template.*;
 import com.oracle.truffle.codegen.processor.template.ParameterSpec.Cardinality;
-import com.oracle.truffle.codegen.processor.template.ParameterSpec.Kind;
 
 class TypeCheckParser extends TypeSystemMethodParser<TypeCheckData> {
 
@@ -46,8 +45,8 @@
             return null;
         }
         List<ParameterSpec> specs = new ArrayList<>();
-        specs.add(new ParameterSpec("value", getTypeSystem(), Kind.EXECUTE, false, Cardinality.ONE));
-        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", getContext().getType(boolean.class), Kind.ATTRIBUTE, false);
+        specs.add(new ParameterSpec("value", getTypeSystem(), false, Cardinality.ONE));
+        ParameterSpec returnTypeSpec = new ParameterSpec("returnType", getContext().getType(boolean.class), false);
         MethodSpec spec = new MethodSpec(returnTypeSpec, specs);
         return spec;
     }
@@ -62,7 +61,7 @@
     }
 
     @Override
-    public Class< ? extends Annotation> getAnnotationType() {
+    public Class<? extends Annotation> getAnnotationType() {
         return TypeCheck.class;
     }
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -39,8 +39,7 @@
     private final List<TypeCastData> typeCasts = new ArrayList<>();
     private final List<TypeCheckData> typeChecks = new ArrayList<>();
 
-    public TypeData(TypeElement templateType, AnnotationMirror annotation,
-                    TypeMirror primitiveType, TypeMirror boxedType) {
+    public TypeData(TypeElement templateType, AnnotationMirror annotation, TypeMirror primitiveType, TypeMirror boxedType) {
         super(templateType, annotation);
         this.primitiveType = primitiveType;
         this.boxedType = boxedType;
@@ -84,5 +83,10 @@
         }
         return Utils.typeEquals(boxedType, getTypeSystem().getVoidType().getBoxedType());
     }
+
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + "[" + Utils.getSimpleName(primitiveType) + "]";
+    }
+
 }
-
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemCodeGenerator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemCodeGenerator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -53,8 +53,8 @@
     }
 
     /**
-     * Finds the generated singleton field for a TypeSytemData instance. TypeSystemCodeGenerator must be applied to the
-     * TypeSystemData model before use.
+     * Finds the generated singleton field for a TypeSytemData instance. TypeSystemCodeGenerator
+     * must be applied to the TypeSystemData model before use.
      */
     public static VariableElement findSingleton(ProcessorContext context, TypeSystemData typeSystem) {
         TypeMirror type = context.findGeneratedClassBySimpleName(TypeClassFactory.typeName(typeSystem), typeSystem);
@@ -125,7 +125,6 @@
             return new ArrayList<>(sourceTypes);
         }
 
-
         private CodeExecutableElement createConvertTo(TypeSystemData typeSystem, CodeVariableElement singleton) {
             CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(Object.class), "convertTo");
             method.addParameter(new CodeVariableElement(getContext().getType(Class.class), "targetType"));
@@ -198,8 +197,7 @@
                 return null;
             }
 
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(boolean.class),
-                            TypeSystemCodeGenerator.isTypeMethodName(type));
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), getContext().getType(boolean.class), TypeSystemCodeGenerator.isTypeMethodName(type));
             method.addParameter(new CodeVariableElement(getContext().getType(Object.class), LOCAL_VALUE));
 
             CodeTreeBuilder body = method.createBuilder();
@@ -213,8 +211,7 @@
                 return null;
             }
 
-            CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type.getPrimitiveType(),
-                            TypeSystemCodeGenerator.asTypeMethodName(type));
+            CodeExecutableElement method = new CodeExecutableElement(modifiers(PUBLIC), type.getPrimitiveType(), TypeSystemCodeGenerator.asTypeMethodName(type));
             method.addParameter(new CodeVariableElement(getContext().getType(Object.class), LOCAL_VALUE));
 
             CodeTreeBuilder body = method.createBuilder();
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemData.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,22 +36,15 @@
     private final TypeMirror[] primitiveTypeMirrors;
     private final TypeMirror[] boxedTypeMirrors;
 
-    private final TypeMirror nodeType;
     private final TypeMirror genericType;
 
     private final TypeData voidType;
 
-    private List<GuardData> guards;
-
-
-    public TypeSystemData(TypeElement templateType, AnnotationMirror annotation,
-                    TypeData[] types, TypeMirror nodeType, TypeMirror genericType, TypeData voidType) {
+    public TypeSystemData(TypeElement templateType, AnnotationMirror annotation, TypeData[] types, TypeMirror genericType, TypeData voidType) {
         super(templateType, annotation);
+        this.types = types;
+        this.genericType = genericType;
         this.voidType = voidType;
-        this.types = types;
-        this.nodeType = nodeType;
-        this.genericType = genericType;
-
         this.primitiveTypeMirrors = new TypeMirror[types.length];
         for (int i = 0; i < types.length; i++) {
             primitiveTypeMirrors[i] = types[i].getPrimitiveType();
@@ -65,23 +58,19 @@
         for (TypeData type : types) {
             type.typeSystem = this;
         }
-        if (voidType != null)  {
+        if (voidType != null) {
             voidType.typeSystem = this;
         }
     }
 
+    public boolean isGeneric(TypeMirror type) {
+        return Utils.typeEquals(getGenericType(), type);
+    }
+
     public TypeData getVoidType() {
         return voidType;
     }
 
-    void setGuards(List<GuardData> guards) {
-        this.guards = guards;
-    }
-
-    public List<GuardData> getGuards() {
-        return guards;
-    }
-
     public TypeData[] getTypes() {
         return types;
     }
@@ -94,10 +83,6 @@
         return boxedTypeMirrors;
     }
 
-    public TypeMirror getNodeType() {
-        return nodeType;
-    }
-
     public TypeMirror getGenericType() {
         return genericType;
     }
@@ -117,6 +102,18 @@
         return null;
     }
 
+    public TypeData findTypeData(TypeMirror type) {
+        if (Utils.typeEquals(voidType.getPrimitiveType(), type)) {
+            return voidType;
+        }
+
+        int index = findType(type);
+        if (index == -1) {
+            return null;
+        }
+        return types[index];
+    }
+
     public int findType(TypeMirror type) {
         for (int i = 0; i < types.length; i++) {
             if (Utils.typeEquals(types[i].getPrimitiveType(), type)) {
@@ -126,4 +123,9 @@
         return -1;
     }
 
+    @Override
+    public String toString() {
+        return getClass().getSimpleName() + "[template = " + Utils.getSimpleName(getTemplateType()) + ", types = " + Arrays.toString(types) + "]";
+    }
+
 }
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemMethodParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemMethodParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,30 +28,30 @@
 import com.oracle.truffle.codegen.processor.*;
 import com.oracle.truffle.codegen.processor.template.*;
 
-
-abstract class TypeSystemMethodParser<E extends TemplateMethod> extends TemplateMethodParser<E> {
-
-    private final TypeSystemData typeSystem;
+abstract class TypeSystemMethodParser<E extends TemplateMethod> extends TemplateMethodParser<TypeSystemData, E> {
 
     public TypeSystemMethodParser(ProcessorContext context, TypeSystemData typeSystem) {
-        super(context);
-        this.typeSystem = typeSystem;
+        super(context, typeSystem);
     }
 
     public TypeSystemData getTypeSystem() {
-        return typeSystem;
+        return template;
+    }
+
+    @Override
+    public final boolean isParsable(ExecutableElement method) {
+        return Utils.findAnnotationMirror(getContext().getEnvironment(), method, getAnnotationType()) != null;
     }
 
     protected TypeData findTypeByMethodName(ExecutableElement method, AnnotationMirror annotationMirror, String prefix) {
         String methodName = method.getSimpleName().toString();
         if (!methodName.startsWith(prefix)) {
             String annotationName = Utils.getSimpleName(annotationMirror.getAnnotationType());
-            getContext().getLog().error(method, "Methods annotated with %s must match the pattern '%s'.",
-                            annotationName, String.format("%s${typeName}", prefix));
+            getContext().getLog().error(method, "Methods annotated with %s must match the pattern '%s'.", annotationName, String.format("%s${typeName}", prefix));
             return null;
         }
         String typeName = methodName.substring(prefix.length(), methodName.length());
-        TypeData type = typeSystem.findType(typeName);
+        TypeData type = getTypeSystem().findType(typeName);
         if (type == null) {
             String annotationName = TypeSystem.class.getSimpleName();
             getContext().getLog().error(method, "Type '%s' is not declared in this @%s.", typeName, annotationName);
--- a/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemParser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/typesystem/TypeSystemParser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -33,17 +33,18 @@
 
 import com.oracle.truffle.api.codegen.*;
 import com.oracle.truffle.codegen.processor.*;
-import com.oracle.truffle.codegen.processor.operation.*;
 import com.oracle.truffle.codegen.processor.template.*;
 
 public class TypeSystemParser extends TemplateParser<TypeSystemData> {
 
+    public static final List<Class<TypeSystem>> ANNOTATIONS = Arrays.asList(TypeSystem.class);
+
     public TypeSystemParser(ProcessorContext c) {
         super(c);
     }
 
     @Override
-    public Class< ? extends Annotation> getAnnotationType() {
+    public Class<? extends Annotation> getAnnotationType() {
         return TypeSystem.class;
     }
 
@@ -61,31 +62,25 @@
             return null;
         }
 
-        TypeMirror nodeType = Utils.getAnnotationValueType(templateTypeAnnotation, "nodeBaseClass");
         TypeMirror genericType = context.getType(Object.class);
+        TypeData voidType = new TypeData(templateType, templateTypeAnnotation, context.getType(void.class), context.getType(Void.class));
 
-        TypeData voidType = null;
-        if (Utils.getAnnotationValueBoolean(templateTypeAnnotation, "hasVoid")) {
-            voidType = new TypeData(templateType, templateTypeAnnotation, context.getType(void.class), context.getType(Void.class));
-        }
+        TypeSystemData typeSystem = new TypeSystemData(templateType, templateTypeAnnotation, types, genericType, voidType);
 
-        TypeSystemData typeSystem = new TypeSystemData(templateType, templateTypeAnnotation, types, nodeType, genericType, voidType);
-
-        if (!verifyNodeBaseType(typeSystem)) {
+        if (!verifyExclusiveMethodAnnotation(templateType, TypeCast.class, TypeCheck.class)) {
             return null;
         }
 
-        if (!verifyExclusiveMethodAnnotation(templateType, TypeCast.class, TypeCheck.class, GuardCheck.class)) {
-            return null;
+        List<Element> elements = new ArrayList<>(context.getEnvironment().getElementUtils().getAllMembers(templateType));
+        typeSystem.setExtensionElements(getExtensionParser().parseAll(templateType, elements));
+        if (typeSystem.getExtensionElements() != null) {
+            elements.addAll(typeSystem.getExtensionElements());
         }
 
-        typeSystem.setExtensionElements(getExtensionParser().parseAll(templateType));
+        List<TypeCastData> casts = new TypeCastParser(context, typeSystem).parse(elements);
+        List<TypeCheckData> checks = new TypeCheckParser(context, typeSystem).parse(elements);
 
-        List<TypeCastData> casts = parseMethods(typeSystem, new TypeCastParser(context, typeSystem));
-        List<TypeCheckData> checks = parseMethods(typeSystem, new TypeCheckParser(context, typeSystem));
-        List<GuardData> guards = parseMethods(typeSystem, new GuardParser(context, typeSystem, typeSystem));
-
-        if (casts == null || checks == null || guards == null) {
+        if (casts == null || checks == null) {
             return null;
         }
 
@@ -97,8 +92,6 @@
             cast.getTargetType().addTypeCast(cast);
         }
 
-        typeSystem.setGuards(guards);
-
         if (!verifyGenericTypeChecksAndCasts(types)) {
             return null;
         }
@@ -126,11 +119,9 @@
                     }
                 }
                 if (!hasGeneric) {
-                    log.error(type.getTypeSystem().getTemplateType(),
-                                    "No generic but specific @%s method %s for type %s specified. " +
-                                    "Specify a generic @%s method with parameter type %s to resolve this.",
-                                    TypeCheck.class.getSimpleName(), TypeSystemCodeGenerator.isTypeMethodName(type), Utils.getSimpleName(type.getBoxedType()),
-                                    TypeCheck.class.getSimpleName(), Object.class.getSimpleName());
+                    log.error(type.getTypeSystem().getTemplateType(), "No generic but specific @%s method %s for type %s specified. "
+                                    + "Specify a generic @%s method with parameter type %s to resolve this.", TypeCheck.class.getSimpleName(), TypeSystemCodeGenerator.isTypeMethodName(type),
+                                    Utils.getSimpleName(type.getBoxedType()), TypeCheck.class.getSimpleName(), Object.class.getSimpleName());
                     valid = false;
                 }
             }
@@ -143,11 +134,9 @@
                     }
                 }
                 if (!hasGeneric) {
-                    log.error(type.getTypeSystem().getTemplateType(),
-                                    "No generic but specific @%s method %s for type %s specified. " +
-                                    "Specify a generic @%s method with parameter type %s to resolve this.",
-                                    TypeCast.class.getSimpleName(), TypeSystemCodeGenerator.asTypeMethodName(type), Utils.getSimpleName(type.getBoxedType()),
-                                    TypeCast.class.getSimpleName(), Object.class.getSimpleName());
+                    log.error(type.getTypeSystem().getTemplateType(), "No generic but specific @%s method %s for type %s specified. "
+                                    + "Specify a generic @%s method with parameter type %s to resolve this.", TypeCast.class.getSimpleName(), TypeSystemCodeGenerator.asTypeMethodName(type),
+                                    Utils.getSimpleName(type.getBoxedType()), TypeCast.class.getSimpleName(), Object.class.getSimpleName());
                     valid = false;
                 }
             }
@@ -155,51 +144,21 @@
         return valid;
     }
 
-    private boolean verifyNodeBaseType(TypeSystemData typeSystem) {
-        List<TypeData> types = new ArrayList<>(Arrays.asList(typeSystem.getTypes()));
-        if (typeSystem.getVoidType() != null) {
-            types.add(typeSystem.getVoidType());
-        }
-
-        TypeMirror[] args = new TypeMirror[]{context.getTruffleTypes().getFrame()};
-        List<String> missingMethods = new ArrayList<>();
-        for (TypeData typeData : types) {
-            String methodName = OperationCodeGenerator.executeMethodName(typeData);
-            ExecutableElement declared = Utils.getDeclaredMethodRecursive(Utils.fromTypeMirror(typeSystem.getNodeType()), methodName, args);
-            if (declared == null || declared.getModifiers().contains(Modifier.FINAL)) {
-                missingMethods.add(String.format("public %s %s(%s)",
-                                Utils.getSimpleName(typeData.getPrimitiveType()), methodName,
-                                Utils.getSimpleName(context.getTruffleTypes().getFrame())));
-            }
-        }
-
-        if (!missingMethods.isEmpty()) {
-            log.error(typeSystem.getTemplateType(), typeSystem.getTemplateTypeAnnotation(),
-                            Utils.getAnnotationValue(typeSystem.getTemplateTypeAnnotation(), "nodeBaseClass"),
-                            "The class '%s' does not declare the required non final method(s) %s.",
-                            Utils.getQualifiedName(typeSystem.getNodeType()), missingMethods);
-            return false;
-        }
-
-        return true;
-    }
-
     private TypeData[] parseTypes(TypeElement templateType, AnnotationMirror templateTypeAnnotation) {
-        List<TypeMirror> typeMirrors = Utils.getAnnotationValueList(templateTypeAnnotation, "types");
+        List<TypeMirror> typeMirrors = Utils.getAnnotationValueList(templateTypeAnnotation, "value");
         if (typeMirrors.size() == 0) {
-            log.error(templateType, templateTypeAnnotation, "At least one type child must be defined.");
+            log.error(templateType, templateTypeAnnotation, "At least one type must be defined.");
             return null;
         }
 
-        final AnnotationValue annotationValue = Utils.getAnnotationValue(templateTypeAnnotation, "types");
+        final AnnotationValue annotationValue = Utils.getAnnotationValue(templateTypeAnnotation, "value");
         final TypeMirror objectType = context.getType(Object.class);
 
         List<TypeData> types = new ArrayList<>();
         for (TypeMirror primitiveType : typeMirrors) {
 
             if (isPrimitiveWrapper(primitiveType)) {
-                log.error(templateType, templateTypeAnnotation, annotationValue,
-                                "Types must not contain primitive wrapper types.");
+                log.error(templateType, templateTypeAnnotation, annotationValue, "Types must not contain primitive wrapper types.");
                 continue;
             }
 
@@ -209,8 +168,7 @@
             }
 
             if (Utils.typeEquals(boxedType, objectType)) {
-                log.error(templateType, templateTypeAnnotation, annotationValue,
-                                "Types must not contain the generic type java.lang.Object.");
+                log.error(templateType, templateTypeAnnotation, annotationValue, "Types must not contain the generic type java.lang.Object.");
                 continue;
             }
 
@@ -231,8 +189,7 @@
             TypeData typeData = types.get(i);
             TypeMirror type = typeData.getBoxedType();
             if (invalidTypes.containsKey(Utils.getQualifiedName(type))) {
-                log.error(templateType, templateTypeAnnotation, annotationValue,
-                                "Invalid type order. The type(s) %s are inherited from a earlier defined type %s.",
+                log.error(templateType, templateTypeAnnotation, annotationValue, "Invalid type order. The type(s) %s are inherited from a earlier defined type %s.",
                                 invalidTypes.get(Utils.getQualifiedName(type)), Utils.getQualifiedName(type));
             }
             List<String> nextInvalidTypes = Utils.getQualifiedSuperTypeNames(Utils.fromTypeMirror(type));
@@ -262,7 +219,6 @@
         return false;
     }
 
-
     private boolean verifyMethodSignatures(Element element, TypeData[] types) {
         Set<String> generatedIsMethodNames = new HashSet<>();
         Set<String> generatedAsMethodNames = new HashSet<>();
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,7 @@
 import com.oracle.truffle.sl.*;
 
 public class AbstractTest {
+
     public static final int REPEATS = 10;
     private static final String NEWLINE = System.getProperty("line.separator");
 
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AddTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AddTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class AddTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ComparisonTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ComparisonTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class ComparisonTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/DivTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.test;
+
+import org.junit.*;
+
+// @formatter:off
+public class DivTest extends AbstractTest {
+
+    private static String[] INPUT = new String[] {
+"function main {  ",
+"  print 4 / 2;  ",
+"  print 4 / 4000000000000;  ",
+"  print 3000000000000 / 3;  ",
+"  print 3000000000000 / 3000000000000;  ",
+"}  ",
+    };
+
+    private static String[] OUTPUT = new String[] {
+"2",
+"0",
+"1000000000000",
+"1",
+    };
+
+    @Test
+    public void test() {
+        executeSL(INPUT, OUTPUT, true);
+    }
+}
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopPrintTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopPrintTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class LoopPrintTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class LoopTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/MulTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/MulTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class MulTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SubTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.test;
+
+import org.junit.*;
+
+// @formatter:off
+public class SubTest extends AbstractTest {
+
+    private static String[] INPUT = new String[] {
+"function main {  ",
+"  print 3 - 4;  ",
+"  print 3 - 4000000000000;  ",
+"  print 3000000000000 - 4;  ",
+"  print 3000000000000 - 4000000000000;  ",
+"}  ",
+    };
+
+    private static String[] OUTPUT = new String[] {
+"-1",
+"-3999999999997",
+"2999999999996",
+"-1000000000000",
+    };
+
+    @Test
+    public void test() {
+        executeSL(INPUT, OUTPUT, true);
+    }
+}
--- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SumTest.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SumTest.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,14 +24,15 @@
 
 import org.junit.*;
 
+// @formatter:off
 public class SumTest extends AbstractTest {
 
     private static String[] INPUT = new String[] {
 "function main {  ",
 "  i = 0;  ",
 "  sum = 0;  ",
-"  while (i < 1000) {  ",
-"    sum = sum + 100000000;  ",
+"  while (i < 100000) {  ",
+"    sum = sum + 1000000;  ",
 "    i = i + 1;  ",
 "  }  ",
 "  return sum;  ",
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/NodeFactory.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,7 @@
 
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.sl.nodes.*;
-import com.oracle.truffle.sl.ops.*;
-import com.oracle.truffle.sl.types.*;
+import com.oracle.truffle.sl.nodes.ArithmeticNodeFactory.*;
 
 public class NodeFactory {
 
@@ -49,7 +48,7 @@
     }
 
     public void startFunction() {
-        frameDescriptor = new FrameDescriptor(TypesGen.TYPES);
+        frameDescriptor = new FrameDescriptor(SLTypesGen.SLTYPES);
     }
 
     public void createFunction(StatementNode body, String name) {
@@ -57,19 +56,28 @@
     }
 
     public TypedNode createLocal(String name) {
-        return ReadLocalOpFactory.create(frameDescriptor.findOrAddFrameSlot(name));
+        return ReadLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name));
     }
 
     public TypedNode createStringLiteral(String value) {
-        return StringLiteralFactory.create(value);
+        return StringLiteralNodeFactory.create(value);
     }
 
     public StatementNode createAssignment(String name, TypedNode right) {
-        return WriteLocalOpFactory.create(right, frameDescriptor.findOrAddFrameSlot(name));
+        return WriteLocalNodeFactory.create(frameDescriptor.findOrAddFrameSlot(name), right);
     }
 
     public StatementNode createPrint(List<TypedNode> expressions) {
-        return new PrintNode(expressions, printOutput);
+        if (expressions.size() >= 1) {
+            StatementNode[] nodes = new StatementNode[expressions.size() + 1];
+            for (int i = 0; i < expressions.size(); i++) {
+                nodes[i] = PrintNodeFactory.create(expressions.get(i), printOutput);
+            }
+            nodes[expressions.size()] = new PrintLineNode(printOutput);
+            return new BlockNode(nodes);
+        } else {
+            return new BlockNode(new StatementNode[]{new PrintLineNode(printOutput)});
+        }
     }
 
     public StatementNode createWhile(ConditionNode condition, StatementNode body) {
@@ -83,13 +91,17 @@
     public TypedNode createBinary(String operation, TypedNode left, TypedNode right) {
         switch (operation) {
             case "+":
-                return AddOpFactory.create(left, right);
+                return AddNodeFactory.create(left, right);
             case "*":
-                return MulOpFactory.create(left, right);
+                return MulNodeFactory.create(left, right);
+            case "/":
+                return DivNodeFactory.create(left, right);
+            case "-":
+                return SubNodeFactory.create(left, right);
             case "<":
-                return LessThanOpFactory.create(left, right);
+                return LessThanNodeFactory.create(left, right);
             case "&&":
-                return LogicalAndOpFactory.create(left, right);
+                return LogicalAndNodeFactory.create(left, right);
             default:
                 throw new RuntimeException("unexpected operation: " + operation);
         }
@@ -97,22 +109,22 @@
 
     public TypedNode createNumericLiteral(String value) {
         try {
-            return IntegerLiteralFactory.create(Integer.parseInt(value));
+            return IntegerLiteralNodeFactory.create(Integer.parseInt(value));
         } catch (NumberFormatException ex) {
-            return BigIntegerLiteralFactory.create(new BigInteger(value));
+            return BigIntegerLiteralNodeFactory.create(new BigInteger(value));
         }
     }
 
     public TypedNode createTime() {
-        return TimeOpFactory.create();
+        return TimeNodeFactory.create();
     }
 
     public StatementNode createReturn(TypedNode value) {
         FrameSlot slot = frameDescriptor.findOrAddFrameSlot("<retval>");
         if (returnValue == null) {
-            returnValue = ReadLocalOpFactory.create(slot);
+            returnValue = ReadLocalNodeFactory.create(slot);
         }
-        StatementNode write = WriteLocalOpFactory.create(value, slot);
+        StatementNode write = WriteLocalNodeFactory.create(slot, value);
         return new ReturnNode(write);
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.nodes.*;
+
+@TypeSystemReference(SLTypes.class)
+public class SLNode extends Node {
+
+    @Override
+    public String toString() {
+        return NodeUtil.printTreeToString(this);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SLTypes.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+
+@TypeSystem({int.class, BigInteger.class, boolean.class, String.class})
+public class SLTypes {
+
+    @TypeCheck
+    public boolean isInteger(Object value) {
+        return value instanceof Integer || (value instanceof BigInteger && ((BigInteger) value).bitLength() < Integer.SIZE);
+    }
+
+    @TypeCast
+    public int asInteger(Object value) {
+        assert isInteger(value);
+        if (value instanceof Integer) {
+            return (int) value;
+        } else {
+            int result = ((BigInteger) value).intValue();
+            assert BigInteger.valueOf(result).equals(value) : "Loosing precision";
+            return result;
+        }
+    }
+
+    @TypeCheck
+    public boolean isBigInteger(Object value) {
+        return value instanceof Integer || value instanceof BigInteger;
+    }
+
+    @TypeCast
+    public BigInteger asBigInteger(Object value) {
+        if (value instanceof Integer) {
+            return BigInteger.valueOf((int) value);
+        } else {
+            return (BigInteger) value;
+        }
+    }
+
+    @TypeCast
+    public BigInteger asBigInteger(int value) {
+        return BigInteger.valueOf(value);
+    }
+
+    @TypeCheck
+    public boolean isBigInteger(@SuppressWarnings("unused") int value) {
+        return true;
+    }
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java	Fri Feb 01 17:06:26 2013 +0100
@@ -25,9 +25,9 @@
 import java.io.*;
 
 import com.oracle.truffle.api.*;
+import com.oracle.truffle.api.nodes.*;
 import com.oracle.truffle.sl.nodes.*;
 import com.oracle.truffle.sl.parser.*;
-import com.oracle.truffle.sl.tools.*;
 
 public class SimpleLanguage {
 
@@ -45,7 +45,7 @@
 
         FunctionDefinitionNode rootNode = factory.findFunction("main");
         if (log) {
-            GraphPrinter.print(rootNode);
+            NodeUtil.printTree(System.out, rootNode);
         }
 
         try {
@@ -67,7 +67,7 @@
 
         } finally {
             if (log) {
-                GraphPrinter.print(rootNode);
+                NodeUtil.printTree(System.out, rootNode);
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ArithmeticNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.intrinsics.*;
+
+public abstract class ArithmeticNode extends BinaryNode {
+
+    public ArithmeticNode(TypedNode left, TypedNode right) {
+        super(left, right);
+    }
+
+    protected ArithmeticNode(ArithmeticNode node) {
+        super(node);
+    }
+
+    @Generic
+    public Object doGeneric(Object left, Object right) {
+        throw new RuntimeException("Arithmetic not defined for types " + left.getClass().getSimpleName() + ", " + right.getClass().getSimpleName());
+    }
+
+    public abstract static class AddNode extends ArithmeticNode {
+
+        public AddNode(TypedNode left, TypedNode right) {
+            super(left, right);
+        }
+
+        protected AddNode(AddNode node) {
+            super(node);
+        }
+
+        @Specialization
+        @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
+        int doInteger(int left, int right) {
+            return ExactMath.addExact(left, right);
+        }
+
+        @Specialization
+        BigInteger doBigInteger(BigInteger left, BigInteger right) {
+            return left.add(right);
+        }
+
+        @Specialization
+        String doStringDirect(String left, String right) {
+            return left + right;
+        }
+
+        @Specialization
+        @SpecializationGuard(methodName = "isString")
+        String doString(Object left, Object right) {
+            return left.toString() + right.toString();
+        }
+    }
+
+    public abstract static class SubNode extends ArithmeticNode {
+
+        public SubNode(TypedNode left, TypedNode right) {
+            super(left, right);
+        }
+
+        protected SubNode(SubNode node) {
+            super(node);
+        }
+
+        @Specialization
+        @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
+        int doInteger(int left, int right) {
+            return ExactMath.subtractExact(left, right);
+        }
+
+        @Specialization
+        BigInteger doBigInteger(BigInteger left, BigInteger right) {
+            return left.subtract(right);
+        }
+    }
+
+    public abstract static class DivNode extends ArithmeticNode {
+
+        public DivNode(TypedNode left, TypedNode right) {
+            super(left, right);
+        }
+
+        protected DivNode(DivNode node) {
+            super(node);
+        }
+
+        @Specialization
+        @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
+        int doInteger(int left, int right) {
+            return left / right;
+        }
+
+        @Specialization
+        BigInteger doBigInteger(BigInteger left, BigInteger right) {
+            return left.divide(right);
+        }
+    }
+
+    public abstract static class MulNode extends ArithmeticNode {
+
+        public MulNode(TypedNode left, TypedNode right) {
+            super(left, right);
+        }
+
+        protected MulNode(MulNode node) {
+            super(node);
+        }
+
+        @Specialization
+        @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
+        int doInteger(int left, int right) {
+            return ExactMath.multiplyExact(left, right);
+        }
+
+        @Specialization
+        BigInteger doBigInteger(BigInteger left, BigInteger right) {
+            return left.multiply(right);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BigIntegerLiteralNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+
+public abstract class BigIntegerLiteralNode extends TypedNode {
+
+    private final BigInteger value;
+
+    public BigIntegerLiteralNode(BigInteger value) {
+        this.value = value;
+    }
+
+    @Specialization
+    public BigInteger doBigInteger() {
+        return value;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BinaryNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.codegen.*;
+
+@ExecuteChildren({"leftNode", "rightNode"})
+public abstract class BinaryNode extends TypedNode {
+
+    @Child protected TypedNode leftNode;
+
+    @Child protected TypedNode rightNode;
+
+    public BinaryNode(TypedNode left, TypedNode right) {
+        this.leftNode = adoptChild(left);
+        this.rightNode = adoptChild(right);
+    }
+
+    public BinaryNode(BinaryNode node) {
+        this(node.leftNode, node.rightNode);
+    }
+
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BlockNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/BlockNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,8 +26,7 @@
 
 public class BlockNode extends StatementNode {
 
-    @Children
-    private final StatementNode[] statements;
+    @Children private final StatementNode[] statements;
 
     public BlockNode(StatementNode[] statements) {
         this.statements = adoptChildren(statements);
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,4 +27,5 @@
 public abstract class ConditionNode extends StatementNode {
 
     public abstract boolean executeCondition(VirtualFrame frame);
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ConditionalNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+
+@SuppressWarnings("unused")
+@ExecuteChildren({"conditionNode", "ifPartNode", "elsePartNode"})
+public abstract class ConditionalNode extends TypedNode {
+
+    @Child protected ConditionNode conditionNode;
+
+    @Child protected TypedNode ifPartNode;
+
+    @Child protected TypedNode elsePartNode;
+
+    public ConditionalNode(ConditionNode condition, TypedNode ifPart, TypedNode elsePart) {
+        this.conditionNode = adoptChild(condition);
+        this.ifPartNode = adoptChild(ifPart);
+        this.elsePartNode = adoptChild(elsePart);
+    }
+
+    public ConditionalNode(ConditionalNode condition) {
+        this(condition.conditionNode, condition.ifPartNode, condition.elsePartNode);
+    }
+
+    @ShortCircuit("ifPartNode")
+    public boolean needsIfPart(boolean condition) {
+        return condition;
+    }
+
+    @ShortCircuit("ifPartNode")
+    public boolean needsIfPart(Object condition) {
+        throw new RuntimeException("operation not defined for type " + condition.getClass().getSimpleName());
+    }
+
+    @ShortCircuit("elsePartNode")
+    public boolean needsElsePart(Object condition, boolean hasIfPart, Object ifPart) {
+        return !hasIfPart;
+    }
+
+    @ShortCircuit("elsePartNode")
+    public boolean needsElsePart(boolean condition, boolean hasIfPart, int ifPart) {
+        return !hasIfPart;
+    }
+
+    @ShortCircuit("elsePartNode")
+    public boolean needsElsePart(boolean condition, boolean hasIfPart, BigInteger ifPart) {
+        return !hasIfPart;
+    }
+
+    @Specialization
+    public int doInteger(boolean condition, boolean hasIfPart, int ifPart, boolean hasElsePart, int elsePart) {
+        return hasIfPart ? ifPart : elsePart;
+    }
+
+    @Specialization
+    public BigInteger doBigInteger(boolean condition, boolean hasIfPart, BigInteger ifPart, boolean hasElsePart, BigInteger elsePart) {
+        return hasIfPart ? ifPart : elsePart;
+    }
+
+    @Generic
+    public Object doGeneric(boolean condition, boolean hasIfPart, Object ifPart, boolean hasElsePart, Object elsePart) {
+        return hasIfPart ? ifPart : elsePart;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FrameSlotNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.frame.*;
+
+public abstract class FrameSlotNode extends TypedNode implements FrameSlotTypeListener {
+
+    protected final FrameSlot slot;
+
+    public FrameSlotNode(FrameSlot slot) {
+        this.slot = slot;
+        slot.registerOneShotTypeListener(this);
+    }
+
+    @Override
+    public void typeChanged(FrameSlot changedSlot, Class<?> oldType) {
+        if (getParent() != null) {
+            replace(specialize(changedSlot.getType()));
+        }
+    }
+
+    protected abstract FrameSlotNode specialize(Class<?> clazz);
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FunctionDefinitionNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/FunctionDefinitionNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -24,16 +24,15 @@
 
 import com.oracle.truffle.api.frame.*;
 import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.sl.types.*;
 
 public class FunctionDefinitionNode extends RootNode {
 
+    @Child private StatementNode body;
+
+    @Child private TypedNode returnValue;
+
     private final FrameDescriptor frameDescriptor;
     private final String name;
-    @Child
-    private StatementNode body;
-    @Child
-    private TypedNode returnValue;
 
     public FunctionDefinitionNode(StatementNode body, FrameDescriptor frameDescriptor, String name, TypedNode returnValue) {
         this.body = adoptChild(body);
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IfNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -22,29 +22,35 @@
  */
 package com.oracle.truffle.sl.nodes;
 
+import com.oracle.truffle.api.codegen.*;
 import com.oracle.truffle.api.frame.*;
 
-public class IfNode extends StatementNode {
+@ExecuteChildren("conditionNode")
+public abstract class IfNode extends StatementNode {
 
-    @Child
-    private ConditionNode condition;
-    @Child
-    private StatementNode thenPart;
-    @Child
-    private StatementNode elsePart;
+    @Child protected ConditionNode conditionNode;
+
+    @Child private StatementNode thenPartNode;
+
+    @Child private StatementNode elsePartNode;
 
     public IfNode(ConditionNode condition, StatementNode thenPart, StatementNode elsePart) {
-        this.condition = adoptChild(condition);
-        this.thenPart = adoptChild(thenPart);
-        this.elsePart = adoptChild(elsePart);
+        this.conditionNode = adoptChild(condition);
+        this.thenPartNode = adoptChild(thenPart);
+        this.elsePartNode = adoptChild(elsePart);
+    }
+
+    protected IfNode(IfNode node) {
+        this(node.conditionNode, node.thenPartNode, node.elsePartNode);
     }
 
-    @Override
-    public void executeVoid(VirtualFrame frame) {
-        if (condition.executeCondition(frame)) {
-            thenPart.executeVoid(frame);
-        } else if (elsePart != null) {
-            elsePart.executeVoid(frame);
+    @Specialization
+    public void doVoid(VirtualFrame frame, boolean condition) {
+        if (condition) {
+            thenPartNode.executeVoid(frame);
+        } else {
+            elsePartNode.executeVoid(frame);
         }
     }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/IntegerLiteralNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.codegen.*;
+
+public abstract class IntegerLiteralNode extends TypedNode {
+
+    private final int value;
+
+    public IntegerLiteralNode(int value) {
+        this.value = value;
+    }
+
+    @Specialization
+    protected int doInteger() {
+        return this.value;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/LessThanNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+
+public abstract class LessThanNode extends BinaryNode {
+
+    public LessThanNode(TypedNode left, TypedNode right) {
+        super(left, right);
+    }
+
+    public LessThanNode(LessThanNode node) {
+        this(node.leftNode, node.rightNode);
+    }
+
+    @Specialization
+    public boolean doInteger(int left, int right) {
+        return left < right;
+    }
+
+    @Specialization
+    public boolean doBigInteger(BigInteger left, BigInteger right) {
+        return left.compareTo(right) < 0;
+    }
+
+    @Specialization
+    @SpecializationGuard(methodName = "isString")
+    public boolean doString(Object left, Object right) {
+        return left.toString().compareTo(right.toString()) < 0;
+    }
+
+    @Generic
+    public boolean doGeneric(Object left, Object right) {
+        throw new RuntimeException("comparison not defined for types " + left.getClass().getSimpleName() + ", " + right.getClass().getSimpleName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/LogicalAndNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.codegen.*;
+
+@SuppressWarnings("unused")
+public abstract class LogicalAndNode extends BinaryNode {
+
+    public LogicalAndNode(TypedNode leftNode, TypedNode rightNode) {
+        super(leftNode, rightNode);
+    }
+
+    public LogicalAndNode(LogicalAndNode node) {
+        this(node.leftNode, node.rightNode);
+    }
+
+    @ShortCircuit("rightNode")
+    public boolean needsRightNode(boolean left) {
+        return left;
+    }
+
+    @ShortCircuit("rightNode")
+    public boolean needsRightNode(Object left) {
+        return left instanceof Boolean && (Boolean) left;
+    }
+
+    @Specialization
+    public boolean doBoolean(boolean left, boolean hasRight, boolean right) {
+        return hasRight && right;
+    }
+
+    @Generic
+    public Object doGeneric(Object left, boolean hasRight, Object right) {
+        throw new RuntimeException("operation not defined for type " + left.getClass().getSimpleName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintLineNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.io.*;
+
+import com.oracle.truffle.api.frame.*;
+
+public class PrintLineNode extends StatementNode {
+
+    private final PrintStream output;
+
+    public PrintLineNode(PrintStream output) {
+        this.output = output;
+    }
+
+    @Override
+    public void executeVoid(VirtualFrame frame) {
+        output.println();
+    }
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/PrintNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,30 +23,41 @@
 package com.oracle.truffle.sl.nodes;
 
 import java.io.*;
-import java.util.*;
+
+import com.oracle.truffle.api.codegen.*;
 
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.sl.types.*;
+public abstract class PrintNode extends StatementNode {
 
-public class PrintNode extends StatementNode {
-
-    @Children
-    private final TypedNode[] expressions;
+    @Child protected TypedNode expression;
 
     private final PrintStream output;
 
-    public PrintNode(List<TypedNode> expressions, PrintStream output) {
-        this.expressions = adoptChildren(expressions.toArray(new TypedNode[expressions.size()]));
+    public PrintNode(TypedNode expression, PrintStream output) {
+        this.expression = adoptChild(expression);
         this.output = output;
     }
 
-    @ExplodeLoop
-    @Override
-    public void executeVoid(VirtualFrame frame) {
-        for (TypedNode expression : expressions) {
-            output.print(expression.executeGeneric(frame));
-        }
-        output.println();
+    public PrintNode(PrintNode node) {
+        this(node.expression, node.output);
+    }
+
+    @Specialization
+    public void doInt(int value) {
+        output.print(value);
+    }
+
+    @Specialization
+    public void doBoolean(boolean value) {
+        output.print(value);
+    }
+
+    @Specialization
+    public void doString(String value) {
+        output.print(value);
+    }
+
+    @Generic
+    public void doGeneric(Object value) {
+        output.print(value.toString());
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReadLocalNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.frame.*;
+
+public abstract class ReadLocalNode extends FrameSlotNode {
+
+    public ReadLocalNode(FrameSlot slot) {
+        super(slot);
+    }
+
+    public ReadLocalNode(ReadLocalNode specialized) {
+        this(specialized.slot);
+    }
+
+    @Specialization
+    public int doInteger(VirtualFrame frame) {
+        return frame.getInt(slot);
+    }
+
+    @Specialization
+    public BigInteger doBigInteger(VirtualFrame frame) {
+        return (BigInteger) frame.getObject(slot);
+    }
+
+    @Specialization
+    public boolean doBoolean(VirtualFrame frame) {
+        return frame.getBoolean(slot);
+    }
+
+    @Specialization
+    public String doString(VirtualFrame frame) {
+        return (String) frame.getObject(slot);
+    }
+
+    @Generic
+    public Object doGeneric(VirtualFrame frame) {
+        return frame.getObject(slot);
+    }
+
+    @Override
+    protected FrameSlotNode specialize(Class<?> clazz) {
+        return ReadLocalNodeFactory.createSpecialized(this, clazz);
+    }
+
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReturnNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/ReturnNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -28,8 +28,7 @@
 
     private static final ReturnException EXCEPTION = new ReturnException();
 
-    @Child
-    private StatementNode expr;
+    @Child private StatementNode expr;
 
     public ReturnNode(StatementNode expr) {
         this.expr = adoptChild(expr);
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/StatementNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/StatementNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -23,9 +23,10 @@
 package com.oracle.truffle.sl.nodes;
 
 import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.nodes.*;
+import com.oracle.truffle.sl.*;
 
-public abstract class StatementNode extends Node {
+public abstract class StatementNode extends SLNode {
 
     public abstract void executeVoid(VirtualFrame frame);
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/StringLiteralNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.codegen.*;
+
+public abstract class StringLiteralNode extends TypedNode {
+
+    private final String value;
+
+    public StringLiteralNode(String value) {
+        this.value = value;
+    }
+
+    @Specialization
+    protected String doString() {
+        return value;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/TimeNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import com.oracle.truffle.api.codegen.*;
+
+public abstract class TimeNode extends TypedNode {
+
+    public static final long START_TIME = System.currentTimeMillis();
+
+    @Specialization
+    public int doInt() {
+        return (int) (System.currentTimeMillis() - START_TIME);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/TypedNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.frame.*;
+import com.oracle.truffle.api.nodes.*;
+
+public abstract class TypedNode extends ConditionNode {
+
+    @Override
+    public final boolean executeCondition(VirtualFrame frame) {
+        try {
+            return executeBoolean(frame);
+        } catch (UnexpectedResultException ex) {
+            throw new RuntimeException("Illegal type for condition: " + ex.getResult().getClass().getSimpleName());
+        }
+    }
+
+    public abstract boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException;
+
+    public abstract int executeInteger(VirtualFrame frame) throws UnexpectedResultException;
+
+    public abstract BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException;
+
+    public abstract String executeString(VirtualFrame frame) throws UnexpectedResultException;
+
+    public abstract Object executeGeneric(VirtualFrame frame);
+
+    @GuardCheck
+    public boolean isString(Object a, Object b) {
+        return a instanceof String || b instanceof String;
+    }
+
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WhileNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WhileNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,9 @@
 
 public class WhileNode extends StatementNode {
 
-    @Child
-    private ConditionNode condition;
-    @Child
-    private StatementNode body;
+    @Child private ConditionNode condition;
+
+    @Child private StatementNode body;
 
     private final BreakException breakTarget;
     private final ContinueException continueTarget;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/WriteLocalNode.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012, 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.truffle.sl.nodes;
+
+import java.math.*;
+
+import com.oracle.truffle.api.codegen.*;
+import com.oracle.truffle.api.frame.*;
+
+public abstract class WriteLocalNode extends FrameSlotNode {
+
+    @Child protected TypedNode rightNode;
+
+    public WriteLocalNode(FrameSlot slot, TypedNode right) {
+        super(slot);
+        this.rightNode = adoptChild(right);
+    }
+
+    public WriteLocalNode(WriteLocalNode node) {
+        this(node.slot, node.rightNode);
+    }
+
+    @Specialization
+    public int doInteger(VirtualFrame frame, int right) {
+        frame.setInt(slot, right);
+        return right;
+    }
+
+    @Specialization
+    public BigInteger doBigInteger(VirtualFrame frame, BigInteger right) {
+        frame.setObject(slot, right);
+        return right;
+    }
+
+    @Specialization
+    public boolean doBoolean(VirtualFrame frame, boolean right) {
+        frame.setBoolean(slot, right);
+        return right;
+    }
+
+    @Specialization
+    public String doString(VirtualFrame frame, String right) {
+        frame.setObject(slot, right);
+        return right;
+    }
+
+    @Generic
+    public Object doGeneric(VirtualFrame frame, Object right) {
+        frame.setObject(slot, right);
+        return right;
+    }
+
+    @SpecializationListener
+    protected void onSpecialize(VirtualFrame frame, Object value) {
+        slot.setType(value.getClass());
+        frame.updateToLatestVersion();
+    }
+
+    @Override
+    protected FrameSlotNode specialize(Class<?> clazz) {
+        return WriteLocalNodeFactory.createSpecialized(this, clazz);
+    }
+
+}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/AddOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.api.intrinsics.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, values = {"left", "right"})
-public class AddOp {
-
-    @Specialization
-    @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
-    public int doInteger(int left, int right) {
-        return ExactMath.addExact(left, right);
-    }
-
-    @Specialization
-    public BigInteger doBigInteger(BigInteger left, BigInteger right) {
-        return left.add(right);
-    }
-
-    @Specialization
-    public String doStringDirect(String left, String right) {
-        return left + right;
-    }
-
-    @Specialization
-    @SpecializationGuard(methodName = "isString")
-    public String doString(Object left, Object right) {
-        return left.toString() + right.toString();
-    }
-
-    @Generic
-    public Object doGeneric(Object left, Object right) {
-        throw new RuntimeException("addition not defined for types " + left.getClass().getSimpleName() + ", " + right.getClass().getSimpleName());
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/BigIntegerLiteral.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class)
-public class BigIntegerLiteral {
-
-    private final BigInteger value;
-
-    public BigIntegerLiteral(BigInteger value) {
-        this.value = value;
-    }
-
-    @Specialization
-    public BigInteger doBigInteger() {
-        return value;
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/IfOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@SuppressWarnings("unused")
-@Operation(typeSystem = Types.class, values = {"condition"}, shortCircuitValues = {"ifPart", "elsePart"})
-public class IfOp {
-
-    @ShortCircuit("ifPart")
-    public boolean needsIfPart(boolean condition) {
-        return condition;
-    }
-
-    @ShortCircuit("ifPart")
-    public boolean needsIfPart(Object condition) {
-        if (TypesGen.TYPES.isBoolean(condition)) {
-            return TypesGen.TYPES.asBoolean(condition);
-        }
-        throw new RuntimeException("operation not defined for type " + condition.getClass().getSimpleName());
-    }
-
-    @ShortCircuit("elsePart")
-    public boolean needsElsePart(Object condition, boolean hasIfPart, Object ifPart) {
-        return !hasIfPart;
-    }
-
-    @ShortCircuit("elsePart")
-    public boolean needsElsePart(boolean condition, boolean hasIfPart, int ifPart) {
-        return !hasIfPart;
-    }
-
-    @ShortCircuit("elsePart")
-    public boolean needsElsePart(boolean condition, boolean hasIfPart, BigInteger ifPart) {
-        return !hasIfPart;
-    }
-
-    @Specialization
-    public int doInteger(boolean condition, boolean hasIfPart, int ifPart, boolean hasElsePart, int elsePart) {
-        return hasIfPart ? ifPart : elsePart;
-    }
-
-    @Specialization
-    public BigInteger doBigInteger(boolean condition, boolean hasIfPart, BigInteger ifPart, boolean hasElsePart, BigInteger elsePart) {
-        return hasIfPart ? ifPart : elsePart;
-    }
-
-    @Generic
-    public Object doGeneric(Object condition, boolean hasIfPart, Object ifPart, boolean hasElsePart, Object elsePart) {
-        return hasIfPart ? ifPart : elsePart;
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/IntegerLiteral.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class)
-public class IntegerLiteral {
-
-    private final int value;
-
-    public IntegerLiteral(int value) {
-        this.value = value;
-    }
-
-    @Specialization
-    protected int doInteger() {
-        return this.value;
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/LessThanOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, values = {"left", "right"})
-public class LessThanOp {
-
-    @Specialization
-    public boolean doInteger(int left, int right) {
-        return left < right;
-    }
-
-    @Specialization
-    public boolean doBigInteger(BigInteger left, BigInteger right) {
-        return left.compareTo(right) < 0;
-    }
-
-    @Specialization
-    @SpecializationGuard(methodName = "isString")
-    public boolean doString(Object left, Object right) {
-        return left.toString().compareTo(right.toString()) < 0;
-    }
-
-    @Generic
-    public boolean doGeneric(Object left, Object right) {
-        throw new RuntimeException("comparison not defined for types " + left.getClass().getSimpleName() + ", " + right.getClass().getSimpleName());
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/LogicalAndOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@SuppressWarnings("unused")
-@Operation(typeSystem = Types.class, values = {"left"}, shortCircuitValues = {"right"})
-public class LogicalAndOp {
-
-    @ShortCircuit(value = "right")
-    public boolean needsRight(boolean left) {
-        return left;
-    }
-
-    @ShortCircuit(value = "right")
-    public boolean needsRight(Object left) {
-        return TypesGen.TYPES.asBoolean(left);
-    }
-
-    @Specialization
-    public boolean doBoolean(boolean left, boolean hasRight, boolean right) {
-        return hasRight && right;
-    }
-
-    @Generic
-    public Object doGeneric(Object left, boolean hasRight, Object right) {
-        throw new RuntimeException("operation not defined for type " + left.getClass().getSimpleName());
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/MulOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.api.intrinsics.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, values = {"left", "right"})
-public class MulOp {
-
-    @Specialization
-    @SpecializationThrows(javaClass = ArithmeticException.class, transitionTo = "doBigInteger")
-    public int doInteger(int left, int right) {
-        return ExactMath.multiplyExact(left, right);
-    }
-
-    @Specialization
-    public BigInteger doBigInteger(BigInteger left, BigInteger right) {
-        return left.multiply(right);
-    }
-
-    @Generic
-    public Object doGeneric(Object left, Object right) {
-        throw new RuntimeException("multiplication not defined for types " + left.getClass().getSimpleName() + ", " + right.getClass().getSimpleName());
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/ReadLocalOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, baseClass = FrameSlotNode.class)
-public class ReadLocalOp {
-
-    @Specialization(order = 2)
-    public int doInteger(VirtualFrame frame, FrameSlot slot) {
-        return frame.getInt(slot);
-    }
-
-    @Specialization
-    public BigInteger doBigInteger(VirtualFrame frame, FrameSlot slot) {
-        return (BigInteger) frame.getObject(slot);
-    }
-
-    @Specialization
-    public boolean doBoolean(VirtualFrame frame, FrameSlot slot) {
-        return frame.getBoolean(slot);
-    }
-
-    @Specialization
-    public String doString(VirtualFrame frame, FrameSlot slot) {
-        return (String) frame.getObject(slot);
-    }
-
-    @Generic
-    public Object doGeneric(VirtualFrame frame, FrameSlot slot) {
-        return frame.getObject(slot);
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/StringLiteral.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class)
-public class StringLiteral {
-
-    private final String value;
-
-    public StringLiteral(String value) {
-        this.value = value;
-    }
-
-    @Specialization
-    protected String doString() {
-        return value;
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/TimeOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, baseClass = TypedNode.class)
-public class TimeOp {
-
-    public static final long START_TIME = System.currentTimeMillis();
-
-    @Specialization
-    public int doInt() {
-        return (int) (System.currentTimeMillis() - START_TIME);
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/ops/WriteLocalOp.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.ops;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.sl.types.*;
-
-@Operation(typeSystem = Types.class, baseClass = FrameSlotNode.class, values = "right")
-public class WriteLocalOp {
-
-    @Specialization
-    public int doInteger(VirtualFrame frame, int right, FrameSlot slot) {
-        frame.setInt(slot, right);
-        return right;
-    }
-
-    @Specialization
-    public BigInteger doBigInteger(VirtualFrame frame, BigInteger right, FrameSlot slot) {
-        frame.setObject(slot, right);
-        return right;
-    }
-
-    @Specialization
-    public boolean doBoolean(VirtualFrame frame, boolean right, FrameSlot slot) {
-        frame.setBoolean(slot, right);
-        return right;
-    }
-
-    @Specialization
-    public String doString(VirtualFrame frame, String right, FrameSlot slot) {
-        frame.setObject(slot, right);
-        return right;
-    }
-
-    @Generic
-    public Object doGeneric(VirtualFrame frame, Object right, FrameSlot slot) {
-        frame.setObject(slot, right);
-        return right;
-    }
-
-    @SpecializationListener
-    protected void onSpecialize(VirtualFrame frame, Object value, FrameSlot slot) {
-        slot.setType(value.getClass());
-        frame.updateToLatestVersion();
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.frame	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.frame	Fri Feb 01 17:06:26 2013 +0100
@@ -30,9 +30,9 @@
 
 import com.oracle.truffle.sl.*;
 import com.oracle.truffle.sl.nodes.*;
-import com.oracle.truffle.sl.types.*;
 
 // Checkstyle: stop
+// @formatter:off
 public class Parser {
 -->constants
     static final boolean T = true;
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Parser.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,16 +21,17 @@
  * questions.
  */
 
- // The content of this file is automatically generated. DO NOT EDIT.
+// The content of this file is automatically generated. DO NOT EDIT.
 
 package com.oracle.truffle.sl.parser;
+
 import java.util.*;
 
 import com.oracle.truffle.sl.*;
 import com.oracle.truffle.sl.nodes.*;
-import com.oracle.truffle.sl.types.*;
 
 // Checkstyle: stop
+// @formatter:off
 public class Parser {
 	public static final int _EOF = 0;
 	public static final int _identifier = 1;
@@ -49,7 +50,7 @@
     public final Scanner scanner;
     public final Errors errors;
     private final NodeFactory factory;
-	
+
     public Parser(Scanner scanner, NodeFactory factory) {
         this.scanner = scanner;
         this.factory = factory;
@@ -129,29 +130,29 @@
 
 	void Function() {
 		Expect(4);
-		factory.startFunction(); 
+		factory.startFunction();
 		Expect(1);
-		String name = t.val; 
+		String name = t.val;
 		StatementNode body = Block();
-		factory.createFunction(body, name); 
+		factory.createFunction(body, name);
 	}
 
 	StatementNode  Block() {
 		StatementNode  result;
-		List<StatementNode> statements = new ArrayList<>(); 
+		List<StatementNode> statements = new ArrayList<>();
 		Expect(5);
 		while (StartOf(1)) {
 			StatementNode statement = Statement();
-			statements.add(statement); 
+			statements.add(statement);
 		}
 		Expect(6);
-		result = factory.createBlock(statements); 
+		result = factory.createBlock(statements);
 		return result;
 	}
 
 	StatementNode  Statement() {
 		StatementNode  result;
-		result = null; 
+		result = null;
 		if (la.kind == 7) {
 			result = WhileStatement();
 		} else if (la.kind == 1) {
@@ -171,31 +172,31 @@
 		ConditionNode condition = Expression();
 		Expect(9);
 		StatementNode body = Block();
-		result = factory.createWhile(condition, body); 
+		result = factory.createWhile(condition, body);
 		return result;
 	}
 
 	StatementNode  AssignmentStatement() {
 		StatementNode  result;
 		Expect(1);
-		String name = t.val; 
+		String name = t.val;
 		Expect(10);
 		TypedNode rvalue = Expression();
 		Expect(11);
-		result = factory.createAssignment(name, rvalue); 
+		result = factory.createAssignment(name, rvalue);
 		return result;
 	}
 
 	StatementNode  OutputStatement() {
 		StatementNode  result;
-		List<TypedNode> expressions = new ArrayList<>(); 
+		List<TypedNode> expressions = new ArrayList<>();
 		Expect(12);
 		while (StartOf(2)) {
 			TypedNode value = Expression();
-			expressions.add(value); 
+			expressions.add(value);
 		}
 		Expect(11);
-		result = factory.createPrint(expressions); 
+		result = factory.createPrint(expressions);
 		return result;
 	}
 
@@ -204,7 +205,7 @@
 		Expect(13);
 		TypedNode value = Expression();
 		Expect(11);
-		result = factory.createReturn(value); 
+		result = factory.createReturn(value);
 		return result;
 	}
 
@@ -238,9 +239,9 @@
 				break;
 			}
 			}
-			String op = t.val; 
+			String op = t.val;
 			TypedNode right = ValueExpression();
-			result = factory.createBinary(op, result, right); 
+			result = factory.createBinary(op, result, right);
 		}
 		return result;
 	}
@@ -254,9 +255,9 @@
 			} else {
 				Get();
 			}
-			String op = t.val; 
+			String op = t.val;
 			TypedNode right = Term();
-			result = factory.createBinary(op, result, right); 
+			result = factory.createBinary(op, result, right);
 		}
 		return result;
 	}
@@ -270,16 +271,16 @@
 			} else {
 				Get();
 			}
-			String op = t.val; 
+			String op = t.val;
 			TypedNode right = Factor();
-			result = factory.createBinary(op, result, right); 
+			result = factory.createBinary(op, result, right);
 		}
 		return result;
 	}
 
 	TypedNode  Factor() {
 		TypedNode  result;
-		result = null; 
+		result = null;
 		if (la.kind == 24) {
 			result = TimeRef();
 		} else if (la.kind == 1) {
@@ -299,28 +300,28 @@
 	TypedNode  TimeRef() {
 		TypedNode  result;
 		Expect(24);
-		result = factory.createTime(); 
+		result = factory.createTime();
 		return result;
 	}
 
 	TypedNode  VariableRef() {
 		TypedNode  result;
 		Expect(1);
-		result = factory.createLocal(t.val); 
+		result = factory.createLocal(t.val);
 		return result;
 	}
 
 	TypedNode  StringLiteral() {
 		TypedNode  result;
 		Expect(2);
-		result = factory.createStringLiteral(t.val.substring(1, t.val.length() - 1)); 
+		result = factory.createStringLiteral(t.val.substring(1, t.val.length() - 1));
 		return result;
 	}
 
 	TypedNode  NumericLiteral() {
 		TypedNode  result;
 		Expect(3);
-		result = factory.createNumericLiteral(t.val); 
+		result = factory.createNumericLiteral(t.val);
 		return result;
 	}
 
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.frame	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.frame	Fri Feb 01 17:06:26 2013 +0100
@@ -33,6 +33,7 @@
 import java.util.HashMap;
 
 // Checkstyle: stop
+// @formatter:off
 class Token {
 
     public int kind; // token kind
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/Scanner.java	Fri Feb 01 17:06:26 2013 +0100
@@ -21,7 +21,7 @@
  * questions.
  */
 
- // The content of this file is automatically generated. DO NOT EDIT.
+// The content of this file is automatically generated. DO NOT EDIT.
 
 package com.oracle.truffle.sl.parser;
 
@@ -32,6 +32,7 @@
 import java.util.HashMap;
 
 // Checkstyle: stop
+// @formatter:off
 class Token {
 
     public int kind; // token kind
@@ -338,21 +339,21 @@
 		for (int i = 65; i <= 90; ++i) start.set(i, 1);
 		for (int i = 97; i <= 122; ++i) start.set(i, 1);
 		for (int i = 49; i <= 57; ++i) start.set(i, 4);
-		start.set(34, 2); 
-		start.set(48, 5); 
-		start.set(123, 6); 
-		start.set(125, 7); 
-		start.set(40, 8); 
-		start.set(41, 9); 
-		start.set(61, 20); 
-		start.set(59, 10); 
-		start.set(60, 21); 
-		start.set(62, 22); 
-		start.set(33, 14); 
-		start.set(43, 16); 
-		start.set(45, 17); 
-		start.set(42, 18); 
-		start.set(47, 19); 
+		start.set(34, 2);
+		start.set(48, 5);
+		start.set(123, 6);
+		start.set(125, 7);
+		start.set(40, 8);
+		start.set(41, 9);
+		start.set(61, 20);
+		start.set(59, 10);
+		start.set(60, 21);
+		start.set(62, 22);
+		start.set(33, 14);
+		start.set(43, 16);
+		start.set(45, 17);
+		start.set(42, 18);
+		start.set(47, 19);
 		start.set(Buffer.EOF, -1);
 		literals.put("function", new Integer(4));
 		literals.put("while", new Integer(7));
@@ -424,12 +425,12 @@
             tval = newBuf;
         }
         if (ch != Buffer.EOF) {
-			tval[tlen++] = (char)ch; 
+			tval[tlen++] = (char)ch;
 
             NextCh();
         }
     }
-	
+
 
 	boolean Comment0() {
 		int level = 1, pos0 = pos, line0 = line, col0 = col, charPos0 = charPos;
@@ -483,7 +484,7 @@
     }
 
     Token NextToken() {
-        while (ch == ' ' || 
+        while (ch == ' ' ||
 			ch >= 9 && ch <= 10 || ch == 13
 		) NextCh();
 		if (ch == '/' && Comment0() ||ch == '/' && Comment1()) return NextToken();
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SimpleLanguage.atg	Fri Feb 01 16:57:40 2013 +0100
+++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/parser/SimpleLanguage.atg	Fri Feb 01 17:06:26 2013 +0100
@@ -28,7 +28,7 @@
 =
 Function 
 {
-    Function
+     Function
 }
 .
 
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/tools/GraphPrinter.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.tools;
-
-import com.oracle.truffle.api.nodes.*;
-
-public class GraphPrinter {
-
-    public static void print(Node root) {
-        print(root, 0);
-    }
-
-    private static void print(Node node, int level) {
-        for (int i = 0; i < level; i++) {
-            System.out.print("    ");
-        }
-        System.out.println(node == null ? "empty" : node.getClass().getSimpleName());
-        if (node != null) {
-            for (Node child : node.getChildren()) {
-                print(child, level + 1);
-            }
-        }
-    }
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/FrameSlotNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.types;
-
-import com.oracle.truffle.api.frame.*;
-
-public abstract class FrameSlotNode extends TypedNode implements FrameSlotTypeListener {
-
-    protected final FrameSlot slot;
-
-    public FrameSlotNode(FrameSlot slot) {
-        this.slot = slot;
-        slot.registerOneShotTypeListener(this);
-    }
-
-    @Override
-    public void typeChanged(FrameSlot changedSlot, Class< ? > oldType) {
-        if (getParent() != null) {
-            specialize(changedSlot.getType());
-        }
-    }
-
-    protected abstract void specialize(Class< ? > clazz);
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/TypedNode.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2012, 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.truffle.sl.types;
-
-import java.math.*;
-
-import com.oracle.truffle.api.frame.*;
-import com.oracle.truffle.api.nodes.*;
-import com.oracle.truffle.sl.nodes.*;
-
-public abstract class TypedNode extends ConditionNode {
-
-    @Override
-    public final boolean executeCondition(VirtualFrame frame) {
-        try {
-            return executeBoolean(frame);
-        } catch (UnexpectedResultException ex) {
-            throw new RuntimeException("Illegal type for condition: " + ex.getResult().getClass().getSimpleName());
-        }
-    }
-
-    public abstract boolean executeBoolean(VirtualFrame frame) throws UnexpectedResultException;
-
-    public abstract int executeInteger(VirtualFrame frame) throws UnexpectedResultException;
-
-    public abstract BigInteger executeBigInteger(VirtualFrame frame) throws UnexpectedResultException;
-
-    public abstract String executeString(VirtualFrame frame) throws UnexpectedResultException;
-
-    public abstract Object executeGeneric(VirtualFrame frame);
-}
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/types/Types.java	Fri Feb 01 16:57:40 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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.truffle.sl.types;
-
-import java.math.*;
-
-import com.oracle.truffle.api.codegen.*;
-
-@TypeSystem(types = {int.class, BigInteger.class, boolean.class, String.class}, nodeBaseClass = TypedNode.class, hasVoid = true)
-public class Types {
-
-    @TypeCheck
-    public boolean isInteger(Object value) {
-        return value instanceof Integer || (value instanceof BigInteger && ((BigInteger) value).bitLength() < Integer.SIZE);
-    }
-
-    @TypeCast
-    public int asInteger(Object value) {
-        assert isInteger(value);
-        if (value instanceof Integer) {
-            return (int) value;
-        } else {
-            int result = ((BigInteger) value).intValue();
-            assert BigInteger.valueOf(result).equals(value) : "Loosing precision";
-            return result;
-        }
-    }
-
-    @GuardCheck
-    public boolean isString(Object a, Object b) {
-        return a instanceof String || b instanceof String;
-    }
-
-    @TypeCheck
-    public boolean isBigInteger(Object value) {
-        return value instanceof Integer || value instanceof BigInteger;
-    }
-
-    @TypeCast
-    public BigInteger asBigInteger(Object value) {
-        if (value instanceof Integer) {
-            return BigInteger.valueOf((int) value);
-        } else {
-            return (BigInteger) value;
-        }
-    }
-
-    @TypeCast
-    public BigInteger asBigInteger(int value) {
-        return BigInteger.valueOf(value);
-    }
-
-    @TypeCheck
-    public boolean isBigInteger(@SuppressWarnings("unused") int value) {
-        return true;
-    }
-
-}
--- a/hotspot/.cproject	Fri Feb 01 16:57:40 2013 +0100
+++ b/hotspot/.cproject	Fri Feb 01 17:06:26 2013 +0100
@@ -44,6 +44,7 @@
 									<listOptionValue builtIn="false" value="TARGET_ARCH_MODEL_x86_64=1"/>
 									<listOptionValue builtIn="false" value="GRAAL=1"/>
 									<listOptionValue builtIn="false" value="COMPILER2=1"/>
+									<listOptionValue builtIn="false" value="GRAALVM=1"/>
 								</option>
 								<option id="gnu.cpp.compiler.option.preprocessor.undef.2137486146" name="Undefined symbols (-U)" superClass="gnu.cpp.compiler.option.preprocessor.undef"/>
 								<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.866181452" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
--- a/make/bsd/Makefile	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/Makefile	Fri Feb 01 17:06:26 2013 +0100
@@ -47,10 +47,10 @@
 
 # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
 # JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is build before building libjvm[_g].so
+#  1. sa-jdi.jar       - This is built before building libjvm.so
 #                        Please refer to ./makefiles/sa.make
-#  2. libsa[_g].so     - Native library for SA - This is built after
-#                        libjsig[_g].so (signal interposition library)
+#  2. libsa.so         - Native library for SA - This is built after
+#                        libjsig.so (signal interposition library)
 #                        Please refer to ./makefiles/vm.make
 # If $(GAMMADIR)/agent dir is not present, SA components are not built.
 
@@ -181,9 +181,9 @@
 #
 # What you get with each target:
 #
-# debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
+# debug*     - "thin" libjvm - debug info linked into the gamma launcher
 # fastdebug* - optimized compile, but with asserts enabled
-# jvmg*      - "fat" libjvm_g - debug info linked into libjvm_g.so
+# jvmg*      - "fat" libjvm - debug info linked into libjvm.so
 # optimized* - optimized compile, no asserts
 # profiled*  - gprof
 # product*   - the shippable thing:  optimized compile, no asserts, -DPRODUCT
--- a/make/bsd/makefiles/buildtree.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/buildtree.make	Fri Feb 01 17:06:26 2013 +0100
@@ -449,12 +449,7 @@
 	echo "  exit 0"; \
 	echo "fi"; \
 	echo ""; \
-	echo "# Use gamma_g if it exists"; \
-	echo ""; \
 	echo "GAMMA_PROG=gamma"; \
-	echo "if [ -f gamma_g ]; then "; \
-	echo "  GAMMA_PROG=gamma_g"; \
-	echo "fi"; \
 	echo ""; \
 	echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \
 	echo "  # Ensure architecture for gamma and JAVA_HOME is the same."; \
--- a/make/bsd/makefiles/debug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/debug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -38,7 +38,6 @@
  "Please use 'make jvmg' to build debug JVM.                            \n" \
  "----------------------------------------------------------------------\n")
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/dtrace.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/dtrace.make	Fri Feb 01 17:06:26 2013 +0100
@@ -38,12 +38,10 @@
 # Bsd does not build libjvm_db, does not compile on macosx
 # disabled in build: rule in vm.make
 JVM_DB = libjvm_db
-#LIBJVM_DB = libjvm_db.dylib
-LIBJVM_DB = libjvm$(G_SUFFIX)_db.dylib
+LIBJVM_DB = libjvm_db.dylib
 
 JVM_DTRACE = jvm_dtrace
-#LIBJVM_DTRACE = libjvm_dtrace.dylib
-LIBJVM_DTRACE = libjvm$(G_SUFFIX)_dtrace.dylib
+LIBJVM_DTRACE = libjvm_dtrace.dylib
 
 JVMOFFS = JvmOffsets
 JVMOFFS.o = $(JVMOFFS).o
@@ -80,9 +78,7 @@
 ifneq ("${ISA}","${BUILDARCH}")
 
 XLIBJVM_DB = 64/$(LIBJVM_DB)
-XLIBJVM_DB_G = 64/$(LIBJVM_DB_G)
 XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE)
-XLIBJVM_DTRACE_G = 64/$(LIBJVM_DTRACE_G)
 XARCH = $(subst sparcv9,v9,$(shell echo $(ISA)))
 
 $(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
@@ -90,14 +86,12 @@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc
-#	[ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
 
 $(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p 64/ ; \
 	$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
-#	[ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
 
 endif # ifneq ("${ISA}","${BUILDARCH}")
 
@@ -141,13 +135,11 @@
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc
-#	[ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
 
 $(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
-#	[ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
 
 #$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \
 #             $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
--- a/make/bsd/makefiles/fastdebug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/fastdebug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -58,7 +58,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
-G_SUFFIX = _g
 VERSION = optimized
 SYSDEFS += -DASSERT -DFASTDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/gcc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/gcc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -284,9 +284,9 @@
 
 # Use the stabs format for debugging information (this is the default
 # on gcc-2.91). It's good enough, has all the information about line
-# numbers and local variables, and libjvm_g.so is only about 16M.
+# numbers and local variables, and libjvm.so is only about 16M.
 # Change this back to "-g" if you want the most expressive format.
-# (warning: that could easily inflate libjvm_g.so to 150M!)
+# (warning: that could easily inflate libjvm.so to 150M!)
 # Note: The Itanium gcc compiler crashes when using -gstabs.
 DEBUG_CFLAGS/ia64  = -g
 DEBUG_CFLAGS/amd64 = -g
--- a/make/bsd/makefiles/jsig.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/jsig.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -24,16 +24,13 @@
 
 # Rules to build signal interposition library, used by vm.make
 
-# libjsig[_g].so: signal interposition library
+# libjsig.so: signal interposition library
 JSIG   = jsig
-JSIG_G = $(JSIG)$(G_SUFFIX)
 
 ifeq ($(OS_VENDOR), Darwin)
   LIBJSIG   = lib$(JSIG).dylib
-  LIBJSIG_G = lib$(JSIG_G).dylib
 else
   LIBJSIG   = lib$(JSIG).so
-  LIBJSIG_G = lib$(JSIG_G).so
 endif
 
 JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
@@ -58,7 +55,6 @@
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
                          $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
-	$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 
 install_jsig: $(LIBJSIG)
 	@echo "Copying $(LIBJSIG) to $(DEST_JSIG)"
--- a/make/bsd/makefiles/jvmg.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/jvmg.make	Fri Feb 01 17:06:26 2013 +0100
@@ -37,7 +37,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/bsd/makefiles/mapfile-vers-debug	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/mapfile-vers-debug	Fri Feb 01 17:06:26 2013 +0100
@@ -1,9 +1,9 @@
 #
-# @(#)mapfile-vers-debug	1.18 07/10/25 16:47:35
+# @(#)mapfile-vers-debug        1.18 07/10/25 16:47:35
 #
 
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -126,8 +126,9 @@
                 JVM_GetClassModifiers;
                 JVM_GetClassName;
                 JVM_GetClassNameUTF;
-		JVM_GetClassSignature;
+                        JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -154,6 +155,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
@@ -203,7 +205,6 @@
                 JVM_NewMultiArray;
                 JVM_OnExit;
                 JVM_Open;
-                JVM_PrintStackTrace;
                 JVM_RaiseSignal;
                 JVM_RawMonitorCreate;
                 JVM_RawMonitorDestroy;
@@ -283,7 +284,7 @@
                 # This is for Forte Analyzer profiling support.
                 AsyncGetCallTrace;
 
-		# INSERT VTABLE SYMBOLS HERE
+                # INSERT VTABLE SYMBOLS HERE
 
         local:
                 *;
--- a/make/bsd/makefiles/mapfile-vers-product	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/mapfile-vers-product	Fri Feb 01 17:06:26 2013 +0100
@@ -3,7 +3,7 @@
 #
 
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -128,6 +128,7 @@
                 JVM_GetClassNameUTF;
                 JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -154,6 +155,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
@@ -203,7 +205,6 @@
                 JVM_NewMultiArray;
                 JVM_OnExit;
                 JVM_Open;
-                JVM_PrintStackTrace;
                 JVM_RaiseSignal;
                 JVM_RawMonitorCreate;
                 JVM_RawMonitorDestroy;
--- a/make/bsd/makefiles/optimized.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/optimized.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -40,5 +40,4 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-debug
 
-G_SUFFIX =
 VERSION = optimized
--- a/make/bsd/makefiles/product.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/product.make	Fri Feb 01 17:06:26 2013 +0100
@@ -40,7 +40,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/bsd/makefiles/mapfile-vers-product
 
-G_SUFFIX =
 SYSDEFS += -DPRODUCT
 VERSION = optimized
 
--- a/make/bsd/makefiles/saproc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/saproc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -24,16 +24,13 @@
 
 # Rules to build serviceability agent library, used by vm.make
 
-# libsaproc[_g].so: serviceability agent
+# libsaproc.so: serviceability agent
 SAPROC   = saproc
-SAPROC_G = $(SAPROC)$(G_SUFFIX)
 
 ifeq ($(OS_VENDOR), Darwin)
   LIBSAPROC   = lib$(SAPROC).dylib
-  LIBSAPROC_G = lib$(SAPROC_G).dylib
 else
   LIBSAPROC   = lib$(SAPROC).so
-  LIBSAPROC_G = lib$(SAPROC_G).so
 endif
 
 AGENT_DIR = $(GAMMADIR)/agent
@@ -114,7 +111,6 @@
 	           $(SA_DEBUG_CFLAGS)                                   \
 	           -o $@                                                \
 	           $(SALIBS)
-	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 
 install_saproc: $(BUILDLIBSAPROC)
 	$(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
--- a/make/bsd/makefiles/vm.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/bsd/makefiles/vm.make	Fri Feb 01 17:06:26 2013 +0100
@@ -138,11 +138,9 @@
 JVM    = jvm
 ifeq ($(OS_VENDOR), Darwin)
   LIBJVM   = lib$(JVM).dylib
-  LIBJVM_G = lib$(JVM)$(G_SUFFIX).dylib
   CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
 else
   LIBJVM   = lib$(JVM).so
-  LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 endif
 
 SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt graal
@@ -325,7 +323,6 @@
 		       $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM); \
 	    $(LINK_LIB.CXX/POST_HOOK)                                    \
 	    rm -f $@.1; ln -s $@ $@.1;                                  \
-	    [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
 	}
 
 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
--- a/make/hotspot_version	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/hotspot_version	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -31,11 +31,11 @@
 #
 
 # Don't put quotes (fail windows build).
-HOTSPOT_VM_COPYRIGHT=Copyright 2012
+HOTSPOT_VM_COPYRIGHT=Copyright 2013
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=12
+HS_BUILD_NUMBER=17
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/make/linux/Makefile	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/Makefile	Fri Feb 01 17:06:26 2013 +0100
@@ -47,10 +47,10 @@
 
 # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
 # JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is build before building libjvm[_g].so
+#  1. sa-jdi.jar       - This is built before building libjvm.so
 #                        Please refer to ./makefiles/sa.make
-#  2. libsa[_g].so     - Native library for SA - This is built after
-#                        libjsig[_g].so (signal interposition library)
+#  2. libsa.so         - Native library for SA - This is built after
+#                        libjsig.so (signal interposition library)
 #                        Please refer to ./makefiles/vm.make
 # If $(GAMMADIR)/agent dir is not present, SA components are not built.
 
@@ -181,9 +181,9 @@
 #
 # What you get with each target:
 #
-# debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
+# debug*     - "thin" libjvm - debug info linked into the gamma launcher
 # fastdebug* - optimized compile, but with asserts enabled
-# jvmg*      - "fat" libjvm_g - debug info linked into libjvm_g.so
+# jvmg*      - "fat" libjvm - debug info linked into libjvm.so
 # optimized* - optimized compile, no asserts
 # profiled*  - gprof
 # product*   - the shippable thing:  optimized compile, no asserts, -DPRODUCT
--- a/make/linux/makefiles/buildtree.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/buildtree.make	Fri Feb 01 17:06:26 2013 +0100
@@ -442,12 +442,7 @@
 	echo "  exit 0"; \
 	echo "fi"; \
 	echo ""; \
-	echo "# Use gamma_g if it exists"; \
-	echo ""; \
 	echo "GAMMA_PROG=gamma"; \
-	echo "if [ -f gamma_g ]; then "; \
-	echo "  GAMMA_PROG=gamma_g"; \
-	echo "fi"; \
 	echo ""; \
 	echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \
 	echo "  # Ensure architecture for gamma and JAVA_HOME is the same."; \
--- a/make/linux/makefiles/debug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/debug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -38,7 +38,6 @@
  "Please use 'make jvmg' to build debug JVM.                            \n" \
  "----------------------------------------------------------------------\n")
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/linux/makefiles/fastdebug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/fastdebug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -58,7 +58,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug
 
-G_SUFFIX = _g
 VERSION = optimized
 SYSDEFS += -DASSERT -DFASTDEBUG
 PICFLAGS = DEFAULT
--- a/make/linux/makefiles/gcc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/gcc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -229,9 +229,9 @@
 else
   # Use the stabs format for debugging information (this is the default
   # on gcc-2.91). It's good enough, has all the information about line
-  # numbers and local variables, and libjvm_g.so is only about 16M.
+  # numbers and local variables, and libjvm.so is only about 16M.
   # Change this back to "-g" if you want the most expressive format.
-  # (warning: that could easily inflate libjvm_g.so to 150M!)
+  # (warning: that could easily inflate libjvm.so to 150M!)
   # Note: The Itanium gcc compiler crashes when using -gstabs.
   DEBUG_CFLAGS/ia64  = -g
   DEBUG_CFLAGS/amd64 = -g
--- a/make/linux/makefiles/jsig.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/jsig.make	Fri Feb 01 17:06:26 2013 +0100
@@ -24,17 +24,12 @@
 
 # Rules to build signal interposition library, used by vm.make
 
-# libjsig[_g].so: signal interposition library
+# libjsig.so: signal interposition library
 JSIG = jsig
 LIBJSIG = lib$(JSIG).so
 
-JSIG_G    = $(JSIG)$(G_SUFFIX)
-LIBJSIG_G = lib$(JSIG_G).so
-
 LIBJSIG_DEBUGINFO   = lib$(JSIG).debuginfo
 LIBJSIG_DIZ         = lib$(JSIG).diz
-LIBJSIG_G_DEBUGINFO = lib$(JSIG_G).debuginfo
-LIBJSIG_G_DIZ       = lib$(JSIG_G).diz
 
 JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
 
@@ -60,7 +55,6 @@
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
                          $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $< -ldl
-	$(QUIETLY) [ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
 	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
@@ -72,11 +66,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBJSIG_G_DEBUGINFO) ] || { ln -s $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
-	$(RM) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
-	[ -f $(LIBJSIG_G_DIZ) ] || { ln -s $(LIBJSIG_DIZ) $(LIBJSIG_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO)
+	$(RM) $(LIBJSIG_DEBUGINFO)
   endif
 endif
 
--- a/make/linux/makefiles/jvmg.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/jvmg.make	Fri Feb 01 17:06:26 2013 +0100
@@ -37,7 +37,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/linux/makefiles/mapfile-vers-debug	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/mapfile-vers-debug	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -124,6 +124,7 @@
                 JVM_GetClassNameUTF;
 		JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -150,6 +151,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
@@ -199,7 +201,6 @@
                 JVM_NewMultiArray;
                 JVM_OnExit;
                 JVM_Open;
-                JVM_PrintStackTrace;
                 JVM_RaiseSignal;
                 JVM_RawMonitorCreate;
                 JVM_RawMonitorDestroy;
--- a/make/linux/makefiles/mapfile-vers-product	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/mapfile-vers-product	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 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
@@ -124,6 +124,7 @@
                 JVM_GetClassNameUTF;
                 JVM_GetClassSignature;
                 JVM_GetClassSigners;
+                JVM_GetClassTypeAnnotations;
                 JVM_GetComponentType;
                 JVM_GetDeclaredClasses;
                 JVM_GetDeclaringClass;
@@ -150,6 +151,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetSockName;
@@ -199,7 +201,6 @@
                 JVM_NewMultiArray;
                 JVM_OnExit;
                 JVM_Open;
-                JVM_PrintStackTrace;
                 JVM_RaiseSignal;
                 JVM_RawMonitorCreate;
                 JVM_RawMonitorDestroy;
--- a/make/linux/makefiles/optimized.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/optimized.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 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
@@ -40,5 +40,4 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-debug
 
-G_SUFFIX =
 VERSION = optimized
--- a/make/linux/makefiles/product.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/product.make	Fri Feb 01 17:06:26 2013 +0100
@@ -40,7 +40,6 @@
 # Linker mapfile
 MAPFILE = $(GAMMADIR)/make/linux/makefiles/mapfile-vers-product
 
-G_SUFFIX =
 SYSDEFS += -DPRODUCT
 VERSION = optimized
 
--- a/make/linux/makefiles/saproc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/saproc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -26,18 +26,13 @@
 
 # Rules to build serviceability agent library, used by vm.make
 
-# libsaproc[_g].so: serviceability agent
+# libsaproc.so: serviceability agent
 
 SAPROC = saproc
 LIBSAPROC = lib$(SAPROC).so
 
-SAPROC_G = $(SAPROC)$(G_SUFFIX)
-LIBSAPROC_G = lib$(SAPROC_G).so
-
 LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
 LIBSAPROC_DIZ         = lib$(SAPROC).diz
-LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
-LIBSAPROC_G_DIZ       = lib$(SAPROC_G).diz
 
 AGENT_DIR = $(GAMMADIR)/agent
 
@@ -99,7 +94,6 @@
 	           $(SA_DEBUG_CFLAGS)                                   \
 	           -o $@                                                \
 	           -lthread_db
-	$(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
 	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
@@ -111,11 +105,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
-	$(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
-	[ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
+	$(RM) $(LIBSAPROC_DEBUGINFO)
   endif
 endif
 
--- a/make/linux/makefiles/vm.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/linux/makefiles/vm.make	Fri Feb 01 17:06:26 2013 +0100
@@ -138,12 +138,9 @@
 
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
-LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
-LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo
-LIBJVM_G_DIZ       = lib$(JVM)$(G_SUFFIX).diz
 
 SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt graal
 
@@ -334,7 +331,6 @@
 		       $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM);       \
 	    $(LINK_LIB.CXX/POST_HOOK)                                    \
 	    rm -f $@.1; ln -s $@ $@.1;                                  \
-	    [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
             if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then                    \
 	      if [ -x /usr/sbin/selinuxenabled ] ; then                 \
 	        /usr/sbin/selinuxenabled;                               \
@@ -359,11 +355,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	$(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
-	$(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
-	[ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
+	$(RM) $(LIBJVM_DEBUGINFO)
   endif
 endif
 
--- a/make/solaris/Makefile	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/Makefile	Fri Feb 01 17:06:26 2013 +0100
@@ -38,10 +38,10 @@
 
 # Along with VM, Serviceability Agent (SA) is built for SA/JDI binding.
 # JDI binding on SA produces two binaries:
-#  1. sa-jdi.jar       - This is build before building libjvm[_g].so
+#  1. sa-jdi.jar       - This is built before building libjvm.so
 #                        Please refer to ./makefiles/sa.make
-#  2. libsaproc[_g].so - Native library for SA - This is built after
-#                        libjsig[_g].so (signal interposition library)
+#  2. libsaproc.so     - Native library for SA - This is built after
+#                        libjsig.so (signal interposition library)
 #                        Please refer to ./makefiles/vm.make
 # If $(GAMMADIR)/agent dir is not present, SA components are not built.
 
@@ -141,9 +141,9 @@
 #
 # What you get with each target:
 #
-# debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
+# debug*     - "thin" libjvm - debug info linked into the gamma launcher
 # fastdebug* - optimized compile, but with asserts enabled
-# jvmg*      - "fat" libjvm_g - debug info linked into libjvm_g.so
+# jvmg*      - "fat" libjvm - debug info linked into libjvm.so
 # optimized* - optimized compile, no asserts
 # profiled*  - gprof
 # product*   - the shippable thing:  optimized compile, no asserts, -DPRODUCT
--- a/make/solaris/makefiles/buildtree.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/buildtree.make	Fri Feb 01 17:06:26 2013 +0100
@@ -436,12 +436,7 @@
 	echo "  exit 0"; \
 	echo "fi"; \
 	echo ""; \
-	echo "# Use gamma_g if it exists"; \
-	echo ""; \
 	echo "GAMMA_PROG=gamma"; \
-	echo "if [ -f gamma_g ]; then "; \
-	echo "  GAMMA_PROG=gamma_g"; \
-	echo "fi"; \
 	echo ""; \
 	echo "if [ \"$(OS_VENDOR)\" = \"Darwin\" ]; then "; \
 	echo "  # Ensure architecture for gamma and JAVA_HOME is the same."; \
--- a/make/solaris/makefiles/debug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/debug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1998, 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
@@ -56,7 +56,6 @@
  "Please use 'gnumake jvmg' to build debug JVM.                            \n" \
  "-------------------------------------------------------------------------\n")
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/solaris/makefiles/dtrace.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/dtrace.make	Fri Feb 01 17:06:26 2013 +0100
@@ -39,21 +39,15 @@
 
 JVM_DB = libjvm_db
 LIBJVM_DB = libjvm_db.so
-LIBJVM_DB_G = libjvm$(G_SUFFIX)_db.so
 
 LIBJVM_DB_DEBUGINFO   = libjvm_db.debuginfo
 LIBJVM_DB_DIZ         = libjvm_db.diz
-LIBJVM_DB_G_DEBUGINFO = libjvm$(G_SUFFIX)_db.debuginfo
-LIBJVM_DB_G_DIZ       = libjvm$(G_SUFFIX)_db.diz
 
 JVM_DTRACE = jvm_dtrace
 LIBJVM_DTRACE = libjvm_dtrace.so
-LIBJVM_DTRACE_G = libjvm$(G_SUFFIX)_dtrace.so
 
 LIBJVM_DTRACE_DEBUGINFO   = libjvm_dtrace.debuginfo
 LIBJVM_DTRACE_DIZ         = libjvm_dtrace.diz
-LIBJVM_DTRACE_G_DEBUGINFO = libjvm$(G_SUFFIX)_dtrace.debuginfo
-LIBJVM_DTRACE_G_DIZ       = libjvm$(G_SUFFIX)_dtrace.diz
 
 JVMOFFS = JvmOffsets
 JVMOFFS.o = $(JVMOFFS).o
@@ -96,25 +90,18 @@
 
 XLIBJVM_DIR = 64
 XLIBJVM_DB = $(XLIBJVM_DIR)/$(LIBJVM_DB)
-XLIBJVM_DB_G = $(XLIBJVM_DIR)/$(LIBJVM_DB_G)
 XLIBJVM_DTRACE = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE)
-XLIBJVM_DTRACE_G = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G)
 
 XLIBJVM_DB_DEBUGINFO       = $(XLIBJVM_DIR)/$(LIBJVM_DB_DEBUGINFO)
 XLIBJVM_DB_DIZ             = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ)
-XLIBJVM_DB_G_DEBUGINFO     = $(XLIBJVM_DIR)/$(LIBJVM_DB_G_DEBUGINFO)
-XLIBJVM_DB_G_DIZ           = $(XLIBJVM_DIR)/$(LIBJVM_DB_G_DIZ)
 XLIBJVM_DTRACE_DEBUGINFO   = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
 XLIBJVM_DTRACE_DIZ         = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
-XLIBJVM_DTRACE_G_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G_DEBUGINFO)
-XLIBJVM_DTRACE_G_DIZ       = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_G_DIZ)
 
 $(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
 	@echo Making $@
 	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
-	[ -f $(XLIBJVM_DB_G) ] || { ln -s $(LIBJVM_DB) $(XLIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
@@ -137,13 +124,11 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(XLIBJVM_DB_G_DEBUGINFO) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
 # in the archived name:
-	( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO) )
-	$(RM) $(XLIBJVM_DB_DEBUGINFO) $(XLIBJVM_DB_G_DEBUGINFO)
-	[ -f $(XLIBJVM_DB_G_DIZ) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DB_DIZ) $(LIBJVM_DB_G_DIZ); }
+	( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) )
+	$(RM) $(XLIBJVM_DB_DEBUGINFO)
   endif
 endif
 
@@ -152,7 +137,6 @@
 	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
-	[ -f $(XLIBJVM_DTRACE_G) ] || { ln -s $(LIBJVM_DTRACE) $(XLIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
@@ -170,13 +154,11 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(XLIBJVM_DTRACE_G_DEBUGINFO) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
 # in the archived name:
-	( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO) )
-	$(RM) $(XLIBJVM_DTRACE_DEBUGINFO) $(XLIBJVM_DTRACE_G_DEBUGINFO)
-	[ -f $(XLIBJVM_DTRACE_G_DIZ) ] || { cd $(XLIBJVM_DIR) && ln -s $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_G_DIZ); }
+	( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO))
+	$(RM) $(XLIBJVM_DTRACE_DEBUGINFO)
   endif
 endif
 
@@ -224,7 +206,6 @@
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
-	[ -f $(LIBJVM_DB_G) ] || { ln -s $@ $(LIBJVM_DB_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
@@ -240,11 +221,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBJVM_DB_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO)
-	$(RM) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB_G_DEBUGINFO)
-	[ -f $(LIBJVM_DB_G_DIZ) ] || { ln -s $(LIBJVM_DB_DIZ) $(LIBJVM_DB_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO)
+	$(RM) $(LIBJVM_DB_DEBUGINFO)
   endif
 endif
 
@@ -252,7 +231,6 @@
 	@echo Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
-	[ -f $(LIBJVM_DTRACE_G) ] || { ln -s $@ $(LIBJVM_DTRACE_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
 	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
@@ -268,11 +246,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBJVM_DTRACE_G_DEBUGINFO) ] || { ln -s $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO)
-	$(RM) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE_G_DEBUGINFO)
-	[ -f $(LIBJVM_DTRACE_G_DIZ) ] || { ln -s $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) 
+	$(RM) $(LIBJVM_DTRACE_DEBUGINFO)
   endif
 endif
 
--- a/make/solaris/makefiles/fastdebug.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/fastdebug.make	Fri Feb 01 17:06:26 2013 +0100
@@ -125,7 +125,6 @@
 # and mustn't be otherwise.
 MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
 
-G_SUFFIX = _g
 VERSION = optimized
 SYSDEFS += -DASSERT -DFASTDEBUG -DCHECK_UNHANDLED_OOPS
 PICFLAGS = DEFAULT
--- a/make/solaris/makefiles/gcc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/gcc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -187,9 +187,9 @@
 
 # Use the stabs format for debugging information (this is the default 
 # on gcc-2.91). It's good enough, has all the information about line 
-# numbers and local variables, and libjvm_g.so is only about 16M. 
+# numbers and local variables, and libjvm.so is only about 16M. 
 # Change this back to "-g" if you want the most expressive format. 
-# (warning: that could easily inflate libjvm_g.so to 150M!) 
+# (warning: that could easily inflate libjvm.so to 150M!) 
 # Note: The Itanium gcc compiler crashes when using -gstabs. 
 DEBUG_CFLAGS/ia64  = -g 
 DEBUG_CFLAGS/amd64 = -g 
--- a/make/solaris/makefiles/jsig.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/jsig.make	Fri Feb 01 17:06:26 2013 +0100
@@ -24,17 +24,12 @@
 
 # Rules to build signal interposition library, used by vm.make
 
-# libjsig[_g].so: signal interposition library
+# libjsig.so: signal interposition library
 JSIG      = jsig
 LIBJSIG   = lib$(JSIG).so
 
-JSIG_G    = $(JSIG)$(G_SUFFIX)
-LIBJSIG_G = lib$(JSIG_G).so
-
 LIBJSIG_DEBUGINFO   = lib$(JSIG).debuginfo
 LIBJSIG_DIZ         = lib$(JSIG).diz
-LIBJSIG_G_DEBUGINFO = lib$(JSIG_G).debuginfo
-LIBJSIG_G_DIZ       = lib$(JSIG_G).diz
 
 JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
 
@@ -56,7 +51,6 @@
 	@echo Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
                          $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
-	[ -f $(LIBJSIG_G) ] || { ln -s $@ $(LIBJSIG_G); }
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
@@ -77,11 +71,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBJSIG_G_DEBUGINFO) ] || { ln -s $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
-	$(RM) $(LIBJSIG_DEBUGINFO) $(LIBJSIG_G_DEBUGINFO)
-	[ -f $(LIBJSIG_G_DIZ) ] || { ln -s $(LIBJSIG_DIZ) $(LIBJSIG_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO)
+	$(RM) $(LIBJSIG_DEBUGINFO)
   endif
 endif
 
--- a/make/solaris/makefiles/jvmg.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/jvmg.make	Fri Feb 01 17:06:26 2013 +0100
@@ -54,7 +54,6 @@
 # and mustn't be otherwise.
 MAPFILE_DTRACE = $(GAMMADIR)/make/solaris/makefiles/mapfile-vers-$(TYPE)
 
-G_SUFFIX = _g
 VERSION = debug
 SYSDEFS += -DASSERT -DDEBUG
 PICFLAGS = DEFAULT
--- a/make/solaris/makefiles/mapfile-vers	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/mapfile-vers	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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
@@ -26,235 +26,236 @@
 
 SUNWprivate_1.1 {
         global:
-		# JNI
+                # JNI
                 JNI_CreateJavaVM;
                 JNI_GetCreatedJavaVMs;
                 JNI_GetDefaultJavaVMInitArgs;
-	
-		# JVM
-		JVM_Accept;
-		JVM_ActiveProcessorCount;
-		JVM_AllocateNewArray;
-		JVM_AllocateNewObject;
-		JVM_ArrayCopy;
-		JVM_AssertionStatusDirectives;
-		JVM_Available;
-		JVM_Bind;
-		JVM_ClassDepth;
-		JVM_ClassLoaderDepth;
-		JVM_Clone;
-		JVM_Close;
-		JVM_CX8Field;
-		JVM_CompileClass;
-		JVM_CompileClasses;
-		JVM_CompilerCommand;
-		JVM_Connect;
-		JVM_ConstantPoolGetClassAt;
-		JVM_ConstantPoolGetClassAtIfLoaded;
-		JVM_ConstantPoolGetDoubleAt;
-		JVM_ConstantPoolGetFieldAt;
-		JVM_ConstantPoolGetFieldAtIfLoaded;
-		JVM_ConstantPoolGetFloatAt;
-		JVM_ConstantPoolGetIntAt;
-		JVM_ConstantPoolGetLongAt;
-		JVM_ConstantPoolGetMethodAt;
-		JVM_ConstantPoolGetMethodAtIfLoaded;
-		JVM_ConstantPoolGetMemberRefInfoAt;
-		JVM_ConstantPoolGetSize;
-		JVM_ConstantPoolGetStringAt;
-		JVM_ConstantPoolGetUTF8At;
-		JVM_CountStackFrames;
-		JVM_CurrentClassLoader;
-		JVM_CurrentLoadedClass;
-		JVM_CurrentThread;
-		JVM_CurrentTimeMillis;
-		JVM_DefineClass;
-		JVM_DefineClassWithSource;
-		JVM_DefineClassWithSourceCond;
-		JVM_DesiredAssertionStatus;
-		JVM_DisableCompiler;
-		JVM_DoPrivileged;
-		JVM_DTraceGetVersion;
-		JVM_DTraceActivate;
-		JVM_DTraceIsProbeEnabled;
-		JVM_DTraceIsSupported;
-		JVM_DTraceDispose;
-		JVM_DumpAllStacks;
-		JVM_DumpThreads;
-		JVM_EnableCompiler;
-		JVM_Exit;
-		JVM_FillInStackTrace;
-		JVM_FindClassFromClass;
-		JVM_FindClassFromClassLoader;
-		JVM_FindClassFromBootLoader;
-		JVM_FindLibraryEntry;
-		JVM_FindLoadedClass;
-		JVM_FindPrimitiveClass;
-		JVM_FindSignal;
-		JVM_FreeMemory;
-		JVM_GC;
-		JVM_GetAllThreads;
-		JVM_GetArrayElement;
-		JVM_GetArrayLength;
-		JVM_GetCPClassNameUTF;
-		JVM_GetCPFieldClassNameUTF;
-		JVM_GetCPFieldModifiers;
-		JVM_GetCPFieldNameUTF;
-		JVM_GetCPFieldSignatureUTF;
-		JVM_GetCPMethodClassNameUTF;
-		JVM_GetCPMethodModifiers;
-		JVM_GetCPMethodNameUTF;
-		JVM_GetCPMethodSignatureUTF;
-		JVM_GetCallerClass;
-		JVM_GetClassAccessFlags;
-		JVM_GetClassAnnotations;
-		JVM_GetClassCPEntriesCount;
-		JVM_GetClassCPTypes;
-		JVM_GetClassConstantPool;
-		JVM_GetClassContext;
-		JVM_GetClassDeclaredConstructors;
-		JVM_GetClassDeclaredFields;
-		JVM_GetClassDeclaredMethods;
-		JVM_GetClassFieldsCount;
-		JVM_GetClassInterfaces;
-		JVM_GetClassLoader;
-		JVM_GetClassMethodsCount;
-		JVM_GetClassModifiers;
-		JVM_GetClassName;
-		JVM_GetClassNameUTF;
-		JVM_GetClassSignature;
-		JVM_GetClassSigners;
-		JVM_GetComponentType;
-		JVM_GetDeclaredClasses;
-		JVM_GetDeclaringClass;
-		JVM_GetEnclosingMethodInfo;
-	        JVM_GetFieldAnnotations;
-		JVM_GetFieldIxModifiers;
-		JVM_GetHostName;
-		JVM_GetInheritedAccessControlContext;
-		JVM_GetInterfaceVersion;
-		JVM_GetLastErrorString;
-		JVM_GetManagement;
-	        JVM_GetMethodAnnotations;
-	        JVM_GetMethodDefaultAnnotationValue;
-		JVM_GetMethodIxArgsSize;
-		JVM_GetMethodIxByteCode;
-		JVM_GetMethodIxByteCodeLength;
-		JVM_GetMethodIxExceptionIndexes;
-		JVM_GetMethodIxExceptionTableEntry;
-		JVM_GetMethodIxExceptionTableLength;
-		JVM_GetMethodIxExceptionsCount;
-		JVM_GetMethodIxLocalsCount;
-		JVM_GetMethodIxMaxStack;
-		JVM_GetMethodIxModifiers;
-		JVM_GetMethodIxNameUTF;
-		JVM_GetMethodIxSignatureUTF;
-	        JVM_GetMethodParameterAnnotations;
-		JVM_GetPrimitiveArrayElement;
-		JVM_GetProtectionDomain;
-		JVM_GetSockName;
-		JVM_GetSockOpt;
-		JVM_GetStackAccessControlContext;
-		JVM_GetStackTraceDepth;
-		JVM_GetStackTraceElement;
-		JVM_GetSystemPackage;
-		JVM_GetSystemPackages;
-		JVM_GetThreadStateNames;
-		JVM_GetThreadStateValues;
-		JVM_GetVersionInfo;
-		JVM_Halt;
-		JVM_HoldsLock;
-		JVM_IHashCode;
-		JVM_InitAgentProperties;
-		JVM_InitProperties;
-		JVM_InitializeCompiler;
-		JVM_InitializeSocketLibrary;
-		JVM_InternString;
-		JVM_Interrupt;
-		JVM_InvokeMethod;
-		JVM_IsArrayClass;
-		JVM_IsConstructorIx;
-		JVM_IsInterface;
-		JVM_IsInterrupted;
-		JVM_IsNaN;
-		JVM_IsPrimitiveClass;
-		JVM_IsSameClassPackage;
-		JVM_IsSilentCompiler;
-		JVM_IsSupportedJNIVersion;
-		JVM_IsThreadAlive;
-		JVM_LatestUserDefinedLoader;
-		JVM_Listen;
-		JVM_LoadClass0;
-		JVM_LoadLibrary;
-		JVM_Lseek;
-		JVM_MaxObjectInspectionAge;
-		JVM_MaxMemory;
-		JVM_MonitorNotify;
-		JVM_MonitorNotifyAll;
-		JVM_MonitorWait;
-		JVM_NativePath;
-		JVM_NanoTime;
-		JVM_NewArray;
-		JVM_NewInstanceFromConstructor;
-		JVM_NewMultiArray;
-		JVM_OnExit;
-		JVM_Open;
-		JVM_PrintStackTrace;
-		JVM_RaiseSignal;
-		JVM_RawMonitorCreate;
-		JVM_RawMonitorDestroy;
-		JVM_RawMonitorEnter;
-		JVM_RawMonitorExit;
-		JVM_Read;
-		JVM_Recv;
-		JVM_RecvFrom;
-		JVM_RegisterSignal;
-		JVM_ReleaseUTF;
-		JVM_ResolveClass;
-		JVM_ResumeThread;
-		JVM_Send;
-		JVM_SendTo;
-		JVM_SetArrayElement;
-		JVM_SetClassSigners;
-		JVM_SetLength;
+        
+                # JVM
+                JVM_Accept;
+                JVM_ActiveProcessorCount;
+                JVM_AllocateNewArray;
+                JVM_AllocateNewObject;
+                JVM_ArrayCopy;
+                JVM_AssertionStatusDirectives;
+                JVM_Available;
+                JVM_Bind;
+                JVM_ClassDepth;
+                JVM_ClassLoaderDepth;
+                JVM_Clone;
+                JVM_Close;
+                JVM_CX8Field;
+                JVM_CompileClass;
+                JVM_CompileClasses;
+                JVM_CompilerCommand;
+                JVM_Connect;
+                JVM_ConstantPoolGetClassAt;
+                JVM_ConstantPoolGetClassAtIfLoaded;
+                JVM_ConstantPoolGetDoubleAt;
+                JVM_ConstantPoolGetFieldAt;
+                JVM_ConstantPoolGetFieldAtIfLoaded;
+                JVM_ConstantPoolGetFloatAt;
+                JVM_ConstantPoolGetIntAt;
+                JVM_ConstantPoolGetLongAt;
+                JVM_ConstantPoolGetMethodAt;
+                JVM_ConstantPoolGetMethodAtIfLoaded;
+                JVM_ConstantPoolGetMemberRefInfoAt;
+                JVM_ConstantPoolGetSize;
+                JVM_ConstantPoolGetStringAt;
+                JVM_ConstantPoolGetUTF8At;
+                JVM_CountStackFrames;
+                JVM_CurrentClassLoader;
+                JVM_CurrentLoadedClass;
+                JVM_CurrentThread;
+                JVM_CurrentTimeMillis;
+                JVM_DefineClass;
+                JVM_DefineClassWithSource;
+                JVM_DefineClassWithSourceCond;
+                JVM_DesiredAssertionStatus;
+                JVM_DisableCompiler;
+                JVM_DoPrivileged;
+                JVM_DTraceGetVersion;
+                JVM_DTraceActivate;
+                JVM_DTraceIsProbeEnabled;
+                JVM_DTraceIsSupported;
+                JVM_DTraceDispose;
+                JVM_DumpAllStacks;
+                JVM_DumpThreads;
+                JVM_EnableCompiler;
+                JVM_Exit;
+                JVM_FillInStackTrace;
+                JVM_FindClassFromClass;
+                JVM_FindClassFromClassLoader;
+                JVM_FindClassFromBootLoader;
+                JVM_FindLibraryEntry;
+                JVM_FindLoadedClass;
+                JVM_FindPrimitiveClass;
+                JVM_FindSignal;
+                JVM_FreeMemory;
+                JVM_GC;
+                JVM_GetAllThreads;
+                JVM_GetArrayElement;
+                JVM_GetArrayLength;
+                JVM_GetCPClassNameUTF;
+                JVM_GetCPFieldClassNameUTF;
+                JVM_GetCPFieldModifiers;
+                JVM_GetCPFieldNameUTF;
+                JVM_GetCPFieldSignatureUTF;
+                JVM_GetCPMethodClassNameUTF;
+                JVM_GetCPMethodModifiers;
+                JVM_GetCPMethodNameUTF;
+                JVM_GetCPMethodSignatureUTF;
+                JVM_GetCallerClass;
+                JVM_GetClassAccessFlags;
+                JVM_GetClassAnnotations;
+                JVM_GetClassCPEntriesCount;
+                JVM_GetClassCPTypes;
+                JVM_GetClassConstantPool;
+                JVM_GetClassContext;
+                JVM_GetClassDeclaredConstructors;
+                JVM_GetClassDeclaredFields;
+                JVM_GetClassDeclaredMethods;
+                JVM_GetClassFieldsCount;
+                JVM_GetClassInterfaces;
+                JVM_GetClassLoader;
+                JVM_GetClassMethodsCount;
+                JVM_GetClassModifiers;
+                JVM_GetClassName;
+                JVM_GetClassNameUTF;
+                JVM_GetClassSignature;
+                JVM_GetClassSigners;
+                JVM_GetComponentType;
+                JVM_GetClassTypeAnnotations;
+                JVM_GetDeclaredClasses;
+                JVM_GetDeclaringClass;
+                JVM_GetEnclosingMethodInfo;
+                JVM_GetFieldAnnotations;
+                JVM_GetFieldIxModifiers;
+                JVM_GetHostName;
+                JVM_GetInheritedAccessControlContext;
+                JVM_GetInterfaceVersion;
+                JVM_GetLastErrorString;
+                JVM_GetManagement;
+                JVM_GetMethodAnnotations;
+                JVM_GetMethodDefaultAnnotationValue;
+                JVM_GetMethodIxArgsSize;
+                JVM_GetMethodIxByteCode;
+                JVM_GetMethodIxByteCodeLength;
+                JVM_GetMethodIxExceptionIndexes;
+                JVM_GetMethodIxExceptionTableEntry;
+                JVM_GetMethodIxExceptionTableLength;
+                JVM_GetMethodIxExceptionsCount;
+                JVM_GetMethodIxLocalsCount;
+                JVM_GetMethodIxMaxStack;
+                JVM_GetMethodIxModifiers;
+                JVM_GetMethodIxNameUTF;
+                JVM_GetMethodIxSignatureUTF;
+                JVM_GetMethodParameterAnnotations;
+                JVM_GetMethodParameters;
+                JVM_GetPrimitiveArrayElement;
+                JVM_GetProtectionDomain;
+                JVM_GetSockName;
+                JVM_GetSockOpt;
+                JVM_GetStackAccessControlContext;
+                JVM_GetStackTraceDepth;
+                JVM_GetStackTraceElement;
+                JVM_GetSystemPackage;
+                JVM_GetSystemPackages;
+                JVM_GetThreadStateNames;
+                JVM_GetThreadStateValues;
+                JVM_GetVersionInfo;
+                JVM_Halt;
+                JVM_HoldsLock;
+                JVM_IHashCode;
+                JVM_InitAgentProperties;
+                JVM_InitProperties;
+                JVM_InitializeCompiler;
+                JVM_InitializeSocketLibrary;
+                JVM_InternString;
+                JVM_Interrupt;
+                JVM_InvokeMethod;
+                JVM_IsArrayClass;
+                JVM_IsConstructorIx;
+                JVM_IsInterface;
+                JVM_IsInterrupted;
+                JVM_IsNaN;
+                JVM_IsPrimitiveClass;
+                JVM_IsSameClassPackage;
+                JVM_IsSilentCompiler;
+                JVM_IsSupportedJNIVersion;
+                JVM_IsThreadAlive;
+                JVM_LatestUserDefinedLoader;
+                JVM_Listen;
+                JVM_LoadClass0;
+                JVM_LoadLibrary;
+                JVM_Lseek;
+                JVM_MaxObjectInspectionAge;
+                JVM_MaxMemory;
+                JVM_MonitorNotify;
+                JVM_MonitorNotifyAll;
+                JVM_MonitorWait;
+                JVM_NativePath;
+                JVM_NanoTime;
+                JVM_NewArray;
+                JVM_NewInstanceFromConstructor;
+                JVM_NewMultiArray;
+                JVM_OnExit;
+                JVM_Open;
+                JVM_RaiseSignal;
+                JVM_RawMonitorCreate;
+                JVM_RawMonitorDestroy;
+                JVM_RawMonitorEnter;
+                JVM_RawMonitorExit;
+                JVM_Read;
+                JVM_Recv;
+                JVM_RecvFrom;
+                JVM_RegisterSignal;
+                JVM_ReleaseUTF;
+                JVM_ResolveClass;
+                JVM_ResumeThread;
+                JVM_Send;
+                JVM_SendTo;
+                JVM_SetArrayElement;
+                JVM_SetClassSigners;
+                JVM_SetLength;
                 JVM_SetNativeThreadName;
-		JVM_SetPrimitiveArrayElement;
-		JVM_SetProtectionDomain;
-		JVM_SetSockOpt;
-		JVM_SetThreadPriority;
-		JVM_Sleep;
-		JVM_Socket;
-		JVM_SocketAvailable;
-		JVM_SocketClose;
-		JVM_SocketShutdown;
-		JVM_StartThread;
-		JVM_StopThread;
-		JVM_SuspendThread;
-		JVM_SupportsCX8;
-		JVM_Sync;
-		JVM_Timeout;
-		JVM_TotalMemory;
-		JVM_TraceInstructions;
-		JVM_TraceMethodCalls;
-		JVM_UnloadLibrary;
-		JVM_Write;
-		JVM_Yield;
-		JVM_handle_solaris_signal;
+                JVM_SetPrimitiveArrayElement;
+                JVM_SetProtectionDomain;
+                JVM_SetSockOpt;
+                JVM_SetThreadPriority;
+                JVM_Sleep;
+                JVM_Socket;
+                JVM_SocketAvailable;
+                JVM_SocketClose;
+                JVM_SocketShutdown;
+                JVM_StartThread;
+                JVM_StopThread;
+                JVM_SuspendThread;
+                JVM_SupportsCX8;
+                JVM_Sync;
+                JVM_Timeout;
+                JVM_TotalMemory;
+                JVM_TraceInstructions;
+                JVM_TraceMethodCalls;
+                JVM_UnloadLibrary;
+                JVM_Write;
+                JVM_Yield;
+                JVM_handle_solaris_signal;
 
-		# miscellaneous functions
-		jio_fprintf;
-		jio_printf;
-		jio_snprintf;
-		jio_vfprintf;
-		jio_vsnprintf;
+                # miscellaneous functions
+                jio_fprintf;
+                jio_printf;
+                jio_snprintf;
+                jio_vfprintf;
+                jio_vsnprintf;
 
-		# Needed because there is no JVM interface for this.
-		sysThreadAvailableStackWithSlack;
+                # Needed because there is no JVM interface for this.
+                sysThreadAvailableStackWithSlack;
 
-		# This is for Forte Analyzer profiling support.
-		AsyncGetCallTrace;
+                # This is for Forte Analyzer profiling support.
+                AsyncGetCallTrace;
 
-		# INSERT VTABLE SYMBOLS HERE
+                # INSERT VTABLE SYMBOLS HERE
 
         local:
                 *;
--- a/make/solaris/makefiles/optimized.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/optimized.make	Fri Feb 01 17:06:26 2013 +0100
@@ -65,5 +65,4 @@
 # Set the environment variable HOTSPARC_GENERIC to "true"
 # to inhibit the effect of the previous line on CFLAGS.
 
-G_SUFFIX =
 VERSION = optimized
--- a/make/solaris/makefiles/product.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/product.make	Fri Feb 01 17:06:26 2013 +0100
@@ -81,6 +81,5 @@
 # and this macro is not used.
 # LINK_LIB.CXX/POST_HOOK += $(STRIP_LIB.CXX/POST_HOOK)
 
-G_SUFFIX =
 SYSDEFS += -DPRODUCT
 VERSION = optimized
--- a/make/solaris/makefiles/saproc.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/saproc.make	Fri Feb 01 17:06:26 2013 +0100
@@ -24,20 +24,15 @@
 
 # Rules to build serviceability agent library, used by vm.make
 
-# libsaproc[_g].so: serviceability agent
+# libsaproc.so: serviceability agent
 
 SAPROC = saproc
 SADIS = sadis
 LIBSAPROC = lib$(SAPROC).so
 SADISOBJ = $(SADIS).o
 
-SAPROC_G = $(SAPROC)$(G_SUFFIX)
-LIBSAPROC_G = lib$(SAPROC_G).so
-
 LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
 LIBSAPROC_DIZ         = lib$(SAPROC).diz
-LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
-LIBSAPROC_G_DIZ       = lib$(SAPROC_G).diz
 
 AGENT_DIR = $(GAMMADIR)/agent
 
@@ -113,7 +108,6 @@
 	           $(SA_LFLAGS)                                         \
 	           -o $@                                                \
 	           -ldl -ldemangle -lthread -lc
-	[ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
 
 $(SADISOBJ): $(SADISSRCFILES)
 	           $(QUIETLY) $(CC)                                     \
@@ -146,11 +140,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	[ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
-	$(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
-	[ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
+	$(RM) $(LIBSAPROC_DEBUGINFO)
   endif
 endif
 
--- a/make/solaris/makefiles/vm.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/solaris/makefiles/vm.make	Fri Feb 01 17:06:26 2013 +0100
@@ -157,12 +157,9 @@
 
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
-LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
-LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo
-LIBJVM_G_DIZ       = lib$(JVM)$(G_SUFFIX).diz
 
 SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt graal
 
@@ -297,8 +294,6 @@
 	$(QUIETLY) $(LINK_VM) $(LFLAGS_VM) -o $@ $(sort $(LIBJVM.o)) $(LIBS_VM)
 	$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)
 	$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
-	$(QUIETLY) [ -f $(LIBJVM_G) ] || ln -s $@ $(LIBJVM_G)
-	$(QUIETLY) [ -f $(LIBJVM_G).1 ] || ln -s $@.1 $(LIBJVM_G).1
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
 # Clear the SHF_ALLOC flag (if set) from empty section headers.
@@ -319,11 +314,9 @@
     # implied else here is no stripping at all
     endif
   endif
-	$(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
   ifeq ($(ZIP_DEBUGINFO_FILES),1)
-	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
-	$(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
-	[ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); }
+	$(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
+	$(RM) $(LIBJVM_DEBUGINFO)
   endif
 endif
 endif # filter -sbfast -xsbfast
--- a/make/windows/build.make	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/windows/build.make	Fri Feb 01 17:06:26 2013 +0100
@@ -33,7 +33,7 @@
 # SA components are built if BUILD_WIN_SA=1 is specified.
 # See notes in README. This produces files:
 #  1. sa-jdi.jar       - This is built before building jvm.dll
-#  2. sawindbg[_g].dll - Native library for SA - This is built after jvm.dll
+#  2. sawindbg.dll     - Native library for SA - This is built after jvm.dll
 #                      - Also, .lib, .map, .pdb.
 #
 # Please refer to ./makefiles/sa.make
@@ -117,7 +117,7 @@
 !endif
 
 #########################################################################
-# Parameters for VERSIONINFO resource for jvm[_g].dll.
+# Parameters for VERSIONINFO resource for jvm.dll.
 # These can be overridden via the nmake.exe command line.
 # They are overridden by RE during the control builds.
 #
@@ -227,11 +227,6 @@
 
 #########################################################################
 
-# With the jvm_g.dll now being named jvm.dll, we can't build both and place
-#   the dll's in the same directory, so we only build one at a time,
-#   re-directing the output to different output directories (done by user
-#   of this makefile).
-#
 defaultTarget: product
 
 # The product or release build is an optimized build, and is the default
--- a/make/windows/projectfiles/compiler2/ADLCompiler.dsp	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/windows/projectfiles/compiler2/ADLCompiler.dsp	Fri Feb 01 17:06:26 2013 +0100
@@ -72,11 +72,11 @@
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
-# ADD BSC32 /o".\adlc\Debug\adlc_g.bsc"
+# ADD BSC32 /o".\adlc\Debug\adlc.bsc"
 # SUBTRACT BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc_g.exe"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe"
 
 !ENDIF 
 
--- a/make/windows/projectfiles/tiered/ADLCompiler.dsp	Fri Feb 01 16:57:40 2013 +0100
+++ b/make/windows/projectfiles/tiered/ADLCompiler.dsp	Fri Feb 01 17:06:26 2013 +0100
@@ -72,11 +72,11 @@
 # ADD RSC /l 0x409
 BSC32=bscmake.exe
 # ADD BASE BSC32 /nologo
-# ADD BSC32 /o".\adlc\Debug\adlc_g.bsc"
+# ADD BSC32 /o".\adlc\Debug\adlc.bsc"
 # SUBTRACT BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc_g.exe"
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /out:".\bin\adlc.exe"
 
 !ENDIF 
 
--- a/mx/commands.py	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/commands.py	Fri Feb 01 17:06:26 2013 +0100
@@ -26,10 +26,9 @@
 #
 # ----------------------------------------------------------------------------------------------------
 
-import os, sys, shutil, zipfile, tempfile, re, time, datetime, platform, subprocess, multiprocessing, types
+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
-from threading import Thread
 import mx
 import sanitycheck
 import json
@@ -80,8 +79,8 @@
 
 def _chmodDir(chmodFlags, dirname, fnames):
     os.chmod(dirname, chmodFlags)
-    for file in fnames:
-        os.chmod(os.path.join(dirname, file), chmodFlags)
+    for name in fnames:
+        os.chmod(os.path.join(dirname, name), chmodFlags)
 
 def chmodRecursive(dirname, chmodFlags):
     os.path.walk(dirname, _chmodDir, chmodFlags)
@@ -575,6 +574,9 @@
             # This removes the need to unzip the *.diz files before debugging in gdb
             env.setdefault('ZIP_DEBUGINFO_FILES', '0')
 
+            # We don't need to run the Queens test (i.e. test_gamma)
+            env.setdefault('TEST_IN_BUILD', 'false')
+
             # Clear these 2 variables as having them set can cause very confusing build problems
             env.pop('LD_LIBRARY_PATH', None)
             env.pop('CLASSPATH', None)
@@ -776,6 +778,13 @@
         clean(cleanArgs)
         tasks.append(t.stop())
 
+        eclipse_exe = os.environ.get('ECLIPSE_EXE')
+        if eclipse_exe is not None:
+            t = Task('CodeFormatCheck')
+            if mx.eclipseformat(['-e', eclipse_exe]) != 0:
+                t.abort('Formatter modified files - run "mx eclipseformat", check in changes and repush')
+            tasks.append(t.stop())
+        
         t = Task('BuildJava')
         build(['--no-native'])
         tasks.append(t.stop())
@@ -875,7 +884,7 @@
         count = int(args[0])
         del args[0]
     
-    for n in range(count):
+    for _ in range(count):
         if not vm(['-XX:+DeoptimizeALot', '-XX:+VerifyOops'] + args + ['-version'], vmbuild='fastdebug') == 0:
             mx.abort("Failed")
             
@@ -916,7 +925,11 @@
             mx.abort('-resultfile must be followed by a file name')
     vm = _vm
     if len(args) is 0:
-        args += ['all']
+        args = ['all']
+
+    def benchmarks_in_group(group):
+        prefix = group + ':'
+        return [a[len(prefix):] for a in args if a.startswith(prefix)]
 
     results = {}
     benchmarks = []
@@ -924,20 +937,20 @@
     if ('dacapo' in args or 'all' in args):
         benchmarks += sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
     else:
-        dacapos = [a[7:] for a in args if a.startswith('dacapo:')]
+        dacapos = benchmarks_in_group('dacapo')
         for dacapo in dacapos:
             if dacapo not in sanitycheck.dacapoSanityWarmup.keys():
-                mx.abort('Unknown dacapo : ' + dacapo)
+                mx.abort('Unknown DaCapo : ' + dacapo)
             benchmarks += [sanitycheck.getDacapo(dacapo, sanitycheck.dacapoSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
 
     if ('scaladacapo' in args or 'all' in args):
         benchmarks += sanitycheck.getScalaDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
     else:
-        dacapos = [a[7:] for a in args if a.startswith('scaladacapo:')]
-        for dacapo in dacapos:
-            if dacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
-                mx.abort('Unknown dacapo : ' + dacapo)
-            benchmarks += [sanitycheck.getScalaDacapo(dacapo, sanitycheck.dacapoScalaSanityWarmup[dacapo][sanitycheck.SanityCheckLevel.Benchmark])]
+        scaladacapos = benchmarks_in_group('scaladacapo')
+        for scaladacapo in scaladacapos:
+            if scaladacapo not in sanitycheck.dacapoScalaSanityWarmup.keys():
+                mx.abort('Unknown Scala DaCapo : ' + scaladacapo)
+            benchmarks += [sanitycheck.getScalaDacapo(scaladacapo, sanitycheck.dacapoScalaSanityWarmup[scaladacapo][sanitycheck.SanityCheckLevel.Benchmark])]
 
     #Bootstrap
     if ('bootstrap' in args or 'all' in args):
@@ -946,18 +959,20 @@
     if ('specjvm2008' in args or 'all' in args):
         benchmarks += [sanitycheck.getSPECjvm2008([], False, True, 120, 120)]
     else:
-        specjvms = [a[12:] for a in args if a.startswith('specjvm2008:')]
+        specjvms = benchmarks_in_group('specjvm2008')
         for specjvm in specjvms:
             benchmarks += [sanitycheck.getSPECjvm2008([specjvm], False, True, 120, 120)]
             
     if ('specjbb2005' in args or 'all' in args):
         benchmarks += [sanitycheck.getSPECjbb2005()]
+        
+    if ('specjbb2013' in args or 'all' in args):
+        benchmarks += [sanitycheck.getSPECjbb2013()]
 
     for test in benchmarks:
-        for (group, res) in test.bench(vm).items():
-            if not results.has_key(group):
-                results[group] = {};
-            results[group].update(res)
+        for (groupName, res) in test.bench(vm).items():
+            group = results.setdefault(groupName, {})
+            group.update(res)
     mx.log(json.dumps(results))
     if resultFile:
         with open(resultFile, 'w') as f:
--- a/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/eclipse-settings/org.eclipse.jdt.core.prefs	Fri Feb 01 17:06:26 2013 +0100
@@ -131,6 +131,7 @@
 org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -141,15 +142,18 @@
 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
@@ -186,11 +190,17 @@
 org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
 org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
 org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true
 org.eclipse.jdt.core.formatter.compact_else_if=true
 org.eclipse.jdt.core.formatter.continuation_indentation=4
 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
 org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
 org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -201,11 +211,16 @@
 org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=8
+org.eclipse.jdt.core.formatter.indentation.size=4
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
 org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -272,12 +287,14 @@
 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
 org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
 org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
 org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
@@ -301,6 +318,7 @@
 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
 org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
@@ -356,15 +374,17 @@
 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
 org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
 org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
 org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
 org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
 org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@@ -388,7 +408,10 @@
 org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
 org.eclipse.jdt.core.formatter.tabulation.char=space
 org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=true
 org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
 org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
 org.eclipse.jdt.core.incompatibleJDKLevel=ignore
 org.eclipse.jdt.core.incompleteClasspath=error
--- a/mx/eclipse-settings/org.eclipse.jdt.ui.prefs	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/eclipse-settings/org.eclipse.jdt.ui.prefs	Fri Feb 01 17:06:26 2013 +0100
@@ -58,8 +58,8 @@
 comment_separate_root_tags=true
 eclipse.preferences.version=1
 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_MaxineJavaCodeStyle
-formatter_settings_version=11
+formatter_profile=_Graal
+formatter_settings_version=12
 org.eclipse.jdt.ui.exception.name=e
 org.eclipse.jdt.ui.gettersetter.use.is=true
 org.eclipse.jdt.ui.ignorelowercasenames=true
@@ -76,6 +76,7 @@
 sp_cleanup.add_missing_methods=false
 sp_cleanup.add_missing_nls_tags=false
 sp_cleanup.add_missing_override_annotations=false
+sp_cleanup.add_missing_override_annotations_interface_methods=false
 sp_cleanup.add_serial_version_id=false
 sp_cleanup.always_use_blocks=false
 sp_cleanup.always_use_parentheses_in_expressions=false
@@ -83,11 +84,12 @@
 sp_cleanup.always_use_this_for_non_static_method_access=false
 sp_cleanup.convert_to_enhanced_for_loop=false
 sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code=true
 sp_cleanup.format_source_code_changes_only=false
 sp_cleanup.make_local_variable_final=false
 sp_cleanup.make_parameters_final=false
 sp_cleanup.make_private_fields_final=false
+sp_cleanup.make_type_abstract_if_missing_method=false
 sp_cleanup.make_variable_declarations_final=false
 sp_cleanup.never_use_blocks=false
 sp_cleanup.never_use_parentheses_in_expressions=false
--- a/mx/outputparser.py	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/outputparser.py	Fri Feb 01 17:06:26 2013 +0100
@@ -23,69 +23,49 @@
 #
 # ----------------------------------------------------------------------------------------------------
 
-import mx
-import commands
-import subprocess
+import re
 
 class OutputParser:
     
-    def __init__(self, nonZeroIsFatal=True):
+    def __init__(self):
         self.matchers = []
-        self.nonZeroIsFatal = nonZeroIsFatal
         
     def addMatcher(self, matcher):
         self.matchers.append(matcher)
     
-    def parse(self, vm, cmd, cwd=None, vmbuild=None):
-        ret = []
-        
-        def parseLine(line):
-            anyMatch = False
-            for matcher in self.matchers:
-                parsed = matcher.parse(line.strip())
-                if parsed:
-                    anyMatch = True
-                    if len(ret) is 0 or (matcher.startNewLine and len(ret[len(ret)-1]) > 0):
-                        ret.append({})
-                    ret[len(ret)-1].update(parsed)
-            if anyMatch :
-                mx.log('>' + line.rstrip())
-            else :
-                mx.log( line.rstrip())
-        
-        retcode = commands.vm(cmd, vm, nonZeroIsFatal=self.nonZeroIsFatal, out=parseLine, err=subprocess.STDOUT, cwd=cwd, vmbuild=vmbuild)
-        return {'parsed' : ret, 'retcode' : retcode}
+    def parse(self, output):
+        valueMaps = []
+        for matcher in self.matchers:
+            matcher.parse(output, valueMaps)
+        return valueMaps
 
-class Matcher:
+"""
+Produces a value map for each match of a given regular expression
+in some text. The value map is specified by a template map
+where each key and value in the template map is either a constant
+value or a named group in the regular expression. The latter is
+given as the group name enclosed in '<' and '>'.
+"""
+class ValuesMatcher:
     
-    def __init__(self, regex, valuesToParse, startNewLine=False):
-        assert isinstance(valuesToParse, dict)
+    def __init__(self, regex, valuesTemplate):
+        assert isinstance(valuesTemplate, dict)
         self.regex = regex
-        self.valuesToParse = valuesToParse
-        self.startNewLine = startNewLine
-        
-    def parse(self, line):
-        match = self.regex.search(line)
-        if not match:
-            return False
-        ret = {}
-        for key, value in self.valuesToParse.items():
-            ret[self.parsestr(match, key)] = self.parsestr(match, value)
-        return ret
+        self.valuesTemplate = valuesTemplate
         
-    def parsestr(self, match, key):
-        if isinstance(key, tuple):
-            if len(key) != 2:
-                raise Exception('Tuple arguments must have a length of 2')
-            tup1, tup2 = key
-            # check if key is a function
-            if hasattr(tup1, '__call__'):
-                return tup1(self.parsestr(match, tup2))
-            elif hasattr(tup2, '__call__'):
-                return tup2(self.parsestr(match, tup1))
-            else:
-                raise Exception('Tuple must contain a function pointer')
-        elif key.startswith('const:'):
-            return key.split(':')[1]
-        else:
-            return match.group(key)
+    def parse(self, text, valueMaps):
+        for match in self.regex.finditer(text):
+            valueMap = {}
+            for keyTemplate, valueTemplate in self.valuesTemplate.items():
+                key = self.get_template_value(match, keyTemplate)
+                value = self.get_template_value(match, valueTemplate)
+                assert not valueMap.has_key(key), key
+                valueMap[key] = value
+            valueMaps.append(valueMap)
+        
+    def get_template_value(self, match, template):
+        def replace_var(m):
+            groupName = m.group(1)
+            return match.group(groupName)
+        
+        return re.sub(r'<([\w]+)>', replace_var, template)
--- a/mx/projects	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/projects	Fri Feb 01 17:06:26 2013 +0100
@@ -279,21 +279,21 @@
 # truffle.api.codegen
 project@com.oracle.truffle.api.codegen@subDir=graal
 project@com.oracle.truffle.api.codegen@sourceDirs=src
-project@com.oracle.truffle.api.codegen@dependencies=com.oracle.truffle.api
+project@com.oracle.truffle.api.codegen@dependencies=
 project@com.oracle.truffle.api.codegen@checkstyle=com.oracle.graal.graph
 project@com.oracle.truffle.api.codegen@javaCompliance=1.7
 
 # truffle.codegen.processor
 project@com.oracle.truffle.codegen.processor@subDir=graal
 project@com.oracle.truffle.codegen.processor@sourceDirs=src
-project@com.oracle.truffle.codegen.processor@dependencies=com.oracle.truffle.api.codegen
+project@com.oracle.truffle.codegen.processor@dependencies=com.oracle.truffle.api.codegen,com.oracle.truffle.api
 project@com.oracle.truffle.codegen.processor@checkstyle=com.oracle.graal.graph
 project@com.oracle.truffle.codegen.processor@javaCompliance=1.7
 
 # truffle.sl
 project@com.oracle.truffle.sl@subDir=graal
 project@com.oracle.truffle.sl@sourceDirs=src
-project@com.oracle.truffle.sl@dependencies=com.oracle.truffle.api.codegen
+project@com.oracle.truffle.sl@dependencies=com.oracle.truffle.api.codegen,com.oracle.truffle.api
 project@com.oracle.truffle.sl@checkstyle=com.oracle.graal.graph
 project@com.oracle.truffle.sl@javaCompliance=1.7
 project@com.oracle.truffle.sl@annotationProcessors=com.oracle.truffle.codegen.processor
--- a/mx/sanitycheck.py	Fri Feb 01 16:57:40 2013 +0100
+++ b/mx/sanitycheck.py	Fri Feb 01 17:06:26 2013 +0100
@@ -23,10 +23,8 @@
 #
 # ----------------------------------------------------------------------------------------------------
 
-from outputparser import OutputParser, Matcher
-import re
-import mx
-import os
+from outputparser import OutputParser, ValuesMatcher
+import re, mx, commands, os, sys, StringIO, subprocess
 from os.path import isfile, join, exists
 
 dacapoSanityWarmup = {
@@ -103,12 +101,25 @@
     if specjbb2005 is None or not exists(join(specjbb2005, 'jbb.jar')):
         mx.abort('Please set the SPECJBB2005 environment variable to a SPECjbb2005 directory')
     
-    score = re.compile(r"^Valid run, Score is  (?P<score>[0-9]+)$")
+    score = re.compile(r"^Valid run, Score is  (?P<score>[0-9]+)$", re.MULTILINE)
     error = re.compile(r"VALIDATION ERROR")
-    success = re.compile(r"^Valid run, Score is  [0-9]+$")
-    matcher = Matcher(score, {'const:group' : "const:SPECjbb2005", 'const:name' : 'const:score', 'const:score' : 'score'})
+    success = re.compile(r"^Valid run, Score is  [0-9]+$", re.MULTILINE)
+    matcher = ValuesMatcher(score, {'group' : 'SPECjbb2005', 'name' : 'score', 'score' : '<score>'})
     classpath = ['jbb.jar', 'check.jar']
     return Test("SPECjbb2005", ['spec.jbb.JBBmain', '-propfile', 'SPECjbb.props'] + benchArgs, [success], [error], [matcher], vmOpts=['-Xms3g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops', '-cp', os.pathsep.join(classpath)], defaultCwd=specjbb2005)
+
+def getSPECjbb2013(benchArgs = []):
+    
+    specjbb2013 = mx.get_env('SPECJBB2013')
+    if specjbb2013 is None or not exists(join(specjbb2013, 'specjbb2013.jar')):
+        mx.abort('Please set the SPECJBB2013 environment variable to a SPECjbb2013 directory')
+    
+    jops = re.compile(r"^RUN RESULT: hbIR \(max attempted\) = [0-9]+, hbIR \(settled\) = [0-9]+, max-jOPS = (?P<max>[0-9]+), critical-jOPS = (?P<critical>[0-9]+)$", re.MULTILINE)
+    #error?
+    success = re.compile(r"org.spec.jbb.controller: Run finished", re.MULTILINE)
+    matcherMax = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'max', 'score' : '<max>'})
+    matcherCritical = ValuesMatcher(jops, {'group' : 'SPECjbb2013', 'name' : 'critical', 'score' : '<critical>'})
+    return Test("SPECjbb2013", ['-jar', 'specjbb2013.jar', '-m', 'composite'] + benchArgs, [success], [], [matcherCritical, matcherMax], vmOpts=['-Xms7g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops', '-XX:CompileCommand=exclude,*.FastMath::slowLog'], defaultCwd=specjbb2013)
     
 def getSPECjvm2008(benchArgs = [], skipCheck=False, skipKitValidation=False, warmupTime=None, iterationTime=None):
     
@@ -116,11 +127,11 @@
     if specjvm2008 is None or not exists(join(specjvm2008, 'SPECjvm2008.jar')):
         mx.abort('Please set the SPECJVM2008 environment variable to a SPECjvm2008 directory')
     
-    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$")
-    error = re.compile(r"^Errors in benchmark: ")
+    score = re.compile(r"^(Score on|Noncompliant) (?P<benchmark>[a-zA-Z0-9\._]+)( result)?: (?P<score>[0-9]+((,|\.)[0-9]+)?)( SPECjvm2008 Base)? ops/m$", re.MULTILINE)
+    error = re.compile(r"^Errors in benchmark: ", re.MULTILINE)
     # The ' ops/m' at the end of the success string is important : it's how you can tell valid and invalid runs apart
-    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$")
-    matcher = Matcher(score, {'const:group' : "const:SPECjvm2008", 'const:name' : 'benchmark', 'const:score' : 'score'}, startNewLine=True)
+    success = re.compile(r"^(Noncompliant c|C)omposite result: [0-9]+((,|\.)[0-9]+)?( SPECjvm2008 (Base|Peak))? ops/m$", re.MULTILINE)
+    matcher = ValuesMatcher(score, {'group' : 'SPECjvm2008', 'name' : '<benchmark>', 'score' : '<score>'})
     
     opts = []
     if warmupTime is not None:
@@ -156,13 +167,13 @@
     if not isfile(dacapo) or not dacapo.endswith('.jar'):
         mx.abort('Specified DaCapo jar file does not exist or is not a jar file: ' + dacapo)
     
-    dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$")
-    dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====$")
+    dacapoSuccess = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$", re.MULTILINE)
+    dacapoFail = re.compile(r"^===== DaCapo 9\.12 ([a-zA-Z0-9_]+) FAILED (warmup|) =====$", re.MULTILINE)
     dacapoTime = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
     dacapoTime1 = re.compile(r"===== DaCapo 9\.12 (?P<benchmark>[a-zA-Z0-9_]+) completed warmup 1 in (?P<time>[0-9]+) msec =====")
     
-    dacapoMatcher = Matcher(dacapoTime, {'const:group' : "const:DaCapo", 'const:name' : 'benchmark', 'const:score' : 'time'}, startNewLine=True)
-    dacapoMatcher1 = Matcher(dacapoTime1, {'const:group' : "const:DaCapo-1stRun", 'const:name' : 'benchmark', 'const:score' : 'time'})
+    dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : 'DaCapo', 'name' : '<benchmark>', 'score' : '<time>'})
+    dacapoMatcher1 = ValuesMatcher(dacapoTime1, {'group' : 'DaCapo-1stRun', 'name' : '<benchmark>', 'score' : '<time>'})
     
     return Test("DaCapo-" + name, ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher, dacapoMatcher1], ['-Xms2g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops'])
 
@@ -188,38 +199,48 @@
     if not isfile(dacapo) or not dacapo.endswith('.jar'):
         mx.abort('Specified Scala DaCapo jar file does not exist or is not a jar file: ' + dacapo)
     
-    dacapoSuccess = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$")
-    dacapoFail = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) FAILED (warmup|) =====$")
+    dacapoSuccess = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) PASSED in ([0-9]+) msec =====$", re.MULTILINE)
+    dacapoFail = re.compile(r"^===== DaCapo 0\.1\.0(-SNAPSHOT)? ([a-zA-Z0-9_]+) FAILED (warmup|) =====$", re.MULTILINE)
     dacapoTime = re.compile(r"===== DaCapo 0\.1\.0(-SNAPSHOT)? (?P<benchmark>[a-zA-Z0-9_]+) PASSED in (?P<time>[0-9]+) msec =====")
     
-    dacapoMatcher = Matcher(dacapoTime, {'const:group' : "const:Scala-DaCapo", 'const:name' : 'benchmark', 'const:score' : 'time'})
+    dacapoMatcher = ValuesMatcher(dacapoTime, {'group' : "Scala-DaCapo", 'name' : '<benchmark>', 'score' : '<time>'})
     
     return Test("Scala-DaCapo-" + name, ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms2g', '-XX:+UseSerialGC', '-XX:-UseCompressedOops'])
 
 def getBootstraps():
     time = re.compile(r"Bootstrapping Graal\.+ in (?P<time>[0-9]+) ms")
-    scoreMatcher = Matcher(time, {'const:group' : 'const:Bootstrap', 'const:name' : 'const:BootstrapTime', 'const:score' : 'time'})
-    scoreMatcherBig = Matcher(time, {'const:group' : 'const:Bootstrap-bigHeap', 'const:name' : 'const:BootstrapTime', 'const:score' : 'time'})
+    scoreMatcher = ValuesMatcher(time, {'group' : 'Bootstrap', 'name' : 'BootstrapTime', 'score' : '<time>'})
+    scoreMatcherBig = ValuesMatcher(time, {'group' : 'Bootstrap-bigHeap', 'name' : 'BootstrapTime', 'score' : '<time>'})
     
     tests = []
-    tests.append(Test("Bootstrap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcher], ingoreVms=['client', 'server']))
-    tests.append(Test("Bootstrap-bigHeap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcherBig], vmOpts=['-Xms2g'], ingoreVms=['client', 'server']))
+    tests.append(Test("Bootstrap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcher], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False))
+    tests.append(Test("Bootstrap-bigHeap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcherBig], vmOpts=['-Xms2g'], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False))
     return tests
 
+class Tee:
+    def __init__(self):
+        self.output = StringIO.StringIO()
+    def eat(self, line):
+        self.output.write(line)
+        sys.stdout.write(line)
+
 """
 Encapsulates a single program that is a sanity test and/or a benchmark.
 """
 class Test:
-    def __init__(self, name, cmd, successREs=[], failureREs=[], scoreMatchers=[], vmOpts=[], defaultCwd=None, ingoreVms=[]):
+    def __init__(self, name, cmd, successREs=[], failureREs=[], scoreMatchers=[], vmOpts=[], defaultCwd=None, ignoredVMs=[], benchmarkCompilationRate=True):
+
         self.name = name
         self.successREs = successREs
-        self.failureREs = failureREs + [re.compile(r"Exception occured in scope: ")]
+        self.failureREs = failureREs + [re.compile(r"Exception occurred in scope: ")]
         self.scoreMatchers = scoreMatchers
         self.vmOpts = vmOpts
         self.cmd = cmd
         self.defaultCwd = defaultCwd
-        self.ingoreVms = ingoreVms;
-        
+        self.ignoredVMs = ignoredVMs
+        self.benchmarkCompilationRate = benchmarkCompilationRate
+        if benchmarkCompilationRate:
+            self.vmOpts = self.vmOpts + ['-XX:+CITime']
         
     def __str__(self):
         return self.name
@@ -228,82 +249,112 @@
         """
         Run this program as a sanity test.
         """
-        if (vm in self.ingoreVms):
-            return True;
+        if (vm in self.ignoredVMs):
+            return True
         if cwd is None:
             cwd = self.defaultCwd
-        parser = OutputParser(nonZeroIsFatal = False)
+        parser = OutputParser()
         jvmError = re.compile(r"(?P<jvmerror>([A-Z]:|/).*[/\\]hs_err_pid[0-9]+\.log)")
-        parser.addMatcher(Matcher(jvmError, {'const:jvmError' : 'jvmerror'}))
+        parser.addMatcher(ValuesMatcher(jvmError, {'jvmError' : '<jvmerror>'}))
         
         for successRE in self.successREs:
-            parser.addMatcher(Matcher(successRE, {'const:passed' : 'const:1'}))
+            parser.addMatcher(ValuesMatcher(successRE, {'passed' : '1'}))
         for failureRE in self.failureREs:
-            parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'}))
-        
-        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
-        
-        parsedLines = result['parsed']
-        if len(parsedLines) == 0:
+            parser.addMatcher(ValuesMatcher(failureRE, {'failed' : '1'}))
+
+        tee = Tee()
+        retcode = commands.vm(self.vmOpts + opts + self.cmd, vm, nonZeroIsFatal=False, out=tee.eat, err=subprocess.STDOUT, cwd=cwd, vmbuild=vmbuild)
+        output = tee.output.getvalue()
+        valueMaps = parser.parse(output)
+
+        if len(valueMaps) == 0:
             return False
         
-        assert len(parsedLines) == 1, 'Test matchers should not return more than one line'
+        assert len(valueMaps) == 1, 'Test matchers should not return more than one record'
         
-        parsed = parsedLines[0]
+        record = valueMaps[0]
         
-        if parsed.has_key('jvmError'):
+        jvmErrorFile = record.get('jvmError')
+        if jvmErrorFile:
             mx.log('/!\\JVM Error : dumping error log...')
-            f = open(parsed['jvmError'], 'rb');
-            for line in iter(f.readline, ''):
-                mx.log(line.rstrip())
-            f.close()
-            os.unlink(parsed['jvmError'])
+            with open(jvmErrorFile, 'rb') as fp:
+                mx.log(fp.read())
+            os.unlink(jvmErrorFile)
             return False
         
-        if parsed.has_key('failed') and parsed['failed'] is '1':
+        if record.get('failed') == '1':
             return False
         
-        return result['retcode'] is 0 and parsed.has_key('passed') and parsed['passed'] is '1'
+        return retcode == 0 and record.get('passed') == '1'
     
     def bench(self, vm, cwd=None, opts=[], vmbuild=None):
         """
         Run this program as a benchmark.
         """
-        if (vm in self.ingoreVms):
-            return {};
+        if (vm in self.ignoredVMs):
+            return {}
         if cwd is None:
             cwd = self.defaultCwd
-        parser = OutputParser(nonZeroIsFatal = False)
+        parser = OutputParser()
         
         for successRE in self.successREs:
-            parser.addMatcher(Matcher(successRE, {'const:passed' : 'const:1'}))
+            parser.addMatcher(ValuesMatcher(successRE, {'passed' : '1'}))
         for failureRE in self.failureREs:
-            parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'}))
+            parser.addMatcher(ValuesMatcher(failureRE, {'failed' : '1'}))
         for scoreMatcher in self.scoreMatchers:
             parser.addMatcher(scoreMatcher)
+
+        if self.benchmarkCompilationRate:
+            if vm == 'graal':
+                bps = re.compile(r"ParsedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
+                ibps = re.compile(r"InlinedBytecodesPerSecond@final: (?P<rate>[0-9]+)")
+                parser.addMatcher(ValuesMatcher(bps, {'group' : 'ParsedBytecodesPerSecond', 'name' : self.name, 'score' : '<rate>'}))
+                parser.addMatcher(ValuesMatcher(ibps, {'group' : 'InlinedBytecodesPerSecond', 'name' : self.name, 'score' : '<rate>'}))
+            else:
+                ibps = re.compile(r"(?P<compiler>[\w]+) compilation speed: +(?P<rate>[0-9]+) bytes/s {standard")
+                parser.addMatcher(ValuesMatcher(ibps, {'group' : 'InlinedBytecodesPerSecond', 'name' : '<compiler>:' + self.name, 'score' : '<rate>'}))
             
-        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
-        if result['retcode'] is not 0:
-            mx.abort("Benchmark failed (non-zero retcode)")
-        
-        parsed = result['parsed']
-        
-        ret = {}
-        
-        passed = False;
+        startDelim = 'START: ' + self.name
+        endDelim = 'END: ' + self.name
         
-        for line in parsed:
-            assert (line.has_key('name') and line.has_key('score') and line.has_key('group')) or line.has_key('passed') or line.has_key('failed')
-            if line.has_key('failed') and line['failed'] is '1':
+        outputfile = os.environ.get('BENCH_OUTPUT', None)
+        if outputfile:
+            # Used only to debug output parsing
+            with open(outputfile) as fp:
+                output = fp.read()
+                start = output.find(startDelim)
+                end = output.find(endDelim, start)
+                if start == -1 and end == -1:
+                    return {}
+                output = output[start + len(startDelim + os.linesep): end]
+                mx.log(startDelim)
+                mx.log(output)
+                mx.log(endDelim)
+        else:
+            tee = Tee()
+            mx.log(startDelim)
+            if commands.vm(self.vmOpts + opts + self.cmd, vm, nonZeroIsFatal=False, out=tee.eat, err=subprocess.STDOUT, cwd=cwd, vmbuild=vmbuild) != 0:
+                mx.abort("Benchmark failed (non-zero retcode)")
+            mx.log(endDelim)
+            output = tee.output.getvalue()
+
+        groups = {}
+        passed = False
+        for valueMap in parser.parse(output):
+            assert (valueMap.has_key('name') and valueMap.has_key('score') and valueMap.has_key('group')) or valueMap.has_key('passed') or valueMap.has_key('failed'), valueMap
+            if valueMap.get('failed') == '1':
                 mx.abort("Benchmark failed")
-            if line.has_key('passed') and line['passed'] is '1':
+            if valueMap.get('passed') == '1':
                 passed = True
-            if line.has_key('name') and line.has_key('score') and line.has_key('group'):
-                if not ret.has_key(line['group']):
-                    ret[line['group']] = {};
-                ret[line['group']][line['name']] = line['score']
+            groupName = valueMap.get('group')
+            if groupName:
+                group = groups.setdefault(groupName, {})
+                name = valueMap.get('name')
+                score = valueMap.get('score')
+                if name and score:
+                    group[name] = score
         
         if not passed:
             mx.abort("Benchmark failed (not passed)")
         
-        return ret
+        return groups
--- a/mxtool/mx.py	Fri Feb 01 16:57:40 2013 +0100
+++ b/mxtool/mx.py	Fri Feb 01 17:06:26 2013 +0100
@@ -172,18 +172,18 @@
         return isinstance(self, Library)
 
 class Project(Dependency):
-    def __init__(self, suite, name, srcDirs, deps, javaCompliance, dir):
+    def __init__(self, suite, name, srcDirs, deps, javaCompliance, d):
         Dependency.__init__(self, suite, name)
         self.srcDirs = srcDirs
         self.deps = deps
         self.checkstyleProj = name
         self.javaCompliance = JavaCompliance(javaCompliance) if javaCompliance is not None else None
         self.native = False
-        self.dir = dir
+        self.dir = d
         
         # Create directories for projects that don't yet exist
-        if not exists(dir):
-            os.mkdir(dir)
+        if not exists(d):
+            os.mkdir(d)
         for s in self.source_dirs():
             if not exists(s):
                 os.mkdir(s)
@@ -412,14 +412,14 @@
             cp.append(path)
 
 class Suite:
-    def __init__(self, dir, primary):
-        self.dir = dir
+    def __init__(self, d, primary):
+        self.dir = d
         self.projects = []
         self.libs = []
         self.includes = []
         self.commands = None
         self.primary = primary
-        mxDir = join(dir, 'mx')
+        mxDir = join(d, 'mx')
         self._load_env(mxDir)
         self._load_commands(mxDir)
         self._load_includes(mxDir)
@@ -471,10 +471,10 @@
             javaCompliance = attrs.pop('javaCompliance', None)
             subDir = attrs.pop('subDir', None);
             if subDir is None:
-                dir = join(self.dir, name)
+                d = join(self.dir, name)
             else:
-                dir = join(self.dir, subDir, name)
-            p = Project(self, name, srcDirs, deps, javaCompliance, dir)
+                d = join(self.dir, subDir, name)
+            p = Project(self, name, srcDirs, deps, javaCompliance, d)
             p.checkstyleProj = attrs.pop('checkstyle', name)
             p.native = attrs.pop('native', '') == 'true'
             if not p.native and p.javaCompliance is None:
@@ -632,13 +632,13 @@
     else:
         abort('Unknown operating system ' + sys.platform)
 
-def _loadSuite(dir, primary=False):
-    mxDir = join(dir, 'mx')
+def _loadSuite(d, primary=False):
+    mxDir = join(d, 'mx')
     if not exists(mxDir) or not isdir(mxDir):
         return None
-    if not _suites.has_key(dir):
-        suite = Suite(dir, primary)
-        _suites[dir] = suite
+    if not _suites.has_key(d):
+        suite = Suite(d, primary)
+        _suites[d] = suite
         return suite
 
 def suites():
@@ -1463,6 +1463,98 @@
         return args
     return None
 
+def eclipseformat(args):
+    """run the Eclipse Code Formatter on the Java sources
+
+    The exit code 1 denotes that at least one file was modified."""
+
+    parser = ArgumentParser(prog='mx eclipseformat')
+    parser.add_argument('-e', '--eclipse-exe', help='location of the Eclipse executable')
+    parser.add_argument('-C', '--no-backup', action='store_false', dest='backup', help='do not save backup of modified files')
+    parser.add_argument('--projects', action='store', help='comma separated projects to process (omit to process all projects)')
+    
+    args = parser.parse_args(args)
+    if args.eclipse_exe is None:
+        args.eclipse_exe = os.environ.get('ECLIPSE_EXE')
+    if args.eclipse_exe is None:
+        abort('Could not find Eclipse executable. Use -e option or ensure ECLIPSE_EXE environment variable is set.')
+
+    eclipseinit([], buildProcessorJars=False)
+
+    # build list of projects to be processed
+    projects = sorted_deps()
+    if args.projects is not None:
+        projects = [project(name) for name in args.projects.split(',')]
+
+    class Batch:
+        def __init__(self, settingsFile):
+            self.path = settingsFile
+            self.javafiles = list()
+            
+        def settings(self):
+            with open(self.path) as fp:
+                return fp.read()
+
+    class FileInfo:
+        def __init__(self, path):
+            self.path = path
+            with open(path) as fp:
+                self.content = fp.read()
+            self.times = (os.path.getatime(path), os.path.getmtime(path))
+
+        def update(self):
+            with open(self.path) as fp:
+                content = fp.read()
+                if self.content != content:
+                    self.content = content
+                    return True
+            os.utime(self.path, self.times)
+            
+    modified = list()
+    batches = dict() # all sources with the same formatting settings are formatted together
+    for p in projects:
+        if p.native:
+            continue
+        sourceDirs = p.source_dirs()
+        
+        batch = Batch(join(p.dir, '.settings', 'org.eclipse.jdt.core.prefs'))
+
+        if not exists(batch.path):
+            log('[no Eclipse Code Formatter preferences at {0} - skipping]'.format(batch.path))
+            continue
+
+        for sourceDir in sourceDirs:
+            for root, _, files in os.walk(sourceDir):
+                for f in [join(root, name) for name in files if name.endswith('.java')]:
+                    batch.javafiles.append(FileInfo(f))
+        if len(batch.javafiles) == 0:
+            log('[no Java sources in {0} - skipping]'.format(p.name))
+            continue
+
+        res = batches.setdefault(batch.settings(), batch)
+        if res is not batch:
+            res.javafiles = res.javafiles + batch.javafiles
+
+    for batch in batches.itervalues():
+        run([args.eclipse_exe, '-nosplash', '-application', 'org.eclipse.jdt.core.JavaCodeFormatter', '-config', batch.path] + [f.path for f in batch.javafiles])
+        for fi in batch.javafiles:
+            if fi.update():
+                modified.append(fi)
+                
+    log('{0} files were modified'.format(len(modified)))
+    if len(modified) != 0:
+        if args.backup:
+            backup = os.path.abspath('eclipseformat.backup.zip')
+            arcbase = _mainSuite.dir
+            zf = zipfile.ZipFile(backup, 'w', zipfile.ZIP_DEFLATED)
+            for fi in modified:
+                arcname = os.path.relpath(fi.path, arcbase).replace(os.sep, '/')
+                zf.writestr(arcname, fi.content)
+            zf.close()
+            log('Wrote backup of {0} modified files to {1}'.format(len(modified), backup))
+        return 1
+    return 0
+
 def processorjars():
     projects = set([])
     
@@ -2816,6 +2908,7 @@
     'canonicalizeprojects': [canonicalizeprojects, ''],
     'clean': [clean, ''],
     'eclipseinit': [eclipseinit, ''],
+    'eclipseformat': [eclipseformat, ''],
     'findclass': [findclass, ''],
     'help': [help_, '[command]'],
     'ideclean': [ideclean, ''],
--- a/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -675,8 +675,8 @@
     AbstractAssembler::flush();
   }
 
-  inline void emit_long(int);  // shadows AbstractAssembler::emit_long
-  inline void emit_data(int x) { emit_long(x); }
+  inline void emit_int32(int);  // shadows AbstractAssembler::emit_int32
+  inline void emit_data(int x) { emit_int32(x); }
   inline void emit_data(int, RelocationHolder const&);
   inline void emit_data(int, relocInfo::relocType rtype);
   // helper for above fcns
@@ -691,12 +691,12 @@
   inline void add(Register s1, Register s2, Register d );
   inline void add(Register s1, int simm13a, Register d );
 
-  void addcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void addcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void addc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | rs2(s2) ); }
-  void addc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void addccc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void addccc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void addcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | rs2(s2) ); }
+  void addc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void addccc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void addccc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(addc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
 
   // pp 136
@@ -749,76 +749,76 @@
   // at address s1 is swapped with the data in d. If the values are not equal,
   // the the contents of memory at s1 is loaded into d, without the swap.
 
-  void casa(  Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(casa_op3 ) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
-  void casxa( Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(casxa_op3) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
+  void casa(  Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(casa_op3 ) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
+  void casxa( Register s1, Register s2, Register d, int ia = -1 ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(casxa_op3) | rs1(s1) | (ia == -1  ? immed(true) : imm_asi(ia)) | rs2(s2)); }
 
   // pp 152
 
-  void udiv(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | rs2(s2)); }
-  void udiv(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdiv(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | rs2(s2)); }
-  void sdiv(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void udivcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
-  void udivcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdivcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
-  void sdivcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udiv(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | rs2(s2)); }
+  void udiv(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdiv(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | rs2(s2)); }
+  void sdiv(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udivcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
+  void udivcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(udiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdivcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | rs2(s2)); }
+  void sdivcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sdiv_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 155
 
-  void done()  { v9_only();  cti();  emit_long( op(arith_op) | fcn(0) | op3(done_op3) ); }
-  void retry() { v9_only();  cti();  emit_long( op(arith_op) | fcn(1) | op3(retry_op3) ); }
+  void done()  { v9_only();  cti();  emit_int32( op(arith_op) | fcn(0) | op3(done_op3) ); }
+  void retry() { v9_only();  cti();  emit_int32( op(arith_op) | fcn(1) | op3(retry_op3) ); }
 
   // pp 156
 
-  void fadd( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x40 + w) | fs2(s2, w)); }
-  void fsub( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x44 + w) | fs2(s2, w)); }
+  void fadd( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x40 + w) | fs2(s2, w)); }
+  void fsub( FloatRegisterImpl::Width w, FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | fs1(s1, w) | opf(0x44 + w) | fs2(s2, w)); }
 
   // pp 157
 
-  void fcmp(  FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_long( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x50 + w) | fs2(s2, w)); }
-  void fcmpe( FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_long( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x54 + w) | fs2(s2, w)); }
+  void fcmp(  FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_int32( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x50 + w) | fs2(s2, w)); }
+  void fcmpe( FloatRegisterImpl::Width w, CC cc, FloatRegister s1, FloatRegister s2) { v8_no_cc(cc);  emit_int32( op(arith_op) | cmpcc(cc) | op3(fpop2_op3) | fs1(s1, w) | opf(0x54 + w) | fs2(s2, w)); }
 
   // pp 159
 
-  void ftox( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(fpop1_op3) | opf(0x80 + w) | fs2(s, w)); }
-  void ftoi( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_long( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(fpop1_op3) | opf(0xd0 + w) | fs2(s, w)); }
+  void ftox( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(fpop1_op3) | opf(0x80 + w) | fs2(s, w)); }
+  void ftoi( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(fpop1_op3) | opf(0xd0 + w) | fs2(s, w)); }
 
   // pp 160
 
-  void ftof( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw, FloatRegister s, FloatRegister d ) { emit_long( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | opf(0xc0 + sw + dw*4) | fs2(s, sw)); }
+  void ftof( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw, FloatRegister s, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | opf(0xc0 + sw + dw*4) | fs2(s, sw)); }
 
   // pp 161
 
-  void fxtof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x80 + w*4) | fs2(s, FloatRegisterImpl::D)); }
-  void fitof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0xc0 + w*4) | fs2(s, FloatRegisterImpl::S)); }
+  void fxtof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x80 + w*4) | fs2(s, FloatRegisterImpl::D)); }
+  void fitof( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) {             emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0xc0 + w*4) | fs2(s, FloatRegisterImpl::S)); }
 
   // pp 162
 
-  void fmov( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x00 + w) | fs2(s, w)); }
+  void fmov( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x00 + w) | fs2(s, w)); }
 
-  void fneg( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(s, w)); }
+  void fneg( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(s, w)); }
 
   // page 144 sparc v8 architecture (double prec works on v8 if the source and destination registers are the same). fnegs is the only instruction available
   // on v8 to do negation of single, double and quad precision floats.
 
-  void fneg( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(sd, w)); else emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) |  opf(0x05) | fs2(sd, w)); }
+  void fneg( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x04 + w) | fs2(sd, w)); else emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) |  opf(0x05) | fs2(sd, w)); }
 
-  void fabs( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(s, w)); }
+  void fabs( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { v8_s_only(w);  emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(s, w)); }
 
   // page 144 sparc v8 architecture (double prec works on v8 if the source and destination registers are the same). fabss is the only instruction available
   // on v8 to do abs operation on single/double/quad precision floats.
 
-  void fabs( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(sd, w)); else emit_long( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x09) | fs2(sd, w)); }
+  void fabs( FloatRegisterImpl::Width w, FloatRegister sd ) { if (VM_Version::v9_instructions_work()) emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x08 + w) | fs2(sd, w)); else emit_int32( op(arith_op) | fd(sd, w) | op3(fpop1_op3) | opf(0x09) | fs2(sd, w)); }
 
   // pp 163
 
-  void fmul( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x48 + w)         | fs2(s2, w)); }
-  void fmul( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw,  FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | fs1(s1, sw) | opf(0x60 + sw + dw*4) | fs2(s2, sw)); }
-  void fdiv( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x4c + w)         | fs2(s2, w)); }
+  void fmul( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x48 + w)         | fs2(s2, w)); }
+  void fmul( FloatRegisterImpl::Width sw, FloatRegisterImpl::Width dw,  FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, dw) | op3(fpop1_op3) | fs1(s1, sw) | opf(0x60 + sw + dw*4) | fs2(s2, sw)); }
+  void fdiv( FloatRegisterImpl::Width w,                            FloatRegister s1, FloatRegister s2, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w)  | op3(fpop1_op3) | fs1(s1, w)  | opf(0x4c + w)         | fs2(s2, w)); }
 
   // pp 164
 
-  void fsqrt( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { emit_long( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x28 + w) | fs2(s, w)); }
+  void fsqrt( FloatRegisterImpl::Width w, FloatRegister s, FloatRegister d ) { emit_int32( op(arith_op) | fd(d, w) | op3(fpop1_op3) | opf(0x28 + w) | fs2(s, w)); }
 
   // pp 165
 
@@ -827,22 +827,22 @@
 
   // pp 167
 
-  void flushw() { v9_only();  emit_long( op(arith_op) | op3(flushw_op3) ); }
+  void flushw() { v9_only();  emit_int32( op(arith_op) | op3(flushw_op3) ); }
 
   // pp 168
 
-  void illtrap( int const22a) { if (const22a != 0) v9_only();  emit_long( op(branch_op) | u_field(const22a, 21, 0) ); }
+  void illtrap( int const22a) { if (const22a != 0) v9_only();  emit_int32( op(branch_op) | u_field(const22a, 21, 0) ); }
   // v8 unimp == illtrap(0)
 
   // pp 169
 
-  void impdep1( int id1, int const19a ) { v9_only();  emit_long( op(arith_op) | fcn(id1) | op3(impdep1_op3) | u_field(const19a, 18, 0)); }
-  void impdep2( int id1, int const19a ) { v9_only();  emit_long( op(arith_op) | fcn(id1) | op3(impdep2_op3) | u_field(const19a, 18, 0)); }
+  void impdep1( int id1, int const19a ) { v9_only();  emit_int32( op(arith_op) | fcn(id1) | op3(impdep1_op3) | u_field(const19a, 18, 0)); }
+  void impdep2( int id1, int const19a ) { v9_only();  emit_int32( op(arith_op) | fcn(id1) | op3(impdep2_op3) | u_field(const19a, 18, 0)); }
 
   // pp 149 (v8)
 
-  void cpop1( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_long( op(arith_op) | fcn(crd) | op3(impdep1_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
-  void cpop2( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_long( op(arith_op) | fcn(crd) | op3(impdep2_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
+  void cpop1( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_int32( op(arith_op) | fcn(crd) | op3(impdep1_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
+  void cpop2( int opc, int cr1, int cr2, int crd ) { v8_only();  emit_int32( op(arith_op) | fcn(crd) | op3(impdep2_op3) | u_field(cr1, 18, 14) | opf(opc) | u_field(cr2, 4, 0)); }
 
   // pp 170
 
@@ -872,8 +872,8 @@
 
   // 173
 
-  void ldfa(  FloatRegisterImpl::Width w, Register s1, Register s2, int ia, FloatRegister d ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldfa(  FloatRegisterImpl::Width w, Register s1, int simm13a,         FloatRegister d ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldfa(  FloatRegisterImpl::Width w, Register s1, Register s2, int ia, FloatRegister d ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldfa(  FloatRegisterImpl::Width w, Register s1, int simm13a,         FloatRegister d ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 175, lduw is ld on v8
 
@@ -896,22 +896,22 @@
 
   // pp 177
 
-  void ldsba(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldsba(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldsha(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldsha(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldswa(  Register s1, Register s2, int ia, Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldswa(  Register s1, int simm13a,         Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduba(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduba(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduha(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduha(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void lduwa(  Register s1, Register s2, int ia, Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void lduwa(  Register s1, int simm13a,         Register d ) {             emit_long( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldxa(   Register s1, Register s2, int ia, Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldxa(   Register s1, int simm13a,         Register d ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void ldda(   Register s1, Register s2, int ia, Register d ) { v9_dep();   emit_long( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldda(   Register s1, int simm13a,         Register d ) { v9_dep();   emit_long( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldsba(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldsba(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldsha(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldsha(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldswa(  Register s1, Register s2, int ia, Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldswa(  Register s1, int simm13a,         Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduba(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduba(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduha(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduha(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void lduwa(  Register s1, Register s2, int ia, Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void lduwa(  Register s1, int simm13a,         Register d ) {             emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldxa(   Register s1, Register s2, int ia, Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldxa(   Register s1, int simm13a,         Register d ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldda(   Register s1, Register s2, int ia, Register d ) { v9_dep();   emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldda(   Register s1, int simm13a,         Register d ) { v9_dep();   emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3  | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 179
 
@@ -920,111 +920,111 @@
 
   // pp 180
 
-  void ldstuba( Register s1, Register s2, int ia, Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void ldstuba( Register s1, int simm13a,         Register d ) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void ldstuba( Register s1, Register s2, int ia, Register d ) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void ldstuba( Register s1, int simm13a,         Register d ) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 181
 
-  void and3(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | rs2(s2) ); }
-  void and3(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andcc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void andcc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andn(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | rs2(s2) ); }
-  void andn(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void andncc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void andncc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void or3(     Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | rs2(s2) ); }
-  void or3(     Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orcc(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void orcc(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orn(     Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | rs2(s2) ); }
-  void orn(     Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void orncc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void orncc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xor3(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | rs2(s2) ); }
-  void xor3(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xorcc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void xorcc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xnor(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | rs2(s2) ); }
-  void xnor(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void xnorcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void xnorcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void and3(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | rs2(s2) ); }
+  void and3(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andcc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void andcc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(and_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andn(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | rs2(s2) ); }
+  void andn(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void andncc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void andncc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(andn_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void or3(     Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | rs2(s2) ); }
+  void or3(     Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3               ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orcc(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void orcc(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(or_op3   | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orn(     Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | rs2(s2) ); }
+  void orn(     Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void orncc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void orncc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(orn_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xor3(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | rs2(s2) ); }
+  void xor3(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xorcc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void xorcc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xor_op3  | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xnor(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | rs2(s2) ); }
+  void xnor(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void xnorcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void xnorcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(xnor_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 183
 
-  void membar( Membar_mask_bits const7a ) { v9_only(); emit_long( op(arith_op) | op3(membar_op3) | rs1(O7) | immed(true) | u_field( int(const7a), 6, 0)); }
+  void membar( Membar_mask_bits const7a ) { v9_only(); emit_int32( op(arith_op) | op3(membar_op3) | rs1(O7) | immed(true) | u_field( int(const7a), 6, 0)); }
 
   // pp 185
 
-  void fmov( FloatRegisterImpl::Width w, Condition c,  bool floatCC, CC cca, FloatRegister s2, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop2_op3) | cond_mov(c) | opf_cc(cca, floatCC) | opf_low6(w) | fs2(s2, w)); }
+  void fmov( FloatRegisterImpl::Width w, Condition c,  bool floatCC, CC cca, FloatRegister s2, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop2_op3) | cond_mov(c) | opf_cc(cca, floatCC) | opf_low6(w) | fs2(s2, w)); }
 
   // pp 189
 
-  void fmov( FloatRegisterImpl::Width w, RCondition c, Register s1,  FloatRegister s2, FloatRegister d ) { v9_only();  emit_long( op(arith_op) | fd(d, w) | op3(fpop2_op3) | rs1(s1) | rcond(c) | opf_low5(4 + w) | fs2(s2, w)); }
+  void fmov( FloatRegisterImpl::Width w, RCondition c, Register s1,  FloatRegister s2, FloatRegister d ) { v9_only();  emit_int32( op(arith_op) | fd(d, w) | op3(fpop2_op3) | rs1(s1) | rcond(c) | opf_low5(4 + w) | fs2(s2, w)); }
 
   // pp 191
 
-  void movcc( Condition c, bool floatCC, CC cca, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | rs2(s2) ); }
-  void movcc( Condition c, bool floatCC, CC cca, int simm11a, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | immed(true) | simm(simm11a, 11) ); }
+  void movcc( Condition c, bool floatCC, CC cca, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | rs2(s2) ); }
+  void movcc( Condition c, bool floatCC, CC cca, int simm11a, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movcc_op3) | mov_cc(cca, floatCC) | cond_mov(c) | immed(true) | simm(simm11a, 11) ); }
 
   // pp 195
 
-  void movr( RCondition c, Register s1, Register s2,  Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | rs2(s2) ); }
-  void movr( RCondition c, Register s1, int simm10a,  Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | immed(true) | simm(simm10a, 10) ); }
+  void movr( RCondition c, Register s1, Register s2,  Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | rs2(s2) ); }
+  void movr( RCondition c, Register s1, int simm10a,  Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(movr_op3) | rs1(s1) | rcond(c) | immed(true) | simm(simm10a, 10) ); }
 
   // pp 196
 
-  void mulx(  Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | rs2(s2) ); }
-  void mulx(  Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void sdivx( Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | rs2(s2) ); }
-  void sdivx( Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void udivx( Register s1, Register s2, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | rs2(s2) ); }
-  void udivx( Register s1, int simm13a, Register d ) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void mulx(  Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | rs2(s2) ); }
+  void mulx(  Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(mulx_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sdivx( Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | rs2(s2) ); }
+  void sdivx( Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(sdivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void udivx( Register s1, Register s2, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | rs2(s2) ); }
+  void udivx( Register s1, int simm13a, Register d ) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(udivx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 197
 
-  void umul(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | rs2(s2) ); }
-  void umul(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void smul(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | rs2(s2) ); }
-  void smul(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void umulcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void umulcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void smulcc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void smulcc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void umul(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | rs2(s2) ); }
+  void umul(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void smul(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | rs2(s2) ); }
+  void smul(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void umulcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void umulcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(umul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void smulcc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void smulcc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(smul_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 199
 
-  void mulscc(   Register s1, Register s2, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | rs2(s2) ); }
-  void mulscc(   Register s1, int simm13a, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void mulscc(   Register s1, Register s2, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | rs2(s2) ); }
+  void mulscc(   Register s1, int simm13a, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(mulscc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 201
 
-  void nop() { emit_long( op(branch_op) | op2(sethi_op2) ); }
+  void nop() { emit_int32( op(branch_op) | op2(sethi_op2) ); }
 
 
   // pp 202
 
-  void popc( Register s,  Register d) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(popc_op3) | rs2(s)); }
-  void popc( int simm13a, Register d) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(popc_op3) | immed(true) | simm(simm13a, 13)); }
+  void popc( Register s,  Register d) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(popc_op3) | rs2(s)); }
+  void popc( int simm13a, Register d) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(popc_op3) | immed(true) | simm(simm13a, 13)); }
 
   // pp 203
 
-  void prefetch(   Register s1, Register s2, PrefetchFcn f) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
+  void prefetch(   Register s1, Register s2, PrefetchFcn f) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | rs2(s2) ); }
   void prefetch(   Register s1, int simm13a, PrefetchFcn f) { v9_only();  emit_data( op(ldst_op) | fcn(f) | op3(prefetch_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-  void prefetcha(  Register s1, Register s2, int ia, PrefetchFcn f ) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void prefetcha(  Register s1, int simm13a,         PrefetchFcn f ) { v9_only();  emit_long( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void prefetcha(  Register s1, Register s2, int ia, PrefetchFcn f ) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void prefetcha(  Register s1, int simm13a,         PrefetchFcn f ) { v9_only();  emit_int32( op(ldst_op) | fcn(f) | op3(prefetch_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 208
 
   // not implementing read privileged register
 
-  inline void rdy(    Register d) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(0, 18, 14)); }
-  inline void rdccr(  Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(2, 18, 14)); }
-  inline void rdasi(  Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(3, 18, 14)); }
-  inline void rdtick( Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(4, 18, 14)); } // Spoon!
-  inline void rdpc(   Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(5, 18, 14)); }
-  inline void rdfprs( Register d) { v9_only(); emit_long( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(6, 18, 14)); }
+  inline void rdy(    Register d) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(0, 18, 14)); }
+  inline void rdccr(  Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(2, 18, 14)); }
+  inline void rdasi(  Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(3, 18, 14)); }
+  inline void rdtick( Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(4, 18, 14)); } // Spoon!
+  inline void rdpc(   Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(5, 18, 14)); }
+  inline void rdfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rd(d) | op3(rdreg_op3) | u_field(6, 18, 14)); }
 
   // pp 213
 
@@ -1033,47 +1033,47 @@
 
   // pp 214
 
-  void save(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | rs2(s2) ); }
+  void save(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | rs2(s2) ); }
   void save(    Register s1, int simm13a, Register d ) {
     // make sure frame is at least large enough for the register save area
     assert(-simm13a >= 16 * wordSize, "frame too small");
-    emit_long( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) );
+    emit_int32( op(arith_op) | rd(d) | op3(save_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) );
   }
 
-  void restore( Register s1 = G0,  Register s2 = G0, Register d = G0 ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | rs2(s2) ); }
-  void restore( Register s1,       int simm13a,      Register d      ) { emit_long( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void restore( Register s1 = G0,  Register s2 = G0, Register d = G0 ) { emit_int32( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | rs2(s2) ); }
+  void restore( Register s1,       int simm13a,      Register d      ) { emit_int32( op(arith_op) | rd(d) | op3(restore_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 216
 
-  void saved()    { v9_only();  emit_long( op(arith_op) | fcn(0) | op3(saved_op3)); }
-  void restored() { v9_only();  emit_long( op(arith_op) | fcn(1) | op3(saved_op3)); }
+  void saved()    { v9_only();  emit_int32( op(arith_op) | fcn(0) | op3(saved_op3)); }
+  void restored() { v9_only();  emit_int32( op(arith_op) | fcn(1) | op3(saved_op3)); }
 
   // pp 217
 
   inline void sethi( int imm22a, Register d, RelocationHolder const& rspec = RelocationHolder() );
   // pp 218
 
-  void sll(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void sll(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
-  void srl(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void srl(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
-  void sra(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
-  void sra(  Register s1, int imm5a,   Register d ) { emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void sll(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void sll(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void srl(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void srl(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
+  void sra(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | rs2(s2) ); }
+  void sra(  Register s1, int imm5a,   Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(0) | immed(true) | u_field(imm5a, 4, 0) ); }
 
-  void sllx( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void sllx( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
-  void srlx( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void srlx( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
-  void srax( Register s1, Register s2, Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
-  void srax( Register s1, int imm6a,   Register d ) { v9_only();  emit_long( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void sllx( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void sllx( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sll_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void srlx( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void srlx( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(srl_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
+  void srax( Register s1, Register s2, Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | rs2(s2) ); }
+  void srax( Register s1, int imm6a,   Register d ) { v9_only();  emit_int32( op(arith_op) | rd(d) | op3(sra_op3) | rs1(s1) | sx(1) | immed(true) | u_field(imm6a, 5, 0) ); }
 
   // pp 220
 
-  void sir( int simm13a ) { emit_long( op(arith_op) | fcn(15) | op3(sir_op3) | immed(true) | simm(simm13a, 13)); }
+  void sir( int simm13a ) { emit_int32( op(arith_op) | fcn(15) | op3(sir_op3) | immed(true) | simm(simm13a, 13)); }
 
   // pp 221
 
-  void stbar() { emit_long( op(arith_op) | op3(membar_op3) | u_field(15, 18, 14)); }
+  void stbar() { emit_int32( op(arith_op) | op3(membar_op3) | u_field(15, 18, 14)); }
 
   // pp 222
 
@@ -1087,8 +1087,8 @@
 
   //  pp 224
 
-  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2, int ia ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a         ) { v9_only();  emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2, int ia ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stfa(  FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a         ) { v9_only();  emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3 | alt_bit_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // p 226
 
@@ -1105,16 +1105,16 @@
 
   // pp 177
 
-  void stba(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stba(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stha(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stha(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stwa(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stwa(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stxa(  Register d, Register s1, Register s2, int ia ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stxa(  Register d, Register s1, int simm13a         ) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void stda(  Register d, Register s1, Register s2, int ia ) {             emit_long( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void stda(  Register d, Register s1, int simm13a         ) {             emit_long( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stba(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stba(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(stb_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stha(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stha(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(sth_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stwa(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stwa(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(stw_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stxa(  Register d, Register s1, Register s2, int ia ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stxa(  Register d, Register s1, int simm13a         ) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void stda(  Register d, Register s1, Register s2, int ia ) {             emit_int32( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void stda(  Register d, Register s1, int simm13a         ) {             emit_int32( op(ldst_op) | rd(d) | op3(std_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 97 (v8)
 
@@ -1129,15 +1129,15 @@
 
   // pp 230
 
-  void sub(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | rs2(s2) ); }
-  void sub(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void sub(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | rs2(s2) ); }
+  void sub(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3              ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
-  void subcc(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | rs2(s2) ); }
-  void subcc(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void subc(   Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | rs2(s2) ); }
-  void subc(   Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void subccc( Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
-  void subccc( Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subcc(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | rs2(s2) ); }
+  void subcc(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(sub_op3 | cc_bit_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subc(   Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | rs2(s2) ); }
+  void subc(   Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3             ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void subccc( Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | rs2(s2) ); }
+  void subccc( Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(subc_op3 | cc_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 231
 
@@ -1146,55 +1146,55 @@
 
   // pp 232
 
-  void swapa(   Register s1, Register s2, int ia, Register d ) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
-  void swapa(   Register s1, int simm13a,         Register d ) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void swapa(   Register s1, Register s2, int ia, Register d ) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | imm_asi(ia) | rs2(s2) ); }
+  void swapa(   Register s1, int simm13a,         Register d ) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3 | alt_bit_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 234, note op in book is wrong, see pp 268
 
-  void taddcc(    Register s1, Register s2, Register d ) {            emit_long( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | rs2(s2) ); }
-  void taddcc(    Register s1, int simm13a, Register d ) {            emit_long( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void taddcctv(  Register s1, Register s2, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | rs2(s2) ); }
-  void taddcctv(  Register s1, int simm13a, Register d ) { v9_dep();  emit_long( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void taddcc(    Register s1, Register s2, Register d ) {            emit_int32( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | rs2(s2) ); }
+  void taddcc(    Register s1, int simm13a, Register d ) {            emit_int32( op(arith_op) | rd(d) | op3(taddcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void taddcctv(  Register s1, Register s2, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | rs2(s2) ); }
+  void taddcctv(  Register s1, int simm13a, Register d ) { v9_dep();  emit_int32( op(arith_op) | rd(d) | op3(taddcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 235
 
-  void tsubcc(    Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | rs2(s2) ); }
-  void tsubcc(    Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
-  void tsubcctv(  Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | rs2(s2) ); }
-  void tsubcctv(  Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void tsubcc(    Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | rs2(s2) ); }
+  void tsubcc(    Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+  void tsubcctv(  Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | rs2(s2) ); }
+  void tsubcctv(  Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(tsubcctv_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
   // pp 237
 
-  void trap( Condition c, CC cc, Register s1, Register s2 ) { v8_no_cc(cc);  emit_long( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | rs2(s2)); }
-  void trap( Condition c, CC cc, Register s1, int trapa   ) { v8_no_cc(cc);  emit_long( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | immed(true) | u_field(trapa, 6, 0)); }
+  void trap( Condition c, CC cc, Register s1, Register s2 ) { v8_no_cc(cc);  emit_int32( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | rs2(s2)); }
+  void trap( Condition c, CC cc, Register s1, int trapa   ) { v8_no_cc(cc);  emit_int32( op(arith_op) | cond(c) | op3(trap_op3) | rs1(s1) | trapcc(cc) | immed(true) | u_field(trapa, 6, 0)); }
   // simple uncond. trap
   void trap( int trapa ) { trap( always, icc, G0, trapa ); }
 
   // pp 239 omit write priv register for now
 
-  inline void wry(    Register d) { v9_dep();  emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(0, 29, 25)); }
-  inline void wrccr(Register s) { v9_only(); emit_long( op(arith_op) | rs1(s) | op3(wrreg_op3) | u_field(2, 29, 25)); }
-  inline void wrccr(Register s, int simm13a) { v9_only(); emit_long( op(arith_op) |
+  inline void wry(    Register d) { v9_dep();  emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(0, 29, 25)); }
+  inline void wrccr(Register s) { v9_only(); emit_int32( op(arith_op) | rs1(s) | op3(wrreg_op3) | u_field(2, 29, 25)); }
+  inline void wrccr(Register s, int simm13a) { v9_only(); emit_int32( op(arith_op) |
                                                                            rs1(s) |
                                                                            op3(wrreg_op3) |
                                                                            u_field(2, 29, 25) |
                                                                            immed(true) |
                                                                            simm(simm13a, 13)); }
-  inline void wrasi(Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(3, 29, 25)); }
+  inline void wrasi(Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(3, 29, 25)); }
   // wrasi(d, imm) stores (d xor imm) to asi
-  inline void wrasi(Register d, int simm13a) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) |
+  inline void wrasi(Register d, int simm13a) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) |
                                                u_field(3, 29, 25) | immed(true) | simm(simm13a, 13)); }
-  inline void wrfprs( Register d) { v9_only(); emit_long( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
+  inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
 
 
   // VIS3 instructions
 
-  void movstosw( FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
-  void movstouw( FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstouw_opf) | fs2(s, FloatRegisterImpl::S)); }
-  void movdtox(  FloatRegister s, Register d ) { vis3_only();  emit_long( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mdtox_opf) | fs2(s, FloatRegisterImpl::D)); }
+  void movstosw( FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
+  void movstouw( FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstouw_opf) | fs2(s, FloatRegisterImpl::S)); }
+  void movdtox(  FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mdtox_opf) | fs2(s, FloatRegisterImpl::D)); }
 
-  void movwtos( Register s, FloatRegister d ) { vis3_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); }
-  void movxtod( Register s, FloatRegister d ) { vis3_only();  emit_long( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); }
+  void movwtos( Register s, FloatRegister d ) { vis3_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::S) | op3(mftoi_op3) | opf(mwtos_opf) | rs2(s)); }
+  void movxtod( Register s, FloatRegister d ) { vis3_only();  emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(mftoi_op3) | opf(mxtod_opf) | rs2(s)); }
 
   // Creation
   Assembler(CodeBuffer* code) : AbstractAssembler(code) {
--- a/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -35,24 +35,24 @@
 # endif
 }
 
-inline void Assembler::emit_long(int x) {
+inline void Assembler::emit_int32(int x) {
   check_delay();
-  AbstractAssembler::emit_long(x);
+  AbstractAssembler::emit_int32(x);
 }
 
 inline void Assembler::emit_data(int x, relocInfo::relocType rtype) {
   relocate(rtype);
-  emit_long(x);
+  emit_int32(x);
 }
 
 inline void Assembler::emit_data(int x, RelocationHolder const& rspec) {
   relocate(rspec);
-  emit_long(x);
+  emit_int32(x);
 }
 
 
-inline void Assembler::add(Register s1, Register s2, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
-inline void Assembler::add(Register s1, int simm13a, Register d ) { emit_long( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
+inline void Assembler::add(Register s1, Register s2, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::add(Register s1, int simm13a, Register d ) { emit_int32( op(arith_op) | rd(d) | op3(add_op3) | rs1(s1) | immed(true) | simm(simm13a, 13) ); }
 
 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, address d, relocInfo::relocType rt ) { v9_only();  cti();  emit_data( op(branch_op) | annul(a) | cond(c) | op2(bpr_op2) | wdisp16(intptr_t(d), intptr_t(pc())) | predict(p) | rs1(s1), rt);  has_delay_slot(); }
 inline void Assembler::bpr( RCondition c, bool a, Predict p, Register s1, Label& L) { bpr( c, a, p, s1, target(L)); }
@@ -79,93 +79,93 @@
 inline void Assembler::call( address d,  relocInfo::relocType rt ) { cti();  emit_data( op(call_op) | wdisp(intptr_t(d), intptr_t(pc()), 30), rt);  has_delay_slot(); assert(rt != relocInfo::virtual_call_type, "must use virtual_call_Relocation::spec"); }
 inline void Assembler::call( Label& L,   relocInfo::relocType rt ) { call( target(L), rt); }
 
-inline void Assembler::flush( Register s1, Register s2) { emit_long( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
+inline void Assembler::flush( Register s1, Register s2) { emit_int32( op(arith_op) | op3(flush_op3) | rs1(s1) | rs2(s2)); }
 inline void Assembler::flush( Register s1, int simm13a) { emit_data( op(arith_op) | op3(flush_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::jmpl( Register s1, Register s2, Register d ) { cti();  emit_long( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
+inline void Assembler::jmpl( Register s1, Register s2, Register d ) { cti();  emit_int32( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
 inline void Assembler::jmpl( Register s1, int simm13a, Register d, RelocationHolder const& rspec ) { cti();  emit_data( op(arith_op) | rd(d) | op3(jmpl_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec);  has_delay_slot(); }
 
-inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, Register s2, FloatRegister d) { emit_int32( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldf(FloatRegisterImpl::Width w, Register s1, int simm13a, FloatRegister d, RelocationHolder const& rspec) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(ldf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13), rspec); }
 
-inline void Assembler::ldfsr(  Register s1, Register s2) { v9_dep();   emit_long( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldfsr(  Register s1, Register s2) { v9_dep();   emit_int32( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldfsr(  Register s1, int simm13a) { v9_dep();   emit_data( op(ldst_op) |             op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldxfsr( Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldxfsr( Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldxfsr( Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(G1)    | op3(ldfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldc(   Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldc(   Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldc(   Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(ldc_op3  ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lddc(  Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lddc(  Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lddc(  Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(lddc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldcsr( Register s1, Register s2, int crd) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldcsr( Register s1, int simm13a, int crd) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(ldcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldsb(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsb(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsb(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldsh(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsh(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsh(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldsw(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldsw(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldsw(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldsw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldub(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldub(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldub(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lduh(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lduh(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lduh(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduh_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::lduw(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::lduw(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::lduw(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(lduw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldx(   Register s1, Register s2, Register d) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldx(   Register s1, Register s2, Register d) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldx(   Register s1, int simm13a, Register d) { v9_only();  emit_data( op(ldst_op) | rd(d) | op3(ldx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::ldd(   Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldd(   Register s1, Register s2, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_int32( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldd(   Register s1, int simm13a, Register d) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(ldd_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::ldstub(  Register s1, Register s2, Register d) { emit_long( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::ldstub(  Register s1, Register s2, Register d) { emit_int32( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::ldstub(  Register s1, int simm13a, Register d) { emit_data( op(ldst_op) | rd(d) | op3(ldstub_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::rett( Register s1, Register s2                         ) { cti();  emit_long( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
+inline void Assembler::rett( Register s1, Register s2                         ) { cti();  emit_int32( op(arith_op) | op3(rett_op3) | rs1(s1) | rs2(s2));  has_delay_slot(); }
 inline void Assembler::rett( Register s1, int simm13a, relocInfo::relocType rt) { cti();  emit_data( op(arith_op) | op3(rett_op3) | rs1(s1) | immed(true) | simm(simm13a, 13), rt);  has_delay_slot(); }
 
 inline void Assembler::sethi( int imm22a, Register d, RelocationHolder const& rspec ) { emit_data( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(imm22a), rspec); }
 
   // pp 222
 
-inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2) { emit_long( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, Register s2) { emit_int32( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stf(    FloatRegisterImpl::Width w, FloatRegister d, Register s1, int simm13a) { emit_data( op(ldst_op) | fd(d, w) | alt_op3(stf_op3, w) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
-inline void Assembler::stfsr(  Register s1, Register s2) { v9_dep();   emit_long( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stfsr(  Register s1, Register s2) { v9_dep();   emit_int32( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stfsr(  Register s1, int simm13a) { v9_dep();   emit_data( op(ldst_op) |             op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stxfsr( Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stxfsr( Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stxfsr( Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(G1)    | op3(stfsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
   // p 226
 
-inline void Assembler::stb(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stb(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stb(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stb_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::sth(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::sth(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::sth(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(sth_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stw(  Register d, Register s1, Register s2) { emit_long( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stw(  Register d, Register s1, Register s2) { emit_int32( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stw(  Register d, Register s1, int simm13a) { emit_data( op(ldst_op) | rd(d) | op3(stw_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 
-inline void Assembler::stx(  Register d, Register s1, Register s2) { v9_only();  emit_long( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stx(  Register d, Register s1, Register s2) { v9_only();  emit_int32( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stx(  Register d, Register s1, int simm13a) { v9_only();  emit_data( op(ldst_op) | rd(d) | op3(stx_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::std(  Register d, Register s1, Register s2) { v9_dep(); assert(d->is_even(), "not even"); emit_long( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::std(  Register d, Register s1, Register s2) { v9_dep(); assert(d->is_even(), "not even"); emit_int32( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::std(  Register d, Register s1, int simm13a) { v9_dep(); assert(d->is_even(), "not even"); emit_data( op(ldst_op) | rd(d) | op3(std_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 // v8 p 99
 
-inline void Assembler::stc(    int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stc(    int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stc(    int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stc_op3 ) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stdc(   int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stdc(   int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stdc(   int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stdc_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stcsr(  int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stcsr(  int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stcsr(  int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stcsr_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
-inline void Assembler::stdcq(  int crd, Register s1, Register s2) { v8_only();  emit_long( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::stdcq(  int crd, Register s1, Register s2) { v8_only();  emit_int32( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::stdcq(  int crd, Register s1, int simm13a) { v8_only();  emit_data( op(ldst_op) | fcn(crd) | op3(stdcq_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 // pp 231
 
-inline void Assembler::swap(    Register s1, Register s2, Register d) { v9_dep();  emit_long( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
+inline void Assembler::swap(    Register s1, Register s2, Register d) { v9_dep();  emit_int32( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | rs2(s2) ); }
 inline void Assembler::swap(    Register s1, int simm13a, Register d) { v9_dep();  emit_data( op(ldst_op) | rd(d) | op3(swap_op3) | rs1(s1) | immed(true) | simm(simm13a, 13)); }
 
 #endif // CPU_SPARC_VM_ASSEMBLER_SPARC_INLINE_HPP
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -298,7 +298,7 @@
     for (int i = 0; i < _bytes_to_copy; i++) {
       address ptr = (address)(_pc_start + i);
       int a_byte = (*ptr) & 0xFF;
-      __ a_byte (a_byte);
+      __ emit_int8 (a_byte);
     }
   }
 
@@ -340,10 +340,10 @@
   int being_initialized_entry_offset = __ offset() - being_initialized_entry + sizeof_patch_record;
 
   // Emit the patch record.  We need to emit a full word, so emit an extra empty byte
-  __ a_byte(0);
-  __ a_byte(being_initialized_entry_offset);
-  __ a_byte(bytes_to_skip);
-  __ a_byte(_bytes_to_copy);
+  __ emit_int8(0);
+  __ emit_int8(being_initialized_entry_offset);
+  __ emit_int8(bytes_to_skip);
+  __ emit_int8(_bytes_to_copy);
   address patch_info_pc = __ pc();
   assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
 
--- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -137,7 +137,7 @@
   }
   __ ret();                           // return from interpreter activation
   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
@@ -232,7 +232,7 @@
   }
   __ retl();                          // return from interpreter activation
   __ delayed()->nop();                // schedule this better
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
@@ -582,7 +582,9 @@
   // the following temporary registers are used during frame creation
   const Register Gtmp1 = G3_scratch ;
   const Register Gtmp2 = G1_scratch;
-  const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
+  const Register RconstMethod = Gtmp1;
+  const Address constMethod(G5_method, 0, in_bytes(Method::const_offset()));
+  const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
 
   bool inc_counter  = UseCompiler || CountCompiledCalls;
 
@@ -618,6 +620,7 @@
   }
 #endif // ASSERT
 
+  __ ld_ptr(constMethod, RconstMethod);
   __ lduh(size_of_parameters, Gtmp1);
   __ sll(Gtmp1, LogBytesPerWord, Gtmp2);       // parameter size in bytes
   __ add(Gargs, Gtmp2, Gargs);                 // points to first local + BytesPerWord
@@ -1047,8 +1050,6 @@
   const Register Gtmp = G3_scratch;
   const Address constMethod       (G5_method, 0, in_bytes(Method::const_offset()));
   const Address access_flags      (G5_method, 0, in_bytes(Method::access_flags_offset()));
-  const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
-  const Address size_of_locals    (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
 
   // slop factor is two extra slots on the expression stack so that
   // we always have room to store a result when returning from a call without parameters
@@ -1066,6 +1067,9 @@
   // Now compute new frame size
 
   if (native) {
+    const Register RconstMethod = Gtmp;
+    const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
+    __ ld_ptr(constMethod, RconstMethod);
     __ lduh( size_of_parameters, Gtmp );
     __ calc_mem_param_words(Gtmp, Gtmp);     // space for native call parameters passed on the stack in words
   } else {
@@ -1236,9 +1240,13 @@
     }
     if (init_value != noreg) {
       Label clear_loop;
+      const Register RconstMethod = O1;
+      const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
+      const Address size_of_locals    (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset()));
 
       // NOTE: If you change the frame layout, this code will need to
       // be updated!
+      __ ld_ptr( constMethod, RconstMethod );
       __ lduh( size_of_locals, O2 );
       __ lduh( size_of_parameters, O1 );
       __ sll( O2, LogBytesPerWord, O2);
@@ -1465,7 +1473,7 @@
     __ brx(Assembler::equal, false, Assembler::pt, skip);         \
     __ delayed()->nop();                                          \
     __ breakpoint_trap();                                         \
-    __ emit_long(marker);                                         \
+    __ emit_int32(marker);                                         \
     __ bind(skip);                                                \
   }
 #else
@@ -1483,13 +1491,16 @@
 //
 //  assert_different_registers(state, prev_state);
   const Register Gtmp = G3_scratch;
+  const RconstMethod = G3_scratch;
   const Register tmp = O2;
-  const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
-  const Address size_of_locals    (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
+  const Address constMethod(G5_method, 0, in_bytes(Method::const_offset()));
+  const Address size_of_parameters(RconstMethod, 0, in_bytes(ConstMethod::size_of_parameters_offset()));
+  const Address size_of_locals    (RconstMethod, 0, in_bytes(ConstMethod::size_of_locals_offset()));
 
+  __ ld_ptr(constMethod, RconstMethod);
   __ lduh(size_of_parameters, tmp);
-  __ sll(tmp, LogBytesPerWord, Gtmp);       // parameter size in bytes
-  __ add(args, Gtmp, Gargs);                // points to first local + BytesPerWord
+  __ sll(tmp, LogBytesPerWord, Gargs);       // parameter size in bytes
+  __ add(args, Gargs, Gargs);                // points to first local + BytesPerWord
   // NEW
   __ add(Gargs, -wordSize, Gargs);             // points to first local[0]
   // determine extra space for non-argument locals & adjust caller's SP
@@ -1541,8 +1552,6 @@
 
   const Address constMethod       (G5_method, 0, in_bytes(Method::const_offset()));
   const Address access_flags      (G5_method, 0, in_bytes(Method::access_flags_offset()));
-  const Address size_of_parameters(G5_method, 0, in_bytes(Method::size_of_parameters_offset()));
-  const Address size_of_locals    (G5_method, 0, in_bytes(Method::size_of_locals_offset()));
 
   address entry_point = __ pc();
   __ mov(G0, prevState);                                                 // no current activation
@@ -1750,7 +1759,9 @@
 
   __ ld_ptr(STATE(_result._to_call._callee), L4_scratch);                        // called method
   __ ld_ptr(STATE(_stack), L1_scratch);                                          // get top of java expr stack
-  __ lduh(L4_scratch, in_bytes(Method::size_of_parameters_offset()), L2_scratch); // get parameter size
+  // get parameter size
+  __ ld_ptr(L4_scratch, in_bytes(Method::const_offset()), L2_scratch);
+  __ lduh(L2_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), L2_scratch);
   __ sll(L2_scratch, LogBytesPerWord, L2_scratch     );                           // parameter size in bytes
   __ add(L1_scratch, L2_scratch, L1_scratch);                                      // stack destination for result
   __ ld(L4_scratch, in_bytes(Method::result_index_offset()), L3_scratch); // called method result type index
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -100,34 +100,6 @@
 bool AbstractAssembler::pd_check_instruction_mark() { return false; }
 #endif
 
-
-void MacroAssembler::print_instruction(int inst) {
-  const char* s;
-  switch (inv_op(inst)) {
-  default:         s = "????"; break;
-  case call_op:    s = "call"; break;
-  case branch_op:
-    switch (inv_op2(inst)) {
-      case fb_op2:     s = "fb";   break;
-      case fbp_op2:    s = "fbp";  break;
-      case br_op2:     s = "br";   break;
-      case bp_op2:     s = "bp";   break;
-      case cb_op2:     s = "cb";   break;
-      case bpr_op2: {
-        if (is_cbcond(inst)) {
-          s = is_cxb(inst) ? "cxb" : "cwb";
-        } else {
-          s = "bpr";
-        }
-        break;
-      }
-      default:         s = "????"; break;
-    }
-  }
-  ::tty->print("%s", s);
-}
-
-
 // Patch instruction inst at offset inst_pos to refer to dest_pos
 // and return the resulting instruction.
 // We should have pcs, not offsets, but since all is relative, it will work out
@@ -1252,7 +1224,7 @@
   // Relocation with special format (see relocInfo_sparc.hpp).
   relocate(rspec, 1);
   // Assembler::sethi(0x3fffff, d);
-  emit_long( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(0x3fffff) );
+  emit_int32( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(0x3fffff) );
   // Don't add relocation for 'add'. Do patching during 'sethi' processing.
   add(d, 0x3ff, d);
 
@@ -1268,7 +1240,7 @@
   // Relocation with special format (see relocInfo_sparc.hpp).
   relocate(rspec, 1);
   // Assembler::sethi(encoded_k, d);
-  emit_long( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(encoded_k) );
+  emit_int32( op(branch_op) | rd(d) | op2(sethi_op2) | hi22(encoded_k) );
   // Don't add relocation for 'add'. Do patching during 'sethi' processing.
   add(d, low10(encoded_k), d);
 
--- a/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -603,7 +603,6 @@
   friend class Label;
 
  protected:
-  static void print_instruction(int inst);
   static int  patched_branch(int dest_pos, int inst, int inst_pos);
   static int  branch_destination(int inst, int pos);
 
@@ -759,9 +758,6 @@
   // Required platform-specific helpers for Label::patch_instructions.
   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
   void pd_patch_instruction(address branch, address target);
-#ifndef PRODUCT
-  static void pd_print_patched_instruction(address branch);
-#endif
 
   // sethi Macro handles optimizations and relocations
 private:
--- a/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -43,14 +43,6 @@
   stub_inst = patched_branch(target - branch, stub_inst, 0);
 }
 
-#ifndef PRODUCT
-inline void MacroAssembler::pd_print_patched_instruction(address branch) {
-  jint stub_inst = *(jint*) branch;
-  print_instruction(stub_inst);
-  ::tty->print("%s", " (unresolved)");
-}
-#endif // PRODUCT
-
 // Use the right loads/stores for the platform
 inline void MacroAssembler::ld_ptr( Register s1, Register s2, Register d ) {
 #ifdef _LP64
--- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -171,7 +171,8 @@
 
   if (VerifyMethodHandles && !for_compiler_entry) {
     // make sure recv is already on stack
-    __ load_sized_value(Address(method_temp, Method::size_of_parameters_offset()),
+    __ ld_ptr(method_temp, in_bytes(Method::const_offset()), temp2);
+    __ load_sized_value(Address(temp2, ConstMethod::size_of_parameters_offset()),
                         temp2,
                         sizeof(u2), /*is_signed*/ false);
     // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
@@ -233,7 +234,8 @@
   int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
   assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
   if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
-    __ load_sized_value(Address(G5_method, Method::size_of_parameters_offset()),
+    __ ld_ptr(G5_method, in_bytes(Method::const_offset()), O4_param_size);
+    __ load_sized_value(Address(O4_param_size, ConstMethod::size_of_parameters_offset()),
                         O4_param_size,
                         sizeof(u2), /*is_signed*/ false);
     // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
--- a/src/cpu/sparc/vm/sparc.ad	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/sparc.ad	Fri Feb 01 17:06:26 2013 +0100
@@ -10224,7 +10224,7 @@
 
 //---------- Zeros Count Instructions ------------------------------------------
 
-instruct countLeadingZerosI(iRegI dst, iRegI src, iRegI tmp, flagsReg cr) %{
+instruct countLeadingZerosI(iRegIsafe dst, iRegI src, iRegI tmp, flagsReg cr) %{
   predicate(UsePopCountInstruction);  // See Matcher::match_rule_supported
   match(Set dst (CountLeadingZerosI src));
   effect(TEMP dst, TEMP tmp, KILL cr);
@@ -10321,7 +10321,7 @@
   ins_pipe(ialu_reg);
 %}
 
-instruct countTrailingZerosI(iRegI dst, iRegI src, flagsReg cr) %{
+instruct countTrailingZerosI(iRegIsafe dst, iRegI src, flagsReg cr) %{
   predicate(UsePopCountInstruction);  // See Matcher::match_rule_supported
   match(Set dst (CountTrailingZerosI src));
   effect(TEMP dst, KILL cr);
@@ -10364,19 +10364,21 @@
 
 //---------- Population Count Instructions -------------------------------------
 
-instruct popCountI(iRegI dst, iRegI src) %{
+instruct popCountI(iRegIsafe dst, iRegI src) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountI src));
 
-  format %{ "POPC   $src, $dst" %}
-  ins_encode %{
-    __ popc($src$$Register, $dst$$Register);
+  format %{ "SRL    $src, G0, $dst\t! clear upper word for 64 bit POPC\n\t"
+            "POPC   $dst, $dst" %}
+  ins_encode %{
+    __ srl($src$$Register, G0, $dst$$Register);
+    __ popc($dst$$Register, $dst$$Register);
   %}
   ins_pipe(ialu_reg);
 %}
 
 // Note: Long.bitCount(long) returns an int.
-instruct popCountL(iRegI dst, iRegL src) %{
+instruct popCountL(iRegIsafe dst, iRegL src) %{
   predicate(UsePopCountInstruction);
   match(Set dst (PopCountL src));
 
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -259,7 +259,7 @@
   }
   __ ret();                           // return from interpreter activation
   __ delayed()->restore(I5_savedSP, G0, SP);  // remove interpreter frame
-  NOT_PRODUCT(__ emit_long(0);)       // marker for disassembly
+  NOT_PRODUCT(__ emit_int32(0);)       // marker for disassembly
   return entry;
 }
 
@@ -434,7 +434,7 @@
 
   // the frame is greater than one page in size, so check against
   // the bottom of the stack
-  __ cmp_and_brx_short(SP, Rscratch, Assembler::greater, Assembler::pt, after_frame_check);
+  __ cmp_and_brx_short(SP, Rscratch, Assembler::greaterUnsigned, Assembler::pt, after_frame_check);
 
   // the stack will overflow, throw an exception
 
@@ -494,9 +494,6 @@
   // (gri - 2/25/2000)
 
 
-  const Address size_of_parameters(G5_method, Method::size_of_parameters_offset());
-  const Address size_of_locals    (G5_method, Method::size_of_locals_offset());
-  const Address constMethod       (G5_method, Method::const_offset());
   int rounded_vm_local_words = round_to( frame::interpreter_frame_vm_local_words, WordsPerLong );
 
   const int extra_space =
@@ -506,11 +503,15 @@
     (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0);
 
   const Register Glocals_size = G3;
+  const Register RconstMethod = Glocals_size;
   const Register Otmp1 = O3;
   const Register Otmp2 = O4;
   // Lscratch can't be used as a temporary because the call_stub uses
   // it to assert that the stack frame was setup correctly.
+  const Address constMethod       (G5_method, Method::const_offset());
+  const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
 
+  __ ld_ptr( constMethod, RconstMethod );
   __ lduh( size_of_parameters, Glocals_size);
 
   // Gargs points to first local + BytesPerWord
@@ -530,6 +531,8 @@
     //
     // Compute number of locals in method apart from incoming parameters
     //
+    const Address size_of_locals    (Otmp1, ConstMethod::size_of_locals_offset());
+    __ ld_ptr( constMethod, Otmp1 );
     __ lduh( size_of_locals, Otmp1 );
     __ sub( Otmp1, Glocals_size, Glocals_size );
     __ round_to( Glocals_size, WordsPerLong );
@@ -1256,8 +1259,7 @@
   // make sure registers are different!
   assert_different_registers(G2_thread, G5_method, Gargs, Gtmp1, Gtmp2);
 
-  const Address size_of_parameters(G5_method, Method::size_of_parameters_offset());
-  const Address size_of_locals    (G5_method, Method::size_of_locals_offset());
+  const Address constMethod       (G5_method, Method::const_offset());
   // Seems like G5_method is live at the point this is used. So we could make this look consistent
   // and use in the asserts.
   const Address access_flags      (Lmethod,   Method::access_flags_offset());
@@ -1307,8 +1309,13 @@
   init_value = G0;
   Label clear_loop;
 
+  const Register RconstMethod = O1;
+  const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
+  const Address size_of_locals    (RconstMethod, ConstMethod::size_of_locals_offset());
+
   // NOTE: If you change the frame layout, this code will need to
   // be updated!
+  __ ld_ptr( constMethod, RconstMethod );
   __ lduh( size_of_locals, O2 );
   __ lduh( size_of_parameters, O1 );
   __ sll( O2, Interpreter::logStackElementSize, O2);
@@ -1823,9 +1830,13 @@
 
     const Register Gtmp1 = G3_scratch;
     const Register Gtmp2 = G1_scratch;
+    const Register RconstMethod = Gtmp1;
+    const Address constMethod(Lmethod, Method::const_offset());
+    const Address size_of_parameters(RconstMethod, ConstMethod::size_of_parameters_offset());
 
     // Compute size of arguments for saving when returning to deoptimized caller
-    __ lduh(Lmethod, in_bytes(Method::size_of_parameters_offset()), Gtmp1);
+    __ ld_ptr(constMethod, RconstMethod);
+    __ lduh(size_of_parameters, Gtmp1);
     __ sll(Gtmp1, Interpreter::logStackElementSize, Gtmp1);
     __ sub(Llocals, Gtmp1, Gtmp2);
     __ add(Gtmp2, wordSize, Gtmp2);
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -3040,7 +3040,8 @@
   Register Rtemp = G4_scratch;
 
   // Load receiver from stack slot
-  __ lduh(G5_method, in_bytes(Method::size_of_parameters_offset()), G4_scratch);
+  __ ld_ptr(G5_method, in_bytes(Method::const_offset()), G4_scratch);
+  __ lduh(G4_scratch, in_bytes(ConstMethod::size_of_parameters_offset()), G4_scratch);
   __ load_receiver(G4_scratch, O0);
 
   // receiver NULL check
--- a/src/cpu/sparc/vm/vmStructs_sparc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/vmStructs_sparc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,7 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry)            \
+#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)            \
  \
   /******************************/                                                                                                   \
   /* JavaCallWrapper            */                                                                                                   \
@@ -37,22 +37,12 @@
   /******************************/                                                                                                   \
   /* JavaFrameAnchor            */                                                                                                   \
   /******************************/                                                                                                   \
-  volatile_nonstatic_field(JavaFrameAnchor,     _flags,                                          int)                                \
-                                                                                                                                     \
+  volatile_nonstatic_field(JavaFrameAnchor,     _flags,                                          int)
 
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must  */
-  /* be present there)                                                */
+#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
 
 
-#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry)                               \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must    */
-  /* be present there)                                                */
-
-
-#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry)                                                              \
+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)                                                              \
   /******************************/                                        \
   /* Register numbers (C2 only) */                                        \
   /******************************/                                        \
@@ -90,15 +80,6 @@
   declare_c2_constant(R_G6_num)                                           \
   declare_c2_constant(R_G7_num)
 
-
-  /* NOTE that we do not use the last_entry() macro here; it is used       */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */
-  /* be present there)                                                     */
-
-#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry)                                                              \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used        */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */
-  /* be present there)                                                      */
+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP
--- a/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/sparc/vm/vm_version_sparc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -259,6 +259,10 @@
   if (!has_vis1()) // Drop to 0 if no VIS1 support
     UseVIS = 0;
 
+  if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
+    (cache_line_size > ContendedPaddingWidth))
+    ContendedPaddingWidth = cache_line_size;
+
 #ifndef PRODUCT
   if (PrintMiscellaneous && Verbose) {
     tty->print("Allocation");
@@ -286,6 +290,9 @@
     if (PrefetchFieldsAhead > 0) {
       tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
     }
+    if (ContendedPaddingWidth > 0) {
+      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+    }
   }
 #endif // PRODUCT
 }
--- a/src/cpu/x86/vm/assembler_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -182,7 +182,7 @@
 // make this go away someday
 void Assembler::emit_data(jint data, relocInfo::relocType rtype, int format) {
   if (rtype == relocInfo::none)
-        emit_long(data);
+        emit_int32(data);
   else  emit_data(data, Relocation::spec_simple(rtype), format);
 }
 
@@ -202,7 +202,7 @@
     else
       code_section()->relocate(inst_mark(), rspec, format);
   }
-  emit_long(data);
+  emit_int32(data);
 }
 
 static int encode(Register r) {
@@ -226,9 +226,9 @@
   assert(isByte(op1) && isByte(op2), "wrong opcode");
   assert(isByte(imm8), "not a byte");
   assert((op1 & 0x01) == 0, "should be 8bit operation");
-  emit_byte(op1);
-  emit_byte(op2 | encode(dst));
-  emit_byte(imm8);
+  emit_int8(op1);
+  emit_int8(op2 | encode(dst));
+  emit_int8(imm8);
 }
 
 
@@ -237,13 +237,13 @@
   assert((op1 & 0x01) == 1, "should be 32bit operation");
   assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
   if (is8bit(imm32)) {
-    emit_byte(op1 | 0x02); // set sign bit
-    emit_byte(op2 | encode(dst));
-    emit_byte(imm32 & 0xFF);
+    emit_int8(op1 | 0x02); // set sign bit
+    emit_int8(op2 | encode(dst));
+    emit_int8(imm32 & 0xFF);
   } else {
-    emit_byte(op1);
-    emit_byte(op2 | encode(dst));
-    emit_long(imm32);
+    emit_int8(op1);
+    emit_int8(op2 | encode(dst));
+    emit_int32(imm32);
   }
 }
 
@@ -252,9 +252,9 @@
   assert(isByte(op1) && isByte(op2), "wrong opcode");
   assert((op1 & 0x01) == 1, "should be 32bit operation");
   assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
-  emit_byte(op1);
-  emit_byte(op2 | encode(dst));
-  emit_long(imm32);
+  emit_int8(op1);
+  emit_int8(op2 | encode(dst));
+  emit_int32(imm32);
 }
 
 // immediate-to-memory forms
@@ -262,21 +262,21 @@
   assert((op1 & 0x01) == 1, "should be 32bit operation");
   assert((op1 & 0x02) == 0, "sign-extension bit should not be set");
   if (is8bit(imm32)) {
-    emit_byte(op1 | 0x02); // set sign bit
+    emit_int8(op1 | 0x02); // set sign bit
     emit_operand(rm, adr, 1);
-    emit_byte(imm32 & 0xFF);
+    emit_int8(imm32 & 0xFF);
   } else {
-    emit_byte(op1);
+    emit_int8(op1);
     emit_operand(rm, adr, 4);
-    emit_long(imm32);
+    emit_int32(imm32);
   }
 }
 
 
 void Assembler::emit_arith(int op1, int op2, Register dst, Register src) {
   assert(isByte(op1) && isByte(op2), "wrong opcode");
-  emit_byte(op1);
-  emit_byte(op2 | encode(dst) << 3 | encode(src));
+  emit_int8(op1);
+  emit_int8(op2 | encode(dst) << 3 | encode(src));
 }
 
 
@@ -301,21 +301,21 @@
         // [base + index*scale]
         // [00 reg 100][ss index base]
         assert(index != rsp, "illegal addressing mode");
-        emit_byte(0x04 | regenc);
-        emit_byte(scale << 6 | indexenc | baseenc);
+        emit_int8(0x04 | regenc);
+        emit_int8(scale << 6 | indexenc | baseenc);
       } else if (is8bit(disp) && rtype == relocInfo::none) {
         // [base + index*scale + imm8]
         // [01 reg 100][ss index base] imm8
         assert(index != rsp, "illegal addressing mode");
-        emit_byte(0x44 | regenc);
-        emit_byte(scale << 6 | indexenc | baseenc);
-        emit_byte(disp & 0xFF);
+        emit_int8(0x44 | regenc);
+        emit_int8(scale << 6 | indexenc | baseenc);
+        emit_int8(disp & 0xFF);
       } else {
         // [base + index*scale + disp32]
         // [10 reg 100][ss index base] disp32
         assert(index != rsp, "illegal addressing mode");
-        emit_byte(0x84 | regenc);
-        emit_byte(scale << 6 | indexenc | baseenc);
+        emit_int8(0x84 | regenc);
+        emit_int8(scale << 6 | indexenc | baseenc);
         emit_data(disp, rspec, disp32_operand);
       }
     } else if (base == rsp LP64_ONLY(|| base == r12)) {
@@ -323,19 +323,19 @@
       if (disp == 0 && rtype == relocInfo::none) {
         // [rsp]
         // [00 reg 100][00 100 100]
-        emit_byte(0x04 | regenc);
-        emit_byte(0x24);
+        emit_int8(0x04 | regenc);
+        emit_int8(0x24);
       } else if (is8bit(disp) && rtype == relocInfo::none) {
         // [rsp + imm8]
         // [01 reg 100][00 100 100] disp8
-        emit_byte(0x44 | regenc);
-        emit_byte(0x24);
-        emit_byte(disp & 0xFF);
+        emit_int8(0x44 | regenc);
+        emit_int8(0x24);
+        emit_int8(disp & 0xFF);
       } else {
         // [rsp + imm32]
         // [10 reg 100][00 100 100] disp32
-        emit_byte(0x84 | regenc);
-        emit_byte(0x24);
+        emit_int8(0x84 | regenc);
+        emit_int8(0x24);
         emit_data(disp, rspec, disp32_operand);
       }
     } else {
@@ -345,16 +345,16 @@
           base != rbp LP64_ONLY(&& base != r13)) {
         // [base]
         // [00 reg base]
-        emit_byte(0x00 | regenc | baseenc);
+        emit_int8(0x00 | regenc | baseenc);
       } else if (is8bit(disp) && rtype == relocInfo::none) {
         // [base + disp8]
         // [01 reg base] disp8
-        emit_byte(0x40 | regenc | baseenc);
-        emit_byte(disp & 0xFF);
+        emit_int8(0x40 | regenc | baseenc);
+        emit_int8(disp & 0xFF);
       } else {
         // [base + disp32]
         // [10 reg base] disp32
-        emit_byte(0x80 | regenc | baseenc);
+        emit_int8(0x80 | regenc | baseenc);
         emit_data(disp, rspec, disp32_operand);
       }
     }
@@ -364,14 +364,14 @@
       // [index*scale + disp]
       // [00 reg 100][ss index 101] disp32
       assert(index != rsp, "illegal addressing mode");
-      emit_byte(0x04 | regenc);
-      emit_byte(scale << 6 | indexenc | 0x05);
+      emit_int8(0x04 | regenc);
+      emit_int8(scale << 6 | indexenc | 0x05);
       emit_data(disp, rspec, disp32_operand);
     } else if (rtype != relocInfo::none ) {
       // [disp] (64bit) RIP-RELATIVE (32bit) abs
       // [00 000 101] disp32
 
-      emit_byte(0x05 | regenc);
+      emit_int8(0x05 | regenc);
       // Note that the RIP-rel. correction applies to the generated
       // disp field, but _not_ to the target address in the rspec.
 
@@ -391,8 +391,8 @@
       // 32bit never did this, did everything as the rip-rel/disp code above
       // [disp] ABSOLUTE
       // [00 reg 100][00 100 101] disp32
-      emit_byte(0x04 | regenc);
-      emit_byte(0x25);
+      emit_int8(0x04 | regenc);
+      emit_int8(0x25);
       emit_data(disp, rspec, disp32_operand);
     }
   }
@@ -883,8 +883,8 @@
 void Assembler::emit_farith(int b1, int b2, int i) {
   assert(isByte(b1) && isByte(b2), "wrong opcode");
   assert(0 <= i &&  i < 8, "illegal stack offset");
-  emit_byte(b1);
-  emit_byte(b2 + i);
+  emit_int8(b1);
+  emit_int8(b2 + i);
 }
 
 
@@ -899,7 +899,7 @@
 void Assembler::adcl(Address dst, Register src) {
   InstructionMark im(this);
   prefix(dst, src);
-  emit_byte(0x11);
+  emit_int8(0x11);
   emit_operand(src, dst);
 }
 
@@ -911,7 +911,7 @@
 void Assembler::adcl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x13);
+  emit_int8(0x13);
   emit_operand(dst, src);
 }
 
@@ -929,7 +929,7 @@
 void Assembler::addl(Address dst, Register src) {
   InstructionMark im(this);
   prefix(dst, src);
-  emit_byte(0x01);
+  emit_int8(0x01);
   emit_operand(src, dst);
 }
 
@@ -941,7 +941,7 @@
 void Assembler::addl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x03);
+  emit_int8(0x03);
   emit_operand(dst, src);
 }
 
@@ -953,39 +953,41 @@
 void Assembler::addr_nop_4() {
   assert(UseAddressNop, "no CPU support");
   // 4 bytes: NOP DWORD PTR [EAX+0]
-  emit_byte(0x0F);
-  emit_byte(0x1F);
-  emit_byte(0x40); // emit_rm(cbuf, 0x1, EAX_enc, EAX_enc);
-  emit_byte(0);    // 8-bits offset (1 byte)
+  emit_int8(0x0F);
+  emit_int8(0x1F);
+  emit_int8(0x40); // emit_rm(cbuf, 0x1, EAX_enc, EAX_enc);
+  emit_int8(0);    // 8-bits offset (1 byte)
 }
 
 void Assembler::addr_nop_5() {
   assert(UseAddressNop, "no CPU support");
   // 5 bytes: NOP DWORD PTR [EAX+EAX*0+0] 8-bits offset
-  emit_byte(0x0F);
-  emit_byte(0x1F);
-  emit_byte(0x44); // emit_rm(cbuf, 0x1, EAX_enc, 0x4);
-  emit_byte(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
-  emit_byte(0);    // 8-bits offset (1 byte)
+  emit_int8(0x0F);
+  emit_int8(0x1F);
+  emit_int8(0x44); // emit_rm(cbuf, 0x1, EAX_enc, 0x4);
+  emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
+  emit_int8(0);    // 8-bits offset (1 byte)
 }
 
 void Assembler::addr_nop_7() {
   assert(UseAddressNop, "no CPU support");
   // 7 bytes: NOP DWORD PTR [EAX+0] 32-bits offset
-  emit_byte(0x0F);
-  emit_byte(0x1F);
-  emit_byte(0x80); // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc);
-  emit_long(0);    // 32-bits offset (4 bytes)
+  emit_int8(0x0F);
+  emit_int8(0x1F);
+  emit_int8((unsigned char)0x80);
+                   // emit_rm(cbuf, 0x2, EAX_enc, EAX_enc);
+  emit_int32(0);   // 32-bits offset (4 bytes)
 }
 
 void Assembler::addr_nop_8() {
   assert(UseAddressNop, "no CPU support");
   // 8 bytes: NOP DWORD PTR [EAX+EAX*0+0] 32-bits offset
-  emit_byte(0x0F);
-  emit_byte(0x1F);
-  emit_byte(0x84); // emit_rm(cbuf, 0x2, EAX_enc, 0x4);
-  emit_byte(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
-  emit_long(0);    // 32-bits offset (4 bytes)
+  emit_int8(0x0F);
+  emit_int8(0x1F);
+  emit_int8((unsigned char)0x84);
+                   // emit_rm(cbuf, 0x2, EAX_enc, 0x4);
+  emit_int8(0x00); // emit_rm(cbuf, 0x0, EAX_enc, EAX_enc);
+  emit_int32(0);   // 32-bits offset (4 bytes)
 }
 
 void Assembler::addsd(XMMRegister dst, XMMRegister src) {
@@ -1012,69 +1014,69 @@
   assert(VM_Version::supports_aes(), "");
   InstructionMark im(this);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xde);
+  emit_int8((unsigned char)0xDE);
   emit_operand(dst, src);
 }
 
 void Assembler::aesdec(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_aes(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xde);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xDE);
+  emit_int8(0xC0 | encode);
 }
 
 void Assembler::aesdeclast(XMMRegister dst, Address src) {
   assert(VM_Version::supports_aes(), "");
   InstructionMark im(this);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdf);
+  emit_int8((unsigned char)0xDF);
   emit_operand(dst, src);
 }
 
 void Assembler::aesdeclast(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_aes(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdf);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xDF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::aesenc(XMMRegister dst, Address src) {
   assert(VM_Version::supports_aes(), "");
   InstructionMark im(this);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdc);
+  emit_int8((unsigned char)0xDC);
   emit_operand(dst, src);
 }
 
 void Assembler::aesenc(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_aes(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdc);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xDC);
+  emit_int8(0xC0 | encode);
 }
 
 void Assembler::aesenclast(XMMRegister dst, Address src) {
   assert(VM_Version::supports_aes(), "");
   InstructionMark im(this);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdd);
+  emit_int8((unsigned char)0xDD);
   emit_operand(dst, src);
 }
 
 void Assembler::aesenclast(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_aes(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0xdd);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xDD);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 
 void Assembler::andl(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rsp, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::andl(Register dst, int32_t imm32) {
@@ -1085,7 +1087,7 @@
 void Assembler::andl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x23);
+  emit_int8(0x23);
   emit_operand(dst, src);
 }
 
@@ -1096,23 +1098,23 @@
 
 void Assembler::bsfl(Register dst, Register src) {
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBC);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBC);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::bsrl(Register dst, Register src) {
   assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT");
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBD);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBD);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::bswapl(Register reg) { // bswap
   int encode = prefix_and_encode(reg->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xC8 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)(0xC8 | encode));
 }
 
 void Assembler::call(Label& L, relocInfo::relocType rtype) {
@@ -1125,36 +1127,36 @@
     assert(offs <= 0, "assembler error");
     InstructionMark im(this);
     // 1110 1000 #32-bit disp
-    emit_byte(0xE8);
+    emit_int8((unsigned char)0xE8);
     emit_data(offs - long_size, rtype, operand);
   } else {
     InstructionMark im(this);
     // 1110 1000 #32-bit disp
     L.add_patch_at(code(), locator());
 
-    emit_byte(0xE8);
+    emit_int8((unsigned char)0xE8);
     emit_data(int(0), rtype, operand);
   }
 }
 
 void Assembler::call(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xD0 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8((unsigned char)(0xD0 | encode));
 }
 
 
 void Assembler::call(Address adr) {
   InstructionMark im(this);
   prefix(adr);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rdx, adr);
 }
 
 void Assembler::call_literal(address entry, RelocationHolder const& rspec) {
   assert(entry != NULL, "call most probably wrong");
   InstructionMark im(this);
-  emit_byte(0xE8);
+  emit_int8((unsigned char)0xE8);
   intptr_t disp = entry - (pc() + sizeof(int32_t));
   assert(is_simm32(disp), "must be 32bit offset (call2)");
   // Technically, should use call32_operand, but this format is
@@ -1165,44 +1167,44 @@
 }
 
 void Assembler::cdql() {
-  emit_byte(0x99);
+  emit_int8((unsigned char)0x99);
 }
 
 void Assembler::cld() {
-  emit_byte(0xfc);
+  emit_int8((unsigned char)0xFC);
 }
 
 void Assembler::cmovl(Condition cc, Register dst, Register src) {
   NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0x40 | cc);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8(0x40 | cc);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 
 void Assembler::cmovl(Condition cc, Register dst, Address src) {
   NOT_LP64(guarantee(VM_Version::supports_cmov(), "illegal instruction"));
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0x40 | cc);
+  emit_int8(0x0F);
+  emit_int8(0x40 | cc);
   emit_operand(dst, src);
 }
 
 void Assembler::cmpb(Address dst, int imm8) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x80);
+  emit_int8((unsigned char)0x80);
   emit_operand(rdi, dst, 1);
-  emit_byte(imm8);
+  emit_int8(imm8);
 }
 
 void Assembler::cmpl(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rdi, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::cmpl(Register dst, int32_t imm32) {
@@ -1219,17 +1221,17 @@
 void Assembler::cmpl(Register dst, Address  src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x3B);
+  emit_int8((unsigned char)0x3B);
   emit_operand(dst, src);
 }
 
 void Assembler::cmpw(Address dst, int imm16) {
   InstructionMark im(this);
   assert(!dst.base_needs_rex() && !dst.index_needs_rex(), "no extended registers");
-  emit_byte(0x66);
-  emit_byte(0x81);
+  emit_int8(0x66);
+  emit_int8((unsigned char)0x81);
   emit_operand(rdi, dst, 2);
-  emit_word(imm16);
+  emit_int16(imm16);
 }
 
 // The 32-bit cmpxchg compares the value at adr with the contents of rax,
@@ -1238,8 +1240,8 @@
 void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
   InstructionMark im(this);
   prefix(adr, reg);
-  emit_byte(0x0F);
-  emit_byte(0xB1);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB1);
   emit_operand(reg, adr);
 }
 
@@ -1266,8 +1268,8 @@
 }
 
 void Assembler::cpuid() {
-  emit_byte(0x0F);
-  emit_byte(0xA2);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xA2);
 }
 
 void Assembler::cvtdq2pd(XMMRegister dst, XMMRegister src) {
@@ -1293,8 +1295,8 @@
 void Assembler::cvtsi2sdl(XMMRegister dst, Register src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F2);
-  emit_byte(0x2A);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2A);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvtsi2sdl(XMMRegister dst, Address src) {
@@ -1305,8 +1307,8 @@
 void Assembler::cvtsi2ssl(XMMRegister dst, Register src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_F3);
-  emit_byte(0x2A);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2A);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvtsi2ssl(XMMRegister dst, Address src) {
@@ -1328,22 +1330,22 @@
 void Assembler::cvttsd2sil(Register dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F2);
-  emit_byte(0x2C);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2C);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvttss2sil(Register dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_F3);
-  emit_byte(0x2C);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2C);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::decl(Address dst) {
   // Don't use it directly. Use MacroAssembler::decrement() instead.
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rcx, dst);
 }
 
@@ -1369,44 +1371,44 @@
 
 void Assembler::emms() {
   NOT_LP64(assert(VM_Version::supports_mmx(), ""));
-  emit_byte(0x0F);
-  emit_byte(0x77);
+  emit_int8(0x0F);
+  emit_int8(0x77);
 }
 
 void Assembler::hlt() {
-  emit_byte(0xF4);
+  emit_int8((unsigned char)0xF4);
 }
 
 void Assembler::idivl(Register src) {
   int encode = prefix_and_encode(src->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xF8 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xF8 | encode));
 }
 
 void Assembler::divl(Register src) { // Unsigned
   int encode = prefix_and_encode(src->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xF0 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xF0 | encode));
 }
 
 void Assembler::imull(Register dst, Register src) {
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xAF);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 
 void Assembler::imull(Register dst, Register src, int value) {
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
   if (is8bit(value)) {
-    emit_byte(0x6B);
-    emit_byte(0xC0 | encode);
-    emit_byte(value & 0xFF);
+    emit_int8(0x6B);
+    emit_int8((unsigned char)(0xC0 | encode));
+    emit_int8(value & 0xFF);
   } else {
-    emit_byte(0x69);
-    emit_byte(0xC0 | encode);
-    emit_long(value);
+    emit_int8(0x69);
+    emit_int8((unsigned char)(0xC0 | encode));
+    emit_int32(value);
   }
 }
 
@@ -1414,7 +1416,7 @@
   // Don't use it directly. Use MacroAssembler::increment() instead.
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rax, dst);
 }
 
@@ -1430,15 +1432,15 @@
     intptr_t offs = (intptr_t)dst - (intptr_t)pc();
     if (maybe_short && is8bit(offs - short_size)) {
       // 0111 tttn #8-bit disp
-      emit_byte(0x70 | cc);
-      emit_byte((offs - short_size) & 0xFF);
+      emit_int8(0x70 | cc);
+      emit_int8((offs - short_size) & 0xFF);
     } else {
       // 0000 1111 1000 tttn #32-bit disp
       assert(is_simm32(offs - long_size),
              "must be 32bit offset (call4)");
-      emit_byte(0x0F);
-      emit_byte(0x80 | cc);
-      emit_long(offs - long_size);
+      emit_int8(0x0F);
+      emit_int8((unsigned char)(0x80 | cc));
+      emit_int32(offs - long_size);
     }
   } else {
     // Note: could eliminate cond. jumps to this jump if condition
@@ -1446,9 +1448,9 @@
     // Note: use jccb() if label to be bound is very close to get
     //       an 8-bit displacement
     L.add_patch_at(code(), locator());
-    emit_byte(0x0F);
-    emit_byte(0x80 | cc);
-    emit_long(0);
+    emit_int8(0x0F);
+    emit_int8((unsigned char)(0x80 | cc));
+    emit_int32(0);
   }
 }
 
@@ -1466,20 +1468,20 @@
 #endif
     intptr_t offs = (intptr_t)entry - (intptr_t)pc();
     // 0111 tttn #8-bit disp
-    emit_byte(0x70 | cc);
-    emit_byte((offs - short_size) & 0xFF);
+    emit_int8(0x70 | cc);
+    emit_int8((offs - short_size) & 0xFF);
   } else {
     InstructionMark im(this);
     L.add_patch_at(code(), locator());
-    emit_byte(0x70 | cc);
-    emit_byte(0);
+    emit_int8(0x70 | cc);
+    emit_int8(0);
   }
 }
 
 void Assembler::jmp(Address adr) {
   InstructionMark im(this);
   prefix(adr);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rsp, adr);
 }
 
@@ -1492,11 +1494,11 @@
     const int long_size = 5;
     intptr_t offs = entry - pc();
     if (maybe_short && is8bit(offs - short_size)) {
-      emit_byte(0xEB);
-      emit_byte((offs - short_size) & 0xFF);
+      emit_int8((unsigned char)0xEB);
+      emit_int8((offs - short_size) & 0xFF);
     } else {
-      emit_byte(0xE9);
-      emit_long(offs - long_size);
+      emit_int8((unsigned char)0xE9);
+      emit_int32(offs - long_size);
     }
   } else {
     // By default, forward jumps are always 32-bit displacements, since
@@ -1505,20 +1507,20 @@
     // force an 8-bit displacement.
     InstructionMark im(this);
     L.add_patch_at(code(), locator());
-    emit_byte(0xE9);
-    emit_long(0);
+    emit_int8((unsigned char)0xE9);
+    emit_int32(0);
   }
 }
 
 void Assembler::jmp(Register entry) {
   int encode = prefix_and_encode(entry->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xE0 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8((unsigned char)(0xE0 | encode));
 }
 
 void Assembler::jmp_literal(address dest, RelocationHolder const& rspec) {
   InstructionMark im(this);
-  emit_byte(0xE9);
+  emit_int8((unsigned char)0xE9);
   assert(dest != NULL, "must have a target");
   intptr_t disp = dest - (pc() + sizeof(int32_t));
   assert(is_simm32(disp), "must be 32bit offset (jmp)");
@@ -1539,13 +1541,13 @@
     assert(is8bit(dist), "Dispacement too large for a short jmp");
 #endif
     intptr_t offs = entry - pc();
-    emit_byte(0xEB);
-    emit_byte((offs - short_size) & 0xFF);
+    emit_int8((unsigned char)0xEB);
+    emit_int8((offs - short_size) & 0xFF);
   } else {
     InstructionMark im(this);
     L.add_patch_at(code(), locator());
-    emit_byte(0xEB);
-    emit_byte(0);
+    emit_int8((unsigned char)0xEB);
+    emit_int8(0);
   }
 }
 
@@ -1553,46 +1555,46 @@
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
   prefix(src);
-  emit_byte(0x0F);
-  emit_byte(0xAE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
   emit_operand(as_Register(2), src);
 }
 
 void Assembler::leal(Register dst, Address src) {
   InstructionMark im(this);
 #ifdef _LP64
-  emit_byte(0x67); // addr32
+  emit_int8(0x67); // addr32
   prefix(src, dst);
 #endif // LP64
-  emit_byte(0x8D);
+  emit_int8((unsigned char)0x8D);
   emit_operand(dst, src);
 }
 
 void Assembler::lfence() {
-  emit_byte(0x0F);
-  emit_byte(0xAE);
-  emit_byte(0xE8);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
+  emit_int8((unsigned char)0xE8);
 }
 
 void Assembler::lock() {
-  emit_byte(0xF0);
+  emit_int8((unsigned char)0xF0);
 }
 
 void Assembler::lzcntl(Register dst, Register src) {
   assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR");
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBD);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBD);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 // Emit mfence instruction
 void Assembler::mfence() {
   NOT_LP64(assert(VM_Version::supports_sse2(), "unsupported");)
-  emit_byte( 0x0F );
-  emit_byte( 0xAE );
-  emit_byte( 0xF0 );
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
+  emit_int8((unsigned char)0xF0);
 }
 
 void Assembler::mov(Register dst, Register src) {
@@ -1612,15 +1614,15 @@
 void Assembler::movlhps(XMMRegister dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int encode = simd_prefix_and_encode(dst, src, src, VEX_SIMD_NONE);
-  emit_byte(0x16);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x16);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movb(Register dst, Address src) {
   NOT_LP64(assert(dst->has_byte_register(), "must have byte register"));
   InstructionMark im(this);
   prefix(src, dst, true);
-  emit_byte(0x8A);
+  emit_int8((unsigned char)0x8A);
   emit_operand(dst, src);
 }
 
@@ -1628,9 +1630,9 @@
 void Assembler::movb(Address dst, int imm8) {
   InstructionMark im(this);
    prefix(dst);
-  emit_byte(0xC6);
+  emit_int8((unsigned char)0xC6);
   emit_operand(rax, dst, 1);
-  emit_byte(imm8);
+  emit_int8(imm8);
 }
 
 
@@ -1638,30 +1640,30 @@
   assert(src->has_byte_register(), "must have byte register");
   InstructionMark im(this);
   prefix(dst, src, true);
-  emit_byte(0x88);
+  emit_int8((unsigned char)0x88);
   emit_operand(src, dst);
 }
 
 void Assembler::movdl(XMMRegister dst, Register src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode(dst, src, VEX_SIMD_66);
-  emit_byte(0x6E);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x6E);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movdl(Register dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // swap src/dst to get correct prefix
   int encode = simd_prefix_and_encode(src, dst, VEX_SIMD_66);
-  emit_byte(0x7E);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x7E);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movdl(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66);
-  emit_byte(0x6E);
+  emit_int8(0x6E);
   emit_operand(dst, src);
 }
 
@@ -1669,7 +1671,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66);
-  emit_byte(0x7E);
+  emit_int8(0x7E);
   emit_operand(src, dst);
 }
 
@@ -1692,7 +1694,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_F3);
-  emit_byte(0x7F);
+  emit_int8(0x7F);
   emit_operand(src, dst);
 }
 
@@ -1701,8 +1703,8 @@
   assert(UseAVX, "");
   bool vector256 = true;
   int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, vector256);
-  emit_byte(0x6F);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x6F);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::vmovdqu(XMMRegister dst, Address src) {
@@ -1710,7 +1712,7 @@
   InstructionMark im(this);
   bool vector256 = true;
   vex_prefix(dst, xnoreg, src, VEX_SIMD_F3, vector256);
-  emit_byte(0x6F);
+  emit_int8(0x6F);
   emit_operand(dst, src);
 }
 
@@ -1721,7 +1723,7 @@
   // swap src<->dst for encoding
   assert(src != xnoreg, "sanity");
   vex_prefix(src, xnoreg, dst, VEX_SIMD_F3, vector256);
-  emit_byte(0x7F);
+  emit_int8(0x7F);
   emit_operand(src, dst);
 }
 
@@ -1729,35 +1731,35 @@
 
 void Assembler::movl(Register dst, int32_t imm32) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xB8 | encode);
-  emit_long(imm32);
+  emit_int8((unsigned char)(0xB8 | encode));
+  emit_int32(imm32);
 }
 
 void Assembler::movl(Register dst, Register src) {
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x8B);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0x8B);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x8B);
+  emit_int8((unsigned char)0x8B);
   emit_operand(dst, src);
 }
 
 void Assembler::movl(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0xC7);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movl(Address dst, Register src) {
   InstructionMark im(this);
   prefix(dst, src);
-  emit_byte(0x89);
+  emit_int8((unsigned char)0x89);
   emit_operand(src, dst);
 }
 
@@ -1771,15 +1773,15 @@
 
 void Assembler::movq( MMXRegister dst, Address src ) {
   assert( VM_Version::supports_mmx(), "" );
-  emit_byte(0x0F);
-  emit_byte(0x6F);
+  emit_int8(0x0F);
+  emit_int8(0x6F);
   emit_operand(dst, src);
 }
 
 void Assembler::movq( Address dst, MMXRegister src ) {
   assert( VM_Version::supports_mmx(), "" );
-  emit_byte(0x0F);
-  emit_byte(0x7F);
+  emit_int8(0x0F);
+  emit_int8(0x7F);
   // workaround gcc (3.2.1-7a) bug
   // In that version of gcc with only an emit_operand(MMX, Address)
   // gcc will tail jump and try and reverse the parameters completely
@@ -1793,7 +1795,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_F3);
-  emit_byte(0x7E);
+  emit_int8(0x7E);
   emit_operand(dst, src);
 }
 
@@ -1801,24 +1803,24 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66);
-  emit_byte(0xD6);
+  emit_int8((unsigned char)0xD6);
   emit_operand(src, dst);
 }
 
 void Assembler::movsbl(Register dst, Address src) { // movsxb
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xBE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBE);
   emit_operand(dst, src);
 }
 
 void Assembler::movsbl(Register dst, Register src) { // movsxb
   NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
   int encode = prefix_and_encode(dst->encoding(), src->encoding(), true);
-  emit_byte(0x0F);
-  emit_byte(0xBE);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBE);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movsd(XMMRegister dst, XMMRegister src) {
@@ -1835,7 +1837,7 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_F2);
-  emit_byte(0x11);
+  emit_int8(0x11);
   emit_operand(src, dst);
 }
 
@@ -1853,93 +1855,93 @@
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_F3);
-  emit_byte(0x11);
+  emit_int8(0x11);
   emit_operand(src, dst);
 }
 
 void Assembler::movswl(Register dst, Address src) { // movsxw
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xBF);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBF);
   emit_operand(dst, src);
 }
 
 void Assembler::movswl(Register dst, Register src) { // movsxw
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBF);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movw(Address dst, int imm16) {
   InstructionMark im(this);
 
-  emit_byte(0x66); // switch to 16-bit mode
+  emit_int8(0x66); // switch to 16-bit mode
   prefix(dst);
-  emit_byte(0xC7);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 2);
-  emit_word(imm16);
+  emit_int16(imm16);
 }
 
 void Assembler::movw(Register dst, Address src) {
   InstructionMark im(this);
-  emit_byte(0x66);
+  emit_int8(0x66);
   prefix(src, dst);
-  emit_byte(0x8B);
+  emit_int8((unsigned char)0x8B);
   emit_operand(dst, src);
 }
 
 void Assembler::movw(Address dst, Register src) {
   InstructionMark im(this);
-  emit_byte(0x66);
+  emit_int8(0x66);
   prefix(dst, src);
-  emit_byte(0x89);
+  emit_int8((unsigned char)0x89);
   emit_operand(src, dst);
 }
 
 void Assembler::movzbl(Register dst, Address src) { // movzxb
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB6);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB6);
   emit_operand(dst, src);
 }
 
 void Assembler::movzbl(Register dst, Register src) { // movzxb
   NOT_LP64(assert(src->has_byte_register(), "must have byte register"));
   int encode = prefix_and_encode(dst->encoding(), src->encoding(), true);
-  emit_byte(0x0F);
-  emit_byte(0xB6);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB6);
+  emit_int8(0xC0 | encode);
 }
 
 void Assembler::movzwl(Register dst, Address src) { // movzxw
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB7);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB7);
   emit_operand(dst, src);
 }
 
 void Assembler::movzwl(Register dst, Register src) { // movzxw
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xB7);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB7);
+  emit_int8(0xC0 | encode);
 }
 
 void Assembler::mull(Address src) {
   InstructionMark im(this);
   prefix(src);
-  emit_byte(0xF7);
+  emit_int8((unsigned char)0xF7);
   emit_operand(rsp, src);
 }
 
 void Assembler::mull(Register src) {
   int encode = prefix_and_encode(src->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xE0 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xE0 | encode));
 }
 
 void Assembler::mulsd(XMMRegister dst, Address src) {
@@ -1964,8 +1966,8 @@
 
 void Assembler::negl(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xD8 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xD8 | encode));
 }
 
 void Assembler::nop(int i) {
@@ -1976,7 +1978,7 @@
   // speed is not an issue so simply use the single byte traditional nop
   // to do alignment.
 
-  for (; i > 0 ; i--) emit_byte(0x90);
+  for (; i > 0 ; i--) emit_int8((unsigned char)0x90);
   return;
 
 #endif // ASSERT
@@ -2006,33 +2008,35 @@
     while(i >= 15) {
       // For Intel don't generate consecutive addess nops (mix with regular nops)
       i -= 15;
-      emit_byte(0x66);   // size prefix
-      emit_byte(0x66);   // size prefix
-      emit_byte(0x66);   // size prefix
+      emit_int8(0x66);   // size prefix
+      emit_int8(0x66);   // size prefix
+      emit_int8(0x66);   // size prefix
       addr_nop_8();
-      emit_byte(0x66);   // size prefix
-      emit_byte(0x66);   // size prefix
-      emit_byte(0x66);   // size prefix
-      emit_byte(0x90);   // nop
+      emit_int8(0x66);   // size prefix
+      emit_int8(0x66);   // size prefix
+      emit_int8(0x66);   // size prefix
+      emit_int8((unsigned char)0x90);
+                         // nop
     }
     switch (i) {
       case 14:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 13:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 12:
         addr_nop_8();
-        emit_byte(0x66); // size prefix
-        emit_byte(0x66); // size prefix
-        emit_byte(0x66); // size prefix
-        emit_byte(0x90); // nop
+        emit_int8(0x66); // size prefix
+        emit_int8(0x66); // size prefix
+        emit_int8(0x66); // size prefix
+        emit_int8((unsigned char)0x90);
+                         // nop
         break;
       case 11:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 10:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 9:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 8:
         addr_nop_8();
         break;
@@ -2040,7 +2044,7 @@
         addr_nop_7();
         break;
       case 6:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 5:
         addr_nop_5();
         break;
@@ -2049,11 +2053,12 @@
         break;
       case 3:
         // Don't use "0x0F 0x1F 0x00" - need patching safe padding
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 2:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 1:
-        emit_byte(0x90); // nop
+        emit_int8((unsigned char)0x90);
+                         // nop
         break;
       default:
         assert(i == 0, " ");
@@ -2086,24 +2091,24 @@
 
     while(i >= 22) {
       i -= 11;
-      emit_byte(0x66); // size prefix
-      emit_byte(0x66); // size prefix
-      emit_byte(0x66); // size prefix
+      emit_int8(0x66); // size prefix
+      emit_int8(0x66); // size prefix
+      emit_int8(0x66); // size prefix
       addr_nop_8();
     }
     // Generate first nop for size between 21-12
     switch (i) {
       case 21:
         i -= 1;
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 20:
       case 19:
         i -= 1;
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 18:
       case 17:
         i -= 1;
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 16:
       case 15:
         i -= 8;
@@ -2116,7 +2121,7 @@
         break;
       case 12:
         i -= 6;
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
         addr_nop_5();
         break;
       default:
@@ -2126,11 +2131,11 @@
     // Generate second nop for size between 11-1
     switch (i) {
       case 11:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 10:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 9:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 8:
         addr_nop_8();
         break;
@@ -2138,7 +2143,7 @@
         addr_nop_7();
         break;
       case 6:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 5:
         addr_nop_5();
         break;
@@ -2147,11 +2152,12 @@
         break;
       case 3:
         // Don't use "0x0F 0x1F 0x00" - need patching safe padding
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 2:
-        emit_byte(0x66); // size prefix
+        emit_int8(0x66); // size prefix
       case 1:
-        emit_byte(0x90); // nop
+        emit_int8((unsigned char)0x90);
+                         // nop
         break;
       default:
         assert(i == 0, " ");
@@ -2174,42 +2180,43 @@
   //
   while(i > 12) {
     i -= 4;
-    emit_byte(0x66); // size prefix
-    emit_byte(0x66);
-    emit_byte(0x66);
-    emit_byte(0x90); // nop
+    emit_int8(0x66); // size prefix
+    emit_int8(0x66);
+    emit_int8(0x66);
+    emit_int8((unsigned char)0x90);
+                     // nop
   }
   // 1 - 12 nops
   if(i > 8) {
     if(i > 9) {
       i -= 1;
-      emit_byte(0x66);
+      emit_int8(0x66);
     }
     i -= 3;
-    emit_byte(0x66);
-    emit_byte(0x66);
-    emit_byte(0x90);
+    emit_int8(0x66);
+    emit_int8(0x66);
+    emit_int8((unsigned char)0x90);
   }
   // 1 - 8 nops
   if(i > 4) {
     if(i > 6) {
       i -= 1;
-      emit_byte(0x66);
+      emit_int8(0x66);
     }
     i -= 3;
-    emit_byte(0x66);
-    emit_byte(0x66);
-    emit_byte(0x90);
+    emit_int8(0x66);
+    emit_int8(0x66);
+    emit_int8((unsigned char)0x90);
   }
   switch (i) {
     case 4:
-      emit_byte(0x66);
+      emit_int8(0x66);
     case 3:
-      emit_byte(0x66);
+      emit_int8(0x66);
     case 2:
-      emit_byte(0x66);
+      emit_int8(0x66);
     case 1:
-      emit_byte(0x90);
+      emit_int8((unsigned char)0x90);
       break;
     default:
       assert(i == 0, " ");
@@ -2218,8 +2225,8 @@
 
 void Assembler::notl(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xD0 | encode );
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xD0 | encode));
 }
 
 void Assembler::orl(Address dst, int32_t imm32) {
@@ -2236,7 +2243,7 @@
 void Assembler::orl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x0B);
+  emit_int8(0x0B);
   emit_operand(dst, src);
 }
 
@@ -2256,65 +2263,77 @@
   emit_simd_arith(0x67, dst, src, VEX_SIMD_66);
 }
 
+void Assembler::vpackuswb(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
+  assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
+  emit_vex_arith(0x67, dst, nds, src, VEX_SIMD_66, vector256);
+}
+
+void Assembler::vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256) {
+    int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true, vector256);
+    emit_int8(0x00);
+    emit_int8(0xC0 | encode);
+    emit_int8(imm8);
+}
+
 void Assembler::pcmpestri(XMMRegister dst, Address src, int imm8) {
   assert(VM_Version::supports_sse4_2(), "");
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_3A);
-  emit_byte(0x61);
+  emit_int8(0x61);
   emit_operand(dst, src);
-  emit_byte(imm8);
+  emit_int8(imm8);
 }
 
 void Assembler::pcmpestri(XMMRegister dst, XMMRegister src, int imm8) {
   assert(VM_Version::supports_sse4_2(), "");
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A);
-  emit_byte(0x61);
-  emit_byte(0xC0 | encode);
-  emit_byte(imm8);
+  emit_int8(0x61);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(imm8);
 }
 
 void Assembler::pmovzxbw(XMMRegister dst, Address src) {
   assert(VM_Version::supports_sse4_1(), "");
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x30);
+  emit_int8(0x30);
   emit_operand(dst, src);
 }
 
 void Assembler::pmovzxbw(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x30);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x30);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 // generic
 void Assembler::pop(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0x58 | encode);
+  emit_int8(0x58 | encode);
 }
 
 void Assembler::popcntl(Register dst, Address src) {
   assert(VM_Version::supports_popcnt(), "must support");
   InstructionMark im(this);
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   prefix(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB8);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB8);
   emit_operand(dst, src);
 }
 
 void Assembler::popcntl(Register dst, Register src) {
   assert(VM_Version::supports_popcnt(), "must support");
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xB8);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB8);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::popf() {
-  emit_byte(0x9D);
+  emit_int8((unsigned char)0x9D);
 }
 
 #ifndef _LP64 // no 32bit push/pop on amd64
@@ -2322,21 +2341,21 @@
   // NOTE: this will adjust stack by 8byte on 64bits
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x8F);
+  emit_int8((unsigned char)0x8F);
   emit_operand(rax, dst);
 }
 #endif
 
 void Assembler::prefetch_prefix(Address src) {
   prefix(src);
-  emit_byte(0x0F);
+  emit_int8(0x0F);
 }
 
 void Assembler::prefetchnta(Address src) {
   NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x18);
+  emit_int8(0x18);
   emit_operand(rax, src); // 0, src
 }
 
@@ -2344,7 +2363,7 @@
   assert(VM_Version::supports_3dnow_prefetch(), "must support");
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x0D);
+  emit_int8(0x0D);
   emit_operand(rax, src); // 0, src
 }
 
@@ -2352,7 +2371,7 @@
   NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x18);
+  emit_int8(0x18);
   emit_operand(rcx, src); // 1, src
 }
 
@@ -2360,7 +2379,7 @@
   NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x18);
+  emit_int8(0x18);
   emit_operand(rdx, src); // 2, src
 }
 
@@ -2368,7 +2387,7 @@
   NOT_LP64(assert(VM_Version::supports_sse(), "must support"));
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x18);
+  emit_int8(0x18);
   emit_operand(rbx, src); // 3, src
 }
 
@@ -2376,27 +2395,26 @@
   assert(VM_Version::supports_3dnow_prefetch(), "must support");
   InstructionMark im(this);
   prefetch_prefix(src);
-  emit_byte(0x0D);
+  emit_int8(0x0D);
   emit_operand(rcx, src); // 1, src
 }
 
 void Assembler::prefix(Prefix p) {
-  a_byte(p);
+  emit_int8(p);
 }
 
 void Assembler::pshufb(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_ssse3(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x00);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x00);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::pshufb(XMMRegister dst, Address src) {
   assert(VM_Version::supports_ssse3(), "");
-  assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
   simd_prefix(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x00);
+  emit_int8(0x00);
   emit_operand(dst, src);
 }
 
@@ -2404,7 +2422,7 @@
   assert(isByte(mode), "invalid value");
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_66);
-  emit_byte(mode & 0xFF);
+  emit_int8(mode & 0xFF);
 
 }
 
@@ -2414,16 +2432,16 @@
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66);
-  emit_byte(0x70);
+  emit_int8(0x70);
   emit_operand(dst, src);
-  emit_byte(mode & 0xFF);
+  emit_int8(mode & 0xFF);
 }
 
 void Assembler::pshuflw(XMMRegister dst, XMMRegister src, int mode) {
   assert(isByte(mode), "invalid value");
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   emit_simd_arith_nonds(0x70, dst, src, VEX_SIMD_F2);
-  emit_byte(mode & 0xFF);
+  emit_int8(mode & 0xFF);
 }
 
 void Assembler::pshuflw(XMMRegister dst, Address src, int mode) {
@@ -2432,18 +2450,18 @@
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_F2);
-  emit_byte(0x70);
+  emit_int8(0x70);
   emit_operand(dst, src);
-  emit_byte(mode & 0xFF);
+  emit_int8(mode & 0xFF);
 }
 
 void Assembler::psrldq(XMMRegister dst, int shift) {
   // Shift 128 bit value in xmm register by number of bytes.
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode(xmm3, dst, dst, VEX_SIMD_66);
-  emit_byte(0x73);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift);
+  emit_int8(0x73);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift);
 }
 
 void Assembler::ptest(XMMRegister dst, Address src) {
@@ -2451,15 +2469,35 @@
   assert((UseAVX > 0), "SSE mode requires address alignment 16 bytes");
   InstructionMark im(this);
   simd_prefix(dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x17);
+  emit_int8(0x17);
   emit_operand(dst, src);
 }
 
 void Assembler::ptest(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
   int encode = simd_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x17);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x17);
+  emit_int8((unsigned char)(0xC0 | encode));
+}
+
+void Assembler::vptest(XMMRegister dst, Address src) {
+  assert(VM_Version::supports_avx(), "");
+  InstructionMark im(this);
+  bool vector256 = true;
+  assert(dst != xnoreg, "sanity");
+  int dst_enc = dst->encoding();
+  // swap src<->dst for encoding
+  vex_prefix(src, 0, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256);
+  emit_int8(0x17);
+  emit_operand(dst, src);
+}
+
+void Assembler::vptest(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx(), "");
+  bool vector256 = true;
+  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
+  emit_int8(0x17);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::punpcklbw(XMMRegister dst, Address src) {
@@ -2492,18 +2530,18 @@
 void Assembler::push(int32_t imm32) {
   // in 64bits we push 64bits onto the stack but only
   // take a 32bit immediate
-  emit_byte(0x68);
-  emit_long(imm32);
+  emit_int8(0x68);
+  emit_int32(imm32);
 }
 
 void Assembler::push(Register src) {
   int encode = prefix_and_encode(src->encoding());
 
-  emit_byte(0x50 | encode);
+  emit_int8(0x50 | encode);
 }
 
 void Assembler::pushf() {
-  emit_byte(0x9C);
+  emit_int8((unsigned char)0x9C);
 }
 
 #ifndef _LP64 // no 32bit push/pop on amd64
@@ -2511,7 +2549,7 @@
   // Note this will push 64bit on 64bit
   InstructionMark im(this);
   prefix(src);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rsi, src);
 }
 #endif
@@ -2520,58 +2558,64 @@
   assert(isShiftCount(imm8), "illegal shift count");
   int encode = prefix_and_encode(dst->encoding());
   if (imm8 == 1) {
-    emit_byte(0xD1);
-    emit_byte(0xD0 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xD0 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xD0 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)0xD0 | encode);
+    emit_int8(imm8);
   }
 }
 
 // copies data from [esi] to [edi] using rcx pointer sized words
 // generic
 void Assembler::rep_mov() {
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   // MOVSQ
   LP64_ONLY(prefix(REX_W));
-  emit_byte(0xA5);
+  emit_int8((unsigned char)0xA5);
+}
+
+// sets rcx bytes with rax, value at [edi]
+void Assembler::rep_stosb() {
+  emit_int8((unsigned char)0xF3); // REP
+  LP64_ONLY(prefix(REX_W));
+  emit_int8((unsigned char)0xAA); // STOSB
 }
 
 // sets rcx pointer sized words with rax, value at [edi]
 // generic
-void Assembler::rep_set() { // rep_set
-  emit_byte(0xF3);
-  // STOSQ
-  LP64_ONLY(prefix(REX_W));
-  emit_byte(0xAB);
+void Assembler::rep_stos() {
+  emit_int8((unsigned char)0xF3); // REP
+  LP64_ONLY(prefix(REX_W));       // LP64:STOSQ, LP32:STOSD
+  emit_int8((unsigned char)0xAB);
 }
 
 // scans rcx pointer sized words at [edi] for occurance of rax,
 // generic
 void Assembler::repne_scan() { // repne_scan
-  emit_byte(0xF2);
+  emit_int8((unsigned char)0xF2);
   // SCASQ
   LP64_ONLY(prefix(REX_W));
-  emit_byte(0xAF);
+  emit_int8((unsigned char)0xAF);
 }
 
 #ifdef _LP64
 // scans rcx 4 byte words at [edi] for occurance of rax,
 // generic
 void Assembler::repne_scanl() { // repne_scan
-  emit_byte(0xF2);
+  emit_int8((unsigned char)0xF2);
   // SCASL
-  emit_byte(0xAF);
+  emit_int8((unsigned char)0xAF);
 }
 #endif
 
 void Assembler::ret(int imm16) {
   if (imm16 == 0) {
-    emit_byte(0xC3);
+    emit_int8((unsigned char)0xC3);
   } else {
-    emit_byte(0xC2);
-    emit_word(imm16);
+    emit_int8((unsigned char)0xC2);
+    emit_int16(imm16);
   }
 }
 
@@ -2580,26 +2624,26 @@
   // Not supported in 64bit mode
   ShouldNotReachHere();
 #endif
-  emit_byte(0x9E);
+  emit_int8((unsigned char)0x9E);
 }
 
 void Assembler::sarl(Register dst, int imm8) {
   int encode = prefix_and_encode(dst->encoding());
   assert(isShiftCount(imm8), "illegal shift count");
   if (imm8 == 1) {
-    emit_byte(0xD1);
-    emit_byte(0xF8 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xF8 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xF8 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)(0xF8 | encode));
+    emit_int8(imm8);
   }
 }
 
 void Assembler::sarl(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xF8 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8((unsigned char)(0xF8 | encode));
 }
 
 void Assembler::sbbl(Address dst, int32_t imm32) {
@@ -2617,7 +2661,7 @@
 void Assembler::sbbl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x1B);
+  emit_int8(0x1B);
   emit_operand(dst, src);
 }
 
@@ -2629,47 +2673,47 @@
 void Assembler::setb(Condition cc, Register dst) {
   assert(0 <= cc && cc < 16, "illegal cc");
   int encode = prefix_and_encode(dst->encoding(), true);
-  emit_byte(0x0F);
-  emit_byte(0x90 | cc);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0x90 | cc);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::shll(Register dst, int imm8) {
   assert(isShiftCount(imm8), "illegal shift count");
   int encode = prefix_and_encode(dst->encoding());
   if (imm8 == 1 ) {
-    emit_byte(0xD1);
-    emit_byte(0xE0 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xE0 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xE0 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)(0xE0 | encode));
+    emit_int8(imm8);
   }
 }
 
 void Assembler::shll(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xE0 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8((unsigned char)(0xE0 | encode));
 }
 
 void Assembler::shrl(Register dst, int imm8) {
   assert(isShiftCount(imm8), "illegal shift count");
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xC1);
-  emit_byte(0xE8 | encode);
-  emit_byte(imm8);
+  emit_int8((unsigned char)0xC1);
+  emit_int8((unsigned char)(0xE8 | encode));
+  emit_int8(imm8);
 }
 
 void Assembler::shrl(Register dst) {
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xE8 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8((unsigned char)(0xE8 | encode));
 }
 
 // copies a single word from [esi] to [edi]
 void Assembler::smovl() {
-  emit_byte(0xA5);
+  emit_int8((unsigned char)0xA5);
 }
 
 void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) {
@@ -2688,7 +2732,7 @@
 }
 
 void Assembler::std() {
-  emit_byte(0xfd);
+  emit_int8((unsigned char)0xFD);
 }
 
 void Assembler::sqrtss(XMMRegister dst, Address src) {
@@ -2700,8 +2744,8 @@
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x0F);
-  emit_byte(0xAE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
   emit_operand(as_Register(3), dst);
 }
 
@@ -2714,7 +2758,7 @@
 void Assembler::subl(Address dst, Register src) {
   InstructionMark im(this);
   prefix(dst, src);
-  emit_byte(0x29);
+  emit_int8(0x29);
   emit_operand(src, dst);
 }
 
@@ -2732,7 +2776,7 @@
 void Assembler::subl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x2B);
+  emit_int8(0x2B);
   emit_operand(dst, src);
 }
 
@@ -2773,13 +2817,13 @@
   // 8bit operands
   int encode = dst->encoding();
   if (encode == 0) {
-    emit_byte(0xA9);
+    emit_int8((unsigned char)0xA9);
   } else {
     encode = prefix_and_encode(encode);
-    emit_byte(0xF7);
-    emit_byte(0xC0 | encode);
+    emit_int8((unsigned char)0xF7);
+    emit_int8((unsigned char)(0xC0 | encode));
   }
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::testl(Register dst, Register src) {
@@ -2790,7 +2834,7 @@
 void Assembler::testl(Register dst, Address  src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x85);
+  emit_int8((unsigned char)0x85);
   emit_operand(dst, src);
 }
 
@@ -2818,28 +2862,28 @@
 void Assembler::xaddl(Address dst, Register src) {
   InstructionMark im(this);
   prefix(dst, src);
-  emit_byte(0x0F);
-  emit_byte(0xC1);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xC1);
   emit_operand(src, dst);
 }
 
 void Assembler::xchgl(Register dst, Address src) { // xchg
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x87);
+  emit_int8((unsigned char)0x87);
   emit_operand(dst, src);
 }
 
 void Assembler::xchgl(Register dst, Register src) {
   int encode = prefix_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x87);
-  emit_byte(0xc0 | encode);
+  emit_int8((unsigned char)0x87);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::xgetbv() {
-  emit_byte(0x0F);
-  emit_byte(0x01);
-  emit_byte(0xD0);
+  emit_int8(0x0F);
+  emit_int8(0x01);
+  emit_int8((unsigned char)0xD0);
 }
 
 void Assembler::xorl(Register dst, int32_t imm32) {
@@ -2850,7 +2894,7 @@
 void Assembler::xorl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
-  emit_byte(0x33);
+  emit_int8(0x33);
   emit_operand(dst, src);
 }
 
@@ -3276,8 +3320,8 @@
 void Assembler::pmulld(XMMRegister dst, XMMRegister src) {
   assert(VM_Version::supports_sse4_1(), "");
   int encode = simd_prefix_and_encode(dst, dst, src, VEX_SIMD_66, VEX_OPCODE_0F_38);
-  emit_byte(0x40);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x40);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
@@ -3288,8 +3332,8 @@
 void Assembler::vpmulld(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
-  emit_byte(0x40);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x40);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::vpmullw(XMMRegister dst, XMMRegister nds, Address src, bool vector256) {
@@ -3303,7 +3347,7 @@
   int dst_enc = dst->encoding();
   int nds_enc = nds->is_valid() ? nds->encoding() : 0;
   vex_prefix(src, nds_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_38, false, vector256);
-  emit_byte(0x40);
+  emit_int8(0x40);
   emit_operand(dst, src);
 }
 
@@ -3312,27 +3356,27 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM6 is for /6 encoding: 66 0F 71 /6 ib
   int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
-  emit_byte(0x71);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x71);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::pslld(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM6 is for /6 encoding: 66 0F 72 /6 ib
   int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
-  emit_byte(0x72);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x72);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psllq(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM6 is for /6 encoding: 66 0F 73 /6 ib
   int encode = simd_prefix_and_encode(xmm6, dst, dst, VEX_SIMD_66);
-  emit_byte(0x73);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x73);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psllw(XMMRegister dst, XMMRegister shift) {
@@ -3354,21 +3398,21 @@
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM6 is for /6 encoding: 66 0F 71 /6 ib
   emit_vex_arith(0x71, xmm6, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpslld(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM6 is for /6 encoding: 66 0F 72 /6 ib
   emit_vex_arith(0x72, xmm6, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsllq(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM6 is for /6 encoding: 66 0F 73 /6 ib
   emit_vex_arith(0x73, xmm6, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsllw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
@@ -3391,18 +3435,18 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM2 is for /2 encoding: 66 0F 71 /2 ib
   int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
-  emit_byte(0x71);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x71);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psrld(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM2 is for /2 encoding: 66 0F 72 /2 ib
   int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
-  emit_byte(0x72);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x72);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psrlq(XMMRegister dst, int shift) {
@@ -3411,9 +3455,9 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   int encode = simd_prefix_and_encode(xmm2, dst, dst, VEX_SIMD_66);
-  emit_byte(0x73);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x73);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psrlw(XMMRegister dst, XMMRegister shift) {
@@ -3435,21 +3479,21 @@
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   emit_vex_arith(0x71, xmm2, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsrld(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   emit_vex_arith(0x72, xmm2, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsrlq(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM2 is for /2 encoding: 66 0F 73 /2 ib
   emit_vex_arith(0x73, xmm2, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsrlw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
@@ -3472,18 +3516,18 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM4 is for /4 encoding: 66 0F 71 /4 ib
   int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66);
-  emit_byte(0x71);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x71);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psrad(XMMRegister dst, int shift) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // XMM4 is for /4 encoding: 66 0F 72 /4 ib
   int encode = simd_prefix_and_encode(xmm4, dst, dst, VEX_SIMD_66);
-  emit_byte(0x72);
-  emit_byte(0xC0 | encode);
-  emit_byte(shift & 0xFF);
+  emit_int8(0x72);
+  emit_int8((unsigned char)(0xC0 | encode));
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::psraw(XMMRegister dst, XMMRegister shift) {
@@ -3500,14 +3544,14 @@
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM4 is for /4 encoding: 66 0F 71 /4 ib
   emit_vex_arith(0x71, xmm4, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsrad(XMMRegister dst, XMMRegister src, int shift, bool vector256) {
   assert(VM_Version::supports_avx() && !vector256 || VM_Version::supports_avx2(), "256 bit integer vectors requires AVX2");
   // XMM4 is for /4 encoding: 66 0F 71 /4 ib
   emit_vex_arith(0x72, xmm4, dst, src, VEX_SIMD_66, vector256);
-  emit_byte(shift & 0xFF);
+  emit_int8(shift & 0xFF);
 }
 
 void Assembler::vpsraw(XMMRegister dst, XMMRegister src, XMMRegister shift, bool vector256) {
@@ -3572,11 +3616,11 @@
   assert(VM_Version::supports_avx(), "");
   bool vector256 = true;
   int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
-  emit_byte(0x18);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x18);
+  emit_int8((unsigned char)(0xC0 | encode));
   // 0x00 - insert into lower 128 bits
   // 0x01 - insert into upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
 }
 
 void Assembler::vinsertf128h(XMMRegister dst, Address src) {
@@ -3587,10 +3631,10 @@
   int dst_enc = dst->encoding();
   // swap src<->dst for encoding
   vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
-  emit_byte(0x18);
+  emit_int8(0x18);
   emit_operand(dst, src);
   // 0x01 - insert into upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
 }
 
 void Assembler::vextractf128h(Address dst, XMMRegister src) {
@@ -3600,21 +3644,21 @@
   assert(src != xnoreg, "sanity");
   int src_enc = src->encoding();
   vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
-  emit_byte(0x19);
+  emit_int8(0x19);
   emit_operand(src, dst);
   // 0x01 - extract from upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
 }
 
 void Assembler::vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
   assert(VM_Version::supports_avx2(), "");
   bool vector256 = true;
   int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A);
-  emit_byte(0x38);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x38);
+  emit_int8((unsigned char)(0xC0 | encode));
   // 0x00 - insert into lower 128 bits
   // 0x01 - insert into upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
 }
 
 void Assembler::vinserti128h(XMMRegister dst, Address src) {
@@ -3625,10 +3669,10 @@
   int dst_enc = dst->encoding();
   // swap src<->dst for encoding
   vex_prefix(src, dst_enc, dst_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
-  emit_byte(0x38);
+  emit_int8(0x38);
   emit_operand(dst, src);
   // 0x01 - insert into upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
 }
 
 void Assembler::vextracti128h(Address dst, XMMRegister src) {
@@ -3638,16 +3682,25 @@
   assert(src != xnoreg, "sanity");
   int src_enc = src->encoding();
   vex_prefix(dst, 0, src_enc, VEX_SIMD_66, VEX_OPCODE_0F_3A, false, vector256);
-  emit_byte(0x39);
+  emit_int8(0x39);
   emit_operand(src, dst);
   // 0x01 - extract from upper 128 bits
-  emit_byte(0x01);
+  emit_int8(0x01);
+}
+
+// duplicate 4-bytes integer data from src into 8 locations in dest
+void Assembler::vpbroadcastd(XMMRegister dst, XMMRegister src) {
+  assert(VM_Version::supports_avx2(), "");
+  bool vector256 = true;
+  int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_38);
+  emit_int8(0x58);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::vzeroupper() {
   assert(VM_Version::supports_avx(), "");
   (void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE);
-  emit_byte(0x77);
+  emit_int8(0x77);
 }
 
 
@@ -3657,15 +3710,15 @@
 void Assembler::cmp_literal32(Register src1, int32_t imm32, RelocationHolder const& rspec) {
   // NO PREFIX AS NEVER 64BIT
   InstructionMark im(this);
-  emit_byte(0x81);
-  emit_byte(0xF8 | src1->encoding());
+  emit_int8((unsigned char)0x81);
+  emit_int8((unsigned char)(0xF8 | src1->encoding()));
   emit_data(imm32, rspec, 0);
 }
 
 void Assembler::cmp_literal32(Address src1, int32_t imm32, RelocationHolder const& rspec) {
   // NO PREFIX AS NEVER 64BIT (not even 32bit versions of 64bit regs
   InstructionMark im(this);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rdi, src1);
   emit_data(imm32, rspec, 0);
 }
@@ -3675,14 +3728,14 @@
 // into rdx:rax.  The ZF is set if the compared values were equal, and cleared otherwise.
 void Assembler::cmpxchg8(Address adr) {
   InstructionMark im(this);
-  emit_byte(0x0F);
-  emit_byte(0xc7);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rcx, adr);
 }
 
 void Assembler::decl(Register dst) {
   // Don't use it directly. Use MacroAssembler::decrementl() instead.
- emit_byte(0x48 | dst->encoding());
+ emit_int8(0x48 | dst->encoding());
 }
 
 #endif // _LP64
@@ -3690,8 +3743,8 @@
 // 64bit typically doesn't use the x87 but needs to for the trig funcs
 
 void Assembler::fabs() {
-  emit_byte(0xD9);
-  emit_byte(0xE1);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xE1);
 }
 
 void Assembler::fadd(int i) {
@@ -3700,13 +3753,13 @@
 
 void Assembler::fadd_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rax, src);
 }
 
 void Assembler::fadd_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rax, src);
 }
 
@@ -3719,8 +3772,8 @@
 }
 
 void Assembler::fchs() {
-  emit_byte(0xD9);
-  emit_byte(0xE0);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xE0);
 }
 
 void Assembler::fcom(int i) {
@@ -3733,29 +3786,29 @@
 
 void Assembler::fcomp_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rbx, src);
 }
 
 void Assembler::fcomp_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rbx, src);
 }
 
 void Assembler::fcompp() {
-  emit_byte(0xDE);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0xDE);
+  emit_int8((unsigned char)0xD9);
 }
 
 void Assembler::fcos() {
-  emit_byte(0xD9);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xFF);
 }
 
 void Assembler::fdecstp() {
-  emit_byte(0xD9);
-  emit_byte(0xF6);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF6);
 }
 
 void Assembler::fdiv(int i) {
@@ -3764,13 +3817,13 @@
 
 void Assembler::fdiv_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rsi, src);
 }
 
 void Assembler::fdiv_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rsi, src);
 }
 
@@ -3791,13 +3844,13 @@
 
 void Assembler::fdivr_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rdi, src);
 }
 
 void Assembler::fdivr_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rdi, src);
 }
 
@@ -3815,59 +3868,59 @@
 
 void Assembler::fild_d(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDF);
+  emit_int8((unsigned char)0xDF);
   emit_operand32(rbp, adr);
 }
 
 void Assembler::fild_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDB);
+  emit_int8((unsigned char)0xDB);
   emit_operand32(rax, adr);
 }
 
 void Assembler::fincstp() {
-  emit_byte(0xD9);
-  emit_byte(0xF7);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF7);
 }
 
 void Assembler::finit() {
-  emit_byte(0x9B);
-  emit_byte(0xDB);
-  emit_byte(0xE3);
+  emit_int8((unsigned char)0x9B);
+  emit_int8((unsigned char)0xDB);
+  emit_int8((unsigned char)0xE3);
 }
 
 void Assembler::fist_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDB);
+  emit_int8((unsigned char)0xDB);
   emit_operand32(rdx, adr);
 }
 
 void Assembler::fistp_d(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDF);
+  emit_int8((unsigned char)0xDF);
   emit_operand32(rdi, adr);
 }
 
 void Assembler::fistp_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDB);
+  emit_int8((unsigned char)0xDB);
   emit_operand32(rbx, adr);
 }
 
 void Assembler::fld1() {
-  emit_byte(0xD9);
-  emit_byte(0xE8);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xE8);
 }
 
 void Assembler::fld_d(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDD);
+  emit_int8((unsigned char)0xDD);
   emit_operand32(rax, adr);
 }
 
 void Assembler::fld_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rax, adr);
 }
 
@@ -3878,35 +3931,35 @@
 
 void Assembler::fld_x(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDB);
+  emit_int8((unsigned char)0xDB);
   emit_operand32(rbp, adr);
 }
 
 void Assembler::fldcw(Address src) {
   InstructionMark im(this);
-  emit_byte(0xd9);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rbp, src);
 }
 
 void Assembler::fldenv(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rsp, src);
 }
 
 void Assembler::fldlg2() {
-  emit_byte(0xD9);
-  emit_byte(0xEC);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xEC);
 }
 
 void Assembler::fldln2() {
-  emit_byte(0xD9);
-  emit_byte(0xED);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xED);
 }
 
 void Assembler::fldz() {
-  emit_byte(0xD9);
-  emit_byte(0xEE);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xEE);
 }
 
 void Assembler::flog() {
@@ -3927,13 +3980,13 @@
 
 void Assembler::fmul_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rcx, src);
 }
 
 void Assembler::fmul_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rcx, src);
 }
 
@@ -3947,63 +4000,63 @@
 
 void Assembler::fnsave(Address dst) {
   InstructionMark im(this);
-  emit_byte(0xDD);
+  emit_int8((unsigned char)0xDD);
   emit_operand32(rsi, dst);
 }
 
 void Assembler::fnstcw(Address src) {
   InstructionMark im(this);
-  emit_byte(0x9B);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0x9B);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rdi, src);
 }
 
 void Assembler::fnstsw_ax() {
-  emit_byte(0xdF);
-  emit_byte(0xE0);
+  emit_int8((unsigned char)0xDF);
+  emit_int8((unsigned char)0xE0);
 }
 
 void Assembler::fprem() {
-  emit_byte(0xD9);
-  emit_byte(0xF8);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF8);
 }
 
 void Assembler::fprem1() {
-  emit_byte(0xD9);
-  emit_byte(0xF5);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF5);
 }
 
 void Assembler::frstor(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDD);
+  emit_int8((unsigned char)0xDD);
   emit_operand32(rsp, src);
 }
 
 void Assembler::fsin() {
-  emit_byte(0xD9);
-  emit_byte(0xFE);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xFE);
 }
 
 void Assembler::fsqrt() {
-  emit_byte(0xD9);
-  emit_byte(0xFA);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xFA);
 }
 
 void Assembler::fst_d(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDD);
+  emit_int8((unsigned char)0xDD);
   emit_operand32(rdx, adr);
 }
 
 void Assembler::fst_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rdx, adr);
 }
 
 void Assembler::fstp_d(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDD);
+  emit_int8((unsigned char)0xDD);
   emit_operand32(rbx, adr);
 }
 
@@ -4013,13 +4066,13 @@
 
 void Assembler::fstp_s(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xD9);
+  emit_int8((unsigned char)0xD9);
   emit_operand32(rbx, adr);
 }
 
 void Assembler::fstp_x(Address adr) {
   InstructionMark im(this);
-  emit_byte(0xDB);
+  emit_int8((unsigned char)0xDB);
   emit_operand32(rdi, adr);
 }
 
@@ -4029,13 +4082,13 @@
 
 void Assembler::fsub_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rsp, src);
 }
 
 void Assembler::fsub_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rsp, src);
 }
 
@@ -4053,13 +4106,13 @@
 
 void Assembler::fsubr_d(Address src) {
   InstructionMark im(this);
-  emit_byte(0xDC);
+  emit_int8((unsigned char)0xDC);
   emit_operand32(rbp, src);
 }
 
 void Assembler::fsubr_s(Address src) {
   InstructionMark im(this);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD8);
   emit_operand32(rbp, src);
 }
 
@@ -4072,15 +4125,15 @@
 }
 
 void Assembler::ftan() {
-  emit_byte(0xD9);
-  emit_byte(0xF2);
-  emit_byte(0xDD);
-  emit_byte(0xD8);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF2);
+  emit_int8((unsigned char)0xDD);
+  emit_int8((unsigned char)0xD8);
 }
 
 void Assembler::ftst() {
-  emit_byte(0xD9);
-  emit_byte(0xE4);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xE4);
 }
 
 void Assembler::fucomi(int i) {
@@ -4096,7 +4149,7 @@
 }
 
 void Assembler::fwait() {
-  emit_byte(0x9B);
+  emit_int8((unsigned char)0x9B);
 }
 
 void Assembler::fxch(int i) {
@@ -4104,23 +4157,23 @@
 }
 
 void Assembler::fyl2x() {
-  emit_byte(0xD9);
-  emit_byte(0xF1);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF1);
 }
 
 void Assembler::frndint() {
-  emit_byte(0xD9);
-  emit_byte(0xFC);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xFC);
 }
 
 void Assembler::f2xm1() {
-  emit_byte(0xD9);
-  emit_byte(0xF0);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xF0);
 }
 
 void Assembler::fldl2e() {
-  emit_byte(0xD9);
-  emit_byte(0xEA);
+  emit_int8((unsigned char)0xD9);
+  emit_int8((unsigned char)0xEA);
 }
 
 // SSE SIMD prefix byte values corresponding to VexSimdPrefix encoding.
@@ -4131,7 +4184,7 @@
 // Generate SSE legacy REX prefix and SIMD opcode based on VEX encoding.
 void Assembler::rex_prefix(Address adr, XMMRegister xreg, VexSimdPrefix pre, VexOpcode opc, bool rex_w) {
   if (pre > 0) {
-    emit_byte(simd_pre[pre]);
+    emit_int8(simd_pre[pre]);
   }
   if (rex_w) {
     prefixq(adr, xreg);
@@ -4139,25 +4192,25 @@
     prefix(adr, xreg);
   }
   if (opc > 0) {
-    emit_byte(0x0F);
+    emit_int8(0x0F);
     int opc2 = simd_opc[opc];
     if (opc2 > 0) {
-      emit_byte(opc2);
+      emit_int8(opc2);
     }
   }
 }
 
 int Assembler::rex_prefix_and_encode(int dst_enc, int src_enc, VexSimdPrefix pre, VexOpcode opc, bool rex_w) {
   if (pre > 0) {
-    emit_byte(simd_pre[pre]);
+    emit_int8(simd_pre[pre]);
   }
   int encode = (rex_w) ? prefixq_and_encode(dst_enc, src_enc) :
                           prefix_and_encode(dst_enc, src_enc);
   if (opc > 0) {
-    emit_byte(0x0F);
+    emit_int8(0x0F);
     int opc2 = simd_opc[opc];
     if (opc2 > 0) {
-      emit_byte(opc2);
+      emit_int8(opc2);
     }
   }
   return encode;
@@ -4171,11 +4224,11 @@
     int byte1 = (vex_r ? VEX_R : 0) | (vex_x ? VEX_X : 0) | (vex_b ? VEX_B : 0);
     byte1 = (~byte1) & 0xE0;
     byte1 |= opc;
-    a_byte(byte1);
+    emit_int8(byte1);
 
     int byte2 = ((~nds_enc) & 0xf) << 3;
     byte2 |= (vex_w ? VEX_W : 0) | (vector256 ? 4 : 0) | pre;
-    emit_byte(byte2);
+    emit_int8(byte2);
   } else {
     prefix(VEX_2bytes);
 
@@ -4183,7 +4236,7 @@
     byte1 = (~byte1) & 0x80;
     byte1 |= ((~nds_enc) & 0xf) << 3;
     byte1 |= (vector256 ? 4 : 0) | pre;
-    emit_byte(byte1);
+    emit_int8(byte1);
   }
 }
 
@@ -4229,28 +4282,28 @@
 void Assembler::emit_simd_arith(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) {
   InstructionMark im(this);
   simd_prefix(dst, dst, src, pre);
-  emit_byte(opcode);
+  emit_int8(opcode);
   emit_operand(dst, src);
 }
 
 void Assembler::emit_simd_arith(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) {
   int encode = simd_prefix_and_encode(dst, dst, src, pre);
-  emit_byte(opcode);
-  emit_byte(0xC0 | encode);
+  emit_int8(opcode);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 // Versions with no second source register (non-destructive source).
 void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, Address src, VexSimdPrefix pre) {
   InstructionMark im(this);
   simd_prefix(dst, xnoreg, src, pre);
-  emit_byte(opcode);
+  emit_int8(opcode);
   emit_operand(dst, src);
 }
 
 void Assembler::emit_simd_arith_nonds(int opcode, XMMRegister dst, XMMRegister src, VexSimdPrefix pre) {
   int encode = simd_prefix_and_encode(dst, xnoreg, src, pre);
-  emit_byte(opcode);
-  emit_byte(0xC0 | encode);
+  emit_int8(opcode);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 // 3-operands AVX instructions
@@ -4258,22 +4311,22 @@
                                Address src, VexSimdPrefix pre, bool vector256) {
   InstructionMark im(this);
   vex_prefix(dst, nds, src, pre, vector256);
-  emit_byte(opcode);
+  emit_int8(opcode);
   emit_operand(dst, src);
 }
 
 void Assembler::emit_vex_arith(int opcode, XMMRegister dst, XMMRegister nds,
                                XMMRegister src, VexSimdPrefix pre, bool vector256) {
   int encode = vex_prefix_and_encode(dst, nds, src, pre, vector256);
-  emit_byte(opcode);
-  emit_byte(0xC0 | encode);
+  emit_int8(opcode);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 #ifndef _LP64
 
 void Assembler::incl(Register dst) {
   // Don't use it directly. Use MacroAssembler::incrementl() instead.
-  emit_byte(0x40 | dst->encoding());
+  emit_int8(0x40 | dst->encoding());
 }
 
 void Assembler::lea(Register dst, Address src) {
@@ -4282,7 +4335,7 @@
 
 void Assembler::mov_literal32(Address dst, int32_t imm32,  RelocationHolder const& rspec) {
   InstructionMark im(this);
-  emit_byte(0xC7);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst);
   emit_data((int)imm32, rspec, 0);
 }
@@ -4290,49 +4343,49 @@
 void Assembler::mov_literal32(Register dst, int32_t imm32, RelocationHolder const& rspec) {
   InstructionMark im(this);
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xB8 | encode);
+  emit_int8((unsigned char)(0xB8 | encode));
   emit_data((int)imm32, rspec, 0);
 }
 
 void Assembler::popa() { // 32bit
-  emit_byte(0x61);
+  emit_int8(0x61);
 }
 
 void Assembler::push_literal32(int32_t imm32, RelocationHolder const& rspec) {
   InstructionMark im(this);
-  emit_byte(0x68);
+  emit_int8(0x68);
   emit_data(imm32, rspec, 0);
 }
 
 void Assembler::pusha() { // 32bit
-  emit_byte(0x60);
+  emit_int8(0x60);
 }
 
 void Assembler::set_byte_if_not_zero(Register dst) {
-  emit_byte(0x0F);
-  emit_byte(0x95);
-  emit_byte(0xE0 | dst->encoding());
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0x95);
+  emit_int8((unsigned char)(0xE0 | dst->encoding()));
 }
 
 void Assembler::shldl(Register dst, Register src) {
-  emit_byte(0x0F);
-  emit_byte(0xA5);
-  emit_byte(0xC0 | src->encoding() << 3 | dst->encoding());
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xA5);
+  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
 }
 
 void Assembler::shrdl(Register dst, Register src) {
-  emit_byte(0x0F);
-  emit_byte(0xAD);
-  emit_byte(0xC0 | src->encoding() << 3 | dst->encoding());
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAD);
+  emit_int8((unsigned char)(0xC0 | src->encoding() << 3 | dst->encoding()));
 }
 
 #else // LP64
 
 void Assembler::set_byte_if_not_zero(Register dst) {
   int enc = prefix_and_encode(dst->encoding(), true);
-  emit_byte(0x0F);
-  emit_byte(0x95);
-  emit_byte(0xE0 | enc);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0x95);
+  emit_int8((unsigned char)(0xE0 | enc));
 }
 
 // 64bit only pieces of the assembler
@@ -4670,7 +4723,7 @@
 void Assembler::adcq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x13);
+  emit_int8(0x13);
   emit_operand(dst, src);
 }
 
@@ -4688,7 +4741,7 @@
 void Assembler::addq(Address dst, Register src) {
   InstructionMark im(this);
   prefixq(dst, src);
-  emit_byte(0x01);
+  emit_int8(0x01);
   emit_operand(src, dst);
 }
 
@@ -4700,7 +4753,7 @@
 void Assembler::addq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x03);
+  emit_int8(0x03);
   emit_operand(dst, src);
 }
 
@@ -4712,9 +4765,9 @@
 void Assembler::andq(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rsp, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::andq(Register dst, int32_t imm32) {
@@ -4725,7 +4778,7 @@
 void Assembler::andq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x23);
+  emit_int8(0x23);
   emit_operand(dst, src);
 }
 
@@ -4736,58 +4789,58 @@
 
 void Assembler::bsfq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBC);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBC);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::bsrq(Register dst, Register src) {
   assert(!VM_Version::supports_lzcnt(), "encoding is treated as LZCNT");
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBD);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBD);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::bswapq(Register reg) {
   int encode = prefixq_and_encode(reg->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xC8 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)(0xC8 | encode));
 }
 
 void Assembler::cdqq() {
   prefix(REX_W);
-  emit_byte(0x99);
+  emit_int8((unsigned char)0x99);
 }
 
 void Assembler::clflush(Address adr) {
   prefix(adr);
-  emit_byte(0x0F);
-  emit_byte(0xAE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
   emit_operand(rdi, adr);
 }
 
 void Assembler::cmovq(Condition cc, Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0x40 | cc);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8(0x40 | cc);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cmovq(Condition cc, Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0x40 | cc);
+  emit_int8(0x0F);
+  emit_int8(0x40 | cc);
   emit_operand(dst, src);
 }
 
 void Assembler::cmpq(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rdi, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::cmpq(Register dst, int32_t imm32) {
@@ -4798,7 +4851,7 @@
 void Assembler::cmpq(Address dst, Register src) {
   InstructionMark im(this);
   prefixq(dst, src);
-  emit_byte(0x3B);
+  emit_int8(0x3B);
   emit_operand(src, dst);
 }
 
@@ -4810,123 +4863,123 @@
 void Assembler::cmpq(Register dst, Address  src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x3B);
+  emit_int8(0x3B);
   emit_operand(dst, src);
 }
 
 void Assembler::cmpxchgq(Register reg, Address adr) {
   InstructionMark im(this);
   prefixq(adr, reg);
-  emit_byte(0x0F);
-  emit_byte(0xB1);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB1);
   emit_operand(reg, adr);
 }
 
 void Assembler::cvtsi2sdq(XMMRegister dst, Register src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F2);
-  emit_byte(0x2A);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2A);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvtsi2sdq(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   InstructionMark im(this);
   simd_prefix_q(dst, dst, src, VEX_SIMD_F2);
-  emit_byte(0x2A);
+  emit_int8(0x2A);
   emit_operand(dst, src);
 }
 
 void Assembler::cvtsi2ssq(XMMRegister dst, Register src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int encode = simd_prefix_and_encode_q(dst, dst, src, VEX_SIMD_F3);
-  emit_byte(0x2A);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2A);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvtsi2ssq(XMMRegister dst, Address src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   InstructionMark im(this);
   simd_prefix_q(dst, dst, src, VEX_SIMD_F3);
-  emit_byte(0x2A);
+  emit_int8(0x2A);
   emit_operand(dst, src);
 }
 
 void Assembler::cvttsd2siq(Register dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F2);
-  emit_byte(0x2C);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2C);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::cvttss2siq(Register dst, XMMRegister src) {
   NOT_LP64(assert(VM_Version::supports_sse(), ""));
   int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_F3);
-  emit_byte(0x2C);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x2C);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::decl(Register dst) {
   // Don't use it directly. Use MacroAssembler::decrementl() instead.
   // Use two-byte form (one-byte form is a REX prefix in 64-bit mode)
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xC8 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8((unsigned char)(0xC8 | encode));
 }
 
 void Assembler::decq(Register dst) {
   // Don't use it directly. Use MacroAssembler::decrementq() instead.
   // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xC8 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8(0xC8 | encode);
 }
 
 void Assembler::decq(Address dst) {
   // Don't use it directly. Use MacroAssembler::decrementq() instead.
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rcx, dst);
 }
 
 void Assembler::fxrstor(Address src) {
   prefixq(src);
-  emit_byte(0x0F);
-  emit_byte(0xAE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
   emit_operand(as_Register(1), src);
 }
 
 void Assembler::fxsave(Address dst) {
   prefixq(dst);
-  emit_byte(0x0F);
-  emit_byte(0xAE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAE);
   emit_operand(as_Register(0), dst);
 }
 
 void Assembler::idivq(Register src) {
   int encode = prefixq_and_encode(src->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xF8 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xF8 | encode));
 }
 
 void Assembler::imulq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xAF);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xAF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::imulq(Register dst, Register src, int value) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
   if (is8bit(value)) {
-    emit_byte(0x6B);
-    emit_byte(0xC0 | encode);
-    emit_byte(value & 0xFF);
+    emit_int8(0x6B);
+    emit_int8((unsigned char)(0xC0 | encode));
+    emit_int8(value & 0xFF);
   } else {
-    emit_byte(0x69);
-    emit_byte(0xC0 | encode);
-    emit_long(value);
+    emit_int8(0x69);
+    emit_int8((unsigned char)(0xC0 | encode));
+    emit_int32(value);
   }
 }
 
@@ -4934,23 +4987,23 @@
   // Don't use it directly. Use MacroAssembler::incrementl() instead.
   // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::incq(Register dst) {
   // Don't use it directly. Use MacroAssembler::incrementq() instead.
   // Use two-byte form (one-byte from is a REX prefix in 64-bit mode)
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xFF);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0xFF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::incq(Address dst) {
   // Don't use it directly. Use MacroAssembler::incrementq() instead.
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rax, dst);
 }
 
@@ -4961,35 +5014,35 @@
 void Assembler::leaq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x8D);
+  emit_int8((unsigned char)0x8D);
   emit_operand(dst, src);
 }
 
 void Assembler::mov64(Register dst, int64_t imm64) {
   InstructionMark im(this);
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xB8 | encode);
+  emit_int8((unsigned char)(0xB8 | encode));
   emit_int64(imm64);
 }
 
 void Assembler::mov_literal64(Register dst, intptr_t imm64, RelocationHolder const& rspec) {
   InstructionMark im(this);
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xB8 | encode);
+  emit_int8(0xB8 | encode);
   emit_data64(imm64, rspec);
 }
 
 void Assembler::mov_narrow_oop(Register dst, int32_t imm32, RelocationHolder const& rspec) {
   InstructionMark im(this);
   int encode = prefix_and_encode(dst->encoding());
-  emit_byte(0xB8 | encode);
+  emit_int8((unsigned char)(0xB8 | encode));
   emit_data((int)imm32, rspec, narrow_oop_operand);
 }
 
 void Assembler::mov_narrow_oop(Address dst, int32_t imm32,  RelocationHolder const& rspec) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0xC7);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 4);
   emit_data((int)imm32, rspec, narrow_oop_operand);
 }
@@ -4997,34 +5050,34 @@
 void Assembler::cmp_narrow_oop(Register src1, int32_t imm32, RelocationHolder const& rspec) {
   InstructionMark im(this);
   int encode = prefix_and_encode(src1->encoding());
-  emit_byte(0x81);
-  emit_byte(0xF8 | encode);
+  emit_int8((unsigned char)0x81);
+  emit_int8((unsigned char)(0xF8 | encode));
   emit_data((int)imm32, rspec, narrow_oop_operand);
 }
 
 void Assembler::cmp_narrow_oop(Address src1, int32_t imm32, RelocationHolder const& rspec) {
   InstructionMark im(this);
   prefix(src1);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rax, src1, 4);
   emit_data((int)imm32, rspec, narrow_oop_operand);
 }
 
 void Assembler::lzcntq(Register dst, Register src) {
   assert(VM_Version::supports_lzcnt(), "encoding is treated as BSR");
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBD);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBD);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movdq(XMMRegister dst, Register src) {
   // table D-1 says MMX/SSE2
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   int encode = simd_prefix_and_encode_q(dst, src, VEX_SIMD_66);
-  emit_byte(0x6E);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x6E);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movdq(Register dst, XMMRegister src) {
@@ -5032,43 +5085,43 @@
   NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   // swap src/dst to get correct prefix
   int encode = simd_prefix_and_encode_q(src, dst, VEX_SIMD_66);
-  emit_byte(0x7E);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x7E);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x8B);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0x8B);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x8B);
+  emit_int8((unsigned char)0x8B);
   emit_operand(dst, src);
 }
 
 void Assembler::movq(Address dst, Register src) {
   InstructionMark im(this);
   prefixq(dst, src);
-  emit_byte(0x89);
+  emit_int8((unsigned char)0x89);
   emit_operand(src, dst);
 }
 
 void Assembler::movsbq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xBE);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBE);
   emit_operand(dst, src);
 }
 
 void Assembler::movsbq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBE);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBE);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movslq(Register dst, int32_t imm32) {
@@ -5078,95 +5131,95 @@
   ShouldNotReachHere();
   InstructionMark im(this);
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xC7 | encode);
-  emit_long(imm32);
+  emit_int8((unsigned char)(0xC7 | encode));
+  emit_int32(imm32);
 }
 
 void Assembler::movslq(Address dst, int32_t imm32) {
   assert(is_simm32(imm32), "lost bits");
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0xC7);
+  emit_int8((unsigned char)0xC7);
   emit_operand(rax, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::movslq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x63);
+  emit_int8(0x63);
   emit_operand(dst, src);
 }
 
 void Assembler::movslq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x63);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x63);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movswq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xBF);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xBF);
   emit_operand(dst, src);
 }
 
 void Assembler::movswq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xBF);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xBF);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::movzbq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB6);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xB6);
   emit_operand(dst, src);
 }
 
 void Assembler::movzbq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xB6);
-  emit_byte(0xC0 | encode);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB6);
+  emit_int8(0xC0 | encode);
 }
 
 void Assembler::movzwq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB7);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xB7);
   emit_operand(dst, src);
 }
 
 void Assembler::movzwq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xB7);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xB7);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::negq(Register dst) {
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xD8 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xD8 | encode));
 }
 
 void Assembler::notq(Register dst) {
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xF7);
-  emit_byte(0xD0 | encode);
+  emit_int8((unsigned char)0xF7);
+  emit_int8((unsigned char)(0xD0 | encode));
 }
 
 void Assembler::orq(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0x81);
+  emit_int8((unsigned char)0x81);
   emit_operand(rcx, dst, 4);
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::orq(Register dst, int32_t imm32) {
@@ -5177,7 +5230,7 @@
 void Assembler::orq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x0B);
+  emit_int8(0x0B);
   emit_operand(dst, src);
 }
 
@@ -5210,26 +5263,26 @@
 void Assembler::popcntq(Register dst, Address src) {
   assert(VM_Version::supports_popcnt(), "must support");
   InstructionMark im(this);
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   prefixq(src, dst);
-  emit_byte(0x0F);
-  emit_byte(0xB8);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xB8);
   emit_operand(dst, src);
 }
 
 void Assembler::popcntq(Register dst, Register src) {
   assert(VM_Version::supports_popcnt(), "must support");
-  emit_byte(0xF3);
+  emit_int8((unsigned char)0xF3);
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x0F);
-  emit_byte(0xB8);
-  emit_byte(0xC0 | encode);
+  emit_int8((unsigned char)0x0F);
+  emit_int8((unsigned char)0xB8);
+  emit_int8((unsigned char)(0xC0 | encode));
 }
 
 void Assembler::popq(Address dst) {
   InstructionMark im(this);
   prefixq(dst);
-  emit_byte(0x8F);
+  emit_int8((unsigned char)0x8F);
   emit_operand(rax, dst);
 }
 
@@ -5261,7 +5314,7 @@
 void Assembler::pushq(Address src) {
   InstructionMark im(this);
   prefixq(src);
-  emit_byte(0xFF);
+  emit_int8((unsigned char)0xFF);
   emit_operand(rsi, src);
 }
 
@@ -5269,31 +5322,31 @@
   assert(isShiftCount(imm8 >> 1), "illegal shift count");
   int encode = prefixq_and_encode(dst->encoding());
   if (imm8 == 1) {
-    emit_byte(0xD1);
-    emit_byte(0xD0 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xD0 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xD0 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)(0xD0 | encode));
+    emit_int8(imm8);
   }
 }
 void Assembler::sarq(Register dst, int imm8) {
   assert(isShiftCount(imm8 >> 1), "illegal shift count");
   int encode = prefixq_and_encode(dst->encoding());
   if (imm8 == 1) {
-    emit_byte(0xD1);
-    emit_byte(0xF8 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xF8 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xF8 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)(0xF8 | encode));
+    emit_int8(imm8);
   }
 }
 
 void Assembler::sarq(Register dst) {
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xF8 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8((unsigned char)(0xF8 | encode));
 }
 
 void Assembler::sbbq(Address dst, int32_t imm32) {
@@ -5310,7 +5363,7 @@
 void Assembler::sbbq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x1B);
+  emit_int8(0x1B);
   emit_operand(dst, src);
 }
 
@@ -5323,33 +5376,33 @@
   assert(isShiftCount(imm8 >> 1), "illegal shift count");
   int encode = prefixq_and_encode(dst->encoding());
   if (imm8 == 1) {
-    emit_byte(0xD1);
-    emit_byte(0xE0 | encode);
+    emit_int8((unsigned char)0xD1);
+    emit_int8((unsigned char)(0xE0 | encode));
   } else {
-    emit_byte(0xC1);
-    emit_byte(0xE0 | encode);
-    emit_byte(imm8);
+    emit_int8((unsigned char)0xC1);
+    emit_int8((unsigned char)(0xE0 | encode));
+    emit_int8(imm8);
   }
 }
 
 void Assembler::shlq(Register dst) {
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xE0 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8((unsigned char)(0xE0 | encode));
 }
 
 void Assembler::shrq(Register dst, int imm8) {
   assert(isShiftCount(imm8 >> 1), "illegal shift count");
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xC1);
-  emit_byte(0xE8 | encode);
-  emit_byte(imm8);
+  emit_int8((unsigned char)0xC1);
+  emit_int8((unsigned char)(0xE8 | encode));
+  emit_int8(imm8);
 }
 
 void Assembler::shrq(Register dst) {
   int encode = prefixq_and_encode(dst->encoding());
-  emit_byte(0xD3);
-  emit_byte(0xE8 | encode);
+  emit_int8((unsigned char)0xD3);
+  emit_int8(0xE8 | encode);
 }
 
 void Assembler::subq(Address dst, int32_t imm32) {
@@ -5361,7 +5414,7 @@
 void Assembler::subq(Address dst, Register src) {
   InstructionMark im(this);
   prefixq(dst, src);
-  emit_byte(0x29);
+  emit_int8(0x29);
   emit_operand(src, dst);
 }
 
@@ -5379,7 +5432,7 @@
 void Assembler::subq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x2B);
+  emit_int8(0x2B);
   emit_operand(dst, src);
 }
 
@@ -5395,13 +5448,13 @@
   int encode = dst->encoding();
   if (encode == 0) {
     prefix(REX_W);
-    emit_byte(0xA9);
+    emit_int8((unsigned char)0xA9);
   } else {
     encode = prefixq_and_encode(encode);
-    emit_byte(0xF7);
-    emit_byte(0xC0 | encode);
+    emit_int8((unsigned char)0xF7);
+    emit_int8((unsigned char)(0xC0 | encode));
   }
-  emit_long(imm32);
+  emit_int32(imm32);
 }
 
 void Assembler::testq(Register dst, Register src) {
@@ -5412,22 +5465,22 @@
 void Assembler::xaddq(Address dst, Register src) {
   InstructionMark im(this);
   prefixq(dst, src);
-  emit_byte(0x0F);
-  emit_byte(0xC1);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xC1);
   emit_operand(src, dst);
 }
 
 void Assembler::xchgq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x87);
+  emit_int8((unsigned char)0x87);
   emit_operand(dst, src);
 }
 
 void Assembler::xchgq(Register dst, Register src) {
   int encode = prefixq_and_encode(dst->encoding(), src->encoding());
-  emit_byte(0x87);
-  emit_byte(0xc0 | encode);
+  emit_int8((unsigned char)0x87);
+  emit_int8((unsigned char)(0xc0 | encode));
 }
 
 void Assembler::xorq(Register dst, Register src) {
@@ -5438,7 +5491,7 @@
 void Assembler::xorq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
-  emit_byte(0x33);
+  emit_int8(0x33);
   emit_operand(dst, src);
 }
 
--- a/src/cpu/x86/vm/assembler_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/assembler_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -832,7 +832,8 @@
 
   // These do register sized moves/scans
   void rep_mov();
-  void rep_set();
+  void rep_stos();
+  void rep_stosb();
   void repne_scan();
 #ifdef _LP64
   void repne_scanl();
@@ -1394,6 +1395,10 @@
   // Pack with unsigned saturation
   void packuswb(XMMRegister dst, XMMRegister src);
   void packuswb(XMMRegister dst, Address src);
+  void vpackuswb(XMMRegister dst, XMMRegister nds, XMMRegister src, bool vector256);
+
+  // Pemutation of 64bit words
+  void vpermq(XMMRegister dst, XMMRegister src, int imm8, bool vector256);
 
   // SSE4.2 string instructions
   void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8);
@@ -1443,9 +1448,12 @@
   // Shift Right by bytes Logical DoubleQuadword Immediate
   void psrldq(XMMRegister dst, int shift);
 
-  // Logical Compare Double Quadword
+  // Logical Compare 128bit
   void ptest(XMMRegister dst, XMMRegister src);
   void ptest(XMMRegister dst, Address src);
+  // Logical Compare 256bit
+  void vptest(XMMRegister dst, XMMRegister src);
+  void vptest(XMMRegister dst, Address src);
 
   // Interleave Low Bytes
   void punpcklbw(XMMRegister dst, XMMRegister src);
@@ -1753,6 +1761,9 @@
   void vextractf128h(Address dst, XMMRegister src);
   void vextracti128h(Address dst, XMMRegister src);
 
+  // duplicate 4-bytes integer data from src into 8 locations in dest
+  void vpbroadcastd(XMMRegister dst, XMMRegister src);
+
   // AVX instruction which is used to clear upper 128 bits of YMM registers and
   // to avoid transaction penalty between AVX and SSE states. There is no
   // penalty if legacy SSE instructions are encoded using VEX prefix because
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -313,10 +313,10 @@
 #endif
   } else {
     // make a copy the code which is going to be patched.
-    for ( int i = 0; i < _bytes_to_copy; i++) {
+    for (int i = 0; i < _bytes_to_copy; i++) {
       address ptr = (address)(_pc_start + i);
       int a_byte = (*ptr) & 0xFF;
-      __ a_byte (a_byte);
+      __ emit_int8(a_byte);
       *ptr = 0x90; // make the site look like a nop
     }
   }
@@ -363,11 +363,11 @@
   // emit the offsets needed to find the code to patch
   int being_initialized_entry_offset = __ pc() - being_initialized_entry + sizeof_patch_record;
 
-  __ a_byte(0xB8);
-  __ a_byte(0);
-  __ a_byte(being_initialized_entry_offset);
-  __ a_byte(bytes_to_skip);
-  __ a_byte(_bytes_to_copy);
+  __ emit_int8((unsigned char)0xB8);
+  __ emit_int8(0);
+  __ emit_int8(being_initialized_entry_offset);
+  __ emit_int8(bytes_to_skip);
+  __ emit_int8(_bytes_to_copy);
   address patch_info_pc = __ pc();
   assert(patch_info_pc - end_of_patch == bytes_to_skip, "incorrect patch info");
 
--- a/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -611,8 +611,6 @@
   // C++ interpreter only
   // rsi/r13 - previous interpreter state pointer
 
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
-
   // InterpreterRuntime::frequency_counter_overflow takes one argument
   // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
   // The call returns the address of the verified entry point for the method or NULL
@@ -977,15 +975,16 @@
   //      to save/restore.
   address entry_point = __ pc();
 
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
-  const Address size_of_locals    (rbx, Method::size_of_locals_offset());
+  const Address constMethod       (rbx, Method::const_offset());
   const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   const Address access_flags      (rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
 
   // rsi/r13 == state/locals rdi == prevstate
   const Register locals = rdi;
 
   // get parameter size (always needed)
+  __ movptr(rcx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // rbx: Method*
@@ -994,6 +993,7 @@
   // for natives the size of locals is zero
 
   // compute beginning of parameters /locals
+
   __ lea(locals, Address(rsp, rcx, Address::times_ptr, -wordSize));
 
   // initialize fixed part of activation frame
@@ -1107,11 +1107,14 @@
   const Register method = rbx;
   const Register thread = LP64_ONLY(r15_thread) NOT_LP64(rdi);
   const Register t      = InterpreterRuntime::SignatureHandlerGenerator::temp();    // rcx|rscratch1
+  const Address constMethod       (method, Method::const_offset());
+  const Address size_of_parameters(t, ConstMethod::size_of_parameters_offset());
 
   // allocate space for parameters
   __ movptr(method, STATE(_method));
   __ verify_method_ptr(method);
-  __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
+  __ movptr(t, constMethod);
+  __ load_unsigned_short(t, size_of_parameters);
   __ shll(t, 2);
 #ifdef _LP64
   __ subptr(rsp, t);
@@ -1700,15 +1703,17 @@
   // save sender sp
   __ push(rcx);
 
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
-  const Address size_of_locals    (rbx, Method::size_of_locals_offset());
+  const Address constMethod       (rbx, Method::const_offset());
   const Address access_flags      (rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
+  const Address size_of_locals    (rdx, ConstMethod::size_of_locals_offset());
 
   // const Address monitor_block_top (rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
   // const Address monitor_block_bot (rbp, frame::interpreter_frame_initial_sp_offset        * wordSize);
   // const Address monitor(rbp, frame::interpreter_frame_initial_sp_offset * wordSize - (int)sizeof(BasicObjectLock));
 
   // get parameter size (always needed)
+  __ movptr(rdx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // rbx: Method*
@@ -1989,7 +1994,9 @@
   __ movptr(rbx, STATE(_result._to_call._callee));
 
   // callee left args on top of expression stack, remove them
-  __ load_unsigned_short(rcx, Address(rbx, Method::size_of_parameters_offset()));
+  __ movptr(rcx, constMethod);
+  __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
+
   __ lea(rsp, Address(rsp, rcx, Address::times_ptr));
 
   __ movl(rcx, Address(rbx, Method::result_index_offset()));
@@ -2159,7 +2166,9 @@
   // Make it look like call_stub calling conventions
 
   // Get (potential) receiver
-  __ load_unsigned_short(rcx, size_of_parameters);                   // get size of parameters in words
+  // get size of parameters in words
+  __ movptr(rcx, constMethod);
+  __ load_unsigned_short(rcx, Address(rcx, ConstMethod::size_of_parameters_offset()));
 
   ExternalAddress recursive(CAST_FROM_FN_PTR(address, RecursiveInterpreterActivation));
   __ pushptr(recursive.addr());                                      // make it look good in the debugger
--- a/src/cpu/x86/vm/globals_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/globals_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -120,6 +120,9 @@
   product(bool, UseUnalignedLoadStores, false,                              \
           "Use SSE2 MOVDQU instruction for Arraycopy")                      \
                                                                             \
+  product(bool, UseFastStosb, false,                                        \
+          "Use fast-string operation for zeroing: rep stosb")               \
+                                                                            \
   /* assembler */                                                           \
   product(bool, Use486InstrsOnly, false,                                    \
           "Use 80486 Compliant instruction subset")                         \
--- a/src/cpu/x86/vm/jni_x86.h	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/jni_x86.h	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -38,14 +38,9 @@
 
   #define JNICALL
   typedef int jint;
-#if defined(_LP64) && !defined(__APPLE__)
+#if defined(_LP64)
   typedef long jlong;
 #else
-  /*
-   * On _LP64 __APPLE__ "long" and "long long" are both 64 bits,
-   * but we use the "long long" typedef to avoid complaints from
-   * the __APPLE__ compiler about fprintf formats.
-   */
   typedef long long jlong;
 #endif
 
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1023,7 +1023,7 @@
 
 void MacroAssembler::leave() {
   // %%% is this really better? Why not on 32bit too?
-  emit_byte(0xC9); // LEAVE
+  emit_int8((unsigned char)0xC9); // LEAVE
 }
 
 void MacroAssembler::lneg(Register hi, Register lo) {
@@ -2112,11 +2112,11 @@
   if (UseAddressNop) {
     addr_nop_5();
   } else {
-    emit_byte(0x26); // es:
-    emit_byte(0x2e); // cs:
-    emit_byte(0x64); // fs:
-    emit_byte(0x65); // gs:
-    emit_byte(0x90);
+    emit_int8(0x26); // es:
+    emit_int8(0x2e); // cs:
+    emit_int8(0x64); // fs:
+    emit_int8(0x65); // gs:
+    emit_int8((unsigned char)0x90);
   }
 }
 
@@ -2534,13 +2534,13 @@
     int offs = (intptr_t)dst.target() - ((intptr_t)pc());
     if (dst.reloc() == relocInfo::none && is8bit(offs - short_size)) {
       // 0111 tttn #8-bit disp
-      emit_byte(0x70 | cc);
-      emit_byte((offs - short_size) & 0xFF);
+      emit_int8(0x70 | cc);
+      emit_int8((offs - short_size) & 0xFF);
     } else {
       // 0000 1111 1000 tttn #32-bit disp
-      emit_byte(0x0F);
-      emit_byte(0x80 | cc);
-      emit_long(offs - long_size);
+      emit_int8(0x0F);
+      emit_int8((unsigned char)(0x80 | cc));
+      emit_int32(offs - long_size);
     }
   } else {
 #ifdef ASSERT
@@ -3085,7 +3085,8 @@
 
 void MacroAssembler::pshufb(XMMRegister dst, AddressLiteral src) {
   // Used in sign-bit flipping with aligned address.
-  assert((UseAVX > 0) || (((intptr_t)src.target() & 15) == 0), "SSE mode requires address alignment 16 bytes");
+  bool aligned_adr = (((intptr_t)src.target() & 15) == 0);
+  assert((UseAVX > 0) || aligned_adr, "SSE mode requires address alignment 16 bytes");
   if (reachable(src)) {
     Assembler::pshufb(dst, as_Address(src));
   } else {
@@ -5223,6 +5224,22 @@
 
 }
 
+void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp) {
+  // cnt - number of qwords (8-byte words).
+  // base - start address, qword aligned.
+  assert(base==rdi, "base register must be edi for rep stos");
+  assert(tmp==rax,   "tmp register must be eax for rep stos");
+  assert(cnt==rcx,   "cnt register must be ecx for rep stos");
+
+  xorptr(tmp, tmp);
+  if (UseFastStosb) {
+    shlptr(cnt,3); // convert to number of bytes
+    rep_stosb();
+  } else {
+    NOT_LP64(shlptr(cnt,1);) // convert to number of dwords for 32-bit VM
+    rep_stos();
+  }
+}
 
 // IndexOf for constant substrings with size >= 8 chars
 // which don't need to be loaded through stack.
@@ -5658,42 +5675,114 @@
   testl(cnt2, cnt2);
   jcc(Assembler::zero, LENGTH_DIFF_LABEL);
 
-  // Load first characters
+  // Compare first characters
   load_unsigned_short(result, Address(str1, 0));
   load_unsigned_short(cnt1, Address(str2, 0));
-
-  // Compare first characters
   subl(result, cnt1);
   jcc(Assembler::notZero,  POP_LABEL);
-  decrementl(cnt2);
-  jcc(Assembler::zero, LENGTH_DIFF_LABEL);
-
-  {
-    // Check after comparing first character to see if strings are equivalent
-    Label LSkip2;
-    // Check if the strings start at same location
-    cmpptr(str1, str2);
-    jccb(Assembler::notEqual, LSkip2);
-
-    // Check if the length difference is zero (from stack)
-    cmpl(Address(rsp, 0), 0x0);
-    jcc(Assembler::equal,  LENGTH_DIFF_LABEL);
-
-    // Strings might not be equivalent
-    bind(LSkip2);
-  }
+  cmpl(cnt2, 1);
+  jcc(Assembler::equal, LENGTH_DIFF_LABEL);
+
+  // Check if the strings start at the same location.
+  cmpptr(str1, str2);
+  jcc(Assembler::equal, LENGTH_DIFF_LABEL);
 
   Address::ScaleFactor scale = Address::times_2;
   int stride = 8;
 
-  // Advance to next element
-  addptr(str1, 16/stride);
-  addptr(str2, 16/stride);
-
-  if (UseSSE42Intrinsics) {
+  if (UseAVX >= 2) {
+    Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_WIDE_TAIL, COMPARE_SMALL_STR;
+    Label COMPARE_WIDE_VECTORS_LOOP, COMPARE_16_CHARS, COMPARE_INDEX_CHAR;
+    Label COMPARE_TAIL_LONG;
+    int pcmpmask = 0x19;
+
+    // Setup to compare 16-chars (32-bytes) vectors,
+    // start from first character again because it has aligned address.
+    int stride2 = 16;
+    int adr_stride  = stride  << scale;
+    int adr_stride2 = stride2 << scale;
+
+    assert(result == rax && cnt2 == rdx && cnt1 == rcx, "pcmpestri");
+    // rax and rdx are used by pcmpestri as elements counters
+    movl(result, cnt2);
+    andl(cnt2, ~(stride2-1));   // cnt2 holds the vector count
+    jcc(Assembler::zero, COMPARE_TAIL_LONG);
+
+    // fast path : compare first 2 8-char vectors.
+    bind(COMPARE_16_CHARS);
+    movdqu(vec1, Address(str1, 0));
+    pcmpestri(vec1, Address(str2, 0), pcmpmask);
+    jccb(Assembler::below, COMPARE_INDEX_CHAR);
+
+    movdqu(vec1, Address(str1, adr_stride));
+    pcmpestri(vec1, Address(str2, adr_stride), pcmpmask);
+    jccb(Assembler::aboveEqual, COMPARE_WIDE_VECTORS);
+    addl(cnt1, stride);
+
+    // Compare the characters at index in cnt1
+    bind(COMPARE_INDEX_CHAR); //cnt1 has the offset of the mismatching character
+    load_unsigned_short(result, Address(str1, cnt1, scale));
+    load_unsigned_short(cnt2, Address(str2, cnt1, scale));
+    subl(result, cnt2);
+    jmp(POP_LABEL);
+
+    // Setup the registers to start vector comparison loop
+    bind(COMPARE_WIDE_VECTORS);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    subl(result, stride2);
+    subl(cnt2, stride2);
+    jccb(Assembler::zero, COMPARE_WIDE_TAIL);
+    negptr(result);
+
+    //  In a loop, compare 16-chars (32-bytes) at once using (vpxor+vptest)
+    bind(COMPARE_WIDE_VECTORS_LOOP);
+    vmovdqu(vec1, Address(str1, result, scale));
+    vpxor(vec1, Address(str2, result, scale));
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, VECTOR_NOT_EQUAL);
+    addptr(result, stride2);
+    subl(cnt2, stride2);
+    jccb(Assembler::notZero, COMPARE_WIDE_VECTORS_LOOP);
+
+    // compare wide vectors tail
+    bind(COMPARE_WIDE_TAIL);
+    testptr(result, result);
+    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
+
+    movl(result, stride2);
+    movl(cnt2, result);
+    negptr(result);
+    jmpb(COMPARE_WIDE_VECTORS_LOOP);
+
+    // Identifies the mismatching (higher or lower)16-bytes in the 32-byte vectors.
+    bind(VECTOR_NOT_EQUAL);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    jmp(COMPARE_16_CHARS);
+
+    // Compare tail chars, length between 1 to 15 chars
+    bind(COMPARE_TAIL_LONG);
+    movl(cnt2, result);
+    cmpl(cnt2, stride);
+    jccb(Assembler::less, COMPARE_SMALL_STR);
+
+    movdqu(vec1, Address(str1, 0));
+    pcmpestri(vec1, Address(str2, 0), pcmpmask);
+    jcc(Assembler::below, COMPARE_INDEX_CHAR);
+    subptr(cnt2, stride);
+    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
+    lea(str1, Address(str1, result, scale));
+    lea(str2, Address(str2, result, scale));
+    negptr(cnt2);
+    jmpb(WHILE_HEAD_LABEL);
+
+    bind(COMPARE_SMALL_STR);
+  } else if (UseSSE42Intrinsics) {
     Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_TAIL;
     int pcmpmask = 0x19;
-    // Setup to compare 16-byte vectors
+    // Setup to compare 8-char (16-byte) vectors,
+    // start from first character again because it has aligned address.
     movl(result, cnt2);
     andl(cnt2, ~(stride - 1));   // cnt2 holds the vector count
     jccb(Assembler::zero, COMPARE_TAIL);
@@ -5725,7 +5814,7 @@
     jccb(Assembler::notZero, COMPARE_WIDE_VECTORS);
 
     // compare wide vectors tail
-    testl(result, result);
+    testptr(result, result);
     jccb(Assembler::zero, LENGTH_DIFF_LABEL);
 
     movl(cnt2, stride);
@@ -5737,21 +5826,20 @@
 
     // Mismatched characters in the vectors
     bind(VECTOR_NOT_EQUAL);
-    addptr(result, cnt1);
-    movptr(cnt2, result);
-    load_unsigned_short(result, Address(str1, cnt2, scale));
-    load_unsigned_short(cnt1, Address(str2, cnt2, scale));
-    subl(result, cnt1);
+    addptr(cnt1, result);
+    load_unsigned_short(result, Address(str1, cnt1, scale));
+    load_unsigned_short(cnt2, Address(str2, cnt1, scale));
+    subl(result, cnt2);
     jmpb(POP_LABEL);
 
     bind(COMPARE_TAIL); // limit is zero
     movl(cnt2, result);
     // Fallthru to tail compare
   }
-
   // Shift str2 and str1 to the end of the arrays, negate min
-  lea(str1, Address(str1, cnt2, scale, 0));
-  lea(str2, Address(str2, cnt2, scale, 0));
+  lea(str1, Address(str1, cnt2, scale));
+  lea(str2, Address(str2, cnt2, scale));
+  decrementl(cnt2);  // first character was compared already
   negptr(cnt2);
 
   // Compare the rest of the elements
@@ -5816,7 +5904,44 @@
   shll(limit, 1);      // byte count != 0
   movl(result, limit); // copy
 
-  if (UseSSE42Intrinsics) {
+  if (UseAVX >= 2) {
+    // With AVX2, use 32-byte vector compare
+    Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
+
+    // Compare 32-byte vectors
+    andl(result, 0x0000001e);  //   tail count (in bytes)
+    andl(limit, 0xffffffe0);   // vector count (in bytes)
+    jccb(Assembler::zero, COMPARE_TAIL);
+
+    lea(ary1, Address(ary1, limit, Address::times_1));
+    lea(ary2, Address(ary2, limit, Address::times_1));
+    negptr(limit);
+
+    bind(COMPARE_WIDE_VECTORS);
+    vmovdqu(vec1, Address(ary1, limit, Address::times_1));
+    vmovdqu(vec2, Address(ary2, limit, Address::times_1));
+    vpxor(vec1, vec2);
+
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, FALSE_LABEL);
+    addptr(limit, 32);
+    jcc(Assembler::notZero, COMPARE_WIDE_VECTORS);
+
+    testl(result, result);
+    jccb(Assembler::zero, TRUE_LABEL);
+
+    vmovdqu(vec1, Address(ary1, result, Address::times_1, -32));
+    vmovdqu(vec2, Address(ary2, result, Address::times_1, -32));
+    vpxor(vec1, vec2);
+
+    vptest(vec1, vec1);
+    jccb(Assembler::notZero, FALSE_LABEL);
+    jmpb(TRUE_LABEL);
+
+    bind(COMPARE_TAIL); // limit is zero
+    movl(limit, result);
+    // Fallthru to tail compare
+  } else if (UseSSE42Intrinsics) {
     // With SSE4.2, use double quad vector compare
     Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
 
@@ -5994,29 +6119,53 @@
     {
       assert( UseSSE >= 2, "supported cpu only" );
       Label L_fill_32_bytes_loop, L_check_fill_8_bytes, L_fill_8_bytes_loop, L_fill_8_bytes;
-      // Fill 32-byte chunks
       movdl(xtmp, value);
-      pshufd(xtmp, xtmp, 0);
-
-      subl(count, 8 << shift);
-      jcc(Assembler::less, L_check_fill_8_bytes);
-      align(16);
-
-      BIND(L_fill_32_bytes_loop);
-
-      if (UseUnalignedLoadStores) {
-        movdqu(Address(to, 0), xtmp);
-        movdqu(Address(to, 16), xtmp);
+      if (UseAVX >= 2 && UseUnalignedLoadStores) {
+        // Fill 64-byte chunks
+        Label L_fill_64_bytes_loop, L_check_fill_32_bytes;
+        vpbroadcastd(xtmp, xtmp);
+
+        subl(count, 16 << shift);
+        jcc(Assembler::less, L_check_fill_32_bytes);
+        align(16);
+
+        BIND(L_fill_64_bytes_loop);
+        vmovdqu(Address(to, 0), xtmp);
+        vmovdqu(Address(to, 32), xtmp);
+        addptr(to, 64);
+        subl(count, 16 << shift);
+        jcc(Assembler::greaterEqual, L_fill_64_bytes_loop);
+
+        BIND(L_check_fill_32_bytes);
+        addl(count, 8 << shift);
+        jccb(Assembler::less, L_check_fill_8_bytes);
+        vmovdqu(Address(to, 0), xtmp);
+        addptr(to, 32);
+        subl(count, 8 << shift);
       } else {
-        movq(Address(to, 0), xtmp);
-        movq(Address(to, 8), xtmp);
-        movq(Address(to, 16), xtmp);
-        movq(Address(to, 24), xtmp);
+        // Fill 32-byte chunks
+        pshufd(xtmp, xtmp, 0);
+
+        subl(count, 8 << shift);
+        jcc(Assembler::less, L_check_fill_8_bytes);
+        align(16);
+
+        BIND(L_fill_32_bytes_loop);
+
+        if (UseUnalignedLoadStores) {
+          movdqu(Address(to, 0), xtmp);
+          movdqu(Address(to, 16), xtmp);
+        } else {
+          movq(Address(to, 0), xtmp);
+          movq(Address(to, 8), xtmp);
+          movq(Address(to, 16), xtmp);
+          movq(Address(to, 24), xtmp);
+        }
+
+        addptr(to, 32);
+        subl(count, 8 << shift);
+        jcc(Assembler::greaterEqual, L_fill_32_bytes_loop);
       }
-
-      addptr(to, 32);
-      subl(count, 8 << shift);
-      jcc(Assembler::greaterEqual, L_fill_32_bytes_loop);
       BIND(L_check_fill_8_bytes);
       addl(count, 8 << shift);
       jccb(Assembler::zero, L_exit);
@@ -6060,6 +6209,128 @@
   }
   BIND(L_exit);
 }
+
+// encode char[] to byte[] in ISO_8859_1
+void MacroAssembler::encode_iso_array(Register src, Register dst, Register len,
+                                      XMMRegister tmp1Reg, XMMRegister tmp2Reg,
+                                      XMMRegister tmp3Reg, XMMRegister tmp4Reg,
+                                      Register tmp5, Register result) {
+  // rsi: src
+  // rdi: dst
+  // rdx: len
+  // rcx: tmp5
+  // rax: result
+  ShortBranchVerifier sbv(this);
+  assert_different_registers(src, dst, len, tmp5, result);
+  Label L_done, L_copy_1_char, L_copy_1_char_exit;
+
+  // set result
+  xorl(result, result);
+  // check for zero length
+  testl(len, len);
+  jcc(Assembler::zero, L_done);
+  movl(result, len);
+
+  // Setup pointers
+  lea(src, Address(src, len, Address::times_2)); // char[]
+  lea(dst, Address(dst, len, Address::times_1)); // byte[]
+  negptr(len);
+
+  if (UseSSE42Intrinsics || UseAVX >= 2) {
+    Label L_chars_8_check, L_copy_8_chars, L_copy_8_chars_exit;
+    Label L_chars_16_check, L_copy_16_chars, L_copy_16_chars_exit;
+
+    if (UseAVX >= 2) {
+      Label L_chars_32_check, L_copy_32_chars, L_copy_32_chars_exit;
+      movl(tmp5, 0xff00ff00);   // create mask to test for Unicode chars in vector
+      movdl(tmp1Reg, tmp5);
+      vpbroadcastd(tmp1Reg, tmp1Reg);
+      jmpb(L_chars_32_check);
+
+      bind(L_copy_32_chars);
+      vmovdqu(tmp3Reg, Address(src, len, Address::times_2, -64));
+      vmovdqu(tmp4Reg, Address(src, len, Address::times_2, -32));
+      vpor(tmp2Reg, tmp3Reg, tmp4Reg, /* vector256 */ true);
+      vptest(tmp2Reg, tmp1Reg);       // check for Unicode chars in  vector
+      jccb(Assembler::notZero, L_copy_32_chars_exit);
+      vpackuswb(tmp3Reg, tmp3Reg, tmp4Reg, /* vector256 */ true);
+      vpermq(tmp4Reg, tmp3Reg, 0xD8, /* vector256 */ true);
+      vmovdqu(Address(dst, len, Address::times_1, -32), tmp4Reg);
+
+      bind(L_chars_32_check);
+      addptr(len, 32);
+      jccb(Assembler::lessEqual, L_copy_32_chars);
+
+      bind(L_copy_32_chars_exit);
+      subptr(len, 16);
+      jccb(Assembler::greater, L_copy_16_chars_exit);
+
+    } else if (UseSSE42Intrinsics) {
+      movl(tmp5, 0xff00ff00);   // create mask to test for Unicode chars in vector
+      movdl(tmp1Reg, tmp5);
+      pshufd(tmp1Reg, tmp1Reg, 0);
+      jmpb(L_chars_16_check);
+    }
+
+    bind(L_copy_16_chars);
+    if (UseAVX >= 2) {
+      vmovdqu(tmp2Reg, Address(src, len, Address::times_2, -32));
+      vptest(tmp2Reg, tmp1Reg);
+      jccb(Assembler::notZero, L_copy_16_chars_exit);
+      vpackuswb(tmp2Reg, tmp2Reg, tmp1Reg, /* vector256 */ true);
+      vpermq(tmp3Reg, tmp2Reg, 0xD8, /* vector256 */ true);
+    } else {
+      if (UseAVX > 0) {
+        movdqu(tmp3Reg, Address(src, len, Address::times_2, -32));
+        movdqu(tmp4Reg, Address(src, len, Address::times_2, -16));
+        vpor(tmp2Reg, tmp3Reg, tmp4Reg, /* vector256 */ false);
+      } else {
+        movdqu(tmp3Reg, Address(src, len, Address::times_2, -32));
+        por(tmp2Reg, tmp3Reg);
+        movdqu(tmp4Reg, Address(src, len, Address::times_2, -16));
+        por(tmp2Reg, tmp4Reg);
+      }
+      ptest(tmp2Reg, tmp1Reg);       // check for Unicode chars in  vector
+      jccb(Assembler::notZero, L_copy_16_chars_exit);
+      packuswb(tmp3Reg, tmp4Reg);
+    }
+    movdqu(Address(dst, len, Address::times_1, -16), tmp3Reg);
+
+    bind(L_chars_16_check);
+    addptr(len, 16);
+    jccb(Assembler::lessEqual, L_copy_16_chars);
+
+    bind(L_copy_16_chars_exit);
+    subptr(len, 8);
+    jccb(Assembler::greater, L_copy_8_chars_exit);
+
+    bind(L_copy_8_chars);
+    movdqu(tmp3Reg, Address(src, len, Address::times_2, -16));
+    ptest(tmp3Reg, tmp1Reg);
+    jccb(Assembler::notZero, L_copy_8_chars_exit);
+    packuswb(tmp3Reg, tmp1Reg);
+    movq(Address(dst, len, Address::times_1, -8), tmp3Reg);
+    addptr(len, 8);
+    jccb(Assembler::lessEqual, L_copy_8_chars);
+
+    bind(L_copy_8_chars_exit);
+    subptr(len, 8);
+    jccb(Assembler::zero, L_done);
+  }
+
+  bind(L_copy_1_char);
+  load_unsigned_short(tmp5, Address(src, len, Address::times_2, 0));
+  testl(tmp5, 0xff00);      // check if Unicode char
+  jccb(Assembler::notZero, L_copy_1_char_exit);
+  movb(Address(dst, len, Address::times_1, 0), tmp5);
+  addptr(len, 1);
+  jccb(Assembler::less, L_copy_1_char);
+
+  bind(L_copy_1_char_exit);
+  addptr(result, len); // len is negative count of not processed elements
+  bind(L_done);
+}
+
 #undef BIND
 #undef BLOCK_COMMENT
 
--- a/src/cpu/x86/vm/macroAssembler_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/macroAssembler_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -126,25 +126,6 @@
     }
   }
 
-#ifndef PRODUCT
-  static void pd_print_patched_instruction(address branch) {
-    const char* s;
-    unsigned char op = branch[0];
-    if (op == 0xE8) {
-      s = "call";
-    } else if (op == 0xE9 || op == 0xEB) {
-      s = "jmp";
-    } else if ((op & 0xF0) == 0x70) {
-      s = "jcc";
-    } else if (op == 0x0F) {
-      s = "jcc";
-    } else {
-      s = "????";
-    }
-    tty->print("%s (unresolved)", s);
-  }
-#endif
-
   // The following 4 methods return the offset of the appropriate move instruction
 
   // Support for fast byte/short loading with zero extension (depending on particular CPU)
@@ -1030,6 +1011,10 @@
       Assembler::vxorpd(dst, nds, src, vector256);
   }
 
+  // Simple version for AVX2 256bit vectors
+  void vpxor(XMMRegister dst, XMMRegister src) { Assembler::vpxor(dst, dst, src, true); }
+  void vpxor(XMMRegister dst, Address src) { Assembler::vpxor(dst, dst, src, true); }
+
   // Move packed integer values from low 128 bit to hign 128 bit in 256 bit vector.
   void vinserti128h(XMMRegister dst, XMMRegister nds, XMMRegister src) {
     if (UseAVX > 1) // vinserti128h is available only in AVX2
@@ -1115,6 +1100,9 @@
   // C2 compiled method's prolog code.
   void verified_entry(int framesize, bool stack_bang, bool fp_mode_24b);
 
+  // clear memory of size 'cnt' qwords, starting at 'base'.
+  void clear_mem(Register base, Register cnt, Register rtmp);
+
   // IndexOf strings.
   // Small strings are loaded through stack if they cross page boundary.
   void string_indexof(Register str1, Register str2,
@@ -1147,6 +1135,10 @@
                      Register to, Register value, Register count,
                      Register rtmp, XMMRegister xtmp);
 
+  void encode_iso_array(Register src, Register dst, Register len,
+                        XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3,
+                        XMMRegister tmp4, Register tmp5, Register result);
+
 #undef VIRTUAL
 
 };
--- a/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -169,8 +169,9 @@
 
   if (VerifyMethodHandles && !for_compiler_entry) {
     // make sure recv is already on stack
+    __ movptr(temp2, Address(method_temp, Method::const_offset()));
     __ load_sized_value(temp2,
-                        Address(method_temp, Method::size_of_parameters_offset()),
+                        Address(temp2, ConstMethod::size_of_parameters_offset()),
                         sizeof(u2), /*is_signed*/ false);
     // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
     Label L;
@@ -234,8 +235,9 @@
   int ref_kind = signature_polymorphic_intrinsic_ref_kind(iid);
   assert(ref_kind != 0 || iid == vmIntrinsics::_invokeBasic, "must be _invokeBasic or a linkTo intrinsic");
   if (ref_kind == 0 || MethodHandles::ref_kind_has_receiver(ref_kind)) {
+    __ movptr(rdx_argp, Address(rbx_method, Method::const_offset()));
     __ load_sized_value(rdx_argp,
-                        Address(rbx_method, Method::size_of_parameters_offset()),
+                        Address(rdx_argp, ConstMethod::size_of_parameters_offset()),
                         sizeof(u2), /*is_signed*/ false);
     // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
     rdx_first_arg_addr = __ argument_address(rdx_argp, -1);
--- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -796,16 +796,22 @@
     __ align(OptoLoopAlignment);
   __ BIND(L_copy_64_bytes_loop);
 
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(from, 0));
-      __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0);
-      __ movdqu(xmm1, Address(from, 16));
-      __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1);
-      __ movdqu(xmm2, Address(from, 32));
-      __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2);
-      __ movdqu(xmm3, Address(from, 48));
-      __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3);
-
+    if (UseUnalignedLoadStores) {
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from,  0));
+        __ vmovdqu(Address(from, to_from, Address::times_1,  0), xmm0);
+        __ vmovdqu(xmm1, Address(from, 32));
+        __ vmovdqu(Address(from, to_from, Address::times_1, 32), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(from, 0));
+        __ movdqu(Address(from, to_from, Address::times_1, 0), xmm0);
+        __ movdqu(xmm1, Address(from, 16));
+        __ movdqu(Address(from, to_from, Address::times_1, 16), xmm1);
+        __ movdqu(xmm2, Address(from, 32));
+        __ movdqu(Address(from, to_from, Address::times_1, 32), xmm2);
+        __ movdqu(xmm3, Address(from, 48));
+        __ movdqu(Address(from, to_from, Address::times_1, 48), xmm3);
+      }
     } else {
       __ movq(xmm0, Address(from, 0));
       __ movq(Address(from, to_from, Address::times_1, 0), xmm0);
@@ -2174,13 +2180,13 @@
   //   c_rarg2   - K (key) in little endian int array
   //
   address generate_aescrypt_encryptBlock() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
     Label L_doLast;
     address start = __ pc();
 
-    const Register from        = rsi;      // source array address
+    const Register from        = rdx;      // source array address
     const Register to          = rdx;      // destination array address
     const Register key         = rcx;      // key array address
     const Register keylen      = rax;
@@ -2189,47 +2195,74 @@
     const Address  key_param (rbp, 8+8);
 
     const XMMRegister xmm_result = xmm0;
-    const XMMRegister xmm_temp   = xmm1;
-    const XMMRegister xmm_key_shuf_mask = xmm2;
-
-    __ enter(); // required for proper stackwalking of RuntimeStub frame
-    __ push(rsi);
-    __ movptr(from , from_param);
-    __ movptr(to   , to_param);
-    __ movptr(key  , key_param);
-
+    const XMMRegister xmm_key_shuf_mask = xmm1;
+    const XMMRegister xmm_temp1  = xmm2;
+    const XMMRegister xmm_temp2  = xmm3;
+    const XMMRegister xmm_temp3  = xmm4;
+    const XMMRegister xmm_temp4  = xmm5;
+
+    __ enter();   // required for proper stackwalking of RuntimeStub frame
+    __ movptr(from, from_param);
+    __ movptr(key, key_param);
+
+    // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
-    // keylen = # of 32-bit words, convert to 128-bit words
-    __ shrl(keylen, 2);
-    __ subl(keylen, 11);   // every key has at least 11 128-bit words, some have more
 
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
     __ movdqu(xmm_result, Address(from, 0));  // get 16 bytes of input
+    __ movptr(to, to_param);
 
     // For encryption, the java expanded key ordering is just what we need
 
-    load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
-    __ pxor(xmm_result, xmm_temp);
-    for (int offset = 0x10; offset <= 0x90; offset += 0x10) {
-      aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
-    }
-    load_key  (xmm_temp, key, 0xa0, xmm_key_shuf_mask);
-    __ cmpl(keylen, 0);
-    __ jcc(Assembler::equal, L_doLast);
-    __ aesenc(xmm_result, xmm_temp);                   // only in 192 and 256 bit keys
-    aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
-    load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask);
-    __ subl(keylen, 2);
-    __ jcc(Assembler::equal, L_doLast);
-    __ aesenc(xmm_result, xmm_temp);                   // only in 256 bit keys
-    aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
-    load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask);
+    load_key(xmm_temp1, key, 0x00, xmm_key_shuf_mask);
+    __ pxor(xmm_result, xmm_temp1);
+
+    load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+    __ aesenc(xmm_result, xmm_temp3);
+    __ aesenc(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+    __ aesenc(xmm_result, xmm_temp3);
+    __ aesenc(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 44);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 52);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask);
 
     __ BIND(L_doLast);
-    __ aesenclast(xmm_result, xmm_temp);
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenclast(xmm_result, xmm_temp2);
     __ movdqu(Address(to, 0), xmm_result);        // store the result
     __ xorptr(rax, rax); // return 0
-    __ pop(rsi);
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -2245,13 +2278,13 @@
   //   c_rarg2   - K (key) in little endian int array
   //
   address generate_aescrypt_decryptBlock() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
     Label L_doLast;
     address start = __ pc();
 
-    const Register from        = rsi;      // source array address
+    const Register from        = rdx;      // source array address
     const Register to          = rdx;      // destination array address
     const Register key         = rcx;      // key array address
     const Register keylen      = rax;
@@ -2260,51 +2293,76 @@
     const Address  key_param (rbp, 8+8);
 
     const XMMRegister xmm_result = xmm0;
-    const XMMRegister xmm_temp   = xmm1;
-    const XMMRegister xmm_key_shuf_mask = xmm2;
+    const XMMRegister xmm_key_shuf_mask = xmm1;
+    const XMMRegister xmm_temp1  = xmm2;
+    const XMMRegister xmm_temp2  = xmm3;
+    const XMMRegister xmm_temp3  = xmm4;
+    const XMMRegister xmm_temp4  = xmm5;
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
-    __ push(rsi);
-    __ movptr(from , from_param);
-    __ movptr(to   , to_param);
-    __ movptr(key  , key_param);
-
+    __ movptr(from, from_param);
+    __ movptr(key, key_param);
+
+    // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
-    // keylen = # of 32-bit words, convert to 128-bit words
-    __ shrl(keylen, 2);
-    __ subl(keylen, 11);   // every key has at least 11 128-bit words, some have more
 
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
     __ movdqu(xmm_result, Address(from, 0));
+    __ movptr(to, to_param);
 
     // for decryption java expanded key ordering is rotated one position from what we want
     // so we start from 0x10 here and hit 0x00 last
     // we don't know if the key is aligned, hence not using load-execute form
-    load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask);
-    __ pxor  (xmm_result, xmm_temp);
-    for (int offset = 0x20; offset <= 0xa0; offset += 0x10) {
-      aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
-    }
-    __ cmpl(keylen, 0);
-    __ jcc(Assembler::equal, L_doLast);
-    // only in 192 and 256 bit keys
-    aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask);
-    __ subl(keylen, 2);
-    __ jcc(Assembler::equal, L_doLast);
-    // only in 256 bit keys
-    aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask);
+    load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask);
+
+    __ pxor  (xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+    __ aesdec(xmm_result, xmm_temp3);
+    __ aesdec(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+    __ aesdec(xmm_result, xmm_temp3);
+    __ aesdec(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x00, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 44);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 52);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask);
 
     __ BIND(L_doLast);
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
     // for decryption the aesdeclast operation is always on key+0x00
-    load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
-    __ aesdeclast(xmm_result, xmm_temp);
-
+    __ aesdeclast(xmm_result, xmm_temp3);
     __ movdqu(Address(to, 0), xmm_result);  // store the result
-
     __ xorptr(rax, rax); // return 0
-    __ pop(rsi);
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
@@ -2340,7 +2398,7 @@
   //   c_rarg4   - input length
   //
   address generate_cipherBlockChaining_encryptAESCrypt() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
     address start = __ pc();
@@ -2393,7 +2451,7 @@
     __ jcc(Assembler::notEqual, L_key_192_256);
 
     // 128 bit code follows here
-    __ movptr(pos, 0);
+    __ movl(pos, 0);
     __ align(OptoLoopAlignment);
     __ BIND(L_loopTop_128);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
@@ -2423,15 +2481,15 @@
     __ leave();                                  // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-  __ BIND(L_key_192_256);
-  // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
+    __ BIND(L_key_192_256);
+    // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
     __ cmpl(rax, 52);
     __ jcc(Assembler::notEqual, L_key_256);
 
     // 192-bit code follows here (could be changed to use more xmm registers)
-    __ movptr(pos, 0);
-  __ align(OptoLoopAlignment);
-  __ BIND(L_loopTop_192);
+    __ movl(pos, 0);
+    __ align(OptoLoopAlignment);
+    __ BIND(L_loopTop_192);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
     __ pxor  (xmm_result, xmm_temp);                                // xor with the current r vector
 
@@ -2452,11 +2510,11 @@
     __ jcc(Assembler::notEqual, L_loopTop_192);
     __ jmp(L_exit);
 
-  __ BIND(L_key_256);
+    __ BIND(L_key_256);
     // 256-bit code follows here (could be changed to use more xmm registers)
-    __ movptr(pos, 0);
-  __ align(OptoLoopAlignment);
-  __ BIND(L_loopTop_256);
+    __ movl(pos, 0);
+    __ align(OptoLoopAlignment);
+    __ BIND(L_loopTop_256);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
     __ pxor  (xmm_result, xmm_temp);                                // xor with the current r vector
 
@@ -2495,7 +2553,7 @@
   //
 
   address generate_cipherBlockChaining_decryptAESCrypt() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
     address start = __ pc();
@@ -2556,9 +2614,9 @@
 
 
     // 128-bit code follows here, parallelized
-    __ movptr(pos, 0);
-  __ align(OptoLoopAlignment);
-  __ BIND(L_singleBlock_loopTop_128);
+    __ movl(pos, 0);
+    __ align(OptoLoopAlignment);
+    __ BIND(L_singleBlock_loopTop_128);
     __ cmpptr(len_reg, 0);           // any blocks left??
     __ jcc(Assembler::equal, L_exit);
     __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of cipher input
@@ -2597,7 +2655,7 @@
     __ jcc(Assembler::notEqual, L_key_256);
 
     // 192-bit code follows here (could be optimized to use parallelism)
-    __ movptr(pos, 0);
+    __ movl(pos, 0);
     __ align(OptoLoopAlignment);
     __ BIND(L_singleBlock_loopTop_192);
     __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of cipher input
@@ -2622,7 +2680,7 @@
 
     __ BIND(L_key_256);
     // 256-bit code follows here (could be optimized to use parallelism)
-    __ movptr(pos, 0);
+    __ movl(pos, 0);
     __ align(OptoLoopAlignment);
     __ BIND(L_singleBlock_loopTop_256);
     __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of cipher input
--- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1286,23 +1286,54 @@
   //   end_to       - destination array end address
   //   qword_count  - 64-bits element count, negative
   //   to           - scratch
-  //   L_copy_32_bytes - entry label
+  //   L_copy_bytes - entry label
   //   L_copy_8_bytes  - exit  label
   //
-  void copy_32_bytes_forward(Register end_from, Register end_to,
+  void copy_bytes_forward(Register end_from, Register end_to,
                              Register qword_count, Register to,
-                             Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
+                             Label& L_copy_bytes, Label& L_copy_8_bytes) {
     DEBUG_ONLY(__ stop("enter at entry label, not here"));
     Label L_loop;
     __ align(OptoLoopAlignment);
-  __ BIND(L_loop);
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
-      __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
-      __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8));
-      __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1);
-
+    if (UseUnalignedLoadStores) {
+      Label L_end;
+      // Copy 64-bytes per iteration
+      __ BIND(L_loop);
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0);
+        __ vmovdqu(xmm1, Address(end_from, qword_count, Address::times_8, -24));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -24), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -56));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -56), xmm0);
+        __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, -40));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -40), xmm1);
+        __ movdqu(xmm2, Address(end_from, qword_count, Address::times_8, -24));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm2);
+        __ movdqu(xmm3, Address(end_from, qword_count, Address::times_8, - 8));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm3);
+      }
+      __ BIND(L_copy_bytes);
+      __ addptr(qword_count, 8);
+      __ jcc(Assembler::lessEqual, L_loop);
+      __ subptr(qword_count, 4);  // sub(8) and add(4)
+      __ jccb(Assembler::greater, L_end);
+      // Copy trailing 32 bytes
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
+        __ vmovdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
+      } else {
+        __ movdqu(xmm0, Address(end_from, qword_count, Address::times_8, -24));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, -24), xmm0);
+        __ movdqu(xmm1, Address(end_from, qword_count, Address::times_8, - 8));
+        __ movdqu(Address(end_to, qword_count, Address::times_8, - 8), xmm1);
+      }
+      __ addptr(qword_count, 4);
+      __ BIND(L_end);
     } else {
+      // Copy 32-bytes per iteration
+      __ BIND(L_loop);
       __ movq(to, Address(end_from, qword_count, Address::times_8, -24));
       __ movq(Address(end_to, qword_count, Address::times_8, -24), to);
       __ movq(to, Address(end_from, qword_count, Address::times_8, -16));
@@ -1311,15 +1342,15 @@
       __ movq(Address(end_to, qword_count, Address::times_8, - 8), to);
       __ movq(to, Address(end_from, qword_count, Address::times_8, - 0));
       __ movq(Address(end_to, qword_count, Address::times_8, - 0), to);
+
+      __ BIND(L_copy_bytes);
+      __ addptr(qword_count, 4);
+      __ jcc(Assembler::lessEqual, L_loop);
     }
-  __ BIND(L_copy_32_bytes);
-    __ addptr(qword_count, 4);
-    __ jcc(Assembler::lessEqual, L_loop);
     __ subptr(qword_count, 4);
     __ jcc(Assembler::less, L_copy_8_bytes); // Copy trailing qwords
   }
 
-
   // Copy big chunks backward
   //
   // Inputs:
@@ -1327,23 +1358,55 @@
   //   dest         - destination array address
   //   qword_count  - 64-bits element count
   //   to           - scratch
-  //   L_copy_32_bytes - entry label
+  //   L_copy_bytes - entry label
   //   L_copy_8_bytes  - exit  label
   //
-  void copy_32_bytes_backward(Register from, Register dest,
+  void copy_bytes_backward(Register from, Register dest,
                               Register qword_count, Register to,
-                              Label& L_copy_32_bytes, Label& L_copy_8_bytes) {
+                              Label& L_copy_bytes, Label& L_copy_8_bytes) {
     DEBUG_ONLY(__ stop("enter at entry label, not here"));
     Label L_loop;
     __ align(OptoLoopAlignment);
-  __ BIND(L_loop);
-    if(UseUnalignedLoadStores) {
-      __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16));
-      __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0);
-      __ movdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
-      __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
-
+    if (UseUnalignedLoadStores) {
+      Label L_end;
+      // Copy 64-bytes per iteration
+      __ BIND(L_loop);
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from, qword_count, Address::times_8, 32));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8, 32), xmm0);
+        __ vmovdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
+      } else {
+        __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 48));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 48), xmm0);
+        __ movdqu(xmm1, Address(from, qword_count, Address::times_8, 32));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 32), xmm1);
+        __ movdqu(xmm2, Address(from, qword_count, Address::times_8, 16));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm2);
+        __ movdqu(xmm3, Address(from, qword_count, Address::times_8,  0));
+        __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm3);
+      }
+      __ BIND(L_copy_bytes);
+      __ subptr(qword_count, 8);
+      __ jcc(Assembler::greaterEqual, L_loop);
+
+      __ addptr(qword_count, 4);  // add(8) and sub(4)
+      __ jccb(Assembler::less, L_end);
+      // Copy trailing 32 bytes
+      if (UseAVX >= 2) {
+        __ vmovdqu(xmm0, Address(from, qword_count, Address::times_8, 0));
+        __ vmovdqu(Address(dest, qword_count, Address::times_8, 0), xmm0);
+      } else {
+        __ movdqu(xmm0, Address(from, qword_count, Address::times_8, 16));
+        __ movdqu(Address(dest, qword_count, Address::times_8, 16), xmm0);
+        __ movdqu(xmm1, Address(from, qword_count, Address::times_8,  0));
+        __ movdqu(Address(dest, qword_count, Address::times_8,  0), xmm1);
+      }
+      __ subptr(qword_count, 4);
+      __ BIND(L_end);
     } else {
+      // Copy 32-bytes per iteration
+      __ BIND(L_loop);
       __ movq(to, Address(from, qword_count, Address::times_8, 24));
       __ movq(Address(dest, qword_count, Address::times_8, 24), to);
       __ movq(to, Address(from, qword_count, Address::times_8, 16));
@@ -1352,10 +1415,11 @@
       __ movq(Address(dest, qword_count, Address::times_8,  8), to);
       __ movq(to, Address(from, qword_count, Address::times_8,  0));
       __ movq(Address(dest, qword_count, Address::times_8,  0), to);
+
+      __ BIND(L_copy_bytes);
+      __ subptr(qword_count, 4);
+      __ jcc(Assembler::greaterEqual, L_loop);
     }
-  __ BIND(L_copy_32_bytes);
-    __ subptr(qword_count, 4);
-    __ jcc(Assembler::greaterEqual, L_loop);
     __ addptr(qword_count, 4);
     __ jcc(Assembler::greater, L_copy_8_bytes); // Copy trailing qwords
   }
@@ -1385,7 +1449,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
     Label L_copy_byte, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
@@ -1417,7 +1481,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count); // make the count negative
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1460,8 +1524,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1488,7 +1552,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_copy_2_bytes;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1531,10 +1595,10 @@
     // Check for and copy trailing dword
   __ BIND(L_copy_4_bytes);
     __ testl(byte_count, 4);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, qword_count, Address::times_8));
     __ movl(Address(to, qword_count, Address::times_8), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1549,8 +1613,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     restore_arg_regs();
     inc_counter_np(SharedRuntime::_jbyte_array_copy_ctr); // Update counter after rscratch1 is free
@@ -1585,7 +1649,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes,L_copy_2_bytes,L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes,L_copy_2_bytes,L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1616,7 +1680,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1652,8 +1716,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1700,7 +1764,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1735,10 +1799,10 @@
     // Check for and copy trailing dword
   __ BIND(L_copy_4_bytes);
     __ testl(word_count, 2);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, qword_count, Address::times_8));
     __ movl(Address(to, qword_count, Address::times_8), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1753,8 +1817,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     restore_arg_regs();
     inc_counter_np(SharedRuntime::_jshort_array_copy_ctr); // Update counter after rscratch1 is free
@@ -1790,7 +1854,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_4_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1826,7 +1890,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1853,8 +1917,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy 32-bytes chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
     __ jmp(L_copy_4_bytes);
 
     return start;
@@ -1882,7 +1946,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1916,10 +1980,10 @@
 
     // Check for and copy trailing dword
     __ testl(dword_count, 1);
-    __ jcc(Assembler::zero, L_copy_32_bytes);
+    __ jcc(Assembler::zero, L_copy_bytes);
     __ movl(rax, Address(from, dword_count, Address::times_4, -4));
     __ movl(Address(to, dword_count, Address::times_4, -4), rax);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -1937,8 +2001,8 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
    __ bind(L_exit);
      if (is_oop) {
@@ -1976,7 +2040,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register qword_count = rdx;  // elements count
@@ -2008,7 +2072,7 @@
     __ lea(end_from, Address(from, qword_count, Address::times_8, -8));
     __ lea(end_to,   Address(to,   qword_count, Address::times_8, -8));
     __ negptr(qword_count);
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -2027,8 +2091,8 @@
       __ ret(0);
     }
 
-    // Copy 64-byte chunks
-    copy_32_bytes_forward(end_from, end_to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_forward(end_from, end_to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     if (is_oop) {
     __ BIND(L_exit);
@@ -2065,7 +2129,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_32_bytes, L_copy_8_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register qword_count = rdx;  // elements count
@@ -2091,7 +2155,7 @@
       gen_write_ref_array_pre_barrier(to, saved_count, dest_uninitialized);
     }
 
-    __ jmp(L_copy_32_bytes);
+    __ jmp(L_copy_bytes);
 
     // Copy trailing qwords
   __ BIND(L_copy_8_bytes);
@@ -2110,8 +2174,8 @@
       __ ret(0);
     }
 
-    // Copy in 32-bytes chunks
-    copy_32_bytes_backward(from, to, qword_count, rax, L_copy_32_bytes, L_copy_8_bytes);
+    // Copy in multi-bytes chunks
+    copy_bytes_backward(from, to, qword_count, rax, L_copy_bytes, L_copy_8_bytes);
 
     if (is_oop) {
     __ BIND(L_exit);
@@ -2953,21 +3017,6 @@
     }
   }
 
-  // aesenc using specified key+offset
-  // can optionally specify that the shuffle mask is already in an xmmregister
-  void aes_enc_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
-    load_key(xmmtmp, key, offset, xmm_shuf_mask);
-    __ aesenc(xmmdst, xmmtmp);
-  }
-
-  // aesdec using specified key+offset
-  // can optionally specify that the shuffle mask is already in an xmmregister
-  void aes_dec_key(XMMRegister xmmdst, XMMRegister xmmtmp, Register key, int offset, XMMRegister xmm_shuf_mask=NULL) {
-    load_key(xmmtmp, key, offset, xmm_shuf_mask);
-    __ aesdec(xmmdst, xmmtmp);
-  }
-
-
   // Arguments:
   //
   // Inputs:
@@ -2976,7 +3025,7 @@
   //   c_rarg2   - K (key) in little endian int array
   //
   address generate_aescrypt_encryptBlock() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
     Label L_doLast;
@@ -2988,15 +3037,17 @@
     const Register keylen      = rax;
 
     const XMMRegister xmm_result = xmm0;
-    const XMMRegister xmm_temp   = xmm1;
-    const XMMRegister xmm_key_shuf_mask = xmm2;
+    const XMMRegister xmm_key_shuf_mask = xmm1;
+    // On win64 xmm6-xmm15 must be preserved so don't use them.
+    const XMMRegister xmm_temp1  = xmm2;
+    const XMMRegister xmm_temp2  = xmm3;
+    const XMMRegister xmm_temp3  = xmm4;
+    const XMMRegister xmm_temp4  = xmm5;
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
+    // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
-    // keylen = # of 32-bit words, convert to 128-bit words
-    __ shrl(keylen, 2);
-    __ subl(keylen, 11);   // every key has at least 11 128-bit words, some have more
 
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
     __ movdqu(xmm_result, Address(from, 0));  // get 16 bytes of input
@@ -3004,25 +3055,53 @@
     // For encryption, the java expanded key ordering is just what we need
     // we don't know if the key is aligned, hence not using load-execute form
 
-    load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
-    __ pxor(xmm_result, xmm_temp);
-    for (int offset = 0x10; offset <= 0x90; offset += 0x10) {
-      aes_enc_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
-    }
-    load_key  (xmm_temp, key, 0xa0, xmm_key_shuf_mask);
-    __ cmpl(keylen, 0);
-    __ jcc(Assembler::equal, L_doLast);
-    __ aesenc(xmm_result, xmm_temp);                   // only in 192 and 256 bit keys
-    aes_enc_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
-    load_key(xmm_temp, key, 0xc0, xmm_key_shuf_mask);
-    __ subl(keylen, 2);
-    __ jcc(Assembler::equal, L_doLast);
-    __ aesenc(xmm_result, xmm_temp);                   // only in 256 bit keys
-    aes_enc_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
-    load_key(xmm_temp, key, 0xe0, xmm_key_shuf_mask);
+    load_key(xmm_temp1, key, 0x00, xmm_key_shuf_mask);
+    __ pxor(xmm_result, xmm_temp1);
+
+    load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+    __ aesenc(xmm_result, xmm_temp3);
+    __ aesenc(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+    __ aesenc(xmm_result, xmm_temp3);
+    __ aesenc(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 44);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 52);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenc(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask);
 
     __ BIND(L_doLast);
-    __ aesenclast(xmm_result, xmm_temp);
+    __ aesenc(xmm_result, xmm_temp1);
+    __ aesenclast(xmm_result, xmm_temp2);
     __ movdqu(Address(to, 0), xmm_result);        // store the result
     __ xorptr(rax, rax); // return 0
     __ leave(); // required for proper stackwalking of RuntimeStub frame
@@ -3040,7 +3119,7 @@
   //   c_rarg2   - K (key) in little endian int array
   //
   address generate_aescrypt_decryptBlock() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
     Label L_doLast;
@@ -3052,15 +3131,17 @@
     const Register keylen      = rax;
 
     const XMMRegister xmm_result = xmm0;
-    const XMMRegister xmm_temp   = xmm1;
-    const XMMRegister xmm_key_shuf_mask = xmm2;
+    const XMMRegister xmm_key_shuf_mask = xmm1;
+    // On win64 xmm6-xmm15 must be preserved so don't use them.
+    const XMMRegister xmm_temp1  = xmm2;
+    const XMMRegister xmm_temp2  = xmm3;
+    const XMMRegister xmm_temp3  = xmm4;
+    const XMMRegister xmm_temp4  = xmm5;
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
+    // keylen could be only {11, 13, 15} * 4 = {44, 52, 60}
     __ movl(keylen, Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)));
-    // keylen = # of 32-bit words, convert to 128-bit words
-    __ shrl(keylen, 2);
-    __ subl(keylen, 11);   // every key has at least 11 128-bit words, some have more
 
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
     __ movdqu(xmm_result, Address(from, 0));
@@ -3068,29 +3149,55 @@
     // for decryption java expanded key ordering is rotated one position from what we want
     // so we start from 0x10 here and hit 0x00 last
     // we don't know if the key is aligned, hence not using load-execute form
-    load_key(xmm_temp, key, 0x10, xmm_key_shuf_mask);
-    __ pxor  (xmm_result, xmm_temp);
-    for (int offset = 0x20; offset <= 0xa0; offset += 0x10) {
-      aes_dec_key(xmm_result, xmm_temp, key, offset, xmm_key_shuf_mask);
-    }
-    __ cmpl(keylen, 0);
-    __ jcc(Assembler::equal, L_doLast);
-    // only in 192 and 256 bit keys
-    aes_dec_key(xmm_result, xmm_temp, key, 0xb0, xmm_key_shuf_mask);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xc0, xmm_key_shuf_mask);
-    __ subl(keylen, 2);
-    __ jcc(Assembler::equal, L_doLast);
-    // only in 256 bit keys
-    aes_dec_key(xmm_result, xmm_temp, key, 0xd0, xmm_key_shuf_mask);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xe0, xmm_key_shuf_mask);
+    load_key(xmm_temp1, key, 0x10, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x20, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x30, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x40, xmm_key_shuf_mask);
+
+    __ pxor  (xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+    __ aesdec(xmm_result, xmm_temp3);
+    __ aesdec(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x50, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0x60, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x70, xmm_key_shuf_mask);
+    load_key(xmm_temp4, key, 0x80, xmm_key_shuf_mask);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+    __ aesdec(xmm_result, xmm_temp3);
+    __ aesdec(xmm_result, xmm_temp4);
+
+    load_key(xmm_temp1, key, 0x90, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xa0, xmm_key_shuf_mask);
+    load_key(xmm_temp3, key, 0x00, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 44);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xb0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xc0, xmm_key_shuf_mask);
+
+    __ cmpl(keylen, 52);
+    __ jccb(Assembler::equal, L_doLast);
+
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
+    load_key(xmm_temp1, key, 0xd0, xmm_key_shuf_mask);
+    load_key(xmm_temp2, key, 0xe0, xmm_key_shuf_mask);
 
     __ BIND(L_doLast);
+    __ aesdec(xmm_result, xmm_temp1);
+    __ aesdec(xmm_result, xmm_temp2);
+
     // for decryption the aesdeclast operation is always on key+0x00
-    load_key(xmm_temp, key, 0x00, xmm_key_shuf_mask);
-    __ aesdeclast(xmm_result, xmm_temp);
-
+    __ aesdeclast(xmm_result, xmm_temp3);
     __ movdqu(Address(to, 0), xmm_result);  // store the result
-
     __ xorptr(rax, rax); // return 0
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
@@ -3109,7 +3216,7 @@
   //   c_rarg4   - input length
   //
   address generate_cipherBlockChaining_encryptAESCrypt() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
     address start = __ pc();
@@ -3133,16 +3240,19 @@
     const XMMRegister xmm_temp   = xmm1;
     // keys 0-10 preloaded into xmm2-xmm12
     const int XMM_REG_NUM_KEY_FIRST = 2;
-    const int XMM_REG_NUM_KEY_LAST  = 12;
+    const int XMM_REG_NUM_KEY_LAST  = 15;
     const XMMRegister xmm_key0   = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
-    const XMMRegister xmm_key10  = as_XMMRegister(XMM_REG_NUM_KEY_LAST);
+    const XMMRegister xmm_key10  = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+10);
+    const XMMRegister xmm_key11  = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+11);
+    const XMMRegister xmm_key12  = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+12);
+    const XMMRegister xmm_key13  = as_XMMRegister(XMM_REG_NUM_KEY_FIRST+13);
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
 #ifdef _WIN64
     // on win64, fill len_reg from stack position
     __ movl(len_reg, len_mem);
-    // save the xmm registers which must be preserved 6-12
+    // save the xmm registers which must be preserved 6-15
     __ subptr(rsp, -rsp_after_call_off * wordSize);
     for (int i = 6; i <= XMM_REG_NUM_KEY_LAST; i++) {
       __ movdqu(xmm_save(i), as_XMMRegister(i));
@@ -3151,12 +3261,11 @@
 
     const XMMRegister xmm_key_shuf_mask = xmm_temp;  // used temporarily to swap key bytes up front
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
-    // load up xmm regs 2 thru 12 with key 0x00 - 0xa0
-    for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
+    // load up xmm regs xmm2 thru xmm12 with key 0x00 - 0xa0
+    for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x00; rnum <= XMM_REG_NUM_KEY_FIRST+10; rnum++) {
       load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
       offset += 0x10;
     }
-
     __ movdqu(xmm_result, Address(rvec, 0x00));   // initialize xmm_result with r vec
 
     // now split to different paths depending on the keylen (len in ints of AESCrypt.KLE array (52=192, or 60=256))
@@ -3167,16 +3276,15 @@
     // 128 bit code follows here
     __ movptr(pos, 0);
     __ align(OptoLoopAlignment);
+
     __ BIND(L_loopTop_128);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
     __ pxor  (xmm_result, xmm_temp);               // xor with the current r vector
-
     __ pxor  (xmm_result, xmm_key0);               // do the aes rounds
-    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
+    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_FIRST + 9; rnum++) {
       __ aesenc(xmm_result, as_XMMRegister(rnum));
     }
     __ aesenclast(xmm_result, xmm_key10);
-
     __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);     // store into the next 16 bytes of output
     // no need to store r to memory until we exit
     __ addptr(pos, AESBlockSize);
@@ -3198,24 +3306,23 @@
 
     __ BIND(L_key_192_256);
     // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
+    load_key(xmm_key11, key, 0xb0, xmm_key_shuf_mask);
+    load_key(xmm_key12, key, 0xc0, xmm_key_shuf_mask);
     __ cmpl(rax, 52);
     __ jcc(Assembler::notEqual, L_key_256);
 
     // 192-bit code follows here (could be changed to use more xmm registers)
     __ movptr(pos, 0);
     __ align(OptoLoopAlignment);
+
     __ BIND(L_loopTop_192);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
     __ pxor  (xmm_result, xmm_temp);               // xor with the current r vector
-
     __ pxor  (xmm_result, xmm_key0);               // do the aes rounds
-    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum  <= XMM_REG_NUM_KEY_LAST; rnum++) {
+    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum  <= XMM_REG_NUM_KEY_FIRST + 11; rnum++) {
       __ aesenc(xmm_result, as_XMMRegister(rnum));
     }
-    aes_enc_key(xmm_result, xmm_temp, key, 0xb0);
-    load_key(xmm_temp, key, 0xc0);
-    __ aesenclast(xmm_result, xmm_temp);
-
+    __ aesenclast(xmm_result, xmm_key12);
     __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);     // store into the next 16 bytes of output
     // no need to store r to memory until we exit
     __ addptr(pos, AESBlockSize);
@@ -3225,22 +3332,19 @@
 
     __ BIND(L_key_256);
     // 256-bit code follows here (could be changed to use more xmm registers)
+    load_key(xmm_key13, key, 0xd0, xmm_key_shuf_mask);
     __ movptr(pos, 0);
     __ align(OptoLoopAlignment);
+
     __ BIND(L_loopTop_256);
     __ movdqu(xmm_temp, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of input
     __ pxor  (xmm_result, xmm_temp);               // xor with the current r vector
-
     __ pxor  (xmm_result, xmm_key0);               // do the aes rounds
-    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum  <= XMM_REG_NUM_KEY_LAST; rnum++) {
+    for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum  <= XMM_REG_NUM_KEY_FIRST + 13; rnum++) {
       __ aesenc(xmm_result, as_XMMRegister(rnum));
     }
-    aes_enc_key(xmm_result, xmm_temp, key, 0xb0);
-    aes_enc_key(xmm_result, xmm_temp, key, 0xc0);
-    aes_enc_key(xmm_result, xmm_temp, key, 0xd0);
     load_key(xmm_temp, key, 0xe0);
     __ aesenclast(xmm_result, xmm_temp);
-
     __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);     // store into the next 16 bytes of output
     // no need to store r to memory until we exit
     __ addptr(pos, AESBlockSize);
@@ -3267,7 +3371,7 @@
   //
 
   address generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
-    assert(UseAES && (UseAVX > 0), "need AES instructions and misaligned SSE support");
+    assert(UseAES, "need AES instructions and misaligned SSE support");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
     address start = __ pc();
@@ -3288,12 +3392,10 @@
 #endif
     const Register pos         = rax;
 
-    // xmm register assignments for the loops below
-    const XMMRegister xmm_result = xmm0;
     // keys 0-10 preloaded into xmm2-xmm12
     const int XMM_REG_NUM_KEY_FIRST = 5;
     const int XMM_REG_NUM_KEY_LAST  = 15;
-    const XMMRegister xmm_key_first   = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
+    const XMMRegister xmm_key_first = as_XMMRegister(XMM_REG_NUM_KEY_FIRST);
     const XMMRegister xmm_key_last  = as_XMMRegister(XMM_REG_NUM_KEY_LAST);
 
     __ enter(); // required for proper stackwalking of RuntimeStub frame
@@ -3312,13 +3414,14 @@
     const XMMRegister xmm_key_shuf_mask = xmm1;  // used temporarily to swap key bytes up front
     __ movdqu(xmm_key_shuf_mask, ExternalAddress(StubRoutines::x86::key_shuffle_mask_addr()));
     // load up xmm regs 5 thru 15 with key 0x10 - 0xa0 - 0x00
-    for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum <= XMM_REG_NUM_KEY_LAST; rnum++) {
-      if (rnum == XMM_REG_NUM_KEY_LAST) offset = 0x00;
+    for (int rnum = XMM_REG_NUM_KEY_FIRST, offset = 0x10; rnum < XMM_REG_NUM_KEY_LAST; rnum++) {
       load_key(as_XMMRegister(rnum), key, offset, xmm_key_shuf_mask);
       offset += 0x10;
     }
+    load_key(xmm_key_last, key, 0x00, xmm_key_shuf_mask);
 
     const XMMRegister xmm_prev_block_cipher = xmm1;  // holds cipher of previous block
+
     // registers holding the four results in the parallelized loop
     const XMMRegister xmm_result0 = xmm0;
     const XMMRegister xmm_result1 = xmm2;
@@ -3376,8 +3479,12 @@
     __ jmp(L_multiBlock_loopTop_128);
 
     // registers used in the non-parallelized loops
+    // xmm register assignments for the loops below
+    const XMMRegister xmm_result = xmm0;
     const XMMRegister xmm_prev_block_cipher_save = xmm2;
-    const XMMRegister xmm_temp   = xmm3;
+    const XMMRegister xmm_key11 = xmm3;
+    const XMMRegister xmm_key12 = xmm4;
+    const XMMRegister xmm_temp  = xmm4;
 
     __ align(OptoLoopAlignment);
     __ BIND(L_singleBlock_loopTop_128);
@@ -3415,12 +3522,15 @@
 
     __ BIND(L_key_192_256);
     // here rax = len in ints of AESCrypt.KLE array (52=192, or 60=256)
+    load_key(xmm_key11, key, 0xb0);
     __ cmpl(rax, 52);
     __ jcc(Assembler::notEqual, L_key_256);
 
     // 192-bit code follows here (could be optimized to use parallelism)
+    load_key(xmm_key12, key, 0xc0);     // 192-bit key goes up to c0
     __ movptr(pos, 0);
     __ align(OptoLoopAlignment);
+
     __ BIND(L_singleBlock_loopTop_192);
     __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of cipher input
     __ movdqa(xmm_prev_block_cipher_save, xmm_result);              // save for next r vector
@@ -3428,14 +3538,13 @@
     for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
       __ aesdec(xmm_result, as_XMMRegister(rnum));
     }
-    aes_dec_key(xmm_result, xmm_temp, key, 0xb0);     // 192-bit key goes up to c0
-    aes_dec_key(xmm_result, xmm_temp, key, 0xc0);
+    __ aesdec(xmm_result, xmm_key11);
+    __ aesdec(xmm_result, xmm_key12);
     __ aesdeclast(xmm_result, xmm_key_last);                    // xmm15 always came from key+0
     __ pxor  (xmm_result, xmm_prev_block_cipher);               // xor with the current r vector
-    __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);     // store into the next 16 bytes of output
+    __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);  // store into the next 16 bytes of output
     // no need to store r to memory until we exit
-    __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);              // set up next r vector with cipher input from this block
-
+    __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);  // set up next r vector with cipher input from this block
     __ addptr(pos, AESBlockSize);
     __ subptr(len_reg, AESBlockSize);
     __ jcc(Assembler::notEqual,L_singleBlock_loopTop_192);
@@ -3445,23 +3554,26 @@
     // 256-bit code follows here (could be optimized to use parallelism)
     __ movptr(pos, 0);
     __ align(OptoLoopAlignment);
+
     __ BIND(L_singleBlock_loopTop_256);
-    __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0));   // get next 16 bytes of cipher input
+    __ movdqu(xmm_result, Address(from, pos, Address::times_1, 0)); // get next 16 bytes of cipher input
     __ movdqa(xmm_prev_block_cipher_save, xmm_result);              // save for next r vector
     __ pxor  (xmm_result, xmm_key_first);               // do the aes dec rounds
     for (int rnum = XMM_REG_NUM_KEY_FIRST + 1; rnum <= XMM_REG_NUM_KEY_LAST - 1; rnum++) {
       __ aesdec(xmm_result, as_XMMRegister(rnum));
     }
-    aes_dec_key(xmm_result, xmm_temp, key, 0xb0);     // 256-bit key goes up to e0
-    aes_dec_key(xmm_result, xmm_temp, key, 0xc0);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xd0);
-    aes_dec_key(xmm_result, xmm_temp, key, 0xe0);
-    __ aesdeclast(xmm_result, xmm_key_last);             // xmm15 came from key+0
+    __ aesdec(xmm_result, xmm_key11);
+    load_key(xmm_temp, key, 0xc0);
+    __ aesdec(xmm_result, xmm_temp);
+    load_key(xmm_temp, key, 0xd0);
+    __ aesdec(xmm_result, xmm_temp);
+    load_key(xmm_temp, key, 0xe0);     // 256-bit key goes up to e0
+    __ aesdec(xmm_result, xmm_temp);
+    __ aesdeclast(xmm_result, xmm_key_last);          // xmm15 came from key+0
     __ pxor  (xmm_result, xmm_prev_block_cipher);               // xor with the current r vector
-    __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);     // store into the next 16 bytes of output
+    __ movdqu(Address(to, pos, Address::times_1, 0), xmm_result);  // store into the next 16 bytes of output
     // no need to store r to memory until we exit
-    __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);              // set up next r vector with cipher input from this block
-
+    __ movdqa(xmm_prev_block_cipher, xmm_prev_block_cipher_save);  // set up next r vector with cipher input from this block
     __ addptr(pos, AESBlockSize);
     __ subptr(len_reg, AESBlockSize);
     __ jcc(Assembler::notEqual,L_singleBlock_loopTop_256);
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -424,8 +424,6 @@
   // C++ interpreter only
   // rsi - previous interpreter state pointer
 
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
-
   // InterpreterRuntime::frequency_counter_overflow takes one argument
   // indicating if the counter overflow occurs at a backwards branch (non-NULL bcp).
   // The call returns the address of the verified entry point for the method or NULL
@@ -868,12 +866,13 @@
   // rsi: previous interpreter state (C++ interpreter) must preserve
   address entry_point = __ pc();
 
-
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
+  const Address constMethod       (rbx, Method::const_offset());
   const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   const Address access_flags      (rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rcx, ConstMethod::size_of_parameters_offset());
 
   // get parameter size (always needed)
+  __ movptr(rcx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // native calls don't need the stack size check since they have no expression stack
@@ -988,7 +987,9 @@
 
   // allocate space for parameters
   __ get_method(method);
-  __ load_unsigned_short(t, Address(method, Method::size_of_parameters_offset()));
+  __ movptr(t, Address(method, Method::const_offset()));
+  __ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset()));
+
   __ shlptr(t, Interpreter::logStackElementSize);
   __ addptr(t, 2*wordSize);     // allocate two more slots for JNIEnv and possible mirror
   __ subptr(rsp, t);
@@ -1297,13 +1298,14 @@
   // rsi: sender sp
   address entry_point = __ pc();
 
-
-  const Address size_of_parameters(rbx, Method::size_of_parameters_offset());
-  const Address size_of_locals    (rbx, Method::size_of_locals_offset());
+  const Address constMethod       (rbx, Method::const_offset());
   const Address invocation_counter(rbx, Method::invocation_counter_offset() + InvocationCounter::counter_offset());
   const Address access_flags      (rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rdx, ConstMethod::size_of_parameters_offset());
+  const Address size_of_locals    (rdx, ConstMethod::size_of_locals_offset());
 
   // get parameter size (always needed)
+  __ movptr(rdx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // rbx,: Method*
@@ -1734,7 +1736,8 @@
 
     // Compute size of arguments for saving when returning to deoptimized caller
     __ get_method(rax);
-    __ load_unsigned_short(rax, Address(rax, in_bytes(Method::size_of_parameters_offset())));
+    __ movptr(rax, Address(rax, Method::const_offset()));
+    __ load_unsigned_short(rax, Address(rax, ConstMethod::size_of_parameters_offset()));
     __ shlptr(rax, Interpreter::logStackElementSize);
     __ restore_locals();
     __ subptr(rdi, rax);
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -400,9 +400,6 @@
   // Everything as it was on entry
   // rdx is not restored. Doesn't appear to really be set.
 
-  const Address size_of_parameters(rbx,
-                                   Method::size_of_parameters_offset());
-
   // InterpreterRuntime::frequency_counter_overflow takes two
   // arguments, the first (thread) is passed by call_VM, the second
   // indicates if the counter overflow occurs at a backwards branch
@@ -875,14 +872,17 @@
 
   address entry_point = __ pc();
 
-  const Address size_of_parameters(rbx, Method::
-                                        size_of_parameters_offset());
+  const Address constMethod       (rbx, Method::const_offset());
   const Address invocation_counter(rbx, Method::
                                         invocation_counter_offset() +
                                         InvocationCounter::counter_offset());
   const Address access_flags      (rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rcx, ConstMethod::
+                                        size_of_parameters_offset());
+
 
   // get parameter size (always needed)
+  __ movptr(rcx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // native calls don't need the stack size check since they have no
@@ -998,9 +998,8 @@
 
   // allocate space for parameters
   __ get_method(method);
-  __ load_unsigned_short(t,
-                         Address(method,
-                                 Method::size_of_parameters_offset()));
+  __ movptr(t, Address(method, Method::const_offset()));
+  __ load_unsigned_short(t, Address(t, ConstMethod::size_of_parameters_offset()));
   __ shll(t, Interpreter::logStackElementSize);
 
   __ subptr(rsp, t);
@@ -1333,15 +1332,18 @@
   // r13: sender sp
   address entry_point = __ pc();
 
-  const Address size_of_parameters(rbx,
-                                   Method::size_of_parameters_offset());
-  const Address size_of_locals(rbx, Method::size_of_locals_offset());
+  const Address constMethod(rbx, Method::const_offset());
   const Address invocation_counter(rbx,
                                    Method::invocation_counter_offset() +
                                    InvocationCounter::counter_offset());
   const Address access_flags(rbx, Method::access_flags_offset());
+  const Address size_of_parameters(rdx,
+                                   ConstMethod::size_of_parameters_offset());
+  const Address size_of_locals(rdx, ConstMethod::size_of_locals_offset());
+
 
   // get parameter size (always needed)
+  __ movptr(rdx, constMethod);
   __ load_unsigned_short(rcx, size_of_parameters);
 
   // rbx: Method*
@@ -1783,7 +1785,8 @@
     // Compute size of arguments for saving when returning to
     // deoptimized caller
     __ get_method(rax);
-    __ load_unsigned_short(rax, Address(rax, in_bytes(Method::
+    __ movptr(rax, Address(rax, Method::const_offset()));
+    __ load_unsigned_short(rax, Address(rax, in_bytes(ConstMethod::
                                                 size_of_parameters_offset())));
     __ shll(rax, Interpreter::logStackElementSize);
     __ restore_locals(); // XXX do we need this?
--- a/src/cpu/x86/vm/vmStructs_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/vmStructs_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,7 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry)            \
+#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)            \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* JavaCallWrapper            */                                                                                                   \
@@ -37,31 +37,14 @@
   /******************************/                                                                                                   \
   /* JavaFrameAnchor            */                                                                                                   \
   /******************************/                                                                                                   \
-  volatile_nonstatic_field(JavaFrameAnchor,     _last_Java_fp,                                    intptr_t*)                              \
-                                                                                                                                     \
+  volatile_nonstatic_field(JavaFrameAnchor,     _last_Java_fp,                                    intptr_t*)
 
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must  */
-  /* be present there)                                                */
 
 
-#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry)                               \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must    */
-  /* be present there)                                                */
-
-
-#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry)                                                              \
+#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
 
-  /* NOTE that we do not use the last_entry() macro here; it is used        */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must  */
-  /* be present there)                                                      */
+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry)                                                              \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used         */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must  */
-  /* be present there)                                                       */
+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // CPU_X86_VM_VMSTRUCTS_X86_HPP
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -429,7 +429,7 @@
   }
 
   char buf[256];
-  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "(%u cores per cpu, %u threads per core) family %d model %d stepping %d%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                cores_per_cpu(), threads_per_core(),
                cpu_family(), _model, _stepping,
                (supports_cmov() ? ", cmov" : ""),
@@ -446,6 +446,7 @@
                (supports_avx()    ? ", avx" : ""),
                (supports_avx2()   ? ", avx2" : ""),
                (supports_aes()    ? ", aes" : ""),
+               (supports_erms()   ? ", erms" : ""),
                (supports_mmx_ext() ? ", mmxext" : ""),
                (supports_3dnow_prefetch() ? ", 3dnowpref" : ""),
                (supports_lzcnt()   ? ", lzcnt": ""),
@@ -489,8 +490,8 @@
   }
 
   // The AES intrinsic stubs require AES instruction support (of course)
-  // but also require AVX and sse3 modes for instructions it use.
-  if (UseAES && (UseAVX > 0) && (UseSSE > 2)) {
+  // but also require sse3 mode for instructions it use.
+  if (UseAES && (UseSSE > 2)) {
     if (FLAG_IS_DEFAULT(UseAESIntrinsics)) {
       UseAESIntrinsics = true;
     }
@@ -660,6 +661,14 @@
       }
     }
   }
+#if defined(COMPILER2) && defined(_ALLBSD_SOURCE)
+    if (MaxVectorSize > 16) {
+      // Limit vectors size to 16 bytes on BSD until it fixes
+      // restoring upper 128bit of YMM registers on return
+      // from signal handler.
+      FLAG_SET_DEFAULT(MaxVectorSize, 16);
+    }
+#endif // COMPILER2
 
   // Use population count instruction if available.
   if (supports_popcnt()) {
@@ -671,6 +680,16 @@
     FLAG_SET_DEFAULT(UsePopCountInstruction, false);
   }
 
+  // Use fast-string operations if available.
+  if (supports_erms()) {
+    if (FLAG_IS_DEFAULT(UseFastStosb)) {
+      UseFastStosb = true;
+    }
+  } else if (UseFastStosb) {
+    warning("fast-string operations are not available on this CPU");
+    FLAG_SET_DEFAULT(UseFastStosb, false);
+  }
+
 #ifdef COMPILER2
   if (FLAG_IS_DEFAULT(AlignVector)) {
     // Modern processors allow misaligned memory operations for vectors.
@@ -734,6 +753,10 @@
   PrefetchFieldsAhead         = prefetch_fields_ahead();
 #endif
 
+  if (FLAG_IS_DEFAULT(ContendedPaddingWidth) &&
+     (cache_line_size > ContendedPaddingWidth))
+     ContendedPaddingWidth = cache_line_size;
+
 #ifndef PRODUCT
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("Logical CPUs per core: %u",
@@ -780,6 +803,9 @@
     if (PrefetchFieldsAhead > 0) {
       tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
     }
+    if (ContendedPaddingWidth > 0) {
+      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+    }
   }
 #endif // !PRODUCT
 }
--- a/src/cpu/x86/vm/vm_version_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/vm_version_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -204,7 +204,8 @@
                    avx2 : 1,
                         : 2,
                    bmi2 : 1,
-                        : 23;
+                   erms : 1,
+                        : 22;
     } bits;
   };
 
@@ -247,7 +248,8 @@
     CPU_TSCINV = (1 << 16),
     CPU_AVX    = (1 << 17),
     CPU_AVX2   = (1 << 18),
-    CPU_AES    = (1 << 19)
+    CPU_AES    = (1 << 19),
+    CPU_ERMS   = (1 << 20) // enhanced 'rep movsb/stosb' instructions
   } cpuFeatureFlags;
 
   enum {
@@ -425,6 +427,8 @@
       result |= CPU_TSCINV;
     if (_cpuid_info.std_cpuid1_ecx.bits.aes != 0)
       result |= CPU_AES;
+    if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0)
+      result |= CPU_ERMS;
 
     // AMD features.
     if (is_amd()) {
@@ -489,7 +493,7 @@
     return (_cpuid_info.std_max_function >= 0xB) &&
            // eax[4:0] | ebx[0:15] == 0 indicates invalid topology level.
            // Some cpus have max cpuid >= 0xB but do not support processor topology.
-           ((_cpuid_info.tpl_cpuidB0_eax & 0x1f | _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus) != 0);
+           (((_cpuid_info.tpl_cpuidB0_eax & 0x1f) | _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus) != 0);
   }
 
   static uint cores_per_cpu()  {
@@ -550,6 +554,7 @@
   static bool supports_avx2()     { return (_cpuFeatures & CPU_AVX2) != 0; }
   static bool supports_tsc()      { return (_cpuFeatures & CPU_TSC)    != 0; }
   static bool supports_aes()      { return (_cpuFeatures & CPU_AES) != 0; }
+  static bool supports_erms()     { return (_cpuFeatures & CPU_ERMS) != 0; }
 
   // Intel features
   static bool is_intel_family_core() { return is_intel() &&
--- a/src/cpu/x86/vm/x86_32.ad	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/x86_32.ad	Fri Feb 01 17:06:26 2013 +0100
@@ -11572,15 +11572,28 @@
 // =======================================================================
 // fast clearing of an array
 instruct rep_stos(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+  predicate(!UseFastStosb);
   match(Set dummy (ClearArray cnt base));
   effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
-  format %{ "SHL    ECX,1\t# Convert doublewords to words\n\t"
-            "XOR    EAX,EAX\n\t"
+  format %{ "XOR    EAX,EAX\t# ClearArray:\n\t"
+            "SHL    ECX,1\t# Convert doublewords to words\n\t"
             "REP STOS\t# store EAX into [EDI++] while ECX--" %}
-  opcode(0,0x4);
-  ins_encode( Opcode(0xD1), RegOpc(ECX),
-              OpcRegReg(0x33,EAX,EAX),
-              Opcode(0xF3), Opcode(0xAB) );
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+instruct rep_fast_stosb(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+  predicate(UseFastStosb);
+  match(Set dummy (ClearArray cnt base));
+  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  format %{ "XOR    EAX,EAX\t# ClearArray:\n\t"
+            "SHL    ECX,3\t# Convert doublewords to bytes\n\t"
+            "REP STOSB\t# store EAX into [EDI++] while ECX--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
   ins_pipe( pipe_slow );
 %}
 
@@ -11674,6 +11687,23 @@
   ins_pipe( pipe_slow );
 %}
 
+// encode char[] to byte[] in ISO_8859_1
+instruct encode_iso_array(eSIRegP src, eDIRegP dst, eDXRegI len,
+                          regD tmp1, regD tmp2, regD tmp3, regD tmp4,
+                          eCXRegI tmp5, eAXRegI result, eFlagsReg cr) %{
+  match(Set result (EncodeISOArray src (Binary dst len)));
+  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL tmp5, KILL cr);
+
+  format %{ "Encode array $src,$dst,$len -> $result    // KILL ECX, EDX, $tmp1, $tmp2, $tmp3, $tmp4, ESI, EDI " %}
+  ins_encode %{
+    __ encode_iso_array($src$$Register, $dst$$Register, $len$$Register,
+                        $tmp1$$XMMRegister, $tmp2$$XMMRegister, $tmp3$$XMMRegister,
+                        $tmp4$$XMMRegister, $tmp5$$Register, $result$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+
 //----------Control Flow Instructions------------------------------------------
 // Signed compare Instructions
 instruct compI_eReg(eFlagsReg cr, rRegI op1, rRegI op2) %{
--- a/src/cpu/x86/vm/x86_64.ad	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/x86/vm/x86_64.ad	Fri Feb 01 17:06:26 2013 +0100
@@ -10374,16 +10374,33 @@
 instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
                   rFlagsReg cr)
 %{
+  predicate(!UseFastStosb);
   match(Set dummy (ClearArray cnt base));
   effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
 
-  format %{ "xorl    rax, rax\t# ClearArray:\n\t"
-            "rep stosq\t# Store rax to *rdi++ while rcx--" %}
-  ins_encode(opc_reg_reg(0x33, RAX, RAX), // xorl %eax, %eax
-             Opcode(0xF3), Opcode(0x48), Opcode(0xAB)); // rep REX_W stos
+  format %{ "xorq    rax, rax\t# ClearArray:\n\t"
+            "rep     stosq\t# Store rax to *rdi++ while rcx--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
   ins_pipe(pipe_slow);
 %}
 
+instruct rep_fast_stosb(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
+                        rFlagsReg cr)
+%{
+  predicate(UseFastStosb);
+  match(Set dummy (ClearArray cnt base));
+  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  format %{ "xorq    rax, rax\t# ClearArray:\n\t"
+            "shlq    rcx,3\t# Convert doublewords to bytes\n\t"
+            "rep     stosb\t# Store rax to *rdi++ while rcx--" %}
+  ins_encode %{ 
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
 instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2,
                         rax_RegI result, regD tmp1, rFlagsReg cr)
 %{
@@ -10478,6 +10495,23 @@
   ins_pipe( pipe_slow );
 %}
 
+// encode char[] to byte[] in ISO_8859_1
+instruct encode_iso_array(rsi_RegP src, rdi_RegP dst, rdx_RegI len,
+                          regD tmp1, regD tmp2, regD tmp3, regD tmp4,
+                          rcx_RegI tmp5, rax_RegI result, rFlagsReg cr) %{
+  match(Set result (EncodeISOArray src (Binary dst len)));
+  effect(TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, USE_KILL src, USE_KILL dst, USE_KILL len, KILL tmp5, KILL cr);
+
+  format %{ "Encode array $src,$dst,$len -> $result    // KILL RCX, RDX, $tmp1, $tmp2, $tmp3, $tmp4, RSI, RDI " %}
+  ins_encode %{
+    __ encode_iso_array($src$$Register, $dst$$Register, $len$$Register,
+                        $tmp1$$XMMRegister, $tmp2$$XMMRegister, $tmp3$$XMMRegister,
+                        $tmp4$$XMMRegister, $tmp5$$Register, $result$$Register);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+
 //----------Control Flow Instructions------------------------------------------
 // Signed compare Instructions
 
--- a/src/cpu/zero/vm/assembler_zero.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/assembler_zero.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -56,15 +56,9 @@
   ShouldNotCallThis();
 }
 
-#ifndef PRODUCT
-void Assembler::pd_print_patched_instruction(address branch) {
-  ShouldNotCallThis();
-}
-#endif // PRODUCT
-
 void MacroAssembler::align(int modulus) {
   while (offset() % modulus != 0)
-    emit_byte(AbstractAssembler::code_fill_byte());
+    emit_int8(AbstractAssembler::code_fill_byte());
 }
 
 void MacroAssembler::bang_stack_with_offset(int offset) {
@@ -72,8 +66,7 @@
 }
 
 void MacroAssembler::advance(int bytes) {
-  _code_pos += bytes;
-  sync();
+  code_section()->set_end(code_section()->end() + bytes);
 }
 
 RegisterOrConstant MacroAssembler::delayed_value_impl(
--- a/src/cpu/zero/vm/assembler_zero.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/assembler_zero.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -37,9 +37,6 @@
 
  public:
   void pd_patch_instruction(address branch, address target);
-#ifndef PRODUCT
-  static void pd_print_patched_instruction(address branch);
-#endif // PRODUCT
 };
 
 class MacroAssembler : public Assembler {
--- a/src/cpu/zero/vm/frame_zero.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/frame_zero.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -98,10 +98,20 @@
 #endif // CC_INTERP
 
 void frame::patch_pc(Thread* thread, address pc) {
-  // We borrow this call to set the thread pointer in the interpreter
-  // state; the hook to set up deoptimized frames isn't supplied it.
-  assert(pc == NULL, "should be");
-  get_interpreterState()->set_thread((JavaThread *) thread);
+
+  if (pc != NULL) {
+    _cb = CodeCache::find_blob(pc);
+    SharkFrame* sharkframe = zeroframe()->as_shark_frame();
+    sharkframe->set_pc(pc);
+    _pc = pc;
+    _deopt_state = is_deoptimized;
+
+  } else {
+    // We borrow this call to set the thread pointer in the interpreter
+    // state; the hook to set up deoptimized frames isn't supplied it.
+    assert(pc == NULL, "should be");
+    get_interpreterState()->set_thread((JavaThread *) thread);
+  }
 }
 
 bool frame::safe_for_sender(JavaThread *thread) {
--- a/src/cpu/zero/vm/frame_zero.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/frame_zero.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -45,27 +45,36 @@
   case ZeroFrame::ENTRY_FRAME:
     _pc = StubRoutines::call_stub_return_pc();
     _cb = NULL;
+    _deopt_state = not_deoptimized;
     break;
 
   case ZeroFrame::INTERPRETER_FRAME:
     _pc = NULL;
     _cb = NULL;
+    _deopt_state = not_deoptimized;
     break;
 
-  case ZeroFrame::SHARK_FRAME:
+  case ZeroFrame::SHARK_FRAME: {
     _pc = zero_sharkframe()->pc();
     _cb = CodeCache::find_blob_unsafe(pc());
+    address original_pc = nmethod::get_deopt_original_pc(this);
+    if (original_pc != NULL) {
+      _pc = original_pc;
+      _deopt_state = is_deoptimized;
+    } else {
+      _deopt_state = not_deoptimized;
+    }
     break;
-
+  }
   case ZeroFrame::FAKE_STUB_FRAME:
     _pc = NULL;
     _cb = NULL;
+    _deopt_state = not_deoptimized;
     break;
 
   default:
     ShouldNotReachHere();
   }
-  _deopt_state = not_deoptimized;
 }
 
 // Accessors
--- a/src/cpu/zero/vm/sharkFrame_zero.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/sharkFrame_zero.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -68,6 +68,10 @@
     return (address) value_of_word(pc_off);
   }
 
+  void set_pc(address pc) const {
+    *((address*) addr_of_word(pc_off)) = pc;
+  }
+
   intptr_t* unextended_sp() const {
     return (intptr_t *) value_of_word(unextended_sp_off);
   }
--- a/src/cpu/zero/vm/vmStructs_zero.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/cpu/zero/vm/vmStructs_zero.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,28 +30,12 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must  */
-  /* be present there)                                                */
+#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
 
-#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must    */
-  /* be present there)                                                */
+#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
 
-#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used        */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must  */
-  /* be present there)                                                      */
+#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used         */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must  */
-  /* be present there)                                                       */
+#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // CPU_ZERO_VM_VMSTRUCTS_ZERO_HPP
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/bsd/vm/os_bsd.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -243,29 +243,32 @@
   int mib[2];
   size_t len;
   int cpu_val;
-  u_long mem_val;
+  julong mem_val;
 
   /* get processors count via hw.ncpus sysctl */
   mib[0] = CTL_HW;
   mib[1] = HW_NCPU;
   len = sizeof(cpu_val);
   if (sysctl(mib, 2, &cpu_val, &len, NULL, 0) != -1 && cpu_val >= 1) {
+       assert(len == sizeof(cpu_val), "unexpected data size");
        set_processor_count(cpu_val);
   }
   else {
        set_processor_count(1);   // fallback
   }
 
-  /* get physical memory via hw.usermem sysctl (hw.usermem is used
-   * instead of hw.physmem because we need size of allocatable memory
+  /* get physical memory via hw.memsize sysctl (hw.memsize is used
+   * since it returns a 64 bit value)
    */
   mib[0] = CTL_HW;
-  mib[1] = HW_USERMEM;
+  mib[1] = HW_MEMSIZE;
   len = sizeof(mem_val);
-  if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1)
+  if (sysctl(mib, 2, &mem_val, &len, NULL, 0) != -1) {
+       assert(len == sizeof(mem_val), "unexpected data size");
        _physical_memory = mem_val;
-  else
+  } else {
        _physical_memory = 256*1024*1024;       // fallback (XXXBSD?)
+  }
 
 #ifdef __OpenBSD__
   {
@@ -298,12 +301,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -313,9 +316,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1228,7 +1231,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -1689,7 +1692,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = {0};
 
-// Find the full path to the current module, libjvm or libjvm_g
+// Find the full path to the current module, libjvm
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -1732,10 +1735,9 @@
         char* jrelib_p;
         int len;
 
-        // Check the current module name "libjvm" or "libjvm_g".
+        // Check the current module name "libjvm"
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         rp = realpath(java_home_var, buf);
         if (rp == NULL)
@@ -1764,11 +1766,9 @@
         // to complete the path to JVM being overridden.  Otherwise fallback
         // to the path to the current library.
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g]" instead of
-          // "libjvm"debug_only("_g")"" since for fastdebug version
-          // we should have "libjvm" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/libjvm%s%s", p, JNI_LIB_SUFFIX);
+          snprintf(buf + len, buflen-len, "/libjvm%s", JNI_LIB_SUFFIX);
         } else {
           // Fall back to path of current library
           rp = realpath(dli_fname, buf);
@@ -4094,11 +4094,12 @@
      }
      -- _nParked ;
 
-    // In theory we could move the ST of 0 into _Event past the unlock(),
-    // but then we'd need a MEMBAR after the ST.
     _Event = 0 ;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other.
+    OrderAccess::fence();
   }
   guarantee (_Event >= 0, "invariant") ;
 }
@@ -4161,40 +4162,44 @@
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   assert (_nParked == 0, "invariant") ;
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other.
+  OrderAccess::fence();
   return ret;
 }
 
 void os::PlatformEvent::unpark() {
-  int v, AnyWaiters ;
-  for (;;) {
-      v = _Event ;
-      if (v > 0) {
-         // The LD of _Event could have reordered or be satisfied
-         // by a read-aside from this processor's write buffer.
-         // To avoid problems execute a barrier and then
-         // ratify the value.
-         OrderAccess::fence() ;
-         if (_Event == v) return ;
-         continue ;
-      }
-      if (Atomic::cmpxchg (v+1, &_Event, v) == v) break ;
+  // Transitions for _Event:
+  //    0 :=> 1
+  //    1 :=> 1
+  //   -1 :=> either 0 or 1; must signal target thread
+  //          That is, we can safely transition _Event from -1 to either
+  //          0 or 1. Forcing 1 is slightly more efficient for back-to-back
+  //          unpark() calls.
+  // See also: "Semaphores in Plan 9" by Mullender & Cox
+  //
+  // Note: Forcing a transition from "-1" to "1" on an unpark() means
+  // that it will take two back-to-back park() calls for the owning
+  // thread to block. This has the benefit of forcing a spurious return
+  // from the first park() call after an unpark() call which will help
+  // shake out uses of park() and unpark() without condition variables.
+
+  if (Atomic::xchg(1, &_Event) >= 0) return;
+
+  // Wait for the thread associated with the event to vacate
+  int status = pthread_mutex_lock(_mutex);
+  assert_status(status == 0, status, "mutex_lock");
+  int AnyWaiters = _nParked;
+  assert(AnyWaiters == 0 || AnyWaiters == 1, "invariant");
+  if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) {
+    AnyWaiters = 0;
+    pthread_cond_signal(_cond);
   }
-  if (v < 0) {
-     // Wait for the thread associated with the event to vacate
-     int status = pthread_mutex_lock(_mutex);
-     assert_status(status == 0, status, "mutex_lock");
-     AnyWaiters = _nParked ;
-     assert (AnyWaiters == 0 || AnyWaiters == 1, "invariant") ;
-     if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) {
-        AnyWaiters = 0 ;
-        pthread_cond_signal (_cond);
-     }
-     status = pthread_mutex_unlock(_mutex);
-     assert_status(status == 0, status, "mutex_unlock");
-     if (AnyWaiters != 0) {
-        status = pthread_cond_signal(_cond);
-        assert_status(status == 0, status, "cond_signal");
-     }
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "mutex_unlock");
+  if (AnyWaiters != 0) {
+    status = pthread_cond_signal(_cond);
+    assert_status(status == 0, status, "cond_signal");
   }
 
   // Note that we signal() _after dropping the lock for "immortal" Events.
@@ -4280,13 +4285,14 @@
 }
 
 void Parker::park(bool isAbsolute, jlong time) {
+  // Ideally we'd do something useful while spinning, such
+  // as calling unpackTime().
+
   // Optional fast-path check:
   // Return immediately if a permit is available.
-  if (_counter > 0) {
-      _counter = 0 ;
-      OrderAccess::fence();
-      return ;
-  }
+  // We depend on Atomic::xchg() having full barrier semantics
+  // since we are doing a lock-free update to _counter.
+  if (Atomic::xchg(0, &_counter) > 0) return;
 
   Thread* thread = Thread::current();
   assert(thread->is_Java_thread(), "Must be JavaThread");
@@ -4327,6 +4333,8 @@
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other and Java-level accesses.
     OrderAccess::fence();
     return;
   }
@@ -4363,12 +4371,14 @@
   _counter = 0 ;
   status = pthread_mutex_unlock(_mutex) ;
   assert_status(status == 0, status, "invariant") ;
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other and Java-level accesses.
+  OrderAccess::fence();
+
   // If externally suspended while waiting, re-suspend
   if (jt->handle_special_suspend_equivalent_condition()) {
     jt->java_suspend_self();
   }
-
-  OrderAccess::fence();
 }
 
 void Parker::unpark() {
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -59,14 +59,6 @@
   return ":";
 }
 
-inline const char* os::jlong_format_specifier() {
-  return "%lld";
-}
-
-inline const char* os::julong_format_specifier() {
-  return "%llu";
-}
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/linux/vm/os_linux.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/linux/vm/os_linux.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -321,12 +321,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -336,9 +336,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1679,7 +1679,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -2180,7 +2180,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = {0};
 
-// Find the full path to the current module, libjvm.so or libjvm_g.so
+// Find the full path to the current module, libjvm.so
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -2223,10 +2223,9 @@
         char* jrelib_p;
         int len;
 
-        // Check the current module name "libjvm.so" or "libjvm_g.so".
+        // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         rp = realpath(java_home_var, buf);
         if (rp == NULL)
@@ -2242,11 +2241,9 @@
         }
 
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g].so" instead of
-          // "libjvm"debug_only("_g")".so" since for fastdebug version
-          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm.so"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
+          snprintf(buf + len, buflen-len, "/hotspot/libjvm.so");
         } else {
           // Go back to path of .so
           rp = realpath(dli_fname, buf);
@@ -5011,11 +5008,12 @@
      }
      -- _nParked ;
 
-    // In theory we could move the ST of 0 into _Event past the unlock(),
-    // but then we'd need a MEMBAR after the ST.
     _Event = 0 ;
      status = pthread_mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other.
+    OrderAccess::fence();
   }
   guarantee (_Event >= 0, "invariant") ;
 }
@@ -5078,40 +5076,44 @@
   status = pthread_mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
   assert (_nParked == 0, "invariant") ;
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other.
+  OrderAccess::fence();
   return ret;
 }
 
 void os::PlatformEvent::unpark() {
-  int v, AnyWaiters ;
-  for (;;) {
-      v = _Event ;
-      if (v > 0) {
-         // The LD of _Event could have reordered or be satisfied
-         // by a read-aside from this processor's write buffer.
-         // To avoid problems execute a barrier and then
-         // ratify the value.
-         OrderAccess::fence() ;
-         if (_Event == v) return ;
-         continue ;
-      }
-      if (Atomic::cmpxchg (v+1, &_Event, v) == v) break ;
-  }
-  if (v < 0) {
-     // Wait for the thread associated with the event to vacate
-     int status = pthread_mutex_lock(_mutex);
-     assert_status(status == 0, status, "mutex_lock");
-     AnyWaiters = _nParked ;
-     assert (AnyWaiters == 0 || AnyWaiters == 1, "invariant") ;
-     if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) {
-        AnyWaiters = 0 ;
-        pthread_cond_signal (_cond);
-     }
-     status = pthread_mutex_unlock(_mutex);
-     assert_status(status == 0, status, "mutex_unlock");
-     if (AnyWaiters != 0) {
-        status = pthread_cond_signal(_cond);
-        assert_status(status == 0, status, "cond_signal");
-     }
+  // Transitions for _Event:
+  //    0 :=> 1
+  //    1 :=> 1
+  //   -1 :=> either 0 or 1; must signal target thread
+  //          That is, we can safely transition _Event from -1 to either
+  //          0 or 1. Forcing 1 is slightly more efficient for back-to-back
+  //          unpark() calls.
+  // See also: "Semaphores in Plan 9" by Mullender & Cox
+  //
+  // Note: Forcing a transition from "-1" to "1" on an unpark() means
+  // that it will take two back-to-back park() calls for the owning
+  // thread to block. This has the benefit of forcing a spurious return
+  // from the first park() call after an unpark() call which will help
+  // shake out uses of park() and unpark() without condition variables.
+
+  if (Atomic::xchg(1, &_Event) >= 0) return;
+
+  // Wait for the thread associated with the event to vacate
+  int status = pthread_mutex_lock(_mutex);
+  assert_status(status == 0, status, "mutex_lock");
+  int AnyWaiters = _nParked;
+  assert(AnyWaiters == 0 || AnyWaiters == 1, "invariant");
+  if (AnyWaiters != 0 && WorkAroundNPTLTimedWaitHang) {
+    AnyWaiters = 0;
+    pthread_cond_signal(_cond);
+  }
+  status = pthread_mutex_unlock(_mutex);
+  assert_status(status == 0, status, "mutex_unlock");
+  if (AnyWaiters != 0) {
+    status = pthread_cond_signal(_cond);
+    assert_status(status == 0, status, "cond_signal");
   }
 
   // Note that we signal() _after dropping the lock for "immortal" Events.
@@ -5197,13 +5199,14 @@
 }
 
 void Parker::park(bool isAbsolute, jlong time) {
+  // Ideally we'd do something useful while spinning, such
+  // as calling unpackTime().
+
   // Optional fast-path check:
   // Return immediately if a permit is available.
-  if (_counter > 0) {
-      _counter = 0 ;
-      OrderAccess::fence();
-      return ;
-  }
+  // We depend on Atomic::xchg() having full barrier semantics
+  // since we are doing a lock-free update to _counter.
+  if (Atomic::xchg(0, &_counter) > 0) return;
 
   Thread* thread = Thread::current();
   assert(thread->is_Java_thread(), "Must be JavaThread");
@@ -5244,6 +5247,8 @@
     _counter = 0;
     status = pthread_mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other and Java-level accesses.
     OrderAccess::fence();
     return;
   }
@@ -5280,12 +5285,14 @@
   _counter = 0 ;
   status = pthread_mutex_unlock(_mutex) ;
   assert_status(status == 0, status, "invariant") ;
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other and Java-level accesses.
+  OrderAccess::fence();
+
   // If externally suspended while waiting, re-suspend
   if (jt->handle_special_suspend_equivalent_condition()) {
     jt->java_suspend_self();
   }
-
-  OrderAccess::fence();
 }
 
 void Parker::unpark() {
--- a/src/os/linux/vm/os_linux.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/linux/vm/os_linux.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -68,14 +68,6 @@
   return ":";
 }
 
-inline const char* os::jlong_format_specifier() {
-  return "%lld";
-}
-
-inline const char* os::julong_format_specifier() {
-  return "%llu";
-}
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/posix/launcher/java_md.c	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/posix/launcher/java_md.c	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1876,11 +1876,6 @@
     }
 }
 
-const char *
-jlong_format_specifier() {
-    return "%lld";
-}
-
 /*
  * Block current thread and continue execution in a new thread
  */
--- a/src/os/posix/launcher/java_md.h	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/posix/launcher/java_md.h	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -64,6 +64,12 @@
 #define Counter2Micros(counts)    (1)
 #endif /* HAVE_GETHRTIME */
 
+#ifdef _LP64
+#define JLONG_FORMAT "%ld"
+#else
+#define JLONG_FORMAT "%lld"
+#endif
+
 /*
  * Function prototypes.
  */
--- a/src/os/posix/vm/os_posix.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/posix/vm/os_posix.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -93,6 +93,47 @@
   return;
 }
 
+// Multiple threads can race in this code, and can remap over each other with MAP_FIXED,
+// so on posix, unmap the section at the start and at the end of the chunk that we mapped
+// rather than unmapping and remapping the whole chunk to get requested alignment.
+char* os::reserve_memory_aligned(size_t size, size_t alignment) {
+  assert((alignment & (os::vm_allocation_granularity() - 1)) == 0,
+      "Alignment must be a multiple of allocation granularity (page size)");
+  assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned");
+
+  size_t extra_size = size + alignment;
+  assert(extra_size >= size, "overflow, size is too large to allow alignment");
+
+  char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
+
+  if (extra_base == NULL) {
+    return NULL;
+  }
+
+  // Do manual alignment
+  char* aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
+
+  // [  |                                       |  ]
+  // ^ extra_base
+  //    ^ extra_base + begin_offset == aligned_base
+  //     extra_base + begin_offset + size       ^
+  //                       extra_base + extra_size ^
+  // |<>| == begin_offset
+  //                              end_offset == |<>|
+  size_t begin_offset = aligned_base - extra_base;
+  size_t end_offset = (extra_base + extra_size) - (aligned_base + size);
+
+  if (begin_offset > 0) {
+      os::release_memory(extra_base, begin_offset);
+  }
+
+  if (end_offset > 0) {
+      os::release_memory(extra_base + begin_offset + size, end_offset);
+  }
+
+  return aligned_base;
+}
+
 void os::Posix::print_load_average(outputStream* st) {
   st->print("load average:");
   double loadavg[3];
--- a/src/os/solaris/vm/os_solaris.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/solaris/vm/os_solaris.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -734,12 +734,12 @@
 
   // The next steps are taken in the product version:
   //
-  // Obtain the JAVA_HOME value from the location of libjvm[_g].so.
+  // Obtain the JAVA_HOME value from the location of libjvm.so.
   // This library should be located at:
-  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm[_g].so.
+  // <JAVA_HOME>/jre/lib/<arch>/{client|server}/libjvm.so.
   //
   // If "/jre/lib/" appears at the right place in the path, then we
-  // assume libjvm[_g].so is installed in a JDK and we use this path.
+  // assume libjvm.so is installed in a JDK and we use this path.
   //
   // Otherwise exit with message: "Could not create the Java virtual machine."
   //
@@ -749,9 +749,9 @@
   // instead of exit check for $JAVA_HOME environment variable.
   //
   // If it is defined and we are able to locate $JAVA_HOME/jre/lib/<arch>,
-  // then we append a fake suffix "hotspot/libjvm[_g].so" to this path so
-  // it looks like libjvm[_g].so is installed there
-  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm[_g].so.
+  // then we append a fake suffix "hotspot/libjvm.so" to this path so
+  // it looks like libjvm.so is installed there
+  // <JAVA_HOME>/jre/lib/<arch>/hotspot/libjvm.so.
   //
   // Otherwise exit.
   //
@@ -1934,7 +1934,7 @@
   return getcwd(buf, buflen);
 }
 
-// check if addr is inside libjvm[_g].so
+// check if addr is inside libjvm.so
 bool os::address_is_in_vm(address addr) {
   static address libjvm_base_addr;
   Dl_info dlinfo;
@@ -2474,7 +2474,7 @@
 
 static char saved_jvm_path[MAXPATHLEN] = { 0 };
 
-// Find the full path to the current module, libjvm.so or libjvm_g.so
+// Find the full path to the current module, libjvm.so
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAXPATHLEN) {
@@ -2522,10 +2522,9 @@
           strcpy(cpu_arch, "amd64");
         }
 #endif
-        // Check the current module name "libjvm.so" or "libjvm_g.so".
+        // Check the current module name "libjvm.so".
         p = strrchr(buf, '/');
         assert(strstr(p, "/libjvm") == p, "invalid library name");
-        p = strstr(p, "_g") ? "_g" : "";
 
         realpath(java_home_var, buf);
         // determine if this is a legacy image or modules image
@@ -2538,11 +2537,9 @@
         }
 
         if (0 == access(buf, F_OK)) {
-          // Use current module name "libjvm[_g].so" instead of
-          // "libjvm"debug_only("_g")".so" since for fastdebug version
-          // we should have "libjvm.so" but debug_only("_g") adds "_g"!
+          // Use current module name "libjvm.so"
           len = strlen(buf);
-          snprintf(buf + len, buflen-len, "/hotspot/libjvm%s.so", p);
+          snprintf(buf + len, buflen-len, "/hotspot/libjvm.so");
         } else {
           // Go back to path of .so
           realpath((char *)dlinfo.dli_fname, buf);
@@ -6017,6 +6014,9 @@
      _Event = 0 ;
      status = os::Solaris::mutex_unlock(_mutex);
      assert_status(status == 0, status, "mutex_unlock");
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other.
+    OrderAccess::fence();
   }
 }
 
@@ -6058,51 +6058,43 @@
   _Event = 0 ;
   status = os::Solaris::mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock");
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other.
+  OrderAccess::fence();
   return ret;
 }
 
 void os::PlatformEvent::unpark() {
-  int v, AnyWaiters;
-
-  // Increment _Event.
-  // Another acceptable implementation would be to simply swap 1
-  // into _Event:
-  //   if (Swap (&_Event, 1) < 0) {
-  //      mutex_lock (_mutex) ; AnyWaiters = nParked; mutex_unlock (_mutex) ;
-  //      if (AnyWaiters) cond_signal (_cond) ;
-  //   }
-
-  for (;;) {
-    v = _Event ;
-    if (v > 0) {
-       // The LD of _Event could have reordered or be satisfied
-       // by a read-aside from this processor's write buffer.
-       // To avoid problems execute a barrier and then
-       // ratify the value.  A degenerate CAS() would also work.
-       // Viz., CAS (v+0, &_Event, v) == v).
-       OrderAccess::fence() ;
-       if (_Event == v) return ;
-       continue ;
-    }
-    if (Atomic::cmpxchg (v+1, &_Event, v) == v) break ;
-  }
+  // Transitions for _Event:
+  //    0 :=> 1
+  //    1 :=> 1
+  //   -1 :=> either 0 or 1; must signal target thread
+  //          That is, we can safely transition _Event from -1 to either
+  //          0 or 1. Forcing 1 is slightly more efficient for back-to-back
+  //          unpark() calls.
+  // See also: "Semaphores in Plan 9" by Mullender & Cox
+  //
+  // Note: Forcing a transition from "-1" to "1" on an unpark() means
+  // that it will take two back-to-back park() calls for the owning
+  // thread to block. This has the benefit of forcing a spurious return
+  // from the first park() call after an unpark() call which will help
+  // shake out uses of park() and unpark() without condition variables.
+
+  if (Atomic::xchg(1, &_Event) >= 0) return;
 
   // If the thread associated with the event was parked, wake it.
-  if (v < 0) {
-     int status ;
-     // Wait for the thread assoc with the PlatformEvent to vacate.
-     status = os::Solaris::mutex_lock(_mutex);
-     assert_status(status == 0, status, "mutex_lock");
-     AnyWaiters = _nParked ;
-     status = os::Solaris::mutex_unlock(_mutex);
-     assert_status(status == 0, status, "mutex_unlock");
-     guarantee (AnyWaiters == 0 || AnyWaiters == 1, "invariant") ;
-     if (AnyWaiters != 0) {
-       // We intentional signal *after* dropping the lock
-       // to avoid a common class of futile wakeups.
-       status = os::Solaris::cond_signal(_cond);
-       assert_status(status == 0, status, "cond_signal");
-     }
+  // Wait for the thread assoc with the PlatformEvent to vacate.
+  int status = os::Solaris::mutex_lock(_mutex);
+  assert_status(status == 0, status, "mutex_lock");
+  int AnyWaiters = _nParked;
+  status = os::Solaris::mutex_unlock(_mutex);
+  assert_status(status == 0, status, "mutex_unlock");
+  guarantee(AnyWaiters == 0 || AnyWaiters == 1, "invariant");
+  if (AnyWaiters != 0) {
+    // We intentional signal *after* dropping the lock
+    // to avoid a common class of futile wakeups.
+    status = os::Solaris::cond_signal(_cond);
+    assert_status(status == 0, status, "cond_signal");
   }
 }
 
@@ -6180,14 +6172,14 @@
 }
 
 void Parker::park(bool isAbsolute, jlong time) {
+  // Ideally we'd do something useful while spinning, such
+  // as calling unpackTime().
 
   // Optional fast-path check:
   // Return immediately if a permit is available.
-  if (_counter > 0) {
-      _counter = 0 ;
-      OrderAccess::fence();
-      return ;
-  }
+  // We depend on Atomic::xchg() having full barrier semantics
+  // since we are doing a lock-free update to _counter.
+  if (Atomic::xchg(0, &_counter) > 0) return;
 
   // Optional fast-exit: Check interrupt before trying to wait
   Thread* thread = Thread::current();
@@ -6229,6 +6221,8 @@
     _counter = 0;
     status = os::Solaris::mutex_unlock(_mutex);
     assert (status == 0, "invariant") ;
+    // Paranoia to ensure our locked and lock-free paths interact
+    // correctly with each other and Java-level accesses.
     OrderAccess::fence();
     return;
   }
@@ -6270,12 +6264,14 @@
   _counter = 0 ;
   status = os::Solaris::mutex_unlock(_mutex);
   assert_status(status == 0, status, "mutex_unlock") ;
+  // Paranoia to ensure our locked and lock-free paths interact
+  // correctly with each other and Java-level accesses.
+  OrderAccess::fence();
 
   // If externally suspended while waiting, re-suspend
   if (jt->handle_special_suspend_equivalent_condition()) {
     jt->java_suspend_self();
   }
-  OrderAccess::fence();
 }
 
 void Parker::unpark() {
--- a/src/os/solaris/vm/os_solaris.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/solaris/vm/os_solaris.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,9 +50,6 @@
 inline const char* os::line_separator() { return "\n"; }
 inline const char* os::path_separator() { return ":"; }
 
-inline const char* os::jlong_format_specifier()   { return "%lld"; }
-inline const char* os::julong_format_specifier()  { return "%llu"; }
-
 // File names are case-sensitive on windows only
 inline int os::file_name_strcmp(const char* s1, const char* s2) {
   return strcmp(s1, s2);
--- a/src/os/windows/launcher/java_md.c	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/launcher/java_md.c	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -1323,11 +1323,6 @@
     }
 }
 
-const char *
-jlong_format_specifier() {
-    return "%I64d";
-}
-
 /*
  * Block current thread and continue execution in a new thread
  */
--- a/src/os/windows/launcher/java_md.h	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/launcher/java_md.h	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -69,6 +69,8 @@
 extern int _main(int argc, char **argv);
 #endif
 
+#define JLONG_FORMAT "%I64d"
+
 /*
  * Function prototypes.
  */
--- a/src/os/windows/vm/decoder_windows.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/vm/decoder_windows.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -49,7 +49,7 @@
     pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions");
     pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize");
     _pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64");
-    _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)GetProcAddress(handle, "UnDecorateSymbolName");
+    _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)::GetProcAddress(handle, "UnDecorateSymbolName");
 
     if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) {
       _pfnSymGetSymFromAddr64 = NULL;
@@ -60,8 +60,9 @@
       return;
     }
 
-    _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
-    if (!_pfnSymInitialize(GetCurrentProcess(), NULL, TRUE)) {
+    HANDLE hProcess = ::GetCurrentProcess();
+    _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS);
+    if (!_pfnSymInitialize(hProcess, NULL, TRUE)) {
       _pfnSymGetSymFromAddr64 = NULL;
       _pfnUndecorateSymbolName = NULL;
       ::FreeLibrary(handle);
@@ -70,6 +71,77 @@
       return;
     }
 
+    // set pdb search paths
+    pfn_SymSetSearchPath  _pfn_SymSetSearchPath =
+      (pfn_SymSetSearchPath)::GetProcAddress(handle, "SymSetSearchPath");
+    pfn_SymGetSearchPath  _pfn_SymGetSearchPath =
+      (pfn_SymGetSearchPath)::GetProcAddress(handle, "SymGetSearchPath");
+    if (_pfn_SymSetSearchPath != NULL && _pfn_SymGetSearchPath != NULL) {
+      char paths[MAX_PATH];
+      int  len = sizeof(paths);
+      if (!_pfn_SymGetSearchPath(hProcess, paths, len)) {
+        paths[0] = '\0';
+      } else {
+        // available spaces in path buffer
+        len -= (int)strlen(paths);
+      }
+
+      char tmp_path[MAX_PATH];
+      DWORD dwSize;
+      HMODULE hJVM = ::GetModuleHandle("jvm.dll");
+      tmp_path[0] = '\0';
+      // append the path where jvm.dll is located
+      if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) {
+        while (dwSize > 0 && tmp_path[dwSize] != '\\') {
+          dwSize --;
+        }
+
+        tmp_path[dwSize] = '\0';
+
+        if (dwSize > 0 && len > (int)dwSize + 1) {
+          strncat(paths, os::path_separator(), 1);
+          strncat(paths, tmp_path, dwSize);
+          len -= dwSize + 1;
+        }
+      }
+
+      // append $JRE/bin. Arguments::get_java_home actually returns $JRE
+      // path
+      char *p = Arguments::get_java_home();
+      assert(p != NULL, "empty java home");
+      size_t java_home_len = strlen(p);
+      if (len > (int)java_home_len + 5) {
+        strncat(paths, os::path_separator(), 1);
+        strncat(paths, p, java_home_len);
+        strncat(paths, "\\bin", 4);
+        len -= (int)(java_home_len + 5);
+      }
+
+      // append $JDK/bin path if it exists
+      assert(java_home_len < MAX_PATH, "Invalid path length");
+      // assume $JRE is under $JDK, construct $JDK/bin path and
+      // see if it exists or not
+      if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) {
+        strncpy(tmp_path, p, java_home_len - 3);
+        tmp_path[java_home_len - 3] = '\0';
+        strncat(tmp_path, "bin", 3);
+
+        // if the directory exists
+        DWORD dwAttrib = GetFileAttributes(tmp_path);
+        if (dwAttrib != INVALID_FILE_ATTRIBUTES &&
+            (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) {
+          // tmp_path should have the same length as java_home_len, since we only
+          // replaced 'jre' with 'bin'
+          if (len > (int)java_home_len + 1) {
+            strncat(paths, os::path_separator(), 1);
+            strncat(paths, tmp_path, java_home_len);
+          }
+        }
+      }
+
+      _pfn_SymSetSearchPath(hProcess, paths);
+    }
+
      // find out if jvm.dll contains private symbols, by decoding
      // current function and comparing the result
      address addr = (address)Decoder::demangle;
--- a/src/os/windows/vm/decoder_windows.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/vm/decoder_windows.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -35,6 +35,8 @@
 typedef BOOL  (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
 typedef BOOL  (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
 typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
+typedef BOOL  (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR);
+typedef BOOL  (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int);
 
 class WindowsDecoder : public AbstractDecoder {
 
--- a/src/os/windows/vm/os_windows.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/vm/os_windows.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -182,7 +182,7 @@
 
       if (!getenv("_ALT_JAVA_HOME_DIR", home_dir, MAX_PATH)) {
           os::jvm_path(home_dir, sizeof(home_dir));
-          // Found the full path to jvm[_g].dll.
+          // Found the full path to jvm.dll.
           // Now cut the path to <java_home>/jre if we can.
           *(strrchr(home_dir, '\\')) = '\0';  /* get rid of \jvm.dll */
           pslash = strrchr(home_dir, '\\');
@@ -1715,7 +1715,7 @@
 
 static char saved_jvm_path[MAX_PATH] = {0};
 
-// Find the full path to the current module, jvm.dll or jvm_g.dll
+// Find the full path to the current module, jvm.dll
 void os::jvm_path(char *buf, jint buflen) {
   // Error checking.
   if (buflen < MAX_PATH) {
@@ -1874,8 +1874,22 @@
       }
       return TRUE;
       break;
+    case CTRL_LOGOFF_EVENT: {
+      // Don't terminate JVM if it is running in a non-interactive session,
+      // such as a service process.
+      USEROBJECTFLAGS flags;
+      HANDLE handle = GetProcessWindowStation();
+      if (handle != NULL &&
+          GetUserObjectInformation(handle, UOI_FLAGS, &flags,
+            sizeof( USEROBJECTFLAGS), NULL)) {
+        // If it is a non-interactive session, let next handler to deal
+        // with it.
+        if ((flags.dwFlags & WSF_VISIBLE) == 0) {
+          return FALSE;
+        }
+      }
+    }
     case CTRL_CLOSE_EVENT:
-    case CTRL_LOGOFF_EVENT:
     case CTRL_SHUTDOWN_EVENT:
       os::signal_raise(SIGTERM);
       return TRUE;
@@ -2897,6 +2911,36 @@
   }
 }
 
+// Multiple threads can race in this code but it's not possible to unmap small sections of
+// virtual space to get requested alignment, like posix-like os's.
+// Windows prevents multiple thread from remapping over each other so this loop is thread-safe.
+char* os::reserve_memory_aligned(size_t size, size_t alignment) {
+  assert((alignment & (os::vm_allocation_granularity() - 1)) == 0,
+      "Alignment must be a multiple of allocation granularity (page size)");
+  assert((size & (alignment -1)) == 0, "size must be 'alignment' aligned");
+
+  size_t extra_size = size + alignment;
+  assert(extra_size >= size, "overflow, size is too large to allow alignment");
+
+  char* aligned_base = NULL;
+
+  do {
+    char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
+    if (extra_base == NULL) {
+      return NULL;
+    }
+    // Do manual alignment
+    aligned_base = (char*) align_size_up((uintptr_t) extra_base, alignment);
+
+    os::release_memory(extra_base, extra_size);
+
+    aligned_base = os::reserve_memory(size, aligned_base);
+
+  } while (aligned_base == NULL);
+
+  return aligned_base;
+}
+
 char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
   assert((size_t)addr % os::vm_allocation_granularity() == 0,
          "reserve alignment");
@@ -2918,7 +2962,7 @@
     }
     if( Verbose && PrintMiscellaneous ) {
       reserveTimer.stop();
-      tty->print_cr("reserve_memory of %Ix bytes took %ld ms (%ld ticks)", bytes,
+      tty->print_cr("reserve_memory of %Ix bytes took " JLONG_FORMAT " ms (" JLONG_FORMAT " ticks)", bytes,
                     reserveTimer.milliseconds(), reserveTimer.ticks());
     }
   }
@@ -4277,7 +4321,7 @@
   if (hFile == NULL) {
     if (PrintMiscellaneous && Verbose) {
       DWORD err = GetLastError();
-      tty->print_cr("CreateFile() failed: GetLastError->%ld.");
+      tty->print_cr("CreateFile() failed: GetLastError->%ld.", err);
     }
     return NULL;
   }
@@ -4327,7 +4371,7 @@
     if (hMap == NULL) {
       if (PrintMiscellaneous && Verbose) {
         DWORD err = GetLastError();
-        tty->print_cr("CreateFileMapping() failed: GetLastError->%ld.");
+        tty->print_cr("CreateFileMapping() failed: GetLastError->%ld.", err);
       }
       CloseHandle(hFile);
       return NULL;
@@ -4537,6 +4581,7 @@
     }
     v = _Event ;
     _Event = 0 ;
+    // see comment at end of os::PlatformEvent::park() below:
     OrderAccess::fence() ;
     // If we encounter a nearly simultanous timeout expiry and unpark()
     // we return OS_OK indicating we awoke via unpark().
@@ -4574,25 +4619,25 @@
 
 void os::PlatformEvent::unpark() {
   guarantee (_ParkHandle != NULL, "Invariant") ;
-  int v ;
-  for (;;) {
-      v = _Event ;      // Increment _Event if it's < 1.
-      if (v > 0) {
-         // If it's already signaled just return.
-         // The LD of _Event could have reordered or be satisfied
-         // by a read-aside from this processor's write buffer.
-         // To avoid problems execute a barrier and then
-         // ratify the value.  A degenerate CAS() would also work.
-         // Viz., CAS (v+0, &_Event, v) == v).
-         OrderAccess::fence() ;
-         if (_Event == v) return ;
-         continue ;
-      }
-      if (Atomic::cmpxchg (v+1, &_Event, v) == v) break ;
-  }
-  if (v < 0) {
-     ::SetEvent (_ParkHandle) ;
-  }
+
+  // Transitions for _Event:
+  //    0 :=> 1
+  //    1 :=> 1
+  //   -1 :=> either 0 or 1; must signal target thread
+  //          That is, we can safely transition _Event from -1 to either
+  //          0 or 1. Forcing 1 is slightly more efficient for back-to-back
+  //          unpark() calls.
+  // See also: "Semaphores in Plan 9" by Mullender & Cox
+  //
+  // Note: Forcing a transition from "-1" to "1" on an unpark() means
+  // that it will take two back-to-back park() calls for the owning
+  // thread to block. This has the benefit of forcing a spurious return
+  // from the first park() call after an unpark() call which will help
+  // shake out uses of park() and unpark() without condition variables.
+
+  if (Atomic::xchg(1, &_Event) >= 0) return;
+
+  ::SetEvent(_ParkHandle);
 }
 
 
--- a/src/os/windows/vm/os_windows.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os/windows/vm/os_windows.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -38,9 +38,6 @@
 inline const char* os::path_separator()                { return ";"; }
 inline const char* os::dll_file_extension()            { return ".dll"; }
 
-inline const char* os::jlong_format_specifier()        { return "%I64d"; }
-inline const char* os::julong_format_specifier()       { return "%I64u"; }
-
 inline const int os::default_file_open_flags() { return O_BINARY | O_NOINHERIT;}
 
 // File names are case-insensitive on windows only
--- a/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/bsd_x86/vm/vmStructs_bsd_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,37 +29,26 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
   nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
-  nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)
 
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
   declare_unsigned_integer_type(OSThread::thread_id_t)                    \
-  declare_unsigned_integer_type(pthread_t)                                \
-                                                                          \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(pthread_t)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP
--- a/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/bsd_zero/vm/vmStructs_bsd_zero.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,21 +30,13 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
 
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP
--- a/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/linux_sparc/vm/vmStructs_linux_sparc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,7 +29,7 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
@@ -37,38 +37,27 @@
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
   nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
-  nonstatic_field(OSThread,                    _pthread_id,                                   pthread_t)                             \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  nonstatic_field(OSThread,                    _pthread_id,                                   pthread_t)
 
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
   /* POSIX Thread IDs */                                                  \
   /**********************/                                                \
                                                                           \
   declare_integer_type(OSThread::thread_id_t)                             \
-  declare_unsigned_integer_type(pthread_t)                                \
-                                                                          \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(pthread_t)
 
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
                                                                         \
   /************************/                                            \
   /* JavaThread constants */                                            \
   /************************/                                            \
                                                                         \
-  declare_constant(JavaFrameAnchor::flushed)                            \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+  declare_constant(JavaFrameAnchor::flushed)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_LINUX_SPARC_VM_VMSTRUCTS_LINUX_SPARC_HPP
--- a/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/linux_x86/vm/vmStructs_linux_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,37 +29,26 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
   nonstatic_field(OSThread,                      _thread_id,                                      OSThread::thread_id_t)             \
-  nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)                         \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  nonstatic_field(OSThread,                      _pthread_id,                                     pthread_t)
 
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
   /* Posix Thread IDs   */                                                \
   /**********************/                                                \
                                                                           \
   declare_integer_type(OSThread::thread_id_t)                             \
-  declare_unsigned_integer_type(pthread_t)                                \
-                                                                          \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(pthread_t)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_LINUX_X86_VM_VMSTRUCTS_LINUX_X86_HPP
--- a/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/linux_zero/vm/vmStructs_linux_zero.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,21 +30,12 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
 
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
-
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_LINUX_ZERO_VM_VMSTRUCTS_LINUX_ZERO_HPP
--- a/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/solaris_sparc/vm/vmStructs_solaris_sparc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,44 +29,32 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(JavaThread,                  _base_of_stack_pointer,                        intptr_t*)                             \
-  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)
 
-
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
-                                                                          \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(OSThread::thread_id_t)
 
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
                                                                         \
   /************************/                                            \
   /* JavaThread constants */                                            \
   /************************/                                            \
                                                                         \
-  declare_constant(JavaFrameAnchor::flushed)                            \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+  declare_constant(JavaFrameAnchor::flushed)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_SOLARIS_SPARC_VM_VMSTRUCTS_SOLARIS_SPARC_HPP
--- a/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/solaris_x86/vm/assembler_solaris_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -116,7 +116,7 @@
   ThreadLocalStorage::pd_tlsAccessMode tlsMode = ThreadLocalStorage::pd_getTlsAccessMode ();
   if (tlsMode == ThreadLocalStorage::pd_tlsAccessIndirect) {            // T1
      // Use thread as a temporary: mov r, gs:[0]; mov r, [r+tlsOffset]
-     emit_byte (segment);
+     emit_int8 (segment);
      // ExternalAddress doesn't work because it can't take NULL
      AddressLiteral null(0, relocInfo::none);
      movptr (thread, null);
@@ -125,7 +125,7 @@
   } else
   if (tlsMode == ThreadLocalStorage::pd_tlsAccessDirect) {              // T2
      // mov r, gs:[tlsOffset]
-     emit_byte (segment);
+     emit_int8 (segment);
      AddressLiteral tls_off((address)ThreadLocalStorage::pd_getTlsOffset(), relocInfo::none);
      movptr (thread, tls_off);
      return ;
--- a/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/solaris_x86/vm/vmStructs_solaris_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,36 +29,24 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
-  nonstatic_field(OSThread,                      _thread_id,                                    OSThread::thread_id_t)               \
-                                                                                                                                     \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  nonstatic_field(OSThread,                      _thread_id,                                    OSThread::thread_id_t)
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
   /**********************/                                                \
   /* Solaris Thread IDs */                                                \
   /**********************/                                                \
                                                                           \
-  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
-                                                                          \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(OSThread::thread_id_t)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_SOLARIS_X86_VM_VMSTRUCTS_SOLARIS_X86_HPP
--- a/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/windows_x86/vm/assembler_windows_x86.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,7 +30,7 @@
 
 
 void MacroAssembler::int3() {
-  emit_byte(0xCC);
+  emit_int8((unsigned char)0xCC);
 }
 
 #ifndef _LP64
--- a/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/os_cpu/windows_x86/vm/vmStructs_windows_x86.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,32 +29,21 @@
 // constants required by the Serviceability Agent. This file is
 // referenced by vmStructs.cpp.
 
-#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \
+#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************/                                                                                                   \
   /* Threads (NOTE: incomplete) */                                                                                                   \
   /******************************/                                                                                                   \
                                                                                                                                      \
   nonstatic_field(OSThread,                    _thread_id,                                    OSThread::thread_id_t)                 \
-  unchecked_nonstatic_field(OSThread,          _thread_handle,                                sizeof(HANDLE)) /* NOTE: no type */    \
-                                                                                                                                     \
-  /* This must be the last entry, and must be present */                                                                             \
-  last_entry()
+  unchecked_nonstatic_field(OSThread,          _thread_handle,                                sizeof(HANDLE)) /* NOTE: no type */
 
-#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
+#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
                                                                           \
-  declare_unsigned_integer_type(OSThread::thread_id_t)                    \
-  /* This must be the last entry, and must be present */                  \
-  last_entry()
+  declare_unsigned_integer_type(OSThread::thread_id_t)
 
-#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
-#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
-                                                                        \
-  /* This must be the last entry, and must be present */                \
-  last_entry()
+#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
 
 #endif // OS_CPU_WINDOWS_X86_VM_VMSTRUCTS_WINDOWS_X86_HPP
--- a/src/share/tools/ProjectCreator/ProjectCreator.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/tools/ProjectCreator/ProjectCreator.java	Fri Feb 01 17:06:26 2013 +0100
@@ -36,7 +36,7 @@
             + "into .dsp file, substituting for path given in "
             + "-sourceBase. Example: HotSpotWorkSpace>");
       System.err.println("  -dllLoc <path to directory in which to put "
-            + "jvm.dll and jvm_g.dll; no trailing slash>");
+            + "jvm.dll; no trailing slash>");
       System.err.println("  If any of the above are specified, "
             + "they must all be.");
       System.err.println("  Additional, optional arguments, which can be "
--- a/src/share/tools/launcher/java.c	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/tools/launcher/java.c	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -808,7 +808,7 @@
 static int
 parse_stack_size(const char *s, jlong *result) {
   jlong n = 0;
-  int args_read = sscanf(s, jlong_format_specifier(), &n);
+  int args_read = sscanf(s, JLONG_FORMAT, &n);
   if (args_read != 1) {
     return 0;
   }
--- a/src/share/tools/launcher/java.h	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/tools/launcher/java.h	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -86,7 +86,6 @@
 jboolean RemovableMachineDependentOption(char * option);
 void PrintMachineDependentOptions();
 
-const char *jlong_format_specifier();
 /*
  * Block current thread and continue execution in new thread
  */
--- a/src/share/vm/adlc/formssel.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/adlc/formssel.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -862,8 +862,10 @@
       ( strcmp(_matrule->_rChild->_opType,"AryEq"     )==0 ||
         strcmp(_matrule->_rChild->_opType,"StrComp"   )==0 ||
         strcmp(_matrule->_rChild->_opType,"StrEquals" )==0 ||
-        strcmp(_matrule->_rChild->_opType,"StrIndexOf")==0 )) {
+        strcmp(_matrule->_rChild->_opType,"StrIndexOf")==0 ||
+        strcmp(_matrule->_rChild->_opType,"EncodeISOArray")==0)) {
         // String.(compareTo/equals/indexOf) and Arrays.equals
+        // and sun.nio.cs.iso8859_1$Encoder.EncodeISOArray
         // take 1 control and 1 memory edges.
     return 2;
   }
--- a/src/share/vm/asm/assembler.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/asm/assembler.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -109,37 +109,6 @@
   ICache::invalidate_range(addr_at(0), offset());
 }
 
-
-void AbstractAssembler::a_byte(int x) {
-  emit_byte(x);
-}
-
-
-void AbstractAssembler::a_long(jint x) {
-  emit_long(x);
-}
-
-// Labels refer to positions in the (to be) generated code.  There are bound
-// and unbound
-//
-// Bound labels refer to known positions in the already generated code.
-// offset() is the position the label refers to.
-//
-// Unbound labels refer to unknown positions in the code to be generated; it
-// may contain a list of unresolved displacements that refer to it
-#ifndef PRODUCT
-void AbstractAssembler::print(Label& L) {
-  if (L.is_bound()) {
-    tty->print_cr("bound label to %d|%d", L.loc_pos(), L.loc_sect());
-  } else if (L.is_unbound()) {
-    L.print_instructions((MacroAssembler*)this);
-  } else {
-    tty->print_cr("label in inconsistent state (loc = %d)", L.loc());
-  }
-}
-#endif // PRODUCT
-
-
 void AbstractAssembler::bind(Label& L) {
   if (L.is_bound()) {
     // Assembler can bind a label more than once to the same place.
@@ -342,28 +311,3 @@
 #endif
   return offset < 0 || os::vm_page_size() <= offset;
 }
-
-#ifndef PRODUCT
-void Label::print_instructions(MacroAssembler* masm) const {
-  CodeBuffer* cb = masm->code();
-  for (int i = 0; i < _patch_index; ++i) {
-    int branch_loc;
-    if (i >= PatchCacheSize) {
-      branch_loc = _patch_overflow->at(i - PatchCacheSize);
-    } else {
-      branch_loc = _patches[i];
-    }
-    int branch_pos  = CodeBuffer::locator_pos(branch_loc);
-    int branch_sect = CodeBuffer::locator_sect(branch_loc);
-    address branch = cb->locator_address(branch_loc);
-    tty->print_cr("unbound label");
-    tty->print("@ %d|%d ", branch_pos, branch_sect);
-    if (branch_sect == CodeBuffer::SECT_CONSTS) {
-      tty->print_cr(PTR_FORMAT, *(address*)branch);
-      continue;
-    }
-    masm->pd_print_patched_instruction(branch);
-    tty->cr();
-  }
-}
-#endif // ndef PRODUCT
--- a/src/share/vm/asm/assembler.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/asm/assembler.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -216,19 +216,6 @@
   bool isByte(int x) const             { return 0 <= x && x < 0x100; }
   bool isShiftCount(int x) const       { return 0 <= x && x < 32; }
 
-  void emit_int8(   int8_t  x) { code_section()->emit_int8(   x); }
-  void emit_int16(  int16_t x) { code_section()->emit_int16(  x); }
-  void emit_int32(  int32_t x) { code_section()->emit_int32(  x); }
-  void emit_int64(  int64_t x) { code_section()->emit_int64(  x); }
-
-  void emit_float(  jfloat  x) { code_section()->emit_float(  x); }
-  void emit_double( jdouble x) { code_section()->emit_double( x); }
-  void emit_address(address x) { code_section()->emit_address(x); }
-
-  void emit_byte(int x)  { emit_int8 (x); }  // deprecated
-  void emit_word(int x)  { emit_int16(x); }  // deprecated
-  void emit_long(jint x) { emit_int32(x); }  // deprecated
-
   // Instruction boundaries (required when emitting relocatable values).
   class InstructionMark: public StackObj {
    private:
@@ -277,9 +264,6 @@
   };
 #endif
 
-  // Label functions
-  void print(Label& L);
-
  public:
 
   // Creation
@@ -288,6 +272,15 @@
   // ensure buf contains all code (call this before using/copying the code)
   void flush();
 
+  void emit_int8(   int8_t  x) { code_section()->emit_int8(   x); }
+  void emit_int16(  int16_t x) { code_section()->emit_int16(  x); }
+  void emit_int32(  int32_t x) { code_section()->emit_int32(  x); }
+  void emit_int64(  int64_t x) { code_section()->emit_int64(  x); }
+
+  void emit_float(  jfloat  x) { code_section()->emit_float(  x); }
+  void emit_double( jdouble x) { code_section()->emit_double( x); }
+  void emit_address(address x) { code_section()->emit_address(x); }
+
   // min and max values for signed immediate ranges
   static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1))    ; }
   static int max_simm(int nbits) { return  (intptr_t(1) << (nbits - 1)) - 1; }
@@ -327,8 +320,6 @@
   void    clear_inst_mark()       {        code_section()->clear_mark(); }
 
   // Constants in code
-  void a_byte(int x);
-  void a_long(jint x);
   void relocate(RelocationHolder const& rspec, int format = 0) {
     assert(!pd_check_instruction_mark()
         || inst_mark() == NULL || inst_mark() == code_section()->end(),
@@ -441,15 +432,6 @@
    */
   void pd_patch_instruction(address branch, address target);
 
-#ifndef PRODUCT
-  /**
-   * Platform-dependent method of printing an instruction that needs to be
-   * patched.
-   *
-   * @param branch the instruction to be patched in the buffer.
-   */
-  static void pd_print_patched_instruction(address branch);
-#endif // PRODUCT
 };
 
 #ifdef TARGET_ARCH_x86
--- a/src/share/vm/asm/codeBuffer.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/asm/codeBuffer.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -496,21 +496,9 @@
   dest->verify_section_allocation();
 }
 
-// Anonymous classes need mirror to keep the metadata alive but
-// for regular classes, the class_loader is sufficient.
+// Append an oop reference that keeps the class alive.
 static void append_oop_references(GrowableArray<oop>* oops, Klass* k) {
-  if (k->oop_is_instance()) {
-    InstanceKlass* ik = InstanceKlass::cast(k);
-    if (ik->is_anonymous()) {
-      oop o = ik->java_mirror();
-      assert (o != NULL, "should have a mirror");
-      if (!oops->contains(o)) {
-        oops->append(o);
-      }
-      return;  // only need the mirror
-    }
-  }
-  oop cl = k->class_loader();
+  oop cl = k->klass_holder();
   if (cl != NULL && !oops->contains(cl)) {
     oops->append(cl);
   }
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -3223,7 +3223,12 @@
   }
   if (try_inline_full(callee, holder_known, bc, receiver))
     return true;
-  print_inlining(callee, _inline_bailout_msg, /*success*/ false);
+
+  // Entire compilation could fail during try_inline_full call.
+  // In that case printing inlining decision info is useless.
+  if (!bailed_out())
+    print_inlining(callee, _inline_bailout_msg, /*success*/ false);
+
   return false;
 }
 
@@ -3442,6 +3447,11 @@
       preserves_state = true;
       break;
 
+    case vmIntrinsics::_loadFence :
+    case vmIntrinsics::_storeFence:
+    case vmIntrinsics::_fullFence :
+      break;
+
     default                       : return false; // do not inline
   }
   // create intrinsic node
@@ -3748,7 +3758,8 @@
   push_scope(callee, cont);
 
   // the BlockListBuilder for the callee could have bailed out
-  CHECK_BAILOUT_(false);
+  if (bailed_out())
+      return false;
 
   // Temporarily set up bytecode stream so we can append instructions
   // (only using the bci of this stream)
@@ -3814,7 +3825,8 @@
   iterate_all_blocks(callee_start_block == NULL);
 
   // If we bailed out during parsing, return immediately (this is bad news)
-  if (bailed_out()) return false;
+  if (bailed_out())
+      return false;
 
   // iterate_all_blocks theoretically traverses in random order; in
   // practice, we have only traversed the continuation if we are
@@ -3823,9 +3835,6 @@
          !continuation()->is_set(BlockBegin::was_visited_flag),
          "continuation should not have been parsed yet if we created it");
 
-  // If we bailed out during parsing, return immediately (this is bad news)
-  CHECK_BAILOUT_(false);
-
   // At this point we are almost ready to return and resume parsing of
   // the caller back in the GraphBuilder. The only thing we want to do
   // first is an optimization: during parsing of the callee we
@@ -4166,7 +4175,10 @@
       else
         log->inline_success("receiver is statically known");
     } else {
-      log->inline_fail(msg);
+      if (msg != NULL)
+        log->inline_fail(msg);
+      else
+        log->inline_fail("reason unknown");
     }
   }
 
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -360,7 +360,7 @@
   ValueType* t = x->type();
   switch (t->tag()) {
     case intTag    : output()->print("%d"  , t->as_IntConstant   ()->value());    break;
-    case longTag   : output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value()); output()->print("L"); break;
+    case longTag   : output()->print(JLONG_FORMAT, t->as_LongConstant()->value()); output()->print("L"); break;
     case floatTag  : output()->print("%g"  , t->as_FloatConstant ()->value());    break;
     case doubleTag : output()->print("%gD" , t->as_DoubleConstant()->value());    break;
     case objectTag : print_object(x);                                        break;
--- a/src/share/vm/c1/c1_LIR.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_LIR.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -1563,7 +1563,7 @@
   switch (type()) {
     case T_ADDRESS:out->print("address:%d",as_jint());          break;
     case T_INT:    out->print("int:%d",   as_jint());           break;
-    case T_LONG:   out->print("lng:%lld", as_jlong());          break;
+    case T_LONG:   out->print("lng:" JLONG_FORMAT, as_jlong()); break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
     case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
     case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
--- a/src/share/vm/c1/c1_LIR.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_LIR.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -2259,7 +2259,7 @@
   typedef enum { inputMode, firstMode = inputMode, tempMode, outputMode, numModes, invalidMode = -1 } OprMode;
 
   enum {
-    maxNumberOfOperands = 16,
+    maxNumberOfOperands = 20,
     maxNumberOfInfos = 4
   };
 
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -2977,6 +2977,16 @@
     do_CompareAndSwap(x, longType);
     break;
 
+  case vmIntrinsics::_loadFence :
+    if (os::is_MP()) __ membar_acquire();
+    break;
+  case vmIntrinsics::_storeFence:
+    if (os::is_MP()) __ membar_release();
+    break;
+  case vmIntrinsics::_fullFence :
+    if (os::is_MP()) __ membar();
+    break;
+
   case vmIntrinsics::_Reference_get:
     do_Reference_get(x);
     break;
--- a/src/share/vm/c1/c1_globals.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/c1/c1_globals.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -147,7 +147,7 @@
           "Inline methods containing exception handlers "                   \
           "(NOTE: does not work with current backend)")                     \
                                                                             \
-  develop(bool, InlineSynchronizedMethods, true,                            \
+  product(bool, InlineSynchronizedMethods, true,                            \
           "Inline synchronized methods")                                    \
                                                                             \
   develop(bool, InlineNIOCheckIndex, true,                                  \
--- a/src/share/vm/ci/ciField.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/ci/ciField.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -366,10 +366,12 @@
 // ------------------------------------------------------------------
 // ciField::print
 void ciField::print() {
-  tty->print("<ciField ");
+  tty->print("<ciField name=");
   _holder->print_name();
   tty->print(".");
   _name->print_symbol();
+  tty->print(" signature=");
+  _signature->print_symbol();
   tty->print(" offset=%d type=", _offset);
   if (_type != NULL) _type->print_name();
   else               tty->print("(reference)");
--- a/src/share/vm/ci/ciReplay.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/ci/ciReplay.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -645,7 +645,7 @@
         java_mirror->bool_field_put(fd.offset(), value);
       } else if (strcmp(field_signature, "J") == 0) {
         jlong value;
-        if (sscanf(string_value, INT64_FORMAT, &value) != 1) {
+        if (sscanf(string_value, JLONG_FORMAT, &value) != 1) {
           fprintf(stderr, "Error parsing long: %s\n", string_value);
           return;
         }
--- a/src/share/vm/ci/ciType.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/ci/ciType.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -60,6 +60,19 @@
 }
 
 // ------------------------------------------------------------------
+// ciType::name
+//
+// Return the name of this type
+const char* ciType::name() {
+  if (is_primitive_type()) {
+    return type2name(basic_type());
+  } else {
+    assert(is_klass(), "must be");
+    return as_klass()->name()->as_utf8();
+  }
+}
+
+// ------------------------------------------------------------------
 // ciType::print_impl
 //
 // Implementation of the print method.
@@ -73,7 +86,8 @@
 //
 // Print the name of this type
 void ciType::print_name_on(outputStream* st) {
-  st->print(type2name(basic_type()));
+  ResourceMark rm;
+  st->print(name());
 }
 
 
--- a/src/share/vm/ci/ciType.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/ci/ciType.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -77,6 +77,7 @@
   bool is_type() const                      { return true; }
   bool is_classless() const                 { return is_primitive_type(); }
 
+  const char* name();
   virtual void print_name_on(outputStream* st);
   void print_name() {
     print_name_on(tty);
--- a/src/share/vm/classfile/classFileParser.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -59,6 +59,7 @@
 #include "services/classLoadingService.hpp"
 #include "services/threadService.hpp"
 #include "utilities/array.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 // We generally try to create the oops directly when parsing, rather than
 // allocating temporary data structures and copying the bytes twice. A
@@ -906,6 +907,7 @@
                                              bool* is_synthetic_addr,
                                              u2* generic_signature_index_addr,
                                              AnnotationArray** field_annotations,
+                                             AnnotationArray** field_type_annotations,
                                              ClassFileParser::FieldAnnotationCollector* parsed_annotations,
                                              TRAPS) {
   ClassFileStream* cfs = stream();
@@ -917,6 +919,10 @@
   int runtime_visible_annotations_length = 0;
   u1* runtime_invisible_annotations = NULL;
   int runtime_invisible_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   while (attributes_count--) {
     cfs->guarantee_more(6, CHECK);  // attribute_name_index, attribute_length
     u2 attribute_name_index = cfs->get_u2_fast();
@@ -965,12 +971,28 @@
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
+        parse_annotations(loader_data,
+                          runtime_visible_annotations,
+                          runtime_visible_annotations_length,
+                          cp,
+                          parsed_annotations,
+                          CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
       } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
         runtime_invisible_annotations_length = attribute_length;
         runtime_invisible_annotations = cfs->get_u1_buffer();
         assert(runtime_invisible_annotations != NULL, "null invisible annotations");
         cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK);
+      } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK);
       } else {
         cfs->skip_u1(attribute_length, CHECK);  // Skip unknown attributes
       }
@@ -988,6 +1010,12 @@
                                             runtime_invisible_annotations,
                                             runtime_invisible_annotations_length,
                                             CHECK);
+  *field_type_annotations = assemble_annotations(loader_data,
+                                            runtime_visible_type_annotations,
+                                            runtime_visible_type_annotations_length,
+                                            runtime_invisible_type_annotations,
+                                            runtime_invisible_type_annotations_length,
+                                            CHECK);
   return;
 }
 
@@ -1084,6 +1112,7 @@
                                          bool is_interface,
                                          FieldAllocationCount *fac,
                                          Array<AnnotationArray*>** fields_annotations,
+                                         Array<AnnotationArray*>** fields_type_annotations,
                                          u2* java_fields_count_ptr, TRAPS) {
   ClassFileStream* cfs = stream();
   cfs->guarantee_more(2, CHECK_NULL);  // length
@@ -1119,6 +1148,7 @@
              THREAD, u2, total_fields * (FieldInfo::field_slots + 1));
 
   AnnotationArray* field_annotations = NULL;
+  AnnotationArray* field_type_annotations = NULL;
   // The generic signature slots start after all other fields' data.
   int generic_signature_slot = total_fields * FieldInfo::field_slots;
   int num_generic_signature = 0;
@@ -1160,7 +1190,7 @@
                              cp, attributes_count, is_static, signature_index,
                              &constantvalue_index, &is_synthetic,
                              &generic_signature_index, &field_annotations,
-                             &parsed_annotations,
+                             &field_type_annotations, &parsed_annotations,
                              CHECK_NULL);
       if (field_annotations != NULL) {
         if (*fields_annotations == NULL) {
@@ -1170,6 +1200,14 @@
         }
         (*fields_annotations)->at_put(n, field_annotations);
       }
+      if (field_type_annotations != NULL) {
+        if (*fields_type_annotations == NULL) {
+          *fields_type_annotations = MetadataFactory::new_array<AnnotationArray*>(
+                                                  loader_data, length, NULL,
+                                                  CHECK_NULL);
+        }
+        (*fields_type_annotations)->at_put(n, field_type_annotations);
+      }
       if (is_synthetic) {
         access_flags.set_is_synthetic();
       }
@@ -1185,19 +1223,16 @@
     field->initialize(access_flags.as_short(),
                       name_index,
                       signature_index,
-                      constantvalue_index,
-                      0);
-    if (parsed_annotations.has_any_annotations())
-      parsed_annotations.apply_to(field);
-
+                      constantvalue_index);
     BasicType type = cp->basic_type_for_signature_at(signature_index);
 
     // Remember how many oops we encountered and compute allocation type
     FieldAllocationType atype = fac->update(is_static, type);
-
-    // The correct offset is computed later (all oop fields will be located together)
-    // We temporarily store the allocation type in the offset field
-    field->set_offset(atype);
+    field->set_allocation_type(atype);
+
+    // After field is initialized with type, we can augment it with aux info
+    if (parsed_annotations.has_any_annotations())
+      parsed_annotations.apply_to(field);
   }
 
   int index = length;
@@ -1228,17 +1263,13 @@
       field->initialize(JVM_ACC_FIELD_INTERNAL,
                         injected[n].name_index,
                         injected[n].signature_index,
-                        0,
                         0);
 
       BasicType type = FieldType::basic_type(injected[n].signature());
 
       // Remember how many oops we encountered and compute allocation type
       FieldAllocationType atype = fac->update(false, type);
-
-      // The correct offset is computed later (all oop fields will be located together)
-      // We temporarily store the allocation type in the offset field
-      field->set_offset(atype);
+      field->set_allocation_type(atype);
       index++;
     }
   }
@@ -1704,7 +1735,8 @@
 }
 
 // Sift through annotations, looking for those significant to the VM:
-void ClassFileParser::parse_annotations(u1* buffer, int limit,
+void ClassFileParser::parse_annotations(ClassLoaderData* loader_data,
+                                        u1* buffer, int limit,
                                         constantPoolHandle cp,
                                         ClassFileParser::AnnotationCollector* coll,
                                         TRAPS) {
@@ -1721,9 +1753,12 @@
       e_type_off = 7,   // utf8 such as 'Ljava/lang/annotation/RetentionPolicy;'
       e_con_off = 9,    // utf8 payload, such as 'SOURCE', 'CLASS', 'RUNTIME'
       e_size = 11,     // end of 'e' annotation
-    c_tag_val = 'c',
-      c_con_off = 7,    // utf8 payload, such as 'I' or 'Ljava/lang/String;'
+    c_tag_val = 'c',    // payload is type
+      c_con_off = 7,    // utf8 payload, such as 'I'
       c_size = 9,       // end of 'c' annotation
+    s_tag_val = 's',    // payload is String
+      s_con_off = 7,    // utf8 payload, such as 'Ljava/lang/String;'
+      s_size = 9,
     min_size = 6        // smallest possible size (zero members)
   };
   while ((--nann) >= 0 && (index-2 + min_size <= limit)) {
@@ -1742,57 +1777,63 @@
     }
 
     // Here is where parsing particular annotations will take place.
-    AnnotationCollector::ID id = coll->annotation_index(aname);
+    AnnotationCollector::ID id = coll->annotation_index(loader_data, aname);
     if (id == AnnotationCollector::_unknown)  continue;
     coll->set_annotation(id);
-    // If there are no values, just set the bit and move on:
-    if (count == 0)   continue;
-
-    // For the record, here is how annotation payloads can be collected.
-    // Suppose we want to capture @Retention.value.  Here is how:
-    //if (id == AnnotationCollector::_class_Retention) {
-    //  Symbol* payload = NULL;
-    //  if (count == 1
-    //      && e_size == (index0 - index)  // match size
-    //      && e_tag_val == *(abase + tag_off)
-    //      && (check_symbol_at(cp, Bytes::get_Java_u2(abase + e_type_off))
-    //          == vmSymbols::RetentionPolicy_signature())
-    //      && member == vmSymbols::value_name()) {
-    //    payload = check_symbol_at(cp, Bytes::get_Java_u2(abase + e_con_off));
-    //  }
-    //  check_property(payload != NULL,
-    //                 "Invalid @Retention annotation at offset %u in class file %s",
-    //                 index0, CHECK);
-    //  if (payload != NULL) {
-    //      payload->increment_refcount();
-    //      coll->_class_RetentionPolicy = payload;
-    //  }
-    //}
+
+    if (id == AnnotationCollector::_sun_misc_Contended) {
+      if (count == 1
+          && s_size == (index - index0)  // match size
+          && s_tag_val == *(abase + tag_off)
+          && member == vmSymbols::value_name()) {
+        u2 group_index = Bytes::get_Java_u2(abase + s_con_off);
+        coll->set_contended_group(group_index);
+      } else {
+        coll->set_contended_group(0); // default contended group
+      }
+      coll->set_contended(true);
+    } else {
+      coll->set_contended(false);
+    }
   }
 }
 
-ClassFileParser::AnnotationCollector::ID ClassFileParser::AnnotationCollector::annotation_index(Symbol* name) {
+ClassFileParser::AnnotationCollector::ID
+ClassFileParser::AnnotationCollector::annotation_index(ClassLoaderData* loader_data,
+                                                                Symbol* name) {
   vmSymbols::SID sid = vmSymbols::find_sid(name);
+  // Privileged code can use all annotations.  Other code silently drops some.
+  bool privileged = loader_data->is_the_null_class_loader_data() ||
+                    loader_data->is_anonymous();
   switch (sid) {
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_ForceInline_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_ForceInline;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_DontInline_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_DontInline;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Compiled;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Hidden_signature):
     if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
     return _method_LambdaForm_Hidden;
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_misc_Contended_signature):
+    if (_location != _in_field && _location != _in_class)          break;  // only allow for fields and classes
+    if (!EnableContended || (RestrictContended && !privileged))    break;  // honor privileges
+    return _sun_misc_Contended;
   default: break;
   }
   return AnnotationCollector::_unknown;
 }
 
 void ClassFileParser::FieldAnnotationCollector::apply_to(FieldInfo* f) {
-  fatal("no field annotations yet");
+  if (is_contended())
+    f->set_contended_group(contended_group());
 }
 
 void ClassFileParser::MethodAnnotationCollector::apply_to(methodHandle m) {
@@ -1807,7 +1848,7 @@
 }
 
 void ClassFileParser::ClassAnnotationCollector::apply_to(instanceKlassHandle k) {
-  fatal("no class annotations yet");
+  k->set_is_contended(is_contended());
 }
 
 
@@ -1831,6 +1872,7 @@
                                            AnnotationArray** method_annotations,
                                            AnnotationArray** method_parameter_annotations,
                                            AnnotationArray** method_default_annotations,
+                                           AnnotationArray** method_type_annotations,
                                            TRAPS) {
   ClassFileStream* cfs = stream();
   methodHandle nullHandle;
@@ -1903,6 +1945,8 @@
   u2** localvariable_table_start;
   u2* localvariable_type_table_length;
   u2** localvariable_type_table_start;
+  u2 method_parameters_length = 0;
+  u1* method_parameters_data = NULL;
   bool parsed_code_attribute = false;
   bool parsed_checked_exceptions_attribute = false;
   bool parsed_stackmap_attribute = false;
@@ -1918,6 +1962,10 @@
   int runtime_visible_parameter_annotations_length = 0;
   u1* runtime_invisible_parameter_annotations = NULL;
   int runtime_invisible_parameter_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   u1* annotation_default = NULL;
   int annotation_default_length = 0;
 
@@ -2108,6 +2156,26 @@
             parse_checked_exceptions(&checked_exceptions_length,
                                      method_attribute_length,
                                      cp, CHECK_(nullHandle));
+    } else if (method_attribute_name == vmSymbols::tag_method_parameters()) {
+      method_parameters_length = cfs->get_u1_fast();
+      // Track the actual size (note: this is written for clarity; a
+      // decent compiler will CSE and constant-fold this into a single
+      // expression)
+      u2 actual_size = 1;
+      method_parameters_data = cfs->get_u1_buffer();
+      actual_size += 2 * method_parameters_length;
+      cfs->skip_u2_fast(method_parameters_length);
+      actual_size += 4 * method_parameters_length;
+      cfs->skip_u4_fast(method_parameters_length);
+      // Enforce attribute length
+      if (method_attribute_length != actual_size) {
+        classfile_parse_error(
+          "Invalid MethodParameters method attribute length %u in class file %s",
+          method_attribute_length, CHECK_(nullHandle));
+      }
+      // ignore this attribute if it cannot be reflected
+      if (!SystemDictionary::Parameter_klass_loaded())
+        method_parameters_length = 0;
     } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
       if (method_attribute_length != 0) {
         classfile_parse_error(
@@ -2135,7 +2203,8 @@
         runtime_visible_annotations_length = method_attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
-        parse_annotations(runtime_visible_annotations,
+        parse_annotations(loader_data,
+            runtime_visible_annotations,
             runtime_visible_annotations_length, cp, &parsed_annotations,
             CHECK_(nullHandle));
         cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
@@ -2159,6 +2228,17 @@
         annotation_default = cfs->get_u1_buffer();
         assert(annotation_default != NULL, "null annotation default");
         cfs->skip_u1(annotation_default_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = method_attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        // No need for the VM to parse Type annotations
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK_(nullHandle));
+      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = method_attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK_(nullHandle));
       } else {
         // Skip unknown attributes
         cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
@@ -2184,7 +2264,8 @@
   Method* m = Method::allocate(
       loader_data, code_length, access_flags, linenumber_table_length,
       total_lvt_length, exception_table_length, checked_exceptions_length,
-      generic_signature_index, ConstMethod::NORMAL, CHECK_(nullHandle));
+      method_parameters_length, generic_signature_index,
+      ConstMethod::NORMAL, CHECK_(nullHandle));
 
   ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
 
@@ -2232,6 +2313,21 @@
                              exception_table_start, size);
   }
 
+  // Copy method parameters
+  if (method_parameters_length > 0) {
+    MethodParametersElement* elem = m->constMethod()->method_parameters_start();
+    for(int i = 0; i < method_parameters_length; i++) {
+      elem[i].name_cp_index =
+        Bytes::get_Java_u2(method_parameters_data);
+      method_parameters_data += 2;
+      u4 flags = Bytes::get_Java_u4(method_parameters_data);
+      // This caused an alignment fault on Sparc, if flags was a u4
+      elem[i].flags_lo = extract_low_short_from_int(flags);
+      elem[i].flags_hi = extract_high_short_from_int(flags);
+      method_parameters_data += 4;
+    }
+  }
+
   // Copy checked exceptions
   if (checked_exceptions_length > 0) {
     int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2);
@@ -2333,6 +2429,12 @@
                                                      NULL,
                                                      0,
                                                      CHECK_(nullHandle));
+  *method_type_annotations = assemble_annotations(loader_data,
+                                                  runtime_visible_type_annotations,
+                                                  runtime_visible_type_annotations_length,
+                                                  runtime_invisible_type_annotations,
+                                                  runtime_invisible_type_annotations_length,
+                                                  CHECK_(nullHandle));
 
   if (name == vmSymbols::finalize_method_name() &&
       signature == vmSymbols::void_method_signature()) {
@@ -2364,12 +2466,14 @@
                                                Array<AnnotationArray*>** methods_annotations,
                                                Array<AnnotationArray*>** methods_parameter_annotations,
                                                Array<AnnotationArray*>** methods_default_annotations,
+                                               Array<AnnotationArray*>** methods_type_annotations,
                                                bool* has_default_methods,
                                                TRAPS) {
   ClassFileStream* cfs = stream();
   AnnotationArray* method_annotations = NULL;
   AnnotationArray* method_parameter_annotations = NULL;
   AnnotationArray* method_default_annotations = NULL;
+  AnnotationArray* method_type_annotations = NULL;
   cfs->guarantee_more(2, CHECK_NULL);  // length
   u2 length = cfs->get_u2_fast();
   if (length == 0) {
@@ -2386,6 +2490,7 @@
                                          &method_annotations,
                                          &method_parameter_annotations,
                                          &method_default_annotations,
+                                         &method_type_annotations,
                                          CHECK_NULL);
 
       if (method->is_final()) {
@@ -2396,22 +2501,40 @@
         *has_default_methods = true;
       }
       methods->at_put(index, method());
-      if (*methods_annotations == NULL) {
-        *methods_annotations =
-             MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+
+      if (method_annotations != NULL) {
+        if (*methods_annotations == NULL) {
+          *methods_annotations =
+              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+        }
+        (*methods_annotations)->at_put(index, method_annotations);
+      }
+
+      if (method_parameter_annotations != NULL) {
+        if (*methods_parameter_annotations == NULL) {
+          *methods_parameter_annotations =
+              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+        }
+        (*methods_parameter_annotations)->at_put(index, method_parameter_annotations);
       }
-      (*methods_annotations)->at_put(index, method_annotations);
-      if (*methods_parameter_annotations == NULL) {
-        *methods_parameter_annotations =
-            MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+
+      if (method_default_annotations != NULL) {
+        if (*methods_default_annotations == NULL) {
+          *methods_default_annotations =
+              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+        }
+        (*methods_default_annotations)->at_put(index, method_default_annotations);
       }
-      (*methods_parameter_annotations)->at_put(index, method_parameter_annotations);
-      if (*methods_default_annotations == NULL) {
-        *methods_default_annotations =
-            MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+
+      if (method_type_annotations != NULL) {
+        if (*methods_type_annotations == NULL) {
+          *methods_type_annotations =
+              MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
+        }
+        (*methods_type_annotations)->at_put(index, method_type_annotations);
       }
-      (*methods_default_annotations)->at_put(index, method_default_annotations);
     }
+
     if (_need_verify && length > 1) {
       // Check duplicated methods
       ResourceMark rm(THREAD);
@@ -2445,6 +2568,7 @@
                                           Array<AnnotationArray*>* methods_annotations,
                                           Array<AnnotationArray*>* methods_parameter_annotations,
                                           Array<AnnotationArray*>* methods_default_annotations,
+                                          Array<AnnotationArray*>* methods_type_annotations,
                                               TRAPS) {
   int length = methods->length();
   // If JVMTI original method ordering or sharing is enabled we have to
@@ -2463,7 +2587,8 @@
   // Note that the ordering is not alphabetical, see Symbol::fast_compare
   Method::sort_methods(methods, methods_annotations,
                        methods_parameter_annotations,
-                       methods_default_annotations);
+                       methods_default_annotations,
+                       methods_type_annotations);
 
   // If JVMTI original method ordering or sharing is enabled construct int
   // array remembering the original ordering
@@ -2728,6 +2853,10 @@
   int runtime_visible_annotations_length = 0;
   u1* runtime_invisible_annotations = NULL;
   int runtime_invisible_annotations_length = 0;
+  u1* runtime_visible_type_annotations = NULL;
+  int runtime_visible_type_annotations_length = 0;
+  u1* runtime_invisible_type_annotations = NULL;
+  int runtime_invisible_type_annotations_length = 0;
   u1* inner_classes_attribute_start = NULL;
   u4  inner_classes_attribute_length = 0;
   u2  enclosing_method_class_index = 0;
@@ -2795,7 +2924,8 @@
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
-        parse_annotations(runtime_visible_annotations,
+        parse_annotations(loader_data,
+                          runtime_visible_annotations,
                           runtime_visible_annotations_length,
                           cp,
                           parsed_annotations,
@@ -2834,6 +2964,17 @@
           classfile_parse_error("Multiple BootstrapMethods attributes in class file %s", CHECK);
         parsed_bootstrap_methods_attribute = true;
         parse_classfile_bootstrap_methods_attribute(loader_data, cp, attribute_length, CHECK);
+      } else if (tag == vmSymbols::tag_runtime_visible_type_annotations()) {
+        runtime_visible_type_annotations_length = attribute_length;
+        runtime_visible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_visible_type_annotations != NULL, "null visible type annotations");
+        // No need for the VM to parse Type annotations
+        cfs->skip_u1(runtime_visible_type_annotations_length, CHECK);
+      } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_type_annotations()) {
+        runtime_invisible_type_annotations_length = attribute_length;
+        runtime_invisible_type_annotations = cfs->get_u1_buffer();
+        assert(runtime_invisible_type_annotations != NULL, "null invisible type annotations");
+        cfs->skip_u1(runtime_invisible_type_annotations_length, CHECK);
       } else {
         // Unknown attribute
         cfs->skip_u1(attribute_length, CHECK);
@@ -2850,6 +2991,13 @@
                                                       runtime_invisible_annotations_length,
                                                       CHECK);
   set_class_annotations(annotations);
+  AnnotationArray* type_annotations = assemble_annotations(loader_data,
+                                                           runtime_visible_type_annotations,
+                                                           runtime_visible_type_annotations_length,
+                                                           runtime_invisible_type_annotations,
+                                                           runtime_invisible_type_annotations_length,
+                                                           CHECK);
+  set_class_type_annotations(type_annotations);
 
   if (parsed_innerclasses_attribute || parsed_enclosingmethod_attribute) {
     u2 num_of_classes = parse_classfile_inner_classes_attribute(
@@ -2956,6 +3104,7 @@
                                                     TempNewSymbol& parsed_name,
                                                     bool verify,
                                                     TRAPS) {
+
   // When a retransformable agent is attached, JVMTI caches the
   // class bytes that existed before the first retransformation.
   // If RedefineClasses() was used before the retransformable
@@ -3190,18 +3339,20 @@
     // Fields (offsets are filled in later)
     FieldAllocationCount fac;
     Array<AnnotationArray*>* fields_annotations = NULL;
+    Array<AnnotationArray*>* fields_type_annotations = NULL;
     Array<u2>* fields = parse_fields(loader_data, class_name, cp, access_flags.is_interface(), &fac, &fields_annotations,
+                                          &fields_type_annotations,
                                           &java_fields_count,
                                           CHECK_(nullHandle));
     // Methods
     bool has_final_method = false;
     AccessFlags promoted_flags;
     promoted_flags.set_flags(0);
-    // These need to be oop pointers because they are allocated lazily
-    // inside parse_methods inside a nested HandleMark
+
     Array<AnnotationArray*>* methods_annotations = NULL;
     Array<AnnotationArray*>* methods_parameter_annotations = NULL;
     Array<AnnotationArray*>* methods_default_annotations = NULL;
+    Array<AnnotationArray*>* methods_type_annotations = NULL;
     Array<Method*>* methods = parse_methods(loader_data,
                                             cp, access_flags.is_interface(),
                                             &promoted_flags,
@@ -3209,6 +3360,7 @@
                                             &methods_annotations,
                                             &methods_parameter_annotations,
                                             &methods_default_annotations,
+                                            &methods_type_annotations,
                                             &has_default_methods,
                                             CHECK_(nullHandle));
 
@@ -3270,6 +3422,7 @@
                                                methods_annotations,
                                                methods_parameter_annotations,
                                                methods_default_annotations,
+                                               methods_type_annotations,
                                                CHECK_(nullHandle));
 
     // promote flags from parse_methods() to the klass' flags
@@ -3290,18 +3443,21 @@
     // Size of Java itable (in words)
     itable_size = access_flags.is_interface() ? 0 : klassItable::compute_itable_size(transitive_interfaces);
 
+    // get the padding width from the option
+    // TODO: Ask VM about specific CPU we are running on
+    int pad_size = ContendedPaddingWidth;
+
     // Field size and offset computation
     int nonstatic_field_size = super_klass() == NULL ? 0 : super_klass->nonstatic_field_size();
 #ifndef PRODUCT
     int orig_nonstatic_field_size = 0;
 #endif
-    int static_field_size = 0;
     int next_static_oop_offset;
     int next_static_double_offset;
     int next_static_word_offset;
     int next_static_short_offset;
     int next_static_byte_offset;
-    int next_static_type_offset;
+    int next_static_padded_offset;
     int next_nonstatic_oop_offset;
     int next_nonstatic_double_offset;
     int next_nonstatic_word_offset;
@@ -3311,11 +3467,36 @@
     int first_nonstatic_oop_offset;
     int first_nonstatic_field_offset;
     int next_nonstatic_field_offset;
+    int next_nonstatic_padded_offset;
+
+    // Count the contended fields by type.
+    int static_contended_count = 0;
+    int nonstatic_contended_count = 0;
+    FieldAllocationCount fac_contended;
+    for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+      FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
+      if (fs.is_contended()) {
+        fac_contended.count[atype]++;
+        if (fs.access_flags().is_static()) {
+          static_contended_count++;
+        } else {
+          nonstatic_contended_count++;
+        }
+      }
+    }
+    int contended_count = static_contended_count + nonstatic_contended_count;
+
 
     // Calculate the starting byte offsets
     next_static_oop_offset      = InstanceMirrorKlass::offset_of_static_fields();
+
+    // class is contended, pad before all the fields
+    if (parsed_annotations.is_contended()) {
+      next_static_oop_offset += pad_size;
+    }
+
     next_static_double_offset   = next_static_oop_offset +
-                                  (fac.count[STATIC_OOP] * heapOopSize);
+                                  ((fac.count[STATIC_OOP] - fac_contended.count[STATIC_OOP]) * heapOopSize);
     if ( fac.count[STATIC_DOUBLE] &&
          (Universe::field_type_should_be_aligned(T_DOUBLE) ||
           Universe::field_type_should_be_aligned(T_LONG)) ) {
@@ -3323,25 +3504,29 @@
     }
 
     next_static_word_offset     = next_static_double_offset +
-                                  (fac.count[STATIC_DOUBLE] * BytesPerLong);
+                                  ((fac.count[STATIC_DOUBLE] - fac_contended.count[STATIC_DOUBLE]) * BytesPerLong);
     next_static_short_offset    = next_static_word_offset +
-                                  (fac.count[STATIC_WORD] * BytesPerInt);
+                                  ((fac.count[STATIC_WORD]   - fac_contended.count[STATIC_WORD]) * BytesPerInt);
     next_static_byte_offset     = next_static_short_offset +
-                                  (fac.count[STATIC_SHORT] * BytesPerShort);
-    next_static_type_offset     = align_size_up((next_static_byte_offset +
-                                  fac.count[STATIC_BYTE] ), wordSize );
-    static_field_size           = (next_static_type_offset -
-                                  next_static_oop_offset) / wordSize;
+                                  ((fac.count[STATIC_SHORT]  - fac_contended.count[STATIC_SHORT]) * BytesPerShort);
+    next_static_padded_offset   = next_static_byte_offset +
+                                  ((fac.count[STATIC_BYTE]   - fac_contended.count[STATIC_BYTE]) * 1);
 
     first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
                                    nonstatic_field_size * heapOopSize;
+
+    // class is contended, pad before all the fields
+    if (parsed_annotations.is_contended()) {
+      first_nonstatic_field_offset += pad_size;
+    }
+
     next_nonstatic_field_offset = first_nonstatic_field_offset;
 
-    unsigned int nonstatic_double_count = fac.count[NONSTATIC_DOUBLE];
-    unsigned int nonstatic_word_count   = fac.count[NONSTATIC_WORD];
-    unsigned int nonstatic_short_count  = fac.count[NONSTATIC_SHORT];
-    unsigned int nonstatic_byte_count   = fac.count[NONSTATIC_BYTE];
-    unsigned int nonstatic_oop_count    = fac.count[NONSTATIC_OOP];
+    unsigned int nonstatic_double_count = fac.count[NONSTATIC_DOUBLE] - fac_contended.count[NONSTATIC_DOUBLE];
+    unsigned int nonstatic_word_count   = fac.count[NONSTATIC_WORD]   - fac_contended.count[NONSTATIC_WORD];
+    unsigned int nonstatic_short_count  = fac.count[NONSTATIC_SHORT]  - fac_contended.count[NONSTATIC_SHORT];
+    unsigned int nonstatic_byte_count   = fac.count[NONSTATIC_BYTE]   - fac_contended.count[NONSTATIC_BYTE];
+    unsigned int nonstatic_oop_count    = fac.count[NONSTATIC_OOP]    - fac_contended.count[NONSTATIC_OOP];
 
     bool super_has_nonstatic_fields =
             (super_klass() != NULL && super_klass->has_nonstatic_fields());
@@ -3414,12 +3599,12 @@
     }
 
     if( allocation_style == 0 ) {
-      // Fields order: oops, longs/doubles, ints, shorts/chars, bytes
+      // Fields order: oops, longs/doubles, ints, shorts/chars, bytes, padded fields
       next_nonstatic_oop_offset    = next_nonstatic_field_offset;
       next_nonstatic_double_offset = next_nonstatic_oop_offset +
                                       (nonstatic_oop_count * heapOopSize);
     } else if( allocation_style == 1 ) {
-      // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
+      // Fields order: longs/doubles, ints, shorts/chars, bytes, oops, padded fields
       next_nonstatic_double_offset = next_nonstatic_field_offset;
     } else if( allocation_style == 2 ) {
       // Fields allocation: oops fields in super and sub classes are together.
@@ -3498,27 +3683,33 @@
                                   (nonstatic_word_count * BytesPerInt);
     next_nonstatic_byte_offset  = next_nonstatic_short_offset +
                                   (nonstatic_short_count * BytesPerShort);
-
-    int notaligned_offset;
-    if( allocation_style == 0 ) {
-      notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
-    } else { // allocation_style == 1
-      next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
+    next_nonstatic_padded_offset = next_nonstatic_byte_offset +
+                                  nonstatic_byte_count;
+
+    // let oops jump before padding with this allocation style
+    if( allocation_style == 1 ) {
+      next_nonstatic_oop_offset = next_nonstatic_padded_offset;
       if( nonstatic_oop_count > 0 ) {
         next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
       }
-      notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
+      next_nonstatic_padded_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
     }
-    next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
-    nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
-                                   - first_nonstatic_field_offset)/heapOopSize);
 
     // Iterate over fields again and compute correct offsets.
     // The field allocation type was temporarily stored in the offset slot.
     // oop fields are located before non-oop fields (static and non-static).
     for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+
+      // skip already laid out fields
+      if (fs.is_offset_set()) continue;
+
+      // contended fields are handled below
+      if (fs.is_contended()) continue;
+
       int real_offset;
-      FieldAllocationType atype = (FieldAllocationType) fs.offset();
+      FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
+
+      // pack the rest of the fields
       switch (atype) {
         case STATIC_OOP:
           real_offset = next_static_oop_offset;
@@ -3607,13 +3798,225 @@
       fs.set_offset(real_offset);
     }
 
+
+    // Handle the contended cases.
+    //
+    // Each contended field should not intersect the cache line with another contended field.
+    // In the absence of alignment information, we end up with pessimistically separating
+    // the fields with full-width padding.
+    //
+    // Additionally, this should not break alignment for the fields, so we round the alignment up
+    // for each field.
+    if (contended_count > 0) {
+
+      // if there is at least one contended field, we need to have pre-padding for them
+      if (nonstatic_contended_count > 0) {
+        next_nonstatic_padded_offset += pad_size;
+      }
+
+      // collect all contended groups
+      BitMap bm(cp->size());
+      for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+        // skip already laid out fields
+        if (fs.is_offset_set()) continue;
+
+        if (fs.is_contended()) {
+          bm.set_bit(fs.contended_group());
+        }
+      }
+
+      int current_group = -1;
+      while ((current_group = (int)bm.get_next_one_offset(current_group + 1)) != (int)bm.size()) {
+
+        for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+
+          // skip already laid out fields
+          if (fs.is_offset_set()) continue;
+
+          // skip non-contended fields and fields from different group
+          if (!fs.is_contended() || (fs.contended_group() != current_group)) continue;
+
+          // handle statics below
+          if (fs.access_flags().is_static()) continue;
+
+          int real_offset;
+          FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
+
+          switch (atype) {
+            case NONSTATIC_BYTE:
+              next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, 1);
+              real_offset = next_nonstatic_padded_offset;
+              next_nonstatic_padded_offset += 1;
+              break;
+
+            case NONSTATIC_SHORT:
+              next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, BytesPerShort);
+              real_offset = next_nonstatic_padded_offset;
+              next_nonstatic_padded_offset += BytesPerShort;
+              break;
+
+            case NONSTATIC_WORD:
+              next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, BytesPerInt);
+              real_offset = next_nonstatic_padded_offset;
+              next_nonstatic_padded_offset += BytesPerInt;
+              break;
+
+            case NONSTATIC_DOUBLE:
+              next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, BytesPerLong);
+              real_offset = next_nonstatic_padded_offset;
+              next_nonstatic_padded_offset += BytesPerLong;
+              break;
+
+            case NONSTATIC_OOP:
+              next_nonstatic_padded_offset = align_size_up(next_nonstatic_padded_offset, heapOopSize);
+              real_offset = next_nonstatic_padded_offset;
+              next_nonstatic_padded_offset += heapOopSize;
+
+              // Create new oop map
+              nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
+              nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
+              nonstatic_oop_map_count += 1;
+              if( first_nonstatic_oop_offset == 0 ) { // Undefined
+                first_nonstatic_oop_offset = real_offset;
+              }
+              break;
+
+            default:
+              ShouldNotReachHere();
+          }
+
+          if (fs.contended_group() == 0) {
+            // Contended group defines the equivalence class over the fields:
+            // the fields within the same contended group are not inter-padded.
+            // The only exception is default group, which does not incur the
+            // equivalence, and so requires intra-padding.
+            next_nonstatic_padded_offset += pad_size;
+          }
+
+          fs.set_offset(real_offset);
+        } // for
+
+        // Start laying out the next group.
+        // Note that this will effectively pad the last group in the back;
+        // this is expected to alleviate memory contention effects for
+        // subclass fields and/or adjacent object.
+        // If this was the default group, the padding is already in place.
+        if (current_group != 0) {
+          next_nonstatic_padded_offset += pad_size;
+        }
+      }
+
+      // handle static fields
+
+      // if there is at least one contended field, we need to have pre-padding for them
+      if (static_contended_count > 0) {
+        next_static_padded_offset += pad_size;
+      }
+
+      current_group = -1;
+      while ((current_group = (int)bm.get_next_one_offset(current_group + 1)) != (int)bm.size()) {
+
+        for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+
+          // skip already laid out fields
+          if (fs.is_offset_set()) continue;
+
+          // skip non-contended fields and fields from different group
+          if (!fs.is_contended() || (fs.contended_group() != current_group)) continue;
+
+          // non-statics already handled above
+          if (!fs.access_flags().is_static()) continue;
+
+          int real_offset;
+          FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
+
+          switch (atype) {
+
+            case STATIC_BYTE:
+              next_static_padded_offset = align_size_up(next_static_padded_offset, 1);
+              real_offset = next_static_padded_offset;
+              next_static_padded_offset += 1;
+              break;
+
+            case STATIC_SHORT:
+              next_static_padded_offset = align_size_up(next_static_padded_offset, BytesPerShort);
+              real_offset = next_static_padded_offset;
+              next_static_padded_offset += BytesPerShort;
+              break;
+
+            case STATIC_WORD:
+              next_static_padded_offset = align_size_up(next_static_padded_offset, BytesPerInt);
+              real_offset = next_static_padded_offset;
+              next_static_padded_offset += BytesPerInt;
+              break;
+
+            case STATIC_DOUBLE:
+              next_static_padded_offset = align_size_up(next_static_padded_offset, BytesPerLong);
+              real_offset = next_static_padded_offset;
+              next_static_padded_offset += BytesPerLong;
+              break;
+
+            case STATIC_OOP:
+              next_static_padded_offset = align_size_up(next_static_padded_offset, heapOopSize);
+              real_offset = next_static_padded_offset;
+              next_static_padded_offset += heapOopSize;
+              break;
+
+            default:
+              ShouldNotReachHere();
+          }
+
+          if (fs.contended_group() == 0) {
+            // Contended group defines the equivalence class over the fields:
+            // the fields within the same contended group are not inter-padded.
+            // The only exception is default group, which does not incur the
+            // equivalence, and so requires intra-padding.
+            next_static_padded_offset += pad_size;
+          }
+
+          fs.set_offset(real_offset);
+        } // for
+
+        // Start laying out the next group.
+        // Note that this will effectively pad the last group in the back;
+        // this is expected to alleviate memory contention effects for
+        // subclass fields and/or adjacent object.
+        // If this was the default group, the padding is already in place.
+        if (current_group != 0) {
+          next_static_padded_offset += pad_size;
+        }
+
+      }
+
+    } // handle contended
+
     // Size of instances
     int instance_size;
 
+    int notaligned_offset = next_nonstatic_padded_offset;
+
+    // Entire class is contended, pad in the back.
+    // This helps to alleviate memory contention effects for subclass fields
+    // and/or adjacent object.
+    if (parsed_annotations.is_contended()) {
+      notaligned_offset += pad_size;
+      next_static_padded_offset += pad_size;
+    }
+
+    int next_static_type_offset     = align_size_up(next_static_padded_offset, wordSize);
+    int static_field_size           = (next_static_type_offset -
+                                  InstanceMirrorKlass::offset_of_static_fields()) / wordSize;
+
+    next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
+    nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
+                                   - first_nonstatic_field_offset)/heapOopSize);
+
     next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
     instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
 
-    assert(instance_size == align_object_size(align_size_up((instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value");
+    assert(instance_size == align_object_size(align_size_up(
+                (instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize + ((parsed_annotations.is_contended()) ? pad_size : 0)),
+            wordSize) / wordSize), "consistent layout helper value");
 
     // Number of non-static oop map blocks allocated at end of klass.
     const unsigned int total_oop_map_count =
@@ -3687,11 +4090,13 @@
     if (is_anonymous())  // I am well known to myself
       cp->klass_at_put(this_class_index, this_klass()); // eagerly resolve
 
+    // Allocate an annotation type if needed.
     if (fields_annotations != NULL ||
         methods_annotations != NULL ||
         methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL) {
-      // Allocate an annotation type if needed.
+        methods_default_annotations != NULL ||
+        fields_type_annotations != NULL ||
+        methods_type_annotations != NULL) {
       Annotations* anno = Annotations::allocate(loader_data,
                             fields_annotations, methods_annotations,
                             methods_parameter_annotations,
@@ -3701,6 +4106,16 @@
       this_klass->set_annotations(NULL);
     }
 
+    if (fields_type_annotations != NULL ||
+        methods_type_annotations != NULL) {
+      assert(this_klass->annotations() != NULL, "annotations should have been allocated");
+      Annotations* anno = Annotations::allocate(loader_data,
+                                                fields_type_annotations,
+                                                methods_type_annotations,
+                                                NULL,
+                                                NULL, CHECK_(nullHandle));
+      this_klass->annotations()->set_type_annotations(anno);
+    }
 
     this_klass->set_minor_version(minor_version);
     this_klass->set_major_version(major_version);
@@ -3725,6 +4140,7 @@
     // Fill in field values obtained by parse_classfile_attributes
     if (parsed_annotations.has_any_annotations())
       parsed_annotations.apply_to(this_klass);
+
     // Create annotations
     if (_annotations != NULL && this_klass->annotations() == NULL) {
       Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
@@ -3732,6 +4148,19 @@
     }
     apply_parsed_class_attributes(this_klass);
 
+    // Create type annotations
+    if (_type_annotations != NULL) {
+      if (this_klass->annotations() == NULL) {
+        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
+        this_klass->set_annotations(anno);
+      }
+      if (this_klass->annotations()->type_annotations() == NULL) {
+        Annotations* anno = Annotations::allocate(loader_data, CHECK_NULL);
+        this_klass->annotations()->set_type_annotations(anno);
+      }
+      this_klass->annotations()->type_annotations()->set_class_annotations(_type_annotations);
+    }
+
     // Miranda methods
     if ((num_miranda_methods > 0) ||
         // if this class introduced new miranda methods or
@@ -3771,7 +4200,10 @@
 
     // check that if this class is an interface then it doesn't have static methods
     if (this_klass->is_interface()) {
-      check_illegal_static_method(this_klass, CHECK_(nullHandle));
+      /* An interface in a JAVA 8 classfile can be static */
+      if (_major_version < JAVA_8_VERSION) {
+        check_illegal_static_method(this_klass, CHECK_(nullHandle));
+      }
     }
 
 
@@ -3864,6 +4296,18 @@
     }
 #endif
 
+#ifndef PRODUCT
+    if (PrintFieldLayout) {
+      print_field_layout(name,
+            fields,
+            cp,
+            instance_size,
+            first_nonstatic_field_offset,
+            next_nonstatic_field_offset,
+            next_static_type_offset);
+    }
+#endif
+
     // preserve result across HandleMark
     preserve_this_klass = this_klass();
   }
@@ -3876,6 +4320,38 @@
   return this_klass;
 }
 
+void ClassFileParser::print_field_layout(Symbol* name,
+                                         Array<u2>* fields,
+                                         constantPoolHandle cp,
+                                         int instance_size,
+                                         int instance_fields_start,
+                                         int instance_fields_end,
+                                         int static_fields_end) {
+  tty->print("%s: field layout\n", name->as_klass_external_name());
+  tty->print("  @%3d %s\n", instance_fields_start, "--- instance fields start ---");
+  for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+    if (!fs.access_flags().is_static()) {
+      tty->print("  @%3d \"%s\" %s\n",
+          fs.offset(),
+          fs.name()->as_klass_external_name(),
+          fs.signature()->as_klass_external_name());
+    }
+  }
+  tty->print("  @%3d %s\n", instance_fields_end, "--- instance fields end ---");
+  tty->print("  @%3d %s\n", instance_size * wordSize, "--- instance ends ---");
+  tty->print("  @%3d %s\n", InstanceMirrorKlass::offset_of_static_fields(), "--- static fields start ---");
+  for (AllFieldStream fs(fields, cp); !fs.done(); fs.next()) {
+    if (fs.access_flags().is_static()) {
+      tty->print("  @%3d \"%s\" %s\n",
+          fs.offset(),
+          fs.name()->as_klass_external_name(),
+          fs.signature()->as_klass_external_name());
+    }
+  }
+  tty->print("  @%3d %s\n", static_fields_end, "--- static fields end ---");
+  tty->print("\n");
+}
+
 unsigned int
 ClassFileParser::compute_oop_map_count(instanceKlassHandle super,
                                        unsigned int nonstatic_oop_map_count,
@@ -4325,6 +4801,7 @@
   const bool is_bridge       = (flags & JVM_ACC_BRIDGE)       != 0;
   const bool is_strict       = (flags & JVM_ACC_STRICT)       != 0;
   const bool is_synchronized = (flags & JVM_ACC_SYNCHRONIZED) != 0;
+  const bool is_protected    = (flags & JVM_ACC_PROTECTED)    != 0;
   const bool major_gte_15    = _major_version >= JAVA_1_5_VERSION;
   const bool major_gte_8     = _major_version >= JAVA_8_VERSION;
   const bool is_initializer  = (name == vmSymbols::object_initializer_name());
@@ -4332,11 +4809,33 @@
   bool is_illegal = false;
 
   if (is_interface) {
-    if (!is_public || is_static || is_final || is_native ||
-        ((is_synchronized || is_strict) && major_gte_15 &&
-            (!major_gte_8 || is_abstract)) ||
-        (!major_gte_8 && !is_abstract)) {
-      is_illegal = true;
+    if (major_gte_8) {
+      // Class file version is JAVA_8_VERSION or later Methods of
+      // interfaces may set any of the flags except ACC_PROTECTED,
+      // ACC_FINAL, ACC_NATIVE, and ACC_SYNCHRONIZED; they must
+      // have exactly one of the ACC_PUBLIC or ACC_PRIVATE flags set.
+      if ((is_public == is_private) || /* Only one of private and public should be true - XNOR */
+          (is_native || is_protected || is_final || is_synchronized) ||
+          // If a specific method of a class or interface has its
+          // ACC_ABSTRACT flag set, it must not have any of its
+          // ACC_FINAL, ACC_NATIVE, ACC_PRIVATE, ACC_STATIC,
+          // ACC_STRICT, or ACC_SYNCHRONIZED flags set.  No need to
+          // check for ACC_FINAL, ACC_NATIVE or ACC_SYNCHRONIZED as
+          // those flags are illegal irrespective of ACC_ABSTRACT being set or not.
+          (is_abstract && (is_private || is_static || is_strict))) {
+        is_illegal = true;
+      }
+    } else if (major_gte_15) {
+      // Class file version in the interval [JAVA_1_5_VERSION, JAVA_8_VERSION)
+      if (!is_public || is_static || is_final || is_synchronized ||
+          is_native || !is_abstract || is_strict) {
+        is_illegal = true;
+      }
+    } else {
+      // Class file version is pre-JAVA_1_5_VERSION
+      if (!is_public || is_static || is_final || is_native || !is_abstract) {
+        is_illegal = true;
+      }
     }
   } else { // not interface
     if (is_initializer) {
--- a/src/share/vm/classfile/classFileParser.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classFileParser.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -64,6 +64,7 @@
   int        _sde_length;
   Array<u2>* _inner_classes;
   AnnotationArray* _annotations;
+  AnnotationArray* _type_annotations;
 
   void set_class_synthetic_flag(bool x)           { _synthetic_flag = x; }
   void set_class_sourcefile(Symbol* x)            { _sourcefile = x; }
@@ -71,12 +72,14 @@
   void set_class_sde_buffer(char* x, int len)     { _sde_buffer = x; _sde_length = len; }
   void set_class_inner_classes(Array<u2>* x)      { _inner_classes = x; }
   void set_class_annotations(AnnotationArray* x)  { _annotations = x; }
+  void set_class_type_annotations(AnnotationArray* x)  { _type_annotations = x; }
   void init_parsed_class_attributes() {
     _synthetic_flag = false;
     _sourcefile = NULL;
     _generic_signature = NULL;
     _sde_buffer = NULL;
     _sde_length = 0;
+    _annotations = _type_annotations = NULL;
     // initialize the other flags too:
     _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false;
     _max_bootstrap_specifier_index = -1;
@@ -92,17 +95,20 @@
       _method_DontInline,
       _method_LambdaForm_Compiled,
       _method_LambdaForm_Hidden,
+      _sun_misc_Contended,
       _annotation_LIMIT
     };
     const Location _location;
     int _annotations_present;
+    u2 _contended_group;
+
     AnnotationCollector(Location location)
     : _location(location), _annotations_present(0)
     {
       assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, "");
     }
     // If this annotation name has an ID, report it (or _none).
-    ID annotation_index(Symbol* name);
+    ID annotation_index(ClassLoaderData* loader_data, Symbol* name);
     // Set the annotation name:
     void set_annotation(ID id) {
       assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
@@ -111,6 +117,12 @@
     // Report if the annotation is present.
     bool has_any_annotations() { return _annotations_present != 0; }
     bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; }
+
+    void set_contended_group(u2 group) { _contended_group = group; }
+    u2 contended_group() { return _contended_group; }
+
+    void set_contended(bool contended) { set_annotation(_sun_misc_Contended); }
+    bool is_contended() { return has_annotation(_sun_misc_Contended); }
   };
   class FieldAnnotationCollector: public AnnotationCollector {
   public:
@@ -163,6 +175,7 @@
                               bool* is_synthetic_addr,
                               u2* generic_signature_index_addr,
                               AnnotationArray** field_annotations,
+                              AnnotationArray** field_type_annotations,
                               FieldAnnotationCollector* parsed_annotations,
                               TRAPS);
   Array<u2>* parse_fields(ClassLoaderData* loader_data,
@@ -170,8 +183,17 @@
                           constantPoolHandle cp, bool is_interface,
                           FieldAllocationCount *fac,
                           Array<AnnotationArray*>** fields_annotations,
+                          Array<AnnotationArray*>** fields_type_annotations,
                           u2* java_fields_count_ptr, TRAPS);
 
+  void print_field_layout(Symbol* name,
+                          Array<u2>* fields,
+                          constantPoolHandle cp,
+                          int instance_size,
+                          int instance_fields_start,
+                          int instance_fields_end,
+                          int static_fields_end);
+
   // Method parsing
   methodHandle parse_method(ClassLoaderData* loader_data,
                             constantPoolHandle cp,
@@ -180,6 +202,7 @@
                             AnnotationArray** method_annotations,
                             AnnotationArray** method_parameter_annotations,
                             AnnotationArray** method_default_annotations,
+                            AnnotationArray** method_type_annotations,
                             TRAPS);
   Array<Method*>* parse_methods(ClassLoaderData* loader_data,
                                 constantPoolHandle cp,
@@ -189,6 +212,7 @@
                                 Array<AnnotationArray*>** methods_annotations,
                                 Array<AnnotationArray*>** methods_parameter_annotations,
                                 Array<AnnotationArray*>** methods_default_annotations,
+                                Array<AnnotationArray*>** methods_type_annotations,
                                 bool* has_default_method,
                                 TRAPS);
   Array<int>* sort_methods(ClassLoaderData* loader_data,
@@ -196,6 +220,7 @@
                            Array<AnnotationArray*>* methods_annotations,
                            Array<AnnotationArray*>* methods_parameter_annotations,
                            Array<AnnotationArray*>* methods_default_annotations,
+                           Array<AnnotationArray*>* methods_type_annotations,
                                 TRAPS);
   u2* parse_exception_table(ClassLoaderData* loader_data,
                             u4 code_length, u4 exception_table_length,
@@ -239,7 +264,8 @@
                                         int runtime_invisible_annotations_length, TRAPS);
   int skip_annotation(u1* buffer, int limit, int index);
   int skip_annotation_value(u1* buffer, int limit, int index);
-  void parse_annotations(u1* buffer, int limit, constantPoolHandle cp,
+  void parse_annotations(ClassLoaderData* loader_data,
+                         u1* buffer, int limit, constantPoolHandle cp,
                          /* Results (currently, only one result is supported): */
                          AnnotationCollector* result,
                          TRAPS);
--- a/src/share/vm/classfile/classFileStream.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classFileStream.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -93,3 +93,10 @@
   }
   _current += length * 2;
 }
+
+void ClassFileStream::skip_u4(int length, TRAPS) {
+  if (_need_verify) {
+    guarantee_more(length * 4, CHECK);
+  }
+  _current += length * 4;
+}
--- a/src/share/vm/classfile/classFileStream.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classFileStream.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -133,6 +133,11 @@
     _current += 2 * length;
   }
 
+  void skip_u4(int length, TRAPS);
+  void skip_u4_fast(int length) {
+    _current += 4 * length;
+  }
+
   // Tells whether eos is reached
   bool at_eos() const          { return _current == _buffer_end; }
 };
--- a/src/share/vm/classfile/classLoaderData.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classLoaderData.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -64,8 +64,10 @@
 
 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
 
-ClassLoaderData::ClassLoaderData(Handle h_class_loader) : _class_loader(h_class_loader()),
-  _metaspace(NULL), _unloading(false), _keep_alive(false), _klasses(NULL),
+ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous) :
+  _class_loader(h_class_loader()),
+  _is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially
+  _metaspace(NULL), _unloading(false), _klasses(NULL),
   _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
   _next(NULL), _dependencies(NULL),
   _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) {
@@ -167,16 +169,18 @@
     ok = (objArrayOop)ok->obj_at(1);
   }
 
+  // Must handle over GC points
+  assert (last != NULL, "dependencies should be initialized");
+  objArrayHandle last_handle(THREAD, last);
+
   // Create a new dependency node with fields for (class_loader or mirror, next)
   objArrayOop deps = oopFactory::new_objectArray(2, CHECK);
   deps->obj_at_put(0, dependency());
 
-  // Must handle over more GC points
+  // Must handle over GC points
   objArrayHandle new_dependency(THREAD, deps);
 
   // Add the dependency under lock
-  assert (last != NULL, "dependencies should be initialized");
-  objArrayHandle last_handle(THREAD, last);
   locked_add_dependency(last_handle, new_dependency);
 }
 
@@ -257,13 +261,6 @@
   ShouldNotReachHere();   // should have found this class!!
 }
 
-
-bool ClassLoaderData::is_anonymous() const {
-  Klass* k = _klasses;
-  return (_keep_alive || (k != NULL && k->oop_is_instance() &&
-          InstanceKlass::cast(k)->is_anonymous()));
-}
-
 void ClassLoaderData::unload() {
   _unloading = true;
 
@@ -321,6 +318,7 @@
 }
 
 Metaspace* ClassLoaderData::metaspace_non_null() {
+  assert(!DumpSharedSpaces, "wrong metaspace!");
   // If the metaspace has not been allocated, create a new one.  Might want
   // to create smaller arena for Reflection class loaders also.
   // The reason for the delayed allocation is because some class loaders are
@@ -333,10 +331,19 @@
     }
     if (this == the_null_class_loader_data()) {
       assert (class_loader() == NULL, "Must be");
-      size_t word_size = Metaspace::first_chunk_word_size();
-      set_metaspace(new Metaspace(_metaspace_lock, word_size));
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::BootMetaspaceType));
+    } else if (is_anonymous()) {
+      if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
+        tty->print_cr("is_anonymous: %s", class_loader()->klass()->internal_name());
+      }
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::AnonymousMetaspaceType));
+    } else if (class_loader()->is_a(SystemDictionary::reflect_DelegatingClassLoader_klass())) {
+      if (TraceClassLoaderData && Verbose && class_loader() != NULL) {
+        tty->print_cr("is_reflection: %s", class_loader()->klass()->internal_name());
+      }
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::ReflectionMetaspaceType));
     } else {
-      set_metaspace(new Metaspace(_metaspace_lock));  // default size for now.
+      set_metaspace(new Metaspace(_metaspace_lock, Metaspace::StandardMetaspaceType));
     }
   }
   return _metaspace;
@@ -396,8 +403,7 @@
 // These anonymous class loaders are to contain classes used for JSR292
 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   // Add a new class loader data to the graph.
-  ClassLoaderData* cld = ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL);
-  return cld;
+  return ClassLoaderDataGraph::add(NULL, loader, CHECK_NULL);
 }
 
 const char* ClassLoaderData::loader_name() {
@@ -475,7 +481,9 @@
   // Create one.
   ClassLoaderData* *list_head = &_head;
   ClassLoaderData* next = _head;
-  ClassLoaderData* cld = new ClassLoaderData(loader);
+
+  bool is_anonymous = (cld_addr == NULL);
+  ClassLoaderData* cld = new ClassLoaderData(loader, is_anonymous);
 
   if (cld_addr != NULL) {
     // First, Atomically set it
@@ -485,10 +493,6 @@
       // Returns the data.
       return old;
     }
-  } else {
-    // Disallow unloading for this CLD during initialization if there is no
-    // class_loader oop to link this to.
-    cld->set_keep_alive(true);
   }
 
   // We won the race, and therefore the task of adding the data to the list of
@@ -678,8 +682,8 @@
          "only supported for null loader data for now");
   assert (!_shared_metaspaces_initialized, "only initialize once");
   MutexLockerEx ml(metaspace_lock(),  Mutex::_no_safepoint_check_flag);
-  _ro_metaspace = new Metaspace(_metaspace_lock, SharedReadOnlySize/wordSize);
-  _rw_metaspace = new Metaspace(_metaspace_lock, SharedReadWriteSize/wordSize);
+  _ro_metaspace = new Metaspace(_metaspace_lock, Metaspace::ROMetaspaceType);
+  _rw_metaspace = new Metaspace(_metaspace_lock, Metaspace::ReadWriteMetaspaceType);
   _shared_metaspaces_initialized = true;
 }
 
--- a/src/share/vm/classfile/classLoaderData.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/classLoaderData.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -8,7 +8,7 @@
  *
  * 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
+ * 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).
  *
@@ -109,6 +109,7 @@
   Mutex* _metaspace_lock;  // Locks the metaspace for allocations and setup.
   bool _unloading;         // true if this class loader goes away
   bool _keep_alive;        // if this CLD can be unloaded for anonymous loaders
+  bool _is_anonymous;      // if this CLD is for an anonymous class
   volatile int _claimed;   // true if claimed, for example during GC traces.
                            // To avoid applying oop closure more than once.
                            // Has to be an int because we cas it.
@@ -139,7 +140,7 @@
   void set_next(ClassLoaderData* next) { _next = next; }
   ClassLoaderData* next() const        { return _next; }
 
-  ClassLoaderData(Handle h_class_loader);
+  ClassLoaderData(Handle h_class_loader, bool is_anonymous);
   ~ClassLoaderData();
 
   void set_metaspace(Metaspace* m) { _metaspace = m; }
@@ -174,12 +175,12 @@
     return _the_null_class_loader_data;
   }
 
-  bool is_anonymous() const;
+  bool is_anonymous() const { return _is_anonymous; }
 
   static void init_null_class_loader_data() {
     assert(_the_null_class_loader_data == NULL, "cannot initialize twice");
     assert(ClassLoaderDataGraph::_head == NULL, "cannot initialize twice");
-    _the_null_class_loader_data = new ClassLoaderData((oop)NULL);
+    _the_null_class_loader_data = new ClassLoaderData((oop)NULL, false);
     ClassLoaderDataGraph::_head = _the_null_class_loader_data;
     assert(_the_null_class_loader_data->is_the_null_class_loader_data(), "Must be");
     if (DumpSharedSpaces) {
--- a/src/share/vm/classfile/defaultMethods.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/defaultMethods.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1148,7 +1148,8 @@
   int code_length = bytecodes->length();
 
   Method* m = Method::allocate(cp->pool_holder()->class_loader_data(),
-      code_length, flags, 0, 0, 0, 0, 0, mt, CHECK_NULL);
+                               code_length, flags, 0, 0, 0, 0, 0, 0,
+                               mt, CHECK_NULL);
 
   m->set_constants(NULL); // This will get filled in later
   m->set_name_index(cp->utf8(name));
@@ -1284,13 +1285,15 @@
 
   enum { ANNOTATIONS, PARAMETERS, DEFAULTS, NUM_ARRAYS };
 
-  Array<AnnotationArray*>* original_annots[NUM_ARRAYS];
+  Array<AnnotationArray*>* original_annots[NUM_ARRAYS] = { NULL };
 
   Array<Method*>* original_methods = klass->methods();
   Annotations* annots = klass->annotations();
-  original_annots[ANNOTATIONS] = annots->methods_annotations();
-  original_annots[PARAMETERS]  = annots->methods_parameter_annotations();
-  original_annots[DEFAULTS]    = annots->methods_default_annotations();
+  if (annots != NULL) {
+    original_annots[ANNOTATIONS] = annots->methods_annotations();
+    original_annots[PARAMETERS]  = annots->methods_parameter_annotations();
+    original_annots[DEFAULTS]    = annots->methods_default_annotations();
+  }
 
   Array<int>* original_ordering = klass->method_ordering();
   Array<int>* merged_ordering = Universe::the_empty_int_array();
@@ -1369,9 +1372,15 @@
 
   // Replace klass methods with new merged lists
   klass->set_methods(merged_methods);
-  annots->set_methods_annotations(merged_annots[ANNOTATIONS]);
-  annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]);
-  annots->set_methods_default_annotations(merged_annots[DEFAULTS]);
+  if (annots != NULL) {
+    annots->set_methods_annotations(merged_annots[ANNOTATIONS]);
+    annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]);
+    annots->set_methods_default_annotations(merged_annots[DEFAULTS]);
+  } else {
+    assert(merged_annots[ANNOTATIONS] == NULL, "Must be");
+    assert(merged_annots[PARAMETERS] == NULL, "Must be");
+    assert(merged_annots[DEFAULTS] == NULL, "Must be");
+  }
 
   ClassLoaderData* cld = klass->class_loader_data();
   MetadataFactory::free_array(cld, original_methods);
--- a/src/share/vm/classfile/javaClasses.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/javaClasses.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -327,14 +327,14 @@
   return result;
 }
 
-unsigned int java_lang_String::to_hash(oop java_string) {
+unsigned int java_lang_String::hash_code(oop java_string) {
   int          length = java_lang_String::length(java_string);
-  // Zero length string will hash to zero with String.toHash() function.
+  // Zero length string will hash to zero with String.hashCode() function.
   if (length == 0) return 0;
 
   typeArrayOop value  = java_lang_String::value(java_string);
   int          offset = java_lang_String::offset(java_string);
-  return java_lang_String::to_hash(value->char_at_addr(offset), length);
+  return java_lang_String::hash_code(value->char_at_addr(offset), length);
 }
 
 char* java_lang_String::as_quoted_ascii(oop java_string) {
@@ -693,19 +693,6 @@
 }
 
 
-Method* java_lang_Class::resolved_constructor(oop java_class) {
-  Metadata* constructor = java_class->metadata_field(_resolved_constructor_offset);
-  assert(constructor == NULL || constructor->is_method(), "should be method");
-  return ((Method*)constructor);
-}
-
-
-void java_lang_Class::set_resolved_constructor(oop java_class, Method* constructor) {
-  assert(constructor->is_method(), "should be method");
-  java_class->metadata_field_put(_resolved_constructor_offset, constructor);
-}
-
-
 bool java_lang_Class::is_primitive(oop java_class) {
   // should assert:
   //assert(java_lang_Class::is_instance(java_class), "must be a Class object");
@@ -930,7 +917,6 @@
 // Write the thread status value to threadStatus field in java.lang.Thread java class.
 void java_lang_Thread::set_thread_status(oop java_thread,
                                          java_lang_Thread::ThreadStatus status) {
-  assert(JavaThread::current()->thread_state() == _thread_in_vm, "Java Thread is not running in vm");
   // The threadStatus is only present starting in 1.5
   if (_thread_status_offset > 0) {
     java_thread->int_field_put(_thread_status_offset, status);
@@ -1164,179 +1150,43 @@
   }
 }
 
-// Print stack trace element to resource allocated buffer
-char* java_lang_Throwable::print_stack_element_to_buffer(Method* method, int bci) {
-  // Get strings and string lengths
-  InstanceKlass* klass = method->method_holder();
-  const char* klass_name  = klass->external_name();
-  int buf_len = (int)strlen(klass_name);
-  char* source_file_name;
-  if (klass->source_file_name() == NULL) {
-    source_file_name = NULL;
+// After this many redefines, the stack trace is unreliable.
+const int MAX_VERSION = USHRT_MAX;
+
+// Helper backtrace functions to store bci|version together.
+static inline int merge_bci_and_version(int bci, int version) {
+  // only store u2 for version, checking for overflow.
+  if (version > USHRT_MAX || version < 0) version = MAX_VERSION;
+  assert((jushort)bci == bci, "bci should be short");
+  return build_int_from_shorts(version, bci);
+}
+
+static inline int bci_at(unsigned int merged) {
+  return extract_high_short_from_int(merged);
+}
+static inline int version_at(unsigned int merged) {
+  return extract_low_short_from_int(merged);
+}
+
+static inline bool version_matches(Method* method, int version) {
+  return (method->constants()->version() == version && version < MAX_VERSION);
+}
+
+static inline int get_line_number(Method* method, int bci) {
+  int line_number = 0;
+  if (method->is_native()) {
+    // Negative value different from -1 below, enabling Java code in
+    // class java.lang.StackTraceElement to distinguish "native" from
+    // "no LineNumberTable".  JDK tests for -2.
+    line_number = -2;
   } else {
-    source_file_name = klass->source_file_name()->as_C_string();
-    buf_len += (int)strlen(source_file_name);
-  }
-  char* method_name = method->name()->as_C_string();
-  buf_len += (int)strlen(method_name);
-
-  // Allocate temporary buffer with extra space for formatting and line number
-  char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64);
-
-  // Print stack trace line in buffer
-  sprintf(buf, "\tat %s.%s", klass_name, method_name);
-  if (method->is_native()) {
-    strcat(buf, "(Native Method)");
-  } else {
-    int line_number = method->line_number_from_bci(bci);
-    if (source_file_name != NULL && (line_number != -1)) {
-      // Sourcename and linenumber
-      sprintf(buf + (int)strlen(buf), "(%s:%d)", source_file_name, line_number);
-    } else if (source_file_name != NULL) {
-      // Just sourcename
-      sprintf(buf + (int)strlen(buf), "(%s)", source_file_name);
-    } else {
-      // Neither soucename and linenumber
-      sprintf(buf + (int)strlen(buf), "(Unknown Source)");
-    }
-    nmethod* nm = method->code();
-    if (WizardMode && nm != NULL) {
-      sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm);
+    // Returns -1 if no LineNumberTable, and otherwise actual line number
+    line_number = method->line_number_from_bci(bci);
+    if (line_number == -1 && ShowHiddenFrames) {
+      line_number = bci + 1000000;
     }
   }
-
-  return buf;
-}
-
-
-void java_lang_Throwable::print_stack_element(Handle stream, Method* method, int bci) {
-  ResourceMark rm;
-  char* buf = print_stack_element_to_buffer(method, bci);
-  print_to_stream(stream, buf);
-}
-
-void java_lang_Throwable::print_stack_element(outputStream *st, Method* method, int bci) {
-  ResourceMark rm;
-  char* buf = print_stack_element_to_buffer(method, bci);
-  st->print_cr("%s", buf);
-}
-
-void java_lang_Throwable::print_to_stream(Handle stream, const char* str) {
-  if (stream.is_null()) {
-    tty->print_cr("%s", str);
-  } else {
-    EXCEPTION_MARK;
-    JavaValue result(T_VOID);
-    Handle arg (THREAD, oopFactory::new_charArray(str, THREAD));
-    if (!HAS_PENDING_EXCEPTION) {
-      JavaCalls::call_virtual(&result,
-                              stream,
-                              KlassHandle(THREAD, stream->klass()),
-                              vmSymbols::println_name(),
-                              vmSymbols::char_array_void_signature(),
-                              arg,
-                              THREAD);
-    }
-    // Ignore any exceptions. we are in the middle of exception handling. Same as classic VM.
-    if (HAS_PENDING_EXCEPTION) CLEAR_PENDING_EXCEPTION;
-  }
-
-}
-
-
-const char* java_lang_Throwable::no_stack_trace_message() {
-  return "\t<<no stack trace available>>";
-}
-
-
-// Currently used only for exceptions occurring during startup
-void java_lang_Throwable::print_stack_trace(oop throwable, outputStream* st) {
-  Thread *THREAD = Thread::current();
-  Handle h_throwable(THREAD, throwable);
-  while (h_throwable.not_null()) {
-    objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable())));
-    if (result.is_null()) {
-      st->print_cr(no_stack_trace_message());
-      return;
-    }
-
-    while (result.not_null()) {
-      typeArrayHandle methods (THREAD,
-                               typeArrayOop(result->obj_at(trace_methods_offset)));
-      typeArrayHandle bcis (THREAD,
-                            typeArrayOop(result->obj_at(trace_bcis_offset)));
-
-      if (methods.is_null() || bcis.is_null()) {
-        st->print_cr(no_stack_trace_message());
-        return;
-      }
-
-      int length = methods()->length();
-      for (int index = 0; index < length; index++) {
-        Method* method = ((Method*)methods()->metadata_at(index));
-        if (method == NULL) goto handle_cause;
-        int bci = bcis->ushort_at(index);
-        print_stack_element(st, method, bci);
-      }
-      result = objArrayHandle(THREAD, objArrayOop(result->obj_at(trace_next_offset)));
-    }
-  handle_cause:
-    {
-      EXCEPTION_MARK;
-      JavaValue result(T_OBJECT);
-      JavaCalls::call_virtual(&result,
-                              h_throwable,
-                              KlassHandle(THREAD, h_throwable->klass()),
-                              vmSymbols::getCause_name(),
-                              vmSymbols::void_throwable_signature(),
-                              THREAD);
-      // Ignore any exceptions. we are in the middle of exception handling. Same as classic VM.
-      if (HAS_PENDING_EXCEPTION) {
-        CLEAR_PENDING_EXCEPTION;
-        h_throwable = Handle();
-      } else {
-        h_throwable = Handle(THREAD, (oop) result.get_jobject());
-        if (h_throwable.not_null()) {
-          st->print("Caused by: ");
-          print(h_throwable, st);
-          st->cr();
-        }
-      }
-    }
-  }
-}
-
-
-void java_lang_Throwable::print_stack_trace(oop throwable, oop print_stream) {
-  // Note: this is no longer used in Merlin, but we support it for compatibility.
-  Thread *thread = Thread::current();
-  Handle stream(thread, print_stream);
-  objArrayHandle result (thread, objArrayOop(backtrace(throwable)));
-  if (result.is_null()) {
-    print_to_stream(stream, no_stack_trace_message());
-    return;
-  }
-
-  while (result.not_null()) {
-    typeArrayHandle methods(thread,
-                            typeArrayOop(result->obj_at(trace_methods_offset)));
-    typeArrayHandle bcis (thread,
-                          typeArrayOop(result->obj_at(trace_bcis_offset)));
-
-    if (methods.is_null() || bcis.is_null()) {
-      print_to_stream(stream, no_stack_trace_message());
-      return;
-    }
-
-    int length = methods()->length();
-    for (int index = 0; index < length; index++) {
-      Method* method = ((Method*)methods()->metadata_at(index));
-      if (method == NULL) return;
-      int bci = bcis->ushort_at(index);
-      print_stack_element(stream, method, bci);
-    }
-    result = objArrayHandle(thread, objArrayOop(result->obj_at(trace_next_offset)));
-  }
+  return line_number;
 }
 
 // This class provides a simple wrapper over the internal structure of
@@ -1356,13 +1206,30 @@
 
   enum {
     trace_methods_offset = java_lang_Throwable::trace_methods_offset,
-    trace_bcis_offset    = java_lang_Throwable::trace_bcis_offset,
+    trace_bcis_offset = java_lang_Throwable::trace_bcis_offset,
     trace_mirrors_offset = java_lang_Throwable::trace_mirrors_offset,
     trace_next_offset    = java_lang_Throwable::trace_next_offset,
     trace_size           = java_lang_Throwable::trace_size,
     trace_chunk_size     = java_lang_Throwable::trace_chunk_size
   };
 
+  // get info out of chunks
+  static typeArrayOop get_methods(objArrayHandle chunk) {
+    typeArrayOop methods = typeArrayOop(chunk->obj_at(trace_methods_offset));
+    assert(methods != NULL, "method array should be initialized in backtrace");
+    return methods;
+  }
+  static typeArrayOop get_bcis(objArrayHandle chunk) {
+    typeArrayOop bcis = typeArrayOop(chunk->obj_at(trace_bcis_offset));
+    assert(bcis != NULL, "bci array should be initialized in backtrace");
+    return bcis;
+  }
+  static objArrayOop get_mirrors(objArrayHandle chunk) {
+    objArrayOop mirrors = objArrayOop(chunk->obj_at(trace_mirrors_offset));
+    assert(mirrors != NULL, "mirror array should be initialized in backtrace");
+    return mirrors;
+  }
+
   // constructor for new backtrace
   BacktraceBuilder(TRAPS): _methods(NULL), _bcis(NULL), _head(NULL), _mirrors(NULL) {
     expand(CHECK);
@@ -1370,6 +1237,19 @@
     _index = 0;
   }
 
+  BacktraceBuilder(objArrayHandle backtrace) {
+    _methods = get_methods(backtrace);
+    _bcis = get_bcis(backtrace);
+    _mirrors = get_mirrors(backtrace);
+    assert(_methods->length() == _bcis->length() &&
+           _methods->length() == _mirrors->length(),
+           "method and source information arrays should match");
+
+    // head is the preallocated backtrace
+    _backtrace = _head = backtrace();
+    _index = 0;
+  }
+
   void expand(TRAPS) {
     objArrayHandle old_head(THREAD, _head);
     Pause_No_Safepoint_Verifier pnsv(&_nsv);
@@ -1377,10 +1257,10 @@
     objArrayOop head = oopFactory::new_objectArray(trace_size, CHECK);
     objArrayHandle new_head(THREAD, head);
 
-    typeArrayOop methods = oopFactory::new_metaDataArray(trace_chunk_size, CHECK);
+    typeArrayOop methods = oopFactory::new_shortArray(trace_chunk_size, CHECK);
     typeArrayHandle new_methods(THREAD, methods);
 
-    typeArrayOop bcis = oopFactory::new_shortArray(trace_chunk_size, CHECK);
+    typeArrayOop bcis = oopFactory::new_intArray(trace_chunk_size, CHECK);
     typeArrayHandle new_bcis(THREAD, bcis);
 
     objArrayOop mirrors = oopFactory::new_objectArray(trace_chunk_size, CHECK);
@@ -1395,7 +1275,7 @@
 
     _head    = new_head();
     _methods = new_methods();
-    _bcis    = new_bcis();
+    _bcis = new_bcis();
     _mirrors = new_mirrors();
     _index = 0;
   }
@@ -1409,7 +1289,6 @@
     // shorts.  The later line number lookup would just smear the -1
     // to a 0 even if it could be recorded.
     if (bci == SynchronizationEntryBCI) bci = 0;
-    assert(bci == (jushort)bci, "doesn't fit");
 
     if (_index >= trace_chunk_size) {
       methodHandle mhandle(THREAD, method);
@@ -1417,26 +1296,148 @@
       method = mhandle();
     }
 
-    _methods->metadata_at_put(_index, method);
-    _bcis->ushort_at_put(_index, bci);
-    // we need to save the mirrors in the backtrace to keep the methods from
-    // being unloaded if their class loader is unloaded while we still have
-    // this stack trace.
+    _methods->short_at_put(_index, method->method_idnum());
+    _bcis->int_at_put(_index, merge_bci_and_version(bci, method->constants()->version()));
+
+    // We need to save the mirrors in the backtrace to keep the class
+    // from being unloaded while we still have this stack trace.
+    assert(method->method_holder()->java_mirror() != NULL, "never push null for mirror");
     _mirrors->obj_at_put(_index, method->method_holder()->java_mirror());
     _index++;
   }
 
-  Method* current_method() {
-    assert(_index >= 0 && _index < trace_chunk_size, "out of range");
-    return ((Method*)_methods->metadata_at(_index));
+};
+
+// Print stack trace element to resource allocated buffer
+char* java_lang_Throwable::print_stack_element_to_buffer(Handle mirror,
+                                  int method_id, int version, int bci) {
+
+  // Get strings and string lengths
+  InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror()));
+  const char* klass_name  = holder->external_name();
+  int buf_len = (int)strlen(klass_name);
+
+  // pushing to the stack trace added one.
+  Method* method = holder->method_with_idnum(method_id);
+  char* method_name = method->name()->as_C_string();
+  buf_len += (int)strlen(method_name);
+
+  char* source_file_name = NULL;
+  if (version_matches(method, version)) {
+    Symbol* source = holder->source_file_name();
+    if (source != NULL) {
+      source_file_name = source->as_C_string();
+      buf_len += (int)strlen(source_file_name);
+    }
+  }
+
+  // Allocate temporary buffer with extra space for formatting and line number
+  char* buf = NEW_RESOURCE_ARRAY(char, buf_len + 64);
+
+  // Print stack trace line in buffer
+  sprintf(buf, "\tat %s.%s", klass_name, method_name);
+
+  if (!version_matches(method, version)) {
+    strcat(buf, "(Redefined)");
+  } else {
+    int line_number = get_line_number(method, bci);
+    if (line_number == -2) {
+      strcat(buf, "(Native Method)");
+    } else {
+      if (source_file_name != NULL && (line_number != -1)) {
+        // Sourcename and linenumber
+        sprintf(buf + (int)strlen(buf), "(%s:%d)", source_file_name, line_number);
+      } else if (source_file_name != NULL) {
+        // Just sourcename
+        sprintf(buf + (int)strlen(buf), "(%s)", source_file_name);
+      } else {
+        // Neither sourcename nor linenumber
+        sprintf(buf + (int)strlen(buf), "(Unknown Source)");
+      }
+      nmethod* nm = method->code();
+      if (WizardMode && nm != NULL) {
+        sprintf(buf + (int)strlen(buf), "(nmethod " INTPTR_FORMAT ")", (intptr_t)nm);
+      }
+    }
   }
 
-  jushort current_bci() {
-    assert(_index >= 0 && _index < trace_chunk_size, "out of range");
-    return _bcis->ushort_at(_index);
+  return buf;
+}
+
+void java_lang_Throwable::print_stack_element(outputStream *st, Handle mirror,
+                                              int method_id, int version, int bci) {
+  ResourceMark rm;
+  char* buf = print_stack_element_to_buffer(mirror, method_id, version, bci);
+  st->print_cr("%s", buf);
+}
+
+void java_lang_Throwable::print_stack_element(outputStream *st, methodHandle method, int bci) {
+  Handle mirror = method->method_holder()->java_mirror();
+  int method_id = method->method_idnum();
+  int version = method->constants()->version();
+  print_stack_element(st, mirror, method_id, version, bci);
+}
+
+const char* java_lang_Throwable::no_stack_trace_message() {
+  return "\t<<no stack trace available>>";
+}
+
+
+// Currently used only for exceptions occurring during startup
+void java_lang_Throwable::print_stack_trace(oop throwable, outputStream* st) {
+  Thread *THREAD = Thread::current();
+  Handle h_throwable(THREAD, throwable);
+  while (h_throwable.not_null()) {
+    objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable())));
+    if (result.is_null()) {
+      st->print_cr(no_stack_trace_message());
+      return;
+    }
+
+    while (result.not_null()) {
+
+      // Get method id, bci, version and mirror from chunk
+      typeArrayHandle methods (THREAD, BacktraceBuilder::get_methods(result));
+      typeArrayHandle bcis (THREAD, BacktraceBuilder::get_bcis(result));
+      objArrayHandle mirrors (THREAD, BacktraceBuilder::get_mirrors(result));
+
+      int length = methods()->length();
+      for (int index = 0; index < length; index++) {
+        Handle mirror(THREAD, mirrors->obj_at(index));
+        // NULL mirror means end of stack trace
+        if (mirror.is_null()) goto handle_cause;
+        int method = methods->short_at(index);
+        int version = version_at(bcis->int_at(index));
+        int bci = bci_at(bcis->int_at(index));
+        print_stack_element(st, mirror, method, version, bci);
+      }
+      result = objArrayHandle(THREAD, objArrayOop(result->obj_at(trace_next_offset)));
+    }
+  handle_cause:
+    {
+      EXCEPTION_MARK;
+      JavaValue cause(T_OBJECT);
+      JavaCalls::call_virtual(&cause,
+                              h_throwable,
+                              KlassHandle(THREAD, h_throwable->klass()),
+                              vmSymbols::getCause_name(),
+                              vmSymbols::void_throwable_signature(),
+                              THREAD);
+      // Ignore any exceptions. we are in the middle of exception handling. Same as classic VM.
+      if (HAS_PENDING_EXCEPTION) {
+        CLEAR_PENDING_EXCEPTION;
+        h_throwable = Handle();
+      } else {
+        h_throwable = Handle(THREAD, (oop) cause.get_jobject());
+        if (h_throwable.not_null()) {
+          st->print("Caused by: ");
+          print(h_throwable, st);
+          st->cr();
+        }
+      }
+    }
   }
-};
-
+}
 
 void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS) {
   if (!StackTraceInThrowable) return;
@@ -1597,21 +1598,8 @@
 
   // No-op if stack trace is disabled
   if (!StackTraceInThrowable) return;
-
-  objArrayOop h_oop = oopFactory::new_objectArray(trace_size, CHECK);
-  objArrayHandle backtrace  (THREAD, h_oop);
-  typeArrayOop m_oop = oopFactory::new_metaDataArray(trace_chunk_size, CHECK);
-  typeArrayHandle methods (THREAD, m_oop);
-  typeArrayOop b = oopFactory::new_shortArray(trace_chunk_size, CHECK);
-  typeArrayHandle bcis(THREAD, b);
-  objArrayOop mirror_oop = oopFactory::new_objectArray(trace_chunk_size, CHECK);
-  objArrayHandle mirrors (THREAD, mirror_oop);
-
-  // backtrace has space for one chunk (next is NULL)
-  backtrace->obj_at_put(trace_methods_offset, methods());
-  backtrace->obj_at_put(trace_bcis_offset, bcis());
-  backtrace->obj_at_put(trace_mirrors_offset, mirrors());
-  set_backtrace(throwable(), backtrace());
+  BacktraceBuilder bt(CHECK);   // creates a backtrace
+  set_backtrace(throwable(), bt.backtrace());
 }
 
 
@@ -1623,48 +1611,26 @@
 
   assert(throwable->is_a(SystemDictionary::Throwable_klass()), "sanity check");
 
-  objArrayOop backtrace = (objArrayOop)java_lang_Throwable::backtrace(throwable());
-  assert(backtrace != NULL, "backtrace not preallocated");
-
-  oop m = backtrace->obj_at(trace_methods_offset);
-  typeArrayOop methods = typeArrayOop(m);
-  assert(methods != NULL && methods->length() > 0, "method array not preallocated");
-
-  oop b = backtrace->obj_at(trace_bcis_offset);
-  typeArrayOop bcis = typeArrayOop(b);
-  assert(bcis != NULL, "bci array not preallocated");
-
-  oop mr = backtrace->obj_at(trace_mirrors_offset);
-  objArrayOop mirrors = objArrayOop(mr);
-  assert(mirrors != NULL, "bci array not preallocated");
-
-  assert(methods->length() == bcis->length() &&
-         methods->length() == mirrors->length(),
-         "method and bci arrays should match");
-
-  JavaThread* thread = JavaThread::current();
-  ResourceMark rm(thread);
-  vframeStream st(thread);
+  JavaThread* THREAD = JavaThread::current();
+
+  objArrayHandle backtrace (THREAD, (objArrayOop)java_lang_Throwable::backtrace(throwable()));
+  assert(backtrace.not_null(), "backtrace should have been preallocated");
+
+  ResourceMark rm(THREAD);
+  vframeStream st(THREAD);
+
+  BacktraceBuilder bt(backtrace);
 
   // Unlike fill_in_stack_trace we do not skip fillInStackTrace or throwable init
   // methods as preallocated errors aren't created by "java" code.
 
   // fill in as much stack trace as possible
+  typeArrayOop methods = BacktraceBuilder::get_methods(backtrace);
   int max_chunks = MIN2(methods->length(), (int)MaxJavaStackTraceDepth);
   int chunk_count = 0;
 
   for (;!st.at_end(); st.next()) {
-    // Add entry and smear the -1 bci to 0 since the array only holds
-    // unsigned shorts.  The later line number lookup would just smear
-    // the -1 to a 0 even if it could be recorded.
-    int bci = st.bci();
-    if (bci == SynchronizationEntryBCI) bci = 0;
-    assert(bci == (jushort)bci, "doesn't fit");
-    bcis->ushort_at_put(chunk_count, bci);
-    methods->metadata_at_put(chunk_count, st.method());
-    mirrors->obj_at_put(chunk_count,
-                   st.method()->method_holder()->java_mirror());
-
+    bt.push(st.method(), st.bci(), CHECK);
     chunk_count++;
 
     // Bail-out for deep stacks
@@ -1678,7 +1644,6 @@
       java_lang_Throwable::set_stacktrace(throwable(), java_lang_Throwable::unassigned_stacktrace());
       assert(java_lang_Throwable::unassigned_stacktrace() != NULL, "not initialized");
   }
-
 }
 
 
@@ -1697,12 +1662,12 @@
       chunk = next;
     }
     assert(chunk != NULL && chunk->obj_at(trace_next_offset) == NULL, "sanity check");
-    // Count element in remaining partial chunk
-    typeArrayOop methods = typeArrayOop(chunk->obj_at(trace_methods_offset));
-    typeArrayOop bcis = typeArrayOop(chunk->obj_at(trace_bcis_offset));
-    assert(methods != NULL && bcis != NULL, "sanity check");
-    for (int i = 0; i < methods->length(); i++) {
-      if (methods->metadata_at(i) == NULL) break;
+    // Count element in remaining partial chunk.  NULL value for mirror
+    // marks the end of the stack trace elements that are saved.
+    objArrayOop mirrors = BacktraceBuilder::get_mirrors(chunk);
+    assert(mirrors != NULL, "sanity check");
+    for (int i = 0; i < mirrors->length(); i++) {
+      if (mirrors->obj_at(i) == NULL) break;
       depth++;
     }
   }
@@ -1728,25 +1693,28 @@
   if (chunk == NULL) {
     THROW_(vmSymbols::java_lang_IndexOutOfBoundsException(), NULL);
   }
-  // Get method,bci from chunk
-  typeArrayOop methods = typeArrayOop(chunk->obj_at(trace_methods_offset));
-  typeArrayOop bcis = typeArrayOop(chunk->obj_at(trace_bcis_offset));
-  assert(methods != NULL && bcis != NULL, "sanity check");
-  methodHandle method(THREAD, ((Method*)methods->metadata_at(chunk_index)));
-  int bci = bcis->ushort_at(chunk_index);
+  // Get method id, bci, version and mirror from chunk
+  typeArrayOop methods = BacktraceBuilder::get_methods(chunk);
+  typeArrayOop bcis = BacktraceBuilder::get_bcis(chunk);
+  objArrayOop mirrors = BacktraceBuilder::get_mirrors(chunk);
+
+  assert(methods != NULL && bcis != NULL && mirrors != NULL, "sanity check");
+
+  int method = methods->short_at(chunk_index);
+  int version = version_at(bcis->int_at(chunk_index));
+  int bci = bci_at(bcis->int_at(chunk_index));
+  Handle mirror(THREAD, mirrors->obj_at(chunk_index));
+
   // Chunk can be partial full
-  if (method.is_null()) {
+  if (mirror.is_null()) {
     THROW_(vmSymbols::java_lang_IndexOutOfBoundsException(), NULL);
   }
 
-  oop element = java_lang_StackTraceElement::create(method, bci, CHECK_0);
+  oop element = java_lang_StackTraceElement::create(mirror, method, version, bci, CHECK_0);
   return element;
 }
 
-oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) {
-  // SystemDictionary::stackTraceElement_klass() will be null for pre-1.4 JDKs
-  assert(JDK_Version::is_gte_jdk14x_version(), "should only be called in >= 1.4");
-
+oop java_lang_StackTraceElement::create(Handle mirror, int method_id, int version, int bci, TRAPS) {
   // Allocate java.lang.StackTraceElement instance
   Klass* k = SystemDictionary::StackTraceElement_klass();
   assert(k != NULL, "must be loaded in 1.4+");
@@ -1758,37 +1726,39 @@
   Handle element = ik->allocate_instance_handle(CHECK_0);
   // Fill in class name
   ResourceMark rm(THREAD);
-  const char* str = method->method_holder()->external_name();
+  InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(mirror()));
+  const char* str = holder->external_name();
   oop classname = StringTable::intern((char*) str, CHECK_0);
   java_lang_StackTraceElement::set_declaringClass(element(), classname);
+
   // Fill in method name
+  Method* method = holder->method_with_idnum(method_id);
   oop methodname = StringTable::intern(method->name(), CHECK_0);
   java_lang_StackTraceElement::set_methodName(element(), methodname);
-  // Fill in source file name
-  Symbol* source = method->method_holder()->source_file_name();
-  if (ShowHiddenFrames && source == NULL)
-    source = vmSymbols::unknown_class_name();
-  oop filename = StringTable::intern(source, CHECK_0);
-  java_lang_StackTraceElement::set_fileName(element(), filename);
-  // File in source line number
-  int line_number;
-  if (method->is_native()) {
-    // Negative value different from -1 below, enabling Java code in
-    // class java.lang.StackTraceElement to distinguish "native" from
-    // "no LineNumberTable".
-    line_number = -2;
+
+  if (!version_matches(method, version)) {
+    // The method was redefined, accurate line number information isn't available
+    java_lang_StackTraceElement::set_fileName(element(), NULL);
+    java_lang_StackTraceElement::set_lineNumber(element(), -1);
   } else {
-    // Returns -1 if no LineNumberTable, and otherwise actual line number
-    line_number = method->line_number_from_bci(bci);
-    if (line_number == -1 && ShowHiddenFrames) {
-      line_number = bci + 1000000;
-    }
+    // Fill in source file name and line number.
+    Symbol* source = holder->source_file_name();
+    if (ShowHiddenFrames && source == NULL)
+      source = vmSymbols::unknown_class_name();
+    oop filename = StringTable::intern(source, CHECK_0);
+    java_lang_StackTraceElement::set_fileName(element(), filename);
+
+    int line_number = get_line_number(method, bci);
+    java_lang_StackTraceElement::set_lineNumber(element(), line_number);
   }
-  java_lang_StackTraceElement::set_lineNumber(element(), line_number);
-
   return element();
 }
 
+oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) {
+  Handle mirror (THREAD, method->method_holder()->java_mirror());
+  int method_id = method->method_idnum();
+  return create(mirror, method_id, method->constants()->version(), bci, THREAD);
+}
 
 void java_lang_reflect_AccessibleObject::compute_offsets() {
   Klass* k = SystemDictionary::reflect_AccessibleObject_klass();
@@ -1819,10 +1789,12 @@
   annotations_offset = -1;
   parameter_annotations_offset = -1;
   annotation_default_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset,             k, vmSymbols::signature_name(),             vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,           k, vmSymbols::annotations_name(),           vmSymbols::byte_array_signature());
   compute_optional_offset(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), vmSymbols::byte_array_signature());
   compute_optional_offset(annotation_default_offset,    k, vmSymbols::annotation_default_name(),    vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Method::create(TRAPS) {
@@ -1968,6 +1940,22 @@
   method->obj_field_put(annotation_default_offset, value);
 }
 
+bool java_lang_reflect_Method::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Method::type_annotations(oop method) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return method->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Method::set_type_annotations(oop method, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  method->obj_field_put(type_annotations_offset, value);
+}
+
 void java_lang_reflect_Constructor::compute_offsets() {
   Klass* k = SystemDictionary::reflect_Constructor_klass();
   compute_offset(clazz_offset,          k, vmSymbols::clazz_name(),          vmSymbols::class_signature());
@@ -1979,9 +1967,11 @@
   signature_offset = -1;
   annotations_offset = -1;
   parameter_annotations_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset,             k, vmSymbols::signature_name(),             vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,           k, vmSymbols::annotations_name(),           vmSymbols::byte_array_signature());
   compute_optional_offset(parameter_annotations_offset, k, vmSymbols::parameter_annotations_name(), vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,      k, vmSymbols::type_annotations_name(),      vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Constructor::create(TRAPS) {
@@ -2092,6 +2082,22 @@
   method->obj_field_put(parameter_annotations_offset, value);
 }
 
+bool java_lang_reflect_Constructor::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Constructor::type_annotations(oop constructor) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return constructor->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Constructor::set_type_annotations(oop constructor, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  constructor->obj_field_put(type_annotations_offset, value);
+}
+
 void java_lang_reflect_Field::compute_offsets() {
   Klass* k = SystemDictionary::reflect_Field_klass();
   compute_offset(clazz_offset,     k, vmSymbols::clazz_name(),     vmSymbols::class_signature());
@@ -2102,8 +2108,10 @@
   // The generic signature and annotations fields are only present in 1.5
   signature_offset = -1;
   annotations_offset = -1;
+  type_annotations_offset = -1;
   compute_optional_offset(signature_offset, k, vmSymbols::signature_name(), vmSymbols::string_signature());
   compute_optional_offset(annotations_offset,  k, vmSymbols::annotations_name(),  vmSymbols::byte_array_signature());
+  compute_optional_offset(type_annotations_offset,  k, vmSymbols::type_annotations_name(),  vmSymbols::byte_array_signature());
 }
 
 Handle java_lang_reflect_Field::create(TRAPS) {
@@ -2198,6 +2206,21 @@
   field->obj_field_put(annotations_offset, value);
 }
 
+bool java_lang_reflect_Field::has_type_annotations_field() {
+  return (type_annotations_offset >= 0);
+}
+
+oop java_lang_reflect_Field::type_annotations(oop field) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  return field->obj_field(type_annotations_offset);
+}
+
+void java_lang_reflect_Field::set_type_annotations(oop field, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  assert(has_type_annotations_field(), "type_annotations field must be present");
+  field->obj_field_put(type_annotations_offset, value);
+}
 
 void sun_reflect_ConstantPool::compute_offsets() {
   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
@@ -2208,6 +2231,66 @@
   }
 }
 
+void java_lang_reflect_Parameter::compute_offsets() {
+  Klass* k = SystemDictionary::reflect_Parameter_klass();
+  if(NULL != k) {
+    compute_offset(name_offset,        k, vmSymbols::name_name(),        vmSymbols::string_signature());
+    compute_offset(modifiers_offset,   k, vmSymbols::modifiers_name(),   vmSymbols::int_signature());
+    compute_offset(index_offset,       k, vmSymbols::index_name(),       vmSymbols::int_signature());
+    compute_offset(executable_offset,  k, vmSymbols::executable_name(),  vmSymbols::executable_signature());
+  }
+}
+
+Handle java_lang_reflect_Parameter::create(TRAPS) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  Symbol* name = vmSymbols::java_lang_reflect_Parameter();
+  Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH);
+  instanceKlassHandle klass (THREAD, k);
+  // Ensure it is initialized
+  klass->initialize(CHECK_NH);
+  return klass->allocate_instance_handle(CHECK_NH);
+}
+
+oop java_lang_reflect_Parameter::name(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->obj_field(name_offset);
+}
+
+void java_lang_reflect_Parameter::set_name(oop param, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->obj_field_put(name_offset, value);
+}
+
+int java_lang_reflect_Parameter::modifiers(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->int_field(modifiers_offset);
+}
+
+void java_lang_reflect_Parameter::set_modifiers(oop param, int value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->int_field_put(modifiers_offset, value);
+}
+
+int java_lang_reflect_Parameter::index(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->int_field(index_offset);
+}
+
+void java_lang_reflect_Parameter::set_index(oop param, int value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->int_field_put(index_offset, value);
+}
+
+oop java_lang_reflect_Parameter::executable(oop param) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  return param->obj_field(executable_offset);
+}
+
+void java_lang_reflect_Parameter::set_executable(oop param, oop value) {
+  assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
+  param->obj_field_put(executable_offset, value);
+}
+
 
 Handle sun_reflect_ConstantPool::create(TRAPS) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
@@ -2842,7 +2925,6 @@
 
 int java_lang_Class::_klass_offset;
 int java_lang_Class::_array_klass_offset;
-int java_lang_Class::_resolved_constructor_offset;
 int java_lang_Class::_oop_size_offset;
 int java_lang_Class::_static_oop_field_count_offset;
 #ifdef GRAAL
@@ -2866,6 +2948,7 @@
 int java_lang_reflect_Method::annotations_offset;
 int java_lang_reflect_Method::parameter_annotations_offset;
 int java_lang_reflect_Method::annotation_default_offset;
+int java_lang_reflect_Method::type_annotations_offset;
 int java_lang_reflect_Constructor::clazz_offset;
 int java_lang_reflect_Constructor::parameterTypes_offset;
 int java_lang_reflect_Constructor::exceptionTypes_offset;
@@ -2874,6 +2957,7 @@
 int java_lang_reflect_Constructor::signature_offset;
 int java_lang_reflect_Constructor::annotations_offset;
 int java_lang_reflect_Constructor::parameter_annotations_offset;
+int java_lang_reflect_Constructor::type_annotations_offset;
 int java_lang_reflect_Field::clazz_offset;
 int java_lang_reflect_Field::name_offset;
 int java_lang_reflect_Field::type_offset;
@@ -2881,6 +2965,11 @@
 int java_lang_reflect_Field::modifiers_offset;
 int java_lang_reflect_Field::signature_offset;
 int java_lang_reflect_Field::annotations_offset;
+int java_lang_reflect_Field::type_annotations_offset;
+int java_lang_reflect_Parameter::name_offset;
+int java_lang_reflect_Parameter::modifiers_offset;
+int java_lang_reflect_Parameter::index_offset;
+int java_lang_reflect_Parameter::executable_offset;
 int java_lang_boxing_object::value_offset;
 int java_lang_boxing_object::long_value_offset;
 int java_lang_ref_Reference::referent_offset;
@@ -3065,6 +3154,8 @@
     sun_reflect_ConstantPool::compute_offsets();
     sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   }
+  if (JDK_Version::is_jdk18x_version())
+    java_lang_reflect_Parameter::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
@@ -3190,7 +3281,6 @@
   // Fake fields
   // CHECK_OFFSET("java/lang/Class", java_lang_Class, klass); // %%% this needs to be checked
   // CHECK_OFFSET("java/lang/Class", java_lang_Class, array_klass); // %%% this needs to be checked
-  // CHECK_OFFSET("java/lang/Class", java_lang_Class, resolved_constructor); // %%% this needs to be checked
 
   // java.lang.Throwable
 
--- a/src/share/vm/classfile/javaClasses.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/javaClasses.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -166,8 +166,8 @@
   // objects in the shared archive file.
   // hash P(31) from Kernighan & Ritchie
   //
-  // For this reason, THIS ALGORITHM MUST MATCH String.toHash().
-  template <typename T> static unsigned int to_hash(T* s, int len) {
+  // For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
+  template <typename T> static unsigned int hash_code(T* s, int len) {
     unsigned int h = 0;
     while (len-- > 0) {
       h = 31*h + (unsigned int) *s;
@@ -175,10 +175,10 @@
     }
     return h;
   }
-  static unsigned int to_hash(oop java_string);
+  static unsigned int hash_code(oop java_string);
 
   // This is the string hash code used by the StringTable, which may be
-  // the same as String.toHash or an alternate hash code.
+  // the same as String.hashCode or an alternate hash code.
   static unsigned int hash_string(oop java_string);
 
   static bool equals(oop java_string, jchar* chars, int len);
@@ -207,7 +207,6 @@
 #define CLASS_INJECTED_FIELDS(macro)                                       \
   macro(java_lang_Class, klass,                  intptr_signature,  false) \
   GRAAL_ONLY(macro(java_lang_Class, graal_mirror, object_signature, false))\
-  macro(java_lang_Class, resolved_constructor,   intptr_signature,  false) \
   macro(java_lang_Class, array_klass,            intptr_signature,  false) \
   macro(java_lang_Class, oop_size,               int_signature,     false) \
   macro(java_lang_Class, static_oop_field_count, int_signature,     false)
@@ -219,7 +218,6 @@
   // The fake offsets are added by the class loader when java.lang.Class is loaded
 
   static int _klass_offset;
-  static int _resolved_constructor_offset;
   static int _array_klass_offset;
 
   static int _oop_size_offset;
@@ -258,15 +256,11 @@
   static bool is_primitive(oop java_class);
   static BasicType primitive_type(oop java_class);
   static oop primitive_mirror(BasicType t);
-  // JVM_NewInstance support
-  static Method* resolved_constructor(oop java_class);
-  static void set_resolved_constructor(oop java_class, Method* constructor);
   // JVM_NewArray support
   static Klass* array_klass(oop java_class);
   static void set_array_klass(oop java_class, Klass* klass);
   // compiler support for class operations
   static int klass_offset_in_bytes()                { return _klass_offset; }
-  static int resolved_constructor_offset_in_bytes() { return _resolved_constructor_offset; }
   static int array_klass_offset_in_bytes()          { return _array_klass_offset; }
   // Support for classRedefinedCount field
   static int classRedefinedCount(oop the_class_mirror);
@@ -479,8 +473,7 @@
   static int static_unassigned_stacktrace_offset;
 
   // Printing
-  static char* print_stack_element_to_buffer(Method* method, int bci);
-  static void print_to_stream(Handle stream, const char* str);
+  static char* print_stack_element_to_buffer(Handle mirror, int method, int version, int bci);
   // StackTrace (programmatic access, new since 1.4)
   static void clear_stacktrace(oop throwable);
   // No stack trace available
@@ -500,12 +493,9 @@
   static oop message(oop throwable);
   static oop message(Handle throwable);
   static void set_message(oop throwable, oop value);
-  // Print stack trace stored in exception by call-back to Java
-  // Note: this is no longer used in Merlin, but we still suppport
-  // it for compatibility.
-  static void print_stack_trace(oop throwable, oop print_stream);
-  static void print_stack_element(Handle stream, Method* method, int bci);
-  static void print_stack_element(outputStream *st, Method* method, int bci);
+  static void print_stack_element(outputStream *st, Handle mirror, int method,
+                                  int version, int bci);
+  static void print_stack_element(outputStream *st, methodHandle method, int bci);
   static void print_stack_usage(Handle stream);
 
   // Allocate space for backtrace (created but stack trace not filled in)
@@ -564,6 +554,7 @@
   static int annotations_offset;
   static int parameter_annotations_offset;
   static int annotation_default_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -609,6 +600,10 @@
   static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop method);
+  static void set_type_annotations(oop method, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
@@ -628,6 +623,7 @@
   static int signature_offset;
   static int annotations_offset;
   static int parameter_annotations_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -663,6 +659,10 @@
   static oop parameter_annotations(oop method);
   static void set_parameter_annotations(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop constructor);
+  static void set_type_annotations(oop constructor, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
@@ -681,6 +681,7 @@
   static int modifiers_offset;
   static int signature_offset;
   static int annotations_offset;
+  static int type_annotations_offset;
 
   static void compute_offsets();
 
@@ -720,10 +721,45 @@
   static oop annotation_default(oop method);
   static void set_annotation_default(oop method, oop value);
 
+  static bool has_type_annotations_field();
+  static oop type_annotations(oop field);
+  static void set_type_annotations(oop field, oop value);
+
   // Debugging
   friend class JavaClasses;
 };
 
+class java_lang_reflect_Parameter {
+ private:
+  // Note that to reduce dependencies on the JDK we compute these
+  // offsets at run-time.
+  static int name_offset;
+  static int modifiers_offset;
+  static int index_offset;
+  static int executable_offset;
+
+  static void compute_offsets();
+
+ public:
+  // Allocation
+  static Handle create(TRAPS);
+
+  // Accessors
+  static oop name(oop field);
+  static void set_name(oop field, oop value);
+
+  static int index(oop reflect);
+  static void set_index(oop reflect, int value);
+
+  static int modifiers(oop reflect);
+  static void set_modifiers(oop reflect, int value);
+
+  static oop executable(oop constructor);
+  static void set_executable(oop constructor, oop value);
+
+  friend class JavaClasses;
+};
+
 // Interface to sun.reflect.ConstantPool objects
 class sun_reflect_ConstantPool {
  private:
@@ -1227,7 +1263,8 @@
   static void set_lineNumber(oop element, int value);
 
   // Create an instance of StackTraceElement
-  static oop create(methodHandle m, int bci, TRAPS);
+  static oop create(Handle mirror, int method, int version, int bci, TRAPS);
+  static oop create(methodHandle method, int bci, TRAPS);
 
   // Debugging
   friend class JavaClasses;
--- a/src/share/vm/classfile/placeholders.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/placeholders.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -142,7 +142,7 @@
 }
 
 
-// placeholder used to track class loading internal states
+// placeholder is used to track class loading internal states
 // placeholder existence now for loading superclass/superinterface
 // superthreadQ tracks class circularity, while loading superclass/superinterface
 // loadInstanceThreadQ tracks load_instance_class calls
@@ -153,15 +153,17 @@
 // All claimants remove SeenThread after completing action
 // On removal: if definer and all queues empty, remove entry
 // Note: you can be in both placeholders and systemDictionary
-// see parse_stream for redefine classes
 // Therefore - must always check SD first
 // Ignores the case where entry is not found
 void PlaceholderTable::find_and_remove(int index, unsigned int hash,
-                       Symbol* name, ClassLoaderData* loader_data, Thread* thread) {
+                                       Symbol* name, ClassLoaderData* loader_data,
+                                       classloadAction action,
+                                       Thread* thread) {
     assert_locked_or_safepoint(SystemDictionary_lock);
     PlaceholderEntry *probe = get_entry(index, hash, name, loader_data);
     if (probe != NULL) {
-       // No other threads using this entry
+       probe->remove_seen_thread(thread, action);
+       // If no other threads using this entry, and this thread is not using this entry for other states
        if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
           && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
          remove_entry(index, hash, name, loader_data);
--- a/src/share/vm/classfile/placeholders.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/placeholders.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -82,7 +82,7 @@
  };
 
   // find_and_add returns probe pointer - old or new
-  // If no entry exists, add a placeholder entry and push SeenThread
+  // If no entry exists, add a placeholder entry and push SeenThread for classloadAction
   // If entry exists, reuse entry and push SeenThread for classloadAction
   PlaceholderEntry* find_and_add(int index, unsigned int hash,
                                  Symbol* name, ClassLoaderData* loader_data,
@@ -92,9 +92,11 @@
   void remove_entry(int index, unsigned int hash,
                     Symbol* name, ClassLoaderData* loader_data);
 
-// Remove placeholder information
+  // find_and_remove first removes SeenThread for classloadAction
+  // If all queues are empty and definer is null, remove the PlacheholderEntry completely
   void find_and_remove(int index, unsigned int hash,
-                       Symbol* name, ClassLoaderData* loader_data, Thread* thread);
+                       Symbol* name, ClassLoaderData* loader_data,
+                       classloadAction action, Thread* thread);
 
   // GC support.
   void classes_do(KlassClosure* f);
--- a/src/share/vm/classfile/symbolTable.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/symbolTable.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -179,7 +179,7 @@
 unsigned int SymbolTable::hash_symbol(const char* s, int len) {
   return use_alternate_hashcode() ?
            AltHashing::murmur3_32(seed(), (const jbyte*)s, len) :
-           java_lang_String::to_hash(s, len);
+           java_lang_String::hash_code(s, len);
 }
 
 
@@ -617,7 +617,7 @@
 // Pick hashing algorithm
 unsigned int StringTable::hash_string(const jchar* s, int len) {
   return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
-                                    java_lang_String::to_hash(s, len);
+                                    java_lang_String::hash_code(s, len);
 }
 
 oop StringTable::lookup(int index, jchar* name,
--- a/src/share/vm/classfile/systemDictionary.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -172,7 +172,7 @@
       assert(klass_h() == NULL, "Should not have result with exception pending");
       Handle e(THREAD, PENDING_EXCEPTION);
       CLEAR_PENDING_EXCEPTION;
-      THROW_MSG_CAUSE_0(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string(), e);
+      THROW_MSG_CAUSE_NULL(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string(), e);
     } else {
       return NULL;
     }
@@ -181,9 +181,9 @@
   if (klass_h() == NULL) {
     ResourceMark rm(THREAD);
     if (throw_error) {
-      THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string());
+      THROW_MSG_NULL(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string());
     } else {
-      THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
+      THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
     }
   }
   return (Klass*)klass_h();
@@ -343,29 +343,29 @@
   }
   if (throw_circularity_error) {
       ResourceMark rm(THREAD);
-      THROW_MSG_0(vmSymbols::java_lang_ClassCircularityError(), child_name->as_C_string());
+      THROW_MSG_NULL(vmSymbols::java_lang_ClassCircularityError(), child_name->as_C_string());
   }
 
 // java.lang.Object should have been found above
   assert(class_name != NULL, "null super class for resolving");
   // Resolve the super class or interface, check results on return
-  Klass* superk = NULL;
-  superk = SystemDictionary::resolve_or_null(class_name,
+  Klass* superk = SystemDictionary::resolve_or_null(class_name,
                                                  class_loader,
                                                  protection_domain,
                                                  THREAD);
 
   KlassHandle superk_h(THREAD, superk);
 
-  // Note: clean up of placeholders currently in callers of
-  // resolve_super_or_fail - either at update_dictionary time
-  // or on error
+  // Clean up of placeholders moved so that each classloadAction registrar self-cleans up
+  // It is no longer necessary to keep the placeholder table alive until update_dictionary
+  // or error. GC used to walk the placeholder table as strong roots.
+  // The instanceKlass is kept alive because the class loader is on the stack,
+  // which keeps the loader_data alive, as well as all instanceKlasses in
+  // the loader_data. parseClassFile adds the instanceKlass to loader_data.
   {
-  MutexLocker mu(SystemDictionary_lock, THREAD);
-   PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data);
-   if (probe != NULL) {
-      probe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER);
-   }
+    MutexLocker mu(SystemDictionary_lock, THREAD);
+    placeholders()->find_and_remove(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, THREAD);
+    SystemDictionary_lock->notify_all();
   }
   if (HAS_PENDING_EXCEPTION || superk_h() == NULL) {
     // can null superk
@@ -430,8 +430,8 @@
 
       // We're using a No_Safepoint_Verifier to catch any place where we
       // might potentially do a GC at all.
-      // SystemDictionary::do_unloading() asserts that classes are only
-      // unloaded at a safepoint.
+      // Dictionary::do_unloading() asserts that classes in SD are only
+      // unloaded at a safepoint. Anonymous classes are not in SD.
       No_Safepoint_Verifier nosafepoint;
       dictionary()->add_protection_domain(d_index, d_hash, klass, loader_data,
                                           protection_domain, THREAD);
@@ -486,7 +486,6 @@
 // super class loading here.
 // This also is critical in cases where the original thread gets stalled
 // even in non-circularity situations.
-// Note: only one thread can define the class, but multiple can resolve
 // Note: must call resolve_super_or_fail even if null super -
 // to force placeholder entry creation for this class for circularity detection
 // Caller must check for pending exception
@@ -518,14 +517,6 @@
                                                           protection_domain,
                                                           true,
                                                           CHECK_(nh));
-  // We don't redefine the class, so we just need to clean up if there
-  // was not an error (don't want to modify any system dictionary
-  // data structures).
-  {
-    MutexLocker mu(SystemDictionary_lock, THREAD);
-    placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
-    SystemDictionary_lock->notify_all();
-  }
 
   // parallelCapable class loaders do NOT wait for parallel superclass loads to complete
   // Serial class loaders and bootstrap classloader do wait for superclass loads
@@ -595,6 +586,10 @@
 
   // Do lookup to see if class already exist and the protection domain
   // has the right access
+  // This call uses find which checks protection domain already matches
+  // All subsequent calls use find_class, and set has_loaded_class so that
+  // before we return a result we call out to java to check for valid protection domain
+  // to allow returning the Klass* and add it to the pd_set if it is valid
   unsigned int d_hash = dictionary()->compute_hash(name, loader_data);
   int d_index = dictionary()->hash_to_index(d_hash);
   Klass* probe = dictionary()->find(d_index, d_hash, name, loader_data,
@@ -652,7 +647,7 @@
     }
   }
 
-  // If the class in is in the placeholder table, class loading is in progress
+  // If the class is in the placeholder table, class loading is in progress
   if (super_load_in_progress && havesupername==true) {
     k = SystemDictionary::handle_parallel_super_load(name, superclassname,
         class_loader, protection_domain, lockObject, THREAD);
@@ -664,7 +659,9 @@
     }
   }
 
+  bool throw_circularity_error = false;
   if (!class_has_been_loaded) {
+    bool load_instance_added = false;
 
     // add placeholder entry to record loading instance class
     // Five cases:
@@ -690,7 +687,7 @@
     //    No performance benefit and no deadlock issues.
     // case 5. parallelCapable user level classloaders - without objectLocker
     //    Allow parallel classloading of a class/classloader pair
-    bool throw_circularity_error = false;
+
     {
       MutexLocker mu(SystemDictionary_lock, THREAD);
       if (class_loader.is_null() || !is_parallelCapable(class_loader)) {
@@ -726,12 +723,13 @@
           }
         }
       }
-      // All cases: add LOAD_INSTANCE
+      // All cases: add LOAD_INSTANCE holding SystemDictionary_lock
       // case 3: UnsyncloadClass || case 5: parallelCapable: allow competing threads to try
       // LOAD_INSTANCE in parallel
-      // add placeholder entry even if error - callers will remove on error
+
       if (!throw_circularity_error && !class_has_been_loaded) {
         PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, loader_data, PlaceholderTable::LOAD_INSTANCE, NULL, THREAD);
+        load_instance_added = true;
         // For class loaders that do not acquire the classloader object lock,
         // if they did not catch another thread holding LOAD_INSTANCE,
         // need a check analogous to the acquire ObjectLocker/find_class
@@ -740,19 +738,18 @@
         // class loaders holding the ObjectLock shouldn't find the class here
         Klass* check = find_class(d_index, d_hash, name, loader_data);
         if (check != NULL) {
-        // Klass is already loaded, so just return it
+        // Klass is already loaded, so return it after checking/adding protection domain
           k = instanceKlassHandle(THREAD, check);
           class_has_been_loaded = true;
-          newprobe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE);
-          placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
-          SystemDictionary_lock->notify_all();
         }
       }
     }
+
     // must throw error outside of owning lock
     if (throw_circularity_error) {
+      assert(!HAS_PENDING_EXCEPTION && load_instance_added == false,"circularity error cleanup");
       ResourceMark rm(THREAD);
-      THROW_MSG_0(vmSymbols::java_lang_ClassCircularityError(), name->as_C_string());
+      THROW_MSG_NULL(vmSymbols::java_lang_ClassCircularityError(), name->as_C_string());
     }
 
     if (!class_has_been_loaded) {
@@ -782,20 +779,6 @@
         }
       }
 
-      // clean up placeholder entries for success or error
-      // This cleans up LOAD_INSTANCE entries
-      // It also cleans up LOAD_SUPER entries on errors from
-      // calling load_instance_class
-      {
-        MutexLocker mu(SystemDictionary_lock, THREAD);
-        PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, name, loader_data);
-        if (probe != NULL) {
-          probe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE);
-          placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
-          SystemDictionary_lock->notify_all();
-        }
-      }
-
       // If everything was OK (no exceptions, no null return value), and
       // class_loader is NOT the defining loader, do a little more bookkeeping.
       if (!HAS_PENDING_EXCEPTION && !k.is_null() &&
@@ -819,18 +802,22 @@
           }
         }
       }
-      if (HAS_PENDING_EXCEPTION || k.is_null()) {
-        // On error, clean up placeholders
-        {
-          MutexLocker mu(SystemDictionary_lock, THREAD);
-          placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
-          SystemDictionary_lock->notify_all();
-        }
-        return NULL;
-      }
+    } // load_instance_class loop
+
+    if (load_instance_added == true) {
+      // clean up placeholder entries for LOAD_INSTANCE success or error
+      // This brackets the SystemDictionary updates for both defining
+      // and initiating loaders
+      MutexLocker mu(SystemDictionary_lock, THREAD);
+        placeholders()->find_and_remove(p_index, p_hash, name, loader_data, PlaceholderTable::LOAD_INSTANCE, THREAD);
+        SystemDictionary_lock->notify_all();
     }
   }
 
+  if (HAS_PENDING_EXCEPTION || k.is_null()) {
+    return NULL;
+  }
+
 #ifdef ASSERT
   {
     ClassLoaderData* loader_data = k->class_loader_data();
@@ -850,8 +837,8 @@
     // so we cannot allow GC to occur while we're holding this entry.
     // We're using a No_Safepoint_Verifier to catch any place where we
     // might potentially do a GC at all.
-    // SystemDictionary::do_unloading() asserts that classes are only
-    // unloaded at a safepoint.
+    // Dictionary::do_unloading() asserts that classes in SD are only
+    // unloaded at a safepoint. Anonymous classes are not in SD.
     No_Safepoint_Verifier nosafepoint;
     if (dictionary()->is_valid_protection_domain(d_index, d_hash, name,
                                                  loader_data,
@@ -898,8 +885,8 @@
     // so we cannot allow GC to occur while we're holding this entry.
     // We're using a No_Safepoint_Verifier to catch any place where we
     // might potentially do a GC at all.
-    // SystemDictionary::do_unloading() asserts that classes are only
-    // unloaded at a safepoint.
+    // Dictionary::do_unloading() asserts that classes in SD are only
+    // unloaded at a safepoint. Anonymous classes are not in SD.
     No_Safepoint_Verifier nosafepoint;
     return dictionary()->find(d_index, d_hash, class_name, loader_data,
                               protection_domain, THREAD);
@@ -965,10 +952,6 @@
   // throw potential ClassFormatErrors.
   //
   // Note: "name" is updated.
-  // Further note:  a placeholder will be added for this class when
-  //   super classes are loaded (resolve_super_or_fail). We expect this
-  //   to be called for all classes but java.lang.Object; and we preload
-  //   java.lang.Object through resolve_or_fail, not this path.
 
   instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
                                                              loader_data,
@@ -979,21 +962,6 @@
                                                              true,
                                                              THREAD);
 
-  // We don't redefine the class, so we just need to clean up whether there
-  // was an error or not (don't want to modify any system dictionary
-  // data structures).
-  // Parsed name could be null if we threw an error before we got far
-  // enough along to parse it -- in that case, there is nothing to clean up.
-  if (parsed_name != NULL) {
-    unsigned int p_hash = placeholders()->compute_hash(parsed_name,
-                                                       loader_data);
-    int p_index = placeholders()->hash_to_index(p_hash);
-    {
-    MutexLocker mu(SystemDictionary_lock, THREAD);
-    placeholders()->find_and_remove(p_index, p_hash, parsed_name, loader_data, THREAD);
-    SystemDictionary_lock->notify_all();
-    }
-  }
 
   if (host_klass.not_null() && k.not_null()) {
     assert(EnableInvokeDynamic, "");
@@ -1062,10 +1030,6 @@
   // throw potential ClassFormatErrors.
   //
   // Note: "name" is updated.
-  // Further note:  a placeholder will be added for this class when
-  //   super classes are loaded (resolve_super_or_fail). We expect this
-  //   to be called for all classes but java.lang.Object; and we preload
-  //   java.lang.Object through resolve_or_fail, not this path.
 
   instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
                                                              loader_data,
@@ -1114,25 +1078,7 @@
     }
   }
 
-  // If parsing the class file or define_instance_class failed, we
-  // need to remove the placeholder added on our behalf. But we
-  // must make sure parsed_name is valid first (it won't be if we had
-  // a format error before the class was parsed far enough to
-  // find the name).
-  if (HAS_PENDING_EXCEPTION && parsed_name != NULL) {
-    unsigned int p_hash = placeholders()->compute_hash(parsed_name,
-                                                       loader_data);
-    int p_index = placeholders()->hash_to_index(p_hash);
-    {
-    MutexLocker mu(SystemDictionary_lock, THREAD);
-    placeholders()->find_and_remove(p_index, p_hash, parsed_name, loader_data, THREAD);
-    SystemDictionary_lock->notify_all();
-    }
-    return NULL;
-  }
-
-  // Make sure that we didn't leave a place holder in the
-  // SystemDictionary; this is only done on success
+  // Make sure we have an entry in the SystemDictionary on success
   debug_only( {
     if (!HAS_PENDING_EXCEPTION) {
       assert(parsed_name != NULL, "parsed_name is still null?");
@@ -1547,8 +1493,7 @@
     // Other cases fall through, and may run into duplicate defines
     // caught by finding an entry in the SystemDictionary
     if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->instance_klass() != NULL)) {
-        probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
-        placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
+        placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
         SystemDictionary_lock->notify_all();
 #ifdef ASSERT
         Klass* check = find_class(d_index, d_hash, name_h, loader_data);
@@ -1578,8 +1523,7 @@
         probe->set_instance_klass(k());
       }
       probe->set_definer(NULL);
-      probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS);
-      placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
+      placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
       SystemDictionary_lock->notify_all();
     }
   }
@@ -1736,6 +1680,8 @@
   }
   return newsize;
 }
+// Assumes classes in the SystemDictionary are only unloaded at a safepoint
+// Note: anonymous classes are not in the SD.
 bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) {
   // First, mark for unload all ClassLoaderData referencing a dead class loader.
   bool has_dead_loaders = ClassLoaderDataGraph::do_unloading(is_alive);
@@ -2105,9 +2051,7 @@
   // All loaded classes get a unique ID.
   TRACE_INIT_ID(k);
 
-  // Check for a placeholder. If there, remove it and make a
-  // new system dictionary entry.
-  placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
+  // Make a new system dictionary entry.
   Klass* sd_check = find_class(d_index, d_hash, name, loader_data);
   if (sd_check == NULL) {
     dictionary()->add_klass(name, loader_data, k);
@@ -2116,12 +2060,8 @@
 #ifdef ASSERT
   sd_check = find_class(d_index, d_hash, name, loader_data);
   assert (sd_check != NULL, "should have entry in system dictionary");
-// Changed to allow PH to remain to complete class circularity checking
-// while only one thread can define a class at one time, multiple
-// classes can resolve the superclass for a class at one time,
-// and the placeholder is used to track that
-//  Symbol* ph_check = find_placeholder(name, class_loader);
-//  assert (ph_check == NULL, "should not have a placeholder entry");
+  // Note: there may be a placeholder entry: for circularity testing
+  // or for parallel defines
 #endif
     SystemDictionary_lock->notify_all();
   }
--- a/src/share/vm/classfile/systemDictionary.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/systemDictionary.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -131,6 +131,7 @@
   do_klass(Properties_klass,                            java_util_Properties,                      Pre                 ) \
   do_klass(reflect_AccessibleObject_klass,              java_lang_reflect_AccessibleObject,        Pre                 ) \
   do_klass(reflect_Field_klass,                         java_lang_reflect_Field,                   Pre                 ) \
+  do_klass(reflect_Parameter_klass,                     java_lang_reflect_Parameter,               Opt                 ) \
   do_klass(reflect_Method_klass,                        java_lang_reflect_Method,                  Pre                 ) \
   do_klass(reflect_Constructor_klass,                   java_lang_reflect_Constructor,             Pre                 ) \
                                                                                                                          \
@@ -499,6 +500,7 @@
   // Tells whether ClassLoader.checkPackageAccess is present
   static bool has_checkPackageAccess()      { return _has_checkPackageAccess; }
 
+  static bool Parameter_klass_loaded()      { return WK_KLASS(reflect_Parameter_klass) != NULL; }
   static bool Class_klass_loaded()          { return WK_KLASS(Class_klass) != NULL; }
   static bool Cloneable_klass_loaded()      { return WK_KLASS(Cloneable_klass) != NULL; }
   static bool Object_klass_loaded()         { return WK_KLASS(Object_klass) != NULL; }
--- a/src/share/vm/classfile/vmSymbols.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -86,6 +86,7 @@
   template(java_lang_reflect_Method,                  "java/lang/reflect/Method")                 \
   template(java_lang_reflect_Constructor,             "java/lang/reflect/Constructor")            \
   template(java_lang_reflect_Field,                   "java/lang/reflect/Field")                  \
+  template(java_lang_reflect_Parameter,               "java/lang/reflect/Parameter")              \
   template(java_lang_reflect_Array,                   "java/lang/reflect/Array")                  \
   template(java_lang_StringBuffer,                    "java/lang/StringBuffer")                   \
   template(java_lang_StringBuilder,                   "java/lang/StringBuilder")                  \
@@ -126,6 +127,7 @@
   template(tag_line_number_table,                     "LineNumberTable")                          \
   template(tag_local_variable_table,                  "LocalVariableTable")                       \
   template(tag_local_variable_type_table,             "LocalVariableTypeTable")                   \
+  template(tag_method_parameters,                     "MethodParameters")                         \
   template(tag_stack_map_table,                       "StackMapTable")                            \
   template(tag_synthetic,                             "Synthetic")                                \
   template(tag_deprecated,                            "Deprecated")                               \
@@ -136,6 +138,8 @@
   template(tag_runtime_visible_parameter_annotations, "RuntimeVisibleParameterAnnotations")       \
   template(tag_runtime_invisible_parameter_annotations,"RuntimeInvisibleParameterAnnotations")    \
   template(tag_annotation_default,                    "AnnotationDefault")                        \
+  template(tag_runtime_visible_type_annotations,      "RuntimeVisibleTypeAnnotations")            \
+  template(tag_runtime_invisible_type_annotations,    "RuntimeInvisibleTypeAnnotations")          \
   template(tag_enclosing_method,                      "EnclosingMethod")                          \
   template(tag_bootstrap_methods,                     "BootstrapMethods")                         \
                                                                                                   \
@@ -190,7 +194,10 @@
   template(java_lang_VirtualMachineError,             "java/lang/VirtualMachineError")            \
   template(java_lang_StackOverflowError,              "java/lang/StackOverflowError")             \
   template(java_lang_StackTraceElement,               "java/lang/StackTraceElement")              \
+                                                                                                  \
+  /* Concurrency support */                                                                       \
   template(java_util_concurrent_locks_AbstractOwnableSynchronizer,   "java/util/concurrent/locks/AbstractOwnableSynchronizer") \
+  template(sun_misc_Contended_signature,              "Lsun/misc/Contended;")                     \
                                                                                                   \
   /* class symbols needed by intrinsics */                                                        \
   VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, template, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \
@@ -233,12 +240,17 @@
   /* Support for annotations (JDK 1.5 and above) */                                               \
                                                                                                   \
   template(annotations_name,                          "annotations")                              \
+  template(index_name,                                "index")                                    \
+  template(executable_name,                           "executable")                               \
   template(parameter_annotations_name,                "parameterAnnotations")                     \
   template(annotation_default_name,                   "annotationDefault")                        \
   template(sun_reflect_ConstantPool,                  "sun/reflect/ConstantPool")                 \
   template(ConstantPool_name,                         "constantPoolOop")                          \
   template(sun_reflect_UnsafeStaticFieldAccessorImpl, "sun/reflect/UnsafeStaticFieldAccessorImpl")\
   template(base_name,                                 "base")                                     \
+  /* Type Annotations (JDK 8 and above) */                                                        \
+  template(type_annotations_name,                     "typeAnnotations")                          \
+                                                                                                  \
                                                                                                   \
   /* Support for JSR 292 & invokedynamic (JDK 1.7 and above) */                                   \
   template(java_lang_invoke_CallSite,                 "java/lang/invoke/CallSite")                \
@@ -367,6 +379,7 @@
   template(interpreter_execute_signature,         "(Lcom/oracle/graal/api/meta/ResolvedJavaMethod;[Ljava/lang/Object;)Ljava/lang/Object;") \
                                                                                                                                       \
                                                                                                   \
+                                                                      \
   /* common method and field names */                                                             \
   template(object_initializer_name,                   "<init>")                                   \
   template(class_initializer_name,                    "<clinit>")                                 \
@@ -466,7 +479,6 @@
   template(basicType_name,                            "basicType")                                \
   template(append_name,                               "append")                                   \
   template(klass_name,                                "klass")                                    \
-  template(resolved_constructor_name,                 "resolved_constructor")                     \
   template(array_klass_name,                          "array_klass")                              \
   template(oop_size_name,                             "oop_size")                                 \
   template(static_oop_field_count_name,               "static_oop_field_count")                   \
@@ -564,6 +576,7 @@
   template(class_signature,                           "Ljava/lang/Class;")                                        \
   template(string_signature,                          "Ljava/lang/String;")                                       \
   template(reference_signature,                       "Ljava/lang/ref/Reference;")                                \
+  template(executable_signature,                      "Ljava/lang/reflect/Executable;")                           \
   template(concurrenthashmap_signature,               "Ljava/util/concurrent/ConcurrentHashMap;")                 \
   template(String_StringBuilder_signature,            "(Ljava/lang/String;)Ljava/lang/StringBuilder;")            \
   template(int_StringBuilder_signature,               "(I)Ljava/lang/StringBuilder;")                             \
@@ -817,6 +830,11 @@
   do_intrinsic(_checkIndex,               java_nio_Buffer,        checkIndex_name, int_int_signature,            F_R)   \
    do_name(     checkIndex_name,                                 "checkIndex")                                          \
                                                                                                                         \
+  do_class(sun_nio_cs_iso8859_1_Encoder,  "sun/nio/cs/ISO_8859_1$Encoder")                                              \
+  do_intrinsic(_encodeISOArray,     sun_nio_cs_iso8859_1_Encoder, encodeISOArray_name, encodeISOArray_signature, F_S)   \
+   do_name(     encodeISOArray_name,                             "encodeISOArray")                                      \
+   do_signature(encodeISOArray_signature,                        "([CI[BII)I")                                          \
+                                                                                                                        \
   /* java/lang/ref/Reference */                                                                                         \
   do_intrinsic(_Reference_get,            java_lang_ref_Reference, get_name,    void_object_signature, F_R)             \
                                                                                                                         \
@@ -850,6 +868,15 @@
   do_intrinsic(_unpark,                   sun_misc_Unsafe,        unpark_name, unpark_signature,                 F_RN)  \
    do_name(     unpark_name,                                     "unpark")                                              \
    do_alias(    unpark_signature,                               /*(LObject;)V*/ object_void_signature)                  \
+  do_intrinsic(_loadFence,                sun_misc_Unsafe,        loadFence_name, loadFence_signature,           F_RN)  \
+   do_name(     loadFence_name,                                  "loadFence")                                           \
+   do_alias(    loadFence_signature,                              void_method_signature)                                \
+  do_intrinsic(_storeFence,               sun_misc_Unsafe,        storeFence_name, storeFence_signature,         F_RN)  \
+   do_name(     storeFence_name,                                 "storeFence")                                          \
+   do_alias(    storeFence_signature,                             void_method_signature)                                \
+  do_intrinsic(_fullFence,                sun_misc_Unsafe,        fullFence_name, fullFence_signature,           F_RN)  \
+   do_name(     fullFence_name,                                  "fullFence")                                           \
+   do_alias(    fullFence_signature,                              void_method_signature)                                \
                                                                                                                         \
   /* unsafe memory references (there are a lot of them...) */                                                           \
   do_signature(getObject_signature,       "(Ljava/lang/Object;J)Ljava/lang/Object;")                                    \
@@ -991,12 +1018,14 @@
   do_intrinsic(_getAndAddLong,            sun_misc_Unsafe,        getAndAddLong_name, getAndAddLong_signature, F_R)     \
    do_name(     getAndAddLong_name,                               "getAndAddLong")                                      \
    do_signature(getAndAddLong_signature,                          "(Ljava/lang/Object;JJ)J" )                           \
-  do_intrinsic(_getAndSetInt,             sun_misc_Unsafe,        getAndSet_name, getAndSetInt_signature, F_R)          \
-   do_name(     getAndSet_name,                                   "getAndSet")                                          \
+  do_intrinsic(_getAndSetInt,             sun_misc_Unsafe,        getAndSetInt_name, getAndSetInt_signature, F_R)       \
+   do_name(     getAndSetInt_name,                                "getAndSetInt")                                       \
    do_alias(    getAndSetInt_signature,                         /*"(Ljava/lang/Object;JI)I"*/ getAndAddInt_signature)   \
-  do_intrinsic(_getAndSetLong,            sun_misc_Unsafe,        getAndSet_name, getAndSetLong_signature, F_R)         \
+  do_intrinsic(_getAndSetLong,            sun_misc_Unsafe,        getAndSetLong_name, getAndSetLong_signature, F_R)     \
+   do_name(     getAndSetLong_name,                               "getAndSetLong")                                      \
    do_alias(    getAndSetLong_signature,                        /*"(Ljava/lang/Object;JJ)J"*/ getAndAddLong_signature)  \
-  do_intrinsic(_getAndSetObject,          sun_misc_Unsafe,        getAndSet_name, getAndSetObject_signature,  F_R)      \
+  do_intrinsic(_getAndSetObject,          sun_misc_Unsafe,        getAndSetObject_name, getAndSetObject_signature,  F_R)\
+   do_name(     getAndSetObject_name,                             "getAndSetObject")                                    \
    do_signature(getAndSetObject_signature,                        "(Ljava/lang/Object;JLjava/lang/Object;)Ljava/lang/Object;" ) \
                                                                                                                         \
   /* prefetch_signature is shared by all prefetch variants */                                                           \
--- a/src/share/vm/code/codeCache.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/code/codeCache.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
 #include "code/icBuffer.hpp"
 #include "code/nmethod.hpp"
 #include "code/pcDesc.hpp"
+#include "compiler/compileBroker.hpp"
 #include "gc_implementation/shared/markSweep.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/gcLocker.hpp"
@@ -39,6 +40,7 @@
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
+#include "runtime/arguments.hpp"
 #include "runtime/icache.hpp"
 #include "runtime/java.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -168,6 +170,8 @@
   return (nmethod*)cb;
 }
 
+static size_t maxCodeCacheUsed = 0;
+
 CodeBlob* CodeCache::allocate(int size) {
   // Do not seize the CodeCache lock here--if the caller has not
   // already done so, we are going to lose bigtime, since the code
@@ -192,6 +196,8 @@
                     (address)_heap->end() - (address)_heap->begin());
     }
   }
+  maxCodeCacheUsed = MAX2(maxCodeCacheUsed, ((address)_heap->high_boundary() -
+                          (address)_heap->low_boundary()) - unallocated_capacity());
   verify_if_often();
   print_trace("allocation", cb, size);
   return cb;
@@ -928,7 +934,14 @@
   FREE_C_HEAP_ARRAY(int, buckets, mtCode);
 }
 
+#endif // !PRODUCT
+
 void CodeCache::print() {
+  print_summary(tty);
+
+#ifndef PRODUCT
+  if (!Verbose) return;
+
   CodeBlob_sizes live;
   CodeBlob_sizes dead;
 
@@ -953,7 +966,7 @@
   }
 
 
-  if (Verbose) {
+  if (WizardMode) {
      // print the oop_map usage
     int code_size = 0;
     int number_of_blobs = 0;
@@ -977,20 +990,30 @@
     tty->print_cr("  map size  = %d", map_size);
   }
 
+#endif // !PRODUCT
 }
 
-#endif // PRODUCT
+void CodeCache::print_summary(outputStream* st, bool detailed) {
+  size_t total = (_heap->high_boundary() - _heap->low_boundary());
+  st->print_cr("CodeCache: size=" SIZE_FORMAT "Kb used=" SIZE_FORMAT
+               "Kb max_used=" SIZE_FORMAT "Kb free=" SIZE_FORMAT
+               "Kb max_free_chunk=" SIZE_FORMAT "Kb",
+               total/K, (total - unallocated_capacity())/K,
+               maxCodeCacheUsed/K, unallocated_capacity()/K, largest_free_block()/K);
 
-void CodeCache::print_bounds(outputStream* st) {
-  st->print_cr("Code Cache  [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")",
-               _heap->low_boundary(),
-               _heap->high(),
-               _heap->high_boundary());
-  st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
-               " adapters=" UINT32_FORMAT " free_code_cache=" SIZE_FORMAT "Kb"
-               " largest_free_block=" SIZE_FORMAT,
-               nof_blobs(), nof_nmethods(), nof_adapters(),
-               unallocated_capacity()/K, largest_free_block());
+  if (detailed) {
+    st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]",
+                 _heap->low_boundary(),
+                 _heap->high(),
+                 _heap->high_boundary());
+    st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT
+                 " adapters=" UINT32_FORMAT,
+                 nof_blobs(), nof_nmethods(), nof_adapters());
+    st->print_cr(" compilation: %s", CompileBroker::should_compile_new_jobs() ?
+                 "enabled" : Arguments::mode() == Arguments::_int ?
+                 "disabled (interpreter mode)" :
+                 "disabled (not enough contiguous free space left)");
+  }
 }
 
 void CodeCache::log_state(outputStream* st) {
--- a/src/share/vm/code/codeCache.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/code/codeCache.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -145,11 +145,11 @@
   static void prune_scavenge_root_nmethods();
 
   // Printing/debugging
-  static void print()   PRODUCT_RETURN;          // prints summary
+  static void print();                           // prints summary
   static void print_internals();
   static void verify();                          // verifies the code cache
   static void print_trace(const char* event, CodeBlob* cb, int size = 0) PRODUCT_RETURN;
-  static void print_bounds(outputStream* st);    // Prints a summary of the bounds of the code cache
+  static void print_summary(outputStream* st, bool detailed = true); // Prints a summary of the code cache usage
   static void log_state(outputStream* st);
 
   // The full limits of the codeCache
--- a/src/share/vm/compiler/abstractCompiler.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/compiler/abstractCompiler.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,17 @@
 
 typedef void (*initializer)(void);
 
+#ifdef GRAAL
+class CompilerStatistics {
+ public:
+  elapsedTimer _t_osr_compilation;
+  elapsedTimer _t_standard_compilation;
+  int _sum_osr_bytes_compiled;
+  int _sum_standard_bytes_compiled;
+  CompilerStatistics() : _sum_osr_bytes_compiled(0), _sum_standard_bytes_compiled(0) {}
+};
+#endif
+
 class AbstractCompiler : public CHeapObj<mtCompiler> {
  private:
   bool _is_initialized; // Mark whether compiler object is initialized
@@ -49,6 +60,10 @@
  private:
   Type _type;
 
+#ifdef GRAAL
+  CompilerStatistics _stats;
+#endif
+
  public:
   AbstractCompiler(Type type) : _is_initialized(false), _type(type)    {}
 
@@ -61,6 +76,7 @@
   virtual bool supports_native()                 { return true; }
 
   virtual bool supports_osr   ()                 { return true; }
+  virtual bool can_compile_method(methodHandle method)  { return true; }
   bool is_c1   ()                                { return _type == c1; }
   bool is_c2   ()                                { return _type == c2; }
   bool is_shark()                                { return _type == shark; }
@@ -83,6 +99,10 @@
   virtual void print_timers() {
     ShouldNotReachHere();
   }
+
+#ifdef GRAAL
+  CompilerStatistics* stats() { return &_stats; }
+#endif
 };
 
 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
--- a/src/share/vm/compiler/compileBroker.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/compiler/compileBroker.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -275,12 +275,10 @@
                              const char* comment,
                              bool is_blocking) {
   assert(!_lock->is_locked(), "bad locking");
-  InstanceKlass* holder = method->method_holder();
 
   _compile_id = compile_id;
   _method = method();
-  _method_holder = JNIHandles::make_global(
-        holder->is_anonymous() ? holder->java_mirror(): holder->class_loader());
+  _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
   _osr_bci = osr_bci;
   _is_blocking = is_blocking;
   _comp_level = comp_level;
@@ -304,10 +302,7 @@
       } else {
         _hot_method = hot_method();
         // only add loader or mirror if different from _method_holder
-        InstanceKlass* hot_holder = hot_method->method_holder();
-        _hot_method_holder = JNIHandles::make_global(
-               hot_holder->is_anonymous() ? hot_holder->java_mirror() :
-                                            hot_holder->class_loader());
+        _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder());
       }
     }
   }
@@ -1246,7 +1241,7 @@
   // lock, make sure that the compilation
   // isn't prohibited in a straightforward way.
 
-  if (compiler(comp_level) == NULL || compilation_is_prohibited(method, osr_bci, comp_level)) {
+  if (compiler(comp_level) == NULL || !compiler(comp_level)->can_compile_method(method) || compilation_is_prohibited(method, osr_bci, comp_level)) {
     return NULL;
   }
 
@@ -1742,6 +1737,20 @@
   }
 }
 
+// wrapper for CodeCache::print_summary()
+static void codecache_print(bool detailed)
+{
+  ResourceMark rm;
+  stringStream s;
+  // Dump code cache  into a buffer before locking the tty,
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeCache::print_summary(&s, detailed);
+  }
+  ttyLocker ttyl;
+  tty->print_cr(s.as_string());
+}
+
 // ------------------------------------------------------------------
 // CompileBroker::invoke_compiler_on_method
 //
@@ -1869,6 +1878,9 @@
     tty->print_cr("size: %d time: %d inlined: %d bytes", code_size, (int)time.milliseconds(), task->num_inlined_bytecodes());
   }
 
+  if (PrintCodeCacheOnCompilation)
+    codecache_print(/* detailed= */ false);
+
   // Disable compilation, if required.
   switch (compilable) {
   case ciEnv::MethodCompilable_never:
@@ -1913,6 +1925,7 @@
   UseInterpreter = true;
   if (UseCompiler || AlwaysCompileLoopMethods ) {
     if (xtty != NULL) {
+      ResourceMark rm;
       stringStream s;
       // Dump code cache state into a buffer before locking the tty,
       // because log_state() will use locks causing lock conflicts.
@@ -1926,9 +1939,9 @@
     }
     warning("CodeCache is full. Compiler has been disabled.");
     warning("Try increasing the code cache size using -XX:ReservedCodeCacheSize=");
-    CodeCache::print_bounds(tty);
 #ifndef PRODUCT
     if (CompileTheWorld || ExitOnFullCodeCache) {
+      codecache_print(/* detailed= */ true);
       before_exit(JavaThread::current());
       exit_globals(); // will delete tty
       vm_direct_exit(CompileTheWorld ? 0 : 1);
@@ -1941,6 +1954,7 @@
       AlwaysCompileLoopMethods  = false;
     }
   }
+  codecache_print(/* detailed= */ true);
 }
 
 // ------------------------------------------------------------------
@@ -2087,9 +2101,17 @@
       if (is_osr) {
         _t_osr_compilation.add(time);
         _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
+#ifdef GRAAL
+        compiler(task->comp_level())->stats()->_t_osr_compilation.add(time);
+        compiler(task->comp_level())->stats()->_sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
+#endif
       } else {
         _t_standard_compilation.add(time);
         _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
+#ifdef GRAAL
+        compiler(task->comp_level())->stats()->_t_standard_compilation.add(time);
+        compiler(task->comp_level())->stats()->_sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes();
+#endif
       }
     }
 
@@ -2162,8 +2184,25 @@
   tty->print_cr("  Total compiled bytecodes : %6d bytes", tcb);
   tty->print_cr("    Standard compilation   : %6d bytes", CompileBroker::_sum_standard_bytes_compiled);
   tty->print_cr("    On stack replacement   : %6d bytes", CompileBroker::_sum_osr_bytes_compiled);
-  int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds());
+  double tcs = CompileBroker::_t_total_compilation.seconds();
+  int bps = tcs == 0.0 ? 0 : (int)(tcb / tcs);
   tty->print_cr("  Average compilation speed: %6d bytes/s", bps);
+#ifdef GRAAL
+  for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) {
+    AbstractCompiler* comp = _compilers[i];
+    if (comp != NULL) {
+      CompilerStatistics* stats = comp->stats();
+      int bytecodes = stats->_sum_osr_bytes_compiled + stats->_sum_standard_bytes_compiled;
+      if (bytecodes != 0) {
+        double seconds = stats->_t_osr_compilation.seconds() + stats->_t_standard_compilation.seconds();
+        int bps = seconds == 0.0 ? 0 : (int) (bytecodes / seconds);
+        tty->print_cr("  %7s compilation speed: %6d bytes/s {standard: %6.3f s, %6d bytes; osr: %6.3f s, %6d bytes}",
+            comp->name(), bps, stats->_t_standard_compilation.seconds(), stats->_sum_standard_bytes_compiled,
+            stats->_t_osr_compilation.seconds(), stats->_sum_osr_bytes_compiled);
+      }
+    }
+  }
+#endif
   tty->cr();
   tty->print_cr("  nmethod code size        : %6d bytes", CompileBroker::_sum_nmethod_code_size);
   tty->print_cr("  nmethod total size       : %6d bytes", CompileBroker::_sum_nmethod_size);
--- a/src/share/vm/compiler/compilerOracle.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/compiler/compilerOracle.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -538,6 +538,7 @@
 
   if (match != NULL) {
     if (!_quiet) {
+      ResourceMark rm;
       tty->print("CompilerOracle: %s ", command_names[command]);
       match->print();
     }
--- a/src/share/vm/compiler/oopMap.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/compiler/oopMap.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -545,17 +545,17 @@
     st->print("Oop");
     break;
   case OopMapValue::value_value:
-    st->print("Value" );
+    st->print("Value");
     break;
   case OopMapValue::narrowoop_value:
-    st->print("NarrowOop" );
+    st->print("NarrowOop");
     break;
   case OopMapValue::callee_saved_value:
-    st->print("Callers_" );
+    st->print("Callers_");
     optional->print_on(st);
     break;
   case OopMapValue::derived_oop_value:
-    st->print("Derived_oop_" );
+    st->print("Derived_oop_");
     optional->print_on(st);
     break;
   default:
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -56,7 +56,7 @@
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     if (UseAdaptiveSizePolicy) {
       _generations[0] = new GenerationSpec(Generation::ASParNew,
                                            _initial_gen0_size, _max_gen0_size);
@@ -96,7 +96,7 @@
 
 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
   // initialize the policy counters - 2 collectors, 3 generations
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
   }
   else {
@@ -119,7 +119,7 @@
 
   assert(size_policy() != NULL, "A size policy is required");
   // initialize the policy counters - 2 collectors, 3 generations
-  if (ParNewGeneration::in_use()) {
+  if (UseParNewGC) {
     _gc_policy_counters = new CMSGCAdaptivePolicyCounters("ParNew:CMS", 2, 3,
       size_policy());
   }
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -214,7 +214,6 @@
     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   }
 
-  VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, adjusted_size));
   compact_top += adjusted_size;
 
   // we need to update the offset table so that the beginnings of objects can be
@@ -555,7 +554,7 @@
     reportIndexedFreeListStatistics();
     size_t total_size = totalSizeInIndexedFreeLists() +
                        _dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
-    gclog_or_tty->print(" free=%ld frag=%1.4f\n", total_size, flsFrag());
+    gclog_or_tty->print(" free=" SIZE_FORMAT " frag=%1.4f\n", total_size, flsFrag());
   }
 }
 
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -827,10 +827,10 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   if (PrintGCDetails) {
     if (Verbose) {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"("SIZE_FORMAT")]",
         level(), short_name(), s, used(), capacity());
     } else {
-      gclog_or_tty->print(" [%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
+      gclog_or_tty->print("[%d %s-%s: "SIZE_FORMAT"K("SIZE_FORMAT"K)]",
         level(), short_name(), s, used() / K, capacity() / K);
     }
   }
@@ -3338,7 +3338,7 @@
     if (Verbose && PrintGC) {
       size_t new_mem_size = _virtual_space.committed_size();
       size_t old_mem_size = new_mem_size - bytes;
-      gclog_or_tty->print_cr("Expanding %s from %ldK by %ldK to %ldK",
+      gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
                     name(), old_mem_size/K, bytes/K, new_mem_size/K);
     }
   }
@@ -9203,7 +9203,7 @@
       if (Verbose && PrintGCDetails) {
         size_t new_mem_size = _virtual_space.committed_size();
         size_t old_mem_size = new_mem_size + bytes;
-        gclog_or_tty->print_cr("Shrinking %s from %ldK by %ldK to %ldK",
+        gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K by " SIZE_FORMAT "K to " SIZE_FORMAT "K",
                       name(), old_mem_size/K, bytes/K, new_mem_size/K);
       }
     }
--- a/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/collectionSetChooser.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -85,7 +85,7 @@
     _curr_index(0), _length(0), _first_par_unreserved_idx(0),
     _region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
   _region_live_threshold_bytes =
-    HeapRegion::GrainBytes * (size_t) G1OldCSetRegionLiveThresholdPercent / 100;
+    HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
 }
 
 #ifndef PRODUCT
--- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -46,27 +46,11 @@
 
 // Concurrent marking bit map wrapper
 
-CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) :
-  _bm((uintptr_t*)NULL,0),
+CMBitMapRO::CMBitMapRO(int shifter) :
+  _bm(),
   _shifter(shifter) {
-  _bmStartWord = (HeapWord*)(rs.base());
-  _bmWordSize  = rs.size()/HeapWordSize;    // rs.size() is in bytes
-  ReservedSpace brs(ReservedSpace::allocation_align_size_up(
-                     (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
-
-  MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
-
-  guarantee(brs.is_reserved(), "couldn't allocate concurrent marking bit map");
-  // For now we'll just commit all of the bit map up fromt.
-  // Later on we'll try to be more parsimonious with swap.
-  guarantee(_virtual_space.initialize(brs, brs.size()),
-            "couldn't reseve backing store for concurrent marking bit map");
-  assert(_virtual_space.committed_size() == brs.size(),
-         "didn't reserve backing store for all of concurrent marking bit map?");
-  _bm.set_map((uintptr_t*)_virtual_space.low());
-  assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
-         _bmWordSize, "inconsistency in bit map sizing");
-  _bm.set_size(_bmWordSize >> _shifter);
+  _bmStartWord = 0;
+  _bmWordSize = 0;
 }
 
 HeapWord* CMBitMapRO::getNextMarkedWordAddress(HeapWord* addr,
@@ -108,15 +92,40 @@
 }
 
 #ifndef PRODUCT
-bool CMBitMapRO::covers(ReservedSpace rs) const {
+bool CMBitMapRO::covers(ReservedSpace heap_rs) const {
   // assert(_bm.map() == _virtual_space.low(), "map inconsistency");
   assert(((size_t)_bm.size() * ((size_t)1 << _shifter)) == _bmWordSize,
          "size inconsistency");
-  return _bmStartWord == (HeapWord*)(rs.base()) &&
-         _bmWordSize  == rs.size()>>LogHeapWordSize;
+  return _bmStartWord == (HeapWord*)(heap_rs.base()) &&
+         _bmWordSize  == heap_rs.size()>>LogHeapWordSize;
 }
 #endif
 
+bool CMBitMap::allocate(ReservedSpace heap_rs) {
+  _bmStartWord = (HeapWord*)(heap_rs.base());
+  _bmWordSize  = heap_rs.size()/HeapWordSize;    // heap_rs.size() is in bytes
+  ReservedSpace brs(ReservedSpace::allocation_align_size_up(
+                     (_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
+  if (!brs.is_reserved()) {
+    warning("ConcurrentMark marking bit map allocation failure");
+    return false;
+  }
+  MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
+  // For now we'll just commit all of the bit map up front.
+  // Later on we'll try to be more parsimonious with swap.
+  if (!_virtual_space.initialize(brs, brs.size())) {
+    warning("ConcurrentMark marking bit map backing store failure");
+    return false;
+  }
+  assert(_virtual_space.committed_size() == brs.size(),
+         "didn't reserve backing store for all of concurrent marking bit map?");
+  _bm.set_map((uintptr_t*)_virtual_space.low());
+  assert(_virtual_space.committed_size() << (_shifter + LogBitsPerByte) >=
+         _bmWordSize, "inconsistency in bit map sizing");
+  _bm.set_size(_bmWordSize >> _shifter);
+  return true;
+}
+
 void CMBitMap::clearAll() {
   _bm.clear();
   return;
@@ -163,20 +172,80 @@
 #endif
 {}
 
-void CMMarkStack::allocate(size_t size) {
-  _base = NEW_C_HEAP_ARRAY(oop, size, mtGC);
-  if (_base == NULL) {
-    vm_exit_during_initialization("Failed to allocate CM region mark stack");
+bool CMMarkStack::allocate(size_t capacity) {
+  // allocate a stack of the requisite depth
+  ReservedSpace rs(ReservedSpace::allocation_align_size_up(capacity * sizeof(oop)));
+  if (!rs.is_reserved()) {
+    warning("ConcurrentMark MarkStack allocation failure");
+    return false;
+  }
+  MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
+  if (!_virtual_space.initialize(rs, rs.size())) {
+    warning("ConcurrentMark MarkStack backing store failure");
+    // Release the virtual memory reserved for the marking stack
+    rs.release();
+    return false;
   }
-  _index = 0;
-  _capacity = (jint) size;
+  assert(_virtual_space.committed_size() == rs.size(),
+         "Didn't reserve backing store for all of ConcurrentMark stack?");
+  _base = (oop*) _virtual_space.low();
+  setEmpty();
+  _capacity = (jint) capacity;
   _saved_index = -1;
+  _should_expand = false;
   NOT_PRODUCT(_max_depth = 0);
+  return true;
+}
+
+void CMMarkStack::expand() {
+  // Called, during remark, if we've overflown the marking stack during marking.
+  assert(isEmpty(), "stack should been emptied while handling overflow");
+  assert(_capacity <= (jint) MarkStackSizeMax, "stack bigger than permitted");
+  // Clear expansion flag
+  _should_expand = false;
+  if (_capacity == (jint) MarkStackSizeMax) {
+    if (PrintGCDetails && Verbose) {
+      gclog_or_tty->print_cr(" (benign) Can't expand marking stack capacity, at max size limit");
+    }
+    return;
+  }
+  // Double capacity if possible
+  jint new_capacity = MIN2(_capacity*2, (jint) MarkStackSizeMax);
+  // Do not give up existing stack until we have managed to
+  // get the double capacity that we desired.
+  ReservedSpace rs(ReservedSpace::allocation_align_size_up(new_capacity *
+                                                           sizeof(oop)));
+  if (rs.is_reserved()) {
+    // Release the backing store associated with old stack
+    _virtual_space.release();
+    // Reinitialize virtual space for new stack
+    if (!_virtual_space.initialize(rs, rs.size())) {
+      fatal("Not enough swap for expanded marking stack capacity");
+    }
+    _base = (oop*)(_virtual_space.low());
+    _index = 0;
+    _capacity = new_capacity;
+  } else {
+    if (PrintGCDetails && Verbose) {
+      // Failed to double capacity, continue;
+      gclog_or_tty->print(" (benign) Failed to expand marking stack capacity from "
+                          SIZE_FORMAT"K to " SIZE_FORMAT"K",
+                          _capacity / K, new_capacity / K);
+    }
+  }
+}
+
+void CMMarkStack::set_should_expand() {
+  // If we're resetting the marking state because of an
+  // marking stack overflow, record that we should, if
+  // possible, expand the stack.
+  _should_expand = _cm->has_overflown();
 }
 
 CMMarkStack::~CMMarkStack() {
   if (_base != NULL) {
-    FREE_C_HEAP_ARRAY(oop, _base, mtGC);
+    _base = NULL;
+    _virtual_space.release();
   }
 }
 
@@ -217,7 +286,7 @@
     jint res = Atomic::cmpxchg(next_index, &_index, index);
     if (res == index) {
       for (int i = 0; i < n; i++) {
-        int ind = index + i;
+        int  ind = index + i;
         assert(ind < _capacity, "By overflow test above.");
         _base[ind] = ptr_arr[i];
       }
@@ -228,7 +297,6 @@
   }
 }
 
-
 void CMMarkStack::par_push_arr(oop* ptr_arr, int n) {
   MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
   jint start = _index;
@@ -244,9 +312,9 @@
     assert(ind < _capacity, "By overflow test above.");
     _base[ind] = ptr_arr[i];
   }
+  NOT_PRODUCT(_max_depth = MAX2(_max_depth, next_index));
 }
 
-
 bool CMMarkStack::par_pop_arr(oop* ptr_arr, int max, int* n) {
   MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
   jint index = _index;
@@ -255,7 +323,7 @@
     return false;
   } else {
     int k = MIN2(max, index);
-    jint new_ind = index - k;
+    jint  new_ind = index - k;
     for (int j = 0; j < k; j++) {
       ptr_arr[j] = _base[new_ind + j];
     }
@@ -404,9 +472,10 @@
   return MAX2((n_par_threads + 2) / 4, 1U);
 }
 
-ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
-  _markBitMap1(rs, MinObjAlignment - 1),
-  _markBitMap2(rs, MinObjAlignment - 1),
+ConcurrentMark::ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs) :
+  _g1h(g1h),
+  _markBitMap1(MinObjAlignment - 1),
+  _markBitMap2(MinObjAlignment - 1),
 
   _parallel_marking_threads(0),
   _max_parallel_marking_threads(0),
@@ -415,10 +484,10 @@
   _cleanup_sleep_factor(0.0),
   _cleanup_task_overhead(1.0),
   _cleanup_list("Cleanup List"),
-  _region_bm((BitMap::idx_t) max_regions, false /* in_resource_area*/),
-  _card_bm((rs.size() + CardTableModRefBS::card_size - 1) >>
-           CardTableModRefBS::card_shift,
-           false /* in_resource_area*/),
+  _region_bm((BitMap::idx_t)(g1h->max_regions()), false /* in_resource_area*/),
+  _card_bm((heap_rs.size() + CardTableModRefBS::card_size - 1) >>
+            CardTableModRefBS::card_shift,
+            false /* in_resource_area*/),
 
   _prevMarkBitMap(&_markBitMap1),
   _nextMarkBitMap(&_markBitMap2),
@@ -449,7 +518,8 @@
   _parallel_workers(NULL),
 
   _count_card_bitmaps(NULL),
-  _count_marked_bytes(NULL) {
+  _count_marked_bytes(NULL),
+  _completed_initialization(false) {
   CMVerboseLevel verbose_level = (CMVerboseLevel) G1MarkingVerboseLevel;
   if (verbose_level < no_verbose) {
     verbose_level = no_verbose;
@@ -464,61 +534,34 @@
                            "heap end = "PTR_FORMAT, _heap_start, _heap_end);
   }
 
-  _markStack.allocate(MarkStackSize);
+  if (!_markBitMap1.allocate(heap_rs)) {
+    warning("Failed to allocate first CM bit map");
+    return;
+  }
+  if (!_markBitMap2.allocate(heap_rs)) {
+    warning("Failed to allocate second CM bit map");
+    return;
+  }
 
   // Create & start a ConcurrentMark thread.
   _cmThread = new ConcurrentMarkThread(this);
   assert(cmThread() != NULL, "CM Thread should have been created");
   assert(cmThread()->cm() != NULL, "CM Thread should refer to this cm");
 
-  _g1h = G1CollectedHeap::heap();
   assert(CGC_lock != NULL, "Where's the CGC_lock?");
-  assert(_markBitMap1.covers(rs), "_markBitMap1 inconsistency");
-  assert(_markBitMap2.covers(rs), "_markBitMap2 inconsistency");
+  assert(_markBitMap1.covers(heap_rs), "_markBitMap1 inconsistency");
+  assert(_markBitMap2.covers(heap_rs), "_markBitMap2 inconsistency");
 
   SATBMarkQueueSet& satb_qs = JavaThread::satb_mark_queue_set();
   satb_qs.set_buffer_size(G1SATBBufferSize);
 
   _root_regions.init(_g1h, this);
 
-  _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC);
-  _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC);
-
-  _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap,  _max_worker_id, mtGC);
-  _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC);
-
-  BitMap::idx_t card_bm_size = _card_bm.size();
-
-  // so that the assertion in MarkingTaskQueue::task_queue doesn't fail
-  _active_tasks = _max_worker_id;
-  for (uint i = 0; i < _max_worker_id; ++i) {
-    CMTaskQueue* task_queue = new CMTaskQueue();
-    task_queue->initialize();
-    _task_queues->register_queue(i, task_queue);
-
-    _count_card_bitmaps[i] = BitMap(card_bm_size, false);
-    _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions, mtGC);
-
-    _tasks[i] = new CMTask(i, this,
-                           _count_marked_bytes[i],
-                           &_count_card_bitmaps[i],
-                           task_queue, _task_queues);
-
-    _accum_task_vtime[i] = 0.0;
-  }
-
-  // Calculate the card number for the bottom of the heap. Used
-  // in biasing indexes into the accounting card bitmaps.
-  _heap_bottom_card_num =
-    intptr_t(uintptr_t(_g1h->reserved_region().start()) >>
-                                CardTableModRefBS::card_shift);
-
-  // Clear all the liveness counting data
-  clear_all_count_data();
-
   if (ConcGCThreads > ParallelGCThreads) {
-    vm_exit_during_initialization("Can't have more ConcGCThreads "
-                                  "than ParallelGCThreads.");
+    warning("Can't have more ConcGCThreads (" UINT32_FORMAT ") "
+            "than ParallelGCThreads (" UINT32_FORMAT ").",
+            ConcGCThreads, ParallelGCThreads);
+    return;
   }
   if (ParallelGCThreads == 0) {
     // if we are not running with any parallel GC threads we will not
@@ -590,9 +633,86 @@
     }
   }
 
+  if (FLAG_IS_DEFAULT(MarkStackSize)) {
+    uintx mark_stack_size =
+      MIN2(MarkStackSizeMax,
+          MAX2(MarkStackSize, (uintx) (parallel_marking_threads() * TASKQUEUE_SIZE)));
+    // Verify that the calculated value for MarkStackSize is in range.
+    // It would be nice to use the private utility routine from Arguments.
+    if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) {
+      warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): "
+              "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
+              mark_stack_size, 1, MarkStackSizeMax);
+      return;
+    }
+    FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size);
+  } else {
+    // Verify MarkStackSize is in range.
+    if (FLAG_IS_CMDLINE(MarkStackSize)) {
+      if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
+        if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
+          warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): "
+                  "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
+                  MarkStackSize, 1, MarkStackSizeMax);
+          return;
+        }
+      } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) {
+        if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
+          warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")"
+                  " or for MarkStackSizeMax (" UINTX_FORMAT ")",
+                  MarkStackSize, MarkStackSizeMax);
+          return;
+        }
+      }
+    }
+  }
+
+  if (!_markStack.allocate(MarkStackSize)) {
+    warning("Failed to allocate CM marking stack");
+    return;
+  }
+
+  _tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_worker_id, mtGC);
+  _accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_worker_id, mtGC);
+
+  _count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap,  _max_worker_id, mtGC);
+  _count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_worker_id, mtGC);
+
+  BitMap::idx_t card_bm_size = _card_bm.size();
+
+  // so that the assertion in MarkingTaskQueue::task_queue doesn't fail
+  _active_tasks = _max_worker_id;
+
+  size_t max_regions = (size_t) _g1h->max_regions();
+  for (uint i = 0; i < _max_worker_id; ++i) {
+    CMTaskQueue* task_queue = new CMTaskQueue();
+    task_queue->initialize();
+    _task_queues->register_queue(i, task_queue);
+
+    _count_card_bitmaps[i] = BitMap(card_bm_size, false);
+    _count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, max_regions, mtGC);
+
+    _tasks[i] = new CMTask(i, this,
+                           _count_marked_bytes[i],
+                           &_count_card_bitmaps[i],
+                           task_queue, _task_queues);
+
+    _accum_task_vtime[i] = 0.0;
+  }
+
+  // Calculate the card number for the bottom of the heap. Used
+  // in biasing indexes into the accounting card bitmaps.
+  _heap_bottom_card_num =
+    intptr_t(uintptr_t(_g1h->reserved_region().start()) >>
+                                CardTableModRefBS::card_shift);
+
+  // Clear all the liveness counting data
+  clear_all_count_data();
+
   // so that the call below can read a sensible value
-  _heap_start = (HeapWord*) rs.base();
+  _heap_start = (HeapWord*) heap_rs.base();
   set_non_marking_state();
+  _completed_initialization = true;
 }
 
 void ConcurrentMark::update_g1_committed(bool force) {
@@ -628,8 +748,8 @@
   assert(_heap_end != NULL, "heap bounds should look ok");
   assert(_heap_start < _heap_end, "heap bounds should look ok");
 
-  // reset all the marking data structures and any necessary flags
-  clear_marking_state();
+  // Reset all the marking data structures and any necessary flags
+  reset_marking_state();
 
   if (verbose_low()) {
     gclog_or_tty->print_cr("[global] resetting");
@@ -647,6 +767,23 @@
   set_concurrent_marking_in_progress();
 }
 
+
+void ConcurrentMark::reset_marking_state(bool clear_overflow) {
+  _markStack.set_should_expand();
+  _markStack.setEmpty();        // Also clears the _markStack overflow flag
+  if (clear_overflow) {
+    clear_has_overflown();
+  } else {
+    assert(has_overflown(), "pre-condition");
+  }
+  _finger = _heap_start;
+
+  for (uint i = 0; i < _max_worker_id; ++i) {
+    CMTaskQueue* queue = _task_queues->queue(i);
+    queue->set_empty();
+  }
+}
+
 void ConcurrentMark::set_phase(uint active_tasks, bool concurrent) {
   assert(active_tasks <= _max_worker_id, "we should not have more");
 
@@ -677,7 +814,7 @@
 void ConcurrentMark::set_non_marking_state() {
   // We set the global marking state to some default values when we're
   // not doing marking.
-  clear_marking_state();
+  reset_marking_state();
   _active_tasks = 0;
   clear_concurrent_marking_in_progress();
 }
@@ -844,7 +981,7 @@
     // not clear the overflow flag since we rely on it being true when
     // we exit this method to abort the pause and restart concurent
     // marking.
-    clear_marking_state(concurrent() /* clear_overflow */);
+    reset_marking_state(concurrent() /* clear_overflow */);
     force_overflow()->update();
 
     if (G1Log::fine()) {
@@ -1138,8 +1275,9 @@
   if (has_overflown()) {
     // Oops.  We overflowed.  Restart concurrent marking.
     _restart_for_overflow = true;
-    // Clear the flag. We do not need it any more.
-    clear_has_overflown();
+    // Clear the marking state because we will be restarting
+    // marking due to overflowing the global mark stack.
+    reset_marking_state();
     if (G1TraceMarkStackOverflow) {
       gclog_or_tty->print_cr("\nRemark led to restart for overflow.");
     }
@@ -1163,11 +1301,13 @@
                        /* option */ VerifyOption_G1UseNextMarking);
     }
     assert(!restart_for_overflow(), "sanity");
+    // Completely reset the marking state since marking completed
+    set_non_marking_state();
   }
 
-  // Reset the marking state if marking completed
-  if (!restart_for_overflow()) {
-    set_non_marking_state();
+  // Expand the marking stack, if we have to and if we can.
+  if (_markStack.should_expand()) {
+    _markStack.expand();
   }
 
 #if VERIFY_OBJS_PROCESSED
@@ -2785,7 +2925,7 @@
     // Verify entries on the task queues
     for (uint i = 0; i < _max_worker_id; i += 1) {
       cl.set_phase(VerifyNoCSetOopsQueues, i);
-      OopTaskQueue* queue = _task_queues->queue(i);
+      CMTaskQueue* queue = _task_queues->queue(i);
       queue->oops_do(&cl);
     }
   }
@@ -2839,22 +2979,6 @@
 }
 #endif // PRODUCT
 
-void ConcurrentMark::clear_marking_state(bool clear_overflow) {
-  _markStack.setEmpty();
-  _markStack.clear_overflow();
-  if (clear_overflow) {
-    clear_has_overflown();
-  } else {
-    assert(has_overflown(), "pre-condition");
-  }
-  _finger = _heap_start;
-
-  for (uint i = 0; i < _max_worker_id; ++i) {
-    OopTaskQueue* queue = _task_queues->queue(i);
-    queue->set_empty();
-  }
-}
-
 // Aggregate the counting data that was constructed concurrently
 // with marking.
 class AggregateCountDataHRClosure: public HeapRegionClosure {
@@ -3061,7 +3185,7 @@
   // Clear the liveness counting data
   clear_all_count_data();
   // Empty mark stack
-  clear_marking_state();
+  reset_marking_state();
   for (uint i = 0; i < _max_worker_id; ++i) {
     _tasks[i]->clear_region_fields();
   }
--- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -63,7 +63,7 @@
 
  public:
   // constructor
-  CMBitMapRO(ReservedSpace rs, int shifter);
+  CMBitMapRO(int shifter);
 
   enum { do_yield = true };
 
@@ -117,8 +117,11 @@
 
  public:
   // constructor
-  CMBitMap(ReservedSpace rs, int shifter) :
-    CMBitMapRO(rs, shifter) {}
+  CMBitMap(int shifter) :
+    CMBitMapRO(shifter) {}
+
+  // Allocates the back store for the marking bitmap
+  bool allocate(ReservedSpace heap_rs);
 
   // write marks
   void mark(HeapWord* addr) {
@@ -155,17 +158,18 @@
   MemRegion getAndClearMarkedRegion(HeapWord* addr, HeapWord* end_addr);
 };
 
-// Represents a marking stack used by the CM collector.
-// Ideally this should be GrowableArray<> just like MSC's marking stack(s).
+// Represents a marking stack used by ConcurrentMarking in the G1 collector.
 class CMMarkStack VALUE_OBJ_CLASS_SPEC {
+  VirtualSpace _virtual_space;   // Underlying backing store for actual stack
   ConcurrentMark* _cm;
   oop*   _base;        // bottom of stack
-  jint   _index;       // one more than last occupied index
-  jint   _capacity;    // max #elements
-  jint   _saved_index; // value of _index saved at start of GC
-  NOT_PRODUCT(jint _max_depth;)  // max depth plumbed during run
+  jint _index;       // one more than last occupied index
+  jint _capacity;    // max #elements
+  jint _saved_index; // value of _index saved at start of GC
+  NOT_PRODUCT(jint _max_depth;)   // max depth plumbed during run
 
-  bool   _overflow;
+  bool  _overflow;
+  bool  _should_expand;
   DEBUG_ONLY(bool _drain_in_progress;)
   DEBUG_ONLY(bool _drain_in_progress_yields;)
 
@@ -173,7 +177,13 @@
   CMMarkStack(ConcurrentMark* cm);
   ~CMMarkStack();
 
-  void allocate(size_t size);
+#ifndef PRODUCT
+  jint max_depth() const {
+    return _max_depth;
+  }
+#endif
+
+  bool allocate(size_t capacity);
 
   oop pop() {
     if (!isEmpty()) {
@@ -231,11 +241,17 @@
 
   bool isEmpty()    { return _index == 0; }
   bool isFull()     { return _index == _capacity; }
-  int maxElems()    { return _capacity; }
+  int  maxElems()   { return _capacity; }
 
   bool overflow() { return _overflow; }
   void clear_overflow() { _overflow = false; }
 
+  bool should_expand() const { return _should_expand; }
+  void set_should_expand();
+
+  // Expand the stack, typically in response to an overflow condition
+  void expand();
+
   int  size() { return _index; }
 
   void setEmpty()   { _index = 0; clear_overflow(); }
@@ -344,6 +360,7 @@
 class ConcurrentMarkThread;
 
 class ConcurrentMark: public CHeapObj<mtGC> {
+  friend class CMMarkStack;
   friend class ConcurrentMarkThread;
   friend class CMTask;
   friend class CMBitMapClosure;
@@ -461,15 +478,18 @@
   // It resets the global marking data structures, as well as the
   // task local ones; should be called during initial mark.
   void reset();
-  // It resets all the marking data structures.
-  void clear_marking_state(bool clear_overflow = true);
+
+  // Resets all the marking data structures. Called when we have to restart
+  // marking or when marking completes (via set_non_marking_state below).
+  void reset_marking_state(bool clear_overflow = true);
+
+  // We do this after we're done with marking so that the marking data
+  // structures are initialised to a sensible and predictable state.
+  void set_non_marking_state();
 
   // It should be called to indicate which phase we're in (concurrent
   // mark or remark) and how many threads are currently active.
   void set_phase(uint active_tasks, bool concurrent);
-  // We do this after we're done with marking so that the marking data
-  // structures are initialised to a sensible and predictable state.
-  void set_non_marking_state();
 
   // prints all gathered CM-related statistics
   void print_stats();
@@ -577,6 +597,9 @@
   // the card bitmaps.
   intptr_t _heap_bottom_card_num;
 
+  // Set to true when initialization is complete
+  bool _completed_initialization;
+
 public:
   // Manipulation of the global mark stack.
   // Notice that the first mark_stack_push is CAS-based, whereas the
@@ -636,7 +659,7 @@
     return _task_queues->steal(worker_id, hash_seed, obj);
   }
 
-  ConcurrentMark(ReservedSpace rs, uint max_regions);
+  ConcurrentMark(G1CollectedHeap* g1h, ReservedSpace heap_rs);
   ~ConcurrentMark();
 
   ConcurrentMarkThread* cmThread() { return _cmThread; }
@@ -907,6 +930,11 @@
   // Should *not* be called from parallel code.
   inline bool mark_and_count(oop obj);
 
+  // Returns true if initialization was successfully completed.
+  bool completed_initialization() const {
+    return _completed_initialization;
+  }
+
 protected:
   // Clear all the per-task bitmaps and arrays used to store the
   // counting data.
--- a/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -159,13 +159,11 @@
           VM_CGC_Operation op(&final_cl, verbose_str, true /* needs_pll */);
           VMThread::execute(&op);
         }
-        if (cm()->restart_for_overflow() &&
-            G1TraceMarkStackOverflow) {
-          gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
-                                 "in remark (restart #%d).", iter);
-        }
-
         if (cm()->restart_for_overflow()) {
+          if (G1TraceMarkStackOverflow) {
+            gclog_or_tty->print_cr("Restarting conc marking because of MS overflow "
+                                   "in remark (restart #%d).", iter);
+          }
           if (G1Log::fine()) {
             gclog_or_tty->date_stamp(PrintGCDateStamps);
             gclog_or_tty->stamp(PrintGCTimeStamps);
--- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -2079,7 +2079,11 @@
 
   // Create the ConcurrentMark data structure and thread.
   // (Must do this late, so that "max_regions" is defined.)
-  _cm       = new ConcurrentMark(heap_rs, max_regions());
+  _cm = new ConcurrentMark(this, heap_rs);
+  if (_cm == NULL || !_cm->completed_initialization()) {
+    vm_shutdown_during_initialization("Could not create/initialize ConcurrentMark");
+    return JNI_ENOMEM;
+  }
   _cmThread = _cm->cmThread();
 
   // Initialize the from_card cache structure of HeapRegionRemSet.
@@ -2087,7 +2091,7 @@
 
   // Now expand into the initial heap size.
   if (!expand(init_byte_size)) {
-    vm_exit_during_initialization("Failed to allocate initial heap.");
+    vm_shutdown_during_initialization("Failed to allocate initial heap.");
     return JNI_ENOMEM;
   }
 
@@ -3664,7 +3668,7 @@
   gclog_or_tty->stamp(PrintGCTimeStamps);
 
   GCCauseString gc_cause_str = GCCauseString("GC pause", gc_cause())
-    .append(g1_policy()->gcs_are_young() ? " (young)" : " (mixed)")
+    .append(g1_policy()->gcs_are_young() ? "(young)" : "(mixed)")
     .append(g1_policy()->during_initial_mark_pause() ? " (initial-mark)" : "");
 
   gclog_or_tty->print("[%s", (const char*)gc_cause_str);
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -309,9 +309,9 @@
 }
 
 G1YoungGenSizer::G1YoungGenSizer() : _sizer_kind(SizerDefaults), _adaptive_size(true) {
-  assert(G1DefaultMinNewGenPercent <= G1DefaultMaxNewGenPercent, "Min larger than max");
-  assert(G1DefaultMinNewGenPercent > 0 && G1DefaultMinNewGenPercent < 100, "Min out of bounds");
-  assert(G1DefaultMaxNewGenPercent > 0 && G1DefaultMaxNewGenPercent < 100, "Max out of bounds");
+  assert(G1NewSizePercent <= G1MaxNewSizePercent, "Min larger than max");
+  assert(G1NewSizePercent > 0 && G1NewSizePercent < 100, "Min out of bounds");
+  assert(G1MaxNewSizePercent > 0 && G1MaxNewSizePercent < 100, "Max out of bounds");
 
   if (FLAG_IS_CMDLINE(NewRatio)) {
     if (FLAG_IS_CMDLINE(NewSize) || FLAG_IS_CMDLINE(MaxNewSize)) {
@@ -344,12 +344,12 @@
 }
 
 uint G1YoungGenSizer::calculate_default_min_length(uint new_number_of_heap_regions) {
-  uint default_value = (new_number_of_heap_regions * G1DefaultMinNewGenPercent) / 100;
+  uint default_value = (new_number_of_heap_regions * G1NewSizePercent) / 100;
   return MAX2(1U, default_value);
 }
 
 uint G1YoungGenSizer::calculate_default_max_length(uint new_number_of_heap_regions) {
-  uint default_value = (new_number_of_heap_regions * G1DefaultMaxNewGenPercent) / 100;
+  uint default_value = (new_number_of_heap_regions * G1MaxNewSizePercent) / 100;
   return MAX2(1U, default_value);
 }
 
--- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -94,18 +94,18 @@
 // will occur.
 //
 // If nothing related to the the young gen size is set on the command
-// line we should allow the young gen to be between
-// G1DefaultMinNewGenPercent and G1DefaultMaxNewGenPercent of the
-// heap size. This means that every time the heap size changes the
-// limits for the young gen size will be updated.
+// line we should allow the young gen to be between G1NewSizePercent
+// and G1MaxNewSizePercent of the heap size. This means that every time
+// the heap size changes, the limits for the young gen size will be
+// recalculated.
 //
 // If only -XX:NewSize is set we should use the specified value as the
-// minimum size for young gen. Still using G1DefaultMaxNewGenPercent
-// of the heap as maximum.
+// minimum size for young gen. Still using G1MaxNewSizePercent of the
+// heap as maximum.
 //
 // If only -XX:MaxNewSize is set we should use the specified value as the
-// maximum size for young gen. Still using G1DefaultMinNewGenPercent
-// of the heap as minimum.
+// maximum size for young gen. Still using G1NewSizePercent of the heap
+// as minimum.
 //
 // If -XX:NewSize and -XX:MaxNewSize are both specified we use these values.
 // No updates when the heap size changes. There is a special case when
--- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -131,17 +131,23 @@
 
 #ifndef PRODUCT
 
+template <> const int WorkerDataArray<int>::_uninitialized = -1;
+template <> const double WorkerDataArray<double>::_uninitialized = -1.0;
+template <> const size_t WorkerDataArray<size_t>::_uninitialized = (size_t)-1;
+
 template <class T>
 void WorkerDataArray<T>::reset() {
   for (uint i = 0; i < _length; i++) {
-    _data[i] = (T)-1;
+    _data[i] = (T)_uninitialized;
   }
 }
 
 template <class T>
 void WorkerDataArray<T>::verify() {
   for (uint i = 0; i < _length; i++) {
-    assert(_data[i] >= (T)0, err_msg("Invalid data for worker %d", i));
+    assert(_data[i] != _uninitialized,
+        err_msg("Invalid data for worker " UINT32_FORMAT ", data: %lf, uninitialized: %lf",
+            i, (double)_data[i], (double)_uninitialized));
   }
 }
 
@@ -201,20 +207,20 @@
   _last_termination_attempts.verify();
   _last_gc_worker_end_times_ms.verify();
 
-    for (uint i = 0; i < _active_gc_threads; i++) {
-      double worker_time = _last_gc_worker_end_times_ms.get(i) - _last_gc_worker_start_times_ms.get(i);
-      _last_gc_worker_times_ms.set(i, worker_time);
+  for (uint i = 0; i < _active_gc_threads; i++) {
+    double worker_time = _last_gc_worker_end_times_ms.get(i) - _last_gc_worker_start_times_ms.get(i);
+    _last_gc_worker_times_ms.set(i, worker_time);
 
-      double worker_known_time = _last_ext_root_scan_times_ms.get(i) +
-        _last_satb_filtering_times_ms.get(i) +
-        _last_update_rs_times_ms.get(i) +
-        _last_scan_rs_times_ms.get(i) +
-        _last_obj_copy_times_ms.get(i) +
-        _last_termination_times_ms.get(i);
+    double worker_known_time = _last_ext_root_scan_times_ms.get(i) +
+      _last_satb_filtering_times_ms.get(i) +
+      _last_update_rs_times_ms.get(i) +
+      _last_scan_rs_times_ms.get(i) +
+      _last_obj_copy_times_ms.get(i) +
+      _last_termination_times_ms.get(i);
 
-      double worker_other_time = worker_time - worker_known_time;
-      _last_gc_worker_other_times_ms.set(i, worker_other_time);
-    }
+    double worker_other_time = worker_time - worker_known_time;
+    _last_gc_worker_other_times_ms.set(i, worker_other_time);
+  }
 
   _last_gc_worker_times_ms.verify();
   _last_gc_worker_other_times_ms.verify();
--- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -35,6 +35,8 @@
   const char* _print_format;
   bool        _print_sum;
 
+  NOT_PRODUCT(static const T _uninitialized;)
+
   // We are caching the sum and average to only have to calculate them once.
   // This is not done in an MT-safe way. It is intetened to allow single
   // threaded code to call sum() and average() multiple times in any order
--- a/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -282,10 +282,8 @@
       if (r->startsHumongous()) {
         // We must adjust the pointers on the single H object.
         oop obj = oop(r->bottom());
-        debug_only(GenMarkSweep::track_interior_pointers(obj));
         // point all the oops to the new location
         obj->adjust_pointers();
-        debug_only(GenMarkSweep::check_interior_pointers());
       }
     } else {
       // This really ought to be "as_CompactibleSpace"...
--- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -287,23 +287,24 @@
           "The number of times we'll force an overflow during "             \
           "concurrent marking")                                             \
                                                                             \
-  experimental(uintx, G1DefaultMinNewGenPercent, 20,                        \
-          "Percentage (0-100) of the heap size to use as minimum "          \
-          "young gen size.")                                                \
+  experimental(uintx, G1NewSizePercent, 5,                                  \
+          "Percentage (0-100) of the heap size to use as default "          \
+          "minimum young gen size.")                                        \
                                                                             \
-  experimental(uintx, G1DefaultMaxNewGenPercent, 80,                        \
-          "Percentage (0-100) of the heap size to use as maximum "          \
-          "young gen size.")                                                \
+  experimental(uintx, G1MaxNewSizePercent, 60,                              \
+          "Percentage (0-100) of the heap size to use as default "          \
+          " maximum young gen size.")                                       \
                                                                             \
-  experimental(uintx, G1OldCSetRegionLiveThresholdPercent, 90,              \
-          "Threshold for regions to be added to the collection set. "       \
-          "Regions with more live bytes than this will not be collected.")  \
+  experimental(uintx, G1MixedGCLiveThresholdPercent, 65,                    \
+          "Threshold for regions to be considered for inclusion in the "    \
+          "collection set of mixed GCs. "                                   \
+          "Regions with live bytes exceeding this will not be collected.")  \
                                                                             \
-  product(uintx, G1HeapWastePercent, 5,                                     \
+  product(uintx, G1HeapWastePercent, 10,                                    \
           "Amount of space, expressed as a percentage of the heap size, "   \
           "that G1 is willing not to collect to avoid expensive GCs.")      \
                                                                             \
-  product(uintx, G1MixedGCCountTarget, 4,                                   \
+  product(uintx, G1MixedGCCountTarget, 8,                                   \
           "The target number of mixed GCs after a marking cycle.")          \
                                                                             \
   experimental(uintx, G1OldCSetRegionThresholdPercent, 10,                  \
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -878,12 +878,6 @@
 
 bool ParNewGeneration::_avoid_promotion_undo = false;
 
-void ParNewGeneration::adjust_desired_tenuring_threshold() {
-  // Set the desired survivor size to half the real survivor space
-  _tenuring_threshold =
-    age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
-}
-
 // A Generation that does parallel young-gen collection.
 
 void ParNewGeneration::collect(bool   full,
@@ -1013,6 +1007,8 @@
     size_policy->reset_gc_overhead_limit_count();
 
     assert(to()->is_empty(), "to space should be empty now");
+
+    adjust_desired_tenuring_threshold();
   } else {
     assert(_promo_failure_scan_stack.is_empty(), "post condition");
     _promo_failure_scan_stack.clear(true); // Clear cached segments.
@@ -1035,7 +1031,6 @@
   from()->set_concurrent_iteration_safe_limit(from()->top());
   to()->set_concurrent_iteration_safe_limit(to()->top());
 
-  adjust_desired_tenuring_threshold();
   if (ResizePLAB) {
     plab_stats()->adjust_desired_plab_sz(n_workers);
   }
@@ -1623,7 +1618,3 @@
 const char* ParNewGeneration::name() const {
   return "par new generation";
 }
-
-bool ParNewGeneration::in_use() {
-  return UseParNewGC && ParallelGCThreads > 0;
-}
--- a/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -347,10 +347,6 @@
   bool survivor_overflow() { return _survivor_overflow; }
   void set_survivor_overflow(bool v) { _survivor_overflow = v; }
 
-  // Adjust the tenuring threshold.  See the implementation for
-  // the details of the policy.
-  virtual void adjust_desired_tenuring_threshold();
-
  public:
   ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level);
 
@@ -361,8 +357,6 @@
     delete _task_queues;
   }
 
-  static bool in_use();
-
   virtual void ref_processor_init();
   virtual Generation::Name kind()        { return Generation::ParNew; }
   virtual const char* name() const;
--- a/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/adjoiningVirtualSpaces.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "gc_implementation/parallelScavenge/adjoiningVirtualSpaces.hpp"
+#include "memory/allocation.inline.hpp"
 #include "runtime/java.hpp"
 
 AdjoiningVirtualSpaces::AdjoiningVirtualSpaces(ReservedSpace rs,
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweepDecorator.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -164,7 +164,6 @@
         start_array->allocate_block(compact_top);
       }
 
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), size));
       compact_top += size;
       assert(compact_top <= dest->space()->end(),
         "Exceeding space in destination");
@@ -225,7 +224,6 @@
             start_array->allocate_block(compact_top);
           }
 
-          VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(oop(q), sz));
           compact_top += sz;
           assert(compact_top <= dest->space()->end(),
             "Exceeding space in destination");
@@ -304,11 +302,8 @@
     HeapWord* end = _first_dead;
 
     while (q < end) {
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
       q += size;
     }
 
@@ -328,11 +323,8 @@
     Prefetch::write(q, interval);
     if (oop(q)->is_gc_marked()) {
       // q is alive
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
       debug_only(prev_q = q);
       q += size;
     } else {
@@ -366,7 +358,6 @@
     while (q < end) {
       size_t size = oop(q)->size();
       assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));
       debug_only(prev_q = q);
       q += size;
     }
@@ -401,7 +392,6 @@
       Prefetch::write(compaction_top, copy_interval);
 
       // copy object and reinit its mark
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, compaction_top));
       assert(q != compaction_top, "everything in this pass should be moving");
       Copy::aligned_conjoint_words(q, compaction_top, size);
       oop(compaction_top)->init_mark();
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -99,25 +99,6 @@
 bool   PSParallelCompact::_dwl_initialized = false;
 #endif  // #ifdef ASSERT
 
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>*   PSParallelCompact::_root_refs_stack = NULL;
-GrowableArray<oop> *    PSParallelCompact::_live_oops = NULL;
-GrowableArray<oop> *    PSParallelCompact::_live_oops_moved_to = NULL;
-GrowableArray<size_t>*  PSParallelCompact::_live_oops_size = NULL;
-size_t                  PSParallelCompact::_live_oops_index = 0;
-GrowableArray<void*>*   PSParallelCompact::_other_refs_stack = NULL;
-GrowableArray<void*>*   PSParallelCompact::_adjusted_pointers = NULL;
-bool                    PSParallelCompact::_pointer_tracking = false;
-bool                    PSParallelCompact::_root_tracking = true;
-
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * PSParallelCompact::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* PSParallelCompact::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * PSParallelCompact::_last_gc_live_oops_size = NULL;
-#endif
-
 void SplitInfo::record(size_t src_region_idx, size_t partial_obj_size,
                        HeapWord* destination)
 {
@@ -2715,151 +2696,6 @@
 }
 #endif  // #ifdef ASSERT
 
-
-#ifdef VALIDATE_MARK_SWEEP
-
-void PSParallelCompact::track_adjusted_pointer(void* p, bool isroot) {
-  if (!ValidateMarkSweep)
-    return;
-
-  if (!isroot) {
-    if (_pointer_tracking) {
-      guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
-      _adjusted_pointers->remove(p);
-    }
-  } else {
-    ptrdiff_t index = _root_refs_stack->find(p);
-    if (index != -1) {
-      int l = _root_refs_stack->length();
-      if (l > 0 && l - 1 != index) {
-        void* last = _root_refs_stack->pop();
-        assert(last != p, "should be different");
-        _root_refs_stack->at_put(index, last);
-      } else {
-        _root_refs_stack->remove(p);
-      }
-    }
-  }
-}
-
-
-void PSParallelCompact::check_adjust_pointer(void* p) {
-  _adjusted_pointers->push(p);
-}
-
-
-class AdjusterTracker: public OopClosure {
- public:
-  AdjusterTracker() {};
-  void do_oop(oop* o)         { PSParallelCompact::check_adjust_pointer(o); }
-  void do_oop(narrowOop* o)   { PSParallelCompact::check_adjust_pointer(o); }
-};
-
-
-void PSParallelCompact::track_interior_pointers(oop obj) {
-  if (ValidateMarkSweep) {
-    _adjusted_pointers->clear();
-    _pointer_tracking = true;
-
-    AdjusterTracker checker;
-    obj->oop_iterate_no_header(&checker);
-  }
-}
-
-
-void PSParallelCompact::check_interior_pointers() {
-  if (ValidateMarkSweep) {
-    _pointer_tracking = false;
-    guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
-  }
-}
-
-
-void PSParallelCompact::reset_live_oop_tracking() {
-  if (ValidateMarkSweep) {
-    guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
-    _live_oops_index = 0;
-  }
-}
-
-
-void PSParallelCompact::register_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    _live_oops->push(p);
-    _live_oops_size->push(size);
-    _live_oops_index++;
-  }
-}
-
-void PSParallelCompact::validate_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    oop obj = _live_oops->at((int)_live_oops_index);
-    guarantee(obj == p, "should be the same object");
-    guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
-    _live_oops_index++;
-  }
-}
-
-void PSParallelCompact::live_oop_moved_to(HeapWord* q, size_t size,
-                                  HeapWord* compaction_top) {
-  assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
-         "should be moved to forwarded location");
-  if (ValidateMarkSweep) {
-    PSParallelCompact::validate_live_oop(oop(q), size);
-    _live_oops_moved_to->push(oop(compaction_top));
-  }
-  if (RecordMarkSweepCompaction) {
-    _cur_gc_live_oops->push(q);
-    _cur_gc_live_oops_moved_to->push(compaction_top);
-    _cur_gc_live_oops_size->push(size);
-  }
-}
-
-
-void PSParallelCompact::compaction_complete() {
-  if (RecordMarkSweepCompaction) {
-    GrowableArray<HeapWord*>* _tmp_live_oops          = _cur_gc_live_oops;
-    GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
-    GrowableArray<size_t>   * _tmp_live_oops_size     = _cur_gc_live_oops_size;
-
-    _cur_gc_live_oops           = _last_gc_live_oops;
-    _cur_gc_live_oops_moved_to  = _last_gc_live_oops_moved_to;
-    _cur_gc_live_oops_size      = _last_gc_live_oops_size;
-    _last_gc_live_oops          = _tmp_live_oops;
-    _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
-    _last_gc_live_oops_size     = _tmp_live_oops_size;
-  }
-}
-
-
-void PSParallelCompact::print_new_location_of_heap_address(HeapWord* q) {
-  if (!RecordMarkSweepCompaction) {
-    tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
-    return;
-  }
-
-  if (_last_gc_live_oops == NULL) {
-    tty->print_cr("No compaction information gathered yet");
-    return;
-  }
-
-  for (int i = 0; i < _last_gc_live_oops->length(); i++) {
-    HeapWord* old_oop = _last_gc_live_oops->at(i);
-    size_t    sz      = _last_gc_live_oops_size->at(i);
-    if (old_oop <= q && q < (old_oop + sz)) {
-      HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
-      size_t offset = (q - old_oop);
-      tty->print_cr("Address " PTR_FORMAT, q);
-      tty->print_cr(" Was in oop " PTR_FORMAT ", size %d, at offset %d", old_oop, sz, offset);
-      tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
-      return;
-    }
-  }
-
-  tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
 // Update interior oops in the ranges of regions [beg_region, end_region).
 void
 PSParallelCompact::update_and_deadwood_in_dense_prefix(ParCompactionManager* cm,
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1006,34 +1006,6 @@
   // Reset time since last full gc
   static void reset_millis_since_last_gc();
 
- protected:
-#ifdef VALIDATE_MARK_SWEEP
-  static GrowableArray<void*>*           _root_refs_stack;
-  static GrowableArray<oop> *            _live_oops;
-  static GrowableArray<oop> *            _live_oops_moved_to;
-  static GrowableArray<size_t>*          _live_oops_size;
-  static size_t                          _live_oops_index;
-  static size_t                          _live_oops_index_at_perm;
-  static GrowableArray<void*>*           _other_refs_stack;
-  static GrowableArray<void*>*           _adjusted_pointers;
-  static bool                            _pointer_tracking;
-  static bool                            _root_tracking;
-
-  // The following arrays are saved since the time of the last GC and
-  // assist in tracking down problems where someone has done an errant
-  // store into the heap, usually to an oop that wasn't properly
-  // handleized across a GC. If we crash or otherwise fail before the
-  // next GC, we can query these arrays to find out the object we had
-  // intended to do the store to (assuming it is still alive) and the
-  // offset within that object. Covered under RecordMarkSweepCompaction.
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _cur_gc_live_oops_size;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _last_gc_live_oops_size;
-#endif
-
  public:
   class MarkAndPushClosure: public OopClosure {
    private:
@@ -1191,25 +1163,6 @@
   // Time since last full gc (in milliseconds).
   static jlong millis_since_last_gc();
 
-#ifdef VALIDATE_MARK_SWEEP
-  static void track_adjusted_pointer(void* p, bool isroot);
-  static void check_adjust_pointer(void* p);
-  static void track_interior_pointers(oop obj);
-  static void check_interior_pointers();
-
-  static void reset_live_oop_tracking();
-  static void register_live_oop(oop p, size_t size);
-  static void validate_live_oop(oop p, size_t size);
-  static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
-  static void compaction_complete();
-
-  // Querying operation of RecordMarkSweepCompaction results.
-  // Finds and prints the current base oop and offset for a word
-  // within an oop that was live during the last GC. Helpful for
-  // tracking down heap stomps.
-  static void print_new_location_of_heap_address(HeapWord* q);
-#endif  // #ifdef VALIDATE_MARK_SWEEP
-
 #ifndef PRODUCT
   // Debugging support.
   static const char* space_names[last_space_id];
@@ -1250,12 +1203,7 @@
 inline void PSParallelCompact::follow_root(ParCompactionManager* cm, T* p) {
   assert(!Universe::heap()->is_in_reserved(p),
          "roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    guarantee(!_root_refs_stack->contains(p), "should only be in here once");
-    _root_refs_stack->push(p);
-  }
-#endif
+
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -1294,20 +1242,10 @@
       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
     }
   }
-  VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
 }
 
 template <class T>
 inline void PSParallelCompact::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    if (!Universe::heap()->is_in_reserved(p)) {
-      _root_refs_stack->push(p);
-    } else {
-      _other_refs_stack->push(p);
-    }
-  }
-#endif
   mark_and_push(_compaction_manager, p);
 }
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -529,7 +529,7 @@
 
        if (PrintTenuringDistribution) {
          gclog_or_tty->cr();
-         gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %u (max %u)",
+         gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
                                 size_policy->calculated_survivor_size_in_bytes(),
                                 _tenuring_threshold, MaxTenuringThreshold);
        }
--- a/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/parallelScavenge/psYoungGen.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -808,8 +808,9 @@
   st->print("  to  "); to_space()->print_on(st);
 }
 
+// Note that a space is not printed before the [NAME:
 void PSYoungGen::print_used_change(size_t prev_used) const {
-  gclog_or_tty->print(" [%s:", name());
+  gclog_or_tty->print("[%s:", name());
   gclog_or_tty->print(" "  SIZE_FORMAT "K"
                       "->" SIZE_FORMAT "K"
                       "("  SIZE_FORMAT "K)",
--- a/src/share/vm/gc_implementation/shared/ageTable.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/ageTable.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -96,7 +96,7 @@
 
     if (PrintTenuringDistribution) {
       gclog_or_tty->cr();
-      gclog_or_tty->print_cr("Desired survivor size %ld bytes, new threshold %u (max %u)",
+      gclog_or_tty->print_cr("Desired survivor size " SIZE_FORMAT " bytes, new threshold %u (max %u)",
         desired_survivor_size*oopSize, result, MaxTenuringThreshold);
     }
 
--- a/src/share/vm/gc_implementation/shared/gcStats.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/gcStats.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc_implementation/shared/gcStats.hpp"
 #include "gc_implementation/shared/gcUtil.hpp"
+#include "memory/allocation.inline.hpp"
 
 GCStats::GCStats() {
     _avg_promoted       = new AdaptivePaddedNoZeroDevAverage(
--- a/src/share/vm/gc_implementation/shared/markSweep.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/markSweep.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -42,26 +42,6 @@
 PreservedMark*          MarkSweep::_preserved_marks = NULL;
 ReferenceProcessor*     MarkSweep::_ref_processor   = NULL;
 
-#ifdef VALIDATE_MARK_SWEEP
-GrowableArray<void*>*   MarkSweep::_root_refs_stack = NULL;
-GrowableArray<oop> *    MarkSweep::_live_oops = NULL;
-GrowableArray<oop> *    MarkSweep::_live_oops_moved_to = NULL;
-GrowableArray<size_t>*  MarkSweep::_live_oops_size = NULL;
-size_t                  MarkSweep::_live_oops_index = 0;
-size_t                  MarkSweep::_live_oops_index_at_perm = 0;
-GrowableArray<void*>*   MarkSweep::_other_refs_stack = NULL;
-GrowableArray<void*>*   MarkSweep::_adjusted_pointers = NULL;
-bool                         MarkSweep::_pointer_tracking = false;
-bool                         MarkSweep::_root_tracking = true;
-
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_cur_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * MarkSweep::_cur_gc_live_oops_size = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops = NULL;
-GrowableArray<HeapWord*>* MarkSweep::_last_gc_live_oops_moved_to = NULL;
-GrowableArray<size_t>   * MarkSweep::_last_gc_live_oops_size = NULL;
-#endif
-
 MarkSweep::FollowRootClosure  MarkSweep::follow_root_closure;
 CodeBlobToOopClosure MarkSweep::follow_code_root_closure(&MarkSweep::follow_root_closure, /*do_marking=*/ true);
 
@@ -185,142 +165,6 @@
   }
 }
 
-#ifdef VALIDATE_MARK_SWEEP
-
-void MarkSweep::track_adjusted_pointer(void* p, bool isroot) {
-  if (!ValidateMarkSweep)
-    return;
-
-  if (!isroot) {
-    if (_pointer_tracking) {
-      guarantee(_adjusted_pointers->contains(p), "should have seen this pointer");
-      _adjusted_pointers->remove(p);
-    }
-  } else {
-    ptrdiff_t index = _root_refs_stack->find(p);
-    if (index != -1) {
-      int l = _root_refs_stack->length();
-      if (l > 0 && l - 1 != index) {
-        void* last = _root_refs_stack->pop();
-        assert(last != p, "should be different");
-        _root_refs_stack->at_put(index, last);
-      } else {
-        _root_refs_stack->remove(p);
-      }
-    }
-  }
-}
-
-void MarkSweep::check_adjust_pointer(void* p) {
-  _adjusted_pointers->push(p);
-}
-
-class AdjusterTracker: public OopClosure {
- public:
-  AdjusterTracker() {}
-  void do_oop(oop* o)       { MarkSweep::check_adjust_pointer(o); }
-  void do_oop(narrowOop* o) { MarkSweep::check_adjust_pointer(o); }
-};
-
-void MarkSweep::track_interior_pointers(oop obj) {
-  if (ValidateMarkSweep) {
-    _adjusted_pointers->clear();
-    _pointer_tracking = true;
-
-    AdjusterTracker checker;
-    obj->oop_iterate_no_header(&checker);
-  }
-}
-
-void MarkSweep::check_interior_pointers() {
-  if (ValidateMarkSweep) {
-    _pointer_tracking = false;
-    guarantee(_adjusted_pointers->length() == 0, "should have processed the same pointers");
-  }
-}
-
-void MarkSweep::reset_live_oop_tracking() {
-  if (ValidateMarkSweep) {
-    guarantee((size_t)_live_oops->length() == _live_oops_index, "should be at end of live oops");
-    _live_oops_index = 0;
-  }
-}
-
-void MarkSweep::register_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    _live_oops->push(p);
-    _live_oops_size->push(size);
-    _live_oops_index++;
-  }
-}
-
-void MarkSweep::validate_live_oop(oop p, size_t size) {
-  if (ValidateMarkSweep) {
-    oop obj = _live_oops->at((int)_live_oops_index);
-    guarantee(obj == p, "should be the same object");
-    guarantee(_live_oops_size->at((int)_live_oops_index) == size, "should be the same size");
-    _live_oops_index++;
-  }
-}
-
-void MarkSweep::live_oop_moved_to(HeapWord* q, size_t size,
-                                  HeapWord* compaction_top) {
-  assert(oop(q)->forwardee() == NULL || oop(q)->forwardee() == oop(compaction_top),
-         "should be moved to forwarded location");
-  if (ValidateMarkSweep) {
-    MarkSweep::validate_live_oop(oop(q), size);
-    _live_oops_moved_to->push(oop(compaction_top));
-  }
-  if (RecordMarkSweepCompaction) {
-    _cur_gc_live_oops->push(q);
-    _cur_gc_live_oops_moved_to->push(compaction_top);
-    _cur_gc_live_oops_size->push(size);
-  }
-}
-
-void MarkSweep::compaction_complete() {
-  if (RecordMarkSweepCompaction) {
-    GrowableArray<HeapWord*>* _tmp_live_oops          = _cur_gc_live_oops;
-    GrowableArray<HeapWord*>* _tmp_live_oops_moved_to = _cur_gc_live_oops_moved_to;
-    GrowableArray<size_t>   * _tmp_live_oops_size     = _cur_gc_live_oops_size;
-
-    _cur_gc_live_oops           = _last_gc_live_oops;
-    _cur_gc_live_oops_moved_to  = _last_gc_live_oops_moved_to;
-    _cur_gc_live_oops_size      = _last_gc_live_oops_size;
-    _last_gc_live_oops          = _tmp_live_oops;
-    _last_gc_live_oops_moved_to = _tmp_live_oops_moved_to;
-    _last_gc_live_oops_size     = _tmp_live_oops_size;
-  }
-}
-
-void MarkSweep::print_new_location_of_heap_address(HeapWord* q) {
-  if (!RecordMarkSweepCompaction) {
-    tty->print_cr("Requires RecordMarkSweepCompaction to be enabled");
-    return;
-  }
-
-  if (_last_gc_live_oops == NULL) {
-    tty->print_cr("No compaction information gathered yet");
-    return;
-  }
-
-  for (int i = 0; i < _last_gc_live_oops->length(); i++) {
-    HeapWord* old_oop = _last_gc_live_oops->at(i);
-    size_t    sz      = _last_gc_live_oops_size->at(i);
-    if (old_oop <= q && q < (old_oop + sz)) {
-      HeapWord* new_oop = _last_gc_live_oops_moved_to->at(i);
-      size_t offset = (q - old_oop);
-      tty->print_cr("Address " PTR_FORMAT, q);
-      tty->print_cr(" Was in oop " PTR_FORMAT ", size " SIZE_FORMAT ", at offset " SIZE_FORMAT, old_oop, sz, offset);
-      tty->print_cr(" Now in oop " PTR_FORMAT ", actual address " PTR_FORMAT, new_oop, new_oop + offset);
-      return;
-    }
-  }
-
-  tty->print_cr("Address " PTR_FORMAT " not found in live oop information from last GC", q);
-}
-#endif //VALIDATE_MARK_SWEEP
-
 MarkSweep::IsAliveClosure   MarkSweep::is_alive;
 
 void MarkSweep::IsAliveClosure::do_object(oop p)   { ShouldNotReachHere(); }
--- a/src/share/vm/gc_implementation/shared/markSweep.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/markSweep.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -44,21 +44,6 @@
 //
 // Class unloading will only occur when a full gc is invoked.
 
-// If VALIDATE_MARK_SWEEP is defined, the -XX:+ValidateMarkSweep flag will
-// be operational, and will provide slow but comprehensive self-checks within
-// the GC.  This is not enabled by default in product or release builds,
-// since the extra call to track_adjusted_pointer() in _adjust_pointer()
-// would be too much overhead, and would disturb performance measurement.
-// However, debug builds are sometimes way too slow to run GC tests!
-#ifdef ASSERT
-#define VALIDATE_MARK_SWEEP 1
-#endif
-#ifdef VALIDATE_MARK_SWEEP
-#define VALIDATE_MARK_SWEEP_ONLY(code) code
-#else
-#define VALIDATE_MARK_SWEEP_ONLY(code)
-#endif
-
 // declared at end
 class PreservedMark;
 
@@ -147,33 +132,6 @@
   // Reference processing (used in ...follow_contents)
   static ReferenceProcessor*             _ref_processor;
 
-#ifdef VALIDATE_MARK_SWEEP
-  static GrowableArray<void*>*           _root_refs_stack;
-  static GrowableArray<oop> *            _live_oops;
-  static GrowableArray<oop> *            _live_oops_moved_to;
-  static GrowableArray<size_t>*          _live_oops_size;
-  static size_t                          _live_oops_index;
-  static size_t                          _live_oops_index_at_perm;
-  static GrowableArray<void*>*           _other_refs_stack;
-  static GrowableArray<void*>*           _adjusted_pointers;
-  static bool                            _pointer_tracking;
-  static bool                            _root_tracking;
-
-  // The following arrays are saved since the time of the last GC and
-  // assist in tracking down problems where someone has done an errant
-  // store into the heap, usually to an oop that wasn't properly
-  // handleized across a GC. If we crash or otherwise fail before the
-  // next GC, we can query these arrays to find out the object we had
-  // intended to do the store to (assuming it is still alive) and the
-  // offset within that object. Covered under RecordMarkSweepCompaction.
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _cur_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _cur_gc_live_oops_size;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops;
-  static GrowableArray<HeapWord*> *      _last_gc_live_oops_moved_to;
-  static GrowableArray<size_t>*          _last_gc_live_oops_size;
-#endif
-
   // Non public closures
   static KeepAliveClosure keep_alive;
 
@@ -227,24 +185,6 @@
   static void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
   static void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
 
-#ifdef VALIDATE_MARK_SWEEP
-  static void track_adjusted_pointer(void* p, bool isroot);
-  static void check_adjust_pointer(void* p);
-  static void track_interior_pointers(oop obj);
-  static void check_interior_pointers();
-
-  static void reset_live_oop_tracking();
-  static void register_live_oop(oop p, size_t size);
-  static void validate_live_oop(oop p, size_t size);
-  static void live_oop_moved_to(HeapWord* q, size_t size, HeapWord* compaction_top);
-  static void compaction_complete();
-
-  // Querying operation of RecordMarkSweepCompaction results.
-  // Finds and prints the current base oop and offset for a word
-  // within an oop that was live during the last GC. Helpful for
-  // tracking down heap stomps.
-  static void print_new_location_of_heap_address(HeapWord* q);
-#endif
 };
 
 class PreservedMark VALUE_OBJ_CLASS_SPEC {
--- a/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_implementation/shared/markSweep.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -46,12 +46,6 @@
 template <class T> inline void MarkSweep::follow_root(T* p) {
   assert(!Universe::heap()->is_in_reserved(p),
          "roots shouldn't be things within the heap");
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    guarantee(!_root_refs_stack->contains(p), "should only be in here once");
-    _root_refs_stack->push(p);
-  }
-#endif
   T heap_oop = oopDesc::load_heap_oop(p);
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
@@ -97,19 +91,9 @@
       oopDesc::encode_store_heap_oop_not_null(p, new_obj);
     }
   }
-  VALIDATE_MARK_SWEEP_ONLY(track_adjusted_pointer(p, isroot));
 }
 
 template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    if (!Universe::heap()->is_in_reserved(p)) {
-      _root_refs_stack->push(p);
-    } else {
-      _other_refs_stack->push(p);
-    }
-  }
-#endif
   mark_and_push(p);
 }
 
--- a/src/share/vm/gc_interface/gcCause.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/gc_interface/gcCause.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -99,9 +99,9 @@
  public:
    GCCauseString(const char* prefix, GCCause::Cause cause) {
      if (PrintGCCause) {
-      _position = jio_snprintf(_buffer, _length, "%s (%s)", prefix, GCCause::to_string(cause));
+      _position = jio_snprintf(_buffer, _length, "%s (%s) ", prefix, GCCause::to_string(cause));
      } else {
-      _position = jio_snprintf(_buffer, _length, "%s", prefix);
+      _position = jio_snprintf(_buffer, _length, "%s ", prefix);
      }
      assert(_position >= 0 && _position <= _length,
        err_msg("Need to increase the buffer size in GCCauseString? %d", _position));
--- a/src/share/vm/graal/graalCompiler.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/graal/graalCompiler.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,7 @@
   static GraalCompiler* instance() { return _instance; }
 
 
-  virtual const char* name() { return "G"; }
+  virtual const char* name() { return "Graal"; }
 
   virtual bool supports_native()                 { return true; }
   virtual bool supports_osr   ()                 { return true; }
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -607,6 +607,7 @@
   set_boolean("windowsOs", false);
 #endif
   set_boolean("verifyOops", VerifyOops);
+  set_boolean("ciTime", CITime);
   set_boolean("useFastLocking", GraalUseFastLocking);
   set_boolean("useBiasedLocking", UseBiasedLocking);
   set_boolean("usePopCountInstruction", UsePopCountInstruction);
@@ -636,7 +637,7 @@
   set_int("ageMaskInPlace", (int) markOopDesc::age_mask_in_place);
   set_int("epochMaskInPlace", (int) markOopDesc::epoch_mask_in_place);
   set_int("biasedLockPattern", (int) markOopDesc::biased_lock_pattern);
-  set_int("methodMaxLocalsOffset", in_bytes(Method::size_of_locals_offset()));
+  set_int("methodMaxLocalsOffset", in_bytes(ConstMethod::size_of_locals_offset()));
   set_int("methodConstMethodOffset", in_bytes(Method::const_offset()));
   set_int("constMethodMaxStackOffset", in_bytes(ConstMethod::max_stack_offset()));
   set_int("extraStackEntries", Method::extra_stack_entries());
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -417,7 +417,7 @@
 
     // exception handler lookup
     KlassHandle h_klass(THREAD, h_exception->klass());
-    handler_bci = h_method->fast_exception_handler_bci_for(h_klass, current_bci, THREAD);
+    handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       // We threw an exception while trying to find the exception handler.
       // Transfer the new exception to the exception handle which will
--- a/src/share/vm/interpreter/rewriter.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/interpreter/rewriter.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -27,13 +27,8 @@
 #include "interpreter/interpreter.hpp"
 #include "interpreter/rewriter.hpp"
 #include "memory/gcLocker.hpp"
-#include "memory/metadataFactory.hpp"
-#include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/generateOopMap.hpp"
-#include "oops/objArrayOop.hpp"
-#include "oops/oop.inline.hpp"
-#include "prims/methodComparator.hpp"
 #include "prims/methodHandles.hpp"
 
 // Computes a CPC map (new_index -> original_index) for constant pool entries
@@ -404,13 +399,6 @@
 }
 
 
-void Rewriter::rewrite(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS) {
-  ResourceMark rm(THREAD);
-  Rewriter     rw(klass, cpool, methods, CHECK);
-  // (That's all, folks.)
-}
-
-
 Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS)
   : _klass(klass),
     _pool(cpool),
@@ -455,46 +443,25 @@
     restore_bytecodes();
     return;
   }
-}
 
-// Relocate jsr/rets in a method.  This can't be done with the rewriter
-// stage because it can throw other exceptions, leaving the bytecodes
-// pointing at constant pool cache entries.
-// Link and check jvmti dependencies while we're iterating over the methods.
-// JSR292 code calls with a different set of methods, so two entry points.
-void Rewriter::relocate_and_link(instanceKlassHandle this_oop, TRAPS) {
-  relocate_and_link(this_oop, this_oop->methods(), THREAD);
-}
-
-void Rewriter::relocate_and_link(instanceKlassHandle this_oop,
-                                 Array<Method*>* methods, TRAPS) {
-  int len = methods->length();
+  // Relocate after everything, but still do this under the is_rewritten flag,
+  // so methods with jsrs in custom class lists in aren't attempted to be
+  // rewritten in the RO section of the shared archive.
+  // Relocated bytecodes don't have to be restored, only the cp cache entries
   for (int i = len-1; i >= 0; i--) {
-    methodHandle m(THREAD, methods->at(i));
+    methodHandle m(THREAD, _methods->at(i));
 
     if (m->has_jsrs()) {
-      m = rewrite_jsrs(m, CHECK);
+      m = rewrite_jsrs(m, THREAD);
+      // Restore bytecodes to their unrewritten state if there are exceptions
+      // relocating bytecodes.  If some are relocated, that is ok because that
+      // doesn't affect constant pool to cpCache rewriting.
+      if (HAS_PENDING_EXCEPTION) {
+        restore_bytecodes();
+        return;
+      }
       // Method might have gotten rewritten.
       methods->at_put(i, m());
     }
-
-    // Set up method entry points for compiler and interpreter    .
-    m->link_method(m, CHECK);
-
-    // This is for JVMTI and unrelated to relocator but the last thing we do
-#ifdef ASSERT
-    if (StressMethodComparator) {
-      static int nmc = 0;
-      for (int j = i; j >= 0 && j >= i-4; j--) {
-        if ((++nmc % 1000) == 0)  tty->print_cr("Have run MethodComparator %d times...", nmc);
-        bool z = MethodComparator::methods_EMCP(m(),
-                   methods->at(j));
-        if (j == i && !z) {
-          tty->print("MethodComparator FAIL: "); m->print(); m->print_codes();
-          assert(z, "method must compare equal to itself");
-        }
-      }
-    }
-#endif //ASSERT
   }
 }
--- a/src/share/vm/interpreter/rewriter.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/interpreter/rewriter.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -158,14 +158,6 @@
  public:
   // Driver routine:
   static void rewrite(instanceKlassHandle klass, TRAPS);
-  static void rewrite(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS);
-
-  // Second pass, not gated by is_rewritten flag
-  static void relocate_and_link(instanceKlassHandle klass, TRAPS);
-  // JSR292 version to call with it's own methods.
-  static void relocate_and_link(instanceKlassHandle klass,
-                                Array<Method*>* methods, TRAPS);
-
 };
 
 #endif // SHARE_VM_INTERPRETER_REWRITER_HPP
--- a/src/share/vm/memory/allocation.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/allocation.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -205,7 +205,7 @@
 // Calling new or delete will result in fatal error.
 
 class StackObj ALLOCATION_SUPER_CLASS_SPEC {
- public:
+ private:
   void* operator new(size_t size);
   void  operator delete(void* p);
 };
@@ -229,7 +229,7 @@
 // be defined as a an empty string "".
 //
 class _ValueObj {
- public:
+ private:
   void* operator new(size_t size);
   void operator delete(void* p);
 };
--- a/src/share/vm/memory/binaryTreeDictionary.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/binaryTreeDictionary.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -67,7 +67,8 @@
 }
 
 template <class Chunk_t, template <class> class FreeList_t>
-TreeList<Chunk_t, FreeList_t>::TreeList() {}
+TreeList<Chunk_t, FreeList_t>::TreeList() : _parent(NULL),
+  _left(NULL), _right(NULL) {}
 
 template <class Chunk_t, template <class> class FreeList_t>
 TreeList<Chunk_t, FreeList_t>*
@@ -82,7 +83,7 @@
   tl->link_head(tc);
   tl->link_tail(tc);
   tl->set_count(1);
-
+  assert(tl->parent() == NULL, "Should be clear");
   return tl;
 }
 
--- a/src/share/vm/memory/collectorPolicy.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/collectorPolicy.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -777,6 +777,15 @@
                                        full_gc_count,
                                        GCCause::_metadata_GC_threshold);
     VMThread::execute(&op);
+
+    // If GC was locked out, try again.  Check
+    // before checking success because the prologue
+    // could have succeeded and the GC still have
+    // been locked out.
+    if (op.gc_locked()) {
+      continue;
+    }
+
     if (op.prologue_succeeded()) {
       return op.result();
     }
@@ -818,7 +827,7 @@
   if (_generations == NULL)
     vm_exit_during_initialization("Unable to allocate gen spec");
 
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     _generations[0] = new GenerationSpec(Generation::ParNew, _initial_gen0_size, _max_gen0_size);
   } else {
     _generations[0] = new GenerationSpec(Generation::DefNew, _initial_gen0_size, _max_gen0_size);
@@ -831,10 +840,9 @@
 
 void MarkSweepPolicy::initialize_gc_policy_counters() {
   // initialize the policy counters - 2 collectors, 3 generations
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     _gc_policy_counters = new GCPolicyCounters("ParNew:MSC", 2, 3);
-  }
-  else {
+  } else {
     _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
   }
 }
--- a/src/share/vm/memory/defNewGeneration.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/defNewGeneration.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -550,6 +550,11 @@
   return allocate(size, is_tlab);
 }
 
+void DefNewGeneration::adjust_desired_tenuring_threshold() {
+  // Set the desired survivor size to half the real survivor space
+  _tenuring_threshold =
+    age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
+}
 
 void DefNewGeneration::collect(bool   full,
                                bool   clear_all_soft_refs,
@@ -649,9 +654,7 @@
 
     assert(to()->is_empty(), "to space should be empty now");
 
-    // Set the desired survivor size to half the real survivor space
-    _tenuring_threshold =
-      age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
+    adjust_desired_tenuring_threshold();
 
     // A successful scavenge should restart the GC time limit count which is
     // for full GC's.
--- a/src/share/vm/memory/defNewGeneration.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/defNewGeneration.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -124,7 +124,9 @@
     _should_allocate_from_space = true;
   }
 
- protected:
+  // Tenuring
+  void adjust_desired_tenuring_threshold();
+
   // Spaces
   EdenSpace*       _eden_space;
   ContiguousSpace* _from_space;
--- a/src/share/vm/memory/filemap.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/filemap.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -119,6 +119,7 @@
   _header._magic = 0xf00baba2;
   _header._version = _current_version;
   _header._alignment = alignment;
+  _header._obj_alignment = ObjectAlignmentInBytes;
 
   // The following fields are for sanity checks for whether this archive
   // will function correctly with this JVM and the bootclasspath it's
@@ -211,7 +212,11 @@
 
   // Remove the existing file in case another process has it open.
   remove(_full_path);
+#ifdef _WINDOWS  // if 0444 is used on Windows, then remove() will fail.
+  int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0744);
+#else
   int fd = open(_full_path, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0444);
+#endif
   if (fd < 0) {
     fail_stop("Unable to create shared archive file %s.", _full_path);
   }
@@ -370,9 +375,8 @@
     return rs;
   }
   // the reserved virtual memory is for mapping class data sharing archive
-  if (MemTracker::is_on()) {
-    MemTracker::record_virtual_memory_type((address)rs.base(), mtClassShared);
-  }
+  MemTracker::record_virtual_memory_type((address)rs.base(), mtClassShared);
+
   return rs;
 }
 
@@ -394,6 +398,11 @@
     fail_continue(err_msg("Unable to map %s shared space at required address.", shared_region_name[i]));
     return NULL;
   }
+#ifdef _WINDOWS
+  // This call is Windows-only because the memory_type gets recorded for the other platforms
+  // in method FileMapInfo::reserve_shared_memory(), which is not called on Windows.
+  MemTracker::record_virtual_memory_type((address)base, mtClassShared);
+#endif
   return base;
 }
 
@@ -465,6 +474,12 @@
                   " version or build of HotSpot.");
     return false;
   }
+  if (_header._obj_alignment != ObjectAlignmentInBytes) {
+    fail_continue("The shared archive file's ObjectAlignmentInBytes of %d"
+                  " does not equal the current ObjectAlignmentInBytes of %d.",
+                  _header._obj_alignment, ObjectAlignmentInBytes);
+    return false;
+  }
 
   // Cannot verify interpreter yet, as it can only be created after the GC
   // heap has been initialized.
--- a/src/share/vm/memory/filemap.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/filemap.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -63,6 +63,7 @@
     int    _magic;                    // identify file type.
     int    _version;                  // (from enum, above.)
     size_t _alignment;                // how shared archive should be aligned
+    int    _obj_alignment;            // value of ObjectAlignmentInBytes
 
     struct space_info {
       int    _file_offset;   // sizeof(this) rounded to vm page size
--- a/src/share/vm/memory/genMarkSweep.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/genMarkSweep.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -100,21 +100,8 @@
 
   mark_sweep_phase3(level);
 
-  VALIDATE_MARK_SWEEP_ONLY(
-    if (ValidateMarkSweep) {
-      guarantee(_root_refs_stack->length() == 0, "should be empty by now");
-    }
-  )
-
   mark_sweep_phase4();
 
-  VALIDATE_MARK_SWEEP_ONLY(
-    if (ValidateMarkSweep) {
-      guarantee(_live_oops->length() == _live_oops_moved_to->length(),
-                "should be the same size");
-    }
-  )
-
   restore_marks();
 
   // Set saved marks for allocation profiler (and other things? -- dld)
@@ -187,31 +174,6 @@
 
   _preserved_marks = (PreservedMark*)scratch;
   _preserved_count = 0;
-
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    _root_refs_stack    = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _other_refs_stack   = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _adjusted_pointers  = new (ResourceObj::C_HEAP, mtGC) GrowableArray<void*>(100, true);
-    _live_oops          = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
-    _live_oops_moved_to = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(100, true);
-    _live_oops_size     = new (ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-  }
-  if (RecordMarkSweepCompaction) {
-    if (_cur_gc_live_oops == NULL) {
-      _cur_gc_live_oops           = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _cur_gc_live_oops_moved_to  = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _cur_gc_live_oops_size      = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-      _last_gc_live_oops          = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _last_gc_live_oops_moved_to = new(ResourceObj::C_HEAP, mtGC) GrowableArray<HeapWord*>(100, true);
-      _last_gc_live_oops_size     = new(ResourceObj::C_HEAP, mtGC) GrowableArray<size_t>(100, true);
-    } else {
-      _cur_gc_live_oops->clear();
-      _cur_gc_live_oops_moved_to->clear();
-      _cur_gc_live_oops_size->clear();
-    }
-  }
-#endif
 }
 
 
@@ -225,19 +187,6 @@
   _preserved_oop_stack.clear(true);
   _marking_stack.clear();
   _objarray_stack.clear(true);
-
-#ifdef VALIDATE_MARK_SWEEP
-  if (ValidateMarkSweep) {
-    delete _root_refs_stack;
-    delete _other_refs_stack;
-    delete _adjusted_pointers;
-    delete _live_oops;
-    delete _live_oops_size;
-    delete _live_oops_moved_to;
-    _live_oops_index = 0;
-    _live_oops_index_at_perm = 0;
-  }
-#endif
 }
 
 void GenMarkSweep::mark_sweep_phase1(int level,
@@ -246,8 +195,6 @@
   TraceTime tm("phase 1", PrintGC && Verbose, true, gclog_or_tty);
   trace(" 1");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
   // Because follow_root_closure is created statically, cannot
@@ -315,8 +262,6 @@
   TraceTime tm("phase 2", PrintGC && Verbose, true, gclog_or_tty);
   trace("2");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   gch->prepare_for_compaction();
 }
 
@@ -337,8 +282,6 @@
   // Need new claim bits for the pointer adjustment tracing.
   ClassLoaderDataGraph::clear_claimed_marks();
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   // Because the two closures below are created statically, cannot
   // use OopsInGenClosure constructor which takes a generation,
   // as the Universe has not been created when the static constructors
@@ -393,10 +336,6 @@
   TraceTime tm("phase 4", PrintGC && Verbose, true, gclog_or_tty);
   trace("4");
 
-  VALIDATE_MARK_SWEEP_ONLY(reset_live_oop_tracking());
-
   GenCompactClosure blk;
   gch->generation_iterate(&blk, true);
-
-  VALIDATE_MARK_SWEEP_ONLY(compaction_complete());
 }
--- a/src/share/vm/memory/metachunk.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metachunk.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -56,6 +56,7 @@
   assert(chunk_end > chunk_bottom, "Chunk must be too small");
   chunk->set_end(chunk_end);
   chunk->set_next(NULL);
+  chunk->set_prev(NULL);
   chunk->set_word_size(word_size);
 #ifdef ASSERT
   size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord));
@@ -76,15 +77,15 @@
 }
 
 // _bottom points to the start of the chunk including the overhead.
-size_t Metachunk::used_word_size() {
+size_t Metachunk::used_word_size() const {
   return pointer_delta(_top, _bottom, sizeof(MetaWord));
 }
 
-size_t Metachunk::free_word_size() {
+size_t Metachunk::free_word_size() const {
   return pointer_delta(_end, _top, sizeof(MetaWord));
 }
 
-size_t Metachunk::capacity_word_size() {
+size_t Metachunk::capacity_word_size() const {
   return pointer_delta(_end, _bottom, sizeof(MetaWord));
 }
 
@@ -93,6 +94,10 @@
                " bottom " PTR_FORMAT " top " PTR_FORMAT
                " end " PTR_FORMAT " size " SIZE_FORMAT,
                bottom(), top(), end(), word_size());
+  if (Verbose) {
+    st->print_cr("    used " SIZE_FORMAT " free " SIZE_FORMAT,
+                 used_word_size(), free_word_size());
+  }
 }
 
 #ifndef PRODUCT
--- a/src/share/vm/memory/metachunk.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metachunk.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -67,9 +67,11 @@
   void set_word_size(size_t v) { _word_size = v; }
  public:
 #ifdef ASSERT
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false) {}
+  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false),
+    _next(NULL), _prev(NULL) {}
 #else
-  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL) {}
+  Metachunk() : _bottom(NULL), _end(NULL), _top(NULL),
+    _next(NULL), _prev(NULL) {}
 #endif
 
   // Used to add a Metachunk to a list of Metachunks
@@ -102,15 +104,15 @@
   }
 
   // Reset top to bottom so chunk can be reused.
-  void reset_empty() { _top = (_bottom + _overhead); }
+  void reset_empty() { _top = (_bottom + _overhead); _next = NULL; _prev = NULL; }
   bool is_empty() { return _top == (_bottom + _overhead); }
 
   // used (has been allocated)
   // free (available for future allocations)
   // capacity (total size of chunk)
-  size_t used_word_size();
-  size_t free_word_size();
-  size_t capacity_word_size();
+  size_t used_word_size() const;
+  size_t free_word_size() const;
+  size_t capacity_word_size()const;
 
   // Debug support
 #ifdef ASSERT
--- a/src/share/vm/memory/metadataFactory.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metadataFactory.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -66,7 +66,11 @@
     if (data != NULL) {
       assert(loader_data != NULL, "shouldn't pass null");
       int size = data->size();
-      loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
+      if (DumpSharedSpaces) {
+        loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
+      } else {
+        loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
+      }
     }
   }
 
@@ -77,6 +81,7 @@
       assert(loader_data != NULL, "shouldn't pass null");
       int size = md->size();
       // Call metadata's deallocate function which will call deallocate fields
+      assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive");
       assert(!md->on_stack(), "can't deallocate things on stack");
       md->deallocate_contents(loader_data);
       loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());
--- a/src/share/vm/memory/metaspace.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metaspace.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -58,11 +58,23 @@
 
 // Used in declarations in SpaceManager and ChunkManager
 enum ChunkIndex {
-  SmallIndex = 0,
-  MediumIndex = 1,
-  HumongousIndex = 2,
-  NumberOfFreeLists = 2,
-  NumberOfInUseLists = 3
+  ZeroIndex = 0,
+  SpecializedIndex = ZeroIndex,
+  SmallIndex = SpecializedIndex + 1,
+  MediumIndex = SmallIndex + 1,
+  HumongousIndex = MediumIndex + 1,
+  NumberOfFreeLists = 3,
+  NumberOfInUseLists = 4
+};
+
+enum ChunkSizes {    // in words.
+  ClassSpecializedChunk = 128,
+  SpecializedChunk = 128,
+  ClassSmallChunk = 256,
+  SmallChunk = 512,
+  ClassMediumChunk = 1 * K,
+  MediumChunk = 8 * K,
+  HumongousChunkGranularity = 8
 };
 
 static ChunkIndex next_chunk_index(ChunkIndex i) {
@@ -126,6 +138,7 @@
   //   HumongousChunk
   ChunkList _free_chunks[NumberOfFreeLists];
 
+
   //   HumongousChunk
   ChunkTreeDictionary _humongous_dictionary;
 
@@ -169,6 +182,10 @@
   Metachunk* chunk_freelist_allocate(size_t word_size);
   void chunk_freelist_deallocate(Metachunk* chunk);
 
+  // Map a size to a list index assuming that there are lists
+  // for special, small, medium, and humongous chunks.
+  static ChunkIndex list_index(size_t size);
+
   // Total of the space in the free chunks list
   size_t free_chunks_total();
   size_t free_chunks_total_in_bytes();
@@ -180,8 +197,6 @@
     Atomic::add_ptr(count, &_free_chunks_count);
     Atomic::add_ptr(v, &_free_chunks_total);
   }
-  ChunkList* free_medium_chunks() { return &_free_chunks[1]; }
-  ChunkList* free_small_chunks() { return &_free_chunks[0]; }
   ChunkTreeDictionary* humongous_dictionary() {
     return &_humongous_dictionary;
   }
@@ -400,7 +415,14 @@
   VirtualSpaceList(size_t word_size);
   VirtualSpaceList(ReservedSpace rs);
 
-  Metachunk* get_new_chunk(size_t word_size, size_t grow_chunks_by_words);
+  Metachunk* get_new_chunk(size_t word_size,
+                           size_t grow_chunks_by_words,
+                           size_t medium_chunk_bunch);
+
+  // Get the first chunk for a Metaspace.  Used for
+  // special cases such as the boot class loader, reflection
+  // class loader and anonymous class loader.
+  Metachunk* get_initialization_chunk(size_t word_size, size_t chunk_bunch);
 
   VirtualSpaceNode* current_virtual_space() {
     return _current_virtual_space;
@@ -501,9 +523,13 @@
   friend class Metadebug;
 
  private:
+
   // protects allocations and contains.
   Mutex* const _lock;
 
+  // Chunk related size
+  size_t _medium_chunk_bunch;
+
   // List of chunks in use by this SpaceManager.  Allocations
   // are done from the current chunk.  The list is used for deallocating
   // chunks when the SpaceManager is freed.
@@ -532,6 +558,7 @@
   static const int    _expand_lock_rank;
   static Mutex* const _expand_lock;
 
+ private:
   // Accessors
   Metachunk* chunks_in_use(ChunkIndex index) const { return _chunks_in_use[index]; }
   void set_chunks_in_use(ChunkIndex index, Metachunk* v) { _chunks_in_use[index] = v; }
@@ -554,23 +581,37 @@
 
   Mutex* lock() const { return _lock; }
 
+  const char* chunk_size_name(ChunkIndex index) const;
+
+ protected:
+  void initialize();
+
  public:
-  SpaceManager(Mutex* lock, VirtualSpaceList* vs_list);
+  SpaceManager(Mutex* lock,
+               VirtualSpaceList* vs_list);
   ~SpaceManager();
 
-  enum ChunkSizes {    // in words.
-    SmallChunk = 512,
-    MediumChunk = 8 * K,
-    MediumChunkBunch = 4 * MediumChunk
+  enum ChunkMultiples {
+    MediumChunkMultiple = 4
   };
 
   // Accessors
+  size_t specialized_chunk_size() { return SpecializedChunk; }
+  size_t small_chunk_size() { return (size_t) vs_list()->is_class() ? ClassSmallChunk : SmallChunk; }
+  size_t medium_chunk_size() { return (size_t) vs_list()->is_class() ? ClassMediumChunk : MediumChunk; }
+  size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; }
+
   size_t allocation_total() const { return _allocation_total; }
   void inc_allocation_total(size_t v) { Atomic::add_ptr(v, &_allocation_total); }
-  static bool is_humongous(size_t word_size) { return word_size > MediumChunk; }
+  bool is_humongous(size_t word_size) { return word_size > medium_chunk_size(); }
 
   static Mutex* expand_lock() { return _expand_lock; }
 
+  // Set the sizes for the initial chunks.
+  void get_initial_chunk_sizes(Metaspace::MetaspaceType type,
+                               size_t* chunk_word_size,
+                               size_t* class_chunk_word_size);
+
   size_t sum_capacity_in_chunks_in_use() const;
   size_t sum_used_in_chunks_in_use() const;
   size_t sum_free_in_chunks_in_use() const;
@@ -580,6 +621,8 @@
   size_t sum_count_in_chunks_in_use();
   size_t sum_count_in_chunks_in_use(ChunkIndex i);
 
+  Metachunk* get_new_chunk(size_t word_size, size_t grow_chunks_by_words);
+
   // Block allocation and deallocation.
   // Allocates a block from the current chunk
   MetaWord* allocate(size_t word_size);
@@ -772,8 +815,10 @@
     return false;
   }
 
-  // Commit only 1 page instead of the whole reserved space _rs.size()
-  size_t committed_byte_size = os::vm_page_size();
+  // An allocation out of this Virtualspace that is larger
+  // than an initial commit size can waste that initial committed
+  // space.
+  size_t committed_byte_size = 0;
   bool result = virtual_space()->initialize(_rs, committed_byte_size);
   if (result) {
     set_top((MetaWord*)virtual_space()->low());
@@ -799,7 +844,8 @@
   st->print_cr("   space @ " PTR_FORMAT " " SIZE_FORMAT "K, %3d%% used "
            "[" PTR_FORMAT ", " PTR_FORMAT ", "
            PTR_FORMAT ", " PTR_FORMAT ")",
-           vs, capacity / K, used * 100 / capacity,
+           vs, capacity / K,
+           capacity == 0 ? 0 : used * 100 / capacity,
            bottom(), top(), end(),
            vs->high_boundary());
 }
@@ -922,7 +968,8 @@
 }
 
 Metachunk* VirtualSpaceList::get_new_chunk(size_t word_size,
-                                           size_t grow_chunks_by_words) {
+                                           size_t grow_chunks_by_words,
+                                           size_t medium_chunk_bunch) {
 
   // Get a chunk from the chunk freelist
   Metachunk* next = chunk_manager()->chunk_freelist_allocate(grow_chunks_by_words);
@@ -935,8 +982,8 @@
   if (next == NULL) {
     // Not enough room in current virtual space.  Try to commit
     // more space.
-    size_t expand_vs_by_words = MAX2((size_t)SpaceManager::MediumChunkBunch,
-                                       grow_chunks_by_words);
+    size_t expand_vs_by_words = MAX2(medium_chunk_bunch,
+                                     grow_chunks_by_words);
     size_t page_size_words = os::vm_page_size() / BytesPerWord;
     size_t aligned_expand_vs_by_words = align_size_up(expand_vs_by_words,
                                                         page_size_words);
@@ -954,12 +1001,6 @@
           // Got it.  It's on the list now.  Get a chunk from it.
           next = current_virtual_space()->get_chunk_vs_with_expand(grow_chunks_by_words);
         }
-        if (TraceMetadataHumongousAllocation && SpaceManager::is_humongous(word_size)) {
-          gclog_or_tty->print_cr("  aligned_expand_vs_by_words " PTR_FORMAT,
-                                 aligned_expand_vs_by_words);
-          gclog_or_tty->print_cr("  grow_vs_words " PTR_FORMAT,
-                                 grow_vs_words);
-        }
       } else {
         // Allocation will fail and induce a GC
         if (TraceMetadataChunkAllocation && Verbose) {
@@ -974,9 +1015,20 @@
     }
   }
 
+  assert(next == NULL || (next->next() == NULL && next->prev() == NULL),
+         "New chunk is still on some list");
   return next;
 }
 
+Metachunk* VirtualSpaceList::get_initialization_chunk(size_t chunk_word_size,
+                                                      size_t chunk_bunch) {
+  // Get a chunk from the chunk freelist
+  Metachunk* new_chunk = get_new_chunk(chunk_word_size,
+                                       chunk_word_size,
+                                       chunk_bunch);
+  return new_chunk;
+}
+
 void VirtualSpaceList::print_on(outputStream* st) const {
   if (TraceMetadataChunkAllocation && Verbose) {
     VirtualSpaceListIterator iter(virtual_space_list());
@@ -1373,16 +1425,17 @@
 
 void ChunkList::add_at_head(Metachunk* head, Metachunk* tail) {
   assert_lock_strong(SpaceManager::expand_lock());
-  assert(tail->next() == NULL, "Not the tail");
+  assert(head == tail || tail->next() == NULL,
+         "Not the tail or the head has already been added to a list");
 
   if (TraceMetadataChunkAllocation && Verbose) {
-    tty->print("ChunkList::add_at_head: ");
+    gclog_or_tty->print("ChunkList::add_at_head(head, tail): ");
     Metachunk* cur = head;
     while (cur != NULL) {
-    tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ", cur, cur->word_size());
+      gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ", cur, cur->word_size());
       cur = cur->next();
     }
-    tty->print_cr("");
+    gclog_or_tty->print_cr("");
   }
 
   if (tail != NULL) {
@@ -1486,13 +1539,13 @@
 
 void ChunkManager::locked_print_free_chunks(outputStream* st) {
   assert_lock_strong(SpaceManager::expand_lock());
-  st->print_cr("Free chunk total 0x%x  count 0x%x",
+  st->print_cr("Free chunk total " SIZE_FORMAT "  count " SIZE_FORMAT,
                 _free_chunks_total, _free_chunks_count);
 }
 
 void ChunkManager::locked_print_sum_free_chunks(outputStream* st) {
   assert_lock_strong(SpaceManager::expand_lock());
-  st->print_cr("Sum free chunk total 0x%x  count 0x%x",
+  st->print_cr("Sum free chunk total " SIZE_FORMAT "  count " SIZE_FORMAT,
                 sum_free_chunks(), sum_free_chunks_count());
 }
 ChunkList* ChunkManager::free_chunks(ChunkIndex index) {
@@ -1504,7 +1557,7 @@
 size_t ChunkManager::sum_free_chunks() {
   assert_lock_strong(SpaceManager::expand_lock());
   size_t result = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
     ChunkList* list = free_chunks(i);
 
     if (list == NULL) {
@@ -1520,7 +1573,7 @@
 size_t ChunkManager::sum_free_chunks_count() {
   assert_lock_strong(SpaceManager::expand_lock());
   size_t count = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfFreeLists; i = next_chunk_index(i)) {
     ChunkList* list = free_chunks(i);
     if (list == NULL) {
       continue;
@@ -1532,15 +1585,9 @@
 }
 
 ChunkList* ChunkManager::find_free_chunks_list(size_t word_size) {
-  switch (word_size) {
-  case SpaceManager::SmallChunk :
-      return &_free_chunks[0];
-  case SpaceManager::MediumChunk :
-      return &_free_chunks[1];
-  default:
-    assert(word_size > SpaceManager::MediumChunk, "List inconsistency");
-    return &_free_chunks[2];
-  }
+  ChunkIndex index = list_index(word_size);
+  assert(index < HumongousIndex, "No humongous list");
+  return free_chunks(index);
 }
 
 void ChunkManager::free_chunks_put(Metachunk* chunk) {
@@ -1574,7 +1621,7 @@
   slow_locked_verify();
 
   Metachunk* chunk = NULL;
-  if (!SpaceManager::is_humongous(word_size)) {
+  if (list_index(word_size) != HumongousIndex) {
     ChunkList* free_list = find_free_chunks_list(word_size);
     assert(free_list != NULL, "Sanity check");
 
@@ -1587,8 +1634,8 @@
 
     // Remove the chunk as the head of the list.
     free_list->set_head(chunk->next());
-    chunk->set_next(NULL);
-    // Chunk has been removed from the chunks free list.
+
+    // Chunk is being removed from the chunks free list.
     dec_free_chunks_total(chunk->capacity_word_size());
 
     if (TraceMetadataChunkAllocation && Verbose) {
@@ -1614,8 +1661,14 @@
 #ifdef ASSERT
       chunk->set_is_free(false);
 #endif
+    } else {
+      return NULL;
     }
   }
+
+  // Remove it from the links to this freelist
+  chunk->set_next(NULL);
+  chunk->set_prev(NULL);
   slow_locked_verify();
   return chunk;
 }
@@ -1630,13 +1683,20 @@
     return NULL;
   }
 
-  assert(word_size <= chunk->word_size() ||
-           SpaceManager::is_humongous(chunk->word_size()),
-           "Non-humongous variable sized chunk");
+  assert((word_size <= chunk->word_size()) ||
+         list_index(chunk->word_size() == HumongousIndex),
+         "Non-humongous variable sized chunk");
   if (TraceMetadataChunkAllocation) {
-    tty->print("ChunkManager::chunk_freelist_allocate: chunk "
-               PTR_FORMAT "  size " SIZE_FORMAT " ",
-               chunk, chunk->word_size());
+    size_t list_count;
+    if (list_index(word_size) < HumongousIndex) {
+      ChunkList* list = find_free_chunks_list(word_size);
+      list_count = list->sum_list_count();
+    } else {
+      list_count = humongous_dictionary()->total_count();
+    }
+    tty->print("ChunkManager::chunk_freelist_allocate: " PTR_FORMAT " chunk "
+               PTR_FORMAT "  size " SIZE_FORMAT " count " SIZE_FORMAT " ",
+               this, chunk, chunk->word_size(), list_count);
     locked_print_free_chunks(tty);
   }
 
@@ -1651,10 +1711,42 @@
 
 // SpaceManager methods
 
+void SpaceManager::get_initial_chunk_sizes(Metaspace::MetaspaceType type,
+                                           size_t* chunk_word_size,
+                                           size_t* class_chunk_word_size) {
+  switch (type) {
+  case Metaspace::BootMetaspaceType:
+    *chunk_word_size = Metaspace::first_chunk_word_size();
+    *class_chunk_word_size = Metaspace::first_class_chunk_word_size();
+    break;
+  case Metaspace::ROMetaspaceType:
+    *chunk_word_size = SharedReadOnlySize / wordSize;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  case Metaspace::ReadWriteMetaspaceType:
+    *chunk_word_size = SharedReadWriteSize / wordSize;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  case Metaspace::AnonymousMetaspaceType:
+  case Metaspace::ReflectionMetaspaceType:
+    *chunk_word_size = SpecializedChunk;
+    *class_chunk_word_size = ClassSpecializedChunk;
+    break;
+  default:
+    *chunk_word_size = SmallChunk;
+    *class_chunk_word_size = ClassSmallChunk;
+    break;
+  }
+  assert(chunk_word_size != 0 && class_chunk_word_size != 0,
+    err_msg("Initial chunks sizes bad: data  " SIZE_FORMAT
+            " class " SIZE_FORMAT,
+            chunk_word_size, class_chunk_word_size));
+}
+
 size_t SpaceManager::sum_free_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t free = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       free += chunk->free_word_size();
@@ -1667,9 +1759,7 @@
 size_t SpaceManager::sum_waste_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t result = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
-
-
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
    result += sum_waste_in_chunks_in_use(i);
   }
 
@@ -1678,7 +1768,6 @@
 
 size_t SpaceManager::sum_waste_in_chunks_in_use(ChunkIndex index) const {
   size_t result = 0;
-  size_t count = 0;
   Metachunk* chunk = chunks_in_use(index);
   // Count the free space in all the chunk but not the
   // current chunk from which allocations are still being done.
@@ -1688,7 +1777,6 @@
       result += chunk->free_word_size();
       prev = chunk;
       chunk = chunk->next();
-      count++;
     }
   }
   return result;
@@ -1697,7 +1785,7 @@
 size_t SpaceManager::sum_capacity_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t sum = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       // Just changed this sum += chunk->capacity_word_size();
@@ -1711,7 +1799,7 @@
 
 size_t SpaceManager::sum_count_in_chunks_in_use() {
   size_t count = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     count = count + sum_count_in_chunks_in_use(i);
   }
 
@@ -1732,7 +1820,7 @@
 size_t SpaceManager::sum_used_in_chunks_in_use() const {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
   size_t used = 0;
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     Metachunk* chunk = chunks_in_use(i);
     while (chunk != NULL) {
       used += chunk->used_word_size();
@@ -1744,19 +1832,17 @@
 
 void SpaceManager::locked_print_chunks_in_use_on(outputStream* st) const {
 
-  Metachunk* small_chunk = chunks_in_use(SmallIndex);
-  st->print_cr("SpaceManager: small chunk " PTR_FORMAT
-               " free " SIZE_FORMAT,
-               small_chunk,
-               small_chunk->free_word_size());
-
-  Metachunk* medium_chunk = chunks_in_use(MediumIndex);
-  st->print("medium chunk " PTR_FORMAT, medium_chunk);
-  Metachunk* tail = current_chunk();
-  st->print_cr(" current chunk " PTR_FORMAT, tail);
-
-  Metachunk* head = chunks_in_use(HumongousIndex);
-  st->print_cr("humongous chunk " PTR_FORMAT, head);
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+    Metachunk* chunk = chunks_in_use(i);
+    st->print("SpaceManager: %s " PTR_FORMAT,
+                 chunk_size_name(i), chunk);
+    if (chunk != NULL) {
+      st->print_cr(" free " SIZE_FORMAT,
+                   chunk->free_word_size());
+    } else {
+      st->print_cr("");
+    }
+  }
 
   vs_list()->chunk_manager()->locked_print_free_chunks(st);
   vs_list()->chunk_manager()->locked_print_sum_free_chunks(st);
@@ -1772,18 +1858,28 @@
   if (chunks_in_use(MediumIndex) == NULL &&
       (!has_small_chunk_limit() ||
        sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit)) {
-    chunk_word_size = (size_t) SpaceManager::SmallChunk;
-    if (word_size + Metachunk::overhead() > SpaceManager::SmallChunk) {
-      chunk_word_size = MediumChunk;
+    chunk_word_size = (size_t) small_chunk_size();
+    if (word_size + Metachunk::overhead() > small_chunk_size()) {
+      chunk_word_size = medium_chunk_size();
     }
   } else {
-    chunk_word_size = MediumChunk;
+    chunk_word_size = medium_chunk_size();
   }
 
-  // Might still need a humongous chunk
+  // Might still need a humongous chunk.  Enforce an
+  // eight word granularity to facilitate reuse (some
+  // wastage but better chance of reuse).
+  size_t if_humongous_sized_chunk =
+    align_size_up(word_size + Metachunk::overhead(),
+                  HumongousChunkGranularity);
   chunk_word_size =
-    MAX2((size_t) chunk_word_size, word_size + Metachunk::overhead());
-
+    MAX2((size_t) chunk_word_size, if_humongous_sized_chunk);
+
+  assert(!SpaceManager::is_humongous(word_size) ||
+         chunk_word_size == if_humongous_sized_chunk,
+         err_msg("Size calculation is wrong, word_size " SIZE_FORMAT
+                 " chunk_word_size " SIZE_FORMAT,
+                 word_size, chunk_word_size));
   if (TraceMetadataHumongousAllocation &&
       SpaceManager::is_humongous(word_size)) {
     gclog_or_tty->print_cr("Metadata humongous allocation:");
@@ -1805,15 +1901,21 @@
   MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
 
   if (TraceMetadataChunkAllocation && Verbose) {
+    size_t words_left = 0;
+    size_t words_used = 0;
+    if (current_chunk() != NULL) {
+      words_left = current_chunk()->free_word_size();
+      words_used = current_chunk()->used_word_size();
+    }
     gclog_or_tty->print_cr("SpaceManager::grow_and_allocate for " SIZE_FORMAT
-                           " words " SIZE_FORMAT " space left",
-                            word_size, current_chunk() != NULL ?
-                              current_chunk()->free_word_size() : 0);
+                           " words " SIZE_FORMAT " words used " SIZE_FORMAT
+                           " words left",
+                            word_size, words_used, words_left);
   }
 
   // Get another chunk out of the virtual space
   size_t grow_chunks_by_words = calc_chunk_size(word_size);
-  Metachunk* next = vs_list()->get_new_chunk(word_size, grow_chunks_by_words);
+  Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words);
 
   // If a chunk was available, add it to the in-use chunk list
   // and do an allocation from it.
@@ -1828,7 +1930,7 @@
 
 void SpaceManager::print_on(outputStream* st) const {
 
-  for (ChunkIndex i = SmallIndex;
+  for (ChunkIndex i = ZeroIndex;
        i < NumberOfInUseLists ;
        i = next_chunk_index(i) ) {
     st->print_cr("  chunks_in_use " PTR_FORMAT " chunk size " PTR_FORMAT,
@@ -1847,12 +1949,18 @@
   }
 }
 
-SpaceManager::SpaceManager(Mutex* lock, VirtualSpaceList* vs_list) :
+SpaceManager::SpaceManager(Mutex* lock,
+                           VirtualSpaceList* vs_list) :
   _vs_list(vs_list),
   _allocation_total(0),
-  _lock(lock) {
+  _lock(lock)
+{
+  initialize();
+}
+
+void SpaceManager::initialize() {
   Metadebug::init_allocation_fail_alot_count();
-  for (ChunkIndex i = SmallIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+  for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
     _chunks_in_use[i] = NULL;
   }
   _current_chunk = NULL;
@@ -1885,30 +1993,37 @@
   // Add all the chunks in use by this space manager
   // to the global list of free chunks.
 
-  // Small chunks.  There is one _current_chunk for each
-  // Metaspace.  It could point to a small or medium chunk.
-  // Rather than determine which it is, follow the list of
-  // small chunks to add them to the free list
-  Metachunk* small_chunk = chunks_in_use(SmallIndex);
-  chunk_manager->free_small_chunks()->add_at_head(small_chunk);
-  set_chunks_in_use(SmallIndex, NULL);
-
-  // After the small chunk are the medium chunks
-  Metachunk* medium_chunk = chunks_in_use(MediumIndex);
-  assert(medium_chunk == NULL ||
-         medium_chunk->word_size() == MediumChunk,
-         "Chunk is on the wrong list");
-
-  if (medium_chunk != NULL) {
-    Metachunk* head = medium_chunk;
-    // If there is a medium chunk then the _current_chunk can only
-    // point to the last medium chunk.
-    Metachunk* tail = current_chunk();
-    chunk_manager->free_medium_chunks()->add_at_head(head, tail);
-    set_chunks_in_use(MediumIndex, NULL);
+  // Follow each list of chunks-in-use and add them to the
+  // free lists.  Each list is NULL terminated.
+
+  for (ChunkIndex i = ZeroIndex; i < HumongousIndex; i = next_chunk_index(i)) {
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print_cr("returned %d %s chunks to freelist",
+                             sum_count_in_chunks_in_use(i),
+                             chunk_size_name(i));
+    }
+    Metachunk* chunks = chunks_in_use(i);
+    chunk_manager->free_chunks(i)->add_at_head(chunks);
+    set_chunks_in_use(i, NULL);
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print_cr("updated freelist count %d %s",
+                             chunk_manager->free_chunks(i)->sum_list_count(),
+                             chunk_size_name(i));
+    }
+    assert(i != HumongousIndex, "Humongous chunks are handled explicitly later");
   }
 
+  // The medium chunk case may be optimized by passing the head and
+  // tail of the medium chunk list to add_at_head().  The tail is often
+  // the current chunk but there are probably exceptions.
+
   // Humongous chunks
+  if (TraceMetadataChunkAllocation && Verbose) {
+    gclog_or_tty->print_cr("returned %d %s humongous chunks to dictionary",
+                            sum_count_in_chunks_in_use(HumongousIndex),
+                            chunk_size_name(HumongousIndex));
+    gclog_or_tty->print("Humongous chunk dictionary: ");
+  }
   // Humongous chunks are never the current chunk.
   Metachunk* humongous_chunks = chunks_in_use(HumongousIndex);
 
@@ -1916,14 +2031,65 @@
 #ifdef ASSERT
     humongous_chunks->set_is_free(true);
 #endif
+    if (TraceMetadataChunkAllocation && Verbose) {
+      gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ",
+                          humongous_chunks,
+                          humongous_chunks->word_size());
+    }
+    assert(humongous_chunks->word_size() == (size_t)
+           align_size_up(humongous_chunks->word_size(),
+                             HumongousChunkGranularity),
+           err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
+                   " granularity " SIZE_FORMAT,
+                   humongous_chunks->word_size(), HumongousChunkGranularity));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     chunk_manager->humongous_dictionary()->return_chunk(humongous_chunks);
     humongous_chunks = next_humongous_chunks;
   }
+  if (TraceMetadataChunkAllocation && Verbose) {
+    gclog_or_tty->print_cr("");
+    gclog_or_tty->print_cr("updated dictionary count %d %s",
+                     chunk_manager->humongous_dictionary()->total_count(),
+                     chunk_size_name(HumongousIndex));
+  }
   set_chunks_in_use(HumongousIndex, NULL);
   chunk_manager->slow_locked_verify();
 }
 
+const char* SpaceManager::chunk_size_name(ChunkIndex index) const {
+  switch (index) {
+    case SpecializedIndex:
+      return "Specialized";
+    case SmallIndex:
+      return "Small";
+    case MediumIndex:
+      return "Medium";
+    case HumongousIndex:
+      return "Humongous";
+    default:
+      return NULL;
+  }
+}
+
+ChunkIndex ChunkManager::list_index(size_t size) {
+  switch (size) {
+    case SpecializedChunk:
+      assert(SpecializedChunk == ClassSpecializedChunk,
+             "Need branch for ClassSpecializedChunk");
+      return SpecializedIndex;
+    case SmallChunk:
+    case ClassSmallChunk:
+      return SmallIndex;
+    case MediumChunk:
+    case ClassMediumChunk:
+      return MediumIndex;
+    default:
+      assert(size > MediumChunk || size > ClassMediumChunk,
+             "Not a humongous chunk");
+      return HumongousIndex;
+  }
+}
+
 void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
   assert_lock_strong(_lock);
   size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
@@ -1942,52 +2108,13 @@
 
   // Find the correct list and and set the current
   // chunk for that list.
-  switch (new_chunk->word_size()) {
-  case SpaceManager::SmallChunk :
-    if (chunks_in_use(SmallIndex) == NULL) {
-      // First chunk to add to the list
-      set_chunks_in_use(SmallIndex, new_chunk);
-    } else {
-      assert(current_chunk()->word_size() == SpaceManager::SmallChunk,
-        err_msg( "Incorrect mix of sizes in chunk list "
-        SIZE_FORMAT " new chunk " SIZE_FORMAT,
-        current_chunk()->word_size(), new_chunk->word_size()));
-      current_chunk()->set_next(new_chunk);
-    }
-    // Make current chunk
+  ChunkIndex index = ChunkManager::list_index(new_chunk->word_size());
+
+  if (index != HumongousIndex) {
     set_current_chunk(new_chunk);
-    break;
-  case SpaceManager::MediumChunk :
-    if (chunks_in_use(MediumIndex) == NULL) {
-      // About to add the first medium chunk so teminate the
-      // small chunk list.  In general once medium chunks are
-      // being added, we're past the need for small chunks.
-      if (current_chunk() != NULL) {
-        // Only a small chunk or the initial chunk could be
-        // the current chunk if this is the first medium chunk.
-        assert(current_chunk()->word_size() == SpaceManager::SmallChunk ||
-          chunks_in_use(SmallIndex) == NULL,
-          err_msg("Should be a small chunk or initial chunk, current chunk "
-          SIZE_FORMAT " new chunk " SIZE_FORMAT,
-          current_chunk()->word_size(), new_chunk->word_size()));
-        current_chunk()->set_next(NULL);
-      }
-      // First chunk to add to the list
-      set_chunks_in_use(MediumIndex, new_chunk);
-
-    } else {
-      // As a minimum the first medium chunk added would
-      // have become the _current_chunk
-      // so the _current_chunk has to be non-NULL here
-      // (although not necessarily still the first medium chunk).
-      assert(current_chunk()->word_size() == SpaceManager::MediumChunk,
-             "A medium chunk should the current chunk");
-      current_chunk()->set_next(new_chunk);
-    }
-    // Make current chunk
-    set_current_chunk(new_chunk);
-    break;
-  default: {
+    new_chunk->set_next(chunks_in_use(index));
+    set_chunks_in_use(index, new_chunk);
+  } else {
     // For null class loader data and DumpSharedSpaces, the first chunk isn't
     // small, so small will be null.  Link this first chunk as the current
     // chunk.
@@ -2002,8 +2129,7 @@
     new_chunk->set_next(chunks_in_use(HumongousIndex));
     set_chunks_in_use(HumongousIndex, new_chunk);
 
-    assert(new_chunk->word_size() > MediumChunk, "List inconsistency");
-  }
+    assert(new_chunk->word_size() > medium_chunk_size(), "List inconsistency");
   }
 
   assert(new_chunk->is_empty(), "Not ready for reuse");
@@ -2015,6 +2141,22 @@
   }
 }
 
+Metachunk* SpaceManager::get_new_chunk(size_t word_size,
+                                       size_t grow_chunks_by_words) {
+
+  Metachunk* next = vs_list()->get_new_chunk(word_size,
+                                             grow_chunks_by_words,
+                                             medium_chunk_bunch());
+
+  if (TraceMetadataHumongousAllocation &&
+      SpaceManager::is_humongous(next->word_size())) {
+    gclog_or_tty->print_cr("  new humongous chunk word size " PTR_FORMAT,
+                           next->word_size());
+  }
+
+  return next;
+}
+
 MetaWord* SpaceManager::allocate(size_t word_size) {
   MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
 
@@ -2090,12 +2232,7 @@
   // verfication of chunks does not work since
   // being in the dictionary alters a chunk.
   if (block_freelists()->total_size() == 0) {
-    // Skip the small chunks because their next link points to
-    // medium chunks.  This is because the small chunk is the
-    // current chunk (for allocations) until it is full and the
-    // the addition of the next chunk does not NULL the next
-    // like of the small chunk.
-    for (ChunkIndex i = MediumIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
+    for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
       Metachunk* curr = chunks_in_use(i);
       while (curr != NULL) {
         curr->verify();
@@ -2108,15 +2245,15 @@
 
 void SpaceManager::verify_chunk_size(Metachunk* chunk) {
   assert(is_humongous(chunk->word_size()) ||
-         chunk->word_size() == MediumChunk ||
-         chunk->word_size() == SmallChunk,
+         chunk->word_size() == medium_chunk_size() ||
+         chunk->word_size() == small_chunk_size() ||
+         chunk->word_size() == specialized_chunk_size(),
          "Chunk size is wrong");
   return;
 }
 
 #ifdef ASSERT
 void SpaceManager::verify_allocation_total() {
-#if 0
   // Verification is only guaranteed at a safepoint.
   if (SafepointSynchronize::is_at_safepoint()) {
     gclog_or_tty->print_cr("Chunk " PTR_FORMAT " allocation_total " SIZE_FORMAT
@@ -2129,7 +2266,6 @@
   assert(allocation_total() == sum_used_in_chunks_in_use(),
     err_msg("allocation total is not consistent %d vs %d",
             allocation_total(), sum_used_in_chunks_in_use()));
-#endif
 }
 
 #endif
@@ -2142,7 +2278,7 @@
   size_t capacity = 0;
 
   // Add up statistics for all chunks in this SpaceManager.
-  for (ChunkIndex index = SmallIndex;
+  for (ChunkIndex index = ZeroIndex;
        index < NumberOfInUseLists;
        index = next_chunk_index(index)) {
     for (Metachunk* curr = chunks_in_use(index);
@@ -2160,7 +2296,7 @@
     }
   }
 
-  size_t free = current_chunk()->free_word_size();
+  size_t free = current_chunk() == NULL ? 0 : current_chunk()->free_word_size();
   // Free space isn't wasted.
   waste -= free;
 
@@ -2171,32 +2307,20 @@
 
 #ifndef PRODUCT
 void SpaceManager::mangle_freed_chunks() {
-  for (ChunkIndex index = SmallIndex;
+  for (ChunkIndex index = ZeroIndex;
        index < NumberOfInUseLists;
        index = next_chunk_index(index)) {
     for (Metachunk* curr = chunks_in_use(index);
          curr != NULL;
          curr = curr->next()) {
-      // Try to detect incorrectly terminated small chunk
-      // list.
-      assert(index == MediumIndex || curr != chunks_in_use(MediumIndex),
-             err_msg("Mangling medium chunks in small chunks? "
-                     "curr " PTR_FORMAT " medium list " PTR_FORMAT,
-                     curr, chunks_in_use(MediumIndex)));
       curr->mangle();
     }
   }
 }
 #endif // PRODUCT
 
-
 // MetaspaceAux
 
-size_t MetaspaceAux::used_in_bytes() {
-  return (Metaspace::class_space_list()->used_words_sum() +
-          Metaspace::space_list()->used_words_sum()) * BytesPerWord;
-}
-
 size_t MetaspaceAux::used_in_bytes(Metaspace::MetadataType mdtype) {
   size_t used = 0;
   ClassLoaderDataGraphMetaspaceIterator iter;
@@ -2222,14 +2346,6 @@
   return free * BytesPerWord;
 }
 
-// The total words available for metadata allocation.  This
-// uses Metaspace capacity_words() which is the total words
-// in chunks allocated for a Metaspace.
-size_t MetaspaceAux::capacity_in_bytes() {
-  return (Metaspace::class_space_list()->capacity_words_sum() +
-          Metaspace::space_list()->capacity_words_sum()) * BytesPerWord;
-}
-
 size_t MetaspaceAux::capacity_in_bytes(Metaspace::MetadataType mdtype) {
   size_t capacity = free_chunks_total(mdtype);
   ClassLoaderDataGraphMetaspaceIterator iter;
@@ -2242,11 +2358,6 @@
   return capacity * BytesPerWord;
 }
 
-size_t MetaspaceAux::reserved_in_bytes() {
-  return (Metaspace::class_space_list()->virtual_space_total() +
-          Metaspace::space_list()->virtual_space_total()) * BytesPerWord;
-}
-
 size_t MetaspaceAux::reserved_in_bytes(Metaspace::MetadataType mdtype) {
   size_t reserved = (mdtype == Metaspace::ClassType) ?
                        Metaspace::class_space_list()->virtual_space_total() :
@@ -2254,7 +2365,7 @@
   return reserved * BytesPerWord;
 }
 
-size_t MetaspaceAux::min_chunk_size() { return SpaceManager::MediumChunk; }
+size_t MetaspaceAux::min_chunk_size() { return Metaspace::first_chunk_word_size(); }
 
 size_t MetaspaceAux::free_chunks_total(Metaspace::MetadataType mdtype) {
   ChunkManager* chunk = (mdtype == Metaspace::ClassType) ?
@@ -2334,26 +2445,44 @@
 // Print total fragmentation for class and data metaspaces separately
 void MetaspaceAux::print_waste(outputStream* out) {
 
-  size_t small_waste = 0, medium_waste = 0, large_waste = 0;
-  size_t cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0;
+  size_t specialized_waste = 0, small_waste = 0, medium_waste = 0, large_waste = 0;
+  size_t specialized_count = 0, small_count = 0, medium_count = 0, large_count = 0;
+  size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0;
+  size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_large_count = 0;
 
   ClassLoaderDataGraphMetaspaceIterator iter;
   while (iter.repeat()) {
     Metaspace* msp = iter.get_next();
     if (msp != NULL) {
+      specialized_waste += msp->vsm()->sum_waste_in_chunks_in_use(SpecializedIndex);
+      specialized_count += msp->vsm()->sum_count_in_chunks_in_use(SpecializedIndex);
       small_waste += msp->vsm()->sum_waste_in_chunks_in_use(SmallIndex);
+      small_count += msp->vsm()->sum_count_in_chunks_in_use(SmallIndex);
       medium_waste += msp->vsm()->sum_waste_in_chunks_in_use(MediumIndex);
+      medium_count += msp->vsm()->sum_count_in_chunks_in_use(MediumIndex);
       large_waste += msp->vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
-
+      large_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex);
+
+      cls_specialized_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SpecializedIndex);
+      cls_specialized_count += msp->class_vsm()->sum_count_in_chunks_in_use(SpecializedIndex);
       cls_small_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SmallIndex);
+      cls_small_count += msp->class_vsm()->sum_count_in_chunks_in_use(SmallIndex);
       cls_medium_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(MediumIndex);
+      cls_medium_count += msp->class_vsm()->sum_count_in_chunks_in_use(MediumIndex);
       cls_large_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(HumongousIndex);
+      cls_large_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex);
     }
   }
   out->print_cr("Total fragmentation waste (words) doesn't count free space");
-  out->print("  data: small " SIZE_FORMAT " medium " SIZE_FORMAT,
-             small_waste, medium_waste);
-  out->print_cr(" class: small " SIZE_FORMAT, cls_small_waste);
+  out->print_cr("  data: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
+                        SIZE_FORMAT " small(s) " SIZE_FORMAT ", "
+                        SIZE_FORMAT " medium(s) " SIZE_FORMAT,
+             specialized_count, specialized_waste, small_count,
+             small_waste, medium_count, medium_waste);
+  out->print_cr(" class: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", "
+                           SIZE_FORMAT " small(s) " SIZE_FORMAT,
+             cls_specialized_count, cls_specialized_waste,
+             cls_small_count, cls_small_waste);
 }
 
 // Dump global metaspace things from the end of ClassLoaderDataGraph
@@ -2372,13 +2501,10 @@
 // Metaspace methods
 
 size_t Metaspace::_first_chunk_word_size = 0;
-
-Metaspace::Metaspace(Mutex* lock, size_t word_size) {
-  initialize(lock, word_size);
-}
-
-Metaspace::Metaspace(Mutex* lock) {
-  initialize(lock);
+size_t Metaspace::_first_class_chunk_word_size = 0;
+
+Metaspace::Metaspace(Mutex* lock, MetaspaceType type) {
+  initialize(lock, type);
 }
 
 Metaspace::~Metaspace() {
@@ -2430,11 +2556,18 @@
       }
     }
 
-    // Initialize this before initializing the VirtualSpaceList
+    // Initialize these before initializing the VirtualSpaceList
     _first_chunk_word_size = InitialBootClassLoaderMetaspaceSize / BytesPerWord;
+    _first_chunk_word_size = align_word_size_up(_first_chunk_word_size);
+    // Make the first class chunk bigger than a medium chunk so it's not put
+    // on the medium chunk list.   The next chunk will be small and progress
+    // from there.  This size calculated by -version.
+    _first_class_chunk_word_size = MIN2((size_t)MediumChunk*6,
+                                       (ClassMetaspaceSize/BytesPerWord)*2);
+    _first_class_chunk_word_size = align_word_size_up(_first_class_chunk_word_size);
     // Arbitrarily set the initial virtual space to a multiple
     // of the boot class loader size.
-    size_t word_size = VIRTUALSPACEMULTIPLIER * Metaspace::first_chunk_word_size();
+    size_t word_size = VIRTUALSPACEMULTIPLIER * first_chunk_word_size();
     // Initialize the list of virtual spaces.
     _space_list = new VirtualSpaceList(word_size);
   }
@@ -2449,23 +2582,8 @@
   _class_space_list = new VirtualSpaceList(rs);
 }
 
-
-void Metaspace::initialize(Mutex* lock, size_t initial_size) {
-  // Use SmallChunk size if not specified.   If specified, use this size for
-  // the data metaspace.
-  size_t word_size;
-  size_t class_word_size;
-  if (initial_size == 0) {
-    word_size = (size_t) SpaceManager::SmallChunk;
-    class_word_size = (size_t) SpaceManager::SmallChunk;
-  } else {
-    word_size = initial_size;
-    // Make the first class chunk bigger than a medium chunk so it's not put
-    // on the medium chunk list.   The next chunk will be small and progress
-    // from there.  This size calculated by -version.
-    class_word_size = MIN2((size_t)SpaceManager::MediumChunk*5,
-                           (ClassMetaspaceSize/BytesPerWord)*2);
-  }
+void Metaspace::initialize(Mutex* lock,
+                           MetaspaceType type) {
 
   assert(space_list() != NULL,
     "Metadata VirtualSpaceList has not been initialized");
@@ -2474,6 +2592,11 @@
   if (_vsm == NULL) {
     return;
   }
+  size_t word_size;
+  size_t class_word_size;
+  vsm()->get_initial_chunk_sizes(type,
+                                 &word_size,
+                                 &class_word_size);
 
   assert(class_space_list() != NULL,
     "Class VirtualSpaceList has not been initialized");
@@ -2488,7 +2611,8 @@
 
   // Allocate chunk for metadata objects
   Metachunk* new_chunk =
-     space_list()->current_virtual_space()->get_chunk_vs_with_expand(word_size);
+     space_list()->get_initialization_chunk(word_size,
+                                            vsm()->medium_chunk_bunch());
   assert(!DumpSharedSpaces || new_chunk != NULL, "should have enough space for both chunks");
   if (new_chunk != NULL) {
     // Add to this manager's list of chunks in use and current_chunk().
@@ -2497,12 +2621,18 @@
 
   // Allocate chunk for class metadata objects
   Metachunk* class_chunk =
-     class_space_list()->current_virtual_space()->get_chunk_vs_with_expand(class_word_size);
+     class_space_list()->get_initialization_chunk(class_word_size,
+                                                  class_vsm()->medium_chunk_bunch());
   if (class_chunk != NULL) {
     class_vsm()->add_chunk(class_chunk, true);
   }
 }
 
+size_t Metaspace::align_word_size_up(size_t word_size) {
+  size_t byte_size = word_size * wordSize;
+  return ReservedSpace::allocation_align_size_up(byte_size) / wordSize;
+}
+
 MetaWord* Metaspace::allocate(size_t word_size, MetadataType mdtype) {
   // DumpSharedSpaces doesn't use class metadata area (yet)
   if (mdtype == ClassType && !DumpSharedSpaces) {
@@ -2628,6 +2758,12 @@
 
     // If result is still null, we are out of memory.
     if (result == NULL) {
+      if (Verbose && TraceMetadataChunkAllocation) {
+        gclog_or_tty->print_cr("Metaspace allocation failed for size "
+          SIZE_FORMAT, word_size);
+        if (loader_data->metaspace_or_null() != NULL) loader_data->metaspace_or_null()->dump(gclog_or_tty);
+        MetaspaceAux::dump(gclog_or_tty);
+      }
       // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
       report_java_out_of_memory("Metadata space");
 
--- a/src/share/vm/memory/metaspace.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metaspace.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -87,11 +87,23 @@
 
  public:
   enum MetadataType {ClassType, NonClassType};
+  enum MetaspaceType {
+    StandardMetaspaceType,
+    BootMetaspaceType,
+    ROMetaspaceType,
+    ReadWriteMetaspaceType,
+    AnonymousMetaspaceType,
+    ReflectionMetaspaceType
+  };
 
  private:
-  void initialize(Mutex* lock, size_t initial_size = 0);
+  void initialize(Mutex* lock, MetaspaceType type);
+
+  // Align up the word size to the allocation word size
+  static size_t align_word_size_up(size_t);
 
   static size_t _first_chunk_word_size;
+  static size_t _first_class_chunk_word_size;
 
   SpaceManager* _vsm;
   SpaceManager* vsm() const { return _vsm; }
@@ -110,8 +122,7 @@
 
  public:
 
-  Metaspace(Mutex* lock, size_t initial_size);
-  Metaspace(Mutex* lock);
+  Metaspace(Mutex* lock, MetaspaceType type);
   ~Metaspace();
 
   // Initialize globals for Metaspace
@@ -119,6 +130,7 @@
   static void initialize_class_space(ReservedSpace rs);
 
   static size_t first_chunk_word_size() { return _first_chunk_word_size; }
+  static size_t first_class_chunk_word_size() { return _first_class_chunk_word_size; }
 
   char*  bottom() const;
   size_t used_words(MetadataType mdtype) const;
@@ -156,16 +168,25 @@
 
  public:
   // Total of space allocated to metadata in all Metaspaces
-  static size_t used_in_bytes();
+  static size_t used_in_bytes() {
+    return used_in_bytes(Metaspace::ClassType) +
+           used_in_bytes(Metaspace::NonClassType);
+  }
 
   // Total of available space in all Metaspaces
   // Total of capacity allocated to all Metaspaces.  This includes
   // space in Metachunks not yet allocated and in the Metachunk
   // freelist.
-  static size_t capacity_in_bytes();
+  static size_t capacity_in_bytes() {
+    return capacity_in_bytes(Metaspace::ClassType) +
+           capacity_in_bytes(Metaspace::NonClassType);
+  }
 
   // Total space reserved in all Metaspaces
-  static size_t reserved_in_bytes();
+  static size_t reserved_in_bytes() {
+    return reserved_in_bytes(Metaspace::ClassType) +
+           reserved_in_bytes(Metaspace::NonClassType);
+  }
 
   static size_t min_chunk_size();
 
--- a/src/share/vm/memory/metaspaceCounters.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metaspaceCounters.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/src/share/vm/memory/metaspaceCounters.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metaspaceCounters.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/src/share/vm/memory/metaspaceShared.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/metaspaceShared.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -373,17 +373,44 @@
   md_top = wc.get_top();
 
   // Print shared spaces all the time
-  const char* fmt = "%s space: " PTR_FORMAT " out of " PTR_FORMAT " words allocated at " PTR_FORMAT ".";
+  const char* fmt = "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " PTR_FORMAT;
   Metaspace* ro_space = _loader_data->ro_metaspace();
   Metaspace* rw_space = _loader_data->rw_metaspace();
-  tty->print_cr(fmt, "ro", ro_space->used_words(Metaspace::NonClassType),
-                ro_space->capacity_words(Metaspace::NonClassType),
-                ro_space->bottom());
-  tty->print_cr(fmt, "rw", rw_space->used_words(Metaspace::NonClassType),
-                rw_space->capacity_words(Metaspace::NonClassType),
-                rw_space->bottom());
-  tty->print_cr(fmt, "md", md_top - md_low, md_end-md_low, md_low);
-  tty->print_cr(fmt, "mc", mc_top - mc_low, mc_end-mc_low, mc_low);
+  const size_t BPW = BytesPerWord;
+
+  // Allocated size of each space (may not be all occupied)
+  const size_t ro_alloced = ro_space->capacity_words(Metaspace::NonClassType) * BPW;
+  const size_t rw_alloced = rw_space->capacity_words(Metaspace::NonClassType) * BPW;
+  const size_t md_alloced = md_end-md_low;
+  const size_t mc_alloced = mc_end-mc_low;
+  const size_t total_alloced = ro_alloced + rw_alloced + md_alloced + mc_alloced;
+
+  // Occupied size of each space.
+  const size_t ro_bytes = ro_space->used_words(Metaspace::NonClassType) * BPW;
+  const size_t rw_bytes = rw_space->used_words(Metaspace::NonClassType) * BPW;
+  const size_t md_bytes = size_t(md_top - md_low);
+  const size_t mc_bytes = size_t(mc_top - mc_low);
+
+  // Percent of total size
+  const size_t total_bytes = ro_bytes + rw_bytes + md_bytes + mc_bytes;
+  const double ro_t_perc = ro_bytes / double(total_bytes) * 100.0;
+  const double rw_t_perc = rw_bytes / double(total_bytes) * 100.0;
+  const double md_t_perc = md_bytes / double(total_bytes) * 100.0;
+  const double mc_t_perc = mc_bytes / double(total_bytes) * 100.0;
+
+  // Percent of fullness of each space
+  const double ro_u_perc = ro_bytes / double(ro_alloced) * 100.0;
+  const double rw_u_perc = rw_bytes / double(rw_alloced) * 100.0;
+  const double md_u_perc = md_bytes / double(md_alloced) * 100.0;
+  const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
+  const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
+
+  tty->print_cr(fmt, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
+  tty->print_cr(fmt, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
+  tty->print_cr(fmt, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
+  tty->print_cr(fmt, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
+  tty->print_cr("total   : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
+                 total_bytes, total_alloced, total_u_perc);
 
   // Update the vtable pointers in all of the Klass objects in the
   // heap. They should point to newly generated vtable.
@@ -689,9 +716,15 @@
 bool MetaspaceShared::map_shared_spaces(FileMapInfo* mapinfo) {
   size_t image_alignment = mapinfo->alignment();
 
-  // Map in the shared memory and then map the regions on top of it
+#ifndef _WINDOWS
+  // Map in the shared memory and then map the regions on top of it.
+  // On Windows, don't map the memory here because it will cause the
+  // mappings of the regions to fail.
   ReservedSpace shared_rs = mapinfo->reserve_shared_memory();
   if (!shared_rs.is_reserved()) return false;
+#endif
+
+  assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
 
   // Map each shared region
   if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
@@ -708,8 +741,10 @@
     if (_rw_base != NULL) mapinfo->unmap_region(rw);
     if (_md_base != NULL) mapinfo->unmap_region(md);
     if (_mc_base != NULL) mapinfo->unmap_region(mc);
+#ifndef _WINDOWS
     // Release the entire mapped region
     shared_rs.release();
+#endif
     // If -Xshare:on is specified, print out the error message and exit VM,
     // otherwise, set UseSharedSpaces to false and continue.
     if (RequireSharedSpaces) {
--- a/src/share/vm/memory/space.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/space.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -411,7 +411,6 @@
     assert(q->forwardee() == NULL, "should be forwarded to NULL");
   }
 
-  VALIDATE_MARK_SWEEP_ONLY(MarkSweep::register_live_oop(q, size));
   compact_top += size;
 
   // we need to update the offset table so that the beginnings of objects can be
@@ -470,13 +469,10 @@
     if (oop(q)->is_gc_marked()) {
       // q is alive
 
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));
       // point all the oops to the new location
       size_t size = oop(q)->adjust_pointers();
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());
 
       debug_only(prev_q = q);
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));
 
       q += size;
     } else {
--- a/src/share/vm/memory/space.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/space.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -655,16 +655,10 @@
       assert(block_is_obj(q),                                                   \
              "should be at block boundaries, and should be looking at objs");   \
                                                                                 \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));     \
-                                                                                \
       /* point all the oops to the new location */                              \
       size_t size = oop(q)->adjust_pointers();                                  \
       size = adjust_obj_size(size);                                             \
                                                                                 \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());           \
-                                                                                \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));     \
-                                                                                \
       q += size;                                                                \
     }                                                                           \
                                                                                 \
@@ -685,12 +679,9 @@
     Prefetch::write(q, interval);                                               \
     if (oop(q)->is_gc_marked()) {                                               \
       /* q is alive */                                                          \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::track_interior_pointers(oop(q)));     \
       /* point all the oops to the new location */                              \
       size_t size = oop(q)->adjust_pointers();                                  \
       size = adjust_obj_size(size);                                             \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::check_interior_pointers());           \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::validate_live_oop(oop(q), size));     \
       debug_only(prev_q = q);                                                   \
       q += size;                                                                \
     } else {                                                                    \
@@ -725,7 +716,6 @@
       size_t size = obj_size(q);                                                \
       assert(!oop(q)->is_gc_marked(),                                           \
              "should be unmarked (special dense prefix handling)");             \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size, q));       \
       debug_only(prev_q = q);                                                   \
       q += size;                                                                \
     }                                                                           \
@@ -759,8 +749,6 @@
       Prefetch::write(compaction_top, copy_interval);                           \
                                                                                 \
       /* copy object and reinit its mark */                                     \
-      VALIDATE_MARK_SWEEP_ONLY(MarkSweep::live_oop_moved_to(q, size,            \
-                                                            compaction_top));   \
       assert(q != compaction_top, "everything in this pass should be moving");  \
       Copy::aligned_conjoint_words(q, compaction_top, size);                    \
       oop(compaction_top)->init_mark();                                         \
--- a/src/share/vm/memory/tenuredGeneration.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/tenuredGeneration.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -62,7 +62,7 @@
                                        _virtual_space.reserved_size(),
                                        _the_space, _gen_counters);
 #ifndef SERIALGC
-  if (UseParNewGC && ParallelGCThreads > 0) {
+  if (UseParNewGC) {
     typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
     _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
                                       ParallelGCThreads, mtGC);
--- a/src/share/vm/memory/universe.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/memory/universe.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -228,7 +228,7 @@
   if (size < alignment || size % alignment != 0) {
     ResourceMark rm;
     stringStream st;
-    st.print("Size of %s (%ld bytes) must be aligned to %ld bytes", name, size, alignment);
+    st.print("Size of %s (" UINTX_FORMAT " bytes) must be aligned to " UINTX_FORMAT " bytes", name, size, alignment);
     char* error = st.as_string();
     vm_exit_during_initialization(error);
   }
--- a/src/share/vm/oops/annotations.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/annotations.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -61,6 +61,9 @@
   free_contents(loader_data, methods_annotations());
   free_contents(loader_data, methods_parameter_annotations());
   free_contents(loader_data, methods_default_annotations());
+
+  // Recursively deallocate optional Annotations linked through this one
+  MetadataFactory::free_metadata(loader_data, type_annotations());
 }
 
 // Set the annotation at 'idnum' to 'anno'.
--- a/src/share/vm/oops/annotations.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/annotations.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -38,7 +38,8 @@
 typedef Array<u1> AnnotationArray;
 
 // Class to hold the various types of annotations. The only metadata that points
-// to this is InstanceKlass.
+// to this is InstanceKlass, or another Annotations instance if this is a
+// a type_annotation instance.
 
 class Annotations: public MetaspaceObj {
 
@@ -58,6 +59,8 @@
   // such annotations.
   // Index is the idnum, which is initially the same as the methods array index.
   Array<AnnotationArray*>*     _methods_default_annotations;
+  // Type annotations for this class, or null if none.
+  Annotations*                 _type_annotations;
 
   // Constructor where some some values are known to not be null
   Annotations(Array<AnnotationArray*>* fa, Array<AnnotationArray*>* ma,
@@ -66,7 +69,8 @@
                  _fields_annotations(fa),
                  _methods_annotations(ma),
                  _methods_parameter_annotations(mpa),
-                 _methods_default_annotations(mda) {}
+                 _methods_default_annotations(mda),
+                 _type_annotations(NULL) {}
 
  public:
   // Allocate instance of this class
@@ -81,22 +85,26 @@
   static int size()    { return sizeof(Annotations) / wordSize; }
 
   // Constructor to initialize to null
-  Annotations() : _class_annotations(NULL), _fields_annotations(NULL),
+  Annotations() : _class_annotations(NULL),
+                  _fields_annotations(NULL),
                   _methods_annotations(NULL),
                   _methods_parameter_annotations(NULL),
-                  _methods_default_annotations(NULL) {}
+                  _methods_default_annotations(NULL),
+                  _type_annotations(NULL) {}
 
   AnnotationArray* class_annotations() const                       { return _class_annotations; }
   Array<AnnotationArray*>* fields_annotations() const              { return _fields_annotations; }
   Array<AnnotationArray*>* methods_annotations() const             { return _methods_annotations; }
   Array<AnnotationArray*>* methods_parameter_annotations() const   { return _methods_parameter_annotations; }
   Array<AnnotationArray*>* methods_default_annotations() const     { return _methods_default_annotations; }
+  Annotations* type_annotations() const                            { return _type_annotations; }
 
   void set_class_annotations(AnnotationArray* md)                     { _class_annotations = md; }
   void set_fields_annotations(Array<AnnotationArray*>* md)            { _fields_annotations = md; }
   void set_methods_annotations(Array<AnnotationArray*>* md)           { _methods_annotations = md; }
   void set_methods_parameter_annotations(Array<AnnotationArray*>* md) { _methods_parameter_annotations = md; }
   void set_methods_default_annotations(Array<AnnotationArray*>* md)   { _methods_default_annotations = md; }
+  void set_type_annotations(Annotations* annos)                       { _type_annotations = annos; }
 
   // Redefine classes support
   AnnotationArray* get_method_annotations_of(int idnum)
@@ -129,6 +137,7 @@
   inline AnnotationArray* get_method_annotations_from(int idnum, Array<AnnotationArray*>* annos);
   void set_annotations(Array<AnnotationArray*>* md, Array<AnnotationArray*>** md_p)  { *md_p = md; }
 
+  bool is_klass() const { return false; }
  private:
   void set_methods_annotations_of(instanceKlassHandle ik,
                                   int idnum, AnnotationArray* anno,
--- a/src/share/vm/oops/constMethod.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/constMethod.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -39,18 +39,21 @@
                                    int localvariable_table_length,
                                    int exception_table_length,
                                    int checked_exceptions_length,
+                                   int method_parameters_length,
                                    u2  generic_signature_index,
                                    MethodType method_type,
                                    TRAPS) {
   int size = ConstMethod::size(byte_code_size,
-                                      compressed_line_number_size,
-                                      localvariable_table_length,
-                                      exception_table_length,
-                                      checked_exceptions_length,
-                                      generic_signature_index);
+                               compressed_line_number_size,
+                               localvariable_table_length,
+                               exception_table_length,
+                               checked_exceptions_length,
+                               method_parameters_length,
+                               generic_signature_index);
   return new (loader_data, size, true, THREAD) ConstMethod(
       byte_code_size, compressed_line_number_size, localvariable_table_length,
-      exception_table_length, checked_exceptions_length, generic_signature_index,
+      exception_table_length, checked_exceptions_length,
+      method_parameters_length, generic_signature_index,
       method_type, size);
 }
 
@@ -59,6 +62,7 @@
                          int localvariable_table_length,
                          int exception_table_length,
                          int checked_exceptions_length,
+                         int method_parameters_length,
                          u2  generic_signature_index,
                          MethodType method_type,
                          int size) {
@@ -74,7 +78,8 @@
                             checked_exceptions_length,
                             compressed_line_number_size,
                             localvariable_table_length,
-                            exception_table_length);
+                            exception_table_length,
+                            method_parameters_length);
   set_method_type(method_type);
   assert(this->size() == size, "wrong size for object");
 }
@@ -92,11 +97,12 @@
 // How big must this constMethodObject be?
 
 int ConstMethod::size(int code_size,
-                                    int compressed_line_number_size,
-                                    int local_variable_table_length,
-                                    int exception_table_length,
-                                    int checked_exceptions_length,
-                                    u2  generic_signature_index) {
+                      int compressed_line_number_size,
+                      int local_variable_table_length,
+                      int exception_table_length,
+                      int checked_exceptions_length,
+                      int method_parameters_length,
+                      u2  generic_signature_index) {
   int extra_bytes = code_size;
   if (compressed_line_number_size > 0) {
     extra_bytes += compressed_line_number_size;
@@ -117,6 +123,10 @@
   if (generic_signature_index != 0) {
     extra_bytes += sizeof(u2);
   }
+  if (method_parameters_length > 0) {
+    extra_bytes += sizeof(u2);
+    extra_bytes += method_parameters_length * sizeof(MethodParametersElement);
+  }
   int extra_words = align_size_up(extra_bytes, BytesPerWord) / BytesPerWord;
   return align_object_size(header_size() + extra_words);
 }
@@ -143,6 +153,18 @@
 u2* ConstMethod::checked_exceptions_length_addr() const {
   // Located immediately before the generic signature index.
   assert(has_checked_exceptions(), "called only if table is present");
+  if(has_method_parameters()) {
+    // If method parameters present, locate immediately before them.
+    return (u2*)method_parameters_start() - 1;
+  } else {
+    // Else, the exception table is at the end of the constMethod.
+    return has_generic_signature() ? (last_u2_element() - 1) :
+                                     last_u2_element();
+  }
+}
+
+u2* ConstMethod::method_parameters_length_addr() const {
+  assert(has_method_parameters(), "called only if table is present");
   return has_generic_signature() ? (last_u2_element() - 1) :
                                     last_u2_element();
 }
@@ -153,11 +175,15 @@
     // If checked_exception present, locate immediately before them.
     return (u2*) checked_exceptions_start() - 1;
   } else {
-    // Else, the exception table is at the end of the constMethod or
-    // immediately before the generic signature index.
+    if(has_method_parameters()) {
+      // If method parameters present, locate immediately before them.
+      return (u2*)method_parameters_start() - 1;
+    } else {
+      // Else, the exception table is at the end of the constMethod.
     return has_generic_signature() ? (last_u2_element() - 1) :
                                       last_u2_element();
   }
+  }
 }
 
 u2* ConstMethod::localvariable_table_length_addr() const {
@@ -170,12 +196,16 @@
       // If checked_exception present, locate immediately before them.
       return (u2*) checked_exceptions_start() - 1;
     } else {
-      // Else, the linenumber table is at the end of the constMethod or
-      // immediately before the generic signature index.
+      if(has_method_parameters()) {
+        // If method parameters present, locate immediately before them.
+        return (u2*)method_parameters_start() - 1;
+      } else {
+        // Else, the exception table is at the end of the constMethod.
       return has_generic_signature() ? (last_u2_element() - 1) :
                                         last_u2_element();
     }
   }
+  }
 }
 
 // Update the flags to indicate the presence of these optional fields.
@@ -183,29 +213,57 @@
                                             int checked_exceptions_len,
                                             int compressed_line_number_size,
                                             int localvariable_table_len,
-                                            int exception_table_len) {
-  // Must be done in the order below, otherwise length_addr accessors
-  // will not work. Only set bit in header if length is positive.
+                                            int exception_table_len,
+                                            int method_parameters_len) {
   assert(_flags == 0, "Error");
-  if (compressed_line_number_size > 0) {
+  if (compressed_line_number_size > 0)
     _flags |= _has_linenumber_table;
-  }
-  if (generic_signature_index != 0) {
+  if (generic_signature_index != 0)
     _flags |= _has_generic_signature;
+  if (method_parameters_len > 0)
+    _flags |= _has_method_parameters;
+  if (checked_exceptions_len > 0)
+    _flags |= _has_checked_exceptions;
+  if (exception_table_len > 0)
+    _flags |= _has_exception_table;
+  if (localvariable_table_len > 0)
+    _flags |= _has_localvariable_table;
+
+  // This code is extremely brittle and should possibly be revised.
+  // The *_length_addr functions walk backwards through the
+  // constMethod data, using each of the length indexes ahead of them,
+  // as well as the flags variable.  Therefore, the indexes must be
+  // initialized in reverse order, or else they will compute the wrong
+  // offsets.  Moving the initialization of _flags into a separate
+  // block solves *half* of the problem, but the following part will
+  // still break if the order is not exactly right.
+  //
+  // Also, the servicability agent needs to be informed anytime
+  // anything is added here.  It might be advisable to have some sort
+  // of indication of this inline.
+  if (generic_signature_index != 0)
     *(generic_signature_index_addr()) = generic_signature_index;
-  }
-  if (checked_exceptions_len > 0) {
-    _flags |= _has_checked_exceptions;
+  // New data should probably go here.
+  if (method_parameters_len > 0)
+    *(method_parameters_length_addr()) = method_parameters_len;
+  if (checked_exceptions_len > 0)
     *(checked_exceptions_length_addr()) = checked_exceptions_len;
-  }
-  if (exception_table_len > 0) {
-    _flags |= _has_exception_table;
+  if (exception_table_len > 0)
     *(exception_table_length_addr()) = exception_table_len;
-  }
-  if (localvariable_table_len > 0) {
-    _flags |= _has_localvariable_table;
+  if (localvariable_table_len > 0)
     *(localvariable_table_length_addr()) = localvariable_table_len;
-  }
+}
+
+int ConstMethod::method_parameters_length() const {
+  return has_method_parameters() ? *(method_parameters_length_addr()) : 0;
+}
+
+MethodParametersElement* ConstMethod::method_parameters_start() const {
+  u2* addr = method_parameters_length_addr();
+  u2 length = *addr;
+  assert(length > 0, "should only be called if table is present");
+  addr -= length * sizeof(MethodParametersElement) / sizeof(u2);
+  return (MethodParametersElement*) addr;
 }
 
 
@@ -298,6 +356,10 @@
   }
   guarantee(compressed_table_end <= m_end, "invalid method layout");
   // Verify checked exceptions, exception table and local variable tables
+  if (has_method_parameters()) {
+    u2* addr = method_parameters_length_addr();
+    guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
+  }
   if (has_checked_exceptions()) {
     u2* addr = checked_exceptions_length_addr();
     guarantee(*addr > 0 && (address) addr >= compressed_table_end && (address) addr < m_end, "invalid method layout");
@@ -318,6 +380,8 @@
     uncompressed_table_start = (u2*) exception_table_start();
   } else if (has_checked_exceptions()) {
       uncompressed_table_start = (u2*) checked_exceptions_start();
+  } else if (has_method_parameters()) {
+      uncompressed_table_start = (u2*) method_parameters_start();
   } else {
       uncompressed_table_start = (u2*) m_end;
   }
--- a/src/share/vm/oops/constMethod.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/constMethod.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -46,6 +46,7 @@
 // | interp_kind  | flags    | code_size                  |
 // | name index              | signature index            |
 // | method_idnum            | max_stack                  |
+// | max_locals              | size_of_parameters         |
 // |------------------------------------------------------|
 // |                                                      |
 // | byte codes                                           |
@@ -76,9 +77,18 @@
 // |  (access flags bit tells whether table is present)   |
 // |  (indexed from end of ConstMethod*)                  |
 // |------------------------------------------------------|
+// | method parameters elements + length (length last)    |
+// |  (length is u2, elements are u2, u4 structures)      |
+// |  (see class MethodParametersElement)                 |
+// |  (access flags bit tells whether table is present)   |
+// |  (indexed from end of ConstMethod*)                  |
+// |------------------------------------------------------|
 // | generic signature index (u2)                         |
 // |  (indexed from start of constMethodOop)              |
 // |------------------------------------------------------|
+//
+// IMPORTANT: If anything gets added here, there need to be changes to
+// ensure that ServicabilityAgent doesn't get broken as a result!
 
 
 // Utitily class decribing elements in checked exceptions table inlined in Method*.
@@ -108,6 +118,18 @@
   u2 catch_type_index;
 };
 
+// Utility class describing elements in method parameters
+class MethodParametersElement VALUE_OBJ_CLASS_SPEC {
+ public:
+  u2 name_cp_index;
+  // This has to happen, otherwise it will cause SIGBUS from a
+  // misaligned u4 on some architectures (ie SPARC)
+  // because MethodParametersElements are only aligned mod 2
+  // within the ConstMethod container  u2 flags_hi;
+  u2 flags_hi;
+  u2 flags_lo;
+};
+
 
 class ConstMethod : public MetaspaceObj {
   friend class VMStructs;
@@ -122,7 +144,8 @@
     _has_localvariable_table = 4,
     _has_exception_table = 8,
     _has_generic_signature = 16,
-    _is_overpass = 32
+    _has_method_parameters = 32,
+    _is_overpass = 64
   };
 
   // Bit vector of signature
@@ -150,7 +173,8 @@
                                                  // initially corresponds to the index into the methods array.
                                                  // but this may change with redefinition
   u2                _max_stack;                  // Maximum number of entries on the expression stack
-
+  u2                _max_locals;                 // Number of local variables used by this method
+  u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
 
   // Constructor
   ConstMethod(int byte_code_size,
@@ -158,6 +182,7 @@
               int localvariable_table_length,
               int exception_table_length,
               int checked_exceptions_length,
+              int method_parameters_length,
               u2  generic_signature_index,
               MethodType is_overpass,
               int size);
@@ -169,6 +194,7 @@
                                int localvariable_table_length,
                                int exception_table_length,
                                int checked_exceptions_length,
+                               int method_parameters_length,
                                u2  generic_signature_index,
                                MethodType mt,
                                TRAPS);
@@ -180,7 +206,8 @@
                                  int checked_exceptions_len,
                                  int compressed_line_number_size,
                                  int localvariable_table_len,
-                                 int exception_table_len);
+                                 int exception_table_len,
+                                 int method_parameters_length);
 
   bool has_generic_signature() const
     { return (_flags & _has_generic_signature) != 0; }
@@ -197,6 +224,9 @@
   bool has_exception_handler() const
     { return (_flags & _has_exception_table) != 0; }
 
+  bool has_method_parameters() const
+    { return (_flags & _has_method_parameters) != 0; }
+
   MethodType method_type() const {
     return ((_flags & _is_overpass) == 0) ? NORMAL : OVERPASS;
   }
@@ -282,10 +312,11 @@
 
   // Size needed
   static int size(int code_size, int compressed_line_number_size,
-                         int local_variable_table_length,
-                         int exception_table_length,
-                         int checked_exceptions_length,
-                         u2  generic_signature_index);
+                  int local_variable_table_length,
+                  int exception_table_length,
+                  int checked_exceptions_length,
+                  int method_parameters_length,
+                  u2  generic_signature_index);
 
   int size() const                    { return _constMethod_size;}
   void set_constMethod_size(int size)     { _constMethod_size = size; }
@@ -306,6 +337,7 @@
   u2* checked_exceptions_length_addr() const;
   u2* localvariable_table_length_addr() const;
   u2* exception_table_length_addr() const;
+  u2* method_parameters_length_addr() const;
 
   // checked exceptions
   int checked_exceptions_length() const;
@@ -319,6 +351,10 @@
   int exception_table_length() const;
   ExceptionTableElement* exception_table_start() const;
 
+  // method parameters table
+  int method_parameters_length() const;
+  MethodParametersElement* method_parameters_start() const;
+
   // byte codes
   void    set_code(address code) {
     if (code_size() > 0) {
@@ -338,6 +374,11 @@
 
   static ByteSize max_stack_offset()
                             { return byte_offset_of(ConstMethod, _max_stack); }
+  static ByteSize size_of_locals_offset()
+                            { return byte_offset_of(ConstMethod, _max_locals); }
+  static ByteSize size_of_parameters_offset()
+                            { return byte_offset_of(ConstMethod, _size_of_parameters); }
+
 
   // Unique id for the method
   static const u2 MAX_IDNUM;
@@ -349,6 +390,14 @@
   int  max_stack() const                         { return _max_stack; }
   void set_max_stack(int size)                   { _max_stack = size; }
 
+  // max locals
+  int  max_locals() const                        { return _max_locals; }
+  void set_max_locals(int size)                  { _max_locals = size; }
+
+  // size of parameters
+  int  size_of_parameters() const                { return _size_of_parameters; }
+  void set_size_of_parameters(int size)          { _size_of_parameters = size; }
+
   // Deallocation for RedefineClasses
   void deallocate_contents(ClassLoaderData* loader_data);
   bool is_klass() const { return false; }
--- a/src/share/vm/oops/constantPool.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/constantPool.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -66,7 +66,7 @@
   set_pool_holder(NULL);
   set_flags(0);
   // only set to non-zero if constant pool is merged by RedefineClasses
-  set_orig_length(0);
+  set_version(0);
   set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
   // all fields are initialized; needed for GC
   set_on_stack(false);
--- a/src/share/vm/oops/constantPool.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/constantPool.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -103,8 +103,8 @@
   union {
     // set for CDS to restore resolved references
     int                _resolved_reference_length;
-  // only set to non-zero if constant pool is merged by RedefineClasses
-  int                  _orig_length;
+    // keeps version number for redefined classes (used in backtrace)
+    int                _version;
   } _saved;
 
   Monitor*             _lock;
@@ -786,8 +786,11 @@
   static void copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS);
   static void copy_entry_to(constantPoolHandle from_cp, int from_i, constantPoolHandle to_cp, int to_i, TRAPS);
   int  find_matching_entry(int pattern_i, constantPoolHandle search_cp, TRAPS);
-  int  orig_length() const                { return _saved._orig_length; }
-  void set_orig_length(int orig_length)   { _saved._orig_length = orig_length; }
+  int  version() const                    { return _saved._version; }
+  void set_version(int version)           { _saved._version = version; }
+  void increment_and_save_version(int version) {
+    _saved._version = version >= 0 ? (version + 1) : version;  // keep overflow
+  }
 
   void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; }
   int  resolved_reference_length() const  { return _saved._resolved_reference_length; }
--- a/src/share/vm/oops/fieldInfo.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/fieldInfo.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -43,14 +43,29 @@
  public:
   // fields
   // Field info extracted from the class file and stored
-  // as an array of 7 shorts
+  // as an array of 6 shorts.
+
+#define FIELDINFO_TAG_SIZE             2
+#define FIELDINFO_TAG_BLANK            0
+#define FIELDINFO_TAG_OFFSET           1
+#define FIELDINFO_TAG_TYPE_PLAIN       2
+#define FIELDINFO_TAG_TYPE_CONTENDED   3
+#define FIELDINFO_TAG_MASK             3
+
+  // Packed field has the tag, and can be either of:
+  //    hi bits <--------------------------- lo bits
+  //   |---------high---------|---------low---------|
+  //    ..........................................00  - blank
+  //    [------------------offset----------------]01  - real field offset
+  //    ......................[-------type-------]10  - plain field with type
+  //    [--contention_group--][-------type-------]11  - contended field with type and contention group
   enum FieldOffset {
     access_flags_offset      = 0,
     name_index_offset        = 1,
     signature_index_offset   = 2,
     initval_index_offset     = 3,
-    low_offset               = 4,
-    high_offset              = 5,
+    low_packed_offset        = 4,
+    high_packed_offset       = 5,
     field_slots              = 6
   };
 
@@ -76,17 +91,90 @@
   void initialize(u2 access_flags,
                   u2 name_index,
                   u2 signature_index,
-                  u2 initval_index,
-                  u4 offset) {
+                  u2 initval_index) {
     _shorts[access_flags_offset] = access_flags;
     _shorts[name_index_offset] = name_index;
     _shorts[signature_index_offset] = signature_index;
     _shorts[initval_index_offset] = initval_index;
-    set_offset(offset);
+    _shorts[low_packed_offset] = 0;
+    _shorts[high_packed_offset] = 0;
   }
 
   u2 access_flags() const                        { return _shorts[access_flags_offset];            }
-  u4 offset() const                              { return build_int_from_shorts(_shorts[low_offset], _shorts[high_offset]); }
+  u4 offset() const {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_OFFSET:
+        return build_int_from_shorts(_shorts[low_packed_offset], _shorts[high_packed_offset]) >> FIELDINFO_TAG_SIZE;
+#ifndef PRODUCT
+      case FIELDINFO_TAG_TYPE_PLAIN:
+        ShouldNotReachHere2("Asking offset for the plain type field");
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+        ShouldNotReachHere2("Asking offset for the contended type field");
+      case FIELDINFO_TAG_BLANK:
+        ShouldNotReachHere2("Asking offset for the blank field");
+#endif
+    }
+    ShouldNotReachHere();
+    return 0;
+  }
+
+  bool is_contended() const {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_TYPE_PLAIN:
+        return false;
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+        return true;
+#ifndef PRODUCT
+      case FIELDINFO_TAG_OFFSET:
+        ShouldNotReachHere2("Asking contended flag for the field with offset");
+      case FIELDINFO_TAG_BLANK:
+        ShouldNotReachHere2("Asking contended flag for the blank field");
+#endif
+    }
+    ShouldNotReachHere();
+    return false;
+  }
+
+  u2 contended_group() const {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_TYPE_PLAIN:
+        return 0;
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+        return _shorts[high_packed_offset];
+#ifndef PRODUCT
+      case FIELDINFO_TAG_OFFSET:
+        ShouldNotReachHere2("Asking the contended group for the field with offset");
+      case FIELDINFO_TAG_BLANK:
+        ShouldNotReachHere2("Asking the contended group for the blank field");
+#endif
+    }
+    ShouldNotReachHere();
+    return 0;
+ }
+
+  u2 allocation_type() const {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_TYPE_PLAIN:
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+        return (lo >> FIELDINFO_TAG_SIZE);
+#ifndef PRODUCT
+      case FIELDINFO_TAG_OFFSET:
+        ShouldNotReachHere2("Asking the field type for field with offset");
+      case FIELDINFO_TAG_BLANK:
+        ShouldNotReachHere2("Asking the field type for the blank field");
+#endif
+    }
+    ShouldNotReachHere();
+    return 0;
+  }
+
+  bool is_offset_set() const {
+    return (_shorts[low_packed_offset] & FIELDINFO_TAG_MASK) == FIELDINFO_TAG_OFFSET;
+  }
 
   Symbol* name(constantPoolHandle cp) const {
     int index = name_index();
@@ -106,8 +194,46 @@
 
   void set_access_flags(u2 val)                  { _shorts[access_flags_offset] = val;             }
   void set_offset(u4 val)                        {
-    _shorts[low_offset] = extract_low_short_from_int(val);
-    _shorts[high_offset] = extract_high_short_from_int(val);
+    val = val << FIELDINFO_TAG_SIZE; // make room for tag
+    _shorts[low_packed_offset] = extract_low_short_from_int(val) | FIELDINFO_TAG_OFFSET;
+    _shorts[high_packed_offset] = extract_high_short_from_int(val);
+  }
+
+  void set_allocation_type(int type) {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_BLANK:
+        _shorts[low_packed_offset] = ((type << FIELDINFO_TAG_SIZE)) & 0xFFFF;
+        _shorts[low_packed_offset] &= ~FIELDINFO_TAG_MASK;
+        _shorts[low_packed_offset] |= FIELDINFO_TAG_TYPE_PLAIN;
+        return;
+#ifndef PRODUCT
+      case FIELDINFO_TAG_TYPE_PLAIN:
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+      case FIELDINFO_TAG_OFFSET:
+        ShouldNotReachHere2("Setting the field type with overwriting");
+#endif
+    }
+    ShouldNotReachHere();
+  }
+
+  void set_contended_group(u2 val) {
+    u2 lo = _shorts[low_packed_offset];
+    switch(lo & FIELDINFO_TAG_MASK) {
+      case FIELDINFO_TAG_TYPE_PLAIN:
+        _shorts[low_packed_offset] |= FIELDINFO_TAG_TYPE_CONTENDED;
+        _shorts[high_packed_offset] = val;
+        return;
+#ifndef PRODUCT
+      case FIELDINFO_TAG_TYPE_CONTENDED:
+        ShouldNotReachHere2("Overwriting contended group");
+      case FIELDINFO_TAG_BLANK:
+        ShouldNotReachHere2("Setting contended group for the blank field");
+      case FIELDINFO_TAG_OFFSET:
+        ShouldNotReachHere2("Setting contended group for field with offset");
+#endif
+    }
+    ShouldNotReachHere();
   }
 
   bool is_internal() const {
--- a/src/share/vm/oops/fieldStreams.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/fieldStreams.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -160,9 +160,26 @@
     return field()->offset();
   }
 
+  int allocation_type() const {
+    return field()->allocation_type();
+  }
+
   void set_offset(int offset) {
     field()->set_offset(offset);
   }
+
+  bool is_offset_set() const {
+    return field()->is_offset_set();
+  }
+
+  bool is_contended() const {
+    return field()->is_contended();
+  }
+
+  int contended_group() const {
+    return field()->contended_group();
+  }
+
 };
 
 // Iterate over only the internal fields
--- a/src/share/vm/oops/instanceKlass.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/instanceKlass.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -47,6 +47,7 @@
 #include "oops/symbol.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
+#include "prims/methodComparator.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
@@ -160,6 +161,8 @@
 
 #endif //  ndef DTRACE_ENABLED
 
+volatile int InstanceKlass::_total_instanceKlass_count = 0;
+
 Klass* InstanceKlass::allocate_instance_klass(ClassLoaderData* loader_data,
                                                 int vtable_len,
                                                 int itable_len,
@@ -203,6 +206,7 @@
         access_flags, !host_klass.is_null());
   }
 
+  Atomic::inc(&_total_instanceKlass_count);
   return ik;
 }
 
@@ -361,6 +365,9 @@
   set_protection_domain(NULL);
   set_signers(NULL);
   set_init_lock(NULL);
+
+  // We should deallocate the Annotations instance
+  MetadataFactory::free_metadata(loader_data, annotations());
   set_annotations(NULL);
 }
 
@@ -599,7 +606,7 @@
       }
 
       // relocate jsrs and link methods after they are all rewritten
-      this_oop->relocate_and_link_methods(CHECK_false);
+      this_oop->link_methods(CHECK_false);
 
       // Initialize the vtable and interface table after
       // methods have been rewritten since rewrite may
@@ -647,10 +654,31 @@
 // Now relocate and link method entry points after class is rewritten.
 // This is outside is_rewritten flag. In case of an exception, it can be
 // executed more than once.
-void InstanceKlass::relocate_and_link_methods(TRAPS) {
-  assert(is_loaded(), "must be loaded");
-  instanceKlassHandle this_oop(THREAD, this);
-  Rewriter::relocate_and_link(this_oop, CHECK);
+void InstanceKlass::link_methods(TRAPS) {
+  int len = methods()->length();
+  for (int i = len-1; i >= 0; i--) {
+    methodHandle m(THREAD, methods()->at(i));
+
+    // Set up method entry points for compiler and interpreter    .
+    m->link_method(m, CHECK);
+
+    // This is for JVMTI and unrelated to relocator but the last thing we do
+#ifdef ASSERT
+    if (StressMethodComparator) {
+      ResourceMark rm(THREAD);
+      static int nmc = 0;
+      for (int j = i; j >= 0 && j >= i-4; j--) {
+        if ((++nmc % 1000) == 0)  tty->print_cr("Have run MethodComparator %d times...", nmc);
+        bool z = MethodComparator::methods_EMCP(m(),
+                   methods()->at(j));
+        if (j == i && !z) {
+          tty->print("MethodComparator FAIL: "); m->print(); m->print_codes();
+          assert(z, "method must compare equal to itself");
+        }
+      }
+    }
+#endif //ASSERT
+  }
 }
 
 
@@ -2306,6 +2334,9 @@
   if (_array_name != NULL)  _array_name->decrement_refcount();
   if (_source_file_name != NULL) _source_file_name->decrement_refcount();
   if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
+
+  assert(_total_instanceKlass_count >= 1, "Sanity check");
+  Atomic::dec(&_total_instanceKlass_count);
 }
 
 void InstanceKlass::set_source_file_name(Symbol* n) {
@@ -2859,11 +2890,7 @@
     st->print(BULLET"fake entry for mirror: ");
     mirrored_klass->print_value_on_maybe_null(st);
     st->cr();
-    st->print(BULLET"fake entry resolved_constructor: ");
-    Method* ctor = java_lang_Class::resolved_constructor(obj);
-    ctor->print_value_on_maybe_null(st);
     Klass* array_klass = java_lang_Class::array_klass(obj);
-    st->cr();
     st->print(BULLET"fake entry for array: ");
     array_klass->print_value_on_maybe_null(st);
     st->cr();
--- a/src/share/vm/oops/instanceKlass.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/instanceKlass.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -31,6 +31,7 @@
 #include "oops/fieldInfo.hpp"
 #include "oops/instanceOop.hpp"
 #include "oops/klassVtable.hpp"
+#include "runtime/atomic.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/os.hpp"
 #include "utilities/accessFlags.hpp"
@@ -170,6 +171,11 @@
     initialization_error                // error happened during initialization
   };
 
+  static int number_of_instance_classes() { return _total_instanceKlass_count; }
+
+ private:
+  static volatile int _total_instanceKlass_count;
+
  protected:
   // Protection domain.
   oop             _protection_domain;
@@ -219,12 +225,17 @@
   u2              _java_fields_count;    // The number of declared Java fields
   int             _nonstatic_oop_map_size;// size in words of nonstatic oop map blocks
 
+  // _is_marked_dependent can be set concurrently, thus cannot be part of the
+  // _misc_flags.
   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
+
   enum {
     _misc_rewritten            = 1 << 0, // methods rewritten.
     _misc_has_nonstatic_fields = 1 << 1, // for sizing with UseCompressedOops
     _misc_should_verify_class  = 1 << 2, // allow caching of preverification
-    _misc_is_anonymous         = 1 << 3  // has embedded _inner_classes field
+    _misc_is_anonymous         = 1 << 3, // has embedded _inner_classes field
+    _misc_is_contended         = 1 << 4, // marked with contended annotation
+    _misc_has_default_methods  = 1 << 5  // class/superclass/implemented interfaces has default methods
   };
   u2              _misc_flags;
   u2              _minor_version;        // minor version number of class file
@@ -247,10 +258,6 @@
   jint            _cached_class_file_len;         // JVMTI: length of above
   JvmtiCachedClassFieldMap* _jvmti_cached_class_field_map;  // JVMTI: used during heap iteration
 
-  // true if class, superclass, or implemented interfaces have default methods
-  bool            _has_default_methods;
-
-  volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
   // Method array.
   Array<Method*>* _methods;
   // Interface (Klass*s) this class declares locally to implement.
@@ -274,6 +281,8 @@
   //     ...
   Array<u2>*      _fields;
 
+  volatile u2     _idnum_allocated_count;         // JNI/JVMTI: increments with the addition of methods, old ids don't change
+
   // Class states are defined as ClassState (see above).
   // Place the _init_state here to utilize the unused 2-byte after
   // _idnum_allocated_count.
@@ -454,7 +463,7 @@
   bool link_class_or_fail(TRAPS); // returns false on failure
   void unlink_class();
   void rewrite_class(TRAPS);
-  void relocate_and_link_methods(TRAPS);
+  void link_methods(TRAPS);
   Method* class_initializer();
 
   // set the class to initialized if no static initializer is present
@@ -538,6 +547,23 @@
     }
   }
 
+  // Oop that keeps the metadata for this class from being unloaded
+  // in places where the metadata is stored in other places, like nmethods
+  oop klass_holder() const {
+    return is_anonymous() ? java_mirror() : class_loader();
+  }
+
+  bool is_contended() const                {
+    return (_misc_flags & _misc_is_contended) != 0;
+  }
+  void set_is_contended(bool value)        {
+    if (value) {
+      _misc_flags |= _misc_is_contended;
+    } else {
+      _misc_flags &= ~_misc_is_contended;
+    }
+  }
+
   // signers
   objArrayOop signers() const              { return _signers; }
   void set_signers(objArrayOop s)          { klass_oop_store((oop*)&_signers, s); }
@@ -604,8 +630,16 @@
     return _jvmti_cached_class_field_map;
   }
 
-  bool has_default_methods() const { return _has_default_methods; }
-  void set_has_default_methods(bool b) { _has_default_methods = b; }
+  bool has_default_methods() const {
+    return (_misc_flags & _misc_has_default_methods) != 0;
+  }
+  void set_has_default_methods(bool b) {
+    if (b) {
+      _misc_flags |= _misc_has_default_methods;
+    } else {
+      _misc_flags &= ~_misc_has_default_methods;
+    }
+  }
 
   // for adding methods, ConstMethod::UNSET_IDNUM means no more ids available
   inline u2 next_method_idnum();
@@ -651,6 +685,10 @@
     if (annotations() == NULL) return NULL;
     return annotations()->fields_annotations();
   }
+  Annotations* type_annotations() const {
+    if (annotations() == NULL) return NULL;
+    return annotations()->type_annotations();
+  }
 
   // allocation
   instanceOop allocate_instance(TRAPS);
--- a/src/share/vm/oops/klass.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/klass.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -466,6 +466,8 @@
 
   oop class_loader() const;
 
+  virtual oop klass_holder() const      { return class_loader(); }
+
  protected:
   virtual Klass* array_klass_impl(bool or_null, int rank, TRAPS);
   virtual Klass* array_klass_impl(bool or_null, TRAPS);
--- a/src/share/vm/oops/method.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/method.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -67,6 +67,7 @@
                          int localvariable_table_length,
                          int exception_table_length,
                          int checked_exceptions_length,
+                         int method_parameters_length,
                          u2  generic_signature_index,
                          ConstMethod::MethodType method_type,
                          TRAPS) {
@@ -78,6 +79,7 @@
                                           localvariable_table_length,
                                           exception_table_length,
                                           checked_exceptions_length,
+                                          method_parameters_length,
                                           generic_signature_index,
                                           method_type,
                                           CHECK_NULL);
@@ -200,16 +202,16 @@
   return buf;
 }
 
-int  Method::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) {
+int Method::fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS) {
   // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index)
   // access exception table
-  ExceptionTable table(this);
+  ExceptionTable table(mh());
   int length = table.length();
   // iterate through all entries sequentially
-  constantPoolHandle pool(THREAD, constants());
+  constantPoolHandle pool(THREAD, mh->constants());
   for (int i = 0; i < length; i ++) {
     //reacquire the table in case a GC happened
-    ExceptionTable table(this);
+    ExceptionTable table(mh());
     int beg_bci = table.start_pc(i);
     int end_bci = table.end_pc(i);
     assert(beg_bci <= end_bci, "inconsistent exception table");
@@ -1044,8 +1046,10 @@
 
   methodHandle m;
   {
-    Method* m_oop = Method::allocate(loader_data, 0, accessFlags_from(flags_bits),
-             0, 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty));
+    Method* m_oop = Method::allocate(loader_data, 0,
+                                     accessFlags_from(flags_bits),
+                                     0, 0, 0, 0, 0, 0,
+                                     ConstMethod::NORMAL, CHECK_(empty));
     m = methodHandle(THREAD, m_oop);
   }
   m->set_constants(cp());
@@ -1097,6 +1101,7 @@
   int checked_exceptions_len = m->checked_exceptions_length();
   int localvariable_len = m->localvariable_table_length();
   int exception_table_len = m->exception_table_length();
+  int method_parameters_len = m->method_parameters_length();
 
   ClassLoaderData* loader_data = m->method_holder()->class_loader_data();
   Method* newm_oop = Method::allocate(loader_data,
@@ -1106,6 +1111,7 @@
                                       localvariable_len,
                                       exception_table_len,
                                       checked_exceptions_len,
+                                      method_parameters_len,
                                       generic_signature_index,
                                       m->method_type(),
                                       CHECK_(methodHandle()));
@@ -1340,13 +1346,15 @@
                                  Array<AnnotationArray*>* methods_annotations,
                                  Array<AnnotationArray*>* methods_parameter_annotations,
                                  Array<AnnotationArray*>* methods_default_annotations,
+                                 Array<AnnotationArray*>* methods_type_annotations,
                                  bool idempotent) {
   int length = methods->length();
   if (length > 1) {
     bool do_annotations = false;
     if (methods_annotations != NULL ||
         methods_parameter_annotations != NULL ||
-        methods_default_annotations != NULL) {
+        methods_default_annotations != NULL ||
+        methods_type_annotations != NULL) {
       do_annotations = true;
     }
     if (do_annotations) {
@@ -1365,6 +1373,7 @@
     assert(methods_annotations == NULL           || methods_annotations->length() == methods->length(), "");
     assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), "");
     assert(methods_default_annotations == NULL   || methods_default_annotations->length() == methods->length(), "");
+    assert(methods_type_annotations == NULL   || methods_type_annotations->length() == methods->length(), "");
     if (do_annotations) {
       ResourceMark rm;
       // Allocate temporary storage
@@ -1372,6 +1381,7 @@
       reorder_based_on_method_index(methods, methods_annotations, temp_array);
       reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array);
       reorder_based_on_method_index(methods, methods_default_annotations, temp_array);
+      reorder_based_on_method_index(methods, methods_type_annotations, temp_array);
     }
 
     // Reset method ordering
--- a/src/share/vm/oops/method.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/oops/method.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -73,8 +73,7 @@
 // |------------------------------------------------------|
 // | result_index (C++ interpreter only)                  |
 // |------------------------------------------------------|
-// | method_size             |   max_locals               |
-// | size_of_parameters      |   intrinsic_id|   flags    |
+// | method_size             |   intrinsic_id|   flags    |
 // |------------------------------------------------------|
 // | throwout_count          |   num_breakpoints          |
 // |------------------------------------------------------|
@@ -116,8 +115,6 @@
   int               _result_index;               // C++ interpreter needs for converting results to/from stack
 #endif
   u2                _method_size;                // size of this object
-  u2                _max_locals;                 // Number of local variables used by this method
-  u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
   u1                _jfr_towrite  : 1,           // Flags
                     _force_inline : 1,
@@ -167,6 +164,7 @@
                           int localvariable_table_length,
                           int exception_table_length,
                           int checked_exceptions_length,
+                          int method_parameters_length,
                           u2 generic_signature_index,
                           ConstMethod::MethodType method_type,
                           TRAPS);
@@ -232,6 +230,13 @@
     }
     return ik->annotations()->get_method_default_annotations_of(method_idnum());
   }
+  AnnotationArray* type_annotations() const {
+  InstanceKlass* ik = method_holder();
+  Annotations* type_annos = ik->type_annotations();
+  if (type_annos == NULL)
+    return NULL;
+  return type_annos->get_method_annotations_of(method_idnum());
+}
 
 #ifdef CC_INTERP
   void set_result_index(BasicType type);
@@ -296,8 +301,8 @@
   void      set_max_stack(int size)              {        constMethod()->set_max_stack(size); }
 
   // max locals
-  int  max_locals() const                        { return _max_locals; }
-  void set_max_locals(int size)                  { _max_locals = size; }
+  int  max_locals() const                        { return constMethod()->max_locals(); }
+  void set_max_locals(int size)                  { constMethod()->set_max_locals(size); }
 
   int highest_comp_level() const;
   void set_highest_comp_level(int level);
@@ -315,7 +320,8 @@
   void set_interpreter_throwout_count(int count) { _interpreter_throwout_count = count; }
 
   // size of parameters
-  int  size_of_parameters() const                { return _size_of_parameters; }
+  int  size_of_parameters() const                { return constMethod()->size_of_parameters(); }
+  void set_size_of_parameters(int size)          { constMethod()->set_size_of_parameters(size); }
 
   bool has_stackmap_table() const {
     return constMethod()->has_stackmap_table();
@@ -349,7 +355,7 @@
   // exception handler which caused the exception to be thrown, which
   // is needed for proper retries. See, for example,
   // InterpreterRuntime::exception_handler_for_exception.
-  int fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS);
+  static int fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS);
 
   // method data access
   MethodData* method_data() const              {
@@ -487,6 +493,12 @@
   void print_codes_on(outputStream* st) const                      PRODUCT_RETURN;
   void print_codes_on(int from, int to, outputStream* st) const    PRODUCT_RETURN;
 
+  // method parameters
+  int method_parameters_length() const
+                         { return constMethod()->method_parameters_length(); }
+  MethodParametersElement* method_parameters_start() const
+                          { return constMethod()->method_parameters_start(); }
+
   // checked exceptions
   int checked_exceptions_length() const
                          { return constMethod()->checked_exceptions_length(); }
@@ -600,8 +612,6 @@
 #ifdef CC_INTERP
   static ByteSize result_index_offset()          { return byte_offset_of(Method, _result_index ); }
 #endif /* CC_INTERP */
-  static ByteSize size_of_locals_offset()        { return byte_offset_of(Method, _max_locals        ); }
-  static ByteSize size_of_parameters_offset()    { return byte_offset_of(Method, _size_of_parameters); }
   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
   static ByteSize invocation_counter_offset()    { return byte_offset_of(Method, _invocation_counter); }
@@ -810,11 +820,9 @@
                            Array<AnnotationArray*>* methods_annotations,
                            Array<AnnotationArray*>* methods_parameter_annotations,
                            Array<AnnotationArray*>* methods_default_annotations,
+                           Array<AnnotationArray*>* methods_type_annotations,
                            bool idempotent = false);
 
-  // size of parameters
-  void set_size_of_parameters(int size)          { _size_of_parameters = size; }
-
   // Deallocation function for redefine classes or if an error occurs
   void deallocate_contents(ClassLoaderData* loader_data);
 
--- a/src/share/vm/opto/addnode.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/addnode.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -189,6 +189,11 @@
       set_req(1, addx);
       set_req(2, a22);
       progress = this;
+      PhaseIterGVN *igvn = phase->is_IterGVN();
+      if (add2->outcnt() == 0 && igvn) {
+        // add disconnected.
+        igvn->_worklist.push(add2);
+      }
     }
   }
 
@@ -624,6 +629,11 @@
     if( t22->singleton() && (t22 != Type::TOP) ) {  // Right input is an add of a constant?
       set_req(Address, phase->transform(new (phase->C) AddPNode(in(Base),in(Address),add->in(1))));
       set_req(Offset, add->in(2));
+      PhaseIterGVN *igvn = phase->is_IterGVN();
+      if (add->outcnt() == 0 && igvn) {
+        // add disconnected.
+        igvn->_worklist.push((Node*)add);
+      }
       return this;              // Made progress
     }
   }
--- a/src/share/vm/opto/bytecodeInfo.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -46,7 +46,8 @@
   _method(callee),
   _site_invoke_ratio(site_invoke_ratio),
   _max_inline_level(max_inline_level),
-  _count_inline_bcs(method()->code_size_for_inlining())
+  _count_inline_bcs(method()->code_size_for_inlining()),
+  _subtrees(c->comp_arena(), 2, 0, NULL)
 {
   NOT_PRODUCT(_count_inlines = 0;)
   if (_caller_jvms != NULL) {
@@ -209,7 +210,7 @@
   if ( callee_method->dont_inline())                        return "don't inline by annotation";
   if ( callee_method->has_unloaded_classes_in_signature())  return "unloaded signature classes";
 
-  if (callee_method->force_inline() || callee_method->should_inline()) {
+  if (callee_method->should_inline()) {
     // ignore heuristic controls on inlining
     return NULL;
   }
@@ -219,9 +220,11 @@
 
   // Now perform checks which are heuristic
 
-  if (callee_method->has_compiled_code() &&
-      callee_method->instructions_size() > InlineSmallCode) {
+  if (!callee_method->force_inline()) {
+    if (callee_method->has_compiled_code() &&
+        callee_method->instructions_size() > InlineSmallCode) {
     return "already compiled into a big method";
+    }
   }
 
   // don't inline exception code unless the top method belongs to an
@@ -280,12 +283,15 @@
 //-----------------------------try_to_inline-----------------------------------
 // return NULL if ok, reason for not inlining otherwise
 // Relocated from "InliningClosure::try_to_inline"
-const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) {
-
+const char* InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay) {
   // Old algorithm had funny accumulating BC-size counters
   if (UseOldInlining && ClipInlining
       && (int)count_inline_bcs() >= DesiredMethodLimit) {
-    return "size > DesiredMethodLimit";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "size > DesiredMethodLimit";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   const char *msg = NULL;
@@ -306,8 +312,13 @@
   if (callee_method->code_size() > MaxTrivialSize) {
 
     // don't inline into giant methods
-    if (C->unique() > (uint)NodeCountInliningCutoff) {
-      return "NodeCountInliningCutoff";
+    if (C->over_inlining_cutoff()) {
+      if ((!callee_method->force_inline() && !caller_method->is_compiled_lambda_form())
+          || !IncrementalInline) {
+        return "NodeCountInliningCutoff";
+      } else {
+        should_delay = true;
+      }
     }
 
     if ((!UseInterpreter || CompileTheWorld) &&
@@ -326,7 +337,11 @@
     return "not an accessor";
   }
   if (inline_level() > _max_inline_level) {
-    return "inlining too deep";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "inlining too deep";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   // detect direct and indirect recursive inlining
@@ -351,7 +366,11 @@
 
   if (UseOldInlining && ClipInlining
       && (int)count_inline_bcs() + size >= DesiredMethodLimit) {
-    return "size > DesiredMethodLimit";
+    if (!callee_method->force_inline() || !IncrementalInline) {
+      return "size > DesiredMethodLimit";
+    } else if (!C->inlining_incrementally()) {
+      should_delay = true;
+    }
   }
 
   // ok, inline this method
@@ -406,7 +425,7 @@
 //------------------------------print_inlining---------------------------------
 // Really, the failure_msg can be a success message also.
 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const {
-  CompileTask::print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline");
+  C->print_inlining(callee_method, inline_level(), caller_bci, failure_msg ? failure_msg : "inline");
   if (callee_method == NULL)  tty->print(" callee not monotonic or profiled");
   if (Verbose && callee_method) {
     const InlineTree *top = this;
@@ -416,8 +435,9 @@
 }
 
 //------------------------------ok_to_inline-----------------------------------
-WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci) {
+WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci, bool& should_delay) {
   assert(callee_method != NULL, "caller checks for optimized virtual!");
+  assert(!should_delay, "should be initialized to false");
 #ifdef ASSERT
   // Make sure the incoming jvms has the same information content as me.
   // This means that we can eventually make this whole class AllStatic.
@@ -447,7 +467,7 @@
 
   // Check if inlining policy says no.
   WarmCallInfo wci = *(initial_wci);
-  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci);
+  failure_msg = try_to_inline(callee_method, caller_method, caller_bci, profile, &wci, should_delay);
   if (failure_msg != NULL && C->log() != NULL) {
     C->log()->inline_fail(failure_msg);
   }
--- a/src/share/vm/opto/c2_globals.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/c2_globals.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -516,6 +516,9 @@
   develop(bool, SpecialArraysEquals, true,                                  \
           "special version of Arrays.equals(char[],char[])")                \
                                                                             \
+  product(bool, SpecialEncodeISOArray, true,                                \
+          "special version of ISO_8859_1$Encoder.encodeISOArray")           \
+                                                                            \
   develop(bool, BailoutToInterpreterForThrows, false,                       \
           "Compiled methods which throws/catches exceptions will be "       \
           "deopt and intp.")                                                \
@@ -606,6 +609,16 @@
                                                                             \
   develop(bool, VerifyAliases, false,                                       \
           "perform extra checks on the results of alias analysis")          \
+                                                                            \
+  product(bool, IncrementalInline, true,                                    \
+          "do post parse inlining")                                         \
+                                                                            \
+  develop(bool, AlwaysIncrementalInline, false,                             \
+          "do all inlining incrementally")                                  \
+                                                                            \
+  product(intx, LiveNodeCountInliningCutoff, 20000,                         \
+          "max number of live nodes in a method")                           \
+
 
 C2_FLAGS(DECLARE_DEVELOPER_FLAG, DECLARE_PD_DEVELOPER_FLAG, DECLARE_PRODUCT_FLAG, DECLARE_PD_PRODUCT_FLAG, DECLARE_DIAGNOSTIC_FLAG, DECLARE_EXPERIMENTAL_FLAG, DECLARE_NOTPRODUCT_FLAG)
 
--- a/src/share/vm/opto/callGenerator.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/callGenerator.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -262,8 +262,11 @@
 
 // Allow inlining decisions to be delayed
 class LateInlineCallGenerator : public DirectCallGenerator {
+ protected:
   CallGenerator* _inline_cg;
 
+  virtual bool do_late_inline_check(JVMState* jvms) { return true; }
+
  public:
   LateInlineCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
     DirectCallGenerator(method, true), _inline_cg(inline_cg) {}
@@ -274,9 +277,14 @@
   virtual void do_late_inline();
 
   virtual JVMState* generate(JVMState* jvms) {
+    Compile *C = Compile::current();
+    C->print_inlining_skip(this);
+
     // Record that this call site should be revisited once the main
     // parse is finished.
-    Compile::current()->add_late_inline(this);
+    if (!is_mh_late_inline()) {
+      C->add_late_inline(this);
+    }
 
     // Emit the CallStaticJava and request separate projections so
     // that the late inlining logic can distinguish between fall
@@ -285,15 +293,33 @@
     return DirectCallGenerator::generate(jvms);
   }
 
+  virtual void print_inlining_late(const char* msg) {
+    CallNode* call = call_node();
+    Compile* C = Compile::current();
+    C->print_inlining_insert(this);
+    C->print_inlining(method(), call->jvms()->depth()-1, call->jvms()->bci(), msg);
+  }
+
 };
 
-
 void LateInlineCallGenerator::do_late_inline() {
   // Can't inline it
   if (call_node() == NULL || call_node()->outcnt() == 0 ||
       call_node()->in(0) == NULL || call_node()->in(0)->is_top())
     return;
 
+  for (int i1 = 0; i1 < method()->arg_size(); i1++) {
+    if (call_node()->in(TypeFunc::Parms + i1)->is_top()) {
+      assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
+      return;
+    }
+  }
+
+  if (call_node()->in(TypeFunc::Memory)->is_top()) {
+    assert(Compile::current()->inlining_incrementally(), "shouldn't happen during parsing");
+    return;
+  }
+
   CallStaticJavaNode* call = call_node();
 
   // Make a clone of the JVMState that appropriate to use for driving a parse
@@ -307,7 +333,9 @@
 
   // Make sure the state is a MergeMem for parsing.
   if (!map->in(TypeFunc::Memory)->is_MergeMem()) {
-    map->set_req(TypeFunc::Memory, MergeMemNode::make(C, map->in(TypeFunc::Memory)));
+    Node* mem = MergeMemNode::make(C, map->in(TypeFunc::Memory));
+    C->initial_gvn()->set_type_bottom(mem);
+    map->set_req(TypeFunc::Memory, mem);
   }
 
   // Make enough space for the expression stack and transfer the incoming arguments
@@ -320,6 +348,13 @@
     }
   }
 
+  if (!do_late_inline_check(jvms)) {
+    map->disconnect_inputs(NULL, C);
+    return;
+  }
+
+  C->print_inlining_insert(this);
+
   CompileLog* log = C->log();
   if (log != NULL) {
     log->head("late_inline method='%d'", log->identify(method()));
@@ -354,6 +389,10 @@
     result = (result_size == 1) ? kit.pop() : kit.pop_pair();
   }
 
+  C->set_has_loops(C->has_loops() || _inline_cg->method()->has_loops());
+  C->env()->notice_inlined_method(_inline_cg->method());
+  C->set_inlining_progress(true);
+
   kit.replace_call(call, result);
 }
 
@@ -362,6 +401,83 @@
   return new LateInlineCallGenerator(method, inline_cg);
 }
 
+class LateInlineMHCallGenerator : public LateInlineCallGenerator {
+  ciMethod* _caller;
+  int _attempt;
+  bool _input_not_const;
+
+  virtual bool do_late_inline_check(JVMState* jvms);
+  virtual bool already_attempted() const { return _attempt > 0; }
+
+ public:
+  LateInlineMHCallGenerator(ciMethod* caller, ciMethod* callee, bool input_not_const) :
+    LateInlineCallGenerator(callee, NULL), _caller(caller), _attempt(0), _input_not_const(input_not_const) {}
+
+  virtual bool is_mh_late_inline() const { return true; }
+
+  virtual JVMState* generate(JVMState* jvms) {
+    JVMState* new_jvms = LateInlineCallGenerator::generate(jvms);
+    if (_input_not_const) {
+      // inlining won't be possible so no need to enqueue right now.
+      call_node()->set_generator(this);
+    } else {
+      Compile::current()->add_late_inline(this);
+    }
+    return new_jvms;
+  }
+
+  virtual void print_inlining_late(const char* msg) {
+    if (!_input_not_const) return;
+    LateInlineCallGenerator::print_inlining_late(msg);
+  }
+};
+
+bool LateInlineMHCallGenerator::do_late_inline_check(JVMState* jvms) {
+
+  CallGenerator* cg = for_method_handle_inline(jvms, _caller, method(), _input_not_const);
+
+  if (!_input_not_const) {
+    _attempt++;
+  }
+
+  if (cg != NULL) {
+    assert(!cg->is_late_inline() && cg->is_inline(), "we're doing late inlining");
+    _inline_cg = cg;
+    Compile::current()->dec_number_of_mh_late_inlines();
+    return true;
+  }
+
+  call_node()->set_generator(this);
+  return false;
+}
+
+CallGenerator* CallGenerator::for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const) {
+  Compile::current()->inc_number_of_mh_late_inlines();
+  CallGenerator* cg = new LateInlineMHCallGenerator(caller, callee, input_not_const);
+  return cg;
+}
+
+class LateInlineStringCallGenerator : public LateInlineCallGenerator {
+
+ public:
+  LateInlineStringCallGenerator(ciMethod* method, CallGenerator* inline_cg) :
+    LateInlineCallGenerator(method, inline_cg) {}
+
+  virtual JVMState* generate(JVMState* jvms) {
+    Compile *C = Compile::current();
+    C->print_inlining_skip(this);
+
+    C->add_string_late_inline(this);
+
+    JVMState* new_jvms =  DirectCallGenerator::generate(jvms);
+    return new_jvms;
+  }
+};
+
+CallGenerator* CallGenerator::for_string_late_inline(ciMethod* method, CallGenerator* inline_cg) {
+  return new LateInlineStringCallGenerator(method, inline_cg);
+}
+
 
 //---------------------------WarmCallGenerator--------------------------------
 // Internal class which handles initial deferral of inlining decisions.
@@ -580,35 +696,53 @@
 }
 
 
-CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
+CallGenerator* CallGenerator::for_method_handle_call(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden) {
   assert(callee->is_method_handle_intrinsic() ||
          callee->is_compiled_lambda_form(), "for_method_handle_call mismatch");
-  CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee);
-  if (cg != NULL)
-    return cg;
-  return CallGenerator::for_direct_call(callee);
+  bool input_not_const;
+  CallGenerator* cg = CallGenerator::for_method_handle_inline(jvms, caller, callee, input_not_const);
+  Compile* C = Compile::current();
+  if (cg != NULL) {
+    if (!delayed_forbidden && AlwaysIncrementalInline) {
+      return CallGenerator::for_late_inline(callee, cg);
+    } else {
+      return cg;
+    }
+  }
+  int bci = jvms->bci();
+  ciCallProfile profile = caller->call_profile_at_bci(bci);
+  int call_site_count = caller->scale_count(profile.count());
+
+  if (IncrementalInline && call_site_count > 0 &&
+      (input_not_const || !C->inlining_incrementally() || C->over_inlining_cutoff())) {
+    return CallGenerator::for_mh_late_inline(caller, callee, input_not_const);
+  } else {
+    // Out-of-line call.
+    return CallGenerator::for_direct_call(callee);
+  }
 }
 
-CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee) {
+CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const) {
   GraphKit kit(jvms);
   PhaseGVN& gvn = kit.gvn();
   Compile* C = kit.C;
   vmIntrinsics::ID iid = callee->intrinsic_id();
+  input_not_const = true;
   switch (iid) {
   case vmIntrinsics::_invokeBasic:
     {
       // Get MethodHandle receiver:
       Node* receiver = kit.argument(0);
       if (receiver->Opcode() == Op_ConP) {
+        input_not_const = false;
         const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
         ciMethod* target = oop_ptr->const_oop()->as_method_handle()->get_vmtarget();
         guarantee(!target->is_method_handle_intrinsic(), "should not happen");  // XXX remove
         const int vtable_index = Method::invalid_vtable_index;
-        CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS);
+        CallGenerator* cg = C->call_generator(target, vtable_index, false, jvms, true, PROB_ALWAYS, true, true);
+        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
-      } else {
-        if (PrintInlining)  CompileTask::print_inlining(callee, jvms->depth() - 1, jvms->bci(), "receiver not constant");
       }
     }
     break;
@@ -621,6 +755,7 @@
       // Get MemberName argument:
       Node* member_name = kit.argument(callee->arg_size() - 1);
       if (member_name->Opcode() == Op_ConP) {
+        input_not_const = false;
         const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
         ciMethod* target = oop_ptr->const_oop()->as_member_name()->get_vmtarget();
 
@@ -653,9 +788,25 @@
             }
           }
         }
-        const int vtable_index = Method::invalid_vtable_index;
-        const bool call_is_virtual = target->is_abstract();  // FIXME workaround
-        CallGenerator* cg = C->call_generator(target, vtable_index, call_is_virtual, jvms, true, PROB_ALWAYS);
+
+        // Try to get the most accurate receiver type
+        const bool is_virtual              = (iid == vmIntrinsics::_linkToVirtual);
+        const bool is_virtual_or_interface = (is_virtual || iid == vmIntrinsics::_linkToInterface);
+        int  vtable_index       = Method::invalid_vtable_index;
+        bool call_does_dispatch = false;
+
+        if (is_virtual_or_interface) {
+          ciInstanceKlass* klass = target->holder();
+          Node*             receiver_node = kit.argument(0);
+          const TypeOopPtr* receiver_type = gvn.type(receiver_node)->isa_oopptr();
+          // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
+          target = C->optimize_virtual_call(caller, jvms->bci(), klass, target, receiver_type,
+                                            is_virtual,
+                                            call_does_dispatch, vtable_index);  // out-parameters
+        }
+
+        CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, true, true);
+        assert(!cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
         if (cg != NULL && cg->is_inline())
           return cg;
       }
--- a/src/share/vm/opto/callGenerator.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/callGenerator.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -68,6 +68,12 @@
 
   // is_late_inline: supports conversion of call into an inline
   virtual bool      is_late_inline() const      { return false; }
+  // same but for method handle calls
+  virtual bool      is_mh_late_inline() const   { return false; }
+
+  // for method handle calls: have we tried inlinining the call already?
+  virtual bool      already_attempted() const   { ShouldNotReachHere(); return false; }
+
   // Replace the call with an inline version of the code
   virtual void do_late_inline() { ShouldNotReachHere(); }
 
@@ -112,11 +118,13 @@
   static CallGenerator* for_virtual_call(ciMethod* m, int vtable_index);  // virtual, interface
   static CallGenerator* for_dynamic_call(ciMethod* m);   // invokedynamic
 
-  static CallGenerator* for_method_handle_call(  JVMState* jvms, ciMethod* caller, ciMethod* callee);
-  static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee);
+  static CallGenerator* for_method_handle_call(  JVMState* jvms, ciMethod* caller, ciMethod* callee, bool delayed_forbidden);
+  static CallGenerator* for_method_handle_inline(JVMState* jvms, ciMethod* caller, ciMethod* callee, bool& input_not_const);
 
   // How to generate a replace a direct call with an inline version
   static CallGenerator* for_late_inline(ciMethod* m, CallGenerator* inline_cg);
+  static CallGenerator* for_mh_late_inline(ciMethod* caller, ciMethod* callee, bool input_not_const);
+  static CallGenerator* for_string_late_inline(ciMethod* m, CallGenerator* inline_cg);
 
   // How to make a call but defer the decision whether to inline or not.
   static CallGenerator* for_warm_call(WarmCallInfo* ci,
@@ -147,9 +155,11 @@
                                                 CallGenerator* cg);
   virtual Node* generate_predicate(JVMState* jvms) { return NULL; };
 
-  static void print_inlining(ciMethod* callee, int inline_level, int bci, const char* msg) {
+  virtual void print_inlining_late(const char* msg) { ShouldNotReachHere(); }
+
+  static void print_inlining(Compile* C, ciMethod* callee, int inline_level, int bci, const char* msg) {
     if (PrintInlining)
-      CompileTask::print_inlining(callee, inline_level, bci, msg);
+      C->print_inlining(callee, inline_level, bci, msg);
   }
 };
 
--- a/src/share/vm/opto/callnode.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/callnode.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "ci/bcEscapeAnalyzer.hpp"
 #include "compiler/oopMap.hpp"
+#include "opto/callGenerator.hpp"
 #include "opto/callnode.hpp"
 #include "opto/escape.hpp"
 #include "opto/locknode.hpp"
@@ -164,13 +165,13 @@
 
 
 #ifndef PRODUCT
-void ReturnNode::dump_req() const {
+void ReturnNode::dump_req(outputStream *st) const {
   // Dump the required inputs, enclosed in '(' and ')'
   uint i;                       // Exit value of loop
-  for( i=0; i<req(); i++ ) {    // For all required inputs
-    if( i == TypeFunc::Parms ) tty->print("returns");
-    if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
-    else tty->print("_ ");
+  for (i = 0; i < req(); i++) {    // For all required inputs
+    if (i == TypeFunc::Parms) st->print("returns");
+    if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
+    else st->print("_ ");
   }
 }
 #endif
@@ -207,13 +208,13 @@
 }
 
 #ifndef PRODUCT
-void RethrowNode::dump_req() const {
+void RethrowNode::dump_req(outputStream *st) const {
   // Dump the required inputs, enclosed in '(' and ')'
   uint i;                       // Exit value of loop
-  for( i=0; i<req(); i++ ) {    // For all required inputs
-    if( i == TypeFunc::Parms ) tty->print("exception");
-    if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
-    else tty->print("_ ");
+  for (i = 0; i < req(); i++) {    // For all required inputs
+    if (i == TypeFunc::Parms) st->print("exception");
+    if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
+    else st->print("_ ");
   }
 }
 #endif
@@ -329,7 +330,8 @@
     st->print(" %s%d]=#ScObj" INT32_FORMAT, msg, i, sco_n);
     return;
   }
-  if( OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
+  if (regalloc->node_regs_max_index() > 0 &&
+      OptoReg::is_valid(regalloc->get_reg_first(n))) { // Check for undefined
     char buf[50];
     regalloc->dump_register(n,buf);
     st->print(" %s%d]=%s",msg,i,buf);
@@ -380,7 +382,7 @@
 //------------------------------format-----------------------------------------
 void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st) const {
   st->print("        #");
-  if( _method ) {
+  if (_method) {
     _method->print_short_name(st);
     st->print(" @ bci:%d ",_bci);
   } else {
@@ -392,21 +394,22 @@
     MachSafePointNode *mcall = n->as_MachSafePoint();
     uint i;
     // Print locals
-    for( i = 0; i < (uint)loc_size(); i++ )
-      format_helper( regalloc, st, mcall->local(this, i), "L[", i, &scobjs );
+    for (i = 0; i < (uint)loc_size(); i++)
+      format_helper(regalloc, st, mcall->local(this, i), "L[", i, &scobjs);
     // Print stack
     for (i = 0; i < (uint)stk_size(); i++) {
       if ((uint)(_stkoff + i) >= mcall->len())
         st->print(" oob ");
       else
-       format_helper( regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs );
+       format_helper(regalloc, st, mcall->stack(this, i), "STK[", i, &scobjs);
     }
     for (i = 0; (int)i < nof_monitors(); i++) {
       Node *box = mcall->monitor_box(this, i);
       Node *obj = mcall->monitor_obj(this, i);
-      if ( OptoReg::is_valid(regalloc->get_reg_first(box)) ) {
+      if (regalloc->node_regs_max_index() > 0 &&
+          OptoReg::is_valid(regalloc->get_reg_first(box))) {
         box = BoxLockNode::box_node(box);
-        format_helper( regalloc, st, box, "MON-BOX[", i, &scobjs );
+        format_helper(regalloc, st, box, "MON-BOX[", i, &scobjs);
       } else {
         OptoReg::Name box_reg = BoxLockNode::reg(box);
         st->print(" MON-BOX%d=%s+%d",
@@ -419,7 +422,7 @@
         if (BoxLockNode::box_node(box)->is_eliminated())
           obj_msg = "MON-OBJ(LOCK ELIMINATED)[";
       }
-      format_helper( regalloc, st, obj, obj_msg, i, &scobjs );
+      format_helper(regalloc, st, obj, obj_msg, i, &scobjs);
     }
 
     for (i = 0; i < (uint)scobjs.length(); i++) {
@@ -462,9 +465,9 @@
           st->print(" [");
           cifield = iklass->nonstatic_field_at(0);
           cifield->print_name_on(st);
-          format_helper( regalloc, st, fld_node, ":", 0, &scobjs );
+          format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
         } else {
-          format_helper( regalloc, st, fld_node, "[", 0, &scobjs );
+          format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
         }
         for (uint j = 1; j < nf; j++) {
           fld_node = mcall->in(first_ind+j);
@@ -472,9 +475,9 @@
             st->print(", [");
             cifield = iklass->nonstatic_field_at(j);
             cifield->print_name_on(st);
-            format_helper( regalloc, st, fld_node, ":", j, &scobjs );
+            format_helper(regalloc, st, fld_node, ":", j, &scobjs);
           } else {
-            format_helper( regalloc, st, fld_node, ", [", j, &scobjs );
+            format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
           }
         }
       }
@@ -482,7 +485,7 @@
     }
   }
   st->print_cr("");
-  if (caller() != NULL)  caller()->format(regalloc, n, st);
+  if (caller() != NULL) caller()->format(regalloc, n, st);
 }
 
 
@@ -585,15 +588,15 @@
 uint CallNode::cmp( const Node &n ) const
 { return _tf == ((CallNode&)n)._tf && _jvms == ((CallNode&)n)._jvms; }
 #ifndef PRODUCT
-void CallNode::dump_req() const {
+void CallNode::dump_req(outputStream *st) const {
   // Dump the required inputs, enclosed in '(' and ')'
   uint i;                       // Exit value of loop
-  for( i=0; i<req(); i++ ) {    // For all required inputs
-    if( i == TypeFunc::Parms ) tty->print("(");
-    if( in(i) ) tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
-    else tty->print("_ ");
+  for (i = 0; i < req(); i++) {    // For all required inputs
+    if (i == TypeFunc::Parms) st->print("(");
+    if (in(i)) st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
+    else st->print("_ ");
   }
-  tty->print(")");
+  st->print(")");
 }
 
 void CallNode::dump_spec(outputStream *st) const {
@@ -751,7 +754,7 @@
         projs->fallthrough_ioproj = pn;
       for (DUIterator j = pn->outs(); pn->has_out(j); j++) {
         Node* e = pn->out(j);
-        if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj()) {
+        if (e->Opcode() == Op_CreateEx && e->in(0)->is_CatchProj() && e->outcnt() > 0) {
           assert(projs->exobj == NULL, "only one");
           projs->exobj = e;
         }
@@ -775,16 +778,38 @@
   // and the exception object may not exist if an exception handler
   // swallows the exception but all the other must exist and be found.
   assert(projs->fallthrough_proj      != NULL, "must be found");
-  assert(projs->fallthrough_catchproj != NULL, "must be found");
-  assert(projs->fallthrough_memproj   != NULL, "must be found");
-  assert(projs->fallthrough_ioproj    != NULL, "must be found");
-  assert(projs->catchall_catchproj    != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_catchproj != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_memproj   != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->fallthrough_ioproj    != NULL, "must be found");
+  assert(Compile::current()->inlining_incrementally() || projs->catchall_catchproj    != NULL, "must be found");
   if (separate_io_proj) {
-    assert(projs->catchall_memproj      != NULL, "must be found");
-    assert(projs->catchall_ioproj       != NULL, "must be found");
+    assert(Compile::current()->inlining_incrementally() || projs->catchall_memproj    != NULL, "must be found");
+    assert(Compile::current()->inlining_incrementally() || projs->catchall_ioproj     != NULL, "must be found");
   }
 }
 
+Node *CallNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  CallGenerator* cg = generator();
+  if (can_reshape && cg != NULL && cg->is_mh_late_inline() && !cg->already_attempted()) {
+    // Check whether this MH handle call becomes a candidate for inlining
+    ciMethod* callee = cg->method();
+    vmIntrinsics::ID iid = callee->intrinsic_id();
+    if (iid == vmIntrinsics::_invokeBasic) {
+      if (in(TypeFunc::Parms)->Opcode() == Op_ConP) {
+        phase->C->prepend_late_inline(cg);
+        set_generator(NULL);
+      }
+    } else {
+      assert(callee->has_member_arg(), "wrong type of call?");
+      if (in(TypeFunc::Parms + callee->arg_size() - 1)->Opcode() == Op_ConP) {
+        phase->C->prepend_late_inline(cg);
+        set_generator(NULL);
+      }
+    }
+  }
+  return SafePointNode::Ideal(phase, can_reshape);
+}
+
 
 //=============================================================================
 uint CallJavaNode::size_of() const { return sizeof(*this); }
--- a/src/share/vm/opto/callnode.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/callnode.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -126,7 +126,7 @@
   virtual uint ideal_reg() const { return NotAMachineReg; }
   virtual uint match_edge(uint idx) const;
 #ifndef PRODUCT
-  virtual void dump_req() const;
+  virtual void dump_req(outputStream *st = tty) const;
 #endif
 };
 
@@ -147,7 +147,7 @@
   virtual uint match_edge(uint idx) const;
   virtual uint ideal_reg() const { return NotAMachineReg; }
 #ifndef PRODUCT
-  virtual void dump_req() const;
+  virtual void dump_req(outputStream *st = tty) const;
 #endif
 };
 
@@ -507,6 +507,7 @@
   Node* exobj;
 };
 
+class CallGenerator;
 
 //------------------------------CallNode---------------------------------------
 // Call nodes now subsume the function of debug nodes at callsites, so they
@@ -517,26 +518,31 @@
   const TypeFunc *_tf;        // Function type
   address      _entry_point;  // Address of method being called
   float        _cnt;          // Estimate of number of times called
+  CallGenerator* _generator;  // corresponding CallGenerator for some late inline calls
 
   CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
     : SafePointNode(tf->domain()->cnt(), NULL, adr_type),
       _tf(tf),
       _entry_point(addr),
-      _cnt(COUNT_UNKNOWN)
+      _cnt(COUNT_UNKNOWN),
+      _generator(NULL)
   {
     init_class_id(Class_Call);
   }
 
-  const TypeFunc* tf()        const { return _tf; }
-  const address entry_point() const { return _entry_point; }
-  const float   cnt()         const { return _cnt; }
+  const TypeFunc* tf()         const { return _tf; }
+  const address  entry_point() const { return _entry_point; }
+  const float    cnt()         const { return _cnt; }
+  CallGenerator* generator()   const { return _generator; }
 
-  void set_tf(const TypeFunc* tf) { _tf = tf; }
-  void set_entry_point(address p) { _entry_point = p; }
-  void set_cnt(float c)           { _cnt = c; }
+  void set_tf(const TypeFunc* tf)       { _tf = tf; }
+  void set_entry_point(address p)       { _entry_point = p; }
+  void set_cnt(float c)                 { _cnt = c; }
+  void set_generator(CallGenerator* cg) { _generator = cg; }
 
   virtual const Type *bottom_type() const;
   virtual const Type *Value( PhaseTransform *phase ) const;
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   virtual Node *Identity( PhaseTransform *phase ) { return this; }
   virtual uint        cmp( const Node &n ) const;
   virtual uint        size_of() const = 0;
@@ -573,7 +579,7 @@
   virtual uint match_edge(uint idx) const;
 
 #ifndef PRODUCT
-  virtual void        dump_req()  const;
+  virtual void        dump_req(outputStream *st = tty) const;
   virtual void        dump_spec(outputStream *st) const;
 #endif
 };
--- a/src/share/vm/opto/cfgnode.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/cfgnode.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -363,6 +363,49 @@
   return true; // The Region node is unreachable - it is dead.
 }
 
+bool RegionNode::try_clean_mem_phi(PhaseGVN *phase) {
+  // Incremental inlining + PhaseStringOpts sometimes produce:
+  //
+  // cmpP with 1 top input
+  //           |
+  //          If
+  //         /  \
+  //   IfFalse  IfTrue  /- Some Node
+  //         \  /      /    /
+  //        Region    / /-MergeMem
+  //             \---Phi
+  //
+  //
+  // It's expected by PhaseStringOpts that the Region goes away and is
+  // replaced by If's control input but because there's still a Phi,
+  // the Region stays in the graph. The top input from the cmpP is
+  // propagated forward and a subgraph that is useful goes away. The
+  // code below replaces the Phi with the MergeMem so that the Region
+  // is simplified.
+
+  PhiNode* phi = has_unique_phi();
+  if (phi && phi->type() == Type::MEMORY && req() == 3 && phi->is_diamond_phi(true)) {
+    MergeMemNode* m = NULL;
+    assert(phi->req() == 3, "same as region");
+    for (uint i = 1; i < 3; ++i) {
+      Node *mem = phi->in(i);
+      if (mem && mem->is_MergeMem() && in(i)->outcnt() == 1) {
+        // Nothing is control-dependent on path #i except the region itself.
+        m = mem->as_MergeMem();
+        uint j = 3 - i;
+        Node* other = phi->in(j);
+        if (other && other == m->base_memory()) {
+          // m is a successor memory to other, and is not pinned inside the diamond, so push it out.
+          // This will allow the diamond to collapse completely.
+          phase->is_IterGVN()->replace_node(phi, m);
+          return true;
+        }
+      }
+    }
+  }
+  return false;
+}
+
 //------------------------------Ideal------------------------------------------
 // Return a node which is more "ideal" than the current node.  Must preserve
 // the CFG, but we can still strip out dead paths.
@@ -375,6 +418,10 @@
   bool has_phis = false;
   if (can_reshape) {            // Need DU info to check for Phi users
     has_phis = (has_phi() != NULL);       // Cache result
+    if (has_phis && try_clean_mem_phi(phase)) {
+      has_phis = false;
+    }
+
     if (!has_phis) {            // No Phi users?  Nothing merging?
       for (uint i = 1; i < req()-1; i++) {
         Node *if1 = in(i);
@@ -1005,7 +1052,9 @@
 //------------------------------is_diamond_phi---------------------------------
 // Does this Phi represent a simple well-shaped diamond merge?  Return the
 // index of the true path or 0 otherwise.
-int PhiNode::is_diamond_phi() const {
+// If check_control_only is true, do not inspect the If node at the
+// top, and return -1 (not an edge number) on success.
+int PhiNode::is_diamond_phi(bool check_control_only) const {
   // Check for a 2-path merge
   Node *region = in(0);
   if( !region ) return 0;
@@ -1018,6 +1067,7 @@
   Node *iff = ifp1->in(0);
   if( !iff || !iff->is_If() ) return 0;
   if( iff != ifp2->in(0) ) return 0;
+  if (check_control_only)  return -1;
   // Check for a proper bool/cmp
   const Node *b = iff->in(1);
   if( !b->is_Bool() ) return 0;
@@ -1566,6 +1616,10 @@
     Node* n = in(j);            // Get the input
     if (rc == NULL || phase->type(rc) == Type::TOP) {
       if (n != top) {           // Not already top?
+        PhaseIterGVN *igvn = phase->is_IterGVN();
+        if (can_reshape && igvn != NULL) {
+          igvn->_worklist.push(r);
+        }
         set_req(j, top);        // Nuke it down
         progress = this;        // Record progress
       }
--- a/src/share/vm/opto/cfgnode.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/cfgnode.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -95,6 +95,7 @@
   virtual Node *Identity( PhaseTransform *phase );
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   virtual const RegMask &out_RegMask() const;
+  bool try_clean_mem_phi(PhaseGVN *phase);
 };
 
 //------------------------------JProjNode--------------------------------------
@@ -181,7 +182,7 @@
   LoopSafety simple_data_loop_check(Node *in) const;
   // Is it unsafe data loop? It becomes a dead loop if this phi node removed.
   bool is_unsafe_data_reference(Node *in) const;
-  int  is_diamond_phi() const;
+  int  is_diamond_phi(bool check_control_only = false) const;
   virtual int Opcode() const;
   virtual bool pinned() const { return in(0) != 0; }
   virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
--- a/src/share/vm/opto/classes.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/classes.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -127,6 +127,7 @@
 macro(DivMod)
 macro(DivModI)
 macro(DivModL)
+macro(EncodeISOArray)
 macro(EncodeP)
 macro(EncodePKlass)
 macro(ExpD)
--- a/src/share/vm/opto/compile.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/compile.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -136,7 +136,7 @@
 
 void Compile::register_intrinsic(CallGenerator* cg) {
   if (_intrinsics == NULL) {
-    _intrinsics = new GrowableArray<CallGenerator*>(60);
+    _intrinsics = new (comp_arena())GrowableArray<CallGenerator*>(comp_arena(), 60, 0, NULL);
   }
   // This code is stolen from ciObjectFactory::insert.
   // Really, GrowableArray should have methods for
@@ -365,6 +365,21 @@
   }
 }
 
+void Compile::remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful) {
+  int shift = 0;
+  for (int i = 0; i < inlines->length(); i++) {
+    CallGenerator* cg = inlines->at(i);
+    CallNode* call = cg->call_node();
+    if (shift > 0) {
+      inlines->at_put(i-shift, cg);
+    }
+    if (!useful.member(call)) {
+      shift++;
+    }
+  }
+  inlines->trunc_to(inlines->length()-shift);
+}
+
 // Disconnect all useless nodes by disconnecting those at the boundary.
 void Compile::remove_useless_nodes(Unique_Node_List &useful) {
   uint next = 0;
@@ -394,6 +409,9 @@
       remove_macro_node(n);
     }
   }
+  // clean up the late inline lists
+  remove_useless_late_inlines(&_string_late_inlines, useful);
+  remove_useless_late_inlines(&_late_inlines, useful);
   debug_only(verify_graph_edges(true/*check for no_dead_code*/);)
 }
 
@@ -610,7 +628,15 @@
                   _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")),
                   _printer(IdealGraphPrinter::printer()),
 #endif
-                  _congraph(NULL) {
+                  _congraph(NULL),
+                  _late_inlines(comp_arena(), 2, 0, NULL),
+                  _string_late_inlines(comp_arena(), 2, 0, NULL),
+                  _late_inlines_pos(0),
+                  _number_of_mh_late_inlines(0),
+                  _inlining_progress(false),
+                  _inlining_incrementally(false),
+                  _print_inlining_list(NULL),
+                  _print_inlining(0) {
   C = this;
 
   CompileWrapper cw(this);
@@ -666,6 +692,9 @@
   PhaseGVN gvn(node_arena(), estimated_size);
   set_initial_gvn(&gvn);
 
+  if (PrintInlining  || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
+    _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer>(comp_arena(), 1, 1, PrintInliningBuffer());
+  }
   { // Scope for timing the parser
     TracePhase t3("parse", &_t_parser, true);
 
@@ -732,28 +761,13 @@
       rethrow_exceptions(kit.transfer_exceptions_into_jvms());
     }
 
-    if (!failing() && has_stringbuilder()) {
-      {
-        // remove useless nodes to make the usage analysis simpler
-        ResourceMark rm;
-        PhaseRemoveUseless pru(initial_gvn(), &for_igvn);
-      }
-
-      {
-        ResourceMark rm;
-        print_method("Before StringOpts", 3);
-        PhaseStringOpts pso(initial_gvn(), &for_igvn);
-        print_method("After StringOpts", 3);
-      }
-
-      // now inline anything that we skipped the first time around
-      while (_late_inlines.length() > 0) {
-        CallGenerator* cg = _late_inlines.pop();
-        cg->do_late_inline();
-        if (failing())  return;
-      }
+    assert(IncrementalInline || (_late_inlines.length() == 0 && !has_mh_late_inlines()), "incremental inlining is off");
+
+    if (_late_inlines.length() == 0 && !has_mh_late_inlines() && !failing() && has_stringbuilder()) {
+      inline_string_calls(true);
     }
-    assert(_late_inlines.length() == 0, "should have been processed");
+
+    if (failing())  return;
 
     print_method("Before RemoveUseless", 3);
 
@@ -899,7 +913,12 @@
 #endif
     _dead_node_list(comp_arena()),
     _dead_node_count(0),
-    _congraph(NULL) {
+    _congraph(NULL),
+    _number_of_mh_late_inlines(0),
+    _inlining_progress(false),
+    _inlining_incrementally(false),
+    _print_inlining_list(NULL),
+    _print_inlining(0) {
   C = this;
 
 #ifndef PRODUCT
@@ -1752,6 +1771,124 @@
   assert(predicate_count()==0, "should be clean!");
 }
 
+// StringOpts and late inlining of string methods
+void Compile::inline_string_calls(bool parse_time) {
+  {
+    // remove useless nodes to make the usage analysis simpler
+    ResourceMark rm;
+    PhaseRemoveUseless pru(initial_gvn(), for_igvn());
+  }
+
+  {
+    ResourceMark rm;
+    print_method("Before StringOpts", 3);
+    PhaseStringOpts pso(initial_gvn(), for_igvn());
+    print_method("After StringOpts", 3);
+  }
+
+  // now inline anything that we skipped the first time around
+  if (!parse_time) {
+    _late_inlines_pos = _late_inlines.length();
+  }
+
+  while (_string_late_inlines.length() > 0) {
+    CallGenerator* cg = _string_late_inlines.pop();
+    cg->do_late_inline();
+    if (failing())  return;
+  }
+  _string_late_inlines.trunc_to(0);
+}
+
+void Compile::inline_incrementally_one(PhaseIterGVN& igvn) {
+  assert(IncrementalInline, "incremental inlining should be on");
+  PhaseGVN* gvn = initial_gvn();
+
+  set_inlining_progress(false);
+  for_igvn()->clear();
+  gvn->replace_with(&igvn);
+
+  int i = 0;
+
+  for (; i <_late_inlines.length() && !inlining_progress(); i++) {
+    CallGenerator* cg = _late_inlines.at(i);
+    _late_inlines_pos = i+1;
+    cg->do_late_inline();
+    if (failing())  return;
+  }
+  int j = 0;
+  for (; i < _late_inlines.length(); i++, j++) {
+    _late_inlines.at_put(j, _late_inlines.at(i));
+  }
+  _late_inlines.trunc_to(j);
+
+  {
+    ResourceMark rm;
+    PhaseRemoveUseless pru(C->initial_gvn(), C->for_igvn());
+  }
+
+  igvn = PhaseIterGVN(gvn);
+}
+
+// Perform incremental inlining until bound on number of live nodes is reached
+void Compile::inline_incrementally(PhaseIterGVN& igvn) {
+  PhaseGVN* gvn = initial_gvn();
+
+  set_inlining_incrementally(true);
+  set_inlining_progress(true);
+  uint low_live_nodes = 0;
+
+  while(inlining_progress() && _late_inlines.length() > 0) {
+
+    if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
+      if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) {
+        // PhaseIdealLoop is expensive so we only try it once we are
+        // out of loop and we only try it again if the previous helped
+        // got the number of nodes down significantly
+        PhaseIdealLoop ideal_loop( igvn, false, true );
+        if (failing())  return;
+        low_live_nodes = live_nodes();
+        _major_progress = true;
+      }
+
+      if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
+        break;
+      }
+    }
+
+    inline_incrementally_one(igvn);
+
+    if (failing())  return;
+
+    igvn.optimize();
+
+    if (failing())  return;
+  }
+
+  assert( igvn._worklist.size() == 0, "should be done with igvn" );
+
+  if (_string_late_inlines.length() > 0) {
+    assert(has_stringbuilder(), "inconsistent");
+    for_igvn()->clear();
+    initial_gvn()->replace_with(&igvn);
+
+    inline_string_calls(false);
+
+    if (failing())  return;
+
+    {
+      ResourceMark rm;
+      PhaseRemoveUseless pru(initial_gvn(), for_igvn());
+    }
+
+    igvn = PhaseIterGVN(gvn);
+
+    igvn.optimize();
+  }
+
+  set_inlining_incrementally(false);
+}
+
+
 //------------------------------Optimize---------------------------------------
 // Given a graph, optimize it.
 void Compile::Optimize() {
@@ -1784,6 +1921,12 @@
 
   if (failing())  return;
 
+  inline_incrementally(igvn);
+
+  print_method("Incremental Inline", 2);
+
+  if (failing())  return;
+
   // Perform escape analysis
   if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
     if (has_loops()) {
@@ -1906,6 +2049,7 @@
 
  } // (End scope of igvn; run destructor if necessary for asserts.)
 
+  dump_inlining();
   // A method with only infinite loops has no edges entering loops from root
   {
     NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); )
@@ -3351,3 +3495,33 @@
     cb.consts()->relocate((address) constant_addr, relocInfo::internal_word_type);
   }
 }
+
+void Compile::dump_inlining() {
+  if (PrintInlining || PrintIntrinsics NOT_PRODUCT( || PrintOptoInlining)) {
+    // Print inlining message for candidates that we couldn't inline
+    // for lack of space or non constant receiver
+    for (int i = 0; i < _late_inlines.length(); i++) {
+      CallGenerator* cg = _late_inlines.at(i);
+      cg->print_inlining_late("live nodes > LiveNodeCountInliningCutoff");
+    }
+    Unique_Node_List useful;
+    useful.push(root());
+    for (uint next = 0; next < useful.size(); ++next) {
+      Node* n  = useful.at(next);
+      if (n->is_Call() && n->as_Call()->generator() != NULL && n->as_Call()->generator()->call_node() == n) {
+        CallNode* call = n->as_Call();
+        CallGenerator* cg = call->generator();
+        cg->print_inlining_late("receiver not constant");
+      }
+      uint max = n->len();
+      for ( uint i = 0; i < max; ++i ) {
+        Node *m = n->in(i);
+        if ( m == NULL ) continue;
+        useful.push(m);
+      }
+    }
+    for (int i = 0; i < _print_inlining_list->length(); i++) {
+      tty->print(_print_inlining_list->at(i).ss()->as_string());
+    }
+  }
+}
--- a/src/share/vm/opto/compile.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/compile.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -30,6 +30,7 @@
 #include "code/debugInfoRec.hpp"
 #include "code/exceptionHandlerTable.hpp"
 #include "compiler/compilerOracle.hpp"
+#include "compiler/compileBroker.hpp"
 #include "libadt/dict.hpp"
 #include "libadt/port.hpp"
 #include "libadt/vectset.hpp"
@@ -71,6 +72,7 @@
 class JVMState;
 class TypeData;
 class TypePtr;
+class TypeOopPtr;
 class TypeFunc;
 class Unique_Node_List;
 class nmethod;
@@ -279,6 +281,8 @@
   int                   _orig_pc_slot_offset_in_bytes;
 
   int                   _major_progress;        // Count of something big happening
+  bool                  _inlining_progress;     // progress doing incremental inlining?
+  bool                  _inlining_incrementally;// Are we doing incremental inlining (post parse)
   bool                  _has_loops;             // True if the method _may_ have some loops
   bool                  _has_split_ifs;         // True if the method _may_ have some split-if
   bool                  _has_unsafe_access;     // True if the method _may_ produce faults in unsafe loads or stores.
@@ -366,9 +370,69 @@
   Unique_Node_List*     _for_igvn;              // Initial work-list for next round of Iterative GVN
   WarmCallInfo*         _warm_calls;            // Sorted work-list for heat-based inlining.
 
-  GrowableArray<CallGenerator*> _late_inlines;  // List of CallGenerators to be revisited after
-                                                // main parsing has finished.
+  GrowableArray<CallGenerator*> _late_inlines;        // List of CallGenerators to be revisited after
+                                                      // main parsing has finished.
+  GrowableArray<CallGenerator*> _string_late_inlines; // same but for string operations
+
+  int                           _late_inlines_pos;    // Where in the queue should the next late inlining candidate go (emulate depth first inlining)
+  uint                          _number_of_mh_late_inlines; // number of method handle late inlining still pending
+
+
+  // Inlining may not happen in parse order which would make
+  // PrintInlining output confusing. Keep track of PrintInlining
+  // pieces in order.
+  class PrintInliningBuffer : public ResourceObj {
+   private:
+    CallGenerator* _cg;
+    stringStream* _ss;
+
+   public:
+    PrintInliningBuffer()
+      : _cg(NULL) { _ss = new stringStream(); }
+
+    stringStream* ss() const { return _ss; }
+    CallGenerator* cg() const { return _cg; }
+    void set_cg(CallGenerator* cg) { _cg = cg; }
+  };
+
+  GrowableArray<PrintInliningBuffer>* _print_inlining_list;
+  int _print_inlining;
+
+ public:
 
+  outputStream* print_inlining_stream() const {
+    return _print_inlining_list->at(_print_inlining).ss();
+  }
+
+  void print_inlining_skip(CallGenerator* cg) {
+    if (PrintInlining) {
+      _print_inlining_list->at(_print_inlining).set_cg(cg);
+      _print_inlining++;
+      _print_inlining_list->insert_before(_print_inlining, PrintInliningBuffer());
+    }
+  }
+
+  void print_inlining_insert(CallGenerator* cg) {
+    if (PrintInlining) {
+      for (int i = 0; i < _print_inlining_list->length(); i++) {
+        if (_print_inlining_list->at(i).cg() == cg) {
+          _print_inlining_list->insert_before(i+1, PrintInliningBuffer());
+          _print_inlining = i+1;
+          _print_inlining_list->at(i).set_cg(NULL);
+          return;
+        }
+      }
+      ShouldNotReachHere();
+    }
+  }
+
+  void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
+    stringStream ss;
+    CompileTask::print_inlining(&ss, method, inline_level, bci, msg);
+    print_inlining_stream()->print(ss.as_string());
+  }
+
+ private:
   // Matching, CFG layout, allocation, code generation
   PhaseCFG*             _cfg;                   // Results of CFG finding
   bool                  _select_24_bit_instr;   // We selected an instruction with a 24-bit result
@@ -435,6 +499,10 @@
   int               fixed_slots() const         { assert(_fixed_slots >= 0, "");         return _fixed_slots; }
   void          set_fixed_slots(int n)          { _fixed_slots = n; }
   int               major_progress() const      { return _major_progress; }
+  void          set_inlining_progress(bool z)   { _inlining_progress = z; }
+  int               inlining_progress() const   { return _inlining_progress; }
+  void          set_inlining_incrementally(bool z) { _inlining_incrementally = z; }
+  int               inlining_incrementally() const { return _inlining_incrementally; }
   void          set_major_progress()            { _major_progress++; }
   void        clear_major_progress()            { _major_progress = 0; }
   int               num_loop_opts() const       { return _num_loop_opts; }
@@ -591,7 +659,7 @@
   void         reset_dead_node_list()      { _dead_node_list.Reset();
                                              _dead_node_count = 0;
                                            }
-  uint          live_nodes()               {
+  uint          live_nodes() const         {
     int  val = _unique - _dead_node_count;
     assert (val >= 0, err_msg_res("number of tracked dead nodes %d more than created nodes %d", _unique, _dead_node_count));
             return (uint) val;
@@ -673,9 +741,17 @@
 
   // Decide how to build a call.
   // The profile factor is a discount to apply to this site's interp. profile.
-  CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_is_virtual, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true);
+  CallGenerator*    call_generator(ciMethod* call_method, int vtable_index, bool call_does_dispatch, JVMState* jvms, bool allow_inline, float profile_factor, bool allow_intrinsics = true, bool delayed_forbidden = false);
   bool should_delay_inlining(ciMethod* call_method, JVMState* jvms);
 
+  // Helper functions to identify inlining potential at call-site
+  ciMethod* optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                  ciMethod* callee, const TypeOopPtr* receiver_type,
+                                  bool is_virtual,
+                                  bool &call_does_dispatch, int &vtable_index);
+  ciMethod* optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                              ciMethod* callee, const TypeOopPtr* receiver_type);
+
   // Report if there were too many traps at a current method and bci.
   // Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
   // If there is no MDO at all, report no trap unless told to assume it.
@@ -702,14 +778,45 @@
 
   void              identify_useful_nodes(Unique_Node_List &useful);
   void              update_dead_node_list(Unique_Node_List &useful);
-  void              remove_useless_nodes  (Unique_Node_List &useful);
+  void              remove_useless_nodes (Unique_Node_List &useful);
 
   WarmCallInfo*     warm_calls() const          { return _warm_calls; }
   void          set_warm_calls(WarmCallInfo* l) { _warm_calls = l; }
   WarmCallInfo* pop_warm_call();
 
   // Record this CallGenerator for inlining at the end of parsing.
-  void              add_late_inline(CallGenerator* cg) { _late_inlines.push(cg); }
+  void              add_late_inline(CallGenerator* cg)        {
+    _late_inlines.insert_before(_late_inlines_pos, cg);
+    _late_inlines_pos++;
+  }
+
+  void              prepend_late_inline(CallGenerator* cg)    {
+    _late_inlines.insert_before(0, cg);
+  }
+
+  void              add_string_late_inline(CallGenerator* cg) {
+    _string_late_inlines.push(cg);
+  }
+
+  void remove_useless_late_inlines(GrowableArray<CallGenerator*>* inlines, Unique_Node_List &useful);
+
+  void dump_inlining();
+
+  bool over_inlining_cutoff() const {
+    if (!inlining_incrementally()) {
+      return unique() > (uint)NodeCountInliningCutoff;
+    } else {
+      return live_nodes() > (uint)LiveNodeCountInliningCutoff;
+    }
+  }
+
+  void inc_number_of_mh_late_inlines() { _number_of_mh_late_inlines++; }
+  void dec_number_of_mh_late_inlines() { assert(_number_of_mh_late_inlines > 0, "_number_of_mh_late_inlines < 0 !"); _number_of_mh_late_inlines--; }
+  bool has_mh_late_inlines() const     { return _number_of_mh_late_inlines > 0; }
+
+  void inline_incrementally_one(PhaseIterGVN& igvn);
+  void inline_incrementally(PhaseIterGVN& igvn);
+  void inline_string_calls(bool parse_time);
 
   // Matching, CFG layout, allocation, code generation
   PhaseCFG*         cfg()                       { return _cfg; }
--- a/src/share/vm/opto/doCall.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/doCall.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -40,25 +40,30 @@
 #include "prims/nativeLookup.hpp"
 #include "runtime/sharedRuntime.hpp"
 
-void trace_type_profile(ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
+void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMethod *prof_method, ciKlass *prof_klass, int site_count, int receiver_count) {
   if (TraceTypeProfile || PrintInlining NOT_PRODUCT(|| PrintOptoInlining)) {
+    outputStream* out = tty;
     if (!PrintInlining) {
       if (NOT_PRODUCT(!PrintOpto &&) !PrintCompilation) {
         method->print_short_name();
         tty->cr();
       }
       CompileTask::print_inlining(prof_method, depth, bci);
+    } else {
+      out = C->print_inlining_stream();
     }
-    CompileTask::print_inline_indent(depth);
-    tty->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
-    prof_klass->name()->print_symbol();
-    tty->cr();
+    CompileTask::print_inline_indent(depth, out);
+    out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
+    stringStream ss;
+    prof_klass->name()->print_symbol_on(&ss);
+    out->print(ss.as_string());
+    out->cr();
   }
 }
 
-CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_is_virtual,
+CallGenerator* Compile::call_generator(ciMethod* callee, int vtable_index, bool call_does_dispatch,
                                        JVMState* jvms, bool allow_inline,
-                                       float prof_factor, bool allow_intrinsics) {
+                                       float prof_factor, bool allow_intrinsics, bool delayed_forbidden) {
   ciMethod*       caller   = jvms->method();
   int             bci      = jvms->bci();
   Bytecodes::Code bytecode = caller->java_code_at_bci(bci);
@@ -77,7 +82,7 @@
   // See how many times this site has been invoked.
   int site_count = profile.count();
   int receiver_count = -1;
-  if (call_is_virtual && UseTypeProfile && profile.has_receiver(0)) {
+  if (call_does_dispatch && UseTypeProfile && profile.has_receiver(0)) {
     // Receivers in the profile structure are ordered by call counts
     // so that the most called (major) receiver is profile.receiver(0).
     receiver_count = profile.receiver_count(0);
@@ -89,7 +94,7 @@
     int r2id = (rid != -1 && profile.has_receiver(1))? log->identify(profile.receiver(1)):-1;
     log->begin_elem("call method='%d' count='%d' prof_factor='%g'",
                     log->identify(callee), site_count, prof_factor);
-    if (call_is_virtual)  log->print(" virtual='1'");
+    if (call_does_dispatch)  log->print(" virtual='1'");
     if (allow_inline)     log->print(" inline='1'");
     if (receiver_count >= 0) {
       log->print(" receiver='%d' receiver_count='%d'", rid, receiver_count);
@@ -106,12 +111,12 @@
   // We do this before the strict f.p. check below because the
   // intrinsics handle strict f.p. correctly.
   if (allow_inline && allow_intrinsics) {
-    CallGenerator* cg = find_intrinsic(callee, call_is_virtual);
+    CallGenerator* cg = find_intrinsic(callee, call_does_dispatch);
     if (cg != NULL) {
       if (cg->is_predicted()) {
         // Code without intrinsic but, hopefully, inlined.
         CallGenerator* inline_cg = this->call_generator(callee,
-              vtable_index, call_is_virtual, jvms, allow_inline, prof_factor, false);
+              vtable_index, call_does_dispatch, jvms, allow_inline, prof_factor, false);
         if (inline_cg != NULL) {
           cg = CallGenerator::for_predicted_intrinsic(cg, inline_cg);
         }
@@ -125,7 +130,9 @@
   // MethodHandle.invoke* are native methods which obviously don't
   // have bytecodes and so normal inlining fails.
   if (callee->is_method_handle_intrinsic()) {
-    return CallGenerator::for_method_handle_call(jvms, caller, callee);
+    CallGenerator* cg = CallGenerator::for_method_handle_call(jvms, caller, callee, delayed_forbidden);
+    assert(cg == NULL || !delayed_forbidden || !cg->is_late_inline() || cg->is_mh_late_inline(), "unexpected CallGenerator");
+    return cg;
   }
 
   // Do not inline strict fp into non-strict code, or the reverse
@@ -142,7 +149,7 @@
     float expected_uses = past_uses;
 
     // Try inlining a bytecoded method:
-    if (!call_is_virtual) {
+    if (!call_does_dispatch) {
       InlineTree* ilt;
       if (UseOldInlining) {
         ilt = InlineTree::find_subtree_from_root(this->ilt(), jvms->caller(), jvms->method());
@@ -156,32 +163,39 @@
       WarmCallInfo scratch_ci;
       if (!UseOldInlining)
         scratch_ci.init(jvms, callee, profile, prof_factor);
-      WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci);
+      bool should_delay = false;
+      WarmCallInfo* ci = ilt->ok_to_inline(callee, jvms, profile, &scratch_ci, should_delay);
       assert(ci != &scratch_ci, "do not let this pointer escape");
       bool allow_inline   = (ci != NULL && !ci->is_cold());
       bool require_inline = (allow_inline && ci->is_hot());
 
       if (allow_inline) {
         CallGenerator* cg = CallGenerator::for_inline(callee, expected_uses);
-        if (require_inline && cg != NULL && should_delay_inlining(callee, jvms)) {
+
+        if (require_inline && cg != NULL) {
           // Delay the inlining of this method to give us the
           // opportunity to perform some high level optimizations
           // first.
-          return CallGenerator::for_late_inline(callee, cg);
+          if (should_delay_inlining(callee, jvms)) {
+            assert(!delayed_forbidden, "strange");
+            return CallGenerator::for_string_late_inline(callee, cg);
+          } else if ((should_delay || AlwaysIncrementalInline) && !delayed_forbidden) {
+            return CallGenerator::for_late_inline(callee, cg);
+          }
         }
-        if (cg == NULL) {
+        if (cg == NULL || should_delay) {
           // Fall through.
         } else if (require_inline || !InlineWarmCalls) {
           return cg;
         } else {
-          CallGenerator* cold_cg = call_generator(callee, vtable_index, call_is_virtual, jvms, false, prof_factor);
+          CallGenerator* cold_cg = call_generator(callee, vtable_index, call_does_dispatch, jvms, false, prof_factor);
           return CallGenerator::for_warm_call(ci, cold_cg, cg);
         }
       }
     }
 
     // Try using the type profile.
-    if (call_is_virtual && site_count > 0 && receiver_count > 0) {
+    if (call_does_dispatch && site_count > 0 && receiver_count > 0) {
       // The major receiver's count >= TypeProfileMajorReceiverPercent of site_count.
       bool have_major_receiver = (100.*profile.receiver_prob(0) >= (float)TypeProfileMajorReceiverPercent);
       ciMethod* receiver_method = NULL;
@@ -195,7 +209,7 @@
       if (receiver_method != NULL) {
         // The single majority receiver sufficiently outweighs the minority.
         CallGenerator* hit_cg = this->call_generator(receiver_method,
-              vtable_index, !call_is_virtual, jvms, allow_inline, prof_factor);
+              vtable_index, !call_does_dispatch, jvms, allow_inline, prof_factor);
         if (hit_cg != NULL) {
           // Look up second receiver.
           CallGenerator* next_hit_cg = NULL;
@@ -205,7 +219,7 @@
                                                                profile.receiver(1));
             if (next_receiver_method != NULL) {
               next_hit_cg = this->call_generator(next_receiver_method,
-                                  vtable_index, !call_is_virtual, jvms,
+                                  vtable_index, !call_does_dispatch, jvms,
                                   allow_inline, prof_factor);
               if (next_hit_cg != NULL && !next_hit_cg->is_inline() &&
                   have_major_receiver && UseOnlyInlinedBimorphic) {
@@ -233,13 +247,13 @@
           }
           if (miss_cg != NULL) {
             if (next_hit_cg != NULL) {
-              trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1));
+              trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), next_receiver_method, profile.receiver(1), site_count, profile.receiver_count(1));
               // We don't need to record dependency on a receiver here and below.
               // Whenever we inline, the dependency is added by Parse::Parse().
               miss_cg = CallGenerator::for_predicted_call(profile.receiver(1), miss_cg, next_hit_cg, PROB_MAX);
             }
             if (miss_cg != NULL) {
-              trace_type_profile(jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count);
+              trace_type_profile(C, jvms->method(), jvms->depth() - 1, jvms->bci(), receiver_method, profile.receiver(0), site_count, receiver_count);
               CallGenerator* cg = CallGenerator::for_predicted_call(profile.receiver(0), miss_cg, hit_cg, profile.receiver_prob(0));
               if (cg != NULL)  return cg;
             }
@@ -251,7 +265,7 @@
 
   // There was no special inlining tactic, or it bailed out.
   // Use a more generic tactic, like a simple call.
-  if (call_is_virtual) {
+  if (call_does_dispatch) {
     return CallGenerator::for_virtual_call(callee, vtable_index);
   } else {
     // Class Hierarchy Analysis or Type Profile reveals a unique target,
@@ -383,6 +397,7 @@
   // orig_callee is the resolved callee which's signature includes the
   // appendix argument.
   const int nargs = orig_callee->arg_size();
+  const bool is_signature_polymorphic = MethodHandles::is_signature_polymorphic(orig_callee->intrinsic_id());
 
   // Push appendix argument (MethodType, CallSite, etc.), if one.
   if (iter().has_appendix()) {
@@ -399,25 +414,18 @@
   // Then we may introduce a run-time check and inline on the path where it succeeds.
   // The other path may uncommon_trap, check for another receiver, or do a v-call.
 
-  // Choose call strategy.
-  bool call_is_virtual = is_virtual_or_interface;
-  int vtable_index = Method::invalid_vtable_index;
-  ciMethod* callee = orig_callee;
+  // Try to get the most accurate receiver type
+  ciMethod* callee             = orig_callee;
+  int       vtable_index       = Method::invalid_vtable_index;
+  bool      call_does_dispatch = false;
 
-  // Try to get the most accurate receiver type
   if (is_virtual_or_interface) {
     Node*             receiver_node = stack(sp() - nargs);
     const TypeOopPtr* receiver_type = _gvn.type(receiver_node)->isa_oopptr();
-    ciMethod* optimized_virtual_method = optimize_inlining(method(), bci(), klass, orig_callee, receiver_type);
-
-    // Have the call been sufficiently improved such that it is no longer a virtual?
-    if (optimized_virtual_method != NULL) {
-      callee          = optimized_virtual_method;
-      call_is_virtual = false;
-    } else if (!UseInlineCaches && is_virtual && callee->is_loaded()) {
-      // We can make a vtable call at this site
-      vtable_index = callee->resolve_vtable_index(method()->holder(), klass);
-    }
+    // call_does_dispatch and vtable_index are out-parameters.  They might be changed.
+    callee = C->optimize_virtual_call(method(), bci(), klass, orig_callee, receiver_type,
+                                      is_virtual,
+                                      call_does_dispatch, vtable_index);  // out-parameters
   }
 
   // Note:  It's OK to try to inline a virtual call.
@@ -433,7 +441,7 @@
   // Decide call tactic.
   // This call checks with CHA, the interpreter profile, intrinsics table, etc.
   // It decides whether inlining is desirable or not.
-  CallGenerator* cg = C->call_generator(callee, vtable_index, call_is_virtual, jvms, try_inline, prof_factor());
+  CallGenerator* cg = C->call_generator(callee, vtable_index, call_does_dispatch, jvms, try_inline, prof_factor());
 
   // NOTE:  Don't use orig_callee and callee after this point!  Use cg->method() instead.
   orig_callee = callee = NULL;
@@ -473,7 +481,7 @@
     // the call site, perhaps because it did not match a pattern the
     // intrinsic was expecting to optimize. Should always be possible to
     // get a normal java call that may inline in that case
-    cg = C->call_generator(cg->method(), vtable_index, call_is_virtual, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false);
+    cg = C->call_generator(cg->method(), vtable_index, call_does_dispatch, jvms, try_inline, prof_factor(), /* allow_intrinsics= */ false);
     if ((new_jvms = cg->generate(jvms)) == NULL) {
       guarantee(failing(), "call failed to generate:  calls should work");
       return;
@@ -508,55 +516,50 @@
     round_double_result(cg->method());
 
     ciType* rtype = cg->method()->return_type();
-    if (Bytecodes::has_optional_appendix(iter().cur_bc_raw())) {
+    ciType* ctype = declared_signature->return_type();
+
+    if (Bytecodes::has_optional_appendix(iter().cur_bc_raw()) || is_signature_polymorphic) {
       // Be careful here with return types.
-      ciType* ctype = declared_signature->return_type();
       if (ctype != rtype) {
         BasicType rt = rtype->basic_type();
         BasicType ct = ctype->basic_type();
-        Node* retnode = peek();
         if (ct == T_VOID) {
           // It's OK for a method  to return a value that is discarded.
           // The discarding does not require any special action from the caller.
           // The Java code knows this, at VerifyType.isNullConversion.
           pop_node(rt);  // whatever it was, pop it
-          retnode = top();
         } else if (rt == T_INT || is_subword_type(rt)) {
-          // FIXME: This logic should be factored out.
-          if (ct == T_BOOLEAN) {
-            retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0x1)) );
-          } else if (ct == T_CHAR) {
-            retnode = _gvn.transform( new (C) AndINode(retnode, intcon(0xFFFF)) );
-          } else if (ct == T_BYTE) {
-            retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(24)) );
-            retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(24)) );
-          } else if (ct == T_SHORT) {
-            retnode = _gvn.transform( new (C) LShiftINode(retnode, intcon(16)) );
-            retnode = _gvn.transform( new (C) RShiftINode(retnode, intcon(16)) );
-          } else {
-            assert(ct == T_INT, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct)));
-          }
+          // Nothing.  These cases are handled in lambda form bytecode.
+          assert(ct == T_INT || is_subword_type(ct), err_msg_res("must match: rt=%s, ct=%s", type2name(rt), type2name(ct)));
         } else if (rt == T_OBJECT || rt == T_ARRAY) {
           assert(ct == T_OBJECT || ct == T_ARRAY, err_msg_res("rt=%s, ct=%s", type2name(rt), type2name(ct)));
           if (ctype->is_loaded()) {
             const TypeOopPtr* arg_type = TypeOopPtr::make_from_klass(rtype->as_klass());
             const Type*       sig_type = TypeOopPtr::make_from_klass(ctype->as_klass());
             if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
+              Node* retnode = pop();
               Node* cast_obj = _gvn.transform(new (C) CheckCastPPNode(control(), retnode, sig_type));
-              pop();
               push(cast_obj);
             }
           }
         } else {
-          assert(ct == rt, err_msg("unexpected mismatch rt=%d, ct=%d", rt, ct));
+          assert(rt == ct, err_msg_res("unexpected mismatch: rt=%s, ct=%s", type2name(rt), type2name(ct)));
           // push a zero; it's better than getting an oop/int mismatch
-          retnode = pop_node(rt);
-          retnode = zerocon(ct);
+          pop_node(rt);
+          Node* retnode = zerocon(ct);
           push_node(ct, retnode);
         }
         // Now that the value is well-behaved, continue with the call-site type.
         rtype = ctype;
       }
+    } else {
+      // Symbolic resolution enforces the types to be the same.
+      // NOTE: We must relax the assert for unloaded types because two
+      // different ciType instances of the same unloaded class type
+      // can appear to be "loaded" by different loaders (depending on
+      // the accessing class).
+      assert(!rtype->is_loaded() || !ctype->is_loaded() || rtype == ctype,
+             err_msg_res("mismatched return types: rtype=%s, ctype=%s", rtype->name(), ctype->name()));
     }
 
     // If the return type of the method is not loaded, assert that the
@@ -874,17 +877,39 @@
 #endif //PRODUCT
 
 
+ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                         ciMethod* callee, const TypeOopPtr* receiver_type,
+                                         bool is_virtual,
+                                         bool& call_does_dispatch, int& vtable_index) {
+  // Set default values for out-parameters.
+  call_does_dispatch = true;
+  vtable_index       = Method::invalid_vtable_index;
+
+  // Choose call strategy.
+  ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee, receiver_type);
+
+  // Have the call been sufficiently improved such that it is no longer a virtual?
+  if (optimized_virtual_method != NULL) {
+    callee             = optimized_virtual_method;
+    call_does_dispatch = false;
+  } else if (!UseInlineCaches && is_virtual && callee->is_loaded()) {
+    // We can make a vtable call at this site
+    vtable_index = callee->resolve_vtable_index(caller->holder(), klass);
+  }
+  return callee;
+}
+
 // Identify possible target method and inlining style
-ciMethod* Parse::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
-                                   ciMethod *dest_method, const TypeOopPtr* receiver_type) {
+ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
+                                     ciMethod* callee, const TypeOopPtr* receiver_type) {
   // only use for virtual or interface calls
 
   // If it is obviously final, do not bother to call find_monomorphic_target,
   // because the class hierarchy checks are not needed, and may fail due to
   // incompletely loaded classes.  Since we do our own class loading checks
   // in this module, we may confidently bind to any method.
-  if (dest_method->can_be_statically_bound()) {
-    return dest_method;
+  if (callee->can_be_statically_bound()) {
+    return callee;
   }
 
   // Attempt to improve the receiver
@@ -893,8 +918,8 @@
   if (receiver_type != NULL) {
     // Array methods are all inherited from Object, and are monomorphic.
     if (receiver_type->isa_aryptr() &&
-        dest_method->holder() == env()->Object_klass()) {
-      return dest_method;
+        callee->holder() == env()->Object_klass()) {
+      return callee;
     }
 
     // All other interesting cases are instance klasses.
@@ -914,7 +939,7 @@
   }
 
   ciInstanceKlass*   calling_klass = caller->holder();
-  ciMethod* cha_monomorphic_target = dest_method->find_monomorphic_target(calling_klass, klass, actual_receiver);
+  ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(calling_klass, klass, actual_receiver);
   if (cha_monomorphic_target != NULL) {
     assert(!cha_monomorphic_target->is_abstract(), "");
     // Look at the method-receiver type.  Does it add "too much information"?
@@ -932,10 +957,10 @@
         cha_monomorphic_target->print();
         tty->cr();
       }
-      if (C->log() != NULL) {
-        C->log()->elem("missed_CHA_opportunity klass='%d' method='%d'",
-                       C->log()->identify(klass),
-                       C->log()->identify(cha_monomorphic_target));
+      if (log() != NULL) {
+        log()->elem("missed_CHA_opportunity klass='%d' method='%d'",
+                       log()->identify(klass),
+                       log()->identify(cha_monomorphic_target));
       }
       cha_monomorphic_target = NULL;
     }
@@ -947,7 +972,7 @@
     // by dynamic class loading.  Be sure to test the "static" receiver
     // dest_method here, as opposed to the actual receiver, which may
     // falsely lead us to believe that the receiver is final or private.
-    C->dependencies()->assert_unique_concrete_method(actual_receiver, cha_monomorphic_target);
+    dependencies()->assert_unique_concrete_method(actual_receiver, cha_monomorphic_target);
     return cha_monomorphic_target;
   }
 
@@ -956,7 +981,7 @@
   if (actual_receiver_is_exact) {
     // In case of evolution, there is a dependence on every inlined method, since each
     // such method can be changed when its class is redefined.
-    ciMethod* exact_method = dest_method->resolve_invoke(calling_klass, actual_receiver);
+    ciMethod* exact_method = callee->resolve_invoke(calling_klass, actual_receiver);
     if (exact_method != NULL) {
 #ifndef PRODUCT
       if (PrintOpto) {
--- a/src/share/vm/opto/escape.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/escape.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -523,7 +523,8 @@
     case Op_AryEq:
     case Op_StrComp:
     case Op_StrEquals:
-    case Op_StrIndexOf: {
+    case Op_StrIndexOf:
+    case Op_EncodeISOArray: {
       add_local_var(n, PointsToNode::ArgEscape);
       delayed_worklist->push(n); // Process it later.
       break;
@@ -701,7 +702,8 @@
     case Op_AryEq:
     case Op_StrComp:
     case Op_StrEquals:
-    case Op_StrIndexOf: {
+    case Op_StrIndexOf:
+    case Op_EncodeISOArray: {
       // char[] arrays passed to string intrinsic do not escape but
       // they are not scalar replaceable. Adjust escape state for them.
       // Start from in(2) edge since in(1) is memory edge.
@@ -2581,15 +2583,22 @@
       }
       // Otherwise skip it (the call updated 'result' value).
     } else if (result->Opcode() == Op_SCMemProj) {
-      assert(result->in(0)->is_LoadStore(), "sanity");
-      const Type *at = igvn->type(result->in(0)->in(MemNode::Address));
+      Node* mem = result->in(0);
+      Node* adr = NULL;
+      if (mem->is_LoadStore()) {
+        adr = mem->in(MemNode::Address);
+      } else {
+        assert(mem->Opcode() == Op_EncodeISOArray, "sanity");
+        adr = mem->in(3); // Memory edge corresponds to destination array
+      }
+      const Type *at = igvn->type(adr);
       if (at != Type::TOP) {
         assert (at->isa_ptr() != NULL, "pointer type required.");
         int idx = C->get_alias_index(at->is_ptr());
         assert(idx != alias_idx, "Object is not scalar replaceable if a LoadStore node access its field");
         break;
       }
-      result = result->in(0)->in(MemNode::Memory);
+      result = mem->in(MemNode::Memory);
     }
   }
   if (result->is_Phi()) {
@@ -2927,6 +2936,11 @@
         if (m->is_MergeMem()) {
           assert(_mergemem_worklist.contains(m->as_MergeMem()), "EA: missing MergeMem node in the worklist");
         }
+      } else if (use->Opcode() == Op_EncodeISOArray) {
+        if (use->in(MemNode::Memory) == n || use->in(3) == n) {
+          // EncodeISOArray overwrites destination array
+          memnode_worklist.append_if_missing(use);
+        }
       } else {
         uint op = use->Opcode();
         if (!(op == Op_CmpP || op == Op_Conv2B ||
@@ -2962,6 +2976,16 @@
       n = n->as_MemBar()->proj_out(TypeFunc::Memory);
       if (n == NULL)
         continue;
+    } else if (n->Opcode() == Op_EncodeISOArray) {
+      // get the memory projection
+      for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
+        Node *use = n->fast_out(i);
+        if (use->Opcode() == Op_SCMemProj) {
+          n = use;
+          break;
+        }
+      }
+      assert(n->Opcode() == Op_SCMemProj, "memory projection required");
     } else {
       assert(n->is_Mem(), "memory node required.");
       Node *addr = n->in(MemNode::Address);
@@ -2999,7 +3023,7 @@
       Node *use = n->fast_out(i);
       if (use->is_Phi() || use->is_ClearArray()) {
         memnode_worklist.append_if_missing(use);
-      } else if(use->is_Mem() && use->in(MemNode::Memory) == n) {
+      } else if (use->is_Mem() && use->in(MemNode::Memory) == n) {
         if (use->Opcode() == Op_StoreCM) // Ignore cardmark stores
           continue;
         memnode_worklist.append_if_missing(use);
@@ -3010,6 +3034,11 @@
         assert(use->in(MemNode::Memory) != n, "EA: missing memory path");
       } else if (use->is_MergeMem()) {
         assert(_mergemem_worklist.contains(use->as_MergeMem()), "EA: missing MergeMem node in the worklist");
+      } else if (use->Opcode() == Op_EncodeISOArray) {
+        if (use->in(MemNode::Memory) == n || use->in(3) == n) {
+          // EncodeISOArray overwrites destination array
+          memnode_worklist.append_if_missing(use);
+        }
       } else {
         uint op = use->Opcode();
         if (!(op == Op_StoreCM ||
--- a/src/share/vm/opto/graphKit.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/graphKit.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1771,11 +1771,21 @@
   CallProjections callprojs;
   call->extract_projections(&callprojs, true);
 
+  Node* init_mem = call->in(TypeFunc::Memory);
+  Node* final_mem = final_state->in(TypeFunc::Memory);
+  Node* final_ctl = final_state->in(TypeFunc::Control);
+  Node* final_io = final_state->in(TypeFunc::I_O);
+
   // Replace all the old call edges with the edges from the inlining result
-  C->gvn_replace_by(callprojs.fallthrough_catchproj, final_state->in(TypeFunc::Control));
-  C->gvn_replace_by(callprojs.fallthrough_memproj,   final_state->in(TypeFunc::Memory));
-  C->gvn_replace_by(callprojs.fallthrough_ioproj,    final_state->in(TypeFunc::I_O));
-  Node* final_mem = final_state->in(TypeFunc::Memory);
+  if (callprojs.fallthrough_catchproj != NULL) {
+    C->gvn_replace_by(callprojs.fallthrough_catchproj, final_ctl);
+  }
+  if (callprojs.fallthrough_memproj != NULL) {
+    C->gvn_replace_by(callprojs.fallthrough_memproj,   final_mem);
+  }
+  if (callprojs.fallthrough_ioproj != NULL) {
+    C->gvn_replace_by(callprojs.fallthrough_ioproj,    final_io);
+  }
 
   // Replace the result with the new result if it exists and is used
   if (callprojs.resproj != NULL && result != NULL) {
@@ -1784,10 +1794,15 @@
 
   if (ejvms == NULL) {
     // No exception edges to simply kill off those paths
-    C->gvn_replace_by(callprojs.catchall_catchproj, C->top());
-    C->gvn_replace_by(callprojs.catchall_memproj,   C->top());
-    C->gvn_replace_by(callprojs.catchall_ioproj,    C->top());
-
+    if (callprojs.catchall_catchproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_catchproj, C->top());
+    }
+    if (callprojs.catchall_memproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_memproj,   C->top());
+    }
+    if (callprojs.catchall_ioproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_ioproj,    C->top());
+    }
     // Replace the old exception object with top
     if (callprojs.exobj != NULL) {
       C->gvn_replace_by(callprojs.exobj, C->top());
@@ -1799,10 +1814,15 @@
     SafePointNode* ex_map = ekit.combine_and_pop_all_exception_states();
 
     Node* ex_oop = ekit.use_exception_state(ex_map);
-
-    C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
-    C->gvn_replace_by(callprojs.catchall_memproj,   ekit.reset_memory());
-    C->gvn_replace_by(callprojs.catchall_ioproj,    ekit.i_o());
+    if (callprojs.catchall_catchproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_catchproj, ekit.control());
+    }
+    if (callprojs.catchall_memproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_memproj,   ekit.reset_memory());
+    }
+    if (callprojs.catchall_ioproj != NULL) {
+      C->gvn_replace_by(callprojs.catchall_ioproj,    ekit.i_o());
+    }
 
     // Replace the old exception object with the newly created one
     if (callprojs.exobj != NULL) {
@@ -2980,7 +3000,7 @@
   set_control( _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Control) ) );
   // create memory projection for i_o
   set_memory ( _gvn.transform( new (C) ProjNode(allocx, TypeFunc::Memory, true) ), rawidx );
-  make_slow_call_ex(allocx, env()->OutOfMemoryError_klass(), true);
+  make_slow_call_ex(allocx, env()->Throwable_klass(), true);
 
   // create a memory projection as for the normal control path
   Node* malloc = _gvn.transform(new (C) ProjNode(allocx, TypeFunc::Memory));
--- a/src/share/vm/opto/idealGraphPrinter.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/idealGraphPrinter.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -547,7 +547,7 @@
 
         // max. 2 chars allowed
         if (value >= -9 && value <= 99) {
-          sprintf(buffer, INT64_FORMAT, value);
+          sprintf(buffer, JLONG_FORMAT, value);
           print_prop(short_name, buffer);
         } else {
           print_prop(short_name, "L");
--- a/src/share/vm/opto/lcm.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/lcm.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -175,6 +175,7 @@
     case Op_StrEquals:
     case Op_StrIndexOf:
     case Op_AryEq:
+    case Op_EncodeISOArray:
       // Not a legit memory op for implicit null check regardless of
       // embedded loads
       continue;
--- a/src/share/vm/opto/library_call.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/library_call.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -282,6 +282,7 @@
   typedef enum { LS_xadd, LS_xchg, LS_cmpxchg } LoadStoreKind;
   bool inline_unsafe_load_store(BasicType type,  LoadStoreKind kind);
   bool inline_unsafe_ordered_store(BasicType type);
+  bool inline_unsafe_fence(vmIntrinsics::ID id);
   bool inline_fp_conversions(vmIntrinsics::ID id);
   bool inline_number_methods(vmIntrinsics::ID id);
   bool inline_reference_get();
@@ -289,6 +290,7 @@
   bool inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id);
   Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting);
   Node* get_key_start_from_aescrypt_object(Node* aescrypt_object);
+  bool inline_encodeISOArray();
 };
 
 
@@ -334,6 +336,9 @@
     case vmIntrinsics::_getAndSetInt:
     case vmIntrinsics::_getAndSetLong:
     case vmIntrinsics::_getAndSetObject:
+    case vmIntrinsics::_loadFence:
+    case vmIntrinsics::_storeFence:
+    case vmIntrinsics::_fullFence:
       break;  // InlineNatives does not control String.compareTo
     case vmIntrinsics::_Reference_get:
       break;  // InlineNatives does not control Reference.get
@@ -377,6 +382,10 @@
     // These also use the arraycopy intrinsic mechanism:
     if (!InlineArrayCopy)  return NULL;
     break;
+  case vmIntrinsics::_encodeISOArray:
+    if (!SpecialEncodeISOArray)  return NULL;
+    if (!Matcher::match_rule_supported(Op_EncodeISOArray))  return NULL;
+    break;
   case vmIntrinsics::_checkIndex:
     // We do not intrinsify this.  The optimizer does fine with it.
     return NULL;
@@ -412,16 +421,16 @@
     break;
 
   case vmIntrinsics::_reverseBytes_c:
-    if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return false;
+    if (!Matcher::match_rule_supported(Op_ReverseBytesUS)) return NULL;
     break;
   case vmIntrinsics::_reverseBytes_s:
-    if (!Matcher::match_rule_supported(Op_ReverseBytesS))  return false;
+    if (!Matcher::match_rule_supported(Op_ReverseBytesS))  return NULL;
     break;
   case vmIntrinsics::_reverseBytes_i:
-    if (!Matcher::match_rule_supported(Op_ReverseBytesI))  return false;
+    if (!Matcher::match_rule_supported(Op_ReverseBytesI))  return NULL;
     break;
   case vmIntrinsics::_reverseBytes_l:
-    if (!Matcher::match_rule_supported(Op_ReverseBytesL))  return false;
+    if (!Matcher::match_rule_supported(Op_ReverseBytesL))  return NULL;
     break;
 
   case vmIntrinsics::_Reference_get:
@@ -536,7 +545,7 @@
   // Try to inline the intrinsic.
   if (kit.try_to_inline()) {
     if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
-      CompileTask::print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
+      C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
     }
     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
     if (C->log()) {
@@ -555,7 +564,7 @@
     if (jvms->has_method()) {
       // Not a root compile.
       const char* msg = is_virtual() ? "failed to inline (intrinsic, virtual)" : "failed to inline (intrinsic)";
-      CompileTask::print_inlining(callee, jvms->depth() - 1, bci, msg);
+      C->print_inlining(callee, jvms->depth() - 1, bci, msg);
     } else {
       // Root compile
       tty->print("Did not generate intrinsic %s%s at bci:%d in",
@@ -585,7 +594,7 @@
   Node* slow_ctl = kit.try_to_predicate();
   if (!kit.failing()) {
     if (PrintIntrinsics || PrintInlining NOT_PRODUCT( || PrintOptoInlining) ) {
-      CompileTask::print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
+      C->print_inlining(callee, jvms->depth() - 1, bci, is_virtual() ? "(intrinsic, virtual)" : "(intrinsic)");
     }
     C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_worked);
     if (C->log()) {
@@ -602,12 +611,12 @@
     if (jvms->has_method()) {
       // Not a root compile.
       const char* msg = "failed to generate predicate for intrinsic";
-      CompileTask::print_inlining(kit.callee(), jvms->depth() - 1, bci, msg);
+      C->print_inlining(kit.callee(), jvms->depth() - 1, bci, msg);
     } else {
       // Root compile
-      tty->print("Did not generate predicate for intrinsic %s%s at bci:%d in",
-               vmIntrinsics::name_at(intrinsic_id()),
-               (is_virtual() ? " (virtual)" : ""), bci);
+      C->print_inlining_stream()->print("Did not generate predicate for intrinsic %s%s at bci:%d in",
+                                        vmIntrinsics::name_at(intrinsic_id()),
+                                        (is_virtual() ? " (virtual)" : ""), bci);
     }
   }
   C->gather_intrinsic_statistics(intrinsic_id(), is_virtual(), Compile::_intrinsic_failed);
@@ -732,6 +741,10 @@
   case vmIntrinsics::_getAndSetLong:            return inline_unsafe_load_store(T_LONG,   LS_xchg);
   case vmIntrinsics::_getAndSetObject:          return inline_unsafe_load_store(T_OBJECT, LS_xchg);
 
+  case vmIntrinsics::_loadFence:
+  case vmIntrinsics::_storeFence:
+  case vmIntrinsics::_fullFence:                return inline_unsafe_fence(intrinsic_id());
+
   case vmIntrinsics::_currentThread:            return inline_native_currentThread();
   case vmIntrinsics::_isInterrupted:            return inline_native_isInterrupted();
 
@@ -791,6 +804,9 @@
   case vmIntrinsics::_cipherBlockChaining_decryptAESCrypt:
     return inline_cipherBlockChaining_AESCrypt(intrinsic_id());
 
+  case vmIntrinsics::_encodeISOArray:
+    return inline_encodeISOArray();
+
   default:
     // If you get here, it may be that someone has added a new intrinsic
     // to the list in vmSymbols.hpp without implementing it here.
@@ -2840,6 +2856,26 @@
   return true;
 }
 
+bool LibraryCallKit::inline_unsafe_fence(vmIntrinsics::ID id) {
+  // Regardless of form, don't allow previous ld/st to move down,
+  // then issue acquire, release, or volatile mem_bar.
+  insert_mem_bar(Op_MemBarCPUOrder);
+  switch(id) {
+    case vmIntrinsics::_loadFence:
+      insert_mem_bar(Op_MemBarAcquire);
+      return true;
+    case vmIntrinsics::_storeFence:
+      insert_mem_bar(Op_MemBarRelease);
+      return true;
+    case vmIntrinsics::_fullFence:
+      insert_mem_bar(Op_MemBarVolatile);
+      return true;
+    default:
+      fatal_unexpected_iid(id);
+      return false;
+  }
+}
+
 //----------------------------inline_unsafe_allocate---------------------------
 // public native Object sun.mics.Unsafe.allocateInstance(Class<?> cls);
 bool LibraryCallKit::inline_unsafe_allocate() {
@@ -2952,14 +2988,23 @@
 
   // We only go to the fast case code if we pass two guards.
   // Paths which do not pass are accumulated in the slow_region.
+
+  enum {
+    no_int_result_path   = 1, // t == Thread.current() && !TLS._osthread._interrupted
+    no_clear_result_path = 2, // t == Thread.current() &&  TLS._osthread._interrupted && !clear_int
+    slow_result_path     = 3, // slow path: t.isInterrupted(clear_int)
+    PATH_LIMIT
+  };
+
+  // Ensure that it's not possible to move the load of TLS._osthread._interrupted flag
+  // out of the function.
+  insert_mem_bar(Op_MemBarCPUOrder);
+
+  RegionNode* result_rgn = new (C) RegionNode(PATH_LIMIT);
+  PhiNode*    result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL);
+
   RegionNode* slow_region = new (C) RegionNode(1);
   record_for_igvn(slow_region);
-  RegionNode* result_rgn = new (C) RegionNode(1+3); // fast1, fast2, slow
-  PhiNode*    result_val = new (C) PhiNode(result_rgn, TypeInt::BOOL);
-  enum { no_int_result_path   = 1,
-         no_clear_result_path = 2,
-         slow_result_path     = 3
-  };
 
   // (a) Receiving thread must be the current thread.
   Node* rec_thr = argument(0);
@@ -2968,14 +3013,13 @@
   Node* cmp_thr = _gvn.transform( new (C) CmpPNode(cur_thr, rec_thr) );
   Node* bol_thr = _gvn.transform( new (C) BoolNode(cmp_thr, BoolTest::ne) );
 
-  bool known_current_thread = (_gvn.type(bol_thr) == TypeInt::ZERO);
-  if (!known_current_thread)
-    generate_slow_guard(bol_thr, slow_region);
+  generate_slow_guard(bol_thr, slow_region);
 
   // (b) Interrupt bit on TLS must be false.
   Node* p = basic_plus_adr(top()/*!oop*/, tls_ptr, in_bytes(JavaThread::osthread_offset()));
   Node* osthread = make_load(NULL, p, TypeRawPtr::NOTNULL, T_ADDRESS);
   p = basic_plus_adr(top()/*!oop*/, osthread, in_bytes(OSThread::interrupted_offset()));
+
   // Set the control input on the field _interrupted read to prevent it floating up.
   Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT);
   Node* cmp_bit = _gvn.transform( new (C) CmpINode(int_bit, intcon(0)) );
@@ -3020,22 +3064,20 @@
     Node* slow_val = set_results_for_java_call(slow_call);
     // this->control() comes from set_results_for_java_call
 
-    // If we know that the result of the slow call will be true, tell the optimizer!
-    if (known_current_thread)  slow_val = intcon(1);
-
     Node* fast_io  = slow_call->in(TypeFunc::I_O);
     Node* fast_mem = slow_call->in(TypeFunc::Memory);
+
     // These two phis are pre-filled with copies of of the fast IO and Memory
-    Node* io_phi   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
-    Node* mem_phi  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
+    PhiNode* result_mem  = PhiNode::make(result_rgn, fast_mem, Type::MEMORY, TypePtr::BOTTOM);
+    PhiNode* result_io   = PhiNode::make(result_rgn, fast_io,  Type::ABIO);
 
     result_rgn->init_req(slow_result_path, control());
-    io_phi    ->init_req(slow_result_path, i_o());
-    mem_phi   ->init_req(slow_result_path, reset_memory());
+    result_io ->init_req(slow_result_path, i_o());
+    result_mem->init_req(slow_result_path, reset_memory());
     result_val->init_req(slow_result_path, slow_val);
 
-    set_all_memory( _gvn.transform(mem_phi) );
-    set_i_o(        _gvn.transform(io_phi) );
+    set_all_memory(_gvn.transform(result_mem));
+    set_i_o(       _gvn.transform(result_io));
   }
 
   C->set_has_split_ifs(true); // Has chance for split-if optimization
@@ -3319,7 +3361,7 @@
     Node* arg = args[which_arg];
     arg = null_check(arg);
     if (stopped())  break;
-    args[which_arg] = _gvn.transform(arg);
+    args[which_arg] = arg;
 
     Node* p = basic_plus_adr(arg, class_klass_offset);
     Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type);
@@ -3525,7 +3567,6 @@
 // public static <T,U> T[] java.util.Arrays.copyOf(     U[] original, int newLength,         Class<? extends T[]> newType);
 // public static <T,U> T[] java.util.Arrays.copyOfRange(U[] original, int from,      int to, Class<? extends T[]> newType);
 bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
-  return false;
   if (too_many_traps(Deoptimization::Reason_intrinsic))  return false;
 
   // Get the arguments.
@@ -5335,6 +5376,47 @@
                     src_start, dest_start, copy_length XTOP);
 }
 
+//-------------inline_encodeISOArray-----------------------------------
+// encode char[] to byte[] in ISO_8859_1
+bool LibraryCallKit::inline_encodeISOArray() {
+  assert(callee()->signature()->size() == 5, "encodeISOArray has 5 parameters");
+  // no receiver since it is static method
+  Node *src         = argument(0);
+  Node *src_offset  = argument(1);
+  Node *dst         = argument(2);
+  Node *dst_offset  = argument(3);
+  Node *length      = argument(4);
+
+  const Type* src_type = src->Value(&_gvn);
+  const Type* dst_type = dst->Value(&_gvn);
+  const TypeAryPtr* top_src = src_type->isa_aryptr();
+  const TypeAryPtr* top_dest = dst_type->isa_aryptr();
+  if (top_src  == NULL || top_src->klass()  == NULL ||
+      top_dest == NULL || top_dest->klass() == NULL) {
+    // failed array check
+    return false;
+  }
+
+  // Figure out the size and type of the elements we will be copying.
+  BasicType src_elem = src_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+  BasicType dst_elem = dst_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
+  if (src_elem != T_CHAR || dst_elem != T_BYTE) {
+    return false;
+  }
+  Node* src_start = array_element_address(src, src_offset, src_elem);
+  Node* dst_start = array_element_address(dst, dst_offset, dst_elem);
+  // 'src_start' points to src array + scaled offset
+  // 'dst_start' points to dst array + scaled offset
+
+  const TypeAryPtr* mtype = TypeAryPtr::BYTES;
+  Node* enc = new (C) EncodeISOArrayNode(control(), memory(mtype), src_start, dst_start, length);
+  enc = _gvn.transform(enc);
+  Node* res_mem = _gvn.transform(new (C) SCMemProjNode(enc));
+  set_memory(res_mem, mtype);
+  set_result(enc);
+  return true;
+}
+
 //----------------------------inline_reference_get----------------------------
 // public T java.lang.ref.Reference.get();
 bool LibraryCallKit::inline_reference_get() {
--- a/src/share/vm/opto/loopTransform.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/loopTransform.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -613,6 +613,7 @@
       case Op_StrComp:
       case Op_StrEquals:
       case Op_StrIndexOf:
+      case Op_EncodeISOArray:
       case Op_AryEq: {
         return false;
       }
@@ -717,6 +718,7 @@
       case Op_StrComp:
       case Op_StrEquals:
       case Op_StrIndexOf:
+      case Op_EncodeISOArray:
       case Op_AryEq: {
         // Do not unroll a loop with String intrinsics code.
         // String intrinsics are large and have loops.
--- a/src/share/vm/opto/machnode.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/machnode.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -506,7 +506,7 @@
 #ifndef PRODUCT
 void MachNullCheckNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
   int reg = ra_->get_reg_first(in(1)->in(_vidx));
-  tty->print("%s %s", Name(), Matcher::regName[reg]);
+  st->print("%s %s", Name(), Matcher::regName[reg]);
 }
 #endif
 
--- a/src/share/vm/opto/macro.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/macro.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -361,14 +361,21 @@
       }
       // Otherwise skip it (the call updated 'mem' value).
     } else if (mem->Opcode() == Op_SCMemProj) {
-      assert(mem->in(0)->is_LoadStore(), "sanity");
-      const TypePtr* atype = mem->in(0)->in(MemNode::Address)->bottom_type()->is_ptr();
+      mem = mem->in(0);
+      Node* adr = NULL;
+      if (mem->is_LoadStore()) {
+        adr = mem->in(MemNode::Address);
+      } else {
+        assert(mem->Opcode() == Op_EncodeISOArray, "sanity");
+        adr = mem->in(3); // Destination array
+      }
+      const TypePtr* atype = adr->bottom_type()->is_ptr();
       int adr_idx = Compile::current()->get_alias_index(atype);
       if (adr_idx == alias_idx) {
         assert(false, "Object is not scalar replaceable if a LoadStore node access its field");
         return NULL;
       }
-      mem = mem->in(0)->in(MemNode::Memory);
+      mem = mem->in(MemNode::Memory);
     } else {
       return mem;
     }
@@ -445,7 +452,7 @@
         }
         values.at_put(j, val);
       } else if (val->Opcode() == Op_SCMemProj) {
-        assert(val->in(0)->is_LoadStore(), "sanity");
+        assert(val->in(0)->is_LoadStore() || val->in(0)->Opcode() == Op_EncodeISOArray, "sanity");
         assert(false, "Object is not scalar replaceable if a LoadStore node access its field");
         return NULL;
       } else {
--- a/src/share/vm/opto/matcher.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/matcher.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -919,6 +919,7 @@
     case Op_AryEq:
     case Op_MemBarVolatile:
     case Op_MemBarCPUOrder: // %%% these ideals should have narrower adr_type?
+    case Op_EncodeISOArray:
       nidx = Compile::AliasIdxTop;
       nat = NULL;
       break;
@@ -1982,6 +1983,7 @@
       case Op_StrEquals:
       case Op_StrIndexOf:
       case Op_AryEq:
+      case Op_EncodeISOArray:
         set_shared(n); // Force result into register (it will be anyways)
         break;
       case Op_ConP: {  // Convert pointers above the centerline to NUL
@@ -2183,6 +2185,13 @@
         n->del_req(4);
         break;
       }
+      case Op_EncodeISOArray: {
+        // Restructure into a binary tree for Matching.
+        Node* pair = new (C) BinaryNode(n->in(3), n->in(4));
+        n->set_req(3, pair);
+        n->del_req(4);
+        break;
+      }
       default:
         break;
       }
--- a/src/share/vm/opto/memnode.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/memnode.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -2725,10 +2725,8 @@
     zend  = phase->transform( new(C) URShiftXNode(zend,  shift) );
   }
 
+  // Bulk clear double-words
   Node* zsize = phase->transform( new(C) SubXNode(zend, zbase) );
-  Node* zinit = phase->zerocon((unit == BytesPerLong) ? T_LONG : T_INT);
-
-  // Bulk clear double-words
   Node* adr = phase->transform( new(C) AddPNode(dest, dest, start_offset) );
   mem = new (C) ClearArrayNode(ctl, mem, zsize, adr);
   return phase->transform(mem);
@@ -2799,6 +2797,26 @@
 }
 
 //=============================================================================
+//------------------------------match_edge-------------------------------------
+// Do not match memory edge
+uint EncodeISOArrayNode::match_edge(uint idx) const {
+  return idx == 2 || idx == 3; // EncodeISOArray src (Binary dst len)
+}
+
+//------------------------------Ideal------------------------------------------
+// Return a node which is more "ideal" than the current node.  Strip out
+// control copies
+Node *EncodeISOArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
+  return remove_dead_region(phase, can_reshape) ? this : NULL;
+}
+
+//------------------------------Value------------------------------------------
+const Type *EncodeISOArrayNode::Value(PhaseTransform *phase) const {
+  if (in(0) && phase->type(in(0)) == Type::TOP) return Type::TOP;
+  return bottom_type();
+}
+
+//=============================================================================
 MemBarNode::MemBarNode(Compile* C, int alias_idx, Node* precedent)
   : MultiNode(TypeFunc::Parms + (precedent == NULL? 0: 1)),
     _adr_type(C->get_adr_type(alias_idx))
--- a/src/share/vm/opto/memnode.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/memnode.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -888,6 +888,22 @@
   virtual const Type* bottom_type() const { return TypeInt::BOOL; }
 };
 
+
+//------------------------------EncodeISOArray--------------------------------
+// encode char[] to byte[] in ISO_8859_1
+class EncodeISOArrayNode: public Node {
+public:
+  EncodeISOArrayNode(Node *control, Node* arymem, Node* s1, Node* s2, Node* c): Node(control, arymem, s1, s2, c) {};
+  virtual int Opcode() const;
+  virtual bool depends_only_on_test() const { return false; }
+  virtual const Type* bottom_type() const { return TypeInt::INT; }
+  virtual const TypePtr* adr_type() const { return TypePtr::BOTTOM; }
+  virtual uint match_edge(uint idx) const;
+  virtual uint ideal_reg() const { return Op_RegI; }
+  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
+  virtual const Type *Value(PhaseTransform *phase) const;
+};
+
 //------------------------------MemBar-----------------------------------------
 // There are different flavors of Memory Barriers to match the Java Memory
 // Model.  Monitor-enter and volatile-load act as Aquires: no following ref
--- a/src/share/vm/opto/node.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/node.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1476,35 +1476,35 @@
 }
 
 #ifdef ASSERT
-static void dump_orig(Node* orig) {
+static void dump_orig(Node* orig, outputStream *st) {
   Compile* C = Compile::current();
-  if (NotANode(orig))  orig = NULL;
-  if (orig != NULL && !C->node_arena()->contains(orig))  orig = NULL;
-  if (orig == NULL)  return;
-  tty->print(" !orig=");
+  if (NotANode(orig)) orig = NULL;
+  if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL;
+  if (orig == NULL) return;
+  st->print(" !orig=");
   Node* fast = orig->debug_orig(); // tortoise & hare algorithm to detect loops
-  if (NotANode(fast))  fast = NULL;
+  if (NotANode(fast)) fast = NULL;
   while (orig != NULL) {
     bool discon = is_disconnected(orig);  // if discon, print [123] else 123
-    if (discon)  tty->print("[");
+    if (discon) st->print("[");
     if (!Compile::current()->node_arena()->contains(orig))
-      tty->print("o");
-    tty->print("%d", orig->_idx);
-    if (discon)  tty->print("]");
+      st->print("o");
+    st->print("%d", orig->_idx);
+    if (discon) st->print("]");
     orig = orig->debug_orig();
-    if (NotANode(orig))  orig = NULL;
-    if (orig != NULL && !C->node_arena()->contains(orig))  orig = NULL;
-    if (orig != NULL)  tty->print(",");
+    if (NotANode(orig)) orig = NULL;
+    if (orig != NULL && !C->node_arena()->contains(orig)) orig = NULL;
+    if (orig != NULL) st->print(",");
     if (fast != NULL) {
       // Step fast twice for each single step of orig:
       fast = fast->debug_orig();
-      if (NotANode(fast))  fast = NULL;
+      if (NotANode(fast)) fast = NULL;
       if (fast != NULL && fast != orig) {
         fast = fast->debug_orig();
-        if (NotANode(fast))  fast = NULL;
+        if (NotANode(fast)) fast = NULL;
       }
       if (fast == orig) {
-        tty->print("...");
+        st->print("...");
         break;
       }
     }
@@ -1531,35 +1531,34 @@
 
 //------------------------------dump------------------------------------------
 // Dump a Node
-void Node::dump() const {
+void Node::dump(const char* suffix, outputStream *st) const {
   Compile* C = Compile::current();
   bool is_new = C->node_arena()->contains(this);
   _in_dump_cnt++;
-  tty->print("%c%d\t%s\t=== ",
-             is_new ? ' ' : 'o', _idx, Name());
+  st->print("%c%d\t%s\t=== ", is_new ? ' ' : 'o', _idx, Name());
 
   // Dump the required and precedence inputs
-  dump_req();
-  dump_prec();
+  dump_req(st);
+  dump_prec(st);
   // Dump the outputs
-  dump_out();
+  dump_out(st);
 
   if (is_disconnected(this)) {
 #ifdef ASSERT
-    tty->print("  [%d]",debug_idx());
-    dump_orig(debug_orig());
+    st->print("  [%d]",debug_idx());
+    dump_orig(debug_orig(), st);
 #endif
-    tty->cr();
+    st->cr();
     _in_dump_cnt--;
     return;                     // don't process dead nodes
   }
 
   // Dump node-specific info
-  dump_spec(tty);
+  dump_spec(st);
 #ifdef ASSERT
   // Dump the non-reset _debug_idx
-  if( Verbose && WizardMode ) {
-    tty->print("  [%d]",debug_idx());
+  if (Verbose && WizardMode) {
+    st->print("  [%d]",debug_idx());
   }
 #endif
 
@@ -1569,88 +1568,88 @@
     const TypeInstPtr  *toop = t->isa_instptr();
     const TypeKlassPtr *tkls = t->isa_klassptr();
     ciKlass*           klass = toop ? toop->klass() : (tkls ? tkls->klass() : NULL );
-    if( klass && klass->is_loaded() && klass->is_interface() ) {
-      tty->print("  Interface:");
-    } else if( toop ) {
-      tty->print("  Oop:");
-    } else if( tkls ) {
-      tty->print("  Klass:");
+    if (klass && klass->is_loaded() && klass->is_interface()) {
+      st->print("  Interface:");
+    } else if (toop) {
+      st->print("  Oop:");
+    } else if (tkls) {
+      st->print("  Klass:");
     }
-    t->dump();
-  } else if( t == Type::MEMORY ) {
-    tty->print("  Memory:");
-    MemNode::dump_adr_type(this, adr_type(), tty);
-  } else if( Verbose || WizardMode ) {
-    tty->print("  Type:");
-    if( t ) {
-      t->dump();
+    t->dump_on(st);
+  } else if (t == Type::MEMORY) {
+    st->print("  Memory:");
+    MemNode::dump_adr_type(this, adr_type(), st);
+  } else if (Verbose || WizardMode) {
+    st->print("  Type:");
+    if (t) {
+      t->dump_on(st);
     } else {
-      tty->print("no type");
+      st->print("no type");
     }
   } else if (t->isa_vect() && this->is_MachSpillCopy()) {
     // Dump MachSpillcopy vector type.
-    t->dump();
+    t->dump_on(st);
   }
   if (is_new) {
-    debug_only(dump_orig(debug_orig()));
+    debug_only(dump_orig(debug_orig(), st));
     Node_Notes* nn = C->node_notes_at(_idx);
     if (nn != NULL && !nn->is_clear()) {
       if (nn->jvms() != NULL) {
-        tty->print(" !jvms:");
-        nn->jvms()->dump_spec(tty);
+        st->print(" !jvms:");
+        nn->jvms()->dump_spec(st);
       }
     }
   }
-  tty->cr();
+  if (suffix) st->print(suffix);
   _in_dump_cnt--;
 }
 
 //------------------------------dump_req--------------------------------------
-void Node::dump_req() const {
+void Node::dump_req(outputStream *st) const {
   // Dump the required input edges
   for (uint i = 0; i < req(); i++) {    // For all required inputs
     Node* d = in(i);
     if (d == NULL) {
-      tty->print("_ ");
+      st->print("_ ");
     } else if (NotANode(d)) {
-      tty->print("NotANode ");  // uninitialized, sentinel, garbage, etc.
+      st->print("NotANode ");  // uninitialized, sentinel, garbage, etc.
     } else {
-      tty->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx);
+      st->print("%c%d ", Compile::current()->node_arena()->contains(d) ? ' ' : 'o', d->_idx);
     }
   }
 }
 
 
 //------------------------------dump_prec-------------------------------------
-void Node::dump_prec() const {
+void Node::dump_prec(outputStream *st) const {
   // Dump the precedence edges
   int any_prec = 0;
   for (uint i = req(); i < len(); i++) {       // For all precedence inputs
     Node* p = in(i);
     if (p != NULL) {
-      if( !any_prec++ ) tty->print(" |");
-      if (NotANode(p)) { tty->print("NotANode "); continue; }
-      tty->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
+      if (!any_prec++) st->print(" |");
+      if (NotANode(p)) { st->print("NotANode "); continue; }
+      st->print("%c%d ", Compile::current()->node_arena()->contains(in(i)) ? ' ' : 'o', in(i)->_idx);
     }
   }
 }
 
 //------------------------------dump_out--------------------------------------
-void Node::dump_out() const {
+void Node::dump_out(outputStream *st) const {
   // Delimit the output edges
-  tty->print(" [[");
+  st->print(" [[");
   // Dump the output edges
   for (uint i = 0; i < _outcnt; i++) {    // For all outputs
     Node* u = _out[i];
     if (u == NULL) {
-      tty->print("_ ");
+      st->print("_ ");
     } else if (NotANode(u)) {
-      tty->print("NotANode ");
+      st->print("NotANode ");
     } else {
-      tty->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx);
+      st->print("%c%d ", Compile::current()->node_arena()->contains(u) ? ' ' : 'o', u->_idx);
     }
   }
-  tty->print("]] ");
+  st->print("]] ");
 }
 
 //------------------------------dump_nodes-------------------------------------
@@ -1839,15 +1838,16 @@
   return idx;                   // True for other than index 0 (control)
 }
 
+static RegMask _not_used_at_all;
 // Register classes are defined for specific machines
 const RegMask &Node::out_RegMask() const {
   ShouldNotCallThis();
-  return *(new RegMask());
+  return _not_used_at_all;
 }
 
 const RegMask &Node::in_RegMask(uint) const {
   ShouldNotCallThis();
-  return *(new RegMask());
+  return _not_used_at_all;
 }
 
 //=============================================================================
--- a/src/share/vm/opto/node.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/node.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -994,12 +994,13 @@
 #ifndef PRODUCT
   Node* find(int idx) const;         // Search the graph for the given idx.
   Node* find_ctrl(int idx) const;    // Search control ancestors for the given idx.
-  void dump() const;                 // Print this node,
+  void dump() const { dump("\n"); }  // Print this node.
+  void dump(const char* suffix, outputStream *st = tty) const;// Print this node.
   void dump(int depth) const;        // Print this node, recursively to depth d
   void dump_ctrl(int depth) const;   // Print control nodes, to depth d
-  virtual void dump_req() const;     // Print required-edge info
-  virtual void dump_prec() const;    // Print precedence-edge info
-  virtual void dump_out() const;     // Print the output edge info
+  virtual void dump_req(outputStream *st = tty) const;     // Print required-edge info
+  virtual void dump_prec(outputStream *st = tty) const;    // Print precedence-edge info
+  virtual void dump_out(outputStream *st = tty) const;     // Print the output edge info
   virtual void dump_spec(outputStream *st) const {}; // Print per-node info
   void verify_edges(Unique_Node_List &visited); // Verify bi-directional edges
   void verify() const;               // Check Def-Use info for my subgraph
--- a/src/share/vm/opto/optoreg.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/optoreg.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -77,7 +77,7 @@
   // (We would like to have an operator+ for RegName, but it is not
   // a class, so this would be illegal in C++.)
 
-  static void dump( int );
+  static void dump(int, outputStream *st = tty);
 
   // Get the stack slot number of an OptoReg::Name
   static unsigned int reg2stack( OptoReg::Name r) {
--- a/src/share/vm/opto/parse.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/parse.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -70,7 +70,7 @@
   InlineTree *build_inline_tree_for_callee(ciMethod* callee_method,
                                            JVMState* caller_jvms,
                                            int caller_bci);
-  const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result);
+  const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result, bool& should_delay);
   const char* should_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const;
   const char* should_not_inline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const;
   void        print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const;
@@ -107,7 +107,7 @@
   // and may be accessed by find_subtree_from_root.
   // The call_method is the dest_method for a special or static invocation.
   // The call_method is an optimized virtual method candidate otherwise.
-  WarmCallInfo* ok_to_inline(ciMethod *call_method, JVMState* caller_jvms, ciCallProfile& profile, WarmCallInfo* wci);
+  WarmCallInfo* ok_to_inline(ciMethod *call_method, JVMState* caller_jvms, ciCallProfile& profile, WarmCallInfo* wci, bool& should_delay);
 
   // Information about inlined method
   JVMState*   caller_jvms()       const { return _caller_jvms; }
@@ -469,10 +469,6 @@
   // Helper function to uncommon-trap or bailout for non-compilable call-sites
   bool can_not_compile_call_site(ciMethod *dest_method, ciInstanceKlass *klass);
 
-  // Helper function to identify inlining potential at call-site
-  ciMethod* optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
-                              ciMethod *dest_method, const TypeOopPtr* receiver_type);
-
   // Helper function to setup for type-profile based inlining
   bool prepare_type_profile_inline(ciInstanceKlass* prof_klass, ciMethod* prof_method);
 
--- a/src/share/vm/opto/parse1.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/parse1.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1404,7 +1404,8 @@
 
     do_one_bytecode();
 
-    assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth, "correct depth prediction");
+    assert(!have_se || stopped() || failing() || (sp() - pre_bc_sp) == depth,
+           err_msg_res("incorrect depth prediction: sp=%d, pre_bc_sp=%d, depth=%d", sp(), pre_bc_sp, depth));
 
     do_exceptions();
 
--- a/src/share/vm/opto/parse3.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/parse3.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -509,6 +509,7 @@
                           makecon(TypeKlassPtr::make(array_klass)),
                           dims);
   }
+  make_slow_call_ex(c, env()->Throwable_klass(), false);
 
   Node* res = _gvn.transform(new (C) ProjNode(c, TypeFunc::Parms));
 
--- a/src/share/vm/opto/phaseX.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/phaseX.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -75,6 +75,13 @@
   // nh->_sentinel must be in the current node space
 }
 
+void NodeHash::replace_with(NodeHash *nh) {
+  debug_only(_table = (Node**)badAddress);   // interact correctly w/ operator=
+  // just copy in all the fields
+  *this = *nh;
+  // nh->_sentinel must be in the current node space
+}
+
 //------------------------------hash_find--------------------------------------
 // Find in hash table
 Node *NodeHash::hash_find( const Node *n ) {
--- a/src/share/vm/opto/phaseX.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/phaseX.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -92,6 +92,7 @@
   }
 
   void   remove_useless_nodes(VectorSet &useful); // replace with sentinel
+  void replace_with(NodeHash* nh);
 
   Node  *sentinel() { return _sentinel; }
 
@@ -386,6 +387,11 @@
   Node  *transform( Node *n );
   Node  *transform_no_reclaim( Node *n );
 
+  void replace_with(PhaseGVN* gvn) {
+    _table.replace_with(&gvn->_table);
+    _types = gvn->_types;
+  }
+
   // Check for a simple dead loop when a data node references itself.
   DEBUG_ONLY(void dead_loop_check(Node *n);)
 };
--- a/src/share/vm/opto/regalloc.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/regalloc.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -40,6 +40,7 @@
                Phase(Register_Allocation), _cfg(cfg), _matcher(matcher),
                _node_oops(Thread::current()->resource_area()),
                _node_regs(0),
+               _node_regs_max_index(0),
                _framesize(0xdeadbeef)
 {
     int i;
--- a/src/share/vm/opto/regmask.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/regmask.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -108,13 +108,13 @@
 //------------------------------dump-------------------------------------------
 
 #ifndef PRODUCT
-void OptoReg::dump( int r ) {
-  switch( r ) {
-  case Special: tty->print("r---");   break;
-  case Bad:     tty->print("rBAD");   break;
+void OptoReg::dump(int r, outputStream *st) {
+  switch (r) {
+  case Special: st->print("r---"); break;
+  case Bad:     st->print("rBAD"); break;
   default:
-    if( r < _last_Mach_Reg ) tty->print(Matcher::regName[r]);
-    else tty->print("rS%d",r);
+    if (r < _last_Mach_Reg) st->print(Matcher::regName[r]);
+    else st->print("rS%d",r);
     break;
   }
 }
@@ -404,53 +404,53 @@
 
 #ifndef PRODUCT
 //------------------------------print------------------------------------------
-void RegMask::dump( ) const {
-  tty->print("[");
+void RegMask::dump(outputStream *st) const {
+  st->print("[");
   RegMask rm = *this;           // Structure copy into local temp
 
   OptoReg::Name start = rm.find_first_elem(); // Get a register
-  if( OptoReg::is_valid(start) ) { // Check for empty mask
+  if (OptoReg::is_valid(start)) { // Check for empty mask
     rm.Remove(start);           // Yank from mask
-    OptoReg::dump(start);       // Print register
+    OptoReg::dump(start, st);   // Print register
     OptoReg::Name last = start;
 
     // Now I have printed an initial register.
     // Print adjacent registers as "rX-rZ" instead of "rX,rY,rZ".
     // Begin looping over the remaining registers.
-    while( 1 ) {                //
+    while (1) {                 //
       OptoReg::Name reg = rm.find_first_elem(); // Get a register
-      if( !OptoReg::is_valid(reg) )
+      if (!OptoReg::is_valid(reg))
         break;                  // Empty mask, end loop
       rm.Remove(reg);           // Yank from mask
 
-      if( last+1 == reg ) {     // See if they are adjacent
+      if (last+1 == reg) {      // See if they are adjacent
         // Adjacent registers just collect into long runs, no printing.
         last = reg;
       } else {                  // Ending some kind of run
-        if( start == last ) {   // 1-register run; no special printing
-        } else if( start+1 == last ) {
-          tty->print(",");      // 2-register run; print as "rX,rY"
-          OptoReg::dump(last);
+        if (start == last) {    // 1-register run; no special printing
+        } else if (start+1 == last) {
+          st->print(",");       // 2-register run; print as "rX,rY"
+          OptoReg::dump(last, st);
         } else {                // Multi-register run; print as "rX-rZ"
-          tty->print("-");
-          OptoReg::dump(last);
+          st->print("-");
+          OptoReg::dump(last, st);
         }
-        tty->print(",");        // Seperate start of new run
+        st->print(",");         // Seperate start of new run
         start = last = reg;     // Start a new register run
-        OptoReg::dump(start); // Print register
+        OptoReg::dump(start, st); // Print register
       } // End of if ending a register run or not
     } // End of while regmask not empty
 
-    if( start == last ) {       // 1-register run; no special printing
-    } else if( start+1 == last ) {
-      tty->print(",");          // 2-register run; print as "rX,rY"
-      OptoReg::dump(last);
+    if (start == last) {        // 1-register run; no special printing
+    } else if (start+1 == last) {
+      st->print(",");           // 2-register run; print as "rX,rY"
+      OptoReg::dump(last, st);
     } else {                    // Multi-register run; print as "rX-rZ"
-      tty->print("-");
-      OptoReg::dump(last);
+      st->print("-");
+      OptoReg::dump(last, st);
     }
-    if( rm.is_AllStack() ) tty->print("...");
+    if (rm.is_AllStack()) st->print("...");
   }
-  tty->print("]");
+  st->print("]");
 }
 #endif
--- a/src/share/vm/opto/regmask.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/regmask.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -310,7 +310,7 @@
 
 #ifndef PRODUCT
   void print() const { dump(); }
-  void dump() const;            // Print a mask
+  void dump(outputStream *st = tty) const; // Print a mask
 #endif
 
   static const RegMask Empty;   // Common empty mask
--- a/src/share/vm/opto/runtime.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/runtime.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -989,7 +989,7 @@
       // since we're notifying the VM on every catch.
       // Force deoptimization and the rest of the lookup
       // will be fine.
-      deoptimize_caller_frame(thread, true);
+      deoptimize_caller_frame(thread);
     }
 
     // Check the stack guard pages.  If enabled, look for handler in this frame;
@@ -1143,17 +1143,22 @@
 
 
 void OptoRuntime::deoptimize_caller_frame(JavaThread *thread, bool doit) {
-  // Deoptimize frame
-  if (doit) {
-    // Called from within the owner thread, so no need for safepoint
-    RegisterMap reg_map(thread);
-    frame stub_frame = thread->last_frame();
-    assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
-    frame caller_frame = stub_frame.sender(&reg_map);
+  // Deoptimize the caller before continuing, as the compiled
+  // exception handler table may not be valid.
+  if (!StressCompiledExceptionHandlers && doit) {
+    deoptimize_caller_frame(thread);
+  }
+}
 
-    // Deoptimize the caller frame.
-    Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
-  }
+void OptoRuntime::deoptimize_caller_frame(JavaThread *thread) {
+  // Called from within the owner thread, so no need for safepoint
+  RegisterMap reg_map(thread);
+  frame stub_frame = thread->last_frame();
+  assert(stub_frame.is_runtime_frame() || exception_blob()->contains(stub_frame.pc()), "sanity check");
+  frame caller_frame = stub_frame.sender(&reg_map);
+
+  // Deoptimize the caller frame.
+  Deoptimization::deoptimize_frame(thread, caller_frame.id(), Deoptimization::Reason_constraint);
 }
 
 
--- a/src/share/vm/opto/runtime.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/runtime.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -174,6 +174,7 @@
   static address handle_exception_C       (JavaThread* thread);
   static address handle_exception_C_helper(JavaThread* thread, nmethod*& nm);
   static address rethrow_C                (oopDesc* exception, JavaThread *thread, address return_pc );
+  static void deoptimize_caller_frame     (JavaThread *thread);
   static void deoptimize_caller_frame     (JavaThread *thread, bool doit);
   static bool is_deoptimized_caller_frame (JavaThread *thread);
 
--- a/src/share/vm/opto/stringopts.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/stringopts.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -265,7 +265,8 @@
     } else if (n->is_IfTrue()) {
       Compile* C = _stringopts->C;
       C->gvn_replace_by(n, n->in(0)->in(0));
-      C->gvn_replace_by(n->in(0), C->top());
+      // get rid of the other projection
+      C->gvn_replace_by(n->in(0)->as_If()->proj_out(false), C->top());
     }
   }
 }
@@ -439,7 +440,7 @@
       }
       // Find the constructor call
       Node* result = alloc->result_cast();
-      if (result == NULL || !result->is_CheckCastPP()) {
+      if (result == NULL || !result->is_CheckCastPP() || alloc->in(TypeFunc::Memory)->is_top()) {
         // strange looking allocation
 #ifndef PRODUCT
         if (PrintOptimizeStringConcat) {
@@ -744,7 +745,9 @@
       ctrl_path.push(cn);
       ctrl_path.push(cn->proj_out(0));
       ctrl_path.push(cn->proj_out(0)->unique_out());
-      ctrl_path.push(cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0));
+      if (cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0) != NULL) {
+        ctrl_path.push(cn->proj_out(0)->unique_out()->as_Catch()->proj_out(0));
+      }
     } else {
       ShouldNotReachHere();
     }
@@ -762,6 +765,12 @@
     } else if (ptr->is_IfTrue()) {
       IfNode* iff = ptr->in(0)->as_If();
       BoolNode* b = iff->in(1)->isa_Bool();
+
+      if (b == NULL) {
+        fail = true;
+        break;
+      }
+
       Node* cmp = b->in(1);
       Node* v1 = cmp->in(1);
       Node* v2 = cmp->in(2);
@@ -826,6 +835,9 @@
           ptr->in(1)->in(0) != NULL && ptr->in(1)->in(0)->is_If()) {
         // Simple diamond.
         // XXX should check for possibly merging stores.  simple data merges are ok.
+        // The IGVN will make this simple diamond go away when it
+        // transforms the Region. Make sure it sees it.
+        Compile::current()->record_for_igvn(ptr);
         ptr = ptr->in(1)->in(0)->in(0);
         continue;
       }
@@ -1408,71 +1420,76 @@
                       Deoptimization::Action_make_not_entrant);
   }
 
-  // length now contains the number of characters needed for the
-  // char[] so create a new AllocateArray for the char[]
-  Node* char_array = NULL;
-  {
-    PreserveReexecuteState preexecs(&kit);
-    // The original jvms is for an allocation of either a String or
-    // StringBuffer so no stack adjustment is necessary for proper
-    // reexecution.  If we deoptimize in the slow path the bytecode
-    // will be reexecuted and the char[] allocation will be thrown away.
-    kit.jvms()->set_should_reexecute(true);
-    char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
-                               length, 1);
-  }
+  Node* result;
+  if (!kit.stopped()) {
+
+    // length now contains the number of characters needed for the
+    // char[] so create a new AllocateArray for the char[]
+    Node* char_array = NULL;
+    {
+      PreserveReexecuteState preexecs(&kit);
+      // The original jvms is for an allocation of either a String or
+      // StringBuffer so no stack adjustment is necessary for proper
+      // reexecution.  If we deoptimize in the slow path the bytecode
+      // will be reexecuted and the char[] allocation will be thrown away.
+      kit.jvms()->set_should_reexecute(true);
+      char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
+                                 length, 1);
+    }
+
+    // Mark the allocation so that zeroing is skipped since the code
+    // below will overwrite the entire array
+    AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
+    char_alloc->maybe_set_complete(_gvn);
 
-  // Mark the allocation so that zeroing is skipped since the code
-  // below will overwrite the entire array
-  AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
-  char_alloc->maybe_set_complete(_gvn);
-
-  // Now copy the string representations into the final char[]
-  Node* start = __ intcon(0);
-  for (int argi = 0; argi < sc->num_arguments(); argi++) {
-    Node* arg = sc->argument(argi);
-    switch (sc->mode(argi)) {
-      case StringConcat::IntMode: {
-        Node* end = __ AddI(start, string_sizes->in(argi));
-        // getChars words backwards so pass the ending point as well as the start
-        int_getChars(kit, arg, char_array, start, end);
-        start = end;
-        break;
+    // Now copy the string representations into the final char[]
+    Node* start = __ intcon(0);
+    for (int argi = 0; argi < sc->num_arguments(); argi++) {
+      Node* arg = sc->argument(argi);
+      switch (sc->mode(argi)) {
+        case StringConcat::IntMode: {
+          Node* end = __ AddI(start, string_sizes->in(argi));
+          // getChars words backwards so pass the ending point as well as the start
+          int_getChars(kit, arg, char_array, start, end);
+          start = end;
+          break;
+        }
+        case StringConcat::StringNullCheckMode:
+        case StringConcat::StringMode: {
+          start = copy_string(kit, arg, char_array, start);
+          break;
+        }
+        case StringConcat::CharMode: {
+          __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
+                             arg, T_CHAR, char_adr_idx);
+          start = __ AddI(start, __ intcon(1));
+          break;
+        }
+        default:
+          ShouldNotReachHere();
       }
-      case StringConcat::StringNullCheckMode:
-      case StringConcat::StringMode: {
-        start = copy_string(kit, arg, char_array, start);
-        break;
-      }
-      case StringConcat::CharMode: {
-        __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
-                           arg, T_CHAR, char_adr_idx);
-        start = __ AddI(start, __ intcon(1));
-        break;
-      }
-      default:
-        ShouldNotReachHere();
     }
-  }
 
-  // If we're not reusing an existing String allocation then allocate one here.
-  Node* result = sc->string_alloc();
-  if (result == NULL) {
-    PreserveReexecuteState preexecs(&kit);
-    // The original jvms is for an allocation of either a String or
-    // StringBuffer so no stack adjustment is necessary for proper
-    // reexecution.
-    kit.jvms()->set_should_reexecute(true);
-    result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass())));
+    // If we're not reusing an existing String allocation then allocate one here.
+    result = sc->string_alloc();
+    if (result == NULL) {
+      PreserveReexecuteState preexecs(&kit);
+      // The original jvms is for an allocation of either a String or
+      // StringBuffer so no stack adjustment is necessary for proper
+      // reexecution.
+      kit.jvms()->set_should_reexecute(true);
+      result = kit.new_instance(__ makecon(TypeKlassPtr::make(C->env()->String_klass())));
+    }
+
+    // Intialize the string
+    if (java_lang_String::has_offset_field()) {
+      kit.store_String_offset(kit.control(), result, __ intcon(0));
+      kit.store_String_length(kit.control(), result, length);
+    }
+    kit.store_String_value(kit.control(), result, char_array);
+  } else {
+    result = C->top();
   }
-
-  // Intialize the string
-  if (java_lang_String::has_offset_field()) {
-    kit.store_String_offset(kit.control(), result, __ intcon(0));
-    kit.store_String_length(kit.control(), result, length);
-  }
-  kit.store_String_value(kit.control(), result, char_array);
-
   // hook up the outgoing control and result
   kit.replace_call(sc->end(), result);
 
--- a/src/share/vm/opto/type.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/opto/type.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1542,10 +1542,10 @@
 static const char* longnamenear(jlong x, const char* xname, char* buf, jlong n) {
   if (n > x) {
     if (n >= x + 10000)  return NULL;
-    sprintf(buf, "%s+" INT64_FORMAT, xname, n - x);
+    sprintf(buf, "%s+" JLONG_FORMAT, xname, n - x);
   } else if (n < x) {
     if (n <= x - 10000)  return NULL;
-    sprintf(buf, "%s-" INT64_FORMAT, xname, x - n);
+    sprintf(buf, "%s-" JLONG_FORMAT, xname, x - n);
   } else {
     return xname;
   }
@@ -1557,11 +1557,11 @@
   if (n == min_jlong)
     return "min";
   else if (n < min_jlong + 10000)
-    sprintf(buf, "min+" INT64_FORMAT, n - min_jlong);
+    sprintf(buf, "min+" JLONG_FORMAT, n - min_jlong);
   else if (n == max_jlong)
     return "max";
   else if (n > max_jlong - 10000)
-    sprintf(buf, "max-" INT64_FORMAT, max_jlong - n);
+    sprintf(buf, "max-" JLONG_FORMAT, max_jlong - n);
   else if ((str = longnamenear(max_juint, "maxuint", buf, n)) != NULL)
     return str;
   else if ((str = longnamenear(max_jint, "maxint", buf, n)) != NULL)
@@ -1569,7 +1569,7 @@
   else if ((str = longnamenear(min_jint, "minint", buf, n)) != NULL)
     return str;
   else
-    sprintf(buf, INT64_FORMAT, n);
+    sprintf(buf, JLONG_FORMAT, n);
   return buf;
 }
 
--- a/src/share/vm/prims/jvm.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/jvm.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -486,15 +486,6 @@
 JVM_END
 
 
-JVM_ENTRY(void, JVM_PrintStackTrace(JNIEnv *env, jobject receiver, jobject printable))
-  JVMWrapper("JVM_PrintStackTrace");
-  // Note: This is no longer used in Merlin, but we still support it for compatibility.
-  oop exception = JNIHandles::resolve_non_null(receiver);
-  oop stream    = JNIHandles::resolve_non_null(printable);
-  java_lang_Throwable::print_stack_trace(exception, stream);
-JVM_END
-
-
 JVM_ENTRY(jint, JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable))
   JVMWrapper("JVM_GetStackTraceDepth");
   oop exception = JNIHandles::resolve(throwable);
@@ -1517,7 +1508,7 @@
 JVM_END
 
 
-static Method* jvm_get_method_common(jobject method, TRAPS) {
+static Method* jvm_get_method_common(jobject method) {
   // some of this code was adapted from from jni_FromReflectedMethod
 
   oop reflected = JNIHandles::resolve_non_null(method);
@@ -1535,8 +1526,7 @@
   }
   Klass* k = java_lang_Class::as_Klass(mirror);
 
-  KlassHandle kh(THREAD, k);
-  Method* m = InstanceKlass::cast(kh())->method_with_idnum(slot);
+  Method* m = InstanceKlass::cast(k)->method_with_idnum(slot);
   if (m == NULL) {
     assert(false, "cannot find method");
     return NULL;  // robustness
@@ -1550,7 +1540,7 @@
   JVMWrapper("JVM_GetMethodAnnotations");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->annotations(), THREAD));
 JVM_END
@@ -1560,7 +1550,7 @@
   JVMWrapper("JVM_GetMethodDefaultAnnotationValue");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->annotation_default(), THREAD));
 JVM_END
@@ -1570,11 +1560,79 @@
   JVMWrapper("JVM_GetMethodParameterAnnotations");
 
   // method is a handle to a java.lang.reflect.Method object
-  Method* m = jvm_get_method_common(method, CHECK_NULL);
+  Method* m = jvm_get_method_common(method);
   return (jbyteArray) JNIHandles::make_local(env,
     Annotations::make_java_array(m->parameter_annotations(), THREAD));
 JVM_END
 
+/* Type use annotations support (JDK 1.8) */
+
+JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
+  assert (cls != NULL, "illegal class");
+  JVMWrapper("JVM_GetClassTypeAnnotations");
+  ResourceMark rm(THREAD);
+  // Return null for arrays and primitives
+  if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
+    Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
+    if (k->oop_is_instance()) {
+      Annotations* type_annotations = InstanceKlass::cast(k)->type_annotations();
+      if (type_annotations != NULL) {
+        typeArrayOop a = Annotations::make_java_array(type_annotations->class_annotations(), CHECK_NULL);
+        return (jbyteArray) JNIHandles::make_local(env, a);
+      }
+    }
+  }
+  return NULL;
+JVM_END
+
+static void bounds_check(constantPoolHandle cp, jint index, TRAPS) {
+  if (!cp->is_within_bounds(index)) {
+    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Constant pool index out of bounds");
+  }
+}
+
+JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
+{
+  JVMWrapper("JVM_GetMethodParameters");
+  // method is a handle to a java.lang.reflect.Method object
+  Method* method_ptr = jvm_get_method_common(method);
+  methodHandle mh (THREAD, method_ptr);
+  Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method));
+  const int num_params = mh->method_parameters_length();
+
+  if (0 != num_params) {
+    // make sure all the symbols are properly formatted
+    for (int i = 0; i < num_params; i++) {
+      MethodParametersElement* params = mh->method_parameters_start();
+      int index = params[i].name_cp_index;
+      bounds_check(mh->constants(), index, CHECK_NULL);
+
+      if (0 != index && !mh->constants()->tag_at(index).is_utf8()) {
+        THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+                    "Wrong type at constant pool index");
+      }
+
+    }
+
+    objArrayOop result_oop = oopFactory::new_objArray(SystemDictionary::reflect_Parameter_klass(), num_params, CHECK_NULL);
+    objArrayHandle result (THREAD, result_oop);
+
+    for (int i = 0; i < num_params; i++) {
+      MethodParametersElement* params = mh->method_parameters_start();
+      // For a 0 index, give a NULL symbol
+      Symbol* const sym = 0 != params[i].name_cp_index ?
+        mh->constants()->symbol_at(params[i].name_cp_index) : NULL;
+      int flags = build_int_from_shorts(params[i].flags_lo, params[i].flags_hi);
+      oop param = Reflection::new_parameter(reflected_method, i, sym,
+                                            flags, CHECK_NULL);
+      result->obj_at_put(i, param);
+    }
+    return (jobjectArray)JNIHandles::make_local(env, result());
+  } else {
+    return (jobjectArray)NULL;
+  }
+}
+JVM_END
 
 // New (JDK 1.4) reflection implementation /////////////////////////////////////
 
@@ -1790,13 +1848,6 @@
 JVM_END
 
 
-static void bounds_check(constantPoolHandle cp, jint index, TRAPS) {
-  if (!cp->is_within_bounds(index)) {
-    THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "Constant pool index out of bounds");
-  }
-}
-
-
 JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetClassAt");
@@ -1811,7 +1862,6 @@
 }
 JVM_END
 
-
 JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetClassAtIfLoaded");
--- a/src/share/vm/prims/jvm.h	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/jvm.h	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -86,6 +86,8 @@
 
 #define JVM_INTERFACE_VERSION 4
 
+JNIEXPORT jobjectArray JNICALL
+JVM_GetMethodParameters(JNIEnv *env, jobject method);
 
 JNIEXPORT jint JNICALL
 JVM_GetInterfaceVersion(void);
@@ -210,9 +212,6 @@
 JNIEXPORT void JNICALL
 JVM_FillInStackTrace(JNIEnv *env, jobject throwable);
 
-JNIEXPORT void JNICALL
-JVM_PrintStackTrace(JNIEnv *env, jobject throwable, jobject printable);
-
 JNIEXPORT jint JNICALL
 JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable);
 
@@ -519,6 +518,10 @@
 JNIEXPORT jbyteArray JNICALL
 JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method);
 
+/* Type use annotations support (JDK 1.8) */
+
+JNIEXPORT jbyteArray JNICALL
+JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls);
 
 /*
  * New (JDK 1.4) reflection implementation
--- a/src/share/vm/prims/jvmtiExport.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/jvmtiExport.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1305,15 +1305,21 @@
         vframeStream st(thread);
         assert(!st.at_end(), "cannot be at end");
         Method* current_method = NULL;
+        // A GC may occur during the Method::fast_exception_handler_bci_for()
+        // call below if it needs to load the constraint class. Using a
+        // methodHandle to keep the 'current_method' from being deallocated
+        // if GC happens.
+        methodHandle current_mh = methodHandle(thread, current_method);
         int current_bci = -1;
         do {
           current_method = st.method();
+          current_mh = methodHandle(thread, current_method);
           current_bci = st.bci();
           do {
             should_repeat = false;
             KlassHandle eh_klass(thread, exception_handle()->klass());
-            current_bci = current_method->fast_exception_handler_bci_for(
-              eh_klass, current_bci, THREAD);
+            current_bci = Method::fast_exception_handler_bci_for(
+              current_mh, eh_klass, current_bci, THREAD);
             if (HAS_PENDING_EXCEPTION) {
               exception_handle = Handle(thread, PENDING_EXCEPTION);
               CLEAR_PENDING_EXCEPTION;
@@ -1328,8 +1334,7 @@
           catch_jmethodID = 0;
           current_bci = 0;
         } else {
-          catch_jmethodID = jem.to_jmethodID(
-                                     methodHandle(thread, current_method));
+          catch_jmethodID = jem.to_jmethodID(current_mh);
         }
 
         JvmtiJavaThreadEventTransition jet(thread);
--- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1043,7 +1043,7 @@
 
     Rewriter::rewrite(scratch_class, THREAD);
     if (!HAS_PENDING_EXCEPTION) {
-      Rewriter::relocate_and_link(scratch_class, THREAD);
+      scratch_class->link_methods(THREAD);
     }
     if (HAS_PENDING_EXCEPTION) {
       Symbol* ex_name = PENDING_EXCEPTION->klass()->name();
@@ -1334,20 +1334,8 @@
     return JVMTI_ERROR_INTERNAL;
   }
 
-  int orig_length = old_cp->orig_length();
-  if (orig_length == 0) {
-    // This old_cp is an actual original constant pool. We save
-    // the original length in the merged constant pool so that
-    // merge_constant_pools() can be more efficient. If a constant
-    // pool has a non-zero orig_length() value, then that constant
-    // pool was created by a merge operation in RedefineClasses.
-    merge_cp->set_orig_length(old_cp->length());
-  } else {
-    // This old_cp is a merged constant pool from a previous
-    // RedefineClasses() calls so just copy the orig_length()
-    // value.
-    merge_cp->set_orig_length(old_cp->orig_length());
-  }
+  // Update the version number of the constant pool
+  merge_cp->increment_and_save_version(old_cp->version());
 
   ResourceMark rm(THREAD);
   _index_map_count = 0;
@@ -2417,18 +2405,19 @@
        int scratch_cp_length, TRAPS) {
   assert(scratch_cp->length() >= scratch_cp_length, "sanity check");
 
-    // scratch_cp is a merged constant pool and has enough space for a
-    // worst case merge situation. We want to associate the minimum
-    // sized constant pool with the klass to save space.
-    constantPoolHandle smaller_cp(THREAD,
-    ConstantPool::allocate(loader_data, scratch_cp_length,
-                                   THREAD));
-    // preserve orig_length() value in the smaller copy
-    int orig_length = scratch_cp->orig_length();
-    assert(orig_length != 0, "sanity check");
-    smaller_cp->set_orig_length(orig_length);
-    scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
-    scratch_cp = smaller_cp;
+  // scratch_cp is a merged constant pool and has enough space for a
+  // worst case merge situation. We want to associate the minimum
+  // sized constant pool with the klass to save space.
+  constantPoolHandle smaller_cp(THREAD,
+          ConstantPool::allocate(loader_data, scratch_cp_length, THREAD));
+
+  // preserve version() value in the smaller copy
+  int version = scratch_cp->version();
+  assert(version != 0, "sanity check");
+  smaller_cp->set_version(version);
+
+  scratch_cp->copy_cp_to(1, scratch_cp_length - 1, smaller_cp, 1, THREAD);
+  scratch_cp = smaller_cp;
 
   // attach new constant pool to klass
   scratch_cp->set_pool_holder(scratch_class());
@@ -3338,7 +3327,20 @@
     the_class->set_access_flags(flags);
   }
 
-  // Replace annotation fields value
+  // Since there is currently no rewriting of type annotations indexes
+  // into the CP, we null out type annotations on scratch_class before
+  // we swap annotations with the_class rather than facing the
+  // possibility of shipping annotations with broken indexes to
+  // Java-land.
+  Annotations* new_annotations = scratch_class->annotations();
+  if (new_annotations != NULL) {
+    Annotations* new_type_annotations = new_annotations->type_annotations();
+    if (new_type_annotations != NULL) {
+      MetadataFactory::free_metadata(scratch_class->class_loader_data(), new_type_annotations);
+      new_annotations->set_type_annotations(NULL);
+    }
+  }
+  // Swap annotation fields values
   Annotations* old_annotations = the_class->annotations();
   the_class->set_annotations(scratch_class->annotations());
   scratch_class->set_annotations(old_annotations);
--- a/src/share/vm/prims/methodHandles.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/methodHandles.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1168,8 +1168,8 @@
     // Walk all nmethods depending on this call site.
     MutexLocker mu(Compile_lock, thread);
     Universe::flush_dependents_on(call_site, target);
+    java_lang_invoke_CallSite::set_target(call_site(), target());
   }
-  java_lang_invoke_CallSite::set_target(call_site(), target());
 }
 JVM_END
 
@@ -1180,8 +1180,8 @@
     // Walk all nmethods depending on this call site.
     MutexLocker mu(Compile_lock, thread);
     Universe::flush_dependents_on(call_site, target);
+    java_lang_invoke_CallSite::set_target_volatile(call_site(), target());
   }
-  java_lang_invoke_CallSite::set_target_volatile(call_site(), target());
 }
 JVM_END
 
--- a/src/share/vm/prims/unsafe.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/prims/unsafe.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -468,6 +468,21 @@
 #endif
 UNSAFE_END
 
+UNSAFE_ENTRY(void, Unsafe_LoadFence(JNIEnv *env, jobject unsafe))
+  UnsafeWrapper("Unsafe_LoadFence");
+  OrderAccess::acquire();
+UNSAFE_END
+
+UNSAFE_ENTRY(void, Unsafe_StoreFence(JNIEnv *env, jobject unsafe))
+  UnsafeWrapper("Unsafe_StoreFence");
+  OrderAccess::release();
+UNSAFE_END
+
+UNSAFE_ENTRY(void, Unsafe_FullFence(JNIEnv *env, jobject unsafe))
+  UnsafeWrapper("Unsafe_FullFence");
+  OrderAccess::fence();
+UNSAFE_END
+
 ////// Data in the C heap.
 
 // Note:  These do not throw NullPointerException for bad pointers.
@@ -1550,6 +1565,9 @@
     {CC"putOrderedObject",   CC"("OBJ"J"OBJ")V",         FN_PTR(Unsafe_SetOrderedObject)},
     {CC"putOrderedInt",      CC"("OBJ"JI)V",             FN_PTR(Unsafe_SetOrderedInt)},
     {CC"putOrderedLong",     CC"("OBJ"JJ)V",             FN_PTR(Unsafe_SetOrderedLong)},
+    {CC"loadFence",          CC"()V",                    FN_PTR(Unsafe_LoadFence)},
+    {CC"storeFence",         CC"()V",                    FN_PTR(Unsafe_StoreFence)},
+    {CC"fullFence",          CC"()V",                    FN_PTR(Unsafe_FullFence)},
     {CC"park",               CC"(ZJ)V",                  FN_PTR(Unsafe_Park)},
     {CC"unpark",             CC"("OBJ")V",               FN_PTR(Unsafe_Unpark)}
 
--- a/src/share/vm/runtime/aprofiler.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/aprofiler.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -129,7 +129,7 @@
   assert(!is_active(), "AllocationProfiler cannot be active while printing profile");
 
   tty->cr();
-  tty->print_cr("Allocation profile (sizes in bytes, cutoff = %ld bytes):", cutoff * BytesPerWord);
+  tty->print_cr("Allocation profile (sizes in bytes, cutoff = " SIZE_FORMAT " bytes):", cutoff * BytesPerWord);
   tty->cr();
 
   // Print regular instance klasses and basic type array klasses
--- a/src/share/vm/runtime/arguments.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -545,7 +545,7 @@
 // Parses a memory size specification string.
 static bool atomull(const char *s, julong* result) {
   julong n = 0;
-  int args_read = sscanf(s, os::julong_format_specifier(), &n);
+  int args_read = sscanf(s, JULONG_FORMAT, &n);
   if (args_read != 1) {
     return false;
   }
@@ -1101,10 +1101,6 @@
   }
 }
 
-// If the user has chosen ParallelGCThreads > 0, we set UseParNewGC
-// if it's not explictly set or unset. If the user has chosen
-// UseParNewGC and not explicitly set ParallelGCThreads we
-// set it, unless this is a single cpu machine.
 void Arguments::set_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
          "control point invariant");
@@ -1113,42 +1109,41 @@
   // Turn off AdaptiveSizePolicy for parnew until it is complete.
   disable_adaptive_size_policy("UseParNewGC");
 
-  if (ParallelGCThreads == 0) {
-    FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
-    if (ParallelGCThreads == 1) {
-      FLAG_SET_DEFAULT(UseParNewGC, false);
-      FLAG_SET_DEFAULT(ParallelGCThreads, 0);
-    }
+  if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
+    FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+    assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
+  } else if (ParallelGCThreads == 0) {
+    jio_fprintf(defaultStream::error_stream(),
+        "The ParNew GC can not be combined with -XX:ParallelGCThreads=0\n");
+    vm_exit(1);
+  }
+
+  // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
+  // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
+  // we set them to 1024 and 1024.
+  // See CR 6362902.
+  if (FLAG_IS_DEFAULT(YoungPLABSize)) {
+    FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
   }
-  if (UseParNewGC) {
-    // By default YoungPLABSize and OldPLABSize are set to 4096 and 1024 respectively,
-    // these settings are default for Parallel Scavenger. For ParNew+Tenured configuration
-    // we set them to 1024 and 1024.
-    // See CR 6362902.
-    if (FLAG_IS_DEFAULT(YoungPLABSize)) {
-      FLAG_SET_DEFAULT(YoungPLABSize, (intx)1024);
+  if (FLAG_IS_DEFAULT(OldPLABSize)) {
+    FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
+  }
+
+  // AlwaysTenure flag should make ParNew promote all at first collection.
+  // See CR 6362902.
+  if (AlwaysTenure) {
+    FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
+  }
+  // When using compressed oops, we use local overflow stacks,
+  // rather than using a global overflow list chained through
+  // the klass word of the object's pre-image.
+  if (UseCompressedOops && !ParGCUseLocalOverflow) {
+    if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
+      warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
     }
-    if (FLAG_IS_DEFAULT(OldPLABSize)) {
-      FLAG_SET_DEFAULT(OldPLABSize, (intx)1024);
-    }
-
-    // AlwaysTenure flag should make ParNew promote all at first collection.
-    // See CR 6362902.
-    if (AlwaysTenure) {
-      FLAG_SET_CMDLINE(uintx, MaxTenuringThreshold, 0);
-    }
-    // When using compressed oops, we use local overflow stacks,
-    // rather than using a global overflow list chained through
-    // the klass word of the object's pre-image.
-    if (UseCompressedOops && !ParGCUseLocalOverflow) {
-      if (!FLAG_IS_DEFAULT(ParGCUseLocalOverflow)) {
-        warning("Forcing +ParGCUseLocalOverflow: needed if using compressed references");
-      }
-      FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
-    }
-    assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
+    FLAG_SET_DEFAULT(ParGCUseLocalOverflow, true);
   }
+  assert(ParGCUseLocalOverflow || !UseCompressedOops, "Error");
 }
 
 // Adjust some sizes to suit CMS and/or ParNew needs; these work well on
@@ -1349,14 +1344,14 @@
   // then a saved space from compressed oops.
   if ((int)ObjectAlignmentInBytes > 256) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must not be greater then 256\n",
+                "error: ObjectAlignmentInBytes=%d must not be greater than 256\n",
                 (int)ObjectAlignmentInBytes);
     return false;
   }
   // In case page size is very small.
   if ((int)ObjectAlignmentInBytes >= os::vm_page_size()) {
     jio_fprintf(defaultStream::error_stream(),
-                "error: ObjectAlignmentInBytes=%d must be less then page size %d\n",
+                "error: ObjectAlignmentInBytes=%d must be less than page size %d\n",
                 (int)ObjectAlignmentInBytes, os::vm_page_size());
     return false;
   }
@@ -1477,30 +1472,34 @@
 
   // If no heap maximum was requested explicitly, use some reasonable fraction
   // of the physical memory, up to a maximum of 1GB.
-  if (UseParallelGC) {
-    FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
-
-    // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
-    // SurvivorRatio has been set, reset their default values to SurvivorRatio +
-    // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
-    // See CR 6362902 for details.
-    if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
-      if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
-         FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
-      }
-      if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
-        FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
-      }
+  FLAG_SET_DEFAULT(ParallelGCThreads,
+                   Abstract_VM_Version::parallel_worker_threads());
+  if (ParallelGCThreads == 0) {
+    jio_fprintf(defaultStream::error_stream(),
+        "The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
+    vm_exit(1);
+  }
+
+
+  // If InitialSurvivorRatio or MinSurvivorRatio were not specified, but the
+  // SurvivorRatio has been set, reset their default values to SurvivorRatio +
+  // 2.  By doing this we make SurvivorRatio also work for Parallel Scavenger.
+  // See CR 6362902 for details.
+  if (!FLAG_IS_DEFAULT(SurvivorRatio)) {
+    if (FLAG_IS_DEFAULT(InitialSurvivorRatio)) {
+       FLAG_SET_DEFAULT(InitialSurvivorRatio, SurvivorRatio + 2);
     }
-
-    if (UseParallelOldGC) {
-      // Par compact uses lower default values since they are treated as
-      // minimums.  These are different defaults because of the different
-      // interpretation and are not ergonomically set.
-      if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
-        FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
-      }
+    if (FLAG_IS_DEFAULT(MinSurvivorRatio)) {
+      FLAG_SET_DEFAULT(MinSurvivorRatio, SurvivorRatio + 2);
+    }
+  }
+
+  if (UseParallelOldGC) {
+    // Par compact uses lower default values since they are treated as
+    // minimums.  These are different defaults because of the different
+    // interpretation and are not ergonomically set.
+    if (FLAG_IS_DEFAULT(MarkSweepDeadRatio)) {
+      FLAG_SET_DEFAULT(MarkSweepDeadRatio, 1);
     }
   }
 }
@@ -1517,13 +1516,12 @@
                      Abstract_VM_Version::parallel_worker_threads());
   }
 
-  if (FLAG_IS_DEFAULT(MarkStackSize)) {
-    FLAG_SET_DEFAULT(MarkStackSize, 128 * TASKQUEUE_SIZE);
-  }
-  if (PrintGCDetails && Verbose) {
-    tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
-      MarkStackSize / K, MarkStackSizeMax / K);
-    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+  // MarkStackSize will be set (if it hasn't been set by the user)
+  // when concurrent marking is initialized.
+  // Its value will be based upon the number of parallel marking threads.
+  // But we do set the maximum mark stack size here.
+  if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
+    FLAG_SET_DEFAULT(MarkStackSizeMax, 128 * TASKQUEUE_SIZE);
   }
 
   if (FLAG_IS_DEFAULT(GCTimeRatio) || GCTimeRatio == 0) {
@@ -1535,6 +1533,12 @@
     // is allocation). We might consider increase it further.
     FLAG_SET_DEFAULT(GCTimeRatio, 9);
   }
+
+  if (PrintGCDetails && Verbose) {
+    tty->print_cr("MarkStackSize: %uk  MarkStackSizeMax: %uk",
+      MarkStackSize / K, MarkStackSizeMax / K);
+    tty->print_cr("ConcGCThreads: %u", ConcGCThreads);
+  }
 }
 
 void Arguments::set_heap_size() {
@@ -1796,6 +1800,24 @@
   return status;
 }
 
+void Arguments::check_deprecated_gcs() {
+  if (UseConcMarkSweepGC && !UseParNewGC) {
+    warning("Using the DefNew young collector with the CMS collector is deprecated "
+        "and will likely be removed in a future release");
+  }
+
+  if (UseParNewGC && !UseConcMarkSweepGC) {
+    // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
+    // set up UseSerialGC properly, so that can't be used in the check here.
+    warning("Using the ParNew young collector with the Serial old collector is deprecated "
+        "and will likely be removed in a future release");
+  }
+
+  if (CMSIncrementalMode) {
+    warning("Using incremental CMS is deprecated and will likely be removed in a future release");
+  }
+}
+
 // Check stack pages settings
 bool Arguments::check_stack_pages()
 {
@@ -1998,6 +2020,9 @@
   status = status && verify_min_value(ClassMetaspaceSize, 1*M,
                                       "ClassMetaspaceSize");
 
+  status = status && verify_interval(MarkStackSizeMax,
+                                  1, (max_jint - 1), "MarkStackSizeMax");
+
 #ifdef SPARC
   if (UseConcMarkSweepGC || UseG1GC) {
     // Issue a stern warning if the user has explicitly set
@@ -3169,11 +3194,6 @@
     FLAG_SET_DEFAULT(UseLargePages, false);
   }
 
-  // Add 2M to any size for SharedReadOnlySize to get around the JPRT setting
-  if (DumpSharedSpaces && !FLAG_IS_DEFAULT(SharedReadOnlySize)) {
-    SharedReadOnlySize = 14*M;
-  }
-
   if (DumpSharedSpaces) {
     if (RequireSharedSpaces) {
       warning("cannot dump shared archive while using shared archive");
@@ -3210,7 +3230,6 @@
   strcpy(shared_archive_path, jvm_path);
   strcat(shared_archive_path, os::file_separator());
   strcat(shared_archive_path, "classes");
-  DEBUG_ONLY(strcat(shared_archive_path, "_g");)
   strcat(shared_archive_path, ".jsa");
   SharedArchivePath = shared_archive_path;
 
@@ -3419,6 +3438,7 @@
   } else if (UseG1GC) {
     set_g1_gc_flags();
   }
+  check_deprecated_gcs();
 #endif // INCLUDE_ALTERNATE_GCS
 
 #ifdef SERIALGC
@@ -3466,6 +3486,18 @@
   if (!EliminateLocks) {
     EliminateNestedLocks = false;
   }
+  if (!Inline) {
+    IncrementalInline = false;
+  }
+#ifndef PRODUCT
+  if (!IncrementalInline) {
+    AlwaysIncrementalInline = false;
+  }
+#endif
+  if (IncrementalInline && FLAG_IS_DEFAULT(MaxNodeLimit)) {
+    // incremental inlining: bump MaxNodeLimit
+    FLAG_SET_DEFAULT(MaxNodeLimit, (intx)75000);
+  }
 #endif
 
   if (PrintAssembly && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
--- a/src/share/vm/runtime/arguments.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/arguments.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -424,6 +424,7 @@
   static jint adjust_after_os();
   // Check for consistency in the selection of the garbage collector.
   static bool check_gc_consistency();
+  static void check_deprecated_gcs();
   // Check consistecy or otherwise of VM argument settings
   static bool check_vm_args_consistency();
   // Check stack pages settings
--- a/src/share/vm/runtime/fieldDescriptor.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/fieldDescriptor.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -65,6 +65,17 @@
   return md->at(index());
 }
 
+AnnotationArray* fieldDescriptor::type_annotations() const {
+  InstanceKlass* ik = field_holder();
+  Annotations* type_annos = ik->type_annotations();
+  if (type_annos == NULL)
+    return NULL;
+  Array<AnnotationArray*>* md = type_annos->fields_annotations();
+  if (md == NULL)
+    return NULL;
+  return md->at(index());
+}
+
 constantTag fieldDescriptor::initial_value_tag() const {
   return constants()->tag_at(initial_value_index());
 }
--- a/src/share/vm/runtime/fieldDescriptor.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/fieldDescriptor.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -68,6 +68,7 @@
   Symbol* generic_signature()     const;
   int index()                     const    { return _index; }
   AnnotationArray* annotations()  const;
+  AnnotationArray* type_annotations()  const;
 
   // Initial field value
   bool has_initial_value()        const    { return field()->initval_index() != 0; }
--- a/src/share/vm/runtime/globals.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/globals.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -939,15 +939,21 @@
   develop(bool, PrintExceptionHandlers, false,                              \
           "Print exception handler tables for all nmethods when generated") \
                                                                             \
+  develop(bool, StressCompiledExceptionHandlers, false,                     \
+         "Exercise compiled exception handlers")                            \
+                                                                            \
   develop(bool, InterceptOSException, false,                                \
           "Starts debugger when an implicit OS (e.g., NULL) "               \
           "exception happens")                                              \
                                                                             \
-  notproduct(bool, PrintCodeCache, false,                                   \
-          "Print the compiled_code cache when exiting")                     \
+  product(bool, PrintCodeCache, false,                                      \
+          "Print the code cache memory usage when exiting")                 \
                                                                             \
   develop(bool, PrintCodeCache2, false,                                     \
-          "Print detailed info on the compiled_code cache when exiting")    \
+          "Print detailed usage info on the code cache when exiting")       \
+                                                                            \
+  product(bool, PrintCodeCacheOnCompilation, false,                         \
+          "Print the code cache memory usage each time a method is compiled") \
                                                                             \
   diagnostic(bool, PrintStubCode, false,                                    \
           "Print generated stub code")                                      \
@@ -983,18 +989,6 @@
   notproduct(uintx, WarnOnStalledSpinLock, 0,                               \
           "Prints warnings for stalled SpinLocks")                          \
                                                                             \
-  develop(bool, InitializeJavaLangSystem, true,                             \
-          "Initialize java.lang.System - turn off for individual "          \
-          "method debugging")                                               \
-                                                                            \
-  develop(bool, InitializeJavaLangString, true,                             \
-          "Initialize java.lang.String - turn off for individual "          \
-          "method debugging")                                               \
-                                                                            \
-  develop(bool, InitializeJavaLangExceptionsErrors, true,                   \
-          "Initialize various error and exception classes - turn off for "  \
-          "individual method debugging")                                    \
-                                                                            \
   product(bool, RegisterFinalizersAtInit, true,                             \
           "Register finalizable objects at end of Object.<init> or "        \
           "after allocation")                                               \
@@ -1089,7 +1083,7 @@
                                                                             \
   product(intx, ClearFPUAtPark, 0, "(Unsafe,Unstable)" )                    \
                                                                             \
-  product(intx, hashCode, 0,                                                \
+  product(intx, hashCode, 5,                                                \
          "(Unstable) select hashCode generation algorithm" )                \
                                                                             \
   product(intx, WorkAroundNPTLTimedWaitHang, 1,                             \
@@ -1115,13 +1109,6 @@
   product(bool, ReduceSignalUsage, false,                                   \
           "Reduce the use of OS signals in Java and/or the VM")             \
                                                                             \
-  notproduct(bool, ValidateMarkSweep, false,                                \
-          "Do extra validation during MarkSweep collection")                \
-                                                                            \
-  notproduct(bool, RecordMarkSweepCompaction, false,                        \
-          "Enable GC-to-GC recording and querying of compaction during "    \
-          "MarkSweep")                                                      \
-                                                                            \
   develop_pd(bool, ShareVtableStubs,                                        \
           "Share vtable stubs (smaller code but worse branch prediction")   \
                                                                             \
@@ -1187,6 +1174,18 @@
   notproduct(bool, PrintCompactFieldsSavings, false,                        \
           "Print how many words were saved with CompactFields")             \
                                                                             \
+  notproduct(bool, PrintFieldLayout, false,                                 \
+          "Print field layout for each class")                              \
+                                                                            \
+  product(intx, ContendedPaddingWidth, 128,                                 \
+          "How many bytes to pad the fields/classes marked @Contended with")\
+                                                                            \
+  product(bool, EnableContended, true,                                      \
+          "Enable @Contended annotation support")                           \
+                                                                            \
+  product(bool, RestrictContended, true,                                    \
+          "Restrict @Contended to trusted classes")                         \
+                                                                            \
   product(bool, UseBiasedLocking, true,                                     \
           "Enable biased locking in JVM")                                   \
                                                                             \
@@ -1623,7 +1622,7 @@
   develop(bool, CMSTraceThreadState, false,                                 \
           "Trace the CMS thread state (enable the trace_state() method)")   \
                                                                             \
-  product(bool, CMSClassUnloadingEnabled, false,                            \
+  product(bool, CMSClassUnloadingEnabled, true,                             \
           "Whether class unloading enabled when using CMS GC")              \
                                                                             \
   product(uintx, CMSClassUnloadingMaxInterval, 0,                           \
@@ -1847,7 +1846,7 @@
                                                                             \
   product(intx, CMSIsTooFullPercentage, 98,                                 \
           "An absolute ceiling above which CMS will always consider the "   \
-          "perm gen ripe for collection")                                   \
+          "unloading of classes when class unloading is enabled")           \
                                                                             \
   develop(bool, CMSTestInFreeList, false,                                   \
           "Check if the coalesced range is already in the "                 \
@@ -1916,13 +1915,13 @@
           "Metadata deallocation alot interval")                            \
                                                                             \
   develop(bool, TraceMetadataChunkAllocation, false,                        \
-          "Trace humongous metadata allocations")                           \
+          "Trace chunk metadata allocations")                               \
                                                                             \
   product(bool, TraceMetadataHumongousAllocation, false,                    \
           "Trace humongous metadata allocations")                           \
                                                                             \
   develop(bool, TraceMetavirtualspaceAllocation, false,                     \
-          "Trace humongous metadata allocations")                           \
+          "Trace virtual space metadata allocations")                       \
                                                                             \
   notproduct(bool, ExecuteInternalVMTests, false,                           \
           "Enable execution of internal VM tests.")                         \
@@ -2234,7 +2233,8 @@
   develop(bool, TraceClassLoaderData, false,                                \
           "Trace class loader loader_data lifetime")                        \
                                                                             \
-  product(uintx, InitialBootClassLoaderMetaspaceSize, 3*M,                  \
+  product(uintx, InitialBootClassLoaderMetaspaceSize,                       \
+          NOT_LP64(2200*K) LP64_ONLY(4*M),                                  \
           "Initial size of the boot class loader data metaspace")           \
                                                                             \
   product(bool, TraceGen0Time, false,                                       \
@@ -3560,10 +3560,10 @@
   /* Shared spaces */                                                       \
                                                                             \
   product(bool, UseSharedSpaces, true,                                      \
-          "Use shared spaces in the permanent generation")                  \
+          "Use shared spaces for metadata")                                 \
                                                                             \
   product(bool, RequireSharedSpaces, false,                                 \
-          "Require shared spaces in the permanent generation")              \
+          "Require shared spaces for metadata")                             \
                                                                             \
   product(bool, DumpSharedSpaces, false,                                    \
            "Special mode: JVM reads a class list, loads classes, builds "   \
@@ -3574,16 +3574,16 @@
           "Print usage of shared spaces")                                   \
                                                                             \
   product(uintx, SharedReadWriteSize,  NOT_LP64(12*M) LP64_ONLY(16*M),      \
-          "Size of read-write space in permanent generation (in bytes)")    \
+          "Size of read-write space for metadata (in bytes)")               \
                                                                             \
   product(uintx, SharedReadOnlySize,  NOT_LP64(12*M) LP64_ONLY(16*M),       \
-          "Size of read-only space in permanent generation (in bytes)")     \
+          "Size of read-only space for metadata (in bytes)")                \
                                                                             \
   product(uintx, SharedMiscDataSize,    NOT_LP64(2*M) LP64_ONLY(4*M),       \
-          "Size of the shared data area adjacent to the heap (in bytes)")   \
+          "Size of the shared miscellaneous data area (in bytes)")          \
                                                                             \
   product(uintx, SharedMiscCodeSize,    120*K,                              \
-          "Size of the shared code area adjacent to the heap (in bytes)")   \
+          "Size of the shared miscellaneous code area (in bytes)")          \
                                                                             \
   product(uintx, SharedDummyBlockSize, 0,                                   \
           "Size of dummy block used to shift heap addresses (in bytes)")    \
--- a/src/share/vm/runtime/handles.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/handles.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -80,6 +80,8 @@
       _thread = Thread::current();                                     \
     }                                                                  \
     _thread->metadata_handles()->push((Metadata*)_value);              \
+  } else {                                                             \
+    _thread = NULL;                                                    \
   }                                                                    \
 }                                                                      \
 inline name##Handle& name##Handle::operator=(const name##Handle &s) {  \
@@ -94,6 +96,8 @@
       _thread = Thread::current();                                     \
     }                                                                  \
     _thread->metadata_handles()->push((Metadata*)_value);              \
+  } else {                                                             \
+    _thread = NULL;                                                    \
   }                                                                    \
   return *this;                                                        \
 }                                                                      \
--- a/src/share/vm/runtime/java.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/java.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -374,9 +374,12 @@
   if (CITime) {
     CompileBroker::print_times();
   }
-  if(PrintNMethodStatistics) {
-    nmethod::print_statistics();
+
+  if (PrintCodeCache) {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeCache::print();
   }
+
 #ifdef COMPILER2
   if (PrintPreciseBiasedLockingStatistics) {
     OptoRuntime::print_named_counters();
@@ -555,6 +558,10 @@
     BeforeExit_lock->notify_all();
   }
 
+  // Shutdown NMT before exit. Otherwise,
+  // it will run into trouble when system destroys static variables.
+  MemTracker::shutdown(MemTracker::NMT_normal);
+
   #undef BEFORE_EXIT_NOT_RUN
   #undef BEFORE_EXIT_RUNNING
   #undef BEFORE_EXIT_DONE
--- a/src/share/vm/runtime/objectMonitor.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/objectMonitor.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -653,8 +653,7 @@
     assert (_succ != Self, "invariant") ;
     if (_Responsible == Self) {
         _Responsible = NULL ;
-        // Dekker pivot-point.
-        // Consider OrderAccess::storeload() here
+        OrderAccess::fence(); // Dekker pivot-point
 
         // We may leave threads on cxq|EntryList without a designated
         // "Responsible" thread.  This is benign.  When this thread subsequently
@@ -674,10 +673,6 @@
         //
         // The MEMBAR, above, prevents the LD of cxq|EntryList in the subsequent
         // exit operation from floating above the ST Responsible=null.
-        //
-        // In *practice* however, EnterI() is always followed by some atomic
-        // operation such as the decrement of _count in ::enter().  Those atomics
-        // obviate the need for the explicit MEMBAR, above.
     }
 
     // We've acquired ownership with CAS().
--- a/src/share/vm/runtime/objectMonitor.inline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/objectMonitor.inline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -101,10 +101,12 @@
   return _count;
 }
 
+// Do NOT set _count = 0. There is a race such that _count could
+// be set while inflating prior to setting _owner
+// Just use Atomic::inc/dec and assert 0 when monitor put on free list
 inline void ObjectMonitor::set_owner(void* owner) {
   _owner = owner;
   _recursions = 0;
-  _count = 0;
 }
 
 
--- a/src/share/vm/runtime/os.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/os.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -255,6 +255,7 @@
   static int    vm_allocation_granularity();
   static char*  reserve_memory(size_t bytes, char* addr = 0,
                                size_t alignment_hint = 0);
+  static char*  reserve_memory_aligned(size_t size, size_t alignment);
   static char*  attempt_reserve_memory_at(size_t bytes, char* addr);
   static void   split_reserved_memory(char *base, size_t size,
                                       size_t split, bool realloc);
@@ -640,10 +641,6 @@
 
   static struct hostent* get_host_by_name(char* name);
 
-  // Printing 64 bit integers
-  static const char* jlong_format_specifier();
-  static const char* julong_format_specifier();
-
   // Support for signals (see JVM_RaiseSignal, JVM_RegisterSignal)
   static void  signal_init();
   static void  signal_init_pd();
--- a/src/share/vm/runtime/os_ext.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/os_ext.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/src/share/vm/runtime/perfData.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/perfData.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -192,7 +192,7 @@
 }
 
 int PerfLong::format(char* buffer, int length) {
-  return jio_snprintf(buffer, length,"%lld", *(jlong*)_valuep);
+  return jio_snprintf(buffer, length, JLONG_FORMAT, *(jlong*)_valuep);
 }
 
 PerfLongVariant::PerfLongVariant(CounterNS ns, const char* namep, Units u,
--- a/src/share/vm/runtime/reflection.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/reflection.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -771,6 +771,10 @@
     typeArrayOop an_oop = Annotations::make_java_array(method->annotation_default(), CHECK_NULL);
     java_lang_reflect_Method::set_annotation_default(mh(), an_oop);
   }
+  if (java_lang_reflect_Method::has_type_annotations_field()) {
+    typeArrayOop an_oop = Annotations::make_java_array(method->type_annotations(), CHECK_NULL);
+    java_lang_reflect_Method::set_type_annotations(mh(), an_oop);
+  }
   return mh();
 }
 
@@ -849,6 +853,29 @@
     typeArrayOop an_oop = Annotations::make_java_array(fd->annotations(), CHECK_NULL);
     java_lang_reflect_Field::set_annotations(rh(), an_oop);
   }
+  if (java_lang_reflect_Field::has_type_annotations_field()) {
+    typeArrayOop an_oop = Annotations::make_java_array(fd->type_annotations(), CHECK_NULL);
+    java_lang_reflect_Field::set_type_annotations(rh(), an_oop);
+  }
+  return rh();
+}
+
+oop Reflection::new_parameter(Handle method, int index, Symbol* sym,
+                              int flags, TRAPS) {
+  Handle name;
+
+  // A null symbol here translates to the empty string
+  if(NULL != sym) {
+    name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
+  } else {
+    name = java_lang_String::create_from_str("", CHECK_NULL);
+  }
+
+  Handle rh = java_lang_reflect_Parameter::create(CHECK_NULL);
+  java_lang_reflect_Parameter::set_name(rh(), name());
+  java_lang_reflect_Parameter::set_modifiers(rh(), flags);
+  java_lang_reflect_Parameter::set_executable(rh(), method());
+  java_lang_reflect_Parameter::set_index(rh(), index);
   return rh();
 }
 
--- a/src/share/vm/runtime/reflection.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/reflection.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -118,6 +118,10 @@
   static oop new_constructor(methodHandle method, TRAPS);
   // Create a java.lang.reflect.Field object based on a field descriptor
   static oop new_field(fieldDescriptor* fd, bool intern_name, TRAPS);
+  // Create a java.lang.reflect.Parameter object based on a
+  // MethodParameterElement
+  static oop new_parameter(Handle method, int index, Symbol* sym,
+                           int flags, TRAPS);
 
 private:
   // method resolution for invoke
--- a/src/share/vm/runtime/sharedRuntime.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -664,7 +664,8 @@
       bool skip_scope_increment = false;
       // exception handler lookup
       KlassHandle ek (THREAD, exception->klass());
-      handler_bci = sd->method()->fast_exception_handler_bci_for(ek, bci, THREAD);
+      methodHandle mh(THREAD, sd->method());
+      handler_bci = Method::fast_exception_handler_bci_for(mh, ek, bci, THREAD);
       if (HAS_PENDING_EXCEPTION) {
         recursive_exception = true;
         // We threw an exception while trying to find the exception handler.
--- a/src/share/vm/runtime/synchronizer.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/synchronizer.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -333,7 +333,9 @@
 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
   TEVENT (jni_exit) ;
   if (UseBiasedLocking) {
-    BiasedLocking::revoke_and_rebias(obj, false, THREAD);
+    Handle h_obj(THREAD, obj);
+    BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
+    obj = h_obj();
   }
   assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
 
--- a/src/share/vm/runtime/thread.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/thread.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1730,7 +1730,6 @@
 // cleanup_failed_attach_current_thread as well.
 void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
   assert(this == JavaThread::current(),  "thread consistency check");
-  if (!InitializeJavaLangSystem) return;
 
   HandleMark hm(this);
   Handle uncaught_exception(this, this->pending_exception());
@@ -2206,7 +2205,7 @@
           // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
           RegisterMap reg_map(this, UseBiasedLocking);
           frame compiled_frame = f.sender(&reg_map);
-          if (compiled_frame.can_be_deoptimized()) {
+          if (!StressCompiledExceptionHandlers && compiled_frame.can_be_deoptimized()) {
             Deoptimization::deoptimize(this, compiled_frame, &reg_map, Deoptimization::Reason_constraint);
           }
         }
@@ -3482,11 +3481,7 @@
       create_vm_init_libraries();
     }
 
-    if (InitializeJavaLangString) {
-      initialize_class(vmSymbols::java_lang_String(), CHECK_0);
-    } else {
-      warning("java.lang.String not initialized");
-    }
+    initialize_class(vmSymbols::java_lang_String(), CHECK_0);
 
     if (AggressiveOpts) {
       {
@@ -3527,52 +3522,39 @@
     }
 
     // Initialize java_lang.System (needed before creating the thread)
-    if (InitializeJavaLangSystem) {
-      initialize_class(vmSymbols::java_lang_System(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);
-      Handle thread_group = create_initial_thread_group(CHECK_0);
-      Universe::set_main_thread_group(thread_group());
-      initialize_class(vmSymbols::java_lang_Thread(), CHECK_0);
-      oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0);
-      main_thread->set_threadObj(thread_object);
-      // Set thread status to running since main thread has
-      // been started and running.
-      java_lang_Thread::set_thread_status(thread_object,
-                                          java_lang_Thread::RUNNABLE);
-
-      // The VM preresolve methods to these classes. Make sure that get initialized
-      initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_ref_Finalizer(),  CHECK_0);
-      // The VM creates & returns objects of this class. Make sure it's initialized.
-      initialize_class(vmSymbols::java_lang_Class(), CHECK_0);
-      call_initializeSystemClass(CHECK_0);
-
-      // get the Java runtime name after java.lang.System is initialized
-      JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
-      JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
-    } else {
-      warning("java.lang.System not initialized");
-    }
+    initialize_class(vmSymbols::java_lang_System(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);
+    Handle thread_group = create_initial_thread_group(CHECK_0);
+    Universe::set_main_thread_group(thread_group());
+    initialize_class(vmSymbols::java_lang_Thread(), CHECK_0);
+    oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0);
+    main_thread->set_threadObj(thread_object);
+    // Set thread status to running since main thread has
+    // been started and running.
+    java_lang_Thread::set_thread_status(thread_object,
+                                        java_lang_Thread::RUNNABLE);
+
+    // The VM creates & returns objects of this class. Make sure it's initialized.
+    initialize_class(vmSymbols::java_lang_Class(), CHECK_0);
+
+    // The VM preresolves methods to these classes. Make sure that they get initialized
+    initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_ref_Finalizer(),  CHECK_0);
+    call_initializeSystemClass(CHECK_0);
+
+    // get the Java runtime name after java.lang.System is initialized
+    JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
+    JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
 
     // an instance of OutOfMemory exception has been allocated earlier
-    if (InitializeJavaLangExceptionsErrors) {
-      initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0);
-      initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0);
-    } else {
-      warning("java.lang.OutOfMemoryError has not been initialized");
-      warning("java.lang.NullPointerException has not been initialized");
-      warning("java.lang.ClassCastException has not been initialized");
-      warning("java.lang.ArrayStoreException has not been initialized");
-      warning("java.lang.ArithmeticException has not been initialized");
-      warning("java.lang.StackOverflowError has not been initialized");
-      warning("java.lang.IllegalArgumentException has not been initialized");
-    }
+    initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0);
+    initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0);
   }
 
   // See        : bugid 4211085.
@@ -4023,10 +4005,6 @@
                          Mutex::_as_suspend_equivalent_flag);
   }
 
-  // Shutdown NMT before exit. Otherwise,
-  // it will run into trouble when system destroys static variables.
-  MemTracker::shutdown(MemTracker::NMT_normal);
-
   // Hang forever on exit if we are reporting an error.
   if (ShowMessageBoxOnError && is_error_reported()) {
     os::infinite_sleep();
--- a/src/share/vm/runtime/virtualspace.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/virtualspace.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -329,20 +329,9 @@
     if ((((size_t)base + noaccess_prefix) & (alignment - 1)) != 0) {
       // Base not aligned, retry
       if (!os::release_memory(base, size)) fatal("os::release_memory failed");
-      // Reserve size large enough to do manual alignment and
-      // increase size to a multiple of the desired alignment
+      // Make sure that size is aligned
       size = align_size_up(size, alignment);
-      size_t extra_size = size + alignment;
-      do {
-        char* extra_base = os::reserve_memory(extra_size, NULL, alignment);
-        if (extra_base == NULL) return;
-        // Do manual alignement
-        base = (char*) align_size_up((uintptr_t) extra_base, alignment);
-        assert(base >= extra_base, "just checking");
-        // Re-reserve the region at the aligned base address.
-        os::release_memory(extra_base, extra_size);
-        base = os::reserve_memory(size, base);
-      } while (base == NULL);
+      base = os::reserve_memory_aligned(size, alignment);
 
       if (requested_address != 0 &&
           failed_to_reserve_as_requested(base, requested_address, size, false)) {
@@ -879,8 +868,8 @@
   tty->print   ("Virtual space:");
   if (special()) tty->print(" (pinned in memory)");
   tty->cr();
-  tty->print_cr(" - committed: %ld", committed_size());
-  tty->print_cr(" - reserved:  %ld", reserved_size());
+  tty->print_cr(" - committed: " SIZE_FORMAT, committed_size());
+  tty->print_cr(" - reserved:  " SIZE_FORMAT, reserved_size());
   tty->print_cr(" - [low, high]:     [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low(), high());
   tty->print_cr(" - [low_b, high_b]: [" INTPTR_FORMAT ", " INTPTR_FORMAT "]",  low_boundary(), high_boundary());
 }
--- a/src/share/vm/runtime/vmStructs.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/vmStructs.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -257,8 +257,7 @@
                    c1_nonstatic_field, \
                    c2_nonstatic_field, \
                    unchecked_c1_static_field, \
-                   unchecked_c2_static_field, \
-                   last_entry) \
+                   unchecked_c2_static_field) \
                                                                                                                                      \
   /******************************************************************/                                                               \
   /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */                                                               \
@@ -355,8 +354,6 @@
   nonstatic_field(Method,               _access_flags,                                 AccessFlags)                           \
   nonstatic_field(Method,               _vtable_index,                                 int)                                   \
   nonstatic_field(Method,               _method_size,                                  u2)                                    \
-  nonstatic_field(Method,               _max_locals,                                   u2)                                    \
-  nonstatic_field(Method,               _size_of_parameters,                           u2)                                    \
   nonstatic_field(Method,               _interpreter_throwout_count,                   u2)                                    \
   nonstatic_field(Method,               _number_of_breakpoints,                        u2)                                    \
   nonstatic_field(Method,               _invocation_counter,                           InvocationCounter)                     \
@@ -378,6 +375,8 @@
   nonstatic_field(ConstMethod,          _signature_index,                              u2)                                    \
   nonstatic_field(ConstMethod,          _method_idnum,                                 u2)                                    \
   nonstatic_field(ConstMethod,          _max_stack,                                    u2)                                    \
+  nonstatic_field(ConstMethod,          _max_locals,                                   u2)                                    \
+  nonstatic_field(ConstMethod,          _size_of_parameters,                           u2)                                    \
   nonstatic_field(ObjArrayKlass,               _element_klass,                                Klass*)                                \
   nonstatic_field(ObjArrayKlass,               _bottom_klass,                                 Klass*)                                \
   volatile_nonstatic_field(Symbol,             _refcount,                                     int)                                   \
@@ -718,7 +717,6 @@
   nonstatic_field(ClassLoaderData,             _next,                                         ClassLoaderData*)                      \
                                                                                                                                      \
   static_field(ClassLoaderDataGraph,           _head,                                         ClassLoaderData*)                      \
-  nonstatic_field(ClassLoaderDataGraph,        _unloading,                                    ClassLoaderData*)                      \
                                                                                                                                      \
   /*******************/                                                                                                              \
   /* GrowableArrays  */                                                                                                              \
@@ -1200,7 +1198,6 @@
   /*********************************/                                                                                                \
                                                                                                                                      \
   static_field(java_lang_Class,                _klass_offset,                                 int)                                   \
-  static_field(java_lang_Class,                _resolved_constructor_offset,                  int)                                   \
   static_field(java_lang_Class,                _array_klass_offset,                           int)                                   \
   static_field(java_lang_Class,                _oop_size_offset,                              int)                                   \
   static_field(java_lang_Class,                _static_oop_field_count_offset,                int)                                   \
@@ -1238,9 +1235,6 @@
   nonstatic_field(FreeList<Metablock>,         _count,                                       ssize_t)                                \
   nonstatic_field(MetablockTreeDictionary,     _total_size,                                  size_t)
 
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must  */
-  /* be present there)                                                */
 
 //--------------------------------------------------------------------------------
 // VM_TYPES
@@ -1280,8 +1274,7 @@
                  declare_unsigned_integer_type,                           \
                  declare_c1_toplevel_type,                                \
                  declare_c2_type,                                         \
-                 declare_c2_toplevel_type,                                \
-                 last_entry)                                              \
+                 declare_c2_toplevel_type)                                \
                                                                           \
   /*************************************************************/         \
   /* Java primitive types -- required by the SA implementation */         \
@@ -2098,10 +2091,6 @@
            declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)
 
 
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must be */
-  /* present there)                                                   */
-
 //--------------------------------------------------------------------------------
 // VM_INT_CONSTANTS
 //
@@ -2114,8 +2103,7 @@
                          declare_preprocessor_constant,                   \
                          declare_c1_constant,                             \
                          declare_c2_constant,                             \
-                         declare_c2_preprocessor_constant,                \
-                         last_entry)                                      \
+                         declare_c2_preprocessor_constant)                \
                                                                           \
   /******************/                                                    \
   /* Useful globals */                                                    \
@@ -2294,10 +2282,18 @@
   declare_constant(FieldInfo::name_index_offset)                          \
   declare_constant(FieldInfo::signature_index_offset)                     \
   declare_constant(FieldInfo::initval_index_offset)                       \
-  declare_constant(FieldInfo::low_offset)                                 \
-  declare_constant(FieldInfo::high_offset)                                \
+  declare_constant(FieldInfo::low_packed_offset)                          \
+  declare_constant(FieldInfo::high_packed_offset)                         \
   declare_constant(FieldInfo::field_slots)                                \
                                                                           \
+  /*************************************/                                 \
+  /* FieldInfo tag constants           */                                 \
+  /*************************************/                                 \
+                                                                          \
+  declare_preprocessor_constant("FIELDINFO_TAG_SIZE", FIELDINFO_TAG_SIZE) \
+  declare_preprocessor_constant("FIELDINFO_TAG_MASK", FIELDINFO_TAG_MASK) \
+  declare_preprocessor_constant("FIELDINFO_TAG_OFFSET", FIELDINFO_TAG_OFFSET) \
+                                                                          \
   /************************************************/                      \
   /* InstanceKlass InnerClassAttributeOffset enum */                      \
   /************************************************/                      \
@@ -2489,9 +2485,6 @@
   declare_c2_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT) \
   declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT)
 
-  /* NOTE that we do not use the last_entry() macro here; it is used  */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and */
-  /* must be present there)                                           */
 
 //--------------------------------------------------------------------------------
 // VM_LONG_CONSTANTS
@@ -2501,7 +2494,7 @@
 // enums, etc., while "declare_preprocessor_constant" must be used for
 // all #defined constants.
 
-#define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
+#define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
                                                                           \
   /*********************/                                                 \
   /* MarkOop constants */                                                 \
@@ -2547,11 +2540,7 @@
   /* Constants in markOop used by CMS. */                                 \
   declare_constant(markOopDesc::cms_shift)                                \
   declare_constant(markOopDesc::cms_mask)                                 \
-  declare_constant(markOopDesc::size_shift)                               \
-
-  /* NOTE that we do not use the last_entry() macro here; it is used   */
-  /* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and */
-  /* must be present there)                                            */
+  declare_constant(markOopDesc::size_shift)
 
 
 //--------------------------------------------------------------------------------
@@ -2591,7 +2580,8 @@
 
 // This macro checks the type of a VMStructEntry by comparing pointer types
 #define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)                 \
- {typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName; }
+ {typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName;                   \
+  assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
 
 // This macro checks the type of a volatile VMStructEntry by comparing pointer types
 #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type)        \
@@ -2614,9 +2604,6 @@
 // This is a no-op macro for unchecked fields
 #define CHECK_NO_OP(a, b, c)
 
-// This is a no-op macro for the sentinel value
-#define CHECK_SENTINEL()
-
 //
 // Build-specific macros:
 //
@@ -2795,48 +2782,47 @@
 // as long as class VMStructs is a friend
 VMStructEntry VMStructs::localHotSpotVMStructs[] = {
 
-  VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_STATIC_VM_STRUCT_ENTRY, \
-             GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \
-             GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-             GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-             GENERATE_VM_STRUCT_LAST_ENTRY)
+  VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_STATIC_VM_STRUCT_ENTRY,
+             GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
+             GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
+             GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
 
 #ifndef SERIALGC
-  VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
+  VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                         GENERATE_STATIC_VM_STRUCT_ENTRY)
 
-  VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
+  VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                  GENERATE_STATIC_VM_STRUCT_ENTRY)
 
-  VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
+  VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
                 GENERATE_STATIC_VM_STRUCT_ENTRY)
 #endif // SERIALGC
 
-  VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_STATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-                 GENERATE_VM_STRUCT_LAST_ENTRY)
+  VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_STATIC_VM_STRUCT_ENTRY,
+                 GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
+                 GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
+                 GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
 
-  VM_STRUCTS_OS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_STATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
-                    GENERATE_VM_STRUCT_LAST_ENTRY)
+  VM_STRUCTS_OS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                    GENERATE_STATIC_VM_STRUCT_ENTRY,
+                    GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
+                    GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
+                    GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
+                    GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
+                    GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
+                    GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
+
+  GENERATE_VM_STRUCT_LAST_ENTRY()
 };
 
 VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
@@ -2848,8 +2834,7 @@
            GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
            GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
            GENERATE_C2_VM_TYPE_ENTRY,
-           GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY,
-           GENERATE_VM_TYPE_LAST_ENTRY)
+           GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
 
 #ifndef SERIALGC
   VM_TYPES_PARALLELGC(GENERATE_VM_TYPE_ENTRY,
@@ -2871,8 +2856,7 @@
                GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
                GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
                GENERATE_C2_VM_TYPE_ENTRY,
-               GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY,
-               GENERATE_VM_TYPE_LAST_ENTRY)
+               GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
 
   VM_TYPES_OS_CPU(GENERATE_VM_TYPE_ENTRY,
                   GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
@@ -2881,8 +2865,9 @@
                   GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
                   GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
                   GENERATE_C2_VM_TYPE_ENTRY,
-                  GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY,
-                  GENERATE_VM_TYPE_LAST_ENTRY)
+                  GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
+
+  GENERATE_VM_TYPE_LAST_ENTRY()
 };
 
 VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
@@ -2891,8 +2876,7 @@
                    GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
                    GENERATE_C1_VM_INT_CONSTANT_ENTRY,
                    GENERATE_C2_VM_INT_CONSTANT_ENTRY,
-                   GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
-                   GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
+                   GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 
 #ifndef SERIALGC
   VM_INT_CONSTANTS_CMS(GENERATE_VM_INT_CONSTANT_ENTRY)
@@ -2904,15 +2888,15 @@
                        GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
                        GENERATE_C1_VM_INT_CONSTANT_ENTRY,
                        GENERATE_C2_VM_INT_CONSTANT_ENTRY,
-                       GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
-                       GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
+                       GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
 
   VM_INT_CONSTANTS_OS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY,
                           GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
                           GENERATE_C1_VM_INT_CONSTANT_ENTRY,
                           GENERATE_C2_VM_INT_CONSTANT_ENTRY,
-                          GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
-                          GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
+                          GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
+
+  GENERATE_VM_INT_CONSTANT_LAST_ENTRY()
 };
 
 VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = {
@@ -2921,22 +2905,21 @@
                     GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
                     GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
                     GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
-                    GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
-                    GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
+                    GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
 
   VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
                         GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
                         GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
                         GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
-                        GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
-                        GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
+                        GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
 
   VM_LONG_CONSTANTS_OS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
                            GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
                            GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
                            GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
-                           GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
-                           GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
+                           GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
+
+  GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
 };
 
 // This is used both to check the types of referenced fields and, in
@@ -2951,8 +2934,7 @@
              CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
              CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
              CHECK_NO_OP,
-             CHECK_NO_OP,
-             CHECK_SENTINEL);
+             CHECK_NO_OP);
 
 #ifndef SERIALGC
   VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
@@ -2973,8 +2955,7 @@
                  CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
                  CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
                  CHECK_NO_OP,
-                 CHECK_NO_OP,
-                 CHECK_SENTINEL);
+                 CHECK_NO_OP);
 
   VM_STRUCTS_OS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
                     CHECK_STATIC_VM_STRUCT_ENTRY,
@@ -2983,8 +2964,7 @@
                     CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
                     CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
                     CHECK_NO_OP,
-                    CHECK_NO_OP,
-                    CHECK_SENTINEL);
+                    CHECK_NO_OP);
 
   VM_TYPES(CHECK_VM_TYPE_ENTRY,
            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
@@ -2993,8 +2973,7 @@
            CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
            CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
            CHECK_C2_VM_TYPE_ENTRY,
-           CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY,
-           CHECK_SENTINEL);
+           CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
 
 #ifndef SERIALGC
   VM_TYPES_PARALLELGC(CHECK_VM_TYPE_ENTRY,
@@ -3016,8 +2995,7 @@
                CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
                CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
                CHECK_C2_VM_TYPE_ENTRY,
-               CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY,
-               CHECK_SENTINEL);
+               CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
 
   VM_TYPES_OS_CPU(CHECK_VM_TYPE_ENTRY,
                   CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
@@ -3026,8 +3004,7 @@
                   CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
                   CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
                   CHECK_C2_VM_TYPE_ENTRY,
-                  CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY,
-                  CHECK_SENTINEL);
+                  CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
 
   //
   // Split VM_STRUCTS() invocation into two parts to allow MS VC++ 6.0
@@ -3046,53 +3023,49 @@
   // Solstice NFS setup. If everyone switches to local workspaces on
   // Win32, we can put this back in.
 #ifndef _WINDOWS
-  debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_SENTINEL));
-  debug_only(VM_STRUCTS(CHECK_NO_OP, \
-                        ENSURE_FIELD_TYPE_PRESENT, \
-                        CHECK_NO_OP, \
-                        ENSURE_FIELD_TYPE_PRESENT, \
-                        ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \
-                        ENSURE_C1_FIELD_TYPE_PRESENT, \
-                        ENSURE_C2_FIELD_TYPE_PRESENT, \
-                        CHECK_NO_OP, \
-                        CHECK_NO_OP, \
-                        CHECK_SENTINEL));
+  debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP));
+  debug_only(VM_STRUCTS(CHECK_NO_OP,
+                        ENSURE_FIELD_TYPE_PRESENT,
+                        CHECK_NO_OP,
+                        ENSURE_FIELD_TYPE_PRESENT,
+                        ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
+                        ENSURE_C1_FIELD_TYPE_PRESENT,
+                        ENSURE_C2_FIELD_TYPE_PRESENT,
+                        CHECK_NO_OP,
+                        CHECK_NO_OP));
 #ifndef SERIALGC
-  debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT, \
+  debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT,
                                    ENSURE_FIELD_TYPE_PRESENT));
-  debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT, \
-                            ENSURE_FIELD_TYPE_PRESENT, \
+  debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT,
+                            ENSURE_FIELD_TYPE_PRESENT,
                             ENSURE_FIELD_TYPE_PRESENT));
-  debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT, \
+  debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT,
                            ENSURE_FIELD_TYPE_PRESENT));
 #endif // SERIALGC
-  debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT, \
-                            ENSURE_FIELD_TYPE_PRESENT, \
-                            CHECK_NO_OP, \
-                            ENSURE_FIELD_TYPE_PRESENT, \
-                            ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \
-                            ENSURE_C2_FIELD_TYPE_PRESENT, \
-                            CHECK_NO_OP, \
-                            CHECK_NO_OP, \
-                            CHECK_SENTINEL));
-  debug_only(VM_STRUCTS_OS_CPU(ENSURE_FIELD_TYPE_PRESENT, \
-                               ENSURE_FIELD_TYPE_PRESENT, \
-                               CHECK_NO_OP, \
-                               ENSURE_FIELD_TYPE_PRESENT, \
-                               ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \
-                               ENSURE_C2_FIELD_TYPE_PRESENT, \
-                               CHECK_NO_OP, \
-                               CHECK_NO_OP, \
-                               CHECK_SENTINEL));
+  debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT,
+                            ENSURE_FIELD_TYPE_PRESENT,
+                            CHECK_NO_OP,
+                            ENSURE_FIELD_TYPE_PRESENT,
+                            ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
+                            ENSURE_C2_FIELD_TYPE_PRESENT,
+                            CHECK_NO_OP,
+                            CHECK_NO_OP));
+  debug_only(VM_STRUCTS_OS_CPU(ENSURE_FIELD_TYPE_PRESENT,
+                               ENSURE_FIELD_TYPE_PRESENT,
+                               CHECK_NO_OP,
+                               ENSURE_FIELD_TYPE_PRESENT,
+                               ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
+                               ENSURE_C2_FIELD_TYPE_PRESENT,
+                               CHECK_NO_OP,
+                               CHECK_NO_OP));
 #endif
 }
 
@@ -3152,10 +3125,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3171,10 +3144,10 @@
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      delete s;
+      delete [] s;
       return 1;
     }
-    delete s;
+    delete [] s;
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
@@ -3188,8 +3161,10 @@
     s[len - 6] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
+      free(s);
       return 1;
     }
+    free(s);
   }
   if (!isRecurse) {
     tty->print_cr("type \"%s\" not found", typeName);
@@ -3212,6 +3187,30 @@
 
 #ifndef PRODUCT
 void VMStructs::test() {
+  // Make sure last entry in the each array is indeed the correct end marker.
+  // The reason why these are static is to make sure they are zero initialized.
+  // Putting them on the stack will leave some garbage in the padding of some fields.
+  static VMStructEntry struct_last_entry = GENERATE_VM_STRUCT_LAST_ENTRY();
+  assert(memcmp(&localHotSpotVMStructs[(sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry)) - 1],
+                &struct_last_entry,
+                sizeof(VMStructEntry)) == 0, "Incorrect last entry in localHotSpotVMStructs");
+
+  static VMTypeEntry type_last_entry = GENERATE_VM_TYPE_LAST_ENTRY();
+  assert(memcmp(&localHotSpotVMTypes[sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry) - 1],
+                &type_last_entry,
+                sizeof(VMTypeEntry)) == 0, "Incorrect last entry in localHotSpotVMTypes");
+
+  static VMIntConstantEntry int_last_entry = GENERATE_VM_INT_CONSTANT_LAST_ENTRY();
+  assert(memcmp(&localHotSpotVMIntConstants[sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry) - 1],
+                &int_last_entry,
+                sizeof(VMIntConstantEntry)) == 0, "Incorrect last entry in localHotSpotVMIntConstants");
+
+  static VMLongConstantEntry long_last_entry = GENERATE_VM_LONG_CONSTANT_LAST_ENTRY();
+  assert(memcmp(&localHotSpotVMLongConstants[sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry) - 1],
+                &long_last_entry,
+                sizeof(VMLongConstantEntry)) == 0, "Incorrect last entry in localHotSpotVMLongConstants");
+
+
   // Check for duplicate entries in type array
   for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) {
     for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) {
--- a/src/share/vm/runtime/vmThread.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/runtime/vmThread.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -570,7 +570,11 @@
   if (!t->is_VM_thread()) {
     SkipGCALot sgcalot(t);    // avoid re-entrant attempts to gc-a-lot
     // JavaThread or WatcherThread
-    t->check_for_valid_safepoint_state(true);
+    bool concurrent = op->evaluate_concurrently();
+    // only blocking VM operations need to verify the caller's safepoint state:
+    if (!concurrent) {
+      t->check_for_valid_safepoint_state(true);
+    }
 
     // New request from Java thread, evaluate prologue
     if (!op->doit_prologue()) {
@@ -582,7 +586,6 @@
 
     // It does not make sense to execute the epilogue, if the VM operation object is getting
     // deallocated by the VM thread.
-    bool concurrent     = op->evaluate_concurrently();
     bool execute_epilog = !op->is_cheap_allocated();
     assert(!concurrent || op->is_cheap_allocated(), "concurrent => cheap_allocated");
 
--- a/src/share/vm/services/diagnosticArgument.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/diagnosticArgument.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -86,7 +86,7 @@
 
 template <> void DCmdArgument<jlong>::parse_value(const char* str,
                                                   size_t len, TRAPS) {
-    if (str == NULL || sscanf(str, INT64_FORMAT, &_value) != 1) {
+    if (str == NULL || sscanf(str, JLONG_FORMAT, &_value) != 1) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
       "Integer parsing error in diagnostic command arguments\n");
   }
@@ -171,7 +171,7 @@
               "Integer parsing error nanotime value: syntax error");
   }
 
-  int argc = sscanf(str, INT64_FORMAT , &_value._time);
+  int argc = sscanf(str, JLONG_FORMAT, &_value._time);
   if (argc != 1) {
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Integer parsing error nanotime value: syntax error");
--- a/src/share/vm/services/diagnosticCommand_ext.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/diagnosticCommand_ext.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. DO
- * NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 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
--- a/src/share/vm/services/heapDumper.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/heapDumper.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -1866,7 +1866,7 @@
     if (error() == NULL) {
       char msg[256];
       sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
-        os::jlong_format_specifier(), timer()->seconds());
+        JLONG_FORMAT, timer()->seconds());
       tty->print_cr(msg, writer.bytes_written());
     } else {
       tty->print_cr("Dump file is incomplete: %s", writer.error());
--- a/src/share/vm/services/lowMemoryDetector.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/lowMemoryDetector.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -353,7 +353,7 @@
 
 #ifndef PRODUCT
 void SensorInfo::print() {
-  tty->print_cr("%s count = %ld pending_triggers = %ld pending_clears = %ld",
+  tty->print_cr("%s count = " SIZE_FORMAT " pending_triggers = %ld pending_clears = %ld",
                 (_sensor_on ? "on" : "off"),
                 _sensor_count, _pending_trigger_count, _pending_clear_count);
 }
--- a/src/share/vm/services/memBaseline.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memBaseline.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -22,7 +22,6 @@
  *
  */
 #include "precompiled.hpp"
-#include "classfile/systemDictionary.hpp"
 #include "memory/allocation.hpp"
 #include "services/memBaseline.hpp"
 #include "services/memTracker.hpp"
@@ -349,7 +348,7 @@
   reset();
   _baselined = baseline_malloc_summary(snapshot._alloc_ptrs) &&
                baseline_vm_summary(snapshot._vm_ptrs);
-  _number_of_classes = SystemDictionary::number_of_classes();
+  _number_of_classes = snapshot.number_of_classes();
 
   if (!summary_only && MemTracker::track_callsite() && _baselined) {
     _baselined =  baseline_malloc_details(snapshot._alloc_ptrs) &&
--- a/src/share/vm/services/memBaseline.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memBaseline.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -334,7 +334,7 @@
   // create a memory baseline
   MemBaseline();
 
-  virtual ~MemBaseline();
+  ~MemBaseline();
 
   inline bool baselined() const {
     return _baselined;
--- a/src/share/vm/services/memRecorder.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memRecorder.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -84,10 +84,13 @@
     }
     delete _pointer_records;
   }
-  if (_next != NULL) {
-    delete _next;
+  // delete all linked recorders
+  while (_next != NULL) {
+    MemRecorder* tmp = _next;
+    _next = _next->next();
+    tmp->set_next(NULL);
+    delete tmp;
   }
-
   Atomic::dec(&_instance_count);
 }
 
--- a/src/share/vm/services/memRecorder.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memRecorder.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -203,6 +203,7 @@
   friend class MemSnapshot;
   friend class MemTracker;
   friend class MemTrackWorker;
+  friend class GenerationData;
 
  protected:
   // the array that holds memory records
--- a/src/share/vm/services/memReporter.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memReporter.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/src/share/vm/services/memReporter.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memReporter.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+ * 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
--- a/src/share/vm/services/memSnapshot.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memSnapshot.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -384,6 +384,7 @@
   _staging_area.init();
   _lock = new (std::nothrow) Mutex(Monitor::max_nonleaf - 1, "memSnapshotLock");
   NOT_PRODUCT(_untracked_count = 0;)
+  _number_of_classes = 0;
 }
 
 MemSnapshot::~MemSnapshot() {
@@ -479,7 +480,7 @@
 
 
 // promote data to next generation
-bool MemSnapshot::promote() {
+bool MemSnapshot::promote(int number_of_classes) {
   assert(_alloc_ptrs != NULL && _vm_ptrs != NULL, "Just check");
   assert(_staging_area.malloc_data() != NULL && _staging_area.vm_data() != NULL,
          "Just check");
@@ -496,6 +497,7 @@
 
   NOT_PRODUCT(check_malloc_pointers();)
   _staging_area.clear();
+  _number_of_classes = number_of_classes;
   return promoted;
 }
 
--- a/src/share/vm/services/memSnapshot.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memSnapshot.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -355,6 +355,9 @@
   // the lock to protect this snapshot
   Monitor*              _lock;
 
+  // the number of instance classes
+  int                   _number_of_classes;
+
   NOT_PRODUCT(size_t    _untracked_count;)
   friend class MemBaseline;
 
@@ -375,8 +378,9 @@
   // merge a per-thread memory recorder into staging area
   bool merge(MemRecorder* rec);
   // promote staged data to snapshot
-  bool promote();
+  bool promote(int number_of_classes);
 
+  int  number_of_classes() const { return _number_of_classes; }
 
   void wait(long timeout) {
     assert(_lock != NULL, "Just check");
--- a/src/share/vm/services/memTrackWorker.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memTrackWorker.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -29,6 +29,16 @@
 #include "utilities/decoder.hpp"
 #include "utilities/vmError.hpp"
 
+
+void GenerationData::reset() {
+  _number_of_classes = 0;
+  while (_recorder_list != NULL) {
+    MemRecorder* tmp = _recorder_list;
+    _recorder_list = _recorder_list->next();
+    MemTracker::release_thread_recorder(tmp);
+  }
+}
+
 MemTrackWorker::MemTrackWorker() {
   // create thread uses cgc thread type for now. We should revisit
   // the option, or create new thread type.
@@ -39,7 +49,7 @@
   if (!has_error()) {
     _head = _tail = 0;
     for(int index = 0; index < MAX_GENERATIONS; index ++) {
-      _gen[index] = NULL;
+      ::new ((void*)&_gen[index]) GenerationData();
     }
   }
   NOT_PRODUCT(_sync_point_count = 0;)
@@ -49,10 +59,7 @@
 
 MemTrackWorker::~MemTrackWorker() {
   for (int index = 0; index < MAX_GENERATIONS; index ++) {
-    MemRecorder* rc = _gen[index];
-    if (rc != NULL) {
-      delete rc;
-    }
+    _gen[index].reset();
   }
 }
 
@@ -90,12 +97,7 @@
     {
       // take a recorder from earliest generation in buffer
       ThreadCritical tc;
-      rec = _gen[_head];
-      if (rec != NULL) {
-        _gen[_head] = rec->next();
-      }
-      assert(count_recorder(_gen[_head]) <= MemRecorder::_instance_count,
-        "infinite loop after dequeue");
+      rec = _gen[_head].next_recorder();
     }
     if (rec != NULL) {
       // merge the recorder into staging area
@@ -109,16 +111,20 @@
       // no more recorder to merge, promote staging area
       // to snapshot
       if (_head != _tail) {
+        long number_of_classes;
         {
           ThreadCritical tc;
-          if (_gen[_head] != NULL || _head == _tail) {
+          if (_gen[_head].has_more_recorder() || _head == _tail) {
             continue;
           }
+          number_of_classes = _gen[_head].number_of_classes();
+          _gen[_head].reset();
+
           // done with this generation, increment _head pointer
           _head = (_head + 1) % MAX_GENERATIONS;
         }
         // promote this generation data to snapshot
-        if (!snapshot->promote()) {
+        if (!snapshot->promote(number_of_classes)) {
           // failed to promote, means out of memory
           MemTracker::shutdown(MemTracker::NMT_out_of_memory);
         }
@@ -126,8 +132,8 @@
         snapshot->wait(1000);
         ThreadCritical tc;
         // check if more data arrived
-        if (_gen[_head] == NULL) {
-          _gen[_head] = MemTracker::get_pending_recorders();
+        if (!_gen[_head].has_more_recorder()) {
+          _gen[_head].add_recorders(MemTracker::get_pending_recorders());
         }
       }
     }
@@ -147,7 +153,7 @@
 //   1. add all recorders in pending queue to current generation
 //   2. increase generation
 
-void MemTrackWorker::at_sync_point(MemRecorder* rec) {
+void MemTrackWorker::at_sync_point(MemRecorder* rec, int number_of_classes) {
   NOT_PRODUCT(_sync_point_count ++;)
   assert(count_recorder(rec) <= MemRecorder::_instance_count,
     "pending queue has infinite loop");
@@ -155,23 +161,15 @@
   bool out_of_generation_buffer = false;
   // check shutdown state inside ThreadCritical
   if (MemTracker::shutdown_in_progress()) return;
+
+  _gen[_tail].set_number_of_classes(number_of_classes);
   // append the recorders to the end of the generation
-  if( rec != NULL) {
-    MemRecorder* cur_head = _gen[_tail];
-    if (cur_head == NULL) {
-      _gen[_tail] = rec;
-    } else {
-      while (cur_head->next() != NULL) {
-        cur_head = cur_head->next();
-      }
-      cur_head->set_next(rec);
-    }
-  }
-  assert(count_recorder(rec) <= MemRecorder::_instance_count,
+  _gen[_tail].add_recorders(rec);
+  assert(count_recorder(_gen[_tail].peek()) <= MemRecorder::_instance_count,
     "after add to current generation has infinite loop");
   // we have collected all recorders for this generation. If there is data,
   // we need to increment _tail to start a new generation.
-  if (_gen[_tail] != NULL || _head == _tail) {
+  if (_gen[_tail].has_more_recorder()  || _head == _tail) {
     _tail = (_tail + 1) % MAX_GENERATIONS;
     out_of_generation_buffer = (_tail == _head);
   }
@@ -194,7 +192,7 @@
 int MemTrackWorker::count_pending_recorders() const {
   int count = 0;
   for (int index = 0; index < MAX_GENERATIONS; index ++) {
-    MemRecorder* head = _gen[index];
+    MemRecorder* head = _gen[index].peek();
     if (head != NULL) {
       count += count_recorder(head);
     }
--- a/src/share/vm/services/memTrackWorker.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memTrackWorker.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -32,17 +32,58 @@
 // Maximum MAX_GENERATIONS generation data can be tracked.
 #define MAX_GENERATIONS  512
 
+class GenerationData : public _ValueObj {
+ private:
+  int           _number_of_classes;
+  MemRecorder*  _recorder_list;
+
+ public:
+  GenerationData(): _number_of_classes(0), _recorder_list(NULL) { }
+
+  inline int  number_of_classes() const { return _number_of_classes; }
+  inline void set_number_of_classes(long num) { _number_of_classes = num; }
+
+  inline MemRecorder* next_recorder() {
+    if (_recorder_list == NULL) {
+      return NULL;
+    } else {
+      MemRecorder* tmp = _recorder_list;
+      _recorder_list = _recorder_list->next();
+      return tmp;
+    }
+  }
+
+  inline bool has_more_recorder() const {
+    return (_recorder_list != NULL);
+  }
+
+  // add recorders to this generation
+  void add_recorders(MemRecorder* head) {
+    if (head != NULL) {
+      if (_recorder_list == NULL) {
+        _recorder_list = head;
+      } else {
+        MemRecorder* tmp = _recorder_list;
+        for (; tmp->next() != NULL; tmp = tmp->next());
+        tmp->set_next(head);
+      }
+    }
+  }
+
+  void reset();
+
+  NOT_PRODUCT(MemRecorder* peek() const { return _recorder_list; })
+};
 
 class MemTrackWorker : public NamedThread {
  private:
-  // circular buffer. This buffer contains recorders to be merged into global
+  // circular buffer. This buffer contains generation data to be merged into global
   // snaphsot.
-  // Each slot holds a linked list of memory recorders, that contains one
-  // generation of memory data.
-  MemRecorder*  _gen[MAX_GENERATIONS];
-  int           _head, _tail; // head and tail pointers to above circular buffer
+  // Each slot holds a generation
+  GenerationData  _gen[MAX_GENERATIONS];
+  int             _head, _tail; // head and tail pointers to above circular buffer
 
-  bool          _has_error;
+  bool            _has_error;
 
  public:
   MemTrackWorker();
@@ -56,7 +97,7 @@
   inline bool has_error() const { return _has_error; }
 
   // task at synchronization point
-  void at_sync_point(MemRecorder* pending_recorders);
+  void at_sync_point(MemRecorder* pending_recorders, int number_of_classes);
 
   // for debugging purpose, they are not thread safe.
   NOT_PRODUCT(static int count_recorder(const MemRecorder* head);)
--- a/src/share/vm/services/memTracker.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memTracker.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -23,6 +23,7 @@
  */
 #include "precompiled.hpp"
 
+#include "oops/instanceKlass.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -485,7 +486,7 @@
       }
       // check _worker_thread with lock to avoid racing condition
       if (_worker_thread != NULL) {
-        _worker_thread->at_sync_point(pending_recorders);
+        _worker_thread->at_sync_point(pending_recorders, InstanceKlass::number_of_instance_classes());
       }
 
       assert(SequenceGenerator::peek() == 1, "Should not have memory activities during sync-point");
--- a/src/share/vm/services/memTracker.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/memTracker.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -142,6 +142,7 @@
  * MemTracker is the 'gate' class to native memory tracking runtime.
  */
 class MemTracker : AllStatic {
+  friend class GenerationData;
   friend class MemTrackWorker;
   friend class MemSnapshot;
   friend class SyncThreadRecorderClosure;
--- a/src/share/vm/services/nmtDCmd.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/services/nmtDCmd.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -84,28 +84,31 @@
   }
 
   int nopt = 0;
-  if(_summary.is_set()) { ++nopt; }
-  if(_detail.is_set()) { ++nopt; }
-  if(_baseline.is_set()) { ++nopt; }
-  if(_summary_diff.is_set()) { ++nopt; }
-  if(_detail_diff.is_set()) { ++nopt; }
-  if(_shutdown.is_set()) { ++nopt; }
+  if(_summary.is_set() && _summary.value()) { ++nopt; }
+  if(_detail.is_set() && _detail.value()) { ++nopt; }
+  if(_baseline.is_set() && _baseline.value()) { ++nopt; }
+  if(_summary_diff.is_set() && _summary_diff.value()) { ++nopt; }
+  if(_detail_diff.is_set() && _detail_diff.value()) { ++nopt; }
+  if(_shutdown.is_set() && _shutdown.value()) { ++nopt; }
 #ifndef PRODUCT
-  if(_debug.is_set()) { ++nopt; }
+  if(_debug.is_set() && _debug.value()) { ++nopt; }
 #endif
 
   if(nopt > 1) {
       output()->print_cr("At most one of the following option can be specified: " \
         "summary, detail, baseline, summary.diff, detail.diff, shutdown"
 #ifndef PRODUCT
-        " ,debug"
+        ", debug"
 #endif
       );
       return;
-  }
-
-  if(nopt == 0) {
+  } else if (nopt == 0) {
+    if (_summary.is_set()) {
+      output()->print_cr("No command to execute");
+      return;
+    } else {
       _summary.set_value(true);
+    }
   }
 
 #ifndef PRODUCT
--- a/src/share/vm/shark/sharkBlock.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkBlock.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1032,7 +1032,7 @@
     check_null(value);
     object = value->generic_value();
   }
-  if (is_get && field->is_constant()) {
+  if (is_get && field->is_constant() && field->is_static()) {
     SharkConstant *constant = SharkConstant::for_field(iter());
     if (constant->is_loaded())
       value = constant->value(builder());
@@ -1044,10 +1044,17 @@
     BasicType   basic_type = field->type()->basic_type();
     Type *stack_type = SharkType::to_stackType(basic_type);
     Type *field_type = SharkType::to_arrayType(basic_type);
-
+    Type *type = field_type;
+    if (field->is_volatile()) {
+      if (field_type == SharkType::jfloat_type()) {
+        type = SharkType::jint_type();
+      } else if (field_type == SharkType::jdouble_type()) {
+        type = SharkType::jlong_type();
+      }
+    }
     Value *addr = builder()->CreateAddressOfStructEntry(
       object, in_ByteSize(field->offset_in_bytes()),
-      PointerType::getUnqual(field_type),
+      PointerType::getUnqual(type),
       "addr");
 
     // Do the access
@@ -1055,6 +1062,7 @@
       Value* field_value;
       if (field->is_volatile()) {
         field_value = builder()->CreateAtomicLoad(addr);
+        field_value = builder()->CreateBitCast(field_value, field_type);
       } else {
         field_value = builder()->CreateLoad(addr);
       }
@@ -1074,6 +1082,7 @@
       }
 
       if (field->is_volatile()) {
+        field_value = builder()->CreateBitCast(field_value, type);
         builder()->CreateAtomicStore(field_value, addr);
       } else {
         builder()->CreateStore(field_value, addr);
--- a/src/share/vm/shark/sharkCompiler.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkCompiler.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -185,6 +185,9 @@
 
   // Build the LLVM IR for the method
   Function *function = SharkFunction::build(env, &builder, flow, name);
+  if (env->failing()) {
+    return;
+  }
 
   // Generate native code.  It's unpleasant that we have to drop into
   // the VM to do this -- it blocks safepoints -- but I can't see any
--- a/src/share/vm/shark/sharkCompiler.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkCompiler.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -46,6 +46,9 @@
   // Missing feature tests
   bool supports_native() { return true; }
   bool supports_osr()    { return true; }
+  bool can_compile_method(methodHandle method)  {
+    return ! (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form());
+  }
 
   // Customization
   bool needs_adapters()  { return false; }
--- a/src/share/vm/shark/sharkConstant.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkConstant.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -37,7 +37,12 @@
   ciType *type = NULL;
   if (constant.basic_type() == T_OBJECT) {
     ciEnv *env = ciEnv::current();
-    assert(constant.as_object()->klass() == env->String_klass() || constant.as_object()->klass() == env->Class_klass(), "should be");
+
+    assert(constant.as_object()->klass() == env->String_klass()
+           || constant.as_object()->klass() == env->Class_klass()
+           || constant.as_object()->klass()->is_subtype_of(env->MethodType_klass())
+           || constant.as_object()->klass()->is_subtype_of(env->MethodHandle_klass()), "should be");
+
     type = constant.as_object()->klass();
   }
   return new SharkConstant(constant, type);
--- a/src/share/vm/shark/sharkFunction.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkFunction.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -77,6 +77,10 @@
   // Walk the tree from the start block to determine which
   // blocks are entered and which blocks require phis
   SharkTopLevelBlock *start_block = block(flow()->start_block_num());
+  if (is_osr() && start_block->stack_depth_at_entry() != 0) {
+    env()->record_method_not_compilable("can't compile OSR block with incoming stack-depth > 0");
+    return;
+  }
   assert(start_block->start() == flow()->start_bci(), "blocks out of order");
   start_block->enter();
 
--- a/src/share/vm/shark/sharkInliner.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkInliner.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -725,7 +725,7 @@
   // Push the result if necessary
   if (is_get) {
     bool result_pushed = false;
-    if (field->is_constant()) {
+    if (field->is_constant() && field->is_static()) {
       SharkConstant *sc = SharkConstant::for_field(iter());
       if (sc->is_loaded()) {
         push(sc->is_nonzero());
--- a/src/share/vm/shark/sharkInvariants.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkInvariants.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -68,7 +68,7 @@
   //
   // Accessing this directly is kind of ugly, so it's private.  Add
   // new accessors below if you need something from it.
- private:
+ protected:
   ciEnv* env() const {
     assert(_env != NULL, "env not available");
     return _env;
@@ -99,12 +99,14 @@
   DebugInformationRecorder* debug_info() const {
     return env()->debug_info();
   }
+  SharkCodeBuffer* code_buffer() const {
+    return builder()->code_buffer();
+  }
+
+ public:
   Dependencies* dependencies() const {
     return env()->dependencies();
   }
-  SharkCodeBuffer* code_buffer() const {
-    return builder()->code_buffer();
-  }
 
   // Commonly used classes
  protected:
--- a/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/shark/sharkTopLevelBlock.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -113,7 +113,19 @@
       ciSignature* sig;
       method = iter()->get_method(will_link, &sig);
       assert(will_link, "typeflow responsibility");
-
+      // We can't compile calls to method handle intrinsics, because we use
+      // the interpreter entry points and they expect the top frame to be an
+      // interpreter frame. We need to implement the intrinsics for Shark.
+      if (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form()) {
+        if (SharkPerformanceWarnings) {
+          warning("JSR292 optimization not yet implemented in Shark");
+        }
+        set_trap(
+          Deoptimization::make_trap_request(
+            Deoptimization::Reason_unhandled,
+            Deoptimization::Action_make_not_compilable), bci());
+          return;
+      }
       if (!method->holder()->is_linked()) {
         set_trap(
           Deoptimization::make_trap_request(
@@ -158,6 +170,16 @@
         return;
       }
       break;
+    case Bytecodes::_invokedynamic:
+    case Bytecodes::_invokehandle:
+      if (SharkPerformanceWarnings) {
+        warning("JSR292 optimization not yet implemented in Shark");
+      }
+      set_trap(
+        Deoptimization::make_trap_request(
+          Deoptimization::Reason_unhandled,
+          Deoptimization::Action_make_not_compilable), bci());
+      return;
     }
   }
 
@@ -1030,7 +1052,6 @@
       dest_method->holder() == java_lang_Object_klass())
     return dest_method;
 
-#ifdef SHARK_CAN_DEOPTIMIZE_ANYWHERE
   // This code can replace a virtual call with a direct call if this
   // class is the only one in the entire set of loaded classes that
   // implements this method.  This makes the compiled code dependent
@@ -1064,6 +1085,8 @@
   if (monomorphic_target != NULL) {
     assert(!monomorphic_target->is_abstract(), "shouldn't be");
 
+    function()->dependencies()->assert_unique_concrete_method(actual_receiver, monomorphic_target);
+
     // Opto has a bunch of type checking here that I don't
     // understand.  It's to inhibit casting in one direction,
     // possibly because objects in Opto can have inexact
@@ -1097,7 +1120,6 @@
   // with non-monomorphic targets if the receiver has an exact
   // type.  We don't mark types this way, so we can't do this.
 
-#endif // SHARK_CAN_DEOPTIMIZE_ANYWHERE
 
   return NULL;
 }
@@ -1298,8 +1320,9 @@
 
   // Try to inline the call
   if (!call_is_virtual) {
-    if (SharkInliner::attempt_inline(call_method, current_state()))
+    if (SharkInliner::attempt_inline(call_method, current_state())) {
       return;
+    }
   }
 
   // Find the method we are calling
--- a/src/share/vm/utilities/debug.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/debug.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -612,21 +612,6 @@
   Events::print();
 }
 
-// Given a heap address that was valid before the most recent GC, if
-// the oop that used to contain it is still live, prints the new
-// location of the oop and the address. Useful for tracking down
-// certain kinds of naked oop and oop map bugs.
-extern "C" void pnl(intptr_t old_heap_addr) {
-  // Print New Location of old heap address
-  Command c("pnl");
-#ifndef VALIDATE_MARK_SWEEP
-  tty->print_cr("Requires build with VALIDATE_MARK_SWEEP defined (debug build) and RecordMarkSweepCompaction enabled");
-#else
-  MarkSweep::print_new_location_of_heap_address((HeapWord*) old_heap_addr);
-#endif
-}
-
-
 extern "C" Method* findm(intptr_t pc) {
   Command c("findm");
   nmethod* nm = CodeCache::find_nmethod((address)pc);
--- a/src/share/vm/utilities/exceptions.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/exceptions.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -267,6 +267,7 @@
 #define THROW_WRAPPED_0(name, oop_to_wrap)  THROW_WRAPPED_(name, oop_to_wrap, 0)
 #define THROW_ARG_0(name, signature, arg)   THROW_ARG_(name, signature, arg, 0)
 #define THROW_MSG_CAUSE_0(name, message, cause) THROW_MSG_CAUSE_(name, message, cause, 0)
+#define THROW_MSG_CAUSE_NULL(name, message, cause) THROW_MSG_CAUSE_(name, message, cause, NULL)
 
 #define THROW_NULL(name)                    THROW_(name, NULL)
 #define THROW_MSG_NULL(name, message)       THROW_MSG_(name, message, NULL)
--- a/src/share/vm/utilities/globalDefinitions.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1250,6 +1250,14 @@
 
 #define PTR64_FORMAT           "0x%016" PRIx64
 
+// Format jlong, if necessary
+#ifndef JLONG_FORMAT
+#define JLONG_FORMAT           INT64_FORMAT
+#endif
+#ifndef JULONG_FORMAT
+#define JULONG_FORMAT          UINT64_FORMAT
+#endif
+
 // Format pointers which change size between 32- and 64-bit.
 #ifdef  _LP64
 #define INTPTR_FORMAT "0x%016" PRIxPTR
--- a/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/globalDefinitions_gcc.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -306,4 +306,8 @@
 #endif
 #define offsetof(klass,field) offset_of(klass,field)
 
+#if defined(_LP64) && defined(__APPLE__)
+#define JLONG_FORMAT           "%ld"
+#endif // _LP64 && __APPLE__
+
 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_GCC_HPP
--- a/src/share/vm/utilities/ostream.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/ostream.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -244,13 +244,11 @@
 }
 
 void outputStream::print_jlong(jlong value) {
-  // N.B. Same as INT64_FORMAT
-  print(os::jlong_format_specifier(), value);
+  print(JLONG_FORMAT, value);
 }
 
 void outputStream::print_julong(julong value) {
-  // N.B. Same as UINT64_FORMAT
-  print(os::julong_format_specifier(), value);
+  print(JULONG_FORMAT, value);
 }
 
 /**
--- a/src/share/vm/utilities/taskqueue.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/taskqueue.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -239,8 +239,8 @@
 
 #ifdef TRACESPINNING
 void ParallelTaskTerminator::print_termination_counts() {
-  gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: %lld  "
-    "Total spins: %lld  Total peeks: %lld",
+  gclog_or_tty->print_cr("ParallelTaskTerminator Total yields: " UINT32_FORMAT
+    " Total spins: " UINT32_FORMAT " Total peeks: " UINT32_FORMAT,
     total_yields(),
     total_spins(),
     total_peeks());
--- a/src/share/vm/utilities/vmError.cpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/vmError.cpp	Fri Feb 01 17:06:26 2013 +0100
@@ -726,7 +726,7 @@
 
      if (_verbose && Universe::is_fully_initialized()) {
        // print code cache information before vm abort
-       CodeCache::print_bounds(st);
+       CodeCache::print_summary(st);
        st->cr();
      }
 
--- a/src/share/vm/utilities/workgroup.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/workgroup.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -90,7 +90,7 @@
     NOT_PRODUCT(_name = name);
     _counter = 0;
   }
-  virtual ~AbstractGangTask() { }
+  ~AbstractGangTask() { }
 
 public:
 };
--- a/src/share/vm/utilities/yieldingWorkgroup.hpp	Fri Feb 01 16:57:40 2013 +0100
+++ b/src/share/vm/utilities/yieldingWorkgroup.hpp	Fri Feb 01 17:06:26 2013 +0100
@@ -106,7 +106,7 @@
     _status(INACTIVE),
     _gang(NULL) { }
 
-  virtual ~YieldingFlexibleGangTask() { }
+  ~YieldingFlexibleGangTask() { }
 
   friend class YieldingFlexibleWorkGang;
   friend class YieldingFlexibleGangWorker;
--- a/test/Makefile	Fri Feb 01 16:57:40 2013 +0100
+++ b/test/Makefile	Fri Feb 01 17:06:26 2013 +0100
@@ -189,9 +189,9 @@
 	$(JTREG) -a -v:fail,error               \
           $(JTREG_KEY_OPTION)                   \
           $(EXTRA_JTREG_OPTIONS)                \
-          -r:$(ABS_TEST_OUTPUT_DIR)/JTreport    \
-          -w:$(ABS_TEST_OUTPUT_DIR)/JTwork      \
-          -jdk:$(PRODUCT_HOME)                  \
+          -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport    \
+          -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork      \
+          -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                  \
           $(JAVA_OPTIONS:%=-vmoption:%)         \
           $(JTREG_TESTDIRS)                     \
 	  || $(BUNDLE_UP_FAILED)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/6896617/Test6896617.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,331 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 6896617
+ * @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86
+ * @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617
+ *
+ */
+
+import java.util.*;
+import java.nio.*;
+import java.nio.charset.*;
+
+public class Test6896617 {
+    final static int SIZE = 256;
+
+    public static void main(String[] args) {
+        String csn = "ISO-8859-1";
+        Charset cs = Charset.forName(csn);
+        CharsetEncoder enc = cs.newEncoder();
+        enc.onMalformedInput(CodingErrorAction.REPLACE)
+           .onUnmappableCharacter(CodingErrorAction.REPLACE);
+        CharsetDecoder dec = cs.newDecoder();
+        dec.onMalformedInput(CodingErrorAction.REPLACE)
+           .onUnmappableCharacter(CodingErrorAction.REPLACE);
+
+        byte repl = (byte)'?';
+        enc.replaceWith(new byte[] { repl });
+
+        // Use internal API for tests.
+        sun.nio.cs.ArrayEncoder arrenc = (sun.nio.cs.ArrayEncoder)enc;
+        sun.nio.cs.ArrayDecoder arrdec = (sun.nio.cs.ArrayDecoder)dec;
+
+        // Populate char[] with chars which can be encoded by ISO_8859_1 (<= 0xFF)
+        Random rnd = new Random(0);
+        int maxchar = 0xFF;
+        char[] a = new char[SIZE];
+        byte[] b = new byte[SIZE];
+        char[] at = new char[SIZE];
+        byte[] bt = new byte[SIZE];
+        for (int i = 0; i < SIZE; i++) {
+            char c = (char) rnd.nextInt(maxchar);
+            if (!enc.canEncode(c)) {
+                System.out.printf("Something wrong: can't encode c=%03x\n", (int)c);
+                System.exit(97);
+            }
+            a[i] = c;
+            b[i] = (byte)c;
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+        if (arrenc.encode(a, 0, SIZE, bt) != SIZE || !Arrays.equals(b, bt)) {
+            System.out.println("Something wrong: ArrayEncoder.encode failed");
+            System.exit(97);
+        }
+        if (arrdec.decode(b, 0, SIZE, at) != SIZE || !Arrays.equals(a, at)) {
+            System.out.println("Something wrong: ArrayDecoder.decode failed");
+            System.exit(97);
+        }
+        for (int i = 0; i < SIZE; i++) {
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+
+        ByteBuffer bb  = ByteBuffer.wrap(b);
+        CharBuffer ba  = CharBuffer.wrap(a);
+        ByteBuffer bbt = ByteBuffer.wrap(bt);
+        CharBuffer bat = CharBuffer.wrap(at);
+        if (!enc.encode(ba, bbt, true).isUnderflow() || !Arrays.equals(b, bt)) {
+            System.out.println("Something wrong: Encoder.encode failed");
+            System.exit(97);
+        }
+        if (!dec.decode(bb, bat, true).isUnderflow() || !Arrays.equals(a, at)) {
+            System.out.println("Something wrong: Decoder.decode failed");
+            System.exit(97);
+        }
+        for (int i = 0; i < SIZE; i++) {
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+
+        // Warm up
+        boolean failed = false;
+        int result = 0;
+        for (int i = 0; i < 10000; i++) {
+            result += arrenc.encode(a, 0, SIZE, bt);
+            result -= arrdec.decode(b, 0, SIZE, at);
+        }
+        for (int i = 0; i < 10000; i++) {
+            result += arrenc.encode(a, 0, SIZE, bt);
+            result -= arrdec.decode(b, 0, SIZE, at);
+        }
+        for (int i = 0; i < 10000; i++) {
+            result += arrenc.encode(a, 0, SIZE, bt);
+            result -= arrdec.decode(b, 0, SIZE, at);
+        }
+        if (result != 0 || !Arrays.equals(b, bt) || !Arrays.equals(a, at)) {
+            failed = true;
+            System.out.println("Failed: ArrayEncoder.encode char[" + SIZE + "] and ArrayDecoder.decode byte[" + SIZE + "]");
+        }
+        for (int i = 0; i < SIZE; i++) {
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+
+        boolean is_underflow = true;
+        for (int i = 0; i < 10000; i++) {
+            ba.clear(); bb.clear(); bat.clear(); bbt.clear();
+            boolean enc_res = enc.encode(ba, bbt, true).isUnderflow();
+            boolean dec_res = dec.decode(bb, bat, true).isUnderflow();
+            is_underflow = is_underflow && enc_res && dec_res;
+        }
+        for (int i = 0; i < SIZE; i++) {
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+        for (int i = 0; i < 10000; i++) {
+            ba.clear(); bb.clear(); bat.clear(); bbt.clear();
+            boolean enc_res = enc.encode(ba, bbt, true).isUnderflow();
+            boolean dec_res = dec.decode(bb, bat, true).isUnderflow();
+            is_underflow = is_underflow && enc_res && dec_res;
+        }
+        for (int i = 0; i < SIZE; i++) {
+            at[i] = (char)-1;
+            bt[i] = (byte)-1;
+        }
+        for (int i = 0; i < 10000; i++) {
+            ba.clear(); bb.clear(); bat.clear(); bbt.clear();
+            boolean enc_res = enc.encode(ba, bbt, true).isUnderflow();
+            boolean dec_res = dec.decode(bb, bat, true).isUnderflow();
+            is_underflow = is_underflow && enc_res && dec_res;
+        }
+        if (!is_underflow || !Arrays.equals(b, bt) || !Arrays.equals(a, at)) {
+            failed = true;
+            System.out.println("Failed: Encoder.encode char[" + SIZE + "] and Decoder.decode byte[" + SIZE + "]");
+        }
+
+        // Test encoder with different source and destination sizes
+        System.out.println("Testing different source and destination sizes");
+        for (int i = 1; i <= SIZE; i++) {
+            for (int j = 1; j <= SIZE; j++) {
+                bt = new byte[j];
+                // very source's SIZE
+                result = arrenc.encode(a, 0, i, bt);
+                int l = Math.min(i, j);
+                if (result != l) {
+                    failed = true;
+                    System.out.println("Failed: encode char[" + i + "] to byte[" + j + "]: result = " + result + ", expected " + l);
+                }
+                for (int k = 0; k < l; k++) {
+                    if (bt[k] != b[k]) {
+                        failed = true;
+                        System.out.println("Failed: encoded byte[" + k + "] (" + bt[k] + ") != " + b[k]);
+                    }
+                }
+                // very source's offset
+                int sz = SIZE - i + 1;
+                result = arrenc.encode(a, i-1, sz, bt);
+                l = Math.min(sz, j);
+                if (result != l) {
+                    failed = true;
+                    System.out.println("Failed: encode char[" + sz + "] to byte[" + j + "]: result = " + result + ", expected " + l);
+                }
+                for (int k = 0; k < l; k++) {
+                    if (bt[k] != b[i+k-1]) {
+                        failed = true;
+                        System.out.println("Failed: encoded byte[" + k + "] (" + bt[k] + ") != " + b[i+k-1]);
+                    }
+                }
+            }
+        }
+
+        // Test encoder with char > 0xFF
+        System.out.println("Testing big char");
+
+        byte orig = (byte)'A';
+        bt = new byte[SIZE];
+        for (int i = 1; i <= SIZE; i++) {
+            for (int j = 0; j < i; j++) {
+                a[j] += 0x100;
+                // make sure to replace a different byte
+                bt[j] = orig;
+                result = arrenc.encode(a, 0, i, bt);
+                if (result != i) {
+                    failed = true;
+                    System.out.println("Failed: encode char[" + i + "] to byte[" + i + "]: result = " + result + ", expected " + i);
+                }
+                if (bt[j] != repl) {
+                    failed = true;
+                    System.out.println("Failed: encoded replace byte[" + j + "] (" + bt[j] + ") != " + repl);
+                }
+                bt[j] = b[j]; // Restore to compare whole array
+                for (int k = 0; k < i; k++) {
+                    if (bt[k] != b[k]) {
+                        failed = true;
+                        System.out.println("Failed: encoded byte[" + k + "] (" + bt[k] + ") != " + b[k]);
+                    }
+                }
+                a[j] -= 0x100; // Restore
+            }
+        }
+
+        // Test sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() performance.
+
+        int itrs = Integer.getInteger("iterations", 1000000);
+        int size = Integer.getInteger("size", 256);
+        a  = new char[size];
+        b  = new byte[size];
+        bt = new byte[size];
+        for (int i = 0; i < size; i++) {
+            char c = (char) rnd.nextInt(maxchar);
+            if (!enc.canEncode(c)) {
+                System.out.printf("Something wrong: can't encode c=%03x\n", (int)c);
+                System.exit(97);
+            }
+            a[i] = c;
+            b[i]  = (byte)-1;
+            bt[i] = (byte)c;
+        }
+        ba = CharBuffer.wrap(a);
+        bb = ByteBuffer.wrap(b);
+        boolean enc_res = enc.encode(ba, bb, true).isUnderflow();
+        if (!enc_res || !Arrays.equals(b, bt)) {
+            failed = true;
+            System.out.println("Failed 1: Encoder.encode char[" + size + "]");
+        }
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+
+        // Make sure to recompile method if needed before performance run.
+        for (int i = 0; i < 10000; i++) {
+            ba.clear(); bb.clear();
+            enc_res = enc_res && enc.encode(ba, bb, true).isUnderflow();
+        }
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+        for (int i = 0; i < 10000; i++) {
+            ba.clear(); bb.clear();
+            enc_res = enc_res && enc.encode(ba, bb, true).isUnderflow();
+        }
+        if (!enc_res || !Arrays.equals(b, bt)) {
+            failed = true;
+            System.out.println("Failed 2: Encoder.encode char[" + size + "]");
+        }
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+
+        System.out.println("Testing ISO_8859_1$Encode.encodeArrayLoop() performance");
+        long start = System.currentTimeMillis();
+        for (int i = 0; i < itrs; i++) {
+            ba.clear(); bb.clear();
+            enc_res = enc_res && enc.encode(ba, bb, true).isUnderflow();
+        }
+        long end = System.currentTimeMillis();
+        if (!enc_res || !Arrays.equals(b, bt)) {
+            failed = true;
+            System.out.println("Failed 3: Encoder.encode char[" + size + "]");
+        } else {
+            System.out.println("size: " + size + " time: " + (end - start));
+        }
+
+        // Test sun.nio.cs.ISO_8859_1$Encode.encode() performance.
+
+        // Make sure to recompile method if needed before performance run.
+        result = 0;
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+        for (int i = 0; i < 10000; i++) {
+            result += arrenc.encode(a, 0, size, b);
+        }
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+        for (int i = 0; i < 10000; i++) {
+            result += arrenc.encode(a, 0, size, b);
+        }
+        if (result != size*20000 || !Arrays.equals(b, bt)) {
+            failed = true;
+            System.out.println("Failed 1: ArrayEncoder.encode char[" + SIZE + "]");
+        }
+        for (int i = 0; i < size; i++) {
+            b[i] = (byte)-1;
+        }
+
+        System.out.println("Testing ISO_8859_1$Encode.encode() performance");
+        result = 0;
+        start = System.currentTimeMillis();
+        for (int i = 0; i < itrs; i++) {
+            result += arrenc.encode(a, 0, size, b);
+        }
+        end = System.currentTimeMillis();
+        if (!Arrays.equals(b, bt)) {
+            failed = true;
+            System.out.println("Failed 2: ArrayEncoder.encode char[" + size + "]");
+        } else {
+            System.out.println("size: " + size + " time: " + (end - start));
+        }
+
+        if (failed) {
+          System.out.println("FAILED");
+          System.exit(97);
+        }
+        System.out.println("PASSED");
+    }
+}
--- a/test/compiler/7184394/TestAESBase.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/test/compiler/7184394/TestAESBase.java	Fri Feb 01 17:06:26 2013 +0100
@@ -54,7 +54,6 @@
   String paddingStr = "PKCS5Padding";
   AlgorithmParameters algParams;
   SecretKey key;
-  int ivLen;
 
   static int numThreads = 0;
   int  threadId;
@@ -68,7 +67,7 @@
 
   public void prepare() {
     try {
-    System.out.println("\nmsgSize=" + msgSize + ", key size=" + keySize + ", reInit=" + !noReinit + ", checkOutput=" + checkOutput);
+    System.out.println("\nalgorithm=" + algorithm + ", mode=" + mode + ", msgSize=" + msgSize + ", keySize=" + keySize + ", noReinit=" + noReinit + ", checkOutput=" + checkOutput);
 
       int keyLenBytes = (keySize == 0 ? 16 : keySize/8);
       byte keyBytes[] = new byte[keyLenBytes];
@@ -90,10 +89,14 @@
       cipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
       dCipher = Cipher.getInstance(algorithm + "/" + mode + "/" + paddingStr, "SunJCE");
 
-      ivLen = (algorithm.equals("AES") ? 16 : algorithm.equals("DES") ? 8 : 0);
-      IvParameterSpec initVector = new IvParameterSpec(new byte[ivLen]);
-
-      cipher.init(Cipher.ENCRYPT_MODE, key, initVector);
+      if (mode.equals("CBC")) {
+        int ivLen = (algorithm.equals("AES") ? 16 : algorithm.equals("DES") ? 8 : 0);
+        IvParameterSpec initVector = new IvParameterSpec(new byte[ivLen]);
+        cipher.init(Cipher.ENCRYPT_MODE, key, initVector);
+      } else {
+        algParams = cipher.getParameters();
+        cipher.init(Cipher.ENCRYPT_MODE, key, algParams);
+      }
       algParams = cipher.getParameters();
       dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
       if (threadId == 0) {
--- a/test/compiler/7184394/TestAESMain.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/test/compiler/7184394/TestAESMain.java	Fri Feb 01 17:06:26 2013 +0100
@@ -27,7 +27,8 @@
  * @bug 7184394
  * @summary add intrinsics to use AES instructions
  *
- * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
+ * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=ECB TestAESMain
  *
  * @author Tom Deneau
  */
--- a/test/compiler/7190310/Test7190310.java	Fri Feb 01 16:57:40 2013 +0100
+++ b/test/compiler/7190310/Test7190310.java	Fri Feb 01 17:06:26 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,7 +23,16 @@
  */
 
 /*
- * Manual test
+ * @test
+ * @bug 7190310
+ * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
+ * @run main/othervm/timeout=600 -Xbatch Test7190310
+ */
+
+/*
+ * Note bug exhibits as infinite loop, timeout is helpful.
+ * It should normally finish pretty quickly, but on some especially slow machines
+ * it may not.  The companion _unsafe test lacks a timeout, but that is okay.
  */
 
 import java.lang.ref.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/8004741/Test8004741.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test Test8004741.java
+ * @bug 8004741
+ * @summary Missing compiled exception handle table entry for multidimensional array allocation
+ * @run main/othervm -Xmx64m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers Test8004741
+ *
+ */
+
+import java.util.*;
+
+public class Test8004741 extends Thread {
+
+  static int[][] test(int a, int b) throws Exception {
+    int[][] ar = null;
+    try {
+      ar = new int[a][b];
+    } catch (Error e) {
+      System.out.println("test got Error");
+      passed = true;
+      throw(e);
+    } catch (Exception e) {
+      System.out.println("test got Exception");
+      throw(e);
+    }
+    return ar;
+  }
+
+  static boolean passed = false;
+
+  public void run() {
+      System.out.println("test started");
+      try {
+        while(true) {
+          test(2,20000);
+        }
+      } catch (ThreadDeath e) {
+        System.out.println("test got ThreadDeath");
+        passed = true;
+      } catch (Error e) {
+        e.printStackTrace();
+        System.out.println("test got Error");
+      } catch (Exception e) {
+        e.printStackTrace();
+        System.out.println("test got Exception");
+      }
+  }
+
+  public static void main(String[] args) throws Exception {
+    for (int n = 0; n < 11000; n++) {
+      test(2, 20);
+    }
+
+    // First test exception catch
+    Test8004741 t = new Test8004741();
+
+    passed = false;
+    t.start();
+    Thread.sleep(1000);
+    t.stop();
+
+    Thread.sleep(5000);
+    t.join();
+    if (passed) {
+      System.out.println("PASSED");
+    } else {
+      System.out.println("FAILED");
+      System.exit(97);
+    }
+  }
+
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/8005033/Test8005033.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2012 SAP AG.  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.
+ */
+
+/**
+ * @test
+ * @bug 8005033
+ * @summary On sparcv9, C2's intrinsic for Integer.bitCount(OV) returns wrong result if OV is the result of an operation with int overflow.
+ * @run main/othervm -Xcomp -XX:CompileOnly=Test8005033::testBitCount Test8005033
+ * @author Richard Reingruber richard DOT reingruber AT sap DOT com
+ */
+
+public class Test8005033 {
+    public static int MINUS_ONE = -1;
+
+    public static void main(String[] args) {
+        System.out.println("EXECUTING test.");
+        Integer.bitCount(1);   // load class
+        int expectedBitCount = 0;
+        int calculatedBitCount = testBitCount();
+        if (expectedBitCount != calculatedBitCount) {
+            throw new InternalError("got " + calculatedBitCount + " but expected " + expectedBitCount);
+        }
+        System.out.println("SUCCESSFULLY passed test.");
+    }
+
+    // testBitCount will be compiled using the Integer.bitCount() intrinsic if possible
+    private static int testBitCount() {
+        return Integer.bitCount(MINUS_ONE+1);   // -1 + 1 => int overflow
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/8005419/Test8005419.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,120 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8005419
+ * @summary Improve intrinsics code performance on x86 by using AVX2
+ * @run main/othervm -Xbatch -Xmx64m Test8005419
+ *
+ */
+
+public class Test8005419 {
+    public static int SIZE = 64;
+
+    public static void main(String[] args) {
+        char[] a = new char[SIZE];
+        char[] b = new char[SIZE];
+
+        for (int i = 16; i < SIZE; i++) {
+          a[i] = (char)i;
+          b[i] = (char)i;
+        }
+        String s1 = new String(a);
+        String s2 = new String(b);
+
+        // Warm up
+        boolean failed = false;
+        int result = 0;
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        for (int i = 0; i < 10000; i++) {
+          result += test(s1, s2);
+        }
+        if (result != 0) failed = true;
+
+        System.out.println("Start testing");
+        // Compare same string
+        result = test(s1, s1);
+        if (result != 0) {
+          failed = true;
+          System.out.println("Failed same: result = " + result + ", expected 0");
+        }
+        // Compare equal strings
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          s2 = new String(b, 0, i);
+          result = test(s1, s2);
+          if (result != 0) {
+            failed = true;
+            System.out.println("Failed equals s1[" + i + "], s2[" + i + "]: result = " + result + ", expected 0");
+          }
+        }
+        // Compare equal strings but different sizes
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          for (int j = 1; j <= SIZE; j++) {
+            s2 = new String(b, 0, j);
+            result = test(s1, s2);
+            if (result != (i-j)) {
+              failed = true;
+              System.out.println("Failed diff size s1[" + i + "], s2[" + j + "]: result = " + result + ", expected " + (i-j));
+            }
+          }
+        }
+        // Compare strings with one char different and different sizes
+        for (int i = 1; i <= SIZE; i++) {
+          s1 = new String(a, 0, i);
+          for (int j = 0; j < i; j++) {
+            b[j] -= 3; // change char
+            s2 = new String(b, 0, i);
+            result = test(s1, s2);
+            int chdiff = a[j] - b[j];
+            if (result != chdiff) {
+              failed = true;
+              System.out.println("Failed diff char s1[" + i + "], s2[" + i + "]: result = " + result + ", expected " + chdiff);
+            }
+            result = test(s2, s1);
+            chdiff = b[j] - a[j];
+            if (result != chdiff) {
+              failed = true;
+              System.out.println("Failed diff char s2[" + i + "], s1[" + i + "]: result = " + result + ", expected " + chdiff);
+            }
+            b[j] += 3; // restore
+          }
+        }
+        if (failed) {
+          System.out.println("FAILED");
+          System.exit(97);
+        }
+        System.out.println("PASSED");
+    }
+
+    private static int test(String str1, String str2) {
+        return str1.compareTo(str2);
+    }
+}
--- a/test/runtime/7158804/Test7158804.sh	Fri Feb 01 16:57:40 2013 +0100
+++ b/test/runtime/7158804/Test7158804.sh	Fri Feb 01 17:06:26 2013 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sanity/ExecuteInternalVMTests.java	Fri Feb 01 17:06:26 2013 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ *
+ */
+
+/* @test ExecuteInternalVMTests
+ * @bug 8004691
+ * @summary Add a jtreg test that exercises the ExecuteInternalVMTests flag
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ExecuteInternalVMTests ExecuteInternalVMTests
+ */
+public class ExecuteInternalVMTests {
+    public static void main(String[] args) throws Exception {
+        // The tests that are run are the HotSpot internal tests which are
+        // executed only when the flag -XX:+ExecuteInternalVMTests is used.
+
+        // The flag -XX:+ExecuteInternalVMTests can only be used for
+        // non-product builds of HotSpot. Therefore, the flag
+        // -XX:+IgnoreUnrecognizedVMOptions is also used, which means that this
+        // test will do nothing on a product build.
+    }
+}