changeset 14228:131a42bc2c20

Merge
author asaha
date Thu, 18 Oct 2012 22:01:26 -0700
parents f051c5b38a8a 43f75cb620fb
children 40fbffe104bd
files jdk/src/share/classes/java/io/FilePermission.java jdk/src/share/classes/java/util/ServiceLoader.java jdk/src/share/classes/sun/util/xml/XMLUtils.java jdk/src/share/test/pack200/pack.conf
diffstat 870 files changed, 68967 insertions(+), 5264 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Oct 11 15:30:23 2012 -0700
+++ b/.hgtags	Thu Oct 18 22:01:26 2012 -0700
@@ -181,3 +181,4 @@
 2c21c080b11b93efb3851e39e1363e45da805943 jdk8-b57
 479d3302a26d7607ba271d66973e59ebf58825b6 jdk8-b58
 3bd874584fc01aae92fbc8827e2bd04d8b6ace04 jdk8-b59
+5e3adc681779037a2d33b7be6f75680619085492 jdk8-b60
--- a/.hgtags-top-repo	Thu Oct 11 15:30:23 2012 -0700
+++ b/.hgtags-top-repo	Thu Oct 18 22:01:26 2012 -0700
@@ -181,3 +181,4 @@
 522dfac8ca4d07c0b74025d4ac3b6e5feefbb829 jdk8-b57
 9367024804874faf8e958adeb333682bab1c0c47 jdk8-b58
 dae9821589ccd2611bdf7084269b98e819091770 jdk8-b59
+e07f499b9dccb529ecf74172cf6ac11a195ec57a jdk8-b60
--- a/corba/.hgtags	Thu Oct 11 15:30:23 2012 -0700
+++ b/corba/.hgtags	Thu Oct 18 22:01:26 2012 -0700
@@ -181,3 +181,4 @@
 f3ab4163ae012965fc8acdfc25ce0fece8d6906d jdk8-b57
 18462a19f7bd66d38015f61ea549a5e0c0c889a3 jdk8-b58
 d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
+207ef43ba69ead6cbbab415d81834545e4d46747 jdk8-b60
--- a/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1631,7 +1631,7 @@
 
         // Write data members...
         p.pln();
-        p.pln("private " + getName(theType) + " target = null;");
+        p.pln("volatile private " + getName(theType) + " target = null;");
         p.pln();
 
         // Write the ids...
@@ -1695,6 +1695,10 @@
 
         if (remoteMethods.length > 0) {
             p.plnI("try {");
+            p.pln(getName(theType) + " target = this.target;");
+            p.plnI("if (target == null) {");
+            p.pln("throw new java.io.IOException();");
+            p.pOln("}");
             p.plnI(idExtInputStream + " "+in+" = ");
             p.pln("(" + idExtInputStream + ") "+_in+";");
             p.pO();
--- a/hotspot/.hgtags	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/.hgtags	Thu Oct 18 22:01:26 2012 -0700
@@ -283,3 +283,5 @@
 f2e12eb74117c917c0bb264694c02de4a6a15a10 hs25-b03
 8a1a6b9b4f20fd2f6a12441d638e51f19a82db19 jdk8-b59
 1cc7a2a11d00832e3d07f81f3744a6883422db7e hs25-b04
+3cfd05b2219a29649741a52637696f06acf24a4e jdk8-b60
+b261523fe66c40a02968f0aa7e73602491bb3386 hs25-b05
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/code/CodeCache.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/Address.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/Address.java	Thu Oct 18 22:01:26 2012 -0700
@@ -89,6 +89,7 @@
   public Address    getAddressAt       (long offset) throws UnmappedAddressException, UnalignedAddressException;
   /** Returns the decoded address at the given offset */
   public Address    getCompOopAddressAt (long offset) throws UnmappedAddressException, UnalignedAddressException;
+  public Address    getCompKlassAddressAt (long offset) throws UnmappedAddressException, UnalignedAddressException;
 
   //
   // Java-related routines
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/Debugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/Debugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -121,6 +121,9 @@
   public long getHeapOopSize();
   public long getNarrowOopBase();
   public int  getNarrowOopShift();
+  public long getKlassPtrSize();
+  public long getNarrowKlassBase();
+  public int  getNarrowKlassShift();
 
   public ReadResult readBytesFromProcess(long address, long numBytes)
     throws DebuggerException;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java	Thu Oct 18 22:01:26 2012 -0700
@@ -58,6 +58,10 @@
   protected long heapOopSize;
   protected long narrowOopBase;  // heap base for compressed oops.
   protected int  narrowOopShift; // shift to decode compressed oops.
+  // class metadata space
+  protected long klassPtrSize;
+  protected long narrowKlassBase;  // heap base for compressed klass ptrs.
+  protected int  narrowKlassShift; // shift to decode compressed klass ptrs.
   // Should be initialized if desired by calling initCache()
   private PageCache cache;
 
@@ -159,10 +163,14 @@
     javaPrimitiveTypesConfigured = true;
   }
 
-  public void putHeapConst(long heapOopSize, long narrowOopBase, int narrowOopShift) {
+  public void putHeapConst(long heapOopSize, long klassPtrSize, long narrowOopBase, int narrowOopShift,
+                           long narrowKlassBase, int narrowKlassShift) {
     this.heapOopSize = heapOopSize;
+    this.klassPtrSize = klassPtrSize;
     this.narrowOopBase = narrowOopBase;
     this.narrowOopShift = narrowOopShift;
+    this.narrowKlassBase = narrowKlassBase;
+    this.narrowKlassShift = narrowKlassShift;
   }
 
   /** May be called by subclasses if desired to initialize the page
@@ -464,6 +472,15 @@
     return value;
   }
 
+  protected long readCompKlassAddressValue(long address)
+    throws UnmappedAddressException, UnalignedAddressException {
+    long value = readCInteger(address, getKlassPtrSize(), true);
+    if (value != 0) {
+      value = (long)(narrowKlassBase + (long)(value << narrowKlassShift));
+    }
+    return value;
+  }
+
   protected void writeAddressValue(long address, long value)
     throws UnmappedAddressException, UnalignedAddressException {
     writeCInteger(address, machDesc.getAddressSize(), value);
@@ -551,4 +568,15 @@
   public int getNarrowOopShift() {
     return narrowOopShift;
   }
+
+  public long getKlassPtrSize() {
+    return klassPtrSize;
+  }
+
+  public long getNarrowKlassBase() {
+    return narrowKlassBase;
+  }
+  public int getNarrowKlassShift() {
+    return narrowKlassShift;
+  }
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/JVMDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/JVMDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -42,5 +42,7 @@
                                               long jintSize,
                                               long jlongSize,
                                               long jshortSize);
-  public void putHeapConst(long heapOopSize, long narrowOopBase, int narrowOopShift);
+  public void putHeapConst(long heapOopSize, long klassPtrSize,
+                           long narrowKlassBase, int narrowKlassShift,
+                           long narrowOopBase, int narrowOopShift);
 }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -79,6 +79,11 @@
         return debugger.readCompOopAddress(addr + offset);
     }
 
+    public Address getCompKlassAddressAt(long offset)
+            throws UnalignedAddressException, UnmappedAddressException {
+        return debugger.readCompOopAddress(addr + offset);
+    }
+
     //
     // Java-related routines
     //
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -46,6 +46,7 @@
     throws DebuggerException;
   public BsdAddress readAddress(long address) throws DebuggerException;
   public BsdAddress readCompOopAddress(long address) throws DebuggerException;
+  public BsdAddress readCompKlassAddress(long address) throws DebuggerException;
   public BsdOopHandle readOopHandle(long address) throws DebuggerException;
   public BsdOopHandle readCompOopHandle(long address) throws DebuggerException;
   public long[]       getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebuggerLocal.java	Thu Oct 18 22:01:26 2012 -0700
@@ -431,6 +431,12 @@
         return (value == 0 ? null : new BsdAddress(this, value));
     }
 
+    public BsdAddress readCompKlassAddress(long address)
+            throws UnmappedAddressException, UnalignedAddressException {
+        long value = readCompKlassAddressValue(address);
+        return (value == 0 ? null : new BsdAddress(this, value));
+    }
+
     /** From the BsdDebugger interface */
     public BsdOopHandle readOopHandle(long address)
             throws UnmappedAddressException, UnalignedAddressException,
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdThreadContextFactory.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dummy/DummyAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/dummy/DummyAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -80,6 +80,10 @@
     return new DummyAddress(debugger, badLong);
   }
 
+  public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
+    return new DummyAddress(debugger, badLong);
+  }
+
   //
   // Java-related routines
   //
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -79,6 +79,11 @@
         return debugger.readCompOopAddress(addr + offset);
     }
 
+    public Address getCompKlassAddressAt(long offset)
+            throws UnalignedAddressException, UnmappedAddressException {
+        return debugger.readCompKlassAddress(addr + offset);
+    }
+
     //
     // Java-related routines
     //
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -46,6 +46,7 @@
     throws DebuggerException;
   public LinuxAddress readAddress(long address) throws DebuggerException;
   public LinuxAddress readCompOopAddress(long address) throws DebuggerException;
+  public LinuxAddress readCompKlassAddress(long address) throws DebuggerException;
   public LinuxOopHandle readOopHandle(long address) throws DebuggerException;
   public LinuxOopHandle readCompOopHandle(long address) throws DebuggerException;
   public long[]       getThreadIntegerRegisterSet(int lwp_id) throws DebuggerException;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java	Thu Oct 18 22:01:26 2012 -0700
@@ -429,6 +429,12 @@
         return (value == 0 ? null : new LinuxAddress(this, value));
     }
 
+    public LinuxAddress readCompKlassAddress(long address)
+            throws UnmappedAddressException, UnalignedAddressException {
+        long value = readCompKlassAddressValue(address);
+        return (value == 0 ? null : new LinuxAddress(this, value));
+    }
+
     /** From the LinuxDebugger interface */
     public LinuxOopHandle readOopHandle(long address)
             throws UnmappedAddressException, UnalignedAddressException,
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -76,6 +76,10 @@
     return debugger.readCompOopAddress(addr + offset);
   }
 
+  public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
+    return debugger.readCompKlassAddress(addr + offset);
+  }
+
   //
   // Java-related routines
   //
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -47,6 +47,7 @@
     throws DebuggerException;
   public ProcAddress   readAddress(long address) throws DebuggerException;
   public ProcAddress   readCompOopAddress(long address) throws DebuggerException;
+  public ProcAddress   readCompKlassAddress(long address) throws DebuggerException;
   public ProcOopHandle readOopHandle(long address) throws DebuggerException;
   public ProcOopHandle readCompOopHandle(long address) throws DebuggerException;
   public long[]       getThreadIntegerRegisterSet(int tid) throws DebuggerException;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/proc/ProcDebuggerLocal.java	Thu Oct 18 22:01:26 2012 -0700
@@ -351,6 +351,12 @@
         return (value == 0 ? null : new ProcAddress(this, value));
     }
 
+    public ProcAddress readCompKlassAddress(long address)
+    throws UnmappedAddressException, UnalignedAddressException {
+        long value = readCompKlassAddressValue(address);
+        return (value == 0 ? null : new ProcAddress(this, value));
+    }
+
     /** From the ProcDebugger interface */
     public ProcOopHandle readOopHandle(long address)
     throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -74,6 +74,9 @@
   public Address getCompOopAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
     return debugger.readCompOopAddress(addr + offset);
   }
+  public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
+    return debugger.readCompKlassAddress(addr + offset);
+  }
 
   //
   // Java-related routines
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -68,6 +68,9 @@
   public long      getHeapOopSize() throws RemoteException;
   public long      getNarrowOopBase() throws RemoteException;
   public int       getNarrowOopShift() throws RemoteException;
+  public long      getKlassPtrSize() throws RemoteException;
+  public long      getNarrowKlassBase() throws RemoteException;
+  public int       getNarrowKlassShift() throws RemoteException;
 
   public boolean   areThreadsEqual(long addrOrId1, boolean isAddress1,
                                    long addrOrId2, boolean isAddress2) throws RemoteException;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerClient.java	Thu Oct 18 22:01:26 2012 -0700
@@ -99,7 +99,10 @@
       javaPrimitiveTypesConfigured = true;
       narrowOopBase  = remoteDebugger.getNarrowOopBase();
       narrowOopShift = remoteDebugger.getNarrowOopShift();
+      narrowKlassBase  = remoteDebugger.getNarrowKlassBase();
+      narrowKlassShift = remoteDebugger.getNarrowKlassShift();
       heapOopSize  = remoteDebugger.getHeapOopSize();
+      klassPtrSize  = remoteDebugger.getKlassPtrSize();
     }
     catch (RemoteException e) {
       throw new DebuggerException(e);
@@ -319,6 +322,12 @@
     return (value == 0 ? null : new RemoteAddress(this, value));
   }
 
+  RemoteAddress readCompKlassAddress(long address)
+    throws UnmappedAddressException, UnalignedAddressException {
+    long value = readCompKlassAddressValue(address);
+    return (value == 0 ? null : new RemoteAddress(this, value));
+  }
+
   RemoteOopHandle readOopHandle(long address)
     throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
     long value = readAddressValue(address);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerServer.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/remote/RemoteDebuggerServer.java	Thu Oct 18 22:01:26 2012 -0700
@@ -126,6 +126,18 @@
     return debugger.getNarrowOopShift();
   }
 
+  public long getKlassPtrSize() throws RemoteException {
+    return debugger.getHeapOopSize();
+  }
+
+  public long getNarrowKlassBase() throws RemoteException {
+    return debugger.getNarrowKlassBase();
+  }
+
+  public int  getNarrowKlassShift() throws RemoteException {
+    return debugger.getNarrowKlassShift();
+  }
+
   public boolean   areThreadsEqual(long addrOrId1, boolean isAddress1,
                                    long addrOrId2, boolean isAddress2) throws RemoteException {
     ThreadProxy t1 = getThreadProxy(addrOrId1, isAddress1);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgAddress.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgAddress.java	Thu Oct 18 22:01:26 2012 -0700
@@ -76,6 +76,10 @@
     return debugger.readCompOopAddress(addr + offset);
   }
 
+  public Address getCompKlassAddressAt(long offset) throws UnalignedAddressException, UnmappedAddressException {
+    return debugger.readCompKlassAddress(addr + offset);
+  }
+
   //
   // Java-related routines
   //
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebugger.java	Thu Oct 18 22:01:26 2012 -0700
@@ -46,6 +46,7 @@
     throws DebuggerException;
   public WindbgAddress readAddress(long address) throws DebuggerException;
   public WindbgAddress readCompOopAddress(long address) throws DebuggerException;
+  public WindbgAddress readCompKlassAddress(long address) throws DebuggerException;
   public WindbgOopHandle readOopHandle(long address) throws DebuggerException;
   public WindbgOopHandle readCompOopHandle(long address) throws DebuggerException;
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java	Thu Oct 18 22:01:26 2012 -0700
@@ -321,6 +321,11 @@
     return (WindbgAddress) newAddress(readCompOopAddressValue(address));
   }
 
+  public WindbgAddress readCompKlassAddress(long address)
+    throws UnmappedAddressException, UnalignedAddressException {
+    return (WindbgAddress) newAddress(readCompKlassAddressValue(address));
+  }
+
   /** From the WindbgDebugger interface */
   public WindbgOopHandle readOopHandle(long address)
     throws UnmappedAddressException, UnalignedAddressException, NotInHeapException {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java	Thu Oct 18 22:01:26 2012 -0700
@@ -53,6 +53,8 @@
 
   private static AddressField narrowOopBaseField;
   private static CIntegerField narrowOopShiftField;
+  private static AddressField narrowKlassBaseField;
+  private static CIntegerField narrowKlassShiftField;
 
   static {
     VM.registerVMInitializedObserver(new Observer() {
@@ -86,6 +88,8 @@
 
     narrowOopBaseField = type.getAddressField("_narrow_oop._base");
     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
+    narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
+    narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
   }
 
   public Universe() {
@@ -111,6 +115,19 @@
     return (int)narrowOopShiftField.getValue();
   }
 
+  public static long getNarrowKlassBase() {
+    if (narrowKlassBaseField.getValue() == null) {
+      return 0;
+    } else {
+      return narrowKlassBaseField.getValue().minus(null);
+    }
+  }
+
+  public static int getNarrowKlassShift() {
+    return (int)narrowKlassShiftField.getValue();
+  }
+
+
   /** Returns "TRUE" iff "p" points into the allocated area of the heap. */
   public boolean isIn(Address p) {
     return heap().isIn(p);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Array.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Array.java	Thu Oct 18 22:01:26 2012 -0700
@@ -59,7 +59,7 @@
     if (headerSize != 0) {
       return headerSize;
     }
-    if (VM.getVM().isCompressedHeadersEnabled()) {
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
       headerSize = typeSize;
     } else {
       headerSize = VM.getVM().alignUp(typeSize + VM.getVM().getIntSize(),
@@ -80,7 +80,7 @@
     if (lengthOffsetInBytes != 0) {
       return lengthOffsetInBytes;
     }
-    if (VM.getVM().isCompressedHeadersEnabled()) {
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
       lengthOffsetInBytes = typeSize - VM.getVM().getIntSize();
     } else {
       lengthOffsetInBytes = typeSize;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java	Thu Oct 18 22:01:26 2012 -0700
@@ -44,7 +44,7 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type          = db.lookupType("arrayKlass");
+    Type type          = db.lookupType("ArrayKlass");
     dimension          = new CIntField(type.getCIntegerField("_dimension"), 0);
     higherDimension    = new MetadataField(type.getAddressField("_higher_dimension"), 0);
     lowerDimension     = new MetadataField(type.getAddressField("_lower_dimension"), 0);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BranchData.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/BranchData.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CounterData.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/CounterData.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Instance.java	Thu Oct 18 22:01:26 2012 -0700
@@ -53,7 +53,7 @@
 
   // Returns header size in bytes.
   public static long getHeaderSize() {
-    if (VM.getVM().isCompressedHeadersEnabled()) {
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
       return typeSize - VM.getVM().getIntSize();
     } else {
       return typeSize;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/JumpData.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/JumpData.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Thu Oct 18 22:01:26 2012 -0700
@@ -188,11 +188,11 @@
   public Klass arrayKlassOrNull()         { return arrayKlassImpl(true);        }
 
   public Klass arrayKlassImpl(boolean orNull, int rank) {
-    throw new RuntimeException("array_klass should be dispatched to InstanceKlass, objArrayKlass or typeArrayKlass");
+    throw new RuntimeException("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
   }
 
   public Klass arrayKlassImpl(boolean orNull) {
-    throw new RuntimeException("array_klass should be dispatched to InstanceKlass, objArrayKlass or typeArrayKlass");
+    throw new RuntimeException("array_klass should be dispatched to InstanceKlass, ObjArrayKlass or TypeArrayKlass");
   }
 
   // This returns the name in the form java/lang/String which isn't really a signature
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Metadata.java	Thu Oct 18 22:01:26 2012 -0700
@@ -55,8 +55,8 @@
     metadataConstructor.addMapping("InstanceMirrorKlass", InstanceMirrorKlass.class);
     metadataConstructor.addMapping("InstanceRefKlass", InstanceRefKlass.class);
     metadataConstructor.addMapping("InstanceClassLoaderKlass", InstanceClassLoaderKlass.class);
-    metadataConstructor.addMapping("typeArrayKlass", TypeArrayKlass.class);
-    metadataConstructor.addMapping("objArrayKlass", ObjArrayKlass.class);
+    metadataConstructor.addMapping("TypeArrayKlass", TypeArrayKlass.class);
+    metadataConstructor.addMapping("ObjArrayKlass", ObjArrayKlass.class);
     metadataConstructor.addMapping("Method", Method.class);
     metadataConstructor.addMapping("MethodData", MethodData.class);
     metadataConstructor.addMapping("ConstMethod", ConstMethod.class);
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MetadataField.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MetadataField.java	Thu Oct 18 22:01:26 2012 -0700
@@ -27,7 +27,6 @@
 import sun.jvm.hotspot.runtime.VMObject;
 import sun.jvm.hotspot.debugger.*;
 
-// The class for an C int field simply provides access to the value.
 public class MetadataField extends Field {
 
   public MetadataField(sun.jvm.hotspot.types.AddressField vmField, long startOffset) {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MultiBranchData.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/MultiBranchData.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/NarrowKlassField.java	Thu Oct 18 22:01:26 2012 -0700
@@ -0,0 +1,41 @@
+/*
+ * 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 sun.jvm.hotspot.oops;
+
+import sun.jvm.hotspot.debugger.*;
+
+public class NarrowKlassField extends MetadataField {
+
+  public NarrowKlassField(sun.jvm.hotspot.types.AddressField vmField, long startOffset) {
+    super(vmField, startOffset);
+  }
+
+  public Metadata getValue(Address addr) {
+    return Metadata.instantiateWrapperFor(addr.getCompKlassAddressAt(getOffset()));
+  }
+  public void setValue(Oop obj, long value) throws MutationException {
+    // Fix this: set* missing in Address
+  }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java	Thu Oct 18 22:01:26 2012 -0700
@@ -43,7 +43,7 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type = db.lookupType("objArrayKlass");
+    Type type = db.lookupType("ObjArrayKlass");
     elementKlass = new MetadataField(type.getAddressField("_element_klass"), 0);
     bottomKlass  = new MetadataField(type.getAddressField("_bottom_klass"), 0);
   }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Oop.java	Thu Oct 18 22:01:26 2012 -0700
@@ -47,10 +47,7 @@
     Type type  = db.lookupType("oopDesc");
     mark       = new CIntField(type.getCIntegerField("_mark"), 0);
     klass      = new MetadataField(type.getAddressField("_metadata._klass"), 0);
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      // compressedKlass  = new CIntField(type.getCIntegerField("_metadata._compressed_klass"), 0);
-      throw new InternalError("unimplemented");
-    }
+    compressedKlass  = new NarrowKlassField(type.getAddressField("_metadata._compressed_klass"), 0);
     headerSize = type.getSize();
   }
 
@@ -74,13 +71,13 @@
 
   private static CIntField mark;
   private static MetadataField  klass;
-  private static CIntField compressedKlass;
+  private static NarrowKlassField compressedKlass;
 
   // Accessors for declared fields
   public Mark  getMark()   { return new Mark(getHandle()); }
   public Klass getKlass() {
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      throw new InternalError("unimplemented");
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
+      return (Klass)compressedKlass.getValue(getHandle());
     } else {
       return (Klass)klass.getValue(getHandle());
     }
@@ -150,7 +147,7 @@
   void iterateFields(OopVisitor visitor, boolean doVMFields) {
     if (doVMFields) {
       visitor.doCInt(mark, true);
-      if (VM.getVM().isCompressedHeadersEnabled()) {
+      if (VM.getVM().isCompressedKlassPointersEnabled()) {
         throw new InternalError("unimplemented");
       } else {
         visitor.doMetadata(klass, true);
@@ -210,8 +207,8 @@
     if (handle == null) {
       return null;
     }
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      throw new InternalError("Unimplemented");
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
+      return (Klass)Metadata.instantiateWrapperFor(handle.getCompKlassAddressAt(compressedKlass.getOffset()));
     } else {
       return (Klass)Metadata.instantiateWrapperFor(handle.getAddressAt(klass.getOffset()));
     }
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeArrayKlass.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/TypeArrayKlass.java	Thu Oct 18 22:01:26 2012 -0700
@@ -31,7 +31,7 @@
 import sun.jvm.hotspot.types.*;
 import sun.jvm.hotspot.utilities.*;
 
-// TypeArrayKlass is a proxy for typeArrayKlass in the JVM
+// TypeArrayKlass is a proxy for TypeArrayKlass in the JVM
 
 public class TypeArrayKlass extends ArrayKlass {
   static {
@@ -43,7 +43,7 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type t             = db.lookupType("typeArrayKlass");
+    Type t             = db.lookupType("TypeArrayKlass");
     maxLength          = new CIntField(t.getCIntegerField("_max_length"), 0);
   }
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/java_lang_Class.java	Thu Oct 18 22:01:26 2012 -0700
@@ -63,11 +63,7 @@
 
   /** get Klass* field at offset hc_klass_offset from a java.lang.Class object */
   public static Klass asKlass(Oop aClass) {
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      throw new InternalError("unimplemented");
-    } else {
-      return (Klass)Metadata.instantiateWrapperFor(aClass.getHandle().getAddressAt(klassOffset));
-    }
+    return (Klass)Metadata.instantiateWrapperFor(aClass.getHandle().getAddressAt(klassOffset));
   }
 
   /** get oop_size field at offset oop_size_offset from a java.lang.Class object */
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/Bytes.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Thu Oct 18 22:01:26 2012 -0700
@@ -103,6 +103,7 @@
   private int          logMinObjAlignmentInBytes;
   private int          heapWordSize;
   private int          heapOopSize;
+  private int          klassPtrSize;
   private int          oopSize;
   /** This is only present in a non-core build */
   private CodeCache    codeCache;
@@ -129,7 +130,7 @@
   private static CIntegerType boolType;
   private Boolean sharingEnabled;
   private Boolean compressedOopsEnabled;
-  private Boolean compressedHeadersEnabled;
+  private Boolean compressedKlassPointersEnabled;
 
   // command line flags supplied to VM - see struct Flag in globals.hpp
   public static final class Flag {
@@ -350,6 +351,12 @@
     } else {
       heapOopSize = (int)getOopSize();
     }
+
+    if (isCompressedKlassPointersEnabled()) {
+      klassPtrSize = (int)getIntSize();
+    } else {
+      klassPtrSize = (int)getOopSize(); // same as an oop
+    }
   }
 
   /** This could be used by a reflective runtime system */
@@ -374,8 +381,9 @@
       ((Observer) iter.next()).update(null, null);
     }
 
-    debugger.putHeapConst(soleInstance.getHeapOopSize(), Universe.getNarrowOopBase(),
-                          Universe.getNarrowOopShift());
+    debugger.putHeapConst(soleInstance.getHeapOopSize(), soleInstance.getKlassPtrSize(),
+                          Universe.getNarrowOopBase(), Universe.getNarrowOopShift(),
+                          Universe.getNarrowKlassBase(), Universe.getNarrowKlassShift());
   }
 
   /** This is used by the debugging system */
@@ -536,6 +544,10 @@
   public int getHeapOopSize() {
     return heapOopSize;
   }
+
+  public int getKlassPtrSize() {
+    return klassPtrSize;
+  }
   /** Utility routine for getting data structure alignment correct */
   public long alignUp(long size, long alignment) {
     return (size + alignment - 1) & ~(alignment - 1);
@@ -784,13 +796,13 @@
     return compressedOopsEnabled.booleanValue();
   }
 
-  public boolean isCompressedHeadersEnabled() {
-    if (compressedHeadersEnabled == null) {
-        Flag flag = getCommandLineFlag("UseCompressedHeaders");
-        compressedHeadersEnabled = (flag == null) ? Boolean.FALSE:
+  public boolean isCompressedKlassPointersEnabled() {
+    if (compressedKlassPointersEnabled == null) {
+        Flag flag = getCommandLineFlag("UseCompressedKlassPointers");
+        compressedKlassPointersEnabled = (flag == null) ? Boolean.FALSE:
              (flag.getBool()? Boolean.TRUE: Boolean.FALSE);
     }
-    return compressedHeadersEnabled.booleanValue();
+    return compressedKlassPointersEnabled.booleanValue();
   }
 
   public int getObjectAlignmentInBytes() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Thu Oct 18 22:01:26 2012 -0700
@@ -354,15 +354,14 @@
     }
 
     protected void writeFields() throws IOException {
-        U2Array fields = klass.getFields();
-        final int length = (int) fields.length();
+        final int javaFieldsCount = klass.getJavaFieldsCount();
 
         // write number of fields
-        dos.writeShort((short) length);
+        dos.writeShort((short) javaFieldsCount);
 
-        if (DEBUG) debugMessage("number of fields = " + length);
+        if (DEBUG) debugMessage("number of fields = " + javaFieldsCount);
 
-        for (int index = 0; index < length; index++) {
+        for (int index = 0; index < javaFieldsCount; index++) {
             short accessFlags    = klass.getFieldAccessFlags(index);
             dos.writeShort(accessFlags & (short) JVM_RECOGNIZED_FIELD_MODIFIERS);
 
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/BasicHashtable.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/BasicHashtable.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/BasicHashtableEntry.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/BasicHashtableEntry.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableBucket.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableBucket.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, 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/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/RobustOopDeterminator.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/RobustOopDeterminator.java	Thu Oct 18 22:01:26 2012 -0700
@@ -53,9 +53,8 @@
   private static void initialize(TypeDataBase db) {
     Type type = db.lookupType("oopDesc");
 
-    if (VM.getVM().isCompressedHeadersEnabled()) {
-      // klassField = type.getNarrowOopField("_metadata._compressed_klass");
-      throw new InternalError("unimplemented");
+    if (VM.getVM().isCompressedKlassPointersEnabled()) {
+      klassField = type.getAddressField("_metadata._compressed_klass");
     } else {
       klassField = type.getAddressField("_metadata._klass");
     }
@@ -70,7 +69,11 @@
     }
     try {
       // Try to instantiate the Klass
-      Metadata.instantiateWrapperFor(klassField.getValue(oop));
+      if (VM.getVM().isCompressedKlassPointersEnabled()) {
+        Metadata.instantiateWrapperFor(oop.getCompKlassAddressAt(klassField.getOffset()));
+      } else {
+        Metadata.instantiateWrapperFor(klassField.getValue(oop));
+      }
           return true;
         }
     catch (AddressException e) {
--- a/hotspot/agent/src/share/native/sadis.c	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/agent/src/share/native/sadis.c	Thu Oct 18 22:01:26 2012 -0700
@@ -46,7 +46,7 @@
 
 #else
 
-#include <strings.h>
+#include <string.h>
 #include <dlfcn.h>
 #include <link.h>
 
--- a/hotspot/make/Makefile	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/Makefile	Thu Oct 18 22:01:26 2012 -0700
@@ -76,6 +76,8 @@
 
 include $(GAMMADIR)/make/altsrc.make
 
+-include $(HS_ALT_MAKE)/Makefile.make
+
 ifneq ($(ALT_OUTPUTDIR),)
   ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR)
 else
@@ -88,16 +90,23 @@
 KERNEL_VM_TARGETS=productkernel fastdebugkernel optimizedkernel jvmgkernel
 ZERO_VM_TARGETS=productzero fastdebugzero optimizedzero jvmgzero
 SHARK_VM_TARGETS=productshark fastdebugshark optimizedshark jvmgshark
+MINIMAL1_VM_TARGETS=productminimal1 fastdebugminimal1 jvmgminimal1
 
-COMMON_VM_PRODUCT_TARGETS=product product1 productkernel docs export_product
-COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 fastdebugkernel docs export_fastdebug
-COMMON_VM_DEBUG_TARGETS=jvmg jvmg1 jvmgkernel docs export_debug
+COMMON_VM_PRODUCT_TARGETS=product product1 docs export_product
+COMMON_VM_FASTDEBUG_TARGETS=fastdebug fastdebug1 docs export_fastdebug
+COMMON_VM_DEBUG_TARGETS=jvmg jvmg1 docs export_debug
 
 # JDK directory list
 JDK_DIRS=bin include jre lib demo
 
 all:           all_product all_fastdebug
 
+ifeq ($(JVM_VARIANT_MINIMAL1),true)
+all_product:	productminimal1
+all_fastdebug:	fastdebugminimal1
+all_debug:	jvmgminimal1
+endif
+
 ifdef BUILD_CLIENT_ONLY
 all_product:   product1 docs export_product
 all_fastdebug: fastdebug1 docs export_fastdebug
@@ -114,7 +123,7 @@
 endif
 endif
 
-all_optimized: optimized optimized1 optimizedkernel docs export_optimized
+all_optimized: optimized optimized1 docs export_optimized
 
 allzero:           all_productzero all_fastdebugzero
 all_productzero:   productzero docs export_product
@@ -167,6 +176,11 @@
 	$(MAKE) BUILD_FLAVOR=$(@:%shark=%) VM_TARGET=$@ \
 	  generic_buildshark $(ALT_OUT)
 
+$(MINIMAL1_VM_TARGETS):
+	$(CD) $(GAMMADIR)/make; \
+	$(MAKE) BUILD_FLAVOR=$(@:%minimal1=%) VM_TARGET=$@ \
+	  generic_buildminimal1 $(ALT_OUT)
+
 # Build compiler1 (client) rule, different for platforms
 generic_build1:
 	$(MKDIR) -p $(OUTPUTDIR)
@@ -239,6 +253,27 @@
 		$(MAKE) -f $(ABS_OS_MAKEFILE) \
 			$(MAKE_ARGS) $(VM_TARGET) 
 
+generic_buildminimal1:
+ifeq ($(JVM_VARIANT_MINIMAL1),true)
+	$(MKDIR) -p $(OUTPUTDIR)
+  ifeq ($(ARCH_DATA_MODEL), 32)
+    ifeq ($(OSNAME),windows)
+	$(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" ;
+    else
+      ifeq ($(OSNAME),solaris)
+	$(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)" ;
+      else
+	$(CD) $(OUTPUTDIR); \
+	$(MAKE) -f $(ABS_OS_MAKEFILE) $(MAKE_ARGS) $(VM_TARGET) ;
+      endif
+    endif
+  else
+	    @$(ECHO) "No ($(VM_TARGET)) for $(OSNAME) ARCH_DATA_MODEL=$(ARCH_DATA_MODEL)"
+  endif
+else
+	@$(ECHO) "Error: trying to build a minimal target but JVM_VARIANT_MINIMAL1 is not true."
+endif
+
 # Export file rule
 generic_export: $(EXPORT_LIST)
 export_product:
@@ -287,6 +322,8 @@
 KERNEL_DIR=$(KERNEL_BASE_DIR)/$(VM_SUBDIR)
 ZERO_DIR=$(ZERO_BASE_DIR)/$(VM_SUBDIR)
 SHARK_DIR=$(SHARK_BASE_DIR)/$(VM_SUBDIR)
+MINIMAL1_BASE_DIR=$(OUTPUTDIR)/$(VM_PLATFORM)_minimal1
+MINIMAL1_DIR=$(MINIMAL1_BASE_DIR)/$(VM_SUBDIR)
 
 ifeq ($(JVM_VARIANT_SERVER), true)
     MISC_DIR=$(C2_DIR)
@@ -308,6 +345,10 @@
     MISC_DIR=$(ZERO_DIR)
     GEN_DIR=$(ZERO_BASE_DIR)/generated
 endif
+ifeq ($(JVM_VARIANT_MINIMAL1), true)
+    MISC_DIR=$(MINIMAL1_DIR)
+    GEN_DIR=$(MINIMAL1_BASE_DIR)/generated
+endif
 
 # Bin files (windows)
 ifeq ($(OSNAME),windows)
@@ -357,6 +398,16 @@
 	$(install-file)
 endif
 
+# Minimal JVM files always come from minimal area
+$(EXPORT_MINIMAL_DIR)/%.diz:  $(MINIMAL1_DIR)/%.diz
+	$(install-file)
+$(EXPORT_MINIMAL_DIR)/%.dll:  $(MINIMAL1_DIR)/%.dll
+	$(install-file)
+$(EXPORT_MINIMAL_DIR)/%.pdb:  $(MINIMAL1_DIR)/%.pdb
+	$(install-file)
+$(EXPORT_MINIMAL_DIR)/%.map:  $(MINIMAL1_DIR)/%.map
+	$(install-file)
+
 # Shared Library
 ifneq ($(OSNAME),windows)
     ifeq ($(JVM_VARIANT_SERVER), true)
@@ -411,6 +462,26 @@
         $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(ZERO_DIR)/%.$(LIBRARY_SUFFIX)
 		$(install-file)
     endif
+    ifeq ($(JVM_VARIANT_MINIMAL1), true)
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX):	$(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/%.$(LIBRARY_SUFFIX):	$(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/64/%.$(LIBRARY_SUFFIX):	$(MINIMAL1_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo:		$(MINIMAL1_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/%.debuginfo:		$(MINIMAL1_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/64/%.debuginfo:		$(MINIMAL1_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz:		$(MINIMAL1_DIR)/%.diz
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/%.diz:			$(MINIMAL1_DIR)/%.diz
+		$(install-file)
+        $(EXPORT_MINIMAL_DIR)/64/%.diz:			$(MINIMAL1_DIR)/%.diz
+		$(install-file)
+    endif
 endif
 
 # Jar file (sa-jdi.jar)
@@ -451,7 +522,7 @@
 	$(install-file)
 
 # Xusage file
-$(EXPORT_SERVER_DIR)/Xusage.txt $(EXPORT_CLIENT_DIR)/Xusage.txt $(EXPORT_KERNEL_DIR)/Xusage.txt: $(XUSAGE)
+$(EXPORT_SERVER_DIR)/Xusage.txt $(EXPORT_CLIENT_DIR)/Xusage.txt $(EXPORT_KERNEL_DIR)/Xusage.txt $(EXPORT_MINIMAL_DIR)/Xusage.txt: $(XUSAGE)
 	$(prep-target)
 	$(RM) $@.temp
 	$(SED) 's/\(separated by \)[;:]/\1$(PATH_SEP)/g' $< > $@.temp
@@ -467,6 +538,7 @@
 	$(RM) -r $(KERNEL_DIR)
 	$(RM) -r $(ZERO_DIR)
 	$(RM) -r $(SHARK_DIR)
+	$(RM) -r $(MINIMAL1_DIR)
 clean_export:
 	$(RM) -r $(EXPORT_PATH)
 clean_jdk:
@@ -574,10 +646,11 @@
 	@$(ECHO) "create_jdk:       Create JDK image, export all files into it"
 	@$(ECHO) "update_jdk:       Update JDK image with fresh exported files"
 	@$(ECHO) " "
-	@$(ECHO) "Others targets are:"
+	@$(ECHO) "Other targets are:"
 	@$(ECHO) "   $(C1_VM_TARGETS)"
 	@$(ECHO) "   $(C2_VM_TARGETS)"
 	@$(ECHO) "   $(KERNEL_VM_TARGETS)"
+	@$(ECHO) "   $(MINIMAL1_VM_TARGETS)"
 
 # Variable help (only common ones used by this workspace)
 variable_help: variable_help_intro variable_list variable_help_end
@@ -672,9 +745,10 @@
 include $(GAMMADIR)/make/jprt.gmk
 
 .PHONY: all world clobber clean help $(C1_VM_TARGETS) $(C2_VM_TARGETS) \
-        $(KERNEL_VM_TARGETS) \
-	generic_build1 generic_build2 generic_buildkernel generic_export \
+        $(KERNEL_VM_TARGETS) $(MINIMAL1_VM_TARGETS) \
+	generic_build1 generic_build2 generic_buildkernel generic_buildminimal1 generic_export \
 	export_product export_fastdebug export_debug export_optimized \
 	export_jdk_product export_jdk_fastdebug export_jdk_debug \
 	create_jdk copy_jdk update_jdk test_jdk \
-	copy_product_jdk copy_fastdebug_jdk copy_debug_jdk 
+	copy_product_jdk copy_fastdebug_jdk copy_debug_jdk  \
+	$(HS_ALT_MAKE)/Makefile.make
--- a/hotspot/make/bsd/Makefile	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/Makefile	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
@@ -175,6 +175,10 @@
 #       profiledshark   shark           <os>_<arch>_shark/profiled
 #       productshark    shark           <os>_<arch>_shark/product
 #
+#       fastdebugminimal1 minimal1      <os>_<arch>_minimal1/fastdebug
+#       jvmgminimal1      minimal1      <os>_<arch>_minimal1/jvmg
+#       productminimal1   minimal1      <os>_<arch>_minimal1/product
+#
 # What you get with each target:
 #
 # debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
@@ -199,6 +203,7 @@
 SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
 SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
+SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
@@ -206,6 +211,7 @@
 TARGETS_CORE      = $(addsuffix core,$(TARGETS))
 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
+TARGETS_MINIMAL1  = $(addsuffix minimal1,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX)
@@ -223,6 +229,7 @@
 	@echo "  $(TARGETS_CORE)"
 	@echo "  $(TARGETS_ZERO)"
 	@echo "  $(TARGETS_SHARK)"
+	@echo "  $(TARGETS_MINIMAL1)"
 
 checks: check_os_version check_j2se_version
 
@@ -281,6 +288,10 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH)
 
+$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE)
+	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
+	$(BUILDTREE) VARIANT=minimal1
+
 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
 
@@ -340,12 +351,22 @@
 	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
+$(TARGETS_MINIMAL1):  $(SUBDIRS_MINIMAL1)
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS)
+ifeq ($(TEST_IN_BUILD),true)
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && ./test_gamma
+endif
+ifdef INSTALL
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
+endif
+
 # Just build the tree, and nothing else:
 tree:      $(SUBDIRS_C2)
 tree1:     $(SUBDIRS_C1)
 treecore:  $(SUBDIRS_CORE)
 treezero:  $(SUBDIRS_ZERO)
 treeshark: $(SUBDIRS_SHARK)
+treeminimal1: $(SUBDIRS_MINIMAL1)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -367,17 +388,23 @@
 clean_docs:
 	rm -rf $(SUBDIR_DOCS)
 
-clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark:
+clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1:
 	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 
-clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_docs
+clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs
 
 include $(GAMMADIR)/make/cscope.make
 
+#
+# Include alternate Makefile if it exists.
+#
+-include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
+
 #-------------------------------------------------------------------------------
 
-.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK)
+.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1)
 .PHONY: tree tree1 treecore treezero treeshark
 .PHONY: all compiler1 compiler2 core zero shark
 .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs
 .PHONY: checks check_os_version check_j2se_version
+.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
--- a/hotspot/make/bsd/makefiles/adlc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/adlc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/bsd/makefiles/buildtree.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/buildtree.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2011, 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
@@ -60,6 +60,7 @@
 
 -include $(SPEC)
 include $(GAMMADIR)/make/scm.make
+include $(GAMMADIR)/make/defs.make
 include $(GAMMADIR)/make/altsrc.make
 
 
@@ -163,6 +164,13 @@
   endif
 endif
 
+# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK
+ifndef OPENJDK
+  ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
+    OPENJDK=true
+  endif
+endif
+
 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION=  JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 
 BUILDTREE	= \
@@ -195,6 +203,8 @@
 	sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \
 	echo; \
 	echo "GAMMADIR = $(GAMMADIR)"; \
+	echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \
+	echo "OSNAME = $(OSNAME)"; \
 	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
 	echo "SRCARCH = $(SRCARCH)"; \
 	echo "BUILDARCH = $(BUILDARCH)"; \
@@ -205,6 +215,7 @@
 	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
+	echo "OPENJDK = $(OPENJDK)"; \
 	echo; \
 	echo "# Used for platform dispatching"; \
 	echo "TARGET_DEFINES  = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
@@ -251,6 +262,7 @@
 	[ -n "$(SPEC)" ] && \
 	    echo "include $(SPEC)"; \
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
+	echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
 	) > $@
 
--- a/hotspot/make/bsd/makefiles/defs.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/defs.make	Thu Oct 18 22:01:26 2012 -0700
@@ -155,6 +155,7 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
+EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
 
 EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
 
@@ -168,6 +169,19 @@
   EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
 endif
 
+ifeq ($(JVM_VARIANT_MINIMAL1),true)
+  EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
+  EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
+
+  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+    ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz
+    else
+	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo
+    endif
+  endif 
+endif
+
 # Serviceability Binaries
 # No SA Support for PPC, IA64, ARM or zero
 ADD_SA_BINARIES/x86   = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
--- a/hotspot/make/bsd/makefiles/dtrace.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/dtrace.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, 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
@@ -114,21 +114,21 @@
 
 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
 $(JVMOFFS).h: $(GENOFFS)
-	$(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp; touch $@; \
+	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \
 	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
 	then rm -f $@; mv $@.tmp $@; \
 	else rm -f $@.tmp; \
 	fi
 
 $(JVMOFFS)Index.h: $(GENOFFS)
-	$(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp; touch $@; \
+	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \
 	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
 	then rm -f $@; mv $@.tmp $@; \
 	else rm -f $@.tmp; \
 	fi
 
 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
-	$(QUIETLY) DYLD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp; touch $@; \
+	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \
 	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
 	then rm -f $@; mv $@.tmp $@; \
 	else rm -f $@.tmp; \
--- a/hotspot/make/bsd/makefiles/gcc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/gcc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
@@ -151,11 +151,6 @@
   CFLAGS += -DCC_INTERP
 endif
 
-# Build for embedded targets
-ifdef JAVASE_EMBEDDED
-  CFLAGS += -DJAVASE_EMBEDDED
-endif
-
 # Keep temporary files (.ii, .s)
 ifdef NEED_ASM
   CFLAGS += -save-temps
@@ -186,20 +181,32 @@
   CFLAGS_WARN/os_bsd.o = $(CFLAGS_WARN/DEFAULT) -Wno-deprecated-declarations
 endif
 
+OPT_CFLAGS/SIZE=-Os
+OPT_CFLAGS/SPEED=-O3
+
+# Hotspot uses very unstrict aliasing turn this optimization off
+# This option is added to CFLAGS rather than OPT_CFLAGS
+# so that OPT_CFLAGS overrides get this option too.
+CFLAGS += -fno-strict-aliasing
 
 # The flags to use for an Optimized g++ build
 ifeq ($(OS_VENDOR), Darwin)
   # use -Os by default, unless -O3 can be proved to be worth the cost, as per policy
   # <http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port+Compilers>
-  OPT_CFLAGS += -Os
+  OPT_CFLAGS_DEFAULT ?= SIZE
 else
-  OPT_CFLAGS += -O3
+  OPT_CFLAGS_DEFAULT ?= SPEED
 endif
 
-# Hotspot uses very unstrict aliasing turn this optimization off
-OPT_CFLAGS += -fno-strict-aliasing
+ifdef OPT_CFLAGS
+  ifneq ("$(origin OPT_CFLAGS)", "command line")
+    $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
+  endif
+endif
 
-# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
+OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
+
+# The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp
 # if we use expensive-optimizations
 ifeq ($(BUILDARCH), ia64)
 OPT_CFLAGS += -fno-expensive-optimizations
--- a/hotspot/make/bsd/makefiles/ia64.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/ia64.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, 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
@@ -25,8 +25,6 @@
 #
 # IA64 only uses c++ based interpreter
 CFLAGS += -DCC_INTERP -D_LP64=1 -DVM_LITTLE_ENDIAN
-# Hotspot uses very unstrict aliasing turn this optimization off
-OPT_CFLAGS += -fno-strict-aliasing
 ifeq ($(VERSION),debug)
 ASM_FLAGS= -DDEBUG
 else
--- a/hotspot/make/bsd/makefiles/jvmg.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/jvmg.make	Thu Oct 18 22:01:26 2012 -0700
@@ -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
--- a/hotspot/make/bsd/makefiles/launcher.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/launcher.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/bsd/makefiles/minimal1.make	Thu Oct 18 22:01:26 2012 -0700
@@ -0,0 +1,46 @@
+#
+# 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.
+#  
+#
+
+TYPE=MINIMAL1
+
+INCLUDE_JVMTI ?= false
+INCLUDE_FPROF ?= false
+INCLUDE_VM_STRUCTS ?= false
+INCLUDE_JNI_CHECK ?= false
+INCLUDE_SERVICES ?= false
+INCLUDE_MANAGEMENT ?= false
+INCLUDE_ALTERNATE_GCS ?= false
+INCLUDE_NMT ?= false
+INCLUDE_CDS ?= false
+
+CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
+CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
+
+Src_Dirs/MINIMAL1 = $(CORE_PATHS) $(COMPILER1_PATHS)
+
+Src_Files_EXCLUDE/MINIMAL1 += $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+
+-include $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make
+
+.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make
--- a/hotspot/make/bsd/makefiles/product.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/product.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, 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
--- a/hotspot/make/bsd/makefiles/rules.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/rules.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, 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/hotspot/make/bsd/makefiles/sparcWorks.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/sparcWorks.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/bsd/makefiles/top.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/top.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/bsd/makefiles/vm.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/bsd/makefiles/vm.make	Thu Oct 18 22:01:26 2012 -0700
@@ -190,7 +190,7 @@
 ZERO_SPECIFIC_FILES      := zero
 
 # Always exclude these.
-Src_Files_EXCLUDE := jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
+Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
 
 # Exclude per type.
 Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
--- a/hotspot/make/defs.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/defs.make	Thu Oct 18 22:01:26 2012 -0700
@@ -22,6 +22,27 @@
 #  
 #
 
+# The common definitions for hotspot builds.
+
+# Optionally include SPEC file generated by configure.
+ifneq ($(SPEC),)
+  include $(SPEC)
+endif
+
+# Directory paths and user name
+# Unless GAMMADIR is set on the command line, search upward from
+# the current directory for a parent directory containing "src/share/vm".
+# If that fails, look for $GAMMADIR in the environment.
+# When the tree of subdirs is built, this setting is stored in each flags.make.
+GAMMADIR := $(shell until ([ -d dev ]&&echo $${GAMMADIR:-/GAMMADIR/}) || ([ -d src/share/vm ]&&pwd); do cd ..; done)
+HS_SRC_DIR=$(GAMMADIR)/src
+HS_MAKE_DIR=$(GAMMADIR)/make
+HS_BUILD_DIR=$(GAMMADIR)/build
+
+ifeq ($(USER),)
+  USER=$(USERNAME)
+endif
+
 ifeq ($(HS_ALT_MAKE),)
   ifneq ($(OPENJDK),true)
     HS_ALT_MAKE=$(GAMMADIR)/make/closed
@@ -30,12 +51,10 @@
   endif
 endif
 
-# The common definitions for hotspot builds.
-
-# Optionally include SPEC file generated by configure.
-ifneq ($(SPEC),)
-  include $(SPEC)
-endif
+#
+# Include alternate defs.make if it exists
+#
+-include $(HS_ALT_MAKE)/defs.make
 
 # Default to verbose build logs (show all compile lines):
 MAKE_VERBOSE=y
@@ -84,20 +103,6 @@
   endif
 endif
 
-# Directory paths and user name
-# Unless GAMMADIR is set on the command line, search upward from
-# the current directory for a parent directory containing "src/share/vm".
-# If that fails, look for $GAMMADIR in the environment.
-# When the tree of subdirs is built, this setting is stored in each flags.make.
-GAMMADIR := $(shell until ([ -d dev ]&&echo $${GAMMADIR:-/GAMMADIR/}) || ([ -d src/share/vm ]&&pwd); do cd ..; done)
-HS_SRC_DIR=$(GAMMADIR)/src
-HS_MAKE_DIR=$(GAMMADIR)/make
-HS_BUILD_DIR=$(GAMMADIR)/build
-
-ifeq ($(USER),)
-  USER=$(USERNAME)
-endif
-
 # hotspot version definitions
 include $(GAMMADIR)/make/hotspot_version
 
@@ -339,3 +344,4 @@
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jfr.h
 endif
 
+.PHONY: $(HS_ALT_MAKE)/defs.make
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/excludeSrc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -0,0 +1,110 @@
+#
+# 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.
+#  
+#
+ifeq ($(INCLUDE_JVMTI), false)
+      CXXFLAGS += -DINCLUDE_JVMTI=0
+      CFLAGS += -DINCLUDE_JVMTI=0
+
+      Src_Files_EXCLUDE += jvmtiGetLoadedClasses.cpp forte.cpp jvmtiThreadState.cpp jvmtiExtensions.cpp \
+	jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
+	jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
+	jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp
+endif
+
+ifeq ($(INCLUDE_FPROF), false)
+      CXXFLAGS += -DINCLUDE_FPROF=0
+      CFLAGS += -DINCLUDE_FPROF=0
+
+      Src_Files_EXCLUDE += fprofiler.cpp
+endif
+
+ifeq ($(INCLUDE_VM_STRUCTS), false)
+      CXXFLAGS += -DINCLUDE_VM_STRUCTS=0
+      CFLAGS += -DINCLUDE_VM_STRUCTS=0
+
+      Src_Files_EXCLUDE += vmStructs.cpp
+endif
+
+ifeq ($(INCLUDE_JNI_CHECK), false)
+      CXXFLAGS += -DINCLUDE_JNI_CHECK=0
+      CFLAGS += -DINCLUDE_JNI_CHECK=0
+
+      Src_Files_EXCLUDE += jniCheck.cpp
+endif
+
+ifeq ($(INCLUDE_SERVICES), false)
+      CXXFLAGS += -DINCLUDE_SERVICES=0
+      CFLAGS += -DINCLUDE_SERVICES=0
+
+      Src_Files_EXCLUDE += heapDumper.cpp heapInspection.cpp \
+	attachListener_linux.cpp attachListener.cpp
+endif
+
+ifeq ($(INCLUDE_MANAGEMENT), false)
+      CXXFLAGS += -DINCLUDE_MANAGEMENT=0
+      CFLAGS += -DINCLUDE_MANAGEMENT=0
+endif
+
+ifeq ($(INCLUDE_CDS), false)
+      CXXFLAGS += -DINCLUDE_CDS=0
+      CFLAGS += -DINCLUDE_CDS=0
+
+      Src_Files_EXCLUDE += metaspaceShared.cpp
+endif
+
+ifeq ($(INCLUDE_ALTERNATE_GCS), false)
+      CXXFLAGS += -DINCLUDE_ALTERNATE_GCS=0
+      CFLAGS += -DINCLUDE_ALTERNATE_GCS=0
+
+      CXXFLAGS += -DSERIALGC
+      CFLAGS += -DSERIALGC
+      Src_Files_EXCLUDE += \
+	binaryTreeDictionary.cpp cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \
+	cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp cmsPermGen.cpp compactibleFreeListSpace.cpp \
+	concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp freeBlockDictionary.cpp \
+	freeChunk.cpp freeList.cpp promotionInfo.cpp vmCMSOperations.cpp collectionSetChooser.cpp \
+	concurrentG1Refine.cpp concurrentG1RefineThread.cpp concurrentMark.cpp concurrentMarkThread.cpp \
+	dirtyCardQueue.cpp g1AllocRegion.cpp g1BlockOffsetTable.cpp g1CollectedHeap.cpp g1GCPhaseTimes.cpp \
+	g1CollectorPolicy.cpp g1ErgoVerbose.cpp g1_globals.cpp g1HRPrinter.cpp g1MarkSweep.cpp \
+	g1MMUTracker.cpp g1MonitoringSupport.cpp g1RemSet.cpp g1SATBCardTableModRefBS.cpp heapRegion.cpp \
+	heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp ptrQueue.cpp \
+	satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp adjoiningGenerations.cpp \
+	adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp cardTableExtension.cpp \
+	gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp parallelScavengeHeap.cpp parMarkBitMap.cpp \
+	pcTasks.cpp psAdaptiveSizePolicy.cpp psCompactionManager.cpp psGCAdaptivePolicyCounters.cpp \
+	psGenerationCounters.cpp psMarkSweep.cpp psMarkSweepDecorator.cpp psOldGen.cpp psParallelCompact.cpp \
+	psPermGen.cpp psPromotionLAB.cpp psPromotionManager.cpp psScavenge.cpp psTasks.cpp psVirtualspace.cpp \
+	psYoungGen.cpp vmPSOperations.cpp asParNewGeneration.cpp parCardTableModRefBS.cpp \
+	parGCAllocBuffer.cpp parNewGeneration.cpp mutableSpace.cpp gSpaceCounters.cpp allocationStats.cpp \
+	spaceCounters.cpp gcAdaptivePolicyCounters.cpp mutableNUMASpace.cpp immutableSpace.cpp \
+	immutableSpace.cpp g1MemoryPool.cpp psMemoryPool.cpp yieldWorkingGroup.cpp g1Log.cpp
+endif 
+
+ifeq ($(INCLUDE_NMT), false)
+      CXXFLAGS += -DINCLUDE_NMT=0
+      CFLAGS += -DINCLUDE_NMT=0
+
+      Src_Files_EXCLUDE += \
+	 memBaseline.cpp memPtr.cpp memRecorder.cpp memReporter.cpp memSnapshot.cpp memTrackWorker.cpp \
+	 memTracker.cpp nmtDCmd.cpp
+endif
--- a/hotspot/make/hotspot_version	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/hotspot_version	Thu Oct 18 22:01:26 2012 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=04
+HS_BUILD_NUMBER=05
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/linux/Makefile	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/Makefile	Thu Oct 18 22:01:26 2012 -0700
@@ -175,6 +175,10 @@
 #       profiledshark   shark           <os>_<arch>_shark/profiled
 #       productshark    shark           <os>_<arch>_shark/product
 #
+#       fastdebugminimal1 minimal1      <os>_<arch>_minimal1/fastdebug
+#       jvmgminimal1      minimal1      <os>_<arch>_minimal1/jvmg
+#       productminimal1   minimal1      <os>_<arch>_minimal1/product
+#
 # What you get with each target:
 #
 # debug*     - "thin" libjvm_g - debug info linked into the gamma_g launcher
@@ -199,6 +203,7 @@
 SUBDIRS_CORE      = $(addprefix $(OSNAME)_$(BUILDARCH)_core/,$(TARGETS))
 SUBDIRS_ZERO      = $(addprefix $(OSNAME)_$(VARIANTARCH)_zero/,$(TARGETS))
 SUBDIRS_SHARK     = $(addprefix $(OSNAME)_$(VARIANTARCH)_shark/,$(TARGETS))
+SUBDIRS_MINIMAL1  = $(addprefix $(OSNAME)_$(BUILDARCH)_minimal1/,$(TARGETS))
 
 TARGETS_C2        = $(TARGETS)
 TARGETS_C1        = $(addsuffix 1,$(TARGETS))
@@ -206,6 +211,7 @@
 TARGETS_CORE      = $(addsuffix core,$(TARGETS))
 TARGETS_ZERO      = $(addsuffix zero,$(TARGETS))
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
+TARGETS_MINIMAL1 =  $(addsuffix minimal1,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
 BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
@@ -224,6 +230,7 @@
 	@echo "  $(TARGETS_CORE)"
 	@echo "  $(TARGETS_ZERO)"
 	@echo "  $(TARGETS_SHARK)"
+	@echo "  $(TARGETS_MINIMAL1)"
 
 checks: check_os_version check_j2se_version
 
@@ -281,6 +288,11 @@
 	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
 	$(BUILDTREE) VARIANT=shark VARIANTARCH=$(VARIANTARCH)
 
+$(SUBDIRS_MINIMAL1): $(BUILDTREE_MAKE)
+	$(QUIETLY) $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/Makefile checks
+	$(BUILDTREE) VARIANT=minimal1
+
+
 platform_zero: $(GAMMADIR)/make/$(OSNAME)/platform_zero.in
 	$(SED) 's/@ZERO_ARCHDEF@/$(ZERO_ARCHDEF)/g;s/@ZERO_LIBARCH@/$(ZERO_LIBARCH)/g;' < $< > $@
 
@@ -340,12 +352,22 @@
 	cd $(OSNAME)_$(VARIANTARCH)_shark/$(patsubst %shark,%,$@) && $(MAKE) $(MFLAGS) install
 endif
 
+$(TARGETS_MINIMAL1):  $(SUBDIRS_MINIMAL1)
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS)
+ifeq ($(TEST_IN_BUILD),true)
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && ./test_gamma
+endif
+ifdef INSTALL
+	cd $(OSNAME)_$(BUILDARCH)_minimal1/$(patsubst %minimal1,%,$@) && $(MAKE) $(MFLAGS) install
+endif
+
 # Just build the tree, and nothing else:
 tree:      $(SUBDIRS_C2)
 tree1:     $(SUBDIRS_C1)
 treecore:  $(SUBDIRS_CORE)
 treezero:  $(SUBDIRS_ZERO)
 treeshark: $(SUBDIRS_SHARK)
+treeminimal1: $(SUBDIRS_MINIMAL1)
 
 # Doc target.  This is the same for all build options.
 #     Hence create a docs directory beside ...$(ARCH)_[...]
@@ -369,17 +391,23 @@
 clean_docs:
 	rm -rf $(SUBDIR_DOCS)
 
-clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark:
+clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark clean_minimal1:
 	rm -rf $(OSNAME)_$(BUILDARCH)_$(subst clean_,,$@)
 
-clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_docs
+clean:  clean_compiler2 clean_compiler1 clean_core clean_zero clean_shark clean_minimal1 clean_docs
 
 include $(GAMMADIR)/make/cscope.make
 
+#
+# Include alternate Makefile if it exists.
+#
+-include $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
+
 #-------------------------------------------------------------------------------
 
-.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK)
+.PHONY: $(TARGETS_C2) $(TARGETS_C1) $(TARGETS_CORE) $(TARGETS_ZERO) $(TARGETS_SHARK) $(TARGETS_MINIMAL1)
 .PHONY: tree tree1 treecore treezero treeshark
 .PHONY: all compiler1 compiler2 core zero shark
 .PHONY: clean clean_compiler1 clean_compiler2 clean_core clean_zero clean_shark docs clean_docs
 .PHONY: checks check_os_version check_j2se_version
+.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/Makefile.make
--- a/hotspot/make/linux/makefiles/buildtree.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/buildtree.make	Thu Oct 18 22:01:26 2012 -0700
@@ -57,6 +57,7 @@
 
 -include $(SPEC)
 include $(GAMMADIR)/make/scm.make
+include $(GAMMADIR)/make/defs.make
 include $(GAMMADIR)/make/altsrc.make
 
 
@@ -156,6 +157,13 @@
   endif
 endif
 
+# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK
+ifndef OPENJDK
+  ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
+    OPENJDK=true
+  endif
+endif
+
 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION=  JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 
 BUILDTREE	= \
@@ -188,6 +196,8 @@
 	sed -n '/=/s/^ */Platform_/p' < $(PLATFORM_FILE); \
 	echo; \
 	echo "GAMMADIR = $(GAMMADIR)"; \
+	echo "HS_ALT_MAKE = $(HS_ALT_MAKE)"; \
+	echo "OSNAME = $(OSNAME)"; \
 	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
 	echo "SRCARCH = $(SRCARCH)"; \
 	echo "BUILDARCH = $(BUILDARCH)"; \
@@ -198,6 +208,7 @@
 	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
+	echo "OPENJDK = $(OPENJDK)"; \
 	echo; \
 	echo "# Used for platform dispatching"; \
 	echo "TARGET_DEFINES  = -DTARGET_OS_FAMILY_\$$(Platform_os_family)"; \
@@ -254,6 +265,7 @@
 	[ -n "$(SPEC)" ] && \
 	    echo "include $(SPEC)"; \
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(VARIANT).make"; \
+	echo "include \$$(GAMMADIR)/make/excludeSrc.make"; \
 	echo "include \$$(GAMMADIR)/make/$(OS_FAMILY)/makefiles/$(COMPILER).make"; \
 	) > $@
 
--- a/hotspot/make/linux/makefiles/defs.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/defs.make	Thu Oct 18 22:01:26 2012 -0700
@@ -254,6 +254,7 @@
 endif
 EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
 EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
+EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
 
 EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/wb.jar
 
@@ -281,6 +282,19 @@
   endif 
 endif
 
+ifeq ($(JVM_VARIANT_MINIMAL1),true)
+  EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
+  EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
+
+  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+    ifeq ($(ZIP_DEBUGINFO_FILES),1)
+	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz
+    else
+	EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo
+    endif
+  endif 
+endif
+
 # Serviceability Binaries
 # No SA Support for PPC, IA64, ARM or zero
 ADD_SA_BINARIES/x86   = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
--- a/hotspot/make/linux/makefiles/dtrace.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/dtrace.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,6 @@
 #
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,3 +26,40 @@
 # Linux does not build jvm_db
 LIBJVM_DB =
 
+# Only OPENJDK builds test and support SDT probes currently.
+ifndef OPENJDK
+REASON = "This JDK does not support SDT probes"
+else
+
+# We need a recent GCC for the default
+ifeq "$(shell expr \( $(CC_VER_MAJOR) \>= 4 \) \& \( $(CC_VER_MINOR) \>= 4 \) )" "0"
+REASON = "gcc version is too old"
+else
+
+# But it does have a SystemTap dtrace compatible sys/sdt.h
+ifneq ($(ALT_SDT_H),)
+  SDT_H_FILE = $(ALT_SDT_H)
+else
+  SDT_H_FILE = /usr/include/sys/sdt.h
+endif
+DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE))
+REASON = "$(SDT_H_FILE) not found"
+
+ifneq ($(DTRACE_ENABLED),)
+  CFLAGS += -DDTRACE_ENABLED
+endif
+
+endif
+endif
+
+# Phony target used in vm.make build target to check whether enabled.
+.PHONY: dtraceCheck
+ifeq ($(DTRACE_ENABLED),)
+dtraceCheck:
+	$(QUIETLY) echo "**NOTICE** Dtrace support disabled: $(REASON)"
+else
+dtraceCheck:
+endif
+
+# It doesn't support HAVE_DTRACE_H though.
+
--- a/hotspot/make/linux/makefiles/gcc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/gcc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -116,11 +116,6 @@
   CFLAGS += -DCC_INTERP
 endif
 
-# Build for embedded targets
-ifdef JAVASE_EMBEDDED
-  CFLAGS += -DJAVASE_EMBEDDED
-endif
-
 # Keep temporary files (.ii, .s)
 ifdef NEED_ASM
   CFLAGS += -save-temps
@@ -146,10 +141,23 @@
 CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) 
 
 # The flags to use for an Optimized g++ build
-OPT_CFLAGS += -O3
+OPT_CFLAGS/SIZE=-Os
+OPT_CFLAGS/SPEED=-O3
 
 # Hotspot uses very unstrict aliasing turn this optimization off
-OPT_CFLAGS += -fno-strict-aliasing
+# This option is added to CFLAGS rather than OPT_CFLAGS
+# so that OPT_CFLAGS overrides get this option too.
+CFLAGS += -fno-strict-aliasing 
+
+OPT_CFLAGS_DEFAULT ?= SPEED
+
+ifdef OPT_CFLAGS
+  ifneq ("$(origin OPT_CFLAGS)", "command line")
+    $(error " Use OPT_EXTRAS instead of OPT_CFLAGS to add extra flags to OPT_CFLAGS.")
+  endif
+endif
+
+OPT_CFLAGS = $(OPT_CFLAGS/$(OPT_CFLAGS_DEFAULT)) $(OPT_EXTRAS)
 
 # The gcc compiler segv's on ia64 when compiling bytecodeInterpreter.cpp 
 # if we use expensive-optimizations
--- a/hotspot/make/linux/makefiles/ia64.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/ia64.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2008, 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
@@ -25,8 +25,6 @@
 #
 # IA64 only uses c++ based interpreter
 CFLAGS += -DCC_INTERP -D_LP64=1 -DVM_LITTLE_ENDIAN
-# Hotspot uses very unstrict aliasing turn this optimization off
-OPT_CFLAGS += -fno-strict-aliasing
 ifeq ($(VERSION),debug)
 ASM_FLAGS= -DDEBUG
 else
--- a/hotspot/make/linux/makefiles/launcher.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/launcher.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/make/linux/makefiles/minimal1.make	Thu Oct 18 22:01:26 2012 -0700
@@ -0,0 +1,46 @@
+#
+# 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.
+#  
+#
+
+TYPE=MINIMAL1
+
+INCLUDE_JVMTI ?= false
+INCLUDE_FPROF ?= false
+INCLUDE_VM_STRUCTS ?= false
+INCLUDE_JNI_CHECK ?= false
+INCLUDE_SERVICES ?= false
+INCLUDE_MANAGEMENT ?= false
+INCLUDE_ALTERNATE_GCS ?= false
+INCLUDE_NMT ?= false
+INCLUDE_CDS ?= false
+
+CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
+CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
+
+Src_Dirs/MINIMAL1 = $(CORE_PATHS) $(COMPILER1_PATHS)
+
+Src_Files_EXCLUDE/MINIMAL1 += $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
+
+-include $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make
+
+.PHONY: $(HS_ALT_MAKE)/$(OSNAME)/makefiles/minimal1.make
--- a/hotspot/make/linux/makefiles/ppc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/ppc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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/hotspot/make/linux/makefiles/product.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/product.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/linux/makefiles/rules.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/rules.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, 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/hotspot/make/linux/makefiles/sparcWorks.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/sparcWorks.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/linux/makefiles/top.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/top.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/linux/makefiles/vm.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/linux/makefiles/vm.make	Thu Oct 18 22:01:26 2012 -0700
@@ -192,7 +192,7 @@
 ZERO_SPECIFIC_FILES      := zero
 
 # Always exclude these.
-Src_Files_EXCLUDE := jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
+Src_Files_EXCLUDE += jsig.c jvmtiEnvRecommended.cpp jvmtiEnvStub.cpp
 
 # Exclude per type.
 Src_Files_EXCLUDE/CORE      := $(COMPILER1_SPECIFIC_FILES) $(COMPILER2_SPECIFIC_FILES) $(ZERO_SPECIFIC_FILES) $(SHARK_SPECIFIC_FILES) ciTypeFlow.cpp
@@ -387,7 +387,7 @@
 
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
 
 install: install_jvm install_jsig install_saproc
 
--- a/hotspot/make/solaris/makefiles/adlc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/adlc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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/hotspot/make/solaris/makefiles/buildtree.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/buildtree.make	Thu Oct 18 22:01:26 2012 -0700
@@ -148,6 +148,13 @@
   endif
 endif
 
+# if hotspot-only build and/or OPENJDK isn't passed down, need to set OPENJDK
+ifndef OPENJDK
+  ifneq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
+    OPENJDK=true
+  endif
+endif
+
 BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HS_BUILD_VER) HOTSPOT_BUILD_VERSION= JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) 
 
 BUILDTREE	= \
@@ -190,6 +197,7 @@
 	echo "SA_BUILD_VERSION = $(HS_BUILD_VER)"; \
 	echo "HOTSPOT_BUILD_USER = $(HOTSPOT_BUILD_USER)"; \
 	echo "HOTSPOT_VM_DISTRO = $(HOTSPOT_VM_DISTRO)"; \
+	echo "OPENJDK = $(OPENJDK)"; \
 	echo "$(LP64_SETTING/$(DATA_MODE))"; \
 	echo; \
 	echo "# Used for platform dispatching"; \
--- a/hotspot/make/solaris/makefiles/dtrace.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/dtrace.make	Thu Oct 18 22:01:26 2012 -0700
@@ -206,15 +206,15 @@
 
 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
 $(JVMOFFS).h: $(GENOFFS)
-	$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -header > $@.tmp
+	$(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp
 	$(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 
 $(JVMOFFS)Index.h: $(GENOFFS)
-	$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -index > $@.tmp
+	$(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp
 	$(QUIETLY)  $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 
 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
-	$(QUIETLY) LD_LIBRARY_PATH=. ./$(GENOFFS) -table > $@.tmp
+	$(QUIETLY) LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp
 	$(QUIETLY) $(CONDITIONALLY_UPDATE_JVMOFFS_TARGET)
 
 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
--- a/hotspot/make/solaris/makefiles/gcc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/gcc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2011, 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
--- a/hotspot/make/solaris/makefiles/jvmg.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/jvmg.make	Thu Oct 18 22:01:26 2012 -0700
@@ -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
--- a/hotspot/make/solaris/makefiles/optimized.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/optimized.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2010, 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
--- a/hotspot/make/solaris/makefiles/rules.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/rules.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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/hotspot/make/solaris/makefiles/top.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/solaris/makefiles/top.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1998, 2011, 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
--- a/hotspot/make/windows/build.bat	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/build.bat	Thu Oct 18 22:01:26 2012 -0700
@@ -1,6 +1,6 @@
 @echo off
 REM
-REM Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+REM Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 REM
 REM This code is free software; you can redistribute it and/or modify it
--- a/hotspot/make/windows/build_vm_def.sh	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/build_vm_def.sh	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 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/hotspot/make/windows/get_msc_ver.sh	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/get_msc_ver.sh	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, 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
--- a/hotspot/make/windows/makefiles/adlc.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/adlc.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, 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
--- a/hotspot/make/windows/makefiles/defs.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/defs.make	Thu Oct 18 22:01:26 2012 -0700
@@ -154,10 +154,9 @@
 # On 32 bit windows we build server, client and kernel, on 64 bit just server.
 ifeq ($(JVM_VARIANTS),)
   ifeq ($(ARCH_DATA_MODEL), 32)
-    JVM_VARIANTS:=client,server,kernel
+    JVM_VARIANTS:=client,server
     JVM_VARIANT_CLIENT:=true
     JVM_VARIANT_SERVER:=true
-    JVM_VARIANT_KERNEL:=true
   else
     JVM_VARIANTS:=server
     JVM_VARIANT_SERVER:=true
--- a/hotspot/make/windows/makefiles/launcher.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/launcher.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 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/hotspot/make/windows/makefiles/projectcreator.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/projectcreator.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/make/windows/makefiles/rules.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/rules.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2011, 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/hotspot/make/windows/makefiles/sanity.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/sanity.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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/hotspot/make/windows/makefiles/shared.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/shared.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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/hotspot/make/windows/makefiles/vm.make	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/makefiles/vm.make	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 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/hotspot/make/windows/projectfiles/common/Makefile	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/make/windows/projectfiles/common/Makefile	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2011, 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
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1641,6 +1641,21 @@
 
 }
 
+void  MacroAssembler::set_narrow_klass(Klass* k, Register d) {
+  assert(oop_recorder() != NULL, "this assembler needs an OopRecorder");
+  int klass_index = oop_recorder()->find_index(k);
+  RelocationHolder rspec = metadata_Relocation::spec(klass_index);
+  narrowOop encoded_k = oopDesc::encode_klass(k);
+
+  assert_not_delayed();
+  // 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) );
+  // Don't add relocation for 'add'. Do patching during 'sethi' processing.
+  add(d, low10(encoded_k), d);
+
+}
 
 void MacroAssembler::align(int modulus) {
   while (offset() % modulus != 0) nop();
@@ -4660,7 +4675,7 @@
   // if this changes, change that.
   if (UseCompressedKlassPointers) {
     lduw(src_oop, oopDesc::klass_offset_in_bytes(), klass);
-    decode_heap_oop_not_null(klass);
+    decode_klass_not_null(klass);
   } else {
     ld_ptr(src_oop, oopDesc::klass_offset_in_bytes(), klass);
   }
@@ -4669,7 +4684,7 @@
 void MacroAssembler::store_klass(Register klass, Register dst_oop) {
   if (UseCompressedKlassPointers) {
     assert(dst_oop != klass, "not enough registers");
-    encode_heap_oop_not_null(klass);
+    encode_klass_not_null(klass);
     st(klass, dst_oop, oopDesc::klass_offset_in_bytes());
   } else {
     st_ptr(klass, dst_oop, oopDesc::klass_offset_in_bytes());
@@ -4829,17 +4844,58 @@
   // pd_code_size_limit.
   // Also do not verify_oop as this is called by verify_oop.
   assert (UseCompressedOops, "must be compressed");
-  assert (Universe::heap() != NULL, "java heap should be initialized");
   assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
   sllx(src, LogMinObjAlignmentInBytes, dst);
   if (Universe::narrow_oop_base() != NULL)
     add(dst, G6_heapbase, dst);
 }
 
+void MacroAssembler::encode_klass_not_null(Register r) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  assert (UseCompressedKlassPointers, "must be compressed");
+  assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+  if (Universe::narrow_klass_base() != NULL)
+    sub(r, G6_heapbase, r);
+  srlx(r, LogKlassAlignmentInBytes, r);
+}
+
+void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  assert (UseCompressedKlassPointers, "must be compressed");
+  assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+  if (Universe::narrow_klass_base() == NULL) {
+    srlx(src, LogKlassAlignmentInBytes, dst);
+  } else {
+    sub(src, G6_heapbase, dst);
+    srlx(dst, LogKlassAlignmentInBytes, dst);
+  }
+}
+
+void  MacroAssembler::decode_klass_not_null(Register r) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  // Do not add assert code to this unless you change vtableStubs_sparc.cpp
+  // pd_code_size_limit.
+  assert (UseCompressedKlassPointers, "must be compressed");
+  assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+  sllx(r, LogKlassAlignmentInBytes, r);
+  if (Universe::narrow_klass_base() != NULL)
+    add(r, G6_heapbase, r);
+}
+
+void  MacroAssembler::decode_klass_not_null(Register src, Register dst) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  // Do not add assert code to this unless you change vtableStubs_sparc.cpp
+  // pd_code_size_limit.
+  assert (UseCompressedKlassPointers, "must be compressed");
+  assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+  sllx(src, LogKlassAlignmentInBytes, dst);
+  if (Universe::narrow_klass_base() != NULL)
+    add(dst, G6_heapbase, dst);
+}
+
 void MacroAssembler::reinit_heapbase() {
-  if (UseCompressedOops) {
-    // call indirectly to solve generation ordering problem
-    AddressLiteral base(Universe::narrow_oop_base_addr());
+  if (UseCompressedOops || UseCompressedKlassPointers) {
+    AddressLiteral base(Universe::narrow_ptrs_base_addr());
     load_ptr_contents(base, G6_heapbase);
   }
 }
--- a/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/assembler_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -2280,6 +2280,11 @@
   void encode_heap_oop_not_null(Register src, Register dst);
   void decode_heap_oop_not_null(Register src, Register dst);
 
+  void encode_klass_not_null(Register r);
+  void decode_klass_not_null(Register r);
+  void encode_klass_not_null(Register src, Register dst);
+  void decode_klass_not_null(Register src, Register dst);
+
   // Support for managing the JavaThread pointer (i.e.; the reference to
   // thread-local information).
   void get_thread();                                // load G2_thread
@@ -2409,6 +2414,7 @@
   inline void    set_metadata             (const AddressLiteral& obj_addr, Register d); // same as load_address
 
   void set_narrow_oop( jobject obj, Register d );
+  void set_narrow_klass( Klass* k, Register d );
 
   // nop padding
   void align(int modulus);
--- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_FrameMap_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -105,6 +105,11 @@
         if (src->is_address() && !src->is_stack() && (src->type() == T_OBJECT || src->type() == T_ARRAY)) return false;
       }
 
+      if (UseCompressedKlassPointers) {
+        if (src->is_address() && !src->is_stack() && src->type() == T_ADDRESS &&
+            src->as_address_ptr()->disp() == oopDesc::klass_offset_in_bytes()) return false;
+      }
+
       if (dst->is_register()) {
         if (src->is_address() && Assembler::is_simm13(src->as_address_ptr()->disp())) {
           return !PatchALot;
@@ -969,8 +974,18 @@
 #endif
         }
         break;
-      case T_METADATA:
-      case T_ADDRESS:  __ ld_ptr(base, offset, to_reg->as_register()); break;
+      case T_METADATA:  __ ld_ptr(base, offset, to_reg->as_register()); break;
+      case T_ADDRESS:
+#ifdef _LP64
+        if (offset == oopDesc::klass_offset_in_bytes() && UseCompressedKlassPointers) {
+          __ lduw(base, offset, to_reg->as_register());
+          __ decode_klass_not_null(to_reg->as_register());
+        } else
+#endif
+        {
+          __ ld_ptr(base, offset, to_reg->as_register());
+        }
+        break;
       case T_ARRAY : // fall through
       case T_OBJECT:
         {
@@ -2290,7 +2305,7 @@
         __ mov(length, len);
         __ load_klass(dst, tmp);
 
-        int ek_offset = in_bytes(objArrayKlass::element_klass_offset());
+        int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
         __ ld_ptr(tmp, ek_offset, super_k);
 
         int sco_offset = in_bytes(Klass::super_check_offset_offset());
@@ -2344,7 +2359,7 @@
     if (UseCompressedKlassPointers) {
       // tmp holds the default type. It currently comes uncompressed after the
       // load of a constant, so encode it.
-      __ encode_heap_oop(tmp);
+      __ encode_klass_not_null(tmp);
       // load the raw value of the dst klass, since we will be comparing
       // uncompressed values directly.
       __ lduw(dst, oopDesc::klass_offset_in_bytes(), tmp2);
@@ -2781,7 +2796,7 @@
     __ load_klass(value, klass_RInfo);
 
     // get instance klass
-    __ ld_ptr(Address(k_RInfo, objArrayKlass::element_klass_offset()), k_RInfo);
+    __ ld_ptr(Address(k_RInfo, ObjArrayKlass::element_klass_offset()), k_RInfo);
     // perform the fast part of the checking logic
     __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, O7, success_target, failure_target, NULL);
 
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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/hotspot/src/cpu/sparc/vm/c1_LinearScan_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_LinearScan_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
--- a/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -189,7 +189,7 @@
   if (UseCompressedKlassPointers) {
     // Save klass
     mov(klass, t1);
-    encode_heap_oop_not_null(t1);
+    encode_klass_not_null(t1);
     stw(t1, obj, oopDesc::klass_offset_in_bytes());
   } else {
     st_ptr(klass, obj, oopDesc::klass_offset_in_bytes());
--- a/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/interpreterGenerator_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -208,8 +208,6 @@
   Register O1_scratch    = O1;
   Register O4_param_size = O4;   // size of parameters
 
-  address code_start = __ pc();
-
   // here's where control starts out:
   __ align(CodeEntryAlignment);
   address entry_point = __ pc();
@@ -252,22 +250,9 @@
   // O4_first_arg_addr is live!
 
   if (TraceMethodHandles) {
-    const char* name = vmIntrinsics::name_at(iid);
-    if (*name == '_')  name += 1;
-    const size_t len = strlen(name) + 50;
-    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
-    const char* suffix = "";
-    if (vmIntrinsics::method_for(iid) == NULL ||
-        !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
-      if (is_signature_polymorphic_static(iid))
-        suffix = "/static";
-      else
-        suffix = "/private";
-    }
-    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
     if (O0_mh != noreg)
       __ mov(O0_mh, G3_method_handle);  // make stub happy
-    trace_method_handle(_masm, qname);
+    trace_method_handle_interpreter_entry(_masm, iid);
   }
 
   if (iid == vmIntrinsics::_invokeBasic) {
@@ -287,14 +272,6 @@
     generate_method_handle_dispatch(_masm, iid, O0_recv, G5_member, not_for_compiler_entry);
   }
 
-  if (PrintMethodHandleStubs) {
-    address code_end = __ pc();
-    tty->print_cr("--------");
-    tty->print_cr("method handle interpreter entry for %s", vmIntrinsics::name_at(iid));
-    Disassembler::decode(code_start, code_end);
-    tty->cr();
-  }
-
   return entry_point;
 }
 
--- a/hotspot/src/cpu/sparc/vm/methodHandles_sparc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/methodHandles_sparc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -58,5 +58,3 @@
                                   Register recv, Register method_temp,
                                   Register temp2, Register temp3,
                                   bool for_compiler_entry);
-
-  static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
--- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -97,8 +97,8 @@
     jint inst2;
     guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
     if (format() != 0) {
-      assert(type() == relocInfo::oop_type, "only narrow oops case");
-      jint np = oopDesc::encode_heap_oop((oop)x);
+      assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case");
+      jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : oopDesc::encode_klass((Klass*)x);
       inst &= ~Assembler::hi22(-1);
       inst |=  Assembler::hi22((intptr_t)np);
       if (verify_only) {
--- a/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad	Thu Oct 18 22:01:26 2012 -0700
@@ -557,9 +557,9 @@
     int entry_offset = InstanceKlass::vtable_start_offset() + vtable_index*vtableEntry::size();
     int v_off = entry_offset*wordSize + vtableEntry::method_offset_in_bytes();
     int klass_load_size;
-    if (UseCompressedOops && UseCompressedKlassPointers) {
+    if (UseCompressedKlassPointers) {
       assert(Universe::heap() != NULL, "java heap should be initialized");
-      if (Universe::narrow_oop_base() == NULL)
+      if (Universe::narrow_klass_base() == NULL)
         klass_load_size = 2*BytesPerInstWord; // see MacroAssembler::load_klass()
       else
         klass_load_size = 3*BytesPerInstWord;
@@ -1707,11 +1707,11 @@
 void MachUEPNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
   st->print_cr("\nUEP:");
 #ifdef    _LP64
-  if (UseCompressedOops) {
+  if (UseCompressedKlassPointers) {
     assert(Universe::heap() != NULL, "java heap should be initialized");
     st->print_cr("\tLDUW   [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check - compressed klass");
     st->print_cr("\tSLL    R_G5,3,R_G5");
-    if (Universe::narrow_oop_base() != NULL)
+    if (Universe::narrow_klass_base() != NULL)
       st->print_cr("\tADD    R_G5,R_G6_heap_base,R_G5");
   } else {
     st->print_cr("\tLDX    [R_O0 + oopDesc::klass_offset_in_bytes],R_G5\t! Inline cache check");
@@ -1942,6 +1942,12 @@
   return false;
 }
 
+bool Matcher::narrow_klass_use_complex_address() {
+  NOT_LP64(ShouldNotCallThis());
+  assert(UseCompressedKlassPointers, "only for compressed klass code");
+  return false;
+}
+
 // Is it better to copy float constants, or load them directly from memory?
 // Intel can load a float constant from a direct address, requiring no
 // extra registers.  Most RISCs will have to materialize an address into a
@@ -2602,9 +2608,9 @@
       int off = __ offset();
       __ load_klass(O0, G3_scratch);
       int klass_load_size;
-      if (UseCompressedOops && UseCompressedKlassPointers) {
+      if (UseCompressedKlassPointers) {
         assert(Universe::heap() != NULL, "java heap should be initialized");
-        if (Universe::narrow_oop_base() == NULL)
+        if (Universe::narrow_klass_base() == NULL)
           klass_load_size = 2*BytesPerInstWord;
         else
           klass_load_size = 3*BytesPerInstWord;
@@ -3610,6 +3616,15 @@
   interface(CONST_INTER);
 %}
 
+operand immNKlass()
+%{
+  match(ConNKlass);
+
+  op_cost(10);
+  format %{ %}
+  interface(CONST_INTER);
+%}
+
 // NULL Pointer Immediate
 operand immN0()
 %{
@@ -5870,8 +5885,8 @@
 %}
 
 // Load Unsigned Integer into a Long Register
-instruct loadUI2L(iRegL dst, memory mem) %{
-  match(Set dst (LoadUI2L mem));
+instruct loadUI2L(iRegL dst, memory mem, immL_32bits mask) %{
+  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
   ins_cost(MEMORY_REF_COST);
 
   size(4);
@@ -6159,6 +6174,17 @@
   ins_pipe(ialu_hi_lo_reg);
 %}
 
+instruct loadConNKlass(iRegN dst, immNKlass src) %{
+  match(Set dst src);
+  ins_cost(DEFAULT_COST * 3/2);
+  format %{ "SET    $src,$dst\t! compressed klass ptr" %}
+  ins_encode %{
+    Register dst = $dst$$Register;
+    __ set_narrow_klass((Klass*)$src$$constant, dst);
+  %}
+  ins_pipe(ialu_hi_lo_reg);
+%}
+
 // Materialize long value (predicated by immL_cheap).
 instruct loadConL_set64(iRegL dst, immL_cheap con, o7RegL tmp) %{
   match(Set dst con);
@@ -6475,6 +6501,25 @@
    ins_pipe(istore_mem_spORreg);
 %}
 
+instruct storeNKlass(memory dst, iRegN src) %{
+   match(Set dst (StoreNKlass dst src));
+   ins_cost(MEMORY_REF_COST);
+   size(4);
+
+   format %{ "STW    $src,$dst\t! compressed klass ptr" %}
+   ins_encode %{
+     Register base = as_Register($dst$$base);
+     Register index = as_Register($dst$$index);
+     Register src = $src$$Register;
+     if (index != G0) {
+       __ stw(src, base, index);
+     } else {
+       __ stw(src, base, $dst$$disp);
+     }
+   %}
+   ins_pipe(istore_mem_spORreg);
+%}
+
 instruct storeN0(memory dst, immN0 src) %{
    match(Set dst (StoreN dst src));
    ins_cost(MEMORY_REF_COST);
@@ -6582,6 +6627,23 @@
   ins_pipe(ialu_reg);
 %}
 
+instruct encodeKlass_not_null(iRegN dst, iRegP src) %{
+  match(Set dst (EncodePKlass src));
+  format %{ "encode_klass_not_null $src, $dst" %}
+  ins_encode %{
+    __ encode_klass_not_null($src$$Register, $dst$$Register);
+  %}
+  ins_pipe(ialu_reg);
+%}
+
+instruct decodeKlass_not_null(iRegP dst, iRegN src) %{
+  match(Set dst (DecodeNKlass src));
+  format %{ "decode_klass_not_null $src, $dst" %}
+  ins_encode %{
+    __ decode_klass_not_null($src$$Register, $dst$$Register);
+  %}
+  ins_pipe(ialu_reg);
+%}
 
 //----------MemBar Instructions-----------------------------------------------
 // Memory barrier flavors
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -3091,7 +3091,7 @@
     arraycopy_range_checks(src, src_pos, dst, dst_pos, length,
                            O5_temp, G4_dst_klass, L_failed);
 
-    // typeArrayKlass
+    // TypeArrayKlass
     //
     // src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize);
     // dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize);
@@ -3142,7 +3142,7 @@
     __ br(Assembler::always, false, Assembler::pt, entry_jlong_arraycopy);
     __ delayed()->signx(length, count); // length
 
-    // objArrayKlass
+    // ObjArrayKlass
   __ BIND(L_objArray);
     // live at this point:  G3_src_klass, G4_dst_klass, src[_pos], dst[_pos], length
 
@@ -3198,8 +3198,8 @@
       generate_type_check(G3_src_klass, sco_temp, G4_dst_klass,
                           O5_temp, L_plain_copy);
 
-      // Fetch destination element klass from the objArrayKlass header.
-      int ek_offset = in_bytes(objArrayKlass::element_klass_offset());
+      // Fetch destination element klass from the ObjArrayKlass header.
+      int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
 
       // the checkcast_copy loop needs two extra arguments:
       __ ld_ptr(G4_dst_klass, ek_offset, O4);   // dest elem klass
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -867,7 +867,7 @@
 
   // do fast instanceof cache test
 
-  __ ld_ptr(O4,     in_bytes(objArrayKlass::element_klass_offset()),  O4);
+  __ ld_ptr(O4,     in_bytes(ObjArrayKlass::element_klass_offset()),  O4);
 
   assert(Otos_i == O0, "just checking");
 
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -117,6 +117,7 @@
     // 32-bit oops don't make sense for the 64-bit VM on sparc
     // since the 32-bit VM has the same registers and smaller objects.
     Universe::set_narrow_oop_shift(LogMinObjAlignmentInBytes);
+    Universe::set_narrow_klass_shift(LogKlassAlignmentInBytes);
 #endif // _LP64
 #ifdef COMPILER2
     // Indirect branch is the same cost as direct
--- a/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -220,13 +220,13 @@
       const int basic = 5*BytesPerInstWord +
                         // shift;add for load_klass (only shift with zero heap based)
                         (UseCompressedKlassPointers ?
-                         ((Universe::narrow_oop_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
+                         ((Universe::narrow_klass_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
       return basic + slop;
     } else {
       const int basic = (28 LP64_ONLY(+ 6)) * BytesPerInstWord +
                         // shift;add for load_klass (only shift with zero heap based)
                         (UseCompressedKlassPointers ?
-                         ((Universe::narrow_oop_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
+                         ((Universe::narrow_klass_base() == NULL) ? BytesPerInstWord : 2*BytesPerInstWord) : 0);
       return (basic + slop);
     }
   }
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1170,26 +1170,11 @@
 // and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
 // The ZF is set if the compared values were equal, and cleared otherwise.
 void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
-  if (Atomics & 2) {
-     // caveat: no instructionmark, so this isn't relocatable.
-     // Emit a synthetic, non-atomic, CAS equivalent.
-     // Beware.  The synthetic form sets all ICCs, not just ZF.
-     // cmpxchg r,[m] is equivalent to rax, = CAS (m, rax, r)
-     cmpl(rax, adr);
-     movl(rax, adr);
-     if (reg != rax) {
-        Label L ;
-        jcc(Assembler::notEqual, L);
-        movl(adr, reg);
-        bind(L);
-     }
-  } else {
-     InstructionMark im(this);
-     prefix(adr, reg);
-     emit_byte(0x0F);
-     emit_byte(0xB1);
-     emit_operand(reg, adr);
-  }
+  InstructionMark im(this);
+  prefix(adr, reg);
+  emit_byte(0x0F);
+  emit_byte(0xB1);
+  emit_operand(reg, adr);
 }
 
 void Assembler::comisd(XMMRegister dst, Address src) {
@@ -1513,12 +1498,7 @@
 }
 
 void Assembler::lock() {
-  if (Atomics & 1) {
-     // Emit either nothing, a NOP, or a NOP: prefix
-     emit_byte(0x90) ;
-  } else {
-     emit_byte(0xF0);
-  }
+  emit_byte(0xF0);
 }
 
 void Assembler::lzcntl(Register dst, Register src) {
@@ -6936,7 +6916,7 @@
 #ifdef ASSERT
   // TraceBytecodes does not use r12 but saves it over the call, so don't verify
   // r12 is the heapbase.
-  LP64_ONLY(if (UseCompressedOops && !TraceBytecodes) verify_heapbase("call_VM_base");)
+  LP64_ONLY(if ((UseCompressedOops || UseCompressedKlassPointers) && !TraceBytecodes) verify_heapbase("call_VM_base: heap base corrupted?");)
 #endif // ASSERT
 
   assert(java_thread != oop_result  , "cannot use the same register for java_thread & oop_result");
@@ -10036,7 +10016,7 @@
 #ifdef _LP64
   if (UseCompressedKlassPointers) {
     movl(dst, Address(src, oopDesc::klass_offset_in_bytes()));
-    decode_heap_oop_not_null(dst);
+    decode_klass_not_null(dst);
   } else
 #endif
     movptr(dst, Address(src, oopDesc::klass_offset_in_bytes()));
@@ -10047,15 +10027,10 @@
   if (UseCompressedKlassPointers) {
     assert (Universe::heap() != NULL, "java heap should be initialized");
     movl(dst, Address(src, oopDesc::klass_offset_in_bytes()));
-    if (Universe::narrow_oop_shift() != 0) {
-      assert(LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
-      if (LogMinObjAlignmentInBytes == Address::times_8) {
-        movq(dst, Address(r12_heapbase, dst, Address::times_8, Klass::prototype_header_offset()));
-      } else {
-        // OK to use shift since we don't need to preserve flags.
-        shlq(dst, LogMinObjAlignmentInBytes);
-        movq(dst, Address(r12_heapbase, dst, Address::times_1, Klass::prototype_header_offset()));
-      }
+    if (Universe::narrow_klass_shift() != 0) {
+      assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+      assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?");
+      movq(dst, Address(r12_heapbase, dst, Address::times_8, Klass::prototype_header_offset()));
     } else {
       movq(dst, Address(dst, Klass::prototype_header_offset()));
     }
@@ -10070,7 +10045,7 @@
 void MacroAssembler::store_klass(Register dst, Register src) {
 #ifdef _LP64
   if (UseCompressedKlassPointers) {
-    encode_heap_oop_not_null(src);
+    encode_klass_not_null(src);
     movl(Address(dst, oopDesc::klass_offset_in_bytes()), src);
   } else
 #endif
@@ -10152,12 +10127,12 @@
 
 #ifdef ASSERT
 void MacroAssembler::verify_heapbase(const char* msg) {
-  assert (UseCompressedOops, "should be compressed");
+  assert (UseCompressedOops || UseCompressedKlassPointers, "should be compressed");
   assert (Universe::heap() != NULL, "java heap should be initialized");
   if (CheckCompressedOops) {
     Label ok;
     push(rscratch1); // cmpptr trashes rscratch1
-    cmpptr(r12_heapbase, ExternalAddress((address)Universe::narrow_oop_base_addr()));
+    cmpptr(r12_heapbase, ExternalAddress((address)Universe::narrow_ptrs_base_addr()));
     jcc(Assembler::equal, ok);
     STOP(msg);
     bind(ok);
@@ -10295,6 +10270,74 @@
   }
 }
 
+void MacroAssembler::encode_klass_not_null(Register r) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+#ifdef ASSERT
+  verify_heapbase("MacroAssembler::encode_klass_not_null: heap base corrupted?");
+#endif
+  if (Universe::narrow_klass_base() != NULL) {
+    subq(r, r12_heapbase);
+  }
+  if (Universe::narrow_klass_shift() != 0) {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+    shrq(r, LogKlassAlignmentInBytes);
+  }
+}
+
+void MacroAssembler::encode_klass_not_null(Register dst, Register src) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+#ifdef ASSERT
+  verify_heapbase("MacroAssembler::encode_klass_not_null2: heap base corrupted?");
+#endif
+  if (dst != src) {
+    movq(dst, src);
+  }
+  if (Universe::narrow_klass_base() != NULL) {
+    subq(dst, r12_heapbase);
+  }
+  if (Universe::narrow_klass_shift() != 0) {
+    assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+    shrq(dst, LogKlassAlignmentInBytes);
+  }
+}
+
+void  MacroAssembler::decode_klass_not_null(Register r) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  // Note: it will change flags
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  // Cannot assert, unverified entry point counts instructions (see .ad file)
+  // vtableStubs also counts instructions in pd_code_size_limit.
+  // Also do not verify_oop as this is called by verify_oop.
+  if (Universe::narrow_klass_shift() != 0) {
+    assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+    shlq(r, LogKlassAlignmentInBytes);
+    if (Universe::narrow_klass_base() != NULL) {
+      addq(r, r12_heapbase);
+    }
+  } else {
+    assert (Universe::narrow_klass_base() == NULL, "sanity");
+  }
+}
+
+void  MacroAssembler::decode_klass_not_null(Register dst, Register src) {
+  assert(Metaspace::is_initialized(), "metaspace should be initialized");
+  // Note: it will change flags
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  // Cannot assert, unverified entry point counts instructions (see .ad file)
+  // vtableStubs also counts instructions in pd_code_size_limit.
+  // Also do not verify_oop as this is called by verify_oop.
+  if (Universe::narrow_klass_shift() != 0) {
+    assert(LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
+    assert(LogKlassAlignmentInBytes == Address::times_8, "klass not aligned on 64bits?");
+    leaq(dst, Address(r12_heapbase, src, Address::times_8, 0));
+  } else {
+    assert (Universe::narrow_klass_base() == NULL, "sanity");
+    if (dst != src) {
+      movq(dst, src);
+    }
+  }
+}
+
 void  MacroAssembler::set_narrow_oop(Register dst, jobject obj) {
   assert (UseCompressedOops, "should only be used for compressed headers");
   assert (Universe::heap() != NULL, "java heap should be initialized");
@@ -10313,6 +10356,22 @@
   mov_narrow_oop(dst, oop_index, rspec);
 }
 
+void  MacroAssembler::set_narrow_klass(Register dst, Klass* k) {
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
+  int klass_index = oop_recorder()->find_index(k);
+  RelocationHolder rspec = metadata_Relocation::spec(klass_index);
+  mov_narrow_oop(dst, oopDesc::encode_klass(k), rspec);
+}
+
+void  MacroAssembler::set_narrow_klass(Address dst, Klass* k) {
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
+  int klass_index = oop_recorder()->find_index(k);
+  RelocationHolder rspec = metadata_Relocation::spec(klass_index);
+  mov_narrow_oop(dst, oopDesc::encode_klass(k), rspec);
+}
+
 void  MacroAssembler::cmp_narrow_oop(Register dst, jobject obj) {
   assert (UseCompressedOops, "should only be used for compressed headers");
   assert (Universe::heap() != NULL, "java heap should be initialized");
@@ -10331,9 +10390,25 @@
   Assembler::cmp_narrow_oop(dst, oop_index, rspec);
 }
 
+void  MacroAssembler::cmp_narrow_klass(Register dst, Klass* k) {
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
+  int klass_index = oop_recorder()->find_index(k);
+  RelocationHolder rspec = metadata_Relocation::spec(klass_index);
+  Assembler::cmp_narrow_oop(dst, oopDesc::encode_klass(k), rspec);
+}
+
+void  MacroAssembler::cmp_narrow_klass(Address dst, Klass* k) {
+  assert (UseCompressedKlassPointers, "should only be used for compressed headers");
+  assert (oop_recorder() != NULL, "this assembler needs an OopRecorder");
+  int klass_index = oop_recorder()->find_index(k);
+  RelocationHolder rspec = metadata_Relocation::spec(klass_index);
+  Assembler::cmp_narrow_oop(dst, oopDesc::encode_klass(k), rspec);
+}
+
 void MacroAssembler::reinit_heapbase() {
-  if (UseCompressedOops) {
-    movptr(r12_heapbase, ExternalAddress((address)Universe::narrow_oop_base_addr()));
+  if (UseCompressedOops || UseCompressedKlassPointers) {
+    movptr(r12_heapbase, ExternalAddress((address)Universe::narrow_ptrs_base_addr()));
   }
 }
 #endif // _LP64
@@ -10616,7 +10691,7 @@
         // Array header size is 12 bytes in 32-bit VM
         // + 6 bytes for 3 chars == 18 bytes,
         // enough space to load vec and shift.
-        assert(HeapWordSize*typeArrayKlass::header_size() >= 12,"sanity");
+        assert(HeapWordSize*TypeArrayKlass::header_size() >= 12,"sanity");
         movdqu(vec, Address(str2, (int_cnt2*2)-16));
         psrldq(vec, 16-(int_cnt2*2));
       }
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -2083,6 +2083,15 @@
   void cmp_narrow_oop(Register dst, jobject obj);
   void cmp_narrow_oop(Address dst, jobject obj);
 
+  void encode_klass_not_null(Register r);
+  void decode_klass_not_null(Register r);
+  void encode_klass_not_null(Register dst, Register src);
+  void decode_klass_not_null(Register dst, Register src);
+  void set_narrow_klass(Register dst, Klass* k);
+  void set_narrow_klass(Address dst, Klass* k);
+  void cmp_narrow_klass(Register dst, Klass* k);
+  void cmp_narrow_klass(Address dst, Klass* k);
+
   // if heap base register is used - reinit it with the correct value
   void reinit_heapbase();
 
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_FrameMap_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
@@ -148,7 +148,7 @@
 
   static int adjust_reg_range(int range) {
     // Reduce the number of available regs (to free r12) in case of compressed oops
-    if (UseCompressedOops) return range - 1;
+    if (UseCompressedOops || UseCompressedKlassPointers) return range - 1;
     return range;
   }
 
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -340,7 +340,7 @@
   Register receiver = FrameMap::receiver_opr->as_register();
   Register ic_klass = IC_Klass;
   const int ic_cmp_size = LP64_ONLY(10) NOT_LP64(9);
-  const bool do_post_padding = VerifyOops || UseCompressedOops;
+  const bool do_post_padding = VerifyOops || UseCompressedKlassPointers;
   if (!do_post_padding) {
     // insert some nops so that the verified entry point is aligned on CodeEntryAlignment
     while ((__ offset() + ic_cmp_size) % CodeEntryAlignment != 0) {
@@ -1262,7 +1262,11 @@
       break;
 
     case T_ADDRESS:
-      __ movptr(dest->as_register(), from_addr);
+      if (UseCompressedKlassPointers && addr->disp() == oopDesc::klass_offset_in_bytes()) {
+        __ movl(dest->as_register(), from_addr);
+      } else {
+        __ movptr(dest->as_register(), from_addr);
+      }
       break;
     case T_INT:
       __ movl(dest->as_register(), from_addr);
@@ -1364,6 +1368,12 @@
     }
 #endif
     __ verify_oop(dest->as_register());
+  } else if (type == T_ADDRESS && addr->disp() == oopDesc::klass_offset_in_bytes()) {
+#ifdef _LP64
+    if (UseCompressedKlassPointers) {
+      __ decode_klass_not_null(dest->as_register());
+    }
+#endif
   }
 }
 
@@ -1705,7 +1715,7 @@
   } else if (obj == klass_RInfo) {
     klass_RInfo = dst;
   }
-  if (k->is_loaded() && !UseCompressedOops) {
+  if (k->is_loaded() && !UseCompressedKlassPointers) {
     select_different_registers(obj, dst, k_RInfo, klass_RInfo);
   } else {
     Rtmp1 = op->tmp3()->as_register();
@@ -1881,7 +1891,7 @@
     __ load_klass(klass_RInfo, value);
 
     // get instance klass (it's already uncompressed)
-    __ movptr(k_RInfo, Address(k_RInfo, objArrayKlass::element_klass_offset()));
+    __ movptr(k_RInfo, Address(k_RInfo, ObjArrayKlass::element_klass_offset()));
     // perform the fast part of the checking logic
     __ check_klass_subtype_fast_path(klass_RInfo, k_RInfo, Rtmp1, success_target, failure_target, NULL);
     // call out-of-line instance of __ check_klass_subtype_slow_path(...):
@@ -3349,7 +3359,7 @@
 
 #ifndef _LP64
         __ movptr(tmp, dst_klass_addr);
-        __ movptr(tmp, Address(tmp, objArrayKlass::element_klass_offset()));
+        __ movptr(tmp, Address(tmp, ObjArrayKlass::element_klass_offset()));
         __ push(tmp);
         __ movl(tmp, Address(tmp, Klass::super_check_offset_offset()));
         __ push(tmp);
@@ -3375,14 +3385,14 @@
         // Allocate abi space for args but be sure to keep stack aligned
         __ subptr(rsp, 6*wordSize);
         __ load_klass(c_rarg3, dst);
-        __ movptr(c_rarg3, Address(c_rarg3, objArrayKlass::element_klass_offset()));
+        __ movptr(c_rarg3, Address(c_rarg3, ObjArrayKlass::element_klass_offset()));
         store_parameter(c_rarg3, 4);
         __ movl(c_rarg3, Address(c_rarg3, Klass::super_check_offset_offset()));
         __ call(RuntimeAddress(copyfunc_addr));
         __ addptr(rsp, 6*wordSize);
 #else
         __ load_klass(c_rarg4, dst);
-        __ movptr(c_rarg4, Address(c_rarg4, objArrayKlass::element_klass_offset()));
+        __ movptr(c_rarg4, Address(c_rarg4, ObjArrayKlass::element_klass_offset()));
         __ movl(c_rarg3, Address(c_rarg4, Klass::super_check_offset_offset()));
         __ call(RuntimeAddress(copyfunc_addr));
 #endif
@@ -3446,7 +3456,7 @@
     __ mov_metadata(tmp, default_type->constant_encoding());
 #ifdef _LP64
     if (UseCompressedKlassPointers) {
-      __ encode_heap_oop(tmp);
+      __ encode_klass_not_null(tmp);
     }
 #endif
 
--- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1166,7 +1166,7 @@
   }
   LIR_Opr reg = rlock_result(x);
   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
-  if (!x->klass()->is_loaded() || UseCompressedOops) {
+  if (!x->klass()->is_loaded() || UseCompressedKlassPointers) {
     tmp3 = new_register(objectType);
   }
   __ checkcast(reg, obj.result(), x->klass(),
@@ -1188,7 +1188,7 @@
   }
   obj.load_item();
   LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
-  if (!x->klass()->is_loaded() || UseCompressedOops) {
+  if (!x->klass()->is_loaded() || UseCompressedKlassPointers) {
     tmp3 = new_register(objectType);
   }
   __ instanceof(reg, obj.result(), x->klass(),
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
--- a/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -159,7 +159,7 @@
 #ifdef _LP64
   if (UseCompressedKlassPointers) { // Take care not to kill klass
     movptr(t1, klass);
-    encode_heap_oop_not_null(t1);
+    encode_klass_not_null(t1);
     movl(Address(obj, oopDesc::klass_offset_in_bytes()), t1);
   } else
 #endif
--- a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -209,8 +209,6 @@
   Register rcx_mh     = rcx;   // MH receiver; dies quickly and is recycled
   Register rbx_method = rbx;   // eventual target of this invocation
 
-  address code_start = __ pc();
-
   // here's where control starts out:
   __ align(CodeEntryAlignment);
   address entry_point = __ pc();
@@ -251,23 +249,7 @@
 
   // rdx_first_arg_addr is live!
 
-  if (TraceMethodHandles) {
-    const char* name = vmIntrinsics::name_at(iid);
-    if (*name == '_')  name += 1;
-    const size_t len = strlen(name) + 50;
-    char* qname = NEW_C_HEAP_ARRAY(char, len, mtInternal);
-    const char* suffix = "";
-    if (vmIntrinsics::method_for(iid) == NULL ||
-        !vmIntrinsics::method_for(iid)->access_flags().is_public()) {
-      if (is_signature_polymorphic_static(iid))
-        suffix = "/static";
-      else
-        suffix = "/private";
-    }
-    jio_snprintf(qname, len, "MethodHandle::interpreter_entry::%s%s", name, suffix);
-    // note: stub look for mh in rcx
-    trace_method_handle(_masm, qname);
-  }
+  trace_method_handle_interpreter_entry(_masm, iid);
 
   if (iid == vmIntrinsics::_invokeBasic) {
     generate_method_handle_dispatch(_masm, iid, rcx_mh, noreg, not_for_compiler_entry);
@@ -287,14 +269,6 @@
     generate_method_handle_dispatch(_masm, iid, rcx_recv, rbx_member, not_for_compiler_entry);
   }
 
-  if (PrintMethodHandleStubs) {
-    address code_end = __ pc();
-    tty->print_cr("--------");
-    tty->print_cr("method handle interpreter entry for %s", vmIntrinsics::name_at(iid));
-    Disassembler::decode(code_start, code_end);
-    tty->cr();
-  }
-
   return entry_point;
 }
 
--- a/hotspot/src/cpu/x86/vm/methodHandles_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/methodHandles_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -55,8 +55,6 @@
                                   Register temp2,
                                   bool for_compiler_entry);
 
-  static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN;
-
   static Register saved_last_sp_register() {
     // Should be in sharedRuntime, not here.
     return LP64_ONLY(r13) NOT_LP64(rsi);
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1801,7 +1801,7 @@
     assert_different_registers(src, src_pos, dst, dst_pos, rcx_lh);
     arraycopy_range_checks(src, src_pos, dst, dst_pos, LENGTH, L_failed);
 
-    // typeArrayKlass
+    // TypeArrayKlass
     //
     // src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize);
     // dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize);
@@ -1864,7 +1864,7 @@
     __ leave(); // required for proper stackwalking of RuntimeStub frame
     __ ret(0);
 
-    // objArrayKlass
+    // ObjArrayKlass
   __ BIND(L_objArray);
     // live at this point:  rcx_src_klass, src[_pos], dst[_pos]
 
@@ -1894,7 +1894,7 @@
     // live at this point:  rcx_src_klass, dst[_pos], src[_pos]
     {
       // Handy offsets:
-      int  ek_offset = in_bytes(objArrayKlass::element_klass_offset());
+      int  ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
       int sco_offset = in_bytes(Klass::super_check_offset_offset());
 
       Register rsi_dst_klass = rsi;
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -2604,7 +2604,7 @@
     arraycopy_range_checks(src, src_pos, dst, dst_pos, r11_length,
                            r10, L_failed);
 
-    // typeArrayKlass
+    // TypeArrayKlass
     //
     // src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize);
     // dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize);
@@ -2670,7 +2670,7 @@
     __ movl2ptr(count, r11_length); // length
     __ jump(RuntimeAddress(long_copy_entry));
 
-    // objArrayKlass
+    // ObjArrayKlass
   __ BIND(L_objArray);
     // live at this point:  r10_src_klass, r11_length, src[_pos], dst[_pos]
 
@@ -2723,8 +2723,8 @@
       assert_clean_int(sco_temp, rax);
       generate_type_check(r10_src_klass, sco_temp, r11_dst_klass, L_plain_copy);
 
-      // Fetch destination element klass from the objArrayKlass header.
-      int ek_offset = in_bytes(objArrayKlass::element_klass_offset());
+      // Fetch destination element klass from the ObjArrayKlass header.
+      int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
       __ movptr(r11_dst_klass, Address(r11_dst_klass, ek_offset));
       __ movl(  sco_temp,      Address(r11_dst_klass, sco_offset));
       assert_clean_int(sco_temp, rax);
--- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, 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/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -949,7 +949,7 @@
   __ load_klass(rbx, rax);
   // Move superklass into EAX
   __ load_klass(rax, rdx);
-  __ movptr(rax, Address(rax, objArrayKlass::element_klass_offset()));
+  __ movptr(rax, Address(rax, ObjArrayKlass::element_klass_offset()));
   // Compress array+index*wordSize+12 into a single register.  Frees ECX.
   __ lea(rdx, element_address);
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, 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
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -970,7 +970,7 @@
   // Move superklass into rax
   __ load_klass(rax, rdx);
   __ movptr(rax, Address(rax,
-                         objArrayKlass::element_klass_offset()));
+                         ObjArrayKlass::element_klass_offset()));
   // Compress array + index*oopSize + 12 into a single register.  Frees rcx.
   __ lea(rdx, element_address);
 
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -212,11 +212,11 @@
   if (is_vtable_stub) {
     // Vtable stub size
     return (DebugVtables ? 512 : 24) + (CountCompiledCalls ? 13 : 0) +
-           (UseCompressedOops ? 16 : 0);  // 1 leaq can be 3 bytes + 1 long
+           (UseCompressedKlassPointers ? 16 : 0);  // 1 leaq can be 3 bytes + 1 long
   } else {
     // Itable stub size
     return (DebugVtables ? 512 : 74) + (CountCompiledCalls ? 13 : 0) +
-           (UseCompressedOops ? 32 : 0);  // 2 leaqs
+           (UseCompressedKlassPointers ? 32 : 0);  // 2 leaqs
   }
   // In order to tune these parameters, run the JVM with VM options
   // +PrintMiscellaneous and +WizardMode to see information about
--- a/hotspot/src/cpu/x86/vm/x86_32.ad	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad	Thu Oct 18 22:01:26 2012 -0700
@@ -1424,6 +1424,11 @@
   return true;
 }
 
+bool Matcher::narrow_klass_use_complex_address() {
+  ShouldNotCallThis();
+  return true;
+}
+
 
 // Is it better to copy float constants, or load them directly from memory?
 // Intel can load a float constant from a direct address, requiring no
@@ -1553,9 +1558,6 @@
 // Returns true if the high 32 bits of the value is known to be zero.
 bool is_operand_hi32_zero(Node* n) {
   int opc = n->Opcode();
-  if (opc == Op_LoadUI2L) {
-    return true;
-  }
   if (opc == Op_AndL) {
     Node* o2 = n->in(2);
     if (o2->is_Con() && (o2->get_long() & 0xFFFFFFFF00000000LL) == 0LL) {
@@ -6147,8 +6149,8 @@
 %}
 
 // Load Unsigned Integer into Long Register
-instruct loadUI2L(eRegL dst, memory mem, eFlagsReg cr) %{
-  match(Set dst (LoadUI2L mem));
+instruct loadUI2L(eRegL dst, memory mem, immL_32bits mask, eFlagsReg cr) %{
+  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
   effect(KILL cr);
 
   ins_cost(250);
@@ -12145,8 +12147,8 @@
 
   ins_cost(1100);  // slightly larger than the next version
   format %{ "MOV    EDI,[$sub+Klass::secondary_supers]\n\t"
-            "MOV    ECX,[EDI+arrayKlass::length]\t# length to scan\n\t"
-            "ADD    EDI,arrayKlass::base_offset\t# Skip to start of data; set NZ in case count is zero\n\t"
+            "MOV    ECX,[EDI+ArrayKlass::length]\t# length to scan\n\t"
+            "ADD    EDI,ArrayKlass::base_offset\t# Skip to start of data; set NZ in case count is zero\n\t"
             "REPNE SCASD\t# Scan *EDI++ for a match with EAX while CX-- != 0\n\t"
             "JNE,s  miss\t\t# Missed: EDI not-zero\n\t"
             "MOV    [$sub+Klass::secondary_super_cache],$super\t# Hit: update cache\n\t"
@@ -12164,8 +12166,8 @@
 
   ins_cost(1000);
   format %{ "MOV    EDI,[$sub+Klass::secondary_supers]\n\t"
-            "MOV    ECX,[EDI+arrayKlass::length]\t# length to scan\n\t"
-            "ADD    EDI,arrayKlass::base_offset\t# Skip to start of data; set NZ in case count is zero\n\t"
+            "MOV    ECX,[EDI+ArrayKlass::length]\t# length to scan\n\t"
+            "ADD    EDI,ArrayKlass::base_offset\t# Skip to start of data; set NZ in case count is zero\n\t"
             "REPNE SCASD\t# Scan *EDI++ for a match with EAX while CX-- != 0\n\t"
             "JNE,s  miss\t\t# Missed: flags NZ\n\t"
             "MOV    [$sub+Klass::secondary_super_cache],$super\t# Hit: update cache, flags Z\n\t"
--- a/hotspot/src/cpu/x86/vm/x86_64.ad	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/x86/vm/x86_64.ad	Thu Oct 18 22:01:26 2012 -0700
@@ -1409,10 +1409,10 @@
 #ifndef PRODUCT
 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 {
-  if (UseCompressedOops) {
+  if (UseCompressedKlassPointers) {
     st->print_cr("movl    rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass");
-    if (Universe::narrow_oop_shift() != 0) {
-      st->print_cr("\tdecode_heap_oop_not_null rscratch1, rscratch1");
+    if (Universe::narrow_klass_shift() != 0) {
+      st->print_cr("\tdecode_klass_not_null rscratch1, rscratch1");
     }
     st->print_cr("\tcmpq    rax, rscratch1\t # Inline cache check");
   } else {
@@ -1428,7 +1428,7 @@
 {
   MacroAssembler masm(&cbuf);
   uint insts_size = cbuf.insts_size();
-  if (UseCompressedOops) {
+  if (UseCompressedKlassPointers) {
     masm.load_klass(rscratch1, j_rarg0);
     masm.cmpptr(rax, rscratch1);
   } else {
@@ -1576,6 +1576,11 @@
   return (LogMinObjAlignmentInBytes <= 3);
 }
 
+bool Matcher::narrow_klass_use_complex_address() {
+  assert(UseCompressedKlassPointers, "only for compressed klass code");
+  return (LogKlassAlignmentInBytes <= 3);
+}
+
 // Is it better to copy float constants, or load them directly from
 // memory?  Intel can load a float constant from a direct address,
 // requiring no extra registers.  Most RISCs will have to materialize
@@ -3139,6 +3144,14 @@
   interface(CONST_INTER);
 %}
 
+operand immNKlass() %{
+  match(ConNKlass);
+
+  op_cost(10);
+  format %{ %}
+  interface(CONST_INTER);
+%}
+
 // NULL Pointer Immediate
 operand immN0() %{
   predicate(n->get_narrowcon() == 0);
@@ -4038,6 +4051,145 @@
   %}
 %}
 
+operand indirectNarrowKlass(rRegN reg)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(DecodeNKlass reg);
+
+  format %{ "[$reg]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index(0x4);
+    scale(0x0);
+    disp(0x0);
+  %}
+%}
+
+operand indOffset8NarrowKlass(rRegN reg, immL8 off)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (DecodeNKlass reg) off);
+
+  format %{ "[$reg + $off (8-bit)]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index(0x4);
+    scale(0x0);
+    disp($off);
+  %}
+%}
+
+operand indOffset32NarrowKlass(rRegN reg, immL32 off)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (DecodeNKlass reg) off);
+
+  format %{ "[$reg + $off (32-bit)]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index(0x4);
+    scale(0x0);
+    disp($off);
+  %}
+%}
+
+operand indIndexOffsetNarrowKlass(rRegN reg, rRegL lreg, immL32 off)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (AddP (DecodeNKlass reg) lreg) off);
+
+  op_cost(10);
+  format %{"[$reg + $off + $lreg]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index($lreg);
+    scale(0x0);
+    disp($off);
+  %}
+%}
+
+operand indIndexNarrowKlass(rRegN reg, rRegL lreg)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (DecodeNKlass reg) lreg);
+
+  op_cost(10);
+  format %{"[$reg + $lreg]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index($lreg);
+    scale(0x0);
+    disp(0x0);
+  %}
+%}
+
+operand indIndexScaleNarrowKlass(rRegN reg, rRegL lreg, immI2 scale)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (DecodeNKlass reg) (LShiftL lreg scale));
+
+  op_cost(10);
+  format %{"[$reg + $lreg << $scale]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index($lreg);
+    scale($scale);
+    disp(0x0);
+  %}
+%}
+
+operand indIndexScaleOffsetNarrowKlass(rRegN reg, immL32 off, rRegL lreg, immI2 scale)
+%{
+  predicate(Universe::narrow_klass_shift() == 0);
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (AddP (DecodeNKlass reg) (LShiftL lreg scale)) off);
+
+  op_cost(10);
+  format %{"[$reg + $off + $lreg << $scale]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index($lreg);
+    scale($scale);
+    disp($off);
+  %}
+%}
+
+operand indCompressedKlassOffset(rRegN reg, immL32 off) %{
+  predicate(UseCompressedKlassPointers && (Universe::narrow_klass_shift() == Address::times_8));
+  constraint(ALLOC_IN_RC(ptr_reg));
+  match(AddP (DecodeNKlass reg) off);
+
+  op_cost(10);
+  format %{"[R12 + $reg << 3 + $off] (compressed klass addressing)" %}
+  interface(MEMORY_INTER) %{
+    base(0xc); // R12
+    index($reg);
+    scale(0x3);
+    disp($off);
+  %}
+%}
+
+operand indPosIndexScaleOffsetNarrowKlass(rRegN reg, immL32 off, rRegI idx, immI2 scale)
+%{
+  constraint(ALLOC_IN_RC(ptr_reg));
+  predicate(Universe::narrow_klass_shift() == 0 && n->in(2)->in(3)->in(1)->as_Type()->type()->is_long()->_lo >= 0);
+  match(AddP (AddP (DecodeNKlass reg) (LShiftL (ConvI2L idx) scale)) off);
+
+  op_cost(10);
+  format %{"[$reg + $off + $idx << $scale]" %}
+  interface(MEMORY_INTER) %{
+    base($reg);
+    index($idx);
+    scale($scale);
+    disp($off);
+  %}
+%}
 
 //----------Special Memory Operands--------------------------------------------
 // Stack Slot Operand - This operand is used for loading and storing temporary
@@ -4209,7 +4361,11 @@
                indCompressedOopOffset,
                indirectNarrow, indOffset8Narrow, indOffset32Narrow,
                indIndexOffsetNarrow, indIndexNarrow, indIndexScaleNarrow,
-               indIndexScaleOffsetNarrow, indPosIndexScaleOffsetNarrow);
+               indIndexScaleOffsetNarrow, indPosIndexScaleOffsetNarrow,
+               indCompressedKlassOffset,
+               indirectNarrowKlass, indOffset8NarrowKlass, indOffset32NarrowKlass,
+               indIndexOffsetNarrowKlass, indIndexNarrowKlass, indIndexScaleNarrowKlass,
+               indIndexScaleOffsetNarrowKlass, indPosIndexScaleOffsetNarrowKlass);
 
 //----------PIPELINE-----------------------------------------------------------
 // Rules which define the behavior of the target architectures pipeline.
@@ -5044,9 +5200,9 @@
 %}
 
 // Load Unsigned Integer into Long Register
-instruct loadUI2L(rRegL dst, memory mem)
-%{
-  match(Set dst (LoadUI2L mem));
+instruct loadUI2L(rRegL dst, memory mem, immL_32bits mask) 
+%{
+  match(Set dst (AndL (ConvI2L (LoadI mem)) mask));
 
   ins_cost(125);
   format %{ "movl    $dst, $mem\t# uint -> long" %}
@@ -5469,6 +5625,22 @@
   ins_pipe(ialu_reg_fat); // XXX
 %}
 
+instruct loadConNKlass(rRegN dst, immNKlass src) %{
+  match(Set dst src);
+
+  ins_cost(125);
+  format %{ "movl    $dst, $src\t# compressed klass ptr" %}
+  ins_encode %{
+    address con = (address)$src$$constant;
+    if (con == NULL) {
+      ShouldNotReachHere();
+    } else {
+      __ set_narrow_klass($dst$$Register, (Klass*)$src$$constant);
+    }
+  %}
+  ins_pipe(ialu_reg_fat); // XXX
+%}
+
 instruct loadConF0(regF dst, immF0 src)
 %{
   match(Set dst src);
@@ -5738,7 +5910,7 @@
 
 instruct storeImmP0(memory mem, immP0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreP mem zero));
 
   ins_cost(125); // XXX
@@ -5774,9 +5946,21 @@
   ins_pipe(ialu_mem_reg);
 %}
 
+instruct storeNKlass(memory mem, rRegN src)
+%{
+  match(Set mem (StoreNKlass mem src));
+
+  ins_cost(125); // XXX
+  format %{ "movl    $mem, $src\t# compressed klass ptr" %}
+  ins_encode %{
+    __ movl($mem$$Address, $src$$Register);
+  %}
+  ins_pipe(ialu_mem_reg);
+%}
+
 instruct storeImmN0(memory mem, immN0 zero)
 %{
-  predicate(Universe::narrow_oop_base() == NULL);
+  predicate(Universe::narrow_oop_base() == NULL && Universe::narrow_klass_base() == NULL);
   match(Set mem (StoreN mem zero));
 
   ins_cost(125); // XXX
@@ -5804,10 +5988,22 @@
   ins_pipe(ialu_mem_imm);
 %}
 
+instruct storeImmNKlass(memory mem, immNKlass src)
+%{
+  match(Set mem (StoreNKlass mem src));
+
+  ins_cost(150); // XXX
+  format %{ "movl    $mem, $src\t# compressed klass ptr" %}
+  ins_encode %{
+    __ set_narrow_klass($mem$$Address, (Klass*)$src$$constant);
+  %}
+  ins_pipe(ialu_mem_imm);
+%}
+
 // Store Integer Immediate
 instruct storeImmI0(memory mem, immI0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreI mem zero));
 
   ins_cost(125); // XXX
@@ -5832,7 +6028,7 @@
 // Store Long Immediate
 instruct storeImmL0(memory mem, immL0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreL mem zero));
 
   ins_cost(125); // XXX
@@ -5857,7 +6053,7 @@
 // Store Short/Char Immediate
 instruct storeImmC0(memory mem, immI0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreC mem zero));
 
   ins_cost(125); // XXX
@@ -5883,7 +6079,7 @@
 // Store Byte Immediate
 instruct storeImmB0(memory mem, immI0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreB mem zero));
 
   ins_cost(125); // XXX
@@ -5908,7 +6104,7 @@
 // Store CMS card-mark Immediate
 instruct storeImmCM0_reg(memory mem, immI0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreCM mem zero));
 
   ins_cost(125); // XXX
@@ -5946,7 +6142,7 @@
 // Store immediate Float value (it is faster than store from XMM register)
 instruct storeF0(memory mem, immF0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreF mem zero));
 
   ins_cost(25); // XXX
@@ -5996,7 +6192,7 @@
 
 instruct storeD0(memory mem, immD0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set mem (StoreD mem zero));
 
   ins_cost(25); // XXX
@@ -6482,6 +6678,32 @@
   ins_pipe(ialu_reg_long);
 %}
 
+instruct encodeKlass_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{
+  match(Set dst (EncodePKlass src));
+  effect(KILL cr);
+  format %{ "encode_heap_oop_not_null $dst,$src" %}
+  ins_encode %{
+    __ encode_klass_not_null($dst$$Register, $src$$Register);
+  %}
+  ins_pipe(ialu_reg_long);
+%}
+
+instruct decodeKlass_not_null(rRegP dst, rRegN src, rFlagsReg cr) %{
+  match(Set dst (DecodeNKlass src));
+  effect(KILL cr);
+  format %{ "decode_heap_oop_not_null $dst,$src" %}
+  ins_encode %{
+    Register s = $src$$Register;
+    Register d = $dst$$Register;
+    if (s != d) {
+      __ decode_klass_not_null(d, s);
+    } else {
+      __ decode_klass_not_null(d);
+    }
+  %}
+  ins_pipe(ialu_reg_long);
+%}
+
 
 //----------Conditional Move---------------------------------------------------
 // Jump
@@ -10452,7 +10674,7 @@
 
 instruct testP_mem_reg0(rFlagsReg cr, memory mem, immP0 zero)
 %{
-  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL));
+  predicate(UseCompressedOops && (Universe::narrow_oop_base() == NULL) && (Universe::narrow_klass_base() == NULL));
   match(Set cr (CmpP (LoadP mem) zero));
 
   format %{ "cmpq    R12, $mem\t# ptr (R12_heapbase==0)" %}
@@ -10503,6 +10725,27 @@
   ins_pipe(ialu_cr_reg_mem);
 %}
 
+instruct compN_rReg_imm_klass(rFlagsRegU cr, rRegN op1, immNKlass op2) %{
+  match(Set cr (CmpN op1 op2));
+
+  format %{ "cmpl    $op1, $op2\t# compressed klass ptr" %}
+  ins_encode %{
+    __ cmp_narrow_klass($op1$$Register, (Klass*)$op2$$constant);
+  %}
+  ins_pipe(ialu_cr_reg_imm);
+%}
+
+instruct compN_mem_imm_klass(rFlagsRegU cr, memory mem, immNKlass src)
+%{
+  match(Set cr (CmpN src (LoadNKlass mem)));
+
+  format %{ "cmpl    $mem, $src\t# compressed klass ptr" %}
+  ins_encode %{
+    __ cmp_narrow_klass($mem$$Address, (Klass*)$src$$constant);
+  %}
+  ins_pipe(ialu_cr_reg_mem);
+%}
+
 instruct testN_reg(rFlagsReg cr, rRegN src, immN0 zero) %{
   match(Set cr (CmpN src zero));
 
@@ -10526,7 +10769,7 @@
 
 instruct testN_mem_reg0(rFlagsReg cr, memory mem, immN0 zero)
 %{
-  predicate(Universe::narrow_oop_base() == NULL);
+  predicate(Universe::narrow_oop_base() == NULL && (Universe::narrow_klass_base() == NULL));
   match(Set cr (CmpN (LoadN mem) zero));
 
   format %{ "cmpl    R12, $mem\t# compressed ptr (R12_heapbase==0)" %}
--- a/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/zero/vm/interpreterGenerator_zero.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/cpu/zero/vm/methodHandles_zero.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/cpu/zero/vm/methodHandles_zero.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -267,8 +267,8 @@
 
   printf("\n");
 
-  GEN_OFFS(NarrowOopStruct, _base);
-  GEN_OFFS(NarrowOopStruct, _shift);
+  GEN_OFFS(NarrowPtrStruct, _base);
+  GEN_OFFS(NarrowPtrStruct, _shift);
   printf("\n");
 
   GEN_VALUE(SIZE_HeapBlockHeader, (int) sizeof(HeapBlock::Header));
--- a/hotspot/src/os/bsd/dtrace/jhelper.d	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/bsd/dtrace/jhelper.d	Thu Oct 18 22:01:26 2012 -0700
@@ -45,10 +45,6 @@
 
 extern pointer __1cJCodeCacheF_heap_;
 extern pointer __1cIUniverseO_collectedHeap_;
-extern pointer __1cIUniverseL_narrow_oop_;
-#ifdef _LP64
-extern pointer UseCompressedOops;
-#endif
 
 extern pointer __1cHnmethodG__vtbl_;
 extern pointer __1cNMethodG__vtbl_;
@@ -136,8 +132,8 @@
   copyin_offset(SIZE_oopDesc);
   copyin_offset(SIZE_ConstantPool);
 
-  copyin_offset(OFFSET_NarrowOopStruct_base);
-  copyin_offset(OFFSET_NarrowOopStruct_shift);
+  copyin_offset(OFFSET_NarrowPtrStruct_base);
+  copyin_offset(OFFSET_NarrowPtrStruct_shift);
 
   /*
    * The PC to translate is in arg0.
@@ -159,17 +155,6 @@
   this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
 
   /* Reading volatile values */
-#ifdef _LP64
-  this->Use_Compressed_Oops  = copyin_uint8(&``UseCompressedOops);
-#else
-  this->Use_Compressed_Oops  = 0;
-#endif
-
-  this->Universe_narrow_oop_base  = copyin_ptr(&``__1cIUniverseL_narrow_oop_ +
-                                               OFFSET_NarrowOopStruct_base);
-  this->Universe_narrow_oop_shift = copyin_int32(&``__1cIUniverseL_narrow_oop_ +
-                                                 OFFSET_NarrowOopStruct_shift);
-
   this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address + 
       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 
--- a/hotspot/src/os/bsd/vm/decoder_machO.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/bsd/vm/decoder_machO.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/os/bsd/vm/os_bsd.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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/hotspot/src/os/linux/vm/decoder_linux.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/linux/vm/decoder_linux.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/linux/vm/os_linux.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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/hotspot/src/os/linux/vm/vmError_linux.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/linux/vm/vmError_linux.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -44,7 +44,7 @@
     jio_snprintf(p, buflen - len,
                "\n\n"
                "Do you want to debug the problem?\n\n"
-               "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " INTX_FORMAT " (" INTPTR_FORMAT ")\n"
+               "To debug, run 'gdb /proc/%d/exe %d'; then switch to thread " UINTX_FORMAT " (" INTPTR_FORMAT ")\n"
                "Enter 'yes' to launch gdb automatically (PATH must include gdb)\n"
                "Otherwise, press RETURN to abort...",
                os::current_process_id(), os::current_process_id(),
--- a/hotspot/src/os/posix/launcher/java_md.c	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/posix/launcher/java_md.c	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os/posix/launcher/launcher.script	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/posix/launcher/launcher.script	Thu Oct 18 22:01:26 2012 -0700
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 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/hotspot/src/os/posix/vm/os_posix.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os/posix/vm/os_posix.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/posix/vm/os_posix.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -262,8 +262,8 @@
 
   printf("\n");
 
-  GEN_OFFS(NarrowOopStruct, _base);
-  GEN_OFFS(NarrowOopStruct, _shift);
+  GEN_OFFS(NarrowPtrStruct, _base);
+  GEN_OFFS(NarrowPtrStruct, _shift);
   printf("\n");
 
   GEN_VALUE(SIZE_HeapBlockHeader, sizeof(HeapBlock::Header));
--- a/hotspot/src/os/solaris/dtrace/hs_private.d	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/hs_private.d	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 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
--- a/hotspot/src/os/solaris/dtrace/jhelper.d	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/dtrace/jhelper.d	Thu Oct 18 22:01:26 2012 -0700
@@ -45,10 +45,6 @@
 
 extern pointer __1cJCodeCacheF_heap_;
 extern pointer __1cIUniverseO_collectedHeap_;
-extern pointer __1cIUniverseL_narrow_oop_;
-#ifdef _LP64
-extern pointer UseCompressedOops;
-#endif
 
 extern pointer __1cHnmethodG__vtbl_;
 extern pointer __1cGMethodG__vtbl_;
@@ -136,8 +132,8 @@
   copyin_offset(SIZE_oopDesc);
   copyin_offset(SIZE_ConstantPool);
 
-  copyin_offset(OFFSET_NarrowOopStruct_base);
-  copyin_offset(OFFSET_NarrowOopStruct_shift);
+  copyin_offset(OFFSET_NarrowPtrStruct_base);
+  copyin_offset(OFFSET_NarrowPtrStruct_shift);
 
   /*
    * The PC to translate is in arg0.
@@ -158,18 +154,6 @@
 
   this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
 
-  /* Reading volatile values */
-#ifdef _LP64
-  this->Use_Compressed_Oops  = copyin_uint8(&``UseCompressedOops);
-#else
-  this->Use_Compressed_Oops  = 0;
-#endif
-
-  this->Universe_narrow_oop_base  = copyin_ptr(&``__1cIUniverseL_narrow_oop_ +
-                                               OFFSET_NarrowOopStruct_base);
-  this->Universe_narrow_oop_shift = copyin_int32(&``__1cIUniverseL_narrow_oop_ +
-                                                 OFFSET_NarrowOopStruct_shift);
-
   this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address + 
       OFFSET_CodeHeap_memory + OFFSET_VirtualSpace_low);
 
--- a/hotspot/src/os/solaris/vm/attachListener_solaris.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/attachListener_solaris.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
--- a/hotspot/src/os/solaris/vm/decoder_solaris.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/decoder_solaris.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -5870,15 +5870,6 @@
   }
 }
 
-// Just to get the Kernel build to link on solaris for testing.
-
-extern "C" {
-class ASGCT_CallTrace;
-void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext)
-  KERNEL_RETURN;
-}
-
-
 // ObjectMonitor park-unpark infrastructure ...
 //
 // We implement Solaris and Linux PlatformEvents with the
--- a/hotspot/src/os/solaris/vm/os_solaris.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/solaris/vm/os_solaris.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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/hotspot/src/os/windows/vm/decoder_windows.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/windows/vm/decoder_windows.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/windows/vm/decoder_windows.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/windows/vm/decoder_windows.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/os/windows/vm/jvm_windows.h	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/windows/vm/jvm_windows.h	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, 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
@@ -61,8 +61,6 @@
 
 typedef int socklen_t;
 
-// #include "jni.h"
-
 #define JNI_ONLOAD_SYMBOLS      {"_JNI_OnLoad@8", "JNI_OnLoad"}
 #define JNI_ONUNLOAD_SYMBOLS    {"_JNI_OnUnload@8", "JNI_OnUnload"}
 #define JVM_ONLOAD_SYMBOLS      {"_JVM_OnLoad@12", "JVM_OnLoad"}
@@ -108,10 +106,7 @@
  * File I/O
  */
 
-// #include <sys/types.h>
-// #include <sys/stat.h>
-// #include <fcntl.h>
-// #include <errno.h>
+#include <sys/stat.h>
 
 /* O Flags */
 
--- a/hotspot/src/os/windows/vm/os_windows.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/windows/vm/os_windows.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/os_bsd_x86.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/os_solaris_x86.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2011, 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/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2004, 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/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.inline.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.inline.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/tools/ProjectCreator/ProjectCreator.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/share/tools/ProjectCreator/Util.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/tools/ProjectCreator/Util.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatform.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
--- a/hotspot/src/share/vm/adlc/adlparse.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/adlparse.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1392,7 +1392,7 @@
       _AD.addForm(machnode);
     }
     else if (!strcmp(ident, "attributes")) {
-      bool vsi_seen = false, bhds_seen = false;
+      bool vsi_seen = false;
 
       skipws();
       if ( (_curchar != '%')
@@ -1436,7 +1436,6 @@
           }
 
           pipeline->_branchHasDelaySlot = true;
-          bhds_seen = true;
           continue;
         }
 
@@ -1639,6 +1638,12 @@
     next_char();                   // Skip "(" or ","
     ident = get_ident();           // Grab next identifier
 
+    if (_AD._adl_debug > 1) {
+      if (ident != NULL) {
+        fprintf(stderr, "resource_parse: identifier: %s\n", ident);
+      }
+    }
+
     if (ident == NULL) {
       parse_err(SYNERR, "keyword identifier expected at \"%c\"\n", _curchar);
       return;
@@ -2427,7 +2432,6 @@
   int        lparen = 0;          // keep track of parenthesis nesting depth
   int        rparen = 0;          // position of instruction at this depth
   InstructForm *inst_seen  = NULL;
-  InstructForm *child_seen = NULL;
 
   // Walk the match tree,
   // Record <parent, position, instruction name, input position>
@@ -2437,7 +2441,7 @@
     if (_curchar == '(') {
       ++lparen;
       next_char();
-      child_seen = peep_match_child_parse(match, parent, position, rparen);
+      ( void ) peep_match_child_parse(match, parent, position, rparen);
     }
     // Right paren signals end of an input, may be more
     else if (_curchar == ')') {
@@ -3154,6 +3158,9 @@
 
 
 //------------------------------size_parse-----------------------------------
+// Parse a 'size(<expr>)' attribute which specifies the size of the
+// emitted instructions in bytes. <expr> can be a C++ expression,
+// e.g. a constant.
 char* ADLParser::size_parse(InstructForm *instr) {
   char* sizeOfInstr = NULL;
 
@@ -4274,7 +4281,17 @@
             || ((c >= '0') && (c <= '9'))
             || ((c == '_')) || ((c == ':')) || ((c == '#')) );
   if (start == end) {             // We popped out on the first try
-    parse_err(SYNERR, "identifier expected at %c\n", c);
+    // It can occur that `start' contains the rest of the input file.
+    // In this case the output should be truncated.
+    if (strlen(start) > 24) {
+      char buf[32];
+      strncpy(buf, start, 20);
+      buf[20] = '\0';
+      strcat(buf, "[...]");
+      parse_err(SYNERR, "Identifier expected, but found '%s'.", buf);
+    } else {
+      parse_err(SYNERR, "Identifier expected, but found '%s'.", start);
+    }
     start = NULL;
   }
   else {
--- a/hotspot/src/share/vm/adlc/archDesc.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/archDesc.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -221,6 +221,7 @@
       _register = NULL;
       _encode = NULL;
       _pipeline = NULL;
+      _frame = NULL;
 }
 
 ArchDesc::~ArchDesc() {
@@ -648,7 +649,10 @@
 // Return the textual binding for a given CPP flag name.
 // Return NULL if there is no binding, or it has been #undef-ed.
 char* ArchDesc::get_preproc_def(const char* flag) {
-  SourceForm* deff = (SourceForm*) _preproc_table[flag];
+  // In case of syntax errors, flag may take the value NULL.
+  SourceForm* deff = NULL;
+  if (flag != NULL)
+    deff = (SourceForm*) _preproc_table[flag];
   return (deff == NULL) ? NULL : deff->_code;
 }
 
@@ -803,7 +807,9 @@
     while (i++ <= 15)  fputc(' ', errfile);
     fprintf(errfile, "%-8s:", pref);
     vfprintf(errfile, fmt, args);
-    fprintf(errfile, "\n"); }
+    fprintf(errfile, "\n");
+    fflush(errfile);
+  }
   return 1;
 }
 
@@ -855,8 +861,14 @@
 
   // Check constraints on result's register class
   const char *result_class = opForm.constrained_reg_class();
-  if (!result_class) opForm.dump();
-  assert( result_class, "Resulting register class was not defined for operand");
+  if (result_class == NULL) {
+    opForm.dump();
+    syntax_err(opForm._linenum,
+               "Use of an undefined result class for operand: %s",
+               opForm._ident);
+    abort();
+  }
+
   regMask = reg_class_to_reg_mask( result_class );
 
   return regMask;
@@ -865,8 +877,14 @@
 // Obtain the name of the RegMask for an InstructForm
 const char *ArchDesc::reg_mask(InstructForm &inForm) {
   const char *result = inForm.reduce_result();
-  assert( result,
-          "Did not find result operand or RegMask for this instruction");
+
+  if (result == NULL) {
+    syntax_err(inForm._linenum,
+               "Did not find result operand or RegMask"
+               " for this instruction: %s",
+               inForm._ident);
+    abort();
+  }
 
   // Instructions producing 'Universe' use RegMask::Empty
   if( strcmp(result,"Universe")==0 ) {
@@ -875,10 +893,17 @@
 
   // Lookup this result operand and get its register class
   Form *form = (Form*)_globalNames[result];
-  assert( form, "Result operand must be defined");
+  if (form == NULL) {
+    syntax_err(inForm._linenum,
+               "Did not find result operand for result: %s", result);
+    abort();
+  }
   OperandForm *oper = form->is_operand();
-  if (oper == NULL) form->dump();
-  assert( oper, "Result must be an OperandForm");
+  if (oper == NULL) {
+    syntax_err(inForm._linenum, "Form is not an OperandForm:");
+    form->dump();
+    abort();
+  }
   return reg_mask( *oper );
 }
 
@@ -887,7 +912,13 @@
 char *ArchDesc::stack_or_reg_mask(OperandForm  &opForm) {
   // name of cisc_spillable version
   const char *reg_mask_name = reg_mask(opForm);
-  assert( reg_mask_name != NULL, "called with incorrect opForm");
+
+  if (reg_mask_name == NULL) {
+     syntax_err(opForm._linenum,
+                "Did not find reg_mask for opForm: %s",
+                opForm._ident);
+     abort();
+  }
 
   const char *stack_or = "STACK_OR_";
   int   length         = (int)strlen(stack_or) + (int)strlen(reg_mask_name) + 1;
@@ -968,7 +999,8 @@
   // Create InstructForm and assign type for each ideal instruction.
   for ( int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
     char         *ident    = (char *)NodeClassNames[j];
-    if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") || !strcmp(ident, "ConN") ||
+    if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
+       !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
        !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
        !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
        !strcmp(ident, "Bool") ) {
--- a/hotspot/src/share/vm/adlc/archDesc.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/archDesc.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -365,13 +365,14 @@
 // A derived class defines the appropriate output for a specific mapping.
 class OutputMap {
 protected:
-  FILE     *_hpp;
-  FILE     *_cpp;
-  FormDict &_globals;
-  ArchDesc &_AD;
+  FILE       *_hpp;
+  FILE       *_cpp;
+  FormDict   &_globals;
+  ArchDesc   &_AD;
+  const char *_name;
 public:
-  OutputMap (FILE *decl_file, FILE *def_file, FormDict &globals, ArchDesc &AD)
-    : _hpp(decl_file), _cpp(def_file), _globals(globals), _AD(AD) {};
+  OutputMap (FILE *decl_file, FILE *def_file, FormDict &globals, ArchDesc &AD, const char *name)
+    : _hpp(decl_file), _cpp(def_file), _globals(globals), _AD(AD), _name(name) {};
   // Access files used by this routine
   FILE        *decl_file() { return _hpp; }
   FILE        *def_file()  { return _cpp; }
--- a/hotspot/src/share/vm/adlc/dict2.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/dict2.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -33,7 +33,7 @@
 // String hash tables
 #define MAXID 20
 static char initflag = 0;       // True after 1st initialization
-static char shft[MAXID] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6};
+static char shft[MAXID + 1] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7};
 static short xsum[MAXID];
 
 //------------------------------bucket---------------------------------------
--- a/hotspot/src/share/vm/adlc/filebuff.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/filebuff.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -31,10 +31,14 @@
 using namespace std;
 
 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
-typedef struct {
+
+class BufferedFile {
+ public:
   const char *_name;
   FILE *_fp;
-} BufferedFile;
+  inline BufferedFile() { _name = NULL; _fp = NULL; };
+  inline ~BufferedFile() {};
+};
 
 class ArchDesc;
 
--- a/hotspot/src/share/vm/adlc/forms.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/forms.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -215,6 +215,7 @@
   if (strcmp(name,"ConI")==0) return Form::idealI;
   if (strcmp(name,"ConP")==0) return Form::idealP;
   if (strcmp(name,"ConN")==0) return Form::idealN;
+  if (strcmp(name,"ConNKlass")==0) return Form::idealNKlass;
   if (strcmp(name,"ConL")==0) return Form::idealL;
   if (strcmp(name,"ConF")==0) return Form::idealF;
   if (strcmp(name,"ConD")==0) return Form::idealD;
@@ -255,9 +256,8 @@
   if( strcmp(opType,"LoadD_unaligned")==0 )  return Form::idealD;
   if( strcmp(opType,"LoadF")==0 )  return Form::idealF;
   if( strcmp(opType,"LoadI")==0 )  return Form::idealI;
-  if( strcmp(opType,"LoadUI2L")==0 )  return Form::idealI;
   if( strcmp(opType,"LoadKlass")==0 )  return Form::idealP;
-  if( strcmp(opType,"LoadNKlass")==0 ) return Form::idealN;
+  if( strcmp(opType,"LoadNKlass")==0 ) return Form::idealNKlass;
   if( strcmp(opType,"LoadL")==0 )  return Form::idealL;
   if( strcmp(opType,"LoadL_unaligned")==0 )  return Form::idealL;
   if( strcmp(opType,"LoadPLocked")==0 )  return Form::idealP;
@@ -280,6 +280,7 @@
   if( strcmp(opType,"StoreL")==0)  return Form::idealL;
   if( strcmp(opType,"StoreP")==0)  return Form::idealP;
   if( strcmp(opType,"StoreN")==0)  return Form::idealN;
+  if( strcmp(opType,"StoreNKlass")==0)  return Form::idealNKlass;
   if( strcmp(opType,"StoreVector")==0 )  return Form::idealV;
   assert( strcmp(opType,"Store") != 0, "Must type Stores" );
   return Form::none;
--- a/hotspot/src/share/vm/adlc/forms.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/forms.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -173,7 +173,8 @@
     idealC      =  7,  // Char    type
     idealS      =  8,  // String  type
     idealN      =  9,  // Narrow oop types
-    idealV      = 10   // Vector  type
+    idealNKlass = 10,  // Narrow klass types
+    idealV      = 11   // Vector  type
   };
   // Convert ideal name to a DataType, return DataType::none if not a 'ConX'
   Form::DataType  ideal_to_const_type(const char *ideal_type_name) const;
@@ -448,11 +449,11 @@
   // Return number of USEs + number of DEFs
   int        num_operands();
   // Return zero-based position in list;  -1 if not in list.
-  int        operand_position(const char *name, int usedef);
+  int        operand_position(const char *name, int usedef, Form *fm);
   // Find position for this name, regardless of use/def information
   int        operand_position(const char *name);
   // Find position for this name when looked up for output via "format"
-  int        operand_position_format(const char *name);
+  int        operand_position_format(const char *name, Form *fm);
   // Find position for the Label when looked up for output via "format"
   int        label_position();
   // Find position for the Method when looked up for output via "format"
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -567,7 +567,7 @@
         if( strcmp(rc_name,"stack_slots") ) {
           // Check for ideal_type of RegFlags
           const char *type = opform->ideal_type( globals, registers );
-          if( !strcmp(type,"RegFlags") )
+          if( (type != NULL) && !strcmp(type, "RegFlags") )
             rematerialize = true;
         } else
           rematerialize = false; // Do not rematerialize things target stk
@@ -746,14 +746,16 @@
 // Expected use is for pointer vs oop determination for LoadP
 bool InstructForm::captures_bottom_type(FormDict &globals) const {
   if( _matrule && _matrule->_rChild &&
-       (!strcmp(_matrule->_rChild->_opType,"CastPP")     ||  // new result type
-        !strcmp(_matrule->_rChild->_opType,"CastX2P")    ||  // new result type
-        !strcmp(_matrule->_rChild->_opType,"DecodeN")    ||
-        !strcmp(_matrule->_rChild->_opType,"EncodeP")    ||
-        !strcmp(_matrule->_rChild->_opType,"LoadN")      ||
-        !strcmp(_matrule->_rChild->_opType,"GetAndSetN") ||
-        !strcmp(_matrule->_rChild->_opType,"LoadNKlass") ||
-        !strcmp(_matrule->_rChild->_opType,"CreateEx")   ||  // type of exception
+       (!strcmp(_matrule->_rChild->_opType,"CastPP")       ||  // new result type
+        !strcmp(_matrule->_rChild->_opType,"CastX2P")      ||  // new result type
+        !strcmp(_matrule->_rChild->_opType,"DecodeN")      ||
+        !strcmp(_matrule->_rChild->_opType,"EncodeP")      ||
+        !strcmp(_matrule->_rChild->_opType,"DecodeNKlass") ||
+        !strcmp(_matrule->_rChild->_opType,"EncodePKlass") ||
+        !strcmp(_matrule->_rChild->_opType,"LoadN")        ||
+        !strcmp(_matrule->_rChild->_opType,"GetAndSetN")   ||
+        !strcmp(_matrule->_rChild->_opType,"LoadNKlass")   ||
+        !strcmp(_matrule->_rChild->_opType,"CreateEx")     ||  // type of exception
         !strcmp(_matrule->_rChild->_opType,"CheckCastPP")) ) return true;
   else if ( is_ideal_load() == Form::idealP )                return true;
   else if ( is_ideal_store() != Form::none  )                return true;
@@ -793,6 +795,20 @@
   return num_opnds;
 }
 
+const char *InstructForm::opnd_ident(int idx) {
+  return _components.at(idx)->_name;
+}
+
+const char *InstructForm::unique_opnd_ident(int idx) {
+  uint i;
+  for (i = 1; i < num_opnds(); ++i) {
+    if (unique_opnds_idx(i) == idx) {
+      break;
+    }
+  }
+  return (_components.at(i) != NULL) ? _components.at(i)->_name : "";
+}
+
 // Return count of unmatched operands.
 uint InstructForm::num_post_match_opnds() {
   uint  num_post_match_opnds = _components.count();
@@ -864,6 +880,9 @@
   return base;
 }
 
+// This function determines the order of the MachOper in _opnds[]
+// by writing the operand names into the _components list.
+//
 // Implementation does not modify state of internal structures
 void InstructForm::build_components() {
   // Add top-level operands to the components
@@ -959,11 +978,11 @@
 
 // Return zero-based position in component list;  -1 if not in list.
 int   InstructForm::operand_position(const char *name, int usedef) {
-  return unique_opnds_idx(_components.operand_position(name, usedef));
+  return unique_opnds_idx(_components.operand_position(name, usedef, this));
 }
 
 int   InstructForm::operand_position_format(const char *name) {
-  return unique_opnds_idx(_components.operand_position_format(name));
+  return unique_opnds_idx(_components.operand_position_format(name, this));
 }
 
 // Return zero-based position in component list; -1 if not in list.
@@ -1223,7 +1242,7 @@
     if (different) {
       globalAD->syntax_err(short_branch->_linenum, "Instruction %s and its short form %s have different parameters\n", _ident, short_branch->_ident);
     }
-    if (AD._short_branch_debug) {
+    if (AD._adl_debug > 1 || AD._short_branch_debug) {
       fprintf(stderr, "Instruction %s has short form %s\n", _ident, short_branch->_ident);
     }
     _short_branch_form = short_branch;
@@ -1255,16 +1274,19 @@
   // Find replacement variable's type
   const Form *form   = _localNames[rep_var];
   if (form == NULL) {
-    fprintf(stderr, "unknown replacement variable in format statement: '%s'\n", rep_var);
-    assert(false, "ShouldNotReachHere()");
+    globalAD->syntax_err(_linenum, "Unknown replacement variable %s in format statement of %s.",
+                         rep_var, _ident);
+    return;
   }
   OpClassForm *opc   = form->is_opclass();
   assert( opc, "replacement variable was not found in local names");
   // Lookup the index position of the replacement variable
   int idx  = operand_position_format(rep_var);
   if ( idx == -1 ) {
-    assert( strcmp(opc->_ident,"label")==0, "Unimplemented");
-    assert( false, "ShouldNotReachHere()");
+    globalAD->syntax_err(_linenum, "Could not find replacement variable %s in format statement of %s.\n",
+                         rep_var, _ident);
+    assert(strcmp(opc->_ident, "label") == 0, "Unimplemented");
+    return;
   }
 
   if (is_noninput_operand(idx)) {
@@ -1273,7 +1295,7 @@
     OperandForm* oper = form->is_operand();
     if (oper != NULL && oper->is_bound_register()) {
       const RegDef* first = oper->get_RegClass()->find_first_elem();
-      fprintf(fp, "    tty->print(\"%s\");\n", first->_regname);
+      fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
     } else {
       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
     }
@@ -1371,26 +1393,28 @@
   // idx0=0 is used to indicate that info comes from this same node, not from input edge.
   // idx1 starts at oper_input_base()
   if ( cur_num_opnds >= 1 ) {
-    fprintf(fp,"    // Start at oper_input_base() and count operands\n");
-    fprintf(fp,"    unsigned %sidx0 = %d;\n", prefix, oper_input_base(globals));
-    fprintf(fp,"    unsigned %sidx1 = %d;\n", prefix, oper_input_base(globals));
+    fprintf(fp,"  // Start at oper_input_base() and count operands\n");
+    fprintf(fp,"  unsigned %sidx0 = %d;\n", prefix, oper_input_base(globals));
+    fprintf(fp,"  unsigned %sidx1 = %d;", prefix, oper_input_base(globals));
+    fprintf(fp," \t// %s\n", unique_opnd_ident(1));
 
     // Generate starting points for other unique operands if they exist
     for ( idx = 2; idx < num_unique_opnds(); ++idx ) {
       if( *receiver == 0 ) {
-        fprintf(fp,"    unsigned %sidx%d = %sidx%d + opnd_array(%d)->num_edges();\n",
+        fprintf(fp,"  unsigned %sidx%d = %sidx%d + opnd_array(%d)->num_edges();",
                 prefix, idx, prefix, idx-1, idx-1 );
       } else {
-        fprintf(fp,"    unsigned %sidx%d = %sidx%d + %s_opnds[%d]->num_edges();\n",
+        fprintf(fp,"  unsigned %sidx%d = %sidx%d + %s_opnds[%d]->num_edges();",
                 prefix, idx, prefix, idx-1, receiver, idx-1 );
       }
+      fprintf(fp," \t// %s\n", unique_opnd_ident(idx));
     }
   }
   if( *receiver != 0 ) {
     // This value is used by generate_peepreplace when copying a node.
     // Don't emit it in other cases since it can hide bugs with the
     // use invalid idx's.
-    fprintf(fp,"    unsigned %sidx%d = %sreq(); \n", prefix, idx, receiver);
+    fprintf(fp,"  unsigned %sidx%d = %sreq(); \n", prefix, idx, receiver);
   }
 
 }
@@ -1774,9 +1798,25 @@
   return Component::INVALID;
 }
 
+const char *Component::getUsedefName() {
+  switch (_usedef) {
+    case Component::INVALID:  return "INVALID";  break;
+    case Component::USE:      return "USE";      break;
+    case Component::USE_DEF:  return "USE_DEF";  break;
+    case Component::USE_KILL: return "USE_KILL"; break;
+    case Component::KILL:     return "KILL";     break;
+    case Component::TEMP:     return "TEMP";     break;
+    case Component::DEF:      return "DEF";      break;
+    case Component::CALL:     return "CALL";     break;
+    default: assert(false, "unknown effect");
+  }
+  return "Undefined Use/Def info";
+}
+
 Effect::Effect(const char *name) : _name(name), _use_def(effect_lookup(name)) {
   _ftype = Form::EFF;
 }
+
 Effect::~Effect() {
 }
 
@@ -2273,7 +2313,7 @@
 }
 
 int OperandForm::operand_position(const char *name, int usedef) {
-  return _components.operand_position(name, usedef);
+  return _components.operand_position(name, usedef, this);
 }
 
 
@@ -2399,20 +2439,20 @@
   if (_matrule && (_matrule->is_base_register(globals) ||
                    strcmp(ideal_type(globalAD->globalNames()), "RegFlags") == 0)) {
     // !!!!! !!!!!
-    fprintf(fp,    "{ char reg_str[128];\n");
-    fprintf(fp,"      ra->dump_register(node,reg_str);\n");
-    fprintf(fp,"      tty->print(\"%cs\",reg_str);\n",'%');
-    fprintf(fp,"    }\n");
+    fprintf(fp,"  { char reg_str[128];\n");
+    fprintf(fp,"    ra->dump_register(node,reg_str);\n");
+    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
+    fprintf(fp,"  }\n");
   } else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {
     format_constant( fp, index, dtype );
   } else if (ideal_to_sReg_type(_ident) != Form::none) {
     // Special format for Stack Slot Register
-    fprintf(fp,    "{ char reg_str[128];\n");
-    fprintf(fp,"      ra->dump_register(node,reg_str);\n");
-    fprintf(fp,"      tty->print(\"%cs\",reg_str);\n",'%');
-    fprintf(fp,"    }\n");
+    fprintf(fp,"  { char reg_str[128];\n");
+    fprintf(fp,"    ra->dump_register(node,reg_str);\n");
+    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
+    fprintf(fp,"  }\n");
   } else {
-    fprintf(fp,"tty->print(\"No format defined for %s\n\");\n", _ident);
+    fprintf(fp,"  st->print(\"No format defined for %s\n\");\n", _ident);
     fflush(fp);
     fprintf(stderr,"No format defined for %s\n", _ident);
     dump();
@@ -2426,36 +2466,37 @@
   Form::DataType dtype;
   if (_matrule && (_matrule->is_base_register(globals) ||
                    strcmp(ideal_type(globalAD->globalNames()), "RegFlags") == 0)) {
-    fprintf(fp,    "{ char reg_str[128];\n");
-    fprintf(fp,"      ra->dump_register(node->in(idx");
-    if ( index != 0 ) fprintf(fp,                  "+%d",index);
-    fprintf(fp,                                       "),reg_str);\n");
-    fprintf(fp,"      tty->print(\"%cs\",reg_str);\n",'%');
-    fprintf(fp,"    }\n");
+    fprintf(fp,"  { char reg_str[128];\n");
+    fprintf(fp,"    ra->dump_register(node->in(idx");
+    if ( index != 0 ) fprintf(fp,              "+%d",index);
+    fprintf(fp,                                      "),reg_str);\n");
+    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
+    fprintf(fp,"  }\n");
   } else if (_matrule && (dtype = _matrule->is_base_constant(globals)) != Form::none) {
     format_constant( fp, index, dtype );
   } else if (ideal_to_sReg_type(_ident) != Form::none) {
     // Special format for Stack Slot Register
-    fprintf(fp,    "{ char reg_str[128];\n");
-    fprintf(fp,"      ra->dump_register(node->in(idx");
+    fprintf(fp,"  { char reg_str[128];\n");
+    fprintf(fp,"    ra->dump_register(node->in(idx");
     if ( index != 0 ) fprintf(fp,                  "+%d",index);
     fprintf(fp,                                       "),reg_str);\n");
-    fprintf(fp,"      tty->print(\"%cs\",reg_str);\n",'%');
-    fprintf(fp,"    }\n");
+    fprintf(fp,"    st->print(\"%cs\",reg_str);\n",'%');
+    fprintf(fp,"  }\n");
   } else {
-    fprintf(fp,"tty->print(\"No format defined for %s\n\");\n", _ident);
+    fprintf(fp,"  st->print(\"No format defined for %s\n\");\n", _ident);
     assert( false,"Internal error:\n  output_external_operand() attempting to output other than a Register or Constant");
   }
 }
 
 void OperandForm::format_constant(FILE *fp, uint const_index, uint const_type) {
   switch(const_type) {
-  case Form::idealI:  fprintf(fp,"st->print(\"#%%d\", _c%d);\n", const_index); break;
-  case Form::idealP:  fprintf(fp,"_c%d->dump_on(st);\n",         const_index); break;
-  case Form::idealN:  fprintf(fp,"_c%d->dump_on(st);\n",         const_index); break;
-  case Form::idealL:  fprintf(fp,"st->print(\"#%%lld\", _c%d);\n", const_index); break;
-  case Form::idealF:  fprintf(fp,"st->print(\"#%%f\", _c%d);\n", const_index); break;
-  case Form::idealD:  fprintf(fp,"st->print(\"#%%f\", _c%d);\n", const_index); break;
+  case Form::idealI: fprintf(fp,"  st->print(\"#%%d\", _c%d);\n", const_index); break;
+  case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
+  case Form::idealNKlass:
+  case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
+  case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
+  case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
+  case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   default:
     assert( false, "ShouldNotReachHere()");
   }
@@ -2825,17 +2866,8 @@
   fprintf(fp,"Component:");  // Write to output files
   fprintf(fp, "  name = %s", _name);
   fprintf(fp, ", type = %s", _type);
-  const char * usedef = "Undefined Use/Def info";
-  switch (_usedef) {
-    case USE:      usedef = "USE";      break;
-    case USE_DEF:  usedef = "USE_DEF";  break;
-    case USE_KILL: usedef = "USE_KILL"; break;
-    case KILL:     usedef = "KILL";     break;
-    case TEMP:     usedef = "TEMP";     break;
-    case DEF:      usedef = "DEF";      break;
-    default: assert(false, "unknown effect");
-  }
-  fprintf(fp, ", use/def = %s\n", usedef);
+  assert(_usedef != 0, "unknown effect");
+  fprintf(fp, ", use/def = %s\n", getUsedefName());
 }
 
 
@@ -2927,9 +2959,9 @@
   return count;
 }
 
-// Return zero-based position in list;  -1 if not in list.
+// Return zero-based position of operand 'name' in list;  -1 if not in list.
 // if parameter 'usedef' is ::USE, it will match USE, USE_DEF, ...
-int ComponentList::operand_position(const char *name, int usedef) {
+int ComponentList::operand_position(const char *name, int usedef, Form *fm) {
   PreserveIter pi(this);
   int position = 0;
   int num_opnds = num_operands();
@@ -2952,10 +2984,18 @@
         return position+1;
       } else {
         if( preceding_non_use && strcmp(component->_name, preceding_non_use->_name) ) {
-          fprintf(stderr, "the name '%s' should not precede the name '%s'\n", preceding_non_use->_name, name);
+          fprintf(stderr, "the name '%s(%s)' should not precede the name '%s(%s)'",
+                  preceding_non_use->_name, preceding_non_use->getUsedefName(),
+                  name, component->getUsedefName());
+          if (fm && fm->is_instruction()) fprintf(stderr,  "in form '%s'", fm->is_instruction()->_ident);
+          if (fm && fm->is_operand()) fprintf(stderr,  "in form '%s'", fm->is_operand()->_ident);
+          fprintf(stderr,  "\n");
         }
         if( position >= num_opnds ) {
-          fprintf(stderr, "the name '%s' is too late in its name list\n", name);
+          fprintf(stderr, "the name '%s' is too late in its name list", name);
+          if (fm && fm->is_instruction()) fprintf(stderr,  "in form '%s'", fm->is_instruction()->_ident);
+          if (fm && fm->is_operand()) fprintf(stderr,  "in form '%s'", fm->is_operand()->_ident);
+          fprintf(stderr,  "\n");
         }
         assert(position < num_opnds, "advertised index in bounds");
         return position;
@@ -3001,10 +3041,10 @@
   return Not_in_list;
 }
 
-int ComponentList::operand_position_format(const char *name) {
+int ComponentList::operand_position_format(const char *name, Form *fm) {
   PreserveIter pi(this);
   int  first_position = operand_position(name);
-  int  use_position   = operand_position(name, Component::USE);
+  int  use_position   = operand_position(name, Component::USE, fm);
 
   return ((first_position < use_position) ? use_position : first_position);
 }
@@ -3267,8 +3307,8 @@
 
   // If we are a "Set", start from the right child.
   const MatchNode *const mnode = sets_result() ?
-    (const MatchNode *const)this->_rChild :
-    (const MatchNode *const)this;
+    (const MatchNode *)this->_rChild :
+    (const MatchNode *)this;
 
   // If our right child exists, it is the right reduction
   if ( mnode->_rChild ) {
@@ -3285,8 +3325,8 @@
 
   // If we are a "Set", start from the right child.
   const MatchNode *const mnode = sets_result() ?
-    (const MatchNode *const)this->_rChild :
-    (const MatchNode *const)this;
+    (const MatchNode *)this->_rChild :
+    (const MatchNode *)this;
 
   // If our left child exists, it is the left reduction
   if ( mnode->_lChild ) {
@@ -3390,9 +3430,9 @@
 
 int MatchNode::needs_ideal_memory_edge(FormDict &globals) const {
   static const char *needs_ideal_memory_list[] = {
-    "StoreI","StoreL","StoreP","StoreN","StoreD","StoreF" ,
+    "StoreI","StoreL","StoreP","StoreN","StoreNKlass","StoreD","StoreF" ,
     "StoreB","StoreC","Store" ,"StoreFP",
-    "LoadI", "LoadUI2L", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
+    "LoadI", "LoadL", "LoadP" ,"LoadN", "LoadD" ,"LoadF"  ,
     "LoadB" , "LoadUB", "LoadUS" ,"LoadS" ,"Load" ,
     "StoreVector", "LoadVector",
     "LoadRange", "LoadKlass", "LoadNKlass", "LoadL_unaligned", "LoadD_unaligned",
@@ -3947,6 +3987,8 @@
         strcmp(opType,"ConvL2I")==0 ||
         strcmp(opType,"DecodeN")==0 ||
         strcmp(opType,"EncodeP")==0 ||
+        strcmp(opType,"EncodePKlass")==0 ||
+        strcmp(opType,"DecodeNKlass")==0 ||
         strcmp(opType,"RoundDouble")==0 ||
         strcmp(opType,"RoundFloat")==0 ||
         strcmp(opType,"ReverseBytesI")==0 ||
@@ -4108,12 +4150,17 @@
   output(stderr);
 }
 
-void MatchRule::output(FILE *fp) {
+// Write just one line.
+void MatchRule::output_short(FILE *fp) {
   fprintf(fp,"MatchRule: ( %s",_name);
   if (_lChild) _lChild->output(fp);
   if (_rChild) _rChild->output(fp);
-  fprintf(fp," )\n");
-  fprintf(fp,"   nesting depth = %d\n", _depth);
+  fprintf(fp," )");
+}
+
+void MatchRule::output(FILE *fp) {
+  output_short(fp);
+  fprintf(fp,"\n   nesting depth = %d\n", _depth);
   if (_result) fprintf(fp,"   Result Type = %s", _result);
   fprintf(fp,"\n");
 }
--- a/hotspot/src/share/vm/adlc/formssel.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/formssel.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -76,7 +76,7 @@
 private:
   bool           _ideal_only;       // Not a user-defined instruction
   // Members used for tracking CISC-spilling
-  uint           _cisc_spill_operand;// Which operand may cisc-spill
+  int            _cisc_spill_operand;// Which operand may cisc-spill
   void           set_cisc_spill_operand(uint op_index) { _cisc_spill_operand = op_index; }
   bool           _is_cisc_alternate;
   InstructForm  *_cisc_spill_alternate;// cisc possible replacement
@@ -103,7 +103,7 @@
   RewriteRule   *_rewrule;         // Rewrite rule for this instruction
   FormatRule    *_format;          // Format for assembly generation
   Peephole      *_peephole;        // List of peephole rules for instruction
-  const char    *_ins_pipe;        // Instruction Scheduline description class
+  const char    *_ins_pipe;        // Instruction Scheduling description class
 
   uint          *_uniq_idx;        // Indexes of unique operands
   int            _uniq_idx_length; // Length of _uniq_idx array
@@ -198,6 +198,7 @@
 
   virtual const char *cost();      // Access ins_cost attribute
   virtual uint        num_opnds(); // Count of num_opnds for MachNode class
+                                   // Counts USE_DEF opnds twice.  See also num_unique_opnds().
   virtual uint        num_post_match_opnds();
   virtual uint        num_consts(FormDict &globals) const;// Constants in match rule
   // Constants in match rule with specified type
@@ -228,6 +229,7 @@
   // Return number of relocation entries needed for this instruction.
   virtual uint        reloc(FormDict &globals);
 
+  const char         *opnd_ident(int idx);  // Name of operand #idx.
   const char         *reduce_result();
   // Return the name of the operand on the right hand side of the binary match
   // Return NULL if there is no right hand side
@@ -240,7 +242,7 @@
   // Check if this instruction can cisc-spill to 'alternate'
   bool                cisc_spills_to(ArchDesc &AD, InstructForm *alternate);
   InstructForm       *cisc_spill_alternate() { return _cisc_spill_alternate; }
-  uint                cisc_spill_operand() const { return _cisc_spill_operand; }
+  int                 cisc_spill_operand() const { return _cisc_spill_operand; }
   bool                is_cisc_alternate() const { return _is_cisc_alternate; }
   void                set_cisc_alternate(bool val) { _is_cisc_alternate = val; }
   const char         *cisc_reg_mask_name() const { return _cisc_reg_mask_name; }
@@ -277,6 +279,7 @@
                           return idx;
                         }
   }
+  const char         *unique_opnd_ident(int idx);  // Name of operand at unique idx.
 
   // Operands which are only KILLs aren't part of the input array and
   // require special handling in some cases.  Their position in this
@@ -889,6 +892,7 @@
 
   void dump();                     // Debug printer
   void output(FILE *fp);           // Write to output files
+  const char* getUsedefName();
 
 public:
   // Implementation depends upon working bit intersection and union.
@@ -1030,6 +1034,7 @@
   void       matchrule_swap_commutative_op(const char* instr_ident, int count, int& match_rules_cnt);
 
   void dump();
+  void output_short(FILE *fp);
   void output(FILE *fp);
 };
 
--- a/hotspot/src/share/vm/adlc/main.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/main.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -341,14 +341,20 @@
 static void usage(ArchDesc& AD)
 {
   printf("Architecture Description Language Compiler\n\n");
-  printf("Usage: adl [-doqw] [-Dflag[=def]] [-Uflag] [-cFILENAME] [-hFILENAME] [-aDFAFILE] ADLFILE\n");
+  printf("Usage: adlc [-doqwTs] [-#]* [-D<FLAG>[=<DEF>]] [-U<FLAG>] [-c<CPP_FILE_NAME>] [-h<HPP_FILE_NAME>] [-a<DFA_FILE_NAME>] [-v<GLOBALS_FILE_NAME>] <ADL_FILE_NAME>\n");
   printf(" d  produce DFA debugging info\n");
   printf(" o  no output produced, syntax and semantic checking only\n");
   printf(" q  quiet mode, supresses all non-essential messages\n");
   printf(" w  suppress warning messages\n");
+  printf(" T  make DFA as many subroutine calls\n");
+  printf(" s  output which instructions are cisc-spillable\n");
+  printf(" D  define preprocessor symbol\n");
+  printf(" U  undefine preprocessor symbol\n");
   printf(" c  specify CPP file name (default: %s)\n", AD._CPP_file._name);
   printf(" h  specify HPP file name (default: %s)\n", AD._HPP_file._name);
   printf(" a  specify DFA output file name\n");
+  printf(" v  specify adGlobals output file name\n");
+  printf(" #  increment ADL debug level\n");
   printf("\n");
 }
 
@@ -450,22 +456,6 @@
   return fname;
 }
 
-//------------------------------strip_path_and_ext------------------------------
-static char *strip_path_and_ext(char *fname)
-{
-  char *ep;
-  char *sp;
-
-  if (fname) {
-    for (sp = fname; *sp; sp++)
-      if (*sp == '/')  fname = sp+1;
-    ep = fname;                    // start at first character and look for '.'
-    while (ep <= (fname + strlen(fname) - 1) && *ep != '.') ep++;
-    if (*ep == '.')     *ep = '\0'; // truncate string at '.'
-  }
-  return fname;
-}
-
 //------------------------------base_plus_suffix-------------------------------
 // New concatenated string
 static char *base_plus_suffix(const char* base, const char *suffix)
@@ -477,18 +467,6 @@
   return fname;
 }
 
-
-//------------------------------prefix_plus_base_plus_suffix-------------------
-// New concatenated string
-static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix)
-{
-  int len = (int)strlen(prefix) + (int)strlen(base) + (int)strlen(suffix) + 1;
-
-  char* fname = new char[len];
-  sprintf(fname,"%s%s%s",prefix,base,suffix);
-  return fname;
-}
-
 //------------------------------get_legal_text---------------------------------
 // Get pointer to legal text at the beginning of AD file.
 // This code assumes that a legal text starts at the beginning of .ad files,
--- a/hotspot/src/share/vm/adlc/output_c.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/output_c.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -518,6 +518,14 @@
 
     int cycles = piperesource->_cycles;
     uint stage          = pipeline->_stages.index(piperesource->_stage);
+    if (NameList::Not_in_list == stage) {
+      fprintf(stderr,
+              "pipeline_res_mask_initializer: "
+              "semantic error: "
+              "pipeline stage undeclared: %s\n",
+              piperesource->_stage);
+      exit(1);
+    }
     uint upper_limit    = stage+cycles-1;
     uint lower_limit    = stage-1;
     uint upper_idx      = upper_limit >> 5;
@@ -1000,7 +1008,7 @@
   }
   fprintf(fp_cpp, "};\n\n");
   fprintf(fp_cpp, "#ifndef PRODUCT\n");
-  fprintf(fp_cpp, "void Bundle::dump() const {\n");
+  fprintf(fp_cpp, "void Bundle::dump(outputStream *st) const {\n");
   fprintf(fp_cpp, "  static const char * bundle_flags[] = {\n");
   fprintf(fp_cpp, "    \"\",\n");
   fprintf(fp_cpp, "    \"use nop delay\",\n");
@@ -1019,22 +1027,22 @@
   // See if the same string is in the table
   fprintf(fp_cpp, "  bool needs_comma = false;\n\n");
   fprintf(fp_cpp, "  if (_flags) {\n");
-  fprintf(fp_cpp, "    tty->print(\"%%s\", bundle_flags[_flags]);\n");
+  fprintf(fp_cpp, "    st->print(\"%%s\", bundle_flags[_flags]);\n");
   fprintf(fp_cpp, "    needs_comma = true;\n");
   fprintf(fp_cpp, "  };\n");
   fprintf(fp_cpp, "  if (instr_count()) {\n");
-  fprintf(fp_cpp, "    tty->print(\"%%s%%d instr%%s\", needs_comma ? \", \" : \"\", instr_count(), instr_count() != 1 ? \"s\" : \"\");\n");
+  fprintf(fp_cpp, "    st->print(\"%%s%%d instr%%s\", needs_comma ? \", \" : \"\", instr_count(), instr_count() != 1 ? \"s\" : \"\");\n");
   fprintf(fp_cpp, "    needs_comma = true;\n");
   fprintf(fp_cpp, "  };\n");
   fprintf(fp_cpp, "  uint r = resources_used();\n");
   fprintf(fp_cpp, "  if (r) {\n");
-  fprintf(fp_cpp, "    tty->print(\"%%sresource%%s:\", needs_comma ? \", \" : \"\", (r & (r-1)) != 0 ? \"s\" : \"\");\n");
+  fprintf(fp_cpp, "    st->print(\"%%sresource%%s:\", needs_comma ? \", \" : \"\", (r & (r-1)) != 0 ? \"s\" : \"\");\n");
   fprintf(fp_cpp, "    for (uint i = 0; i < %d; i++)\n", _pipeline->_rescount);
   fprintf(fp_cpp, "      if ((r & (1 << i)) != 0)\n");
-  fprintf(fp_cpp, "        tty->print(\" %%s\", resource_names[i]);\n");
+  fprintf(fp_cpp, "        st->print(\" %%s\", resource_names[i]);\n");
   fprintf(fp_cpp, "    needs_comma = true;\n");
   fprintf(fp_cpp, "  };\n");
-  fprintf(fp_cpp, "  tty->print(\"\\n\");\n");
+  fprintf(fp_cpp, "  st->print(\"\\n\");\n");
   fprintf(fp_cpp, "}\n");
   fprintf(fp_cpp, "#endif\n");
 }
@@ -1048,39 +1056,6 @@
           node, regMask);
 }
 
-// Scan the peepmatch and output a test for each instruction
-static void check_peepmatch_instruction_tree(FILE *fp, PeepMatch *pmatch, PeepConstraint *pconstraint) {
-  int         parent        = -1;
-  int         inst_position = 0;
-  const char* inst_name     = NULL;
-  int         input         = 0;
-  fprintf(fp, "      // Check instruction sub-tree\n");
-  pmatch->reset();
-  for( pmatch->next_instruction( parent, inst_position, inst_name, input );
-       inst_name != NULL;
-       pmatch->next_instruction( parent, inst_position, inst_name, input ) ) {
-    // If this is not a placeholder
-    if( ! pmatch->is_placeholder() ) {
-      // Define temporaries 'inst#', based on parent and parent's input index
-      if( parent != -1 ) {                // root was initialized
-        fprintf(fp, "  inst%d = inst%d->in(%d);\n",
-                inst_position, parent, input);
-      }
-
-      // When not the root
-      // Test we have the correct instruction by comparing the rule
-      if( parent != -1 ) {
-        fprintf(fp, "  matches = matches &&  ( inst%d->rule() == %s_rule );",
-                inst_position, inst_name);
-      }
-    } else {
-      // Check that user did not try to constrain a placeholder
-      assert( ! pconstraint->constrains_instruction(inst_position),
-              "fatal(): Can not constrain a placeholder instruction");
-    }
-  }
-}
-
 static void print_block_index(FILE *fp, int inst_position) {
   assert( inst_position >= 0, "Instruction number less than zero");
   fprintf(fp, "block_index");
@@ -1242,7 +1217,7 @@
         if( left_op_index != 0 ) {
           assert( (left_index <= 9999) && (left_op_index <= 9999), "exceed string size");
           // Must have index into operands
-          sprintf(left_reg_index,",inst%d_idx%d", left_index, left_op_index);
+          sprintf(left_reg_index,",inst%d_idx%d", (int)left_index, left_op_index);
         } else {
           strcpy(left_reg_index, "");
         }
@@ -1255,7 +1230,7 @@
           if( right_op_index != 0 ) {
             assert( (right_index <= 9999) && (right_op_index <= 9999), "exceed string size");
             // Must have index into operands
-            sprintf(right_reg_index,",inst%d_idx%d", right_index, right_op_index);
+            sprintf(right_reg_index,",inst%d_idx%d", (int)right_index, right_op_index);
           } else {
             strcpy(right_reg_index, "");
           }
@@ -1645,7 +1620,7 @@
           new_pos = new_inst->operand_position(parameter,Component::USE);
           exp_pos += node->num_opnds();
           // If there is no use of the created operand, just skip it
-          if (new_pos != -1) {
+          if (new_pos != NameList::Not_in_list) {
             //Copy the operand from the original made above
             fprintf(fp,"  n%d->set_opnd_array(%d, op%d->clone(C)); // %s\n",
                     cnt, new_pos, exp_pos-node->num_opnds(), opid);
@@ -1789,7 +1764,8 @@
       // Build mapping from num_edges to local variables
       fprintf(fp,"  unsigned num0 = 0;\n");
       for( i = 1; i < cur_num_opnds; i++ ) {
-        fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();\n",i,i);
+        fprintf(fp,"  unsigned num%d = opnd_array(%d)->num_edges();",i,i);
+        fprintf(fp, " \t// %s\n", node->opnd_ident(i));
       }
       // Build a mapping from operand index to input edges
       fprintf(fp,"  unsigned idx0 = oper_input_base();\n");
@@ -1934,6 +1910,7 @@
   }
 
   // Track necessary state when identifying a replacement variable
+  // @arg rep_var: The formal parameter of the encoding.
   void update_state(const char *rep_var) {
     // A replacement variable or one of its subfields
     // Obtain replacement variable from list
@@ -1955,7 +1932,7 @@
         }
       }
       else {
-        // Lookup its position in parameter list
+        // Lookup its position in (formal) parameter list of encoding
         int   param_no  = _encoding.rep_var_index(rep_var);
         if ( param_no == -1 ) {
           _AD.syntax_err( _encoding._linenum,
@@ -1964,6 +1941,7 @@
         }
 
         // Lookup the corresponding ins_encode parameter
+        // This is the argument (actual parameter) to the encoding.
         const char *inst_rep_var = _ins_encode.rep_var_name(_inst, param_no);
         if (inst_rep_var == NULL) {
           _AD.syntax_err( _ins_encode._linenum,
@@ -2329,6 +2307,7 @@
           // Add parameter for index position, if not result operand
           if( _operand_idx != 0 ) fprintf(_fp,",idx%d", _operand_idx);
           fprintf(_fp,")");
+          fprintf(_fp, "/* %s */", _operand_name);
         }
       } else {
         assert( _reg_status == LITERAL_OUTPUT, "should have output register literal in emit_rep_var");
@@ -2368,7 +2347,7 @@
         }
       } else {
         assert( _constant_status == LITERAL_OUTPUT, "should have output constant literal in emit_rep_var");
-        // Cosntant literal has already been sent to output file, nothing more needed
+        // Constant literal has already been sent to output file, nothing more needed
       }
     }
     else if ( strcmp(rep_var,"$disp") == 0 ) {
@@ -2387,6 +2366,8 @@
     }
     else {
       printf("emit_field: %s\n",rep_var);
+      globalAD->syntax_err(_inst._linenum, "Unknown replacement variable %s in format statement of %s.",
+                           rep_var, _inst._ident);
       assert( false, "UnImplemented()");
     }
   }
@@ -2484,14 +2465,14 @@
 
   //(1)
   // Output instruction's emit prototype
-  fprintf(fp,"uint  %sNode::size(PhaseRegAlloc *ra_) const {\n",
+  fprintf(fp,"uint %sNode::size(PhaseRegAlloc *ra_) const {\n",
           inst._ident);
 
-  fprintf(fp, " assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
+  fprintf(fp, "  assert(VerifyOops || MachNode::size(ra_) <= %s, \"bad fixed size\");\n", inst._size);
 
   //(2)
   // Print the size
-  fprintf(fp, " return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
+  fprintf(fp, "  return (VerifyOops ? MachNode::size(ra_) : %s);\n", inst._size);
 
   // (3) and (4)
   fprintf(fp,"}\n");
@@ -2579,7 +2560,7 @@
   }
 
   // (3) and (4)
-  fprintf(fp, "}\n");
+  fprintf(fp, "}\n\n");
 }
 
 // defineEvalConstant ---------------------------------------------------------
@@ -2727,12 +2708,12 @@
 // (2)  }
 //
 static void defineClone(FILE *fp, FormDict &globalNames, OperandForm &oper) {
-  fprintf(fp,"MachOper  *%sOper::clone(Compile* C) const {\n", oper._ident);
+  fprintf(fp,"MachOper *%sOper::clone(Compile* C) const {\n", oper._ident);
   // Check for constants that need to be copied over
   const int  num_consts    = oper.num_consts(globalNames);
   const bool is_ideal_bool = oper.is_ideal_bool();
   if( (num_consts > 0) ) {
-    fprintf(fp,"  return  new (C) %sOper(", oper._ident);
+    fprintf(fp,"  return new (C) %sOper(", oper._ident);
     // generate parameters for constants
     int i = 0;
     fprintf(fp,"_c%d", i);
@@ -2744,21 +2725,12 @@
   }
   else {
     assert( num_consts == 0, "Currently support zero or one constant per operand clone function");
-    fprintf(fp,"  return  new (C) %sOper();\n", oper._ident);
+    fprintf(fp,"  return new (C) %sOper();\n", oper._ident);
   }
   // finish method
   fprintf(fp,"}\n");
 }
 
-static void define_hash(FILE *fp, char *operand) {
-  fprintf(fp,"uint %sOper::hash() const { return 5; }\n", operand);
-}
-
-static void define_cmp(FILE *fp, char *operand) {
-  fprintf(fp,"uint %sOper::cmp( const MachOper &oper ) const { return opcode() == oper.opcode(); }\n", operand);
-}
-
-
 // Helper functions for bug 4796752, abstracted with minimal modification
 // from define_oper_interface()
 OperandForm *rep_var_to_operand(const char *encoding, OperandForm &oper, FormDict &globals) {
@@ -2852,14 +2824,14 @@
   } else if ( (strcmp(name,"disp") == 0) ) {
     fprintf(fp,"(PhaseRegAlloc *ra_, const Node *node, int idx) const { \n");
   } else {
-    fprintf(fp,"() const { ");
+    fprintf(fp,"() const { \n");
   }
 
   // Check for hexadecimal value OR replacement variable
   if( *encoding == '$' ) {
     // Replacement variable
     const char *rep_var = encoding + 1;
-    fprintf(fp,"// Replacement variable: %s\n", encoding+1);
+    fprintf(fp,"    // Replacement variable: %s\n", encoding+1);
     // Lookup replacement variable, rep_var, in operand's component list
     const Component *comp = oper._components.search(rep_var);
     assert( comp != NULL, "Replacement variable not found in components");
@@ -2880,10 +2852,10 @@
     } else if ( op->ideal_to_sReg_type(op->_ident) != Form::none ) {
       // StackSlot for an sReg comes either from input node or from self, when idx==0
       fprintf(fp,"    if( idx != 0 ) {\n");
-      fprintf(fp,"      // Access register number for input operand\n");
+      fprintf(fp,"      // Access stack offset (register number) for input operand\n");
       fprintf(fp,"      return ra_->reg2offset(ra_->get_reg_first(node->in(idx)));/* sReg */\n");
       fprintf(fp,"    }\n");
-      fprintf(fp,"    // Access register number from myself\n");
+      fprintf(fp,"    // Access stack offset (register number) from myself\n");
       fprintf(fp,"    return ra_->reg2offset(ra_->get_reg_first(node));/* sReg */\n");
     } else if (op->_matrule && op->_matrule->is_base_constant(globals)) {
       // Constant
@@ -2900,7 +2872,7 @@
   }
   else if( *encoding == '0' && *(encoding+1) == 'x' ) {
     // Hex value
-    fprintf(fp,"return %s;", encoding);
+    fprintf(fp,"    return %s;\n", encoding);
   } else {
     assert( false, "Do not support octal or decimal encode constants");
   }
@@ -3133,8 +3105,8 @@
     // Output the definition for number of relocation entries
     uint reloc_size = instr->reloc(_globalNames);
     if ( reloc_size != 0 ) {
-      fprintf(fp,"int  %sNode::reloc()   const {\n", instr->_ident);
-      fprintf(fp,  "  return  %d;\n", reloc_size );
+      fprintf(fp,"int %sNode::reloc() const {\n", instr->_ident);
+      fprintf(fp,"  return %d;\n", reloc_size);
       fprintf(fp,"}\n");
       fprintf(fp,"\n");
     }
@@ -3241,7 +3213,7 @@
 class OutputReduceOp : public OutputMap {
 public:
   OutputReduceOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "reduceOp") {};
 
   void declaration() { fprintf(_hpp, "extern const int   reduceOp[];\n"); }
   void definition()  { fprintf(_cpp, "const        int   reduceOp[] = {\n"); }
@@ -3276,7 +3248,7 @@
 class OutputLeftOp : public OutputMap {
 public:
   OutputLeftOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "leftOp") {};
 
   void declaration() { fprintf(_hpp, "extern const int   leftOp[];\n"); }
   void definition()  { fprintf(_cpp, "const        int   leftOp[] = {\n"); }
@@ -3306,7 +3278,7 @@
 class OutputRightOp : public OutputMap {
 public:
   OutputRightOp(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "rightOp") {};
 
   void declaration() { fprintf(_hpp, "extern const int   rightOp[];\n"); }
   void definition()  { fprintf(_cpp, "const        int   rightOp[] = {\n"); }
@@ -3336,11 +3308,11 @@
 class OutputRuleName : public OutputMap {
 public:
   OutputRuleName(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "ruleName") {};
 
   void declaration() { fprintf(_hpp, "extern const char *ruleName[];\n"); }
   void definition()  { fprintf(_cpp, "const char        *ruleName[] = {\n"); }
-  void closing()     { fprintf(_cpp, "  \"no trailing comma\"\n");
+  void closing()     { fprintf(_cpp, "  \"invalid rule name\" // no trailing comma\n");
                        OutputMap::closing();
   }
   void map(OpClassForm &opc)  { fprintf(_cpp, "  \"%s\"", _AD.machOperEnum(opc._ident) ); }
@@ -3354,7 +3326,7 @@
 class OutputSwallowed : public OutputMap {
 public:
   OutputSwallowed(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "swallowed") {};
 
   void declaration() { fprintf(_hpp, "extern const bool  swallowed[];\n"); }
   void definition()  { fprintf(_cpp, "const        bool  swallowed[] = {\n"); }
@@ -3375,7 +3347,7 @@
 class OutputInstChainRule : public OutputMap {
 public:
   OutputInstChainRule(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "instruction_chain_rule") {};
 
   void declaration() { fprintf(_hpp, "extern const bool  instruction_chain_rule[];\n"); }
   void definition()  { fprintf(_cpp, "const        bool  instruction_chain_rule[] = {\n"); }
@@ -3416,7 +3388,7 @@
     if ( op->ideal_only() )  continue;
 
     // Generate the entry for this opcode
-    map.map(*op);    fprintf(fp_cpp, ", // %d\n", idx);
+    fprintf(fp_cpp, "  /* %4d */", idx); map.map(*op); fprintf(fp_cpp, ",\n");
     ++idx;
   };
   fprintf(fp_cpp, "  // last operand\n");
@@ -3425,7 +3397,7 @@
   map.record_position(OutputMap::BEGIN_OPCLASSES, idx );
   _opclass.reset();
   for(; (opc = (OpClassForm*)_opclass.iter()) != NULL; ) {
-    map.map(*opc);    fprintf(fp_cpp, ", // %d\n", idx);
+    fprintf(fp_cpp, "  /* %4d */", idx); map.map(*opc); fprintf(fp_cpp, ",\n");
     ++idx;
   };
   fprintf(fp_cpp, "  // last operand class\n");
@@ -3435,7 +3407,7 @@
   _internalOpNames.reset();
   char *name = NULL;
   for(; (name = (char *)_internalOpNames.iter()) != NULL; ) {
-    map.map(name);    fprintf(fp_cpp, ", // %d\n", idx);
+    fprintf(fp_cpp, "  /* %4d */", idx); map.map(name); fprintf(fp_cpp, ",\n");
     ++idx;
   };
   fprintf(fp_cpp, "  // last internally defined operand\n");
@@ -3453,7 +3425,7 @@
         if ( ! inst->is_simple_chain_rule(_globalNames) ) continue;
         if ( inst->rematerialize(_globalNames, get_registers()) ) continue;
 
-        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
+        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
         ++idx;
       };
       map.record_position(OutputMap::BEGIN_REMATERIALIZE, idx );
@@ -3464,7 +3436,7 @@
         if ( ! inst->is_simple_chain_rule(_globalNames) ) continue;
         if ( ! inst->rematerialize(_globalNames, get_registers()) ) continue;
 
-        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
+        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
         ++idx;
       };
       map.record_position(OutputMap::END_INST_CHAIN_RULES, idx );
@@ -3478,7 +3450,7 @@
         if ( inst->is_simple_chain_rule(_globalNames) ) continue;
         if ( ! inst->rematerialize(_globalNames, get_registers()) ) continue;
 
-        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
+        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
         ++idx;
       };
       map.record_position(OutputMap::END_REMATERIALIZE, idx );
@@ -3489,7 +3461,7 @@
         if ( inst->is_simple_chain_rule(_globalNames) ) continue;
         if ( inst->rematerialize(_globalNames, get_registers()) ) continue;
 
-        map.map(*inst);      fprintf(fp_cpp, ", // %d\n", idx);
+        fprintf(fp_cpp, "  /* %4d */", idx); map.map(*inst); fprintf(fp_cpp, ",\n");
         ++idx;
       };
     }
@@ -3571,7 +3543,7 @@
     next              = _register->iter_RegDefs();
     char policy       = reg_save_policy(rdef->_callconv);
     const char *comma = (next != NULL) ? "," : " // no trailing comma";
-    fprintf(fp_cpp, "  '%c'%s\n", policy, comma);
+    fprintf(fp_cpp, "  '%c'%s // %s\n", policy, comma, rdef->_regname);
   }
   fprintf(fp_cpp, "};\n\n");
 
@@ -3583,7 +3555,7 @@
     next        = _register->iter_RegDefs();
     char policy = reg_save_policy(rdef->_c_conv);
     const char *comma = (next != NULL) ? "," : " // no trailing comma";
-    fprintf(fp_cpp, "  '%c'%s\n", policy, comma);
+    fprintf(fp_cpp, "  '%c'%s // %s\n", policy, comma, rdef->_regname);
   }
   fprintf(fp_cpp, "};\n\n");
 
@@ -3644,6 +3616,8 @@
       fprintf(fp, "_leaf->bottom_type()->is_ptr()");
     } else if ( (strcmp(optype,"ConN") == 0) ) {
       fprintf(fp, "_leaf->bottom_type()->is_narrowoop()");
+    } else if ( (strcmp(optype,"ConNKlass") == 0) ) {
+      fprintf(fp, "_leaf->bottom_type()->is_narrowklass()");
     } else if ( (strcmp(optype,"ConF") == 0) ) {
       fprintf(fp, "_leaf->getf()");
     } else if ( (strcmp(optype,"ConD") == 0) ) {
@@ -3792,7 +3766,7 @@
       // For each operand not in the match rule, call MachOperGenerator
       // with the enum for the opcode that needs to be built.
       ComponentList clist = inst->_components;
-      int         index  = clist.operand_position(comp->_name, comp->_usedef);
+      int         index  = clist.operand_position(comp->_name, comp->_usedef, inst);
       const char *opcode = machOperEnum(comp->_type);
       fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index);
       fprintf(fp_cpp, "MachOperGenerator(%s, C));\n", opcode);
@@ -3987,7 +3961,7 @@
     fprintf(fp_cpp, "  case %s_rule:", opClass);
 
     // Start local scope
-    fprintf(fp_cpp, "  {\n");
+    fprintf(fp_cpp, " {\n");
     // Generate code to construct the new MachNode
     buildMachNode(fp_cpp, inst, "     ");
     // Return result and exit scope
@@ -4137,6 +4111,9 @@
 // Get info for the CISC_oracle and MachNode::cisc_version()
 void ArchDesc::identify_cisc_spill_instructions() {
 
+  if (_frame == NULL)
+    return;
+
   // Find the user-defined operand for cisc-spilling
   if( _frame->_cisc_spilling_operand_name != NULL ) {
     const Form *form = _globalNames[_frame->_cisc_spilling_operand_name];
--- a/hotspot/src/share/vm/adlc/output_h.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/adlc/output_h.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -25,6 +25,8 @@
 // output_h.cpp - Class HPP file output routines for architecture definition
 #include "adlc.hpp"
 
+// The comment delimiter used in format statements after assembler instructions.
+#define commentSeperator "!"
 
 // Generate the #define that describes the number of registers.
 static void defineRegCount(FILE *fp, RegisterForm *registers) {
@@ -79,10 +81,15 @@
     _register->reset_RegDefs();
     int i = 0;
     while( (reg_def = _register->iter_RegDefs()) != NULL ) {
-      fprintf(fp_hpp,"  %s_num,\t\t// %d\n", reg_def->_regname, i++);
+      fprintf(fp_hpp,"  %s_num,", reg_def->_regname);
+      for (int j = 0; j < 20-(int)strlen(reg_def->_regname); j++) fprintf(fp_hpp, " ");
+      fprintf(fp_hpp," // enum %3d, regnum %3d, reg encode %3s\n",
+              i++,
+              reg_def->register_num(),
+              reg_def->register_encode());
     }
     // Finish defining enumeration
-    fprintf(fp_hpp, "  _last_Mach_Reg\t// %d\n", i);
+    fprintf(fp_hpp, "  _last_Mach_Reg            // %d\n", i);
     fprintf(fp_hpp, "};\n");
   }
 
@@ -121,13 +128,24 @@
     fprintf(fp_hpp, "// in the order of occurrence in the alloc_class(es).\n");
     fprintf(fp_hpp, "enum MachRegisterEncodes {\n");
 
+    // Find max enum string length.
+    size_t maxlen = 0;
+    _register->reset_RegDefs();
+    reg_def = _register->iter_RegDefs();
+    while (reg_def != NULL) {
+      size_t len = strlen(reg_def->_regname);
+      if (len > maxlen) maxlen = len;
+      reg_def = _register->iter_RegDefs();
+    }
+
     // Output the register encoding for each register in the allocation classes
     _register->reset_RegDefs();
     reg_def_next = _register->iter_RegDefs();
     while( (reg_def = reg_def_next) != NULL ) {
       reg_def_next = _register->iter_RegDefs();
-      fprintf(fp_hpp,"  %s_enc = %s%s\n",
-              reg_def->_regname, reg_def->register_encode(), reg_def_next == NULL? "" : "," );
+      fprintf(fp_hpp,"  %s_enc", reg_def->_regname);
+      for (size_t i = strlen(reg_def->_regname); i < maxlen; i++) fprintf(fp_hpp, " ");
+      fprintf(fp_hpp," = %3s%s\n", reg_def->register_encode(), reg_def_next == NULL? "" : "," );
     }
     // Finish defining enumeration
     fprintf(fp_hpp, "};\n");
@@ -177,14 +195,6 @@
   fprintf(fp,"  virtual const RegMask *in_RegMask(int index) const;\n");
 }
 
-static void declare_hash(FILE *fp) {
-  fprintf(fp,"  virtual uint           hash() const;\n");
-}
-
-static void declare_cmp(FILE *fp) {
-  fprintf(fp,"  virtual uint           cmp( const MachOper &oper ) const;\n");
-}
-
 static void declareConstStorage(FILE *fp, FormDict &globals, OperandForm *oper) {
   int i = 0;
   Component *comp;
@@ -207,6 +217,10 @@
       if (i > 0) fprintf(fp,", ");
       fprintf(fp,"  const TypeNarrowOop *_c%d;\n", i);
     }
+    else if (!strcmp(type, "ConNKlass")) {
+      if (i > 0) fprintf(fp,", ");
+      fprintf(fp,"  const TypeNarrowKlass *_c%d;\n", i);
+    }
     else if (!strcmp(type, "ConL")) {
       if (i > 0) fprintf(fp,", ");
       fprintf(fp,"  jlong          _c%d;\n", i);
@@ -243,6 +257,10 @@
         fprintf(fp,"  const TypePtr *_c%d;\n", i);
         i++;
       }
+      else if (!strcmp(comp->base_type(globals), "ConNKlass")) {
+        fprintf(fp,"  const TypePtr *_c%d;\n", i);
+        i++;
+      }
       else if (!strcmp(comp->base_type(globals), "ConL")) {
         fprintf(fp,"  jlong            _c%d;\n", i);
         i++;
@@ -288,11 +306,12 @@
       fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i);
       break;
     }
-    case Form::idealN : { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
-    case Form::idealP : { fprintf(fp,"const TypePtr *c%d", i); break; }
-    case Form::idealL : { fprintf(fp,"jlong c%d", i);   break;        }
-    case Form::idealF : { fprintf(fp,"jfloat c%d", i);  break;        }
-    case Form::idealD : { fprintf(fp,"jdouble c%d", i); break;        }
+    case Form::idealN :      { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
+    case Form::idealNKlass : { fprintf(fp,"const TypeNarrowKlass *c%d", i); break; }
+    case Form::idealP :      { fprintf(fp,"const TypePtr *c%d", i); break; }
+    case Form::idealL :      { fprintf(fp,"jlong c%d", i);   break;        }
+    case Form::idealF :      { fprintf(fp,"jfloat c%d", i);  break;        }
+    case Form::idealD :      { fprintf(fp,"jdouble c%d", i); break;        }
     default:
       assert(!is_ideal_bool, "Non-constant operand lacks component list.");
       break;
@@ -316,6 +335,11 @@
         fprintf(fp,"const TypePtr *c%d", i);
         i++;
       }
+      else if (!strcmp(comp->base_type(globals), "ConNKlass")) {
+        if (i > 0) fprintf(fp,", ");
+        fprintf(fp,"const TypePtr *c%d", i);
+        i++;
+      }
       else if (!strcmp(comp->base_type(globals), "ConL")) {
         if (i > 0) fprintf(fp,", ");
         fprintf(fp,"jlong c%d", i);
@@ -358,18 +382,19 @@
 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   assert(oper != NULL, "what");
   CondInterface* cond = oper->_interface->is_CondInterface();
-  fprintf(fp, "         if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
-  fprintf(fp, "    else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
-  fprintf(fp, "    else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
-  fprintf(fp, "    else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
-  fprintf(fp, "    else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
-  fprintf(fp, "    else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
+  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
 }
 
 // Output code that dumps constant values, increment "i" if type is constant
 static uint dump_spec_constant(FILE *fp, const char *ideal_type, uint i, OperandForm* oper) {
   if (!strcmp(ideal_type, "ConI")) {
     fprintf(fp,"   st->print(\"#%%d\", _c%d);\n", i);
+    fprintf(fp,"   st->print(\"/0x%%08x\", _c%d);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConP")) {
@@ -380,16 +405,25 @@
     fprintf(fp,"    _c%d->dump_on(st);\n", i);
     ++i;
   }
+  else if (!strcmp(ideal_type, "ConNKlass")) {
+    fprintf(fp,"    _c%d->dump_on(st);\n", i);
+    ++i;
+  }
   else if (!strcmp(ideal_type, "ConL")) {
     fprintf(fp,"    st->print(\"#\" INT64_FORMAT, _c%d);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%d);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConF")) {
     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
+    fprintf(fp,"    jint _c%di = JavaValue(_c%d).get_jint();\n", i, i);
+    fprintf(fp,"    st->print(\"/0x%%x/\", _c%di);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConD")) {
     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
+    fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "Bool")) {
@@ -411,7 +445,7 @@
   }
 
   // Local pointer indicates remaining part of format rule
-  uint  idx = 0;                   // position of operand in match rule
+  int idx = 0;                   // position of operand in match rule
 
   // Generate internal format function, used when stored locally
   fprintf(fp, "\n#ifndef PRODUCT\n");
@@ -426,13 +460,12 @@
       oper._format->_rep_vars.reset();
       oper._format->_strings.reset();
       while ( (string = oper._format->_strings.iter()) != NULL ) {
-        fprintf(fp,"  ");
 
         // Check if this is a standard string or a replacement variable
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -455,7 +488,7 @@
           }
 
           // output invocation of "$..."s format function
-          if ( op != NULL )   op->int_format(fp, globals, idx);
+          if ( op != NULL ) op->int_format(fp, globals, idx);
 
           if ( idx == -1 ) {
             fprintf(stderr,
@@ -498,13 +531,12 @@
       oper._format->_rep_vars.reset();
       oper._format->_strings.reset();
       while ( (string = oper._format->_strings.iter()) != NULL ) {
-        fprintf(fp,"  ");
 
         // Check if this is a standard string or a replacement variable
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -529,7 +561,7 @@
           if ( op != NULL )   op->ext_format(fp, globals, idx);
 
           // Lookup the index position of the replacement variable
-          idx      = oper._components.operand_position_format(rep_var);
+          idx      = oper._components.operand_position_format(rep_var, &oper);
           if ( idx == -1 ) {
             fprintf(stderr,
                     "Using a name, %s, that isn't in match rule\n", rep_var);
@@ -583,7 +615,7 @@
     inst._format->_rep_vars.reset();
     inst._format->_strings.reset();
     while( (string = inst._format->_strings.iter()) != NULL ) {
-      fprintf(fp,"    ");
+      fprintf(fp,"  ");
       // Check if this is a standard string or a replacement variable
       if( string == NameList::_signal ) { // Replacement variable
         const char* rep_var =  inst._format->_rep_vars.iter();
@@ -640,11 +672,12 @@
   if( call_type != Form::invalid_type ) {
     switch( call_type ) {
     case Form::JAVA_DYNAMIC:
-      fprintf(fp,"    _method->print_short_name();\n");
+      fprintf(fp,"  _method->print_short_name(st);\n");
       break;
     case Form::JAVA_STATIC:
-      fprintf(fp,"    if( _method ) _method->print_short_name(st); else st->print(\" wrapper for: %%s\", _name);\n");
-      fprintf(fp,"    if( !_method ) dump_trap_args(st);\n");
+      fprintf(fp,"  if( _method ) _method->print_short_name(st);\n");
+      fprintf(fp,"  else st->print(\" wrapper for: %%s\", _name);\n");
+      fprintf(fp,"  if( !_method ) dump_trap_args(st);\n");
       break;
     case Form::JAVA_COMPILED:
     case Form::JAVA_INTERP:
@@ -652,52 +685,46 @@
     case Form::JAVA_RUNTIME:
     case Form::JAVA_LEAF:
     case Form::JAVA_NATIVE:
-      fprintf(fp,"    st->print(\" %%s\", _name);");
+      fprintf(fp,"  st->print(\" %%s\", _name);");
       break;
     default:
-      assert(0,"ShouldNotReacHere");
+      assert(0,"ShouldNotReachHere");
     }
-    fprintf(fp,  "    st->print_cr(\"\");\n" );
-    fprintf(fp,  "    if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
-    fprintf(fp,  "    st->print(\"        # \");\n" );
-    fprintf(fp,  "    if( _jvms ) _oop_map->print_on(st);\n");
+    fprintf(fp,  "  st->print_cr(\"\");\n" );
+    fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
+    fprintf(fp,  "  st->print(\"        # \");\n" );
+    fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   }
   else if(inst.is_ideal_safepoint()) {
-    fprintf(fp,  "    st->print(\"\");\n" );
-    fprintf(fp,  "    if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
-    fprintf(fp,  "    st->print(\"        # \");\n" );
-    fprintf(fp,  "    if( _jvms ) _oop_map->print_on(st);\n");
+    fprintf(fp,  "  st->print(\"\");\n" );
+    fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
+    fprintf(fp,  "  st->print(\"        # \");\n" );
+    fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   }
   else if( inst.is_ideal_if() ) {
-    fprintf(fp,  "    st->print(\"  P=%%f C=%%f\",_prob,_fcnt);\n" );
+    fprintf(fp,  "  st->print(\"  P=%%f C=%%f\",_prob,_fcnt);\n" );
   }
   else if( inst.is_ideal_mem() ) {
     // Print out the field name if available to improve readability
-    fprintf(fp,  "    if (ra->C->alias_type(adr_type())->field() != NULL) {\n");
-    fprintf(fp,  "      ciField* f = ra->C->alias_type(adr_type())->field();\n");
-    fprintf(fp,  "      st->print(\" ! Field: \");\n");
-    fprintf(fp,  "      if (f->is_volatile())\n");
-    fprintf(fp,  "        st->print(\"volatile \");\n");
-    fprintf(fp,  "      f->holder()->name()->print_symbol_on(st);\n");
-    fprintf(fp,  "      st->print(\".\");\n");
-    fprintf(fp,  "      f->name()->print_symbol_on(st);\n");
-    fprintf(fp,  "      if (f->is_constant())\n");
-    fprintf(fp,  "        st->print(\" (constant)\");\n");
-    fprintf(fp,  "    } else\n");
+    fprintf(fp,  "  if (ra->C->alias_type(adr_type())->field() != NULL) {\n");
+    fprintf(fp,  "    ciField* f = ra->C->alias_type(adr_type())->field();\n");
+    fprintf(fp,  "    st->print(\" %s Field: \");\n", commentSeperator);
+    fprintf(fp,  "    if (f->is_volatile())\n");
+    fprintf(fp,  "      st->print(\"volatile \");\n");
+    fprintf(fp,  "    f->holder()->name()->print_symbol_on(st);\n");
+    fprintf(fp,  "    st->print(\".\");\n");
+    fprintf(fp,  "    f->name()->print_symbol_on(st);\n");
+    fprintf(fp,  "    if (f->is_constant())\n");
+    fprintf(fp,  "      st->print(\" (constant)\");\n");
+    fprintf(fp,  "  } else {\n");
     // Make sure 'Volatile' gets printed out
     fprintf(fp,  "    if (ra->C->alias_type(adr_type())->is_volatile())\n");
     fprintf(fp,  "      st->print(\" volatile!\");\n");
+    fprintf(fp,  "  }\n");
   }
 
   // Complete the definition of the format function
-  fprintf(fp, "  }\n#endif\n");
-}
-
-static bool is_non_constant(char* x) {
-  // Tells whether the string (part of an operator interface) is non-constant.
-  // Simply detect whether there is an occurrence of a formal parameter,
-  // which will always begin with '$'.
-  return strchr(x, '$') == 0;
+  fprintf(fp, "}\n#endif\n");
 }
 
 void ArchDesc::declare_pipe_classes(FILE *fp_hpp) {
@@ -1089,7 +1116,7 @@
   fprintf(fp_hpp, "  static void initialize_nops(MachNode *nop_list[%d], Compile* C);\n\n",
     _pipeline->_nopcnt);
   fprintf(fp_hpp, "#ifndef PRODUCT\n");
-  fprintf(fp_hpp, "  void dump() const;\n");
+  fprintf(fp_hpp, "  void dump(outputStream *st = tty) const;\n");
   fprintf(fp_hpp, "#endif\n");
   fprintf(fp_hpp, "};\n\n");
 
@@ -1234,12 +1261,12 @@
       unsigned int position = 0;
       const char  *opret, *opname, *optype;
       oper->_matrule->base_operand(position,_globalNames,opret,opname,optype);
-      fprintf(fp,"  virtual const Type *type() const {");
+      fprintf(fp,"  virtual const Type    *type() const {");
       const char *type = getIdealType(optype);
       if( type != NULL ) {
         Form::DataType data_type = oper->is_base_constant(_globalNames);
         // Check if we are an ideal pointer type
-        if( data_type == Form::idealP || data_type == Form::idealN ) {
+        if( data_type == Form::idealP || data_type == Form::idealN || data_type == Form::idealNKlass ) {
           // Return the ideal type we already have: <TypePtr *>
           fprintf(fp," return _c0;");
         } else {
@@ -1377,6 +1404,16 @@
           fprintf(fp,   " return _c0->get_ptrtype()->reloc();");
           fprintf(fp, " }\n");
         }
+        else if (!strcmp(oper->ideal_type(_globalNames), "ConNKlass")) {
+          // Access the locally stored constant
+          fprintf(fp,"  virtual intptr_t       constant() const {");
+          fprintf(fp,   " return _c0->get_ptrtype()->get_con();");
+          fprintf(fp, " }\n");
+          // Generate query to determine if this pointer is an oop
+          fprintf(fp,"  virtual relocInfo::relocType           constant_reloc() const {");
+          fprintf(fp,   " return _c0->get_ptrtype()->reloc();");
+          fprintf(fp, " }\n");
+        }
         else if (!strcmp(oper->ideal_type(_globalNames), "ConL")) {
           fprintf(fp,"  virtual intptr_t       constant() const {");
           // We don't support addressing modes with > 4Gig offsets.
@@ -1503,12 +1540,19 @@
       fprintf(fp, "  GrowableArray<Label*> _index2label;\n");
     }
     fprintf(fp,"public:\n");
-    fprintf(fp,"  MachOper *opnd_array(uint operand_index) const { assert(operand_index < _num_opnds, \"invalid _opnd_array index\"); return _opnd_array[operand_index]; }\n");
-    fprintf(fp,"  void      set_opnd_array(uint operand_index, MachOper *operand) { assert(operand_index < _num_opnds, \"invalid _opnd_array index\"); _opnd_array[operand_index] = operand; }\n");
+    fprintf(fp,"  MachOper *opnd_array(uint operand_index) const {\n");
+    fprintf(fp,"    assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n");
+    fprintf(fp,"    return _opnd_array[operand_index];\n");
+    fprintf(fp,"  }\n");
+    fprintf(fp,"  void      set_opnd_array(uint operand_index, MachOper *operand) {\n");
+    fprintf(fp,"    assert(operand_index < _num_opnds, \"invalid _opnd_array index\");\n");
+    fprintf(fp,"    _opnd_array[operand_index] = operand;\n");
+    fprintf(fp,"  }\n");
     fprintf(fp,"private:\n");
     if ( instr->is_ideal_jump() ) {
       fprintf(fp,"  virtual void           add_case_label(int index_num, Label* blockLabel) {\n");
-      fprintf(fp,"                                          _index2label.at_put_grow(index_num, blockLabel);}\n");
+      fprintf(fp,"    _index2label.at_put_grow(index_num, blockLabel);\n");
+      fprintf(fp,"  }\n");
     }
     if( can_cisc_spill() && (instr->cisc_spill_alternate() != NULL) ) {
       fprintf(fp,"  const RegMask  *_cisc_RegMask;\n");
@@ -1544,7 +1588,7 @@
     while (attr != NULL) {
       if (strcmp(attr->_ident,"ins_cost") &&
           strcmp(attr->_ident,"ins_short_branch")) {
-        fprintf(fp,"  int             %s() const { return %s; }\n",
+        fprintf(fp,"          int            %s() const { return %s; }\n",
                 attr->_ident, attr->_val);
       }
       // Check value for ins_avoid_back_to_back, and if it is true (1), set the flag
@@ -1628,12 +1672,12 @@
 
     // Output the declaration for number of relocation entries
     if ( instr->reloc(_globalNames) != 0 ) {
-      fprintf(fp,"  virtual int            reloc()   const;\n");
+      fprintf(fp,"  virtual int            reloc() const;\n");
     }
 
     if (instr->alignment() != 1) {
-      fprintf(fp,"  virtual int            alignment_required()   const { return %d; }\n", instr->alignment());
-      fprintf(fp,"  virtual int            compute_padding(int current_offset)   const;\n");
+      fprintf(fp,"  virtual int            alignment_required() const { return %d; }\n", instr->alignment());
+      fprintf(fp,"  virtual int            compute_padding(int current_offset) const;\n");
     }
 
     // Starting point for inputs matcher wants.
@@ -1803,13 +1847,14 @@
       // as is done for pointers
       //
       // Construct appropriate constant type containing the constant value.
-      fprintf(fp,"  virtual const class Type *bottom_type() const{\n");
+      fprintf(fp,"  virtual const class Type *bottom_type() const {\n");
       switch( data_type ) {
       case Form::idealI:
         fprintf(fp,"    return  TypeInt::make(opnd_array(1)->constant());\n");
         break;
       case Form::idealP:
       case Form::idealN:
+      case Form::idealNKlass:
         fprintf(fp,"    return  opnd_array(1)->type();\n");
         break;
       case Form::idealD:
@@ -1833,7 +1878,7 @@
       // !!!!! !!!!!
       // Provide explicit bottom type for conversions to int
       // On Intel the result operand is a stackSlot, untyped.
-      fprintf(fp,"  virtual const class Type *bottom_type() const{");
+      fprintf(fp,"  virtual const class Type *bottom_type() const {");
       fprintf(fp,   " return  TypeInt::INT;");
       fprintf(fp, " };\n");
     }*/
@@ -1854,7 +1899,7 @@
       // BoxNode provides the address of a stack slot.
       // Define its bottom type to be TypeRawPtr::BOTTOM instead of TypePtr::BOTTOM
       // This prevent s insert_anti_dependencies from complaining. It will
-      // complain if it see that the pointer base is TypePtr::BOTTOM since
+      // complain if it sees that the pointer base is TypePtr::BOTTOM since
       // it doesn't understand what that might alias.
       fprintf(fp,"  const Type            *bottom_type() const { return TypeRawPtr::BOTTOM; } // Box?\n");
     }
@@ -2017,7 +2062,7 @@
 class OutputMachOperands : public OutputMap {
 public:
   OutputMachOperands(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD) {};
+    : OutputMap(hpp, cpp, globals, AD, "MachOperands") {};
 
   void declaration() { }
   void definition()  { fprintf(_cpp, "enum MachOperands {\n"); }
@@ -2052,7 +2097,7 @@
   int end_instructions;
 public:
   OutputMachOpcodes(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD)
-    : OutputMap(hpp, cpp, globals, AD),
+    : OutputMap(hpp, cpp, globals, AD, "MachOpcodes"),
       begin_inst_chain_rule(-1), end_inst_chain_rule(-1), end_instructions(-1)
   {};
 
--- a/hotspot/src/share/vm/asm/assembler.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/asm/assembler.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/share/vm/asm/assembler.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/asm/assembler.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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/hotspot/src/share/vm/asm/register.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/asm/register.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_CFGPrinter.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, 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
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/share/vm/c1/c1_Compilation.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -32,6 +32,7 @@
 #include "c1/c1_ValueMap.hpp"
 #include "c1/c1_ValueStack.hpp"
 #include "code/debugInfoRec.hpp"
+#include "compiler/compileLog.hpp"
 
 
 typedef enum {
@@ -67,10 +68,25 @@
 class PhaseTraceTime: public TraceTime {
  private:
   JavaThread* _thread;
+  CompileLog* _log;
 
  public:
-  PhaseTraceTime(TimerName timer):
-    TraceTime("", &timers[timer], CITime || CITimeEach, Verbose) {
+  PhaseTraceTime(TimerName timer)
+  : TraceTime("", &timers[timer], CITime || CITimeEach, Verbose), _log(NULL) {
+    if (Compilation::current() != NULL) {
+      _log = Compilation::current()->log();
+    }
+
+    if (_log != NULL) {
+      _log->begin_head("phase name='%s'", timer_name[timer]);
+      _log->stamp();
+      _log->end_head();
+    }
+  }
+
+  ~PhaseTraceTime() {
+    if (_log != NULL)
+      _log->done("phase");
   }
 };
 
@@ -390,6 +406,10 @@
     PhaseTraceTime timeit(_t_codeinstall);
     install_code(frame_size);
   }
+
+  if (log() != NULL) // Print code cache state into compiler log
+    log()->code_cache_state();
+
   totalInstructionNodes += Instruction::number_of_instructions();
 }
 
@@ -456,6 +476,7 @@
                          int osr_bci, BufferBlob* buffer_blob)
 : _compiler(compiler)
 , _env(env)
+, _log(env->log())
 , _method(method)
 , _osr_bci(osr_bci)
 , _hir(NULL)
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -66,6 +66,7 @@
   int _next_block_id;
   AbstractCompiler*  _compiler;
   ciEnv*             _env;
+  CompileLog*        _log;
   ciMethod*          _method;
   int                _osr_bci;
   IR*                _hir;
@@ -123,6 +124,7 @@
 
   // accessors
   ciEnv* env() const                             { return _env; }
+  CompileLog* log() const                        { return _log; }
   AbstractCompiler* compiler() const             { return _compiler; }
   bool has_exception_handlers() const            { return _has_exception_handlers; }
   bool has_fpu_code() const                      { return _has_fpu_code; }
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/share/vm/c1/c1_FrameMap.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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/hotspot/src/share/vm/c1/c1_FrameMap.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_FrameMap.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1682,6 +1682,12 @@
   ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder);
   ciInstanceKlass* actual_recv = callee_holder;
 
+  CompileLog* log = compilation()->log();
+  if (log != NULL)
+      log->elem("call method='%d' instr='%s'",
+                log->identify(target),
+                Bytecodes::name(code));
+
   // Some methods are obviously bindable without any type checks so
   // convert them directly to an invokespecial or invokestatic.
   if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
@@ -1826,6 +1832,7 @@
     }
     code = Bytecodes::_invokespecial;
   }
+
   // check if we could do inlining
   if (!PatchALot && Inline && klass->is_loaded() &&
       (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized())
@@ -2448,6 +2455,7 @@
 #endif
   _skip_block = false;
   assert(state() != NULL, "ValueStack missing!");
+  CompileLog* log = compilation()->log();
   ciBytecodeStream s(method());
   s.reset_to_bci(bci);
   int prev_bci = bci;
@@ -2466,6 +2474,9 @@
          (block_at(s.cur_bci()) == NULL || block_at(s.cur_bci()) == block())) {
     assert(state()->kind() == ValueStack::Parsing, "invalid state kind");
 
+    if (log != NULL)
+      log->set_context("bc code='%d' bci='%d'", (int)code, s.cur_bci());
+
     // Check for active jsr during OSR compilation
     if (compilation()->is_osr_compile()
         && scope()->is_top_scope()
@@ -2686,8 +2697,13 @@
       case Bytecodes::_breakpoint     : BAILOUT_("concurrent setting of breakpoint", NULL);
       default                         : ShouldNotReachHere(); break;
     }
+
+    if (log != NULL)
+      log->clear_context(); // skip marker if nothing was printed
+
     // save current bci to setup Goto at the end
     prev_bci = s.cur_bci();
+
   }
   CHECK_BAILOUT_(NULL);
   // stop processing of this block (see try_inline_full)
@@ -3667,7 +3683,7 @@
       INLINE_BAILOUT("total inlining greater than DesiredMethodLimit");
     }
     // printing
-    print_inlining(callee, "");
+    print_inlining(callee);
   }
 
   // NOTE: Bailouts from this point on, which occur at the
@@ -4133,8 +4149,19 @@
 
 
 void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool success) {
+  CompileLog* log = compilation()->log();
+  if (log != NULL) {
+    if (success) {
+      if (msg != NULL)
+        log->inline_success(msg);
+      else
+        log->inline_success("receiver is statically known");
+    } else {
+      log->inline_fail(msg);
+    }
+  }
+
   if (!PrintInlining)  return;
-  assert(msg != NULL, "must be");
   CompileTask::print_inlining(callee, scope()->level(), bci(), msg);
   if (success && CIPrintMethodCodes) {
     callee->print_codes();
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -31,6 +31,7 @@
 #include "c1/c1_ValueStack.hpp"
 #include "ci/ciMethodData.hpp"
 #include "ci/ciStreams.hpp"
+#include "compiler/compileLog.hpp"
 
 class MemoryBuffer;
 
@@ -369,7 +370,7 @@
   void append_unsafe_CAS(ciMethod* callee);
   bool append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
 
-  void print_inlining(ciMethod* callee, const char* msg, bool success = true);
+  void print_inlining(ciMethod* callee, const char* msg = NULL, bool success = true);
 
   void profile_call(ciMethod* callee, Value recv, ciKlass* predicted_holder);
   void profile_invocation(ciMethod* inlinee, ValueStack* state);
--- a/hotspot/src/share/vm/c1/c1_IR.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/share/vm/c1/c1_IR.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_IR.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, 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
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1286,7 +1286,7 @@
   if (x->needs_null_check()) {
     info = state_for(x);
   }
-  __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), UseCompressedKlassPointers ? T_OBJECT : T_ADDRESS), result, info);
+  __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), result, info);
   __ move_wide(new LIR_Address(result, in_bytes(Klass::java_mirror_offset()), T_OBJECT), result);
 }
 
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
--- a/hotspot/src/share/vm/c1/c1_LinearScan.hpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.hpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
--- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -29,6 +29,7 @@
 #include "c1/c1_ValueSet.hpp"
 #include "c1/c1_ValueStack.hpp"
 #include "utilities/bitMap.inline.hpp"
+#include "compiler/compileLog.hpp"
 
 define_array(ValueSetArray, ValueSet*);
 define_stack(ValueSetList, ValueSetArray);
@@ -54,7 +55,18 @@
       // substituted some ifops/phis, so resolve the substitution
       SubstitutionResolver sr(_hir);
     }
+
+    CompileLog* log = _hir->compilation()->log();
+    if (log != NULL)
+      log->set_context("optimize name='cee'");
   }
+
+  ~CE_Eliminator() {
+    CompileLog* log = _hir->compilation()->log();
+    if (log != NULL)
+      log->clear_context(); // skip marker if nothing was printed
+  }
+
   int cee_count() const                          { return _cee_count; }
   int ifop_count() const                         { return _ifop_count; }
 
@@ -306,6 +318,15 @@
   , _merge_count(0)
   {
     _hir->iterate_preorder(this);
+    CompileLog* log = _hir->compilation()->log();
+    if (log != NULL)
+      log->set_context("optimize name='eliminate_blocks'");
+  }
+
+  ~BlockMerger() {
+    CompileLog* log = _hir->compilation()->log();
+    if (log != NULL)
+      log->clear_context(); // skip marker if nothing was printed
   }
 
   bool try_merge(BlockBegin* block) {
@@ -574,6 +595,15 @@
     , _work_list(new BlockList()) {
     _visitable_instructions = new ValueSet();
     _visitor.set_eliminator(this);
+    CompileLog* log = _opt->ir()->compilation()->log();
+    if (log != NULL)
+      log->set_context("optimize name='null_check_elimination'");
+  }
+
+  ~NullCheckEliminator() {
+    CompileLog* log = _opt->ir()->compilation()->log();
+    if (log != NULL)
+      log->clear_context(); // skip marker if nothing was printed
   }
 
   Optimizer*  opt()                               { return _opt; }
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Oct 11 15:30:23 2012 -0700
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Oct 18 22:01:26 2012 -0700
@@ -327,7 +327,7 @@
   //       anymore after new_typeArray() and no GC can happen before.
   //       (This may have to change if this code changes!)
   assert(klass->is_klass(), "not a class");
-  BasicType elt_type = typeArrayKlass::cast(klass)->element_type();
+  BasicType elt_type = TypeArrayKlass::cast(klass)->element_type();
   oop obj = oopFactory::new_typeArray(elt_type, length, CHECK);
   thread->set_vm_result(obj);
   // This is pretty rare but this runtime patch is stressful to deoptimization
@@ -346,7 +346,7 @@
   //       anymore after new_objArray() and no GC can happen before.
   //       (This may have to change if this code changes!)
   assert(array_klass->is_klass(), "not a class");
-  Klass* elem_klass = objArrayKlass::cast(array_klass)->element_klass();
+  Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
   objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
   thread->set_vm_result(obj);
   // This is pretty rare but this runtime patch is stressful to deoptimization
@@ -362,7 +362,7 @@
 
   assert(klass->is_klass(), "not a class");
   assert(rank >= 1, "rank must be nonzero");
-  oop obj = arrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
+  oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
   thread->set_vm_result(obj);
 JRT_END
 
@@ -1234,8 +1234,8 @@
     bs->write_ref_array((HeapWord*)dst_addr, length);
     return ac_ok;
   } else {
-    Klass* bound = objArrayKlass::cast(dst->klass())->element_klass();
-