changeset 2104:57053c7bee2c

merge with jdk7-b131
author mcimadamore
date Tue, 01 Mar 2011 15:05:39 +0000
parents 7dd6319394e9 7dc5384467e0
children fe8ab1affd14
files agent/src/share/classes/sun/jvm/hotspot/oops/SymbolKlass.java agent/src/share/classes/sun/jvm/hotspot/runtime/LowMemoryDetectorThread.java src/share/vm/ci/ciSymbolKlass.cpp src/share/vm/ci/ciSymbolKlass.hpp src/share/vm/gc_implementation/g1/concurrentZFThread.cpp src/share/vm/gc_implementation/g1/concurrentZFThread.hpp src/share/vm/oops/symbolKlass.cpp src/share/vm/oops/symbolKlass.hpp src/share/vm/oops/symbolOop.cpp src/share/vm/oops/symbolOop.hpp
diffstat 500 files changed, 12564 insertions(+), 8839 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jan 05 10:06:07 2011 +0000
+++ b/.hgtags	Tue Mar 01 15:05:39 2011 +0000
@@ -138,3 +138,16 @@
 5484e7c53fa7da5e869902437ee08a9ae10c1c69 hs20-b03
 9669f9b284108a9ee0a0ccbe215c37a130c9dcf5 jdk7-b123
 9669f9b284108a9ee0a0ccbe215c37a130c9dcf5 hs20-b04
+0a8e0d4345b37b71ec49dda08ee03b68c4f1b592 jdk7-b124
+0a8e0d4345b37b71ec49dda08ee03b68c4f1b592 hs20-b05
+e24ab3fa6aafad3efabbe7dba9918c5f461a20b1 jdk7-b125
+4c851c931d001a882cab809aaf3a55371b919244 jdk7-b126
+e24ab3fa6aafad3efabbe7dba9918c5f461a20b1 hs20-b06
+d535bf4c12355a2897e918da9f8910c0aceec4fb hs20-b07
+102466e70debc4b907afbd7624e34ddb1aafee9f jdk7-b127
+9a5762f448595794d449a8e17342abd81a3fadaf jdk7-b128
+ae4b185f2ed14af7bab610738c333840598cdcc4 jdk7-b129
+ae4b185f2ed14af7bab610738c333840598cdcc4 hs21-b01
+e9aa2ca89ad6c53420623d579765f9706ec523d7 jdk7-b130
+0aa3b49089112d5faa77902ad680c582ab53f651 jdk7-b131
+e9aa2ca89ad6c53420623d579765f9706ec523d7 hs21-b02
--- a/LICENSE	Wed Jan 05 10:06:07 2011 +0000
+++ b/LICENSE	Tue Mar 01 15:05:39 2011 +0000
@@ -325,11 +325,11 @@
 
 "CLASSPATH" EXCEPTION TO THE GPL
 
-Certain source files distributed by Oracle and/or its affiliates, are subject to
-the following clarification and special exception to the GPL, but only where
-Oracle has expressly included in the particular source file's header the words
-"Oracle designates this particular file as subject to the "Classpath" exception
-as provided by Oracle in the LICENSE file that accompanied this code."
+Certain source files distributed by Oracle America and/or its affiliates are
+subject to the following clarification and special exception to the GPL, but
+only where Oracle has expressly included in the particular source file's header
+the words "Oracle designates this particular file as subject to the "Classpath"
+exception as provided by Oracle in the LICENSE file that accompanied this code."
 
     Linking this library statically or dynamically with other modules is making
     a combined work based on this library.  Thus, the terms and conditions of
--- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java	Tue Mar 01 15:05:39 2011 +0000
@@ -428,6 +428,36 @@
                 }
             }
         },
+        new Command("symbol", "symbol address", false) {
+            public void doit(Tokens t) {
+                if (t.countTokens() != 1) {
+                    usage();
+                } else {
+                    Address a = VM.getVM().getDebugger().parseAddress(t.nextToken());
+                    Symbol.create(a).printValueOn(out);
+                    out.println();
+                }
+            }
+        },
+        new Command("symboltable", "symboltable name", false) {
+            public void doit(Tokens t) {
+                if (t.countTokens() != 1) {
+                    usage();
+                } else {
+                    out.println(SymbolTable.getTheTable().probe(t.nextToken()));
+                }
+            }
+        },
+        new Command("symboldump", "symboldump", false) {
+            public void doit(Tokens t) {
+                SymbolTable.getTheTable().symbolsDo(new SymbolTable.SymbolVisitor() {
+                        public void visit(Symbol sym) {
+                            sym.printValueOn(out);
+                            out.println();
+                        }
+                    });
+            }
+        },
         new Command("flags", "flags [ flag ]", false) {
             public void doit(Tokens t) {
                 int tokens = t.countTokens();
@@ -629,17 +659,6 @@
                 }
             }
         },
-        new Command("symbol", "symbol name", false) {
-            public void doit(Tokens t) {
-                if (t.countTokens() != 1) {
-                    usage();
-                } else {
-                    String symbol = t.nextToken();
-                    Address a = lookup(symbol);
-                    out.println(symbol + " = " + a);
-                }
-            }
-        },
         new Command("printstatics", "printstatics [ type ]", false) {
             public void doit(Tokens t) {
                 if (t.countTokens() > 1) {
@@ -1262,6 +1281,9 @@
         this.err = err;
         for (int i = 0; i < commandList.length; i++) {
             Command c = commandList[i];
+            if (commands.get(c.name) != null) {
+                throw new InternalError(c.name + " has multiple definitions");
+            }
             commands.put(c.name, c);
         }
         if (debugger.isAttached()) {
--- a/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/HotSpotTypeDataBase.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,37 @@
     readVMLongConstants();
   }
 
+  public Type lookupType(String cTypeName, boolean throwException) {
+    Type fieldType = super.lookupType(cTypeName, false);
+    if (fieldType == null && cTypeName.startsWith("const ")) {
+      fieldType = (BasicType)lookupType(cTypeName.substring(6), false);
+    }
+    if (fieldType == null && cTypeName.endsWith(" const")) {
+        fieldType = (BasicType)lookupType(cTypeName.substring(0, cTypeName.length() - 6), false);
+    }
+    if (fieldType == null) {
+      if (cTypeName.startsWith("GrowableArray<") && cTypeName.endsWith(">*")) {
+        String ttype = cTypeName.substring("GrowableArray<".length(),
+                                            cTypeName.length() - 2);
+        Type templateType = lookupType(ttype, false);
+        if (templateType == null && typeNameIsPointerType(ttype)) {
+          templateType = recursiveCreateBasicPointerType(ttype);
+        }
+        if (templateType == null) {
+          lookupOrFail(ttype);
+        }
+        fieldType = recursiveCreateBasicPointerType(cTypeName);
+      }
+    }
+    if (fieldType == null && typeNameIsPointerType(cTypeName)) {
+      fieldType = recursiveCreateBasicPointerType(cTypeName);
+    }
+    if (fieldType == null && throwException) {
+      super.lookupType(cTypeName, true);
+    }
+    return fieldType;
+  }
+
   private void readVMTypes() {
     // Get the variables we need in order to traverse the VMTypeEntry[]
     long typeEntryTypeNameOffset;
@@ -99,15 +130,8 @@
     long typeEntrySizeOffset;
     long typeEntryArrayStride;
 
-    typeEntryTypeNameOffset       = getLongValueFromProcess("gHotSpotVMTypeEntryTypeNameOffset");
-    typeEntrySuperclassNameOffset = getLongValueFromProcess("gHotSpotVMTypeEntrySuperclassNameOffset");
-    typeEntryIsOopTypeOffset      = getLongValueFromProcess("gHotSpotVMTypeEntryIsOopTypeOffset");
-    typeEntryIsIntegerTypeOffset  = getLongValueFromProcess("gHotSpotVMTypeEntryIsIntegerTypeOffset");
-    typeEntryIsUnsignedOffset     = getLongValueFromProcess("gHotSpotVMTypeEntryIsUnsignedOffset");
-    typeEntrySizeOffset           = getLongValueFromProcess("gHotSpotVMTypeEntrySizeOffset");
-    typeEntryArrayStride          = getLongValueFromProcess("gHotSpotVMTypeEntryArrayStride");
-
-    // Fetch the address of the VMTypeEntry*
+    // Fetch the address of the VMTypeEntry*. We get this symbol first
+    // and try to use it to make sure that symbol lookup is working.
     Address entryAddr = lookupInProcess("gHotSpotVMTypes");
     //    System.err.println("gHotSpotVMTypes address = " + entryAddr);
     // Dereference this once to get the pointer to the first VMTypeEntry
@@ -118,6 +142,14 @@
       throw new RuntimeException("gHotSpotVMTypes was not initialized properly in the remote process; can not continue");
     }
 
+    typeEntryTypeNameOffset       = getLongValueFromProcess("gHotSpotVMTypeEntryTypeNameOffset");
+    typeEntrySuperclassNameOffset = getLongValueFromProcess("gHotSpotVMTypeEntrySuperclassNameOffset");
+    typeEntryIsOopTypeOffset      = getLongValueFromProcess("gHotSpotVMTypeEntryIsOopTypeOffset");
+    typeEntryIsIntegerTypeOffset  = getLongValueFromProcess("gHotSpotVMTypeEntryIsIntegerTypeOffset");
+    typeEntryIsUnsignedOffset     = getLongValueFromProcess("gHotSpotVMTypeEntryIsUnsignedOffset");
+    typeEntrySizeOffset           = getLongValueFromProcess("gHotSpotVMTypeEntrySizeOffset");
+    typeEntryArrayStride          = getLongValueFromProcess("gHotSpotVMTypeEntryArrayStride");
+
     // Start iterating down it until we find an entry with no name
     Address typeNameAddr = null;
     do {
@@ -249,7 +281,7 @@
         BasicType containingType = lookupOrFail(typeName);
 
         // The field's Type must already be in the database -- no exceptions
-        BasicType fieldType = lookupOrFail(typeString);
+        BasicType fieldType = (BasicType)lookupType(typeString);
 
         // Create field by type
         createField(containingType, fieldName, fieldType,
@@ -441,10 +473,17 @@
       workarounds due to incomplete information in the VMStructs
       database. */
   private BasicPointerType recursiveCreateBasicPointerType(String typeName) {
+    BasicPointerType result = (BasicPointerType)super.lookupType(typeName, false);
+    if (result != null) {
+      return result;
+    }
     String targetTypeName = typeName.substring(0, typeName.lastIndexOf('*')).trim();
     Type targetType = null;
     if (typeNameIsPointerType(targetTypeName)) {
-      targetType = recursiveCreateBasicPointerType(targetTypeName);
+      targetType = lookupType(targetTypeName, false);
+      if (targetType == null) {
+        targetType = recursiveCreateBasicPointerType(targetTypeName);
+      }
     } else {
       targetType = lookupType(targetTypeName, false);
       if (targetType == null) {
@@ -465,6 +504,20 @@
           BasicType basicTargetType = createBasicType(targetTypeName, false, true, true);
           basicTargetType.setSize(1);
           targetType = basicTargetType;
+        } else if (targetTypeName.startsWith("GrowableArray<")) {
+          BasicType basicTargetType = createBasicType(targetTypeName, false, false, false);
+
+          // transfer fields from GenericGrowableArray to template instance
+          BasicType generic = lookupOrFail("GenericGrowableArray");
+          basicTargetType.setSize(generic.getSize());
+          Iterator fields = generic.getFields();
+          while (fields.hasNext()) {
+              Field f = (Field)fields.next();
+              basicTargetType.addField(internalCreateField(basicTargetType, f.getName(),
+                                                           f.getType(), f.isStatic(),
+                                                           f.getOffset(), null));
+          }
+          targetType = basicTargetType;
         } else {
           if (DEBUG) {
             System.err.println("WARNING: missing target type \"" + targetTypeName + "\" for pointer type \"" + typeName + "\"");
@@ -473,7 +526,10 @@
         }
       }
     }
-    return new BasicPointerType(this, typeName, targetType);
+    result = new BasicPointerType(this, typeName, targetType);
+    result.setSize(UNINITIALIZED_SIZE);
+    addType(result);
+    return result;
   }
 
   private boolean typeNameIsPointerType(String typeName) {
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,10 +122,14 @@
       private MemoizedObject[] sectionHeaders;
       private MemoizedObject[] symbols;
 
+      // Init stringTable at decl time since other fields init'ed in the
+      // constructor need the String Table.
       private MemoizedObject stringTable = new MemoizedObject() {
           public Object computeValue() {
+            // the String Table follows the Symbol Table
             int ptr = getPointerToSymbolTable();
             if (ptr == 0) {
+              // no Symbol Table so no String Table
               return new StringTable(0);
             } else {
               return new StringTable(ptr + SYMBOL_SIZE * getNumberOfSymbols());
@@ -140,6 +144,8 @@
         timeDateStamp = readInt();
         pointerToSymbolTable = readInt();
         numberOfSymbols = readInt();
+        // String Table can be accessed at this point because
+        // pointerToSymbolTable and numberOfSymbols fields are set.
         sizeOfOptionalHeader = readShort();
         characteristics = readShort();
 
@@ -222,6 +228,8 @@
         private MemoizedObject windowsSpecificFields;
         private MemoizedObject dataDirectories;
 
+        // We use an offset of 2 because OptionalHeaderStandardFieldsImpl doesn't
+        // include the 'magic' field.
         private static final int STANDARD_FIELDS_OFFSET = 2;
         private static final int PE32_WINDOWS_SPECIFIC_FIELDS_OFFSET = 28;
         private static final int PE32_DATA_DIRECTORIES_OFFSET = 96;
@@ -288,7 +296,7 @@
         private int sizeOfUninitializedData;
         private int addressOfEntryPoint;
         private int baseOfCode;
-        private int baseOfData;
+        private int baseOfData;  // only set in PE32
 
         OptionalHeaderStandardFieldsImpl(int offset,
                                          boolean isPE32Plus) {
@@ -301,7 +309,8 @@
           sizeOfUninitializedData = readInt();
           addressOfEntryPoint = readInt();
           baseOfCode = readInt();
-          if (isPE32Plus) {
+          if (!isPE32Plus) {
+            // only available in PE32
             baseOfData = readInt();
           }
         }
@@ -433,7 +442,10 @@
                 if (dir.getRVA() == 0 || dir.getSize() == 0) {
                   return null;
                 }
-                return new ExportDirectoryTableImpl(rvaToFileOffset(dir.getRVA()), dir.getSize());
+                // ExportDirectoryTableImpl needs both the RVA and the
+                // RVA converted to a file offset.
+                return new
+                    ExportDirectoryTableImpl(dir.getRVA(), dir.getSize());
               }
             };
 
@@ -526,6 +538,7 @@
       }
 
       class ExportDirectoryTableImpl implements ExportDirectoryTable {
+        private int exportDataDirRVA;
         private int offset;
         private int size;
 
@@ -548,8 +561,9 @@
         private MemoizedObject exportOrdinalTable;
         private MemoizedObject exportAddressTable;
 
-        ExportDirectoryTableImpl(int offset, int size) {
-          this.offset = offset;
+        ExportDirectoryTableImpl(int exportDataDirRVA, int size) {
+          this.exportDataDirRVA = exportDataDirRVA;
+          offset = rvaToFileOffset(exportDataDirRVA);
           this.size   = size;
           seek(offset);
           exportFlags = readInt();
@@ -595,6 +609,7 @@
 
           exportOrdinalTable = new MemoizedObject() {
               public Object computeValue() {
+                // number of ordinals is same as the number of name pointers
                 short[] ordinals = new short[getNumberOfNamePointers()];
                 seek(rvaToFileOffset(getOrdinalTableRVA()));
                 for (int i = 0; i < ordinals.length; i++) {
@@ -608,14 +623,18 @@
               public Object computeValue() {
                 int[] addresses = new int[getNumberOfAddressTableEntries()];
                 seek(rvaToFileOffset(getExportAddressTableRVA()));
-                // Must make two passes to avoid rvaToFileOffset
-                // destroying seek() position
+                // The Export Address Table values are a union of two
+                // possible values:
+                //   Export RVA - The address of the exported symbol when
+                //       loaded into memory, relative to the image base.
+                //       This value doesn't get converted into a file offset.
+                //   Forwarder RVA - The pointer to a null-terminated ASCII
+                //       string in the export section. This value gets
+                //       converted into a file offset because we have to
+                //       fetch the string.
                 for (int i = 0; i < addresses.length; i++) {
                   addresses[i] = readInt();
                 }
-                for (int i = 0; i < addresses.length; i++) {
-                  addresses[i] = rvaToFileOffset(addresses[i]);
-                }
                 return addresses;
               }
             };
@@ -648,11 +667,12 @@
 
         public boolean isExportAddressForwarder(short ordinal) {
           int addr = getExportAddress(ordinal);
-          return ((offset <= addr) && (addr < (offset + size)));
+          return ((exportDataDirRVA <= addr) &&
+              (addr < (exportDataDirRVA + size)));
         }
 
         public String getExportAddressForwarder(short ordinal) {
-          seek(getExportAddress(ordinal));
+          seek(rvaToFileOffset(getExportAddress(ordinal)));
           return readCString();
         }
 
@@ -3371,10 +3391,17 @@
               throw new COFFException(e);
             }
             // Look up in string table
+            // FIXME: this index value is assumed to be in the valid range
             name = getStringTable().get(index);
           } else {
             try {
-              name = new String(tmpName, US_ASCII);
+              int length = 0;
+              // find last non-NULL
+              for (; length < tmpName.length && tmpName[length] != '\0';) {
+                length++;
+              }
+              // don't include NULL chars in returned name String
+              name = new String(tmpName, 0, length, US_ASCII);
             } catch (UnsupportedEncodingException e) {
               throw new COFFException(e);
             }
@@ -3487,6 +3514,7 @@
                                 tmpName[5] << 16 |
                                 tmpName[6] <<  8 |
                                 tmpName[7]);
+            // FIXME: stringOffset is assumed to be in the valid range
             name = getStringTable().getAtOffset(stringOffset);
           }
 
@@ -3698,12 +3726,13 @@
 
         StringTable(int offset) {
           if (offset == 0) {
+            // no String Table
             strings = new COFFString[0];
             return;
           }
 
           seek(offset);
-          int length = readInt();
+          int length = readInt();  // length includes itself
           byte[] data = new byte[length - 4];
           int numBytesRead = readBytes(data);
           if (numBytesRead != data.length) {
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/DumpExports.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/DumpExports.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,35 +37,48 @@
 
     String filename = args[0];
     COFFFile file   = COFFFileParser.getParser().parse(filename);
-    ExportDirectoryTable exports =
-      file.getHeader().
-        getOptionalHeader().
-          getDataDirectories().
-            getExportDirectoryTable();
+
+    // get common point for both things we want to dump
+    OptionalHeaderDataDirectories dataDirs = file.getHeader().getOptionalHeader().
+        getDataDirectories();
+
+    // dump the header data directory for the Export Table:
+    DataDirectory dir = dataDirs.getExportTable();
+    System.out.println("Export table: RVA = " + dir.getRVA() + "/0x" +
+        Integer.toHexString(dir.getRVA()) + ", size = " + dir.getSize() + "/0x" +
+        Integer.toHexString(dir.getSize()));
+
+    System.out.println(file.getHeader().getNumberOfSections() + " sections in file");
+    for (int i = 1; i <= file.getHeader().getNumberOfSections(); i++) {
+      SectionHeader sec = file.getHeader().getSectionHeader(i);
+      System.out.println("  Section " + i + ":");
+      System.out.println("    Name = '" + sec.getName() + "'");
+      System.out.println("    VirtualSize = " + sec.getSize() + "/0x" +
+          Integer.toHexString(sec.getSize()));
+      System.out.println("    VirtualAddress = " + sec.getVirtualAddress() + "/0x" +
+          Integer.toHexString(sec.getVirtualAddress()));
+      System.out.println("    SizeOfRawData = " + sec.getSizeOfRawData() + "/0x" +
+          Integer.toHexString(sec.getSizeOfRawData()));
+      System.out.println("    PointerToRawData = " + sec.getPointerToRawData() + "/0x" +
+          Integer.toHexString(sec.getPointerToRawData()));
+    }
+
+    ExportDirectoryTable exports = dataDirs.getExportDirectoryTable();
     if (exports == null) {
       System.out.println("No exports found.");
     } else {
-      System.out.println(file.getHeader().getNumberOfSections() + " sections in file");
-      for (int i = 0; i < file.getHeader().getNumberOfSections(); i++) {
-        System.out.println("  Section " + i + ": " + file.getHeader().getSectionHeader(1 + i).getName());
-      }
-
-      DataDirectory dir = file.getHeader().getOptionalHeader().getDataDirectories().getExportTable();
-      System.out.println("Export table: RVA = 0x" + Integer.toHexString(dir.getRVA()) +
-                         ", size = 0x" + Integer.toHexString(dir.getSize()));
-
       System.out.println("DLL name: " + exports.getDLLName());
       System.out.println("Time/date stamp 0x" + Integer.toHexString(exports.getTimeDateStamp()));
       System.out.println("Major version 0x" + Integer.toHexString(exports.getMajorVersion() & 0xFFFF));
       System.out.println("Minor version 0x" + Integer.toHexString(exports.getMinorVersion() & 0xFFFF));
-      System.out.println(exports.getNumberOfNamePointers() + " functions found");
+      System.out.println(exports.getNumberOfNamePointers() + " exports found");
       for (int i = 0; i < exports.getNumberOfNamePointers(); i++) {
-        System.out.println("  0x" +
-                           Integer.toHexString(exports.getExportAddress(exports.getExportOrdinal(i))) +
-                           "  " +
-                           (exports.isExportAddressForwarder(exports.getExportOrdinal(i))  ?
-                            ("Forwarded to " + exports.getExportAddressForwarder(exports.getExportOrdinal(i))) :
-                            exports.getExportName(i)));
+        short ordinal = exports.getExportOrdinal(i);
+        System.out.print("[" + i + "] '" + exports.getExportName(i) + "': [" +
+            ordinal + "] = 0x" + Integer.toHexString(exports.getExportAddress(ordinal)));
+        System.out.println(exports.isExportAddressForwarder(ordinal)
+            ? "  Forwarded to '" + exports.getExportAddressForwarder(ordinal) + "'"
+            : "");
       }
     }
   }
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/TestParser.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/win32/coff/TestParser.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,8 +42,8 @@
       COFFHeader header = file.getHeader();
       int numSections = header.getNumberOfSections();
       System.out.println(numSections + " sections detected.");
-      for (int i = 0; i < numSections; i++) {
-        SectionHeader secHeader = header.getSectionHeader(1 + i);
+      for (int i = 1; i <= numSections; i++) {
+        SectionHeader secHeader = header.getSectionHeader(i);
         System.out.println(secHeader.getName());
       }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -506,7 +506,6 @@
     throw new DebuggerException("Unimplemented");
   }
 
-  private static String  DTFWHome;
   private static String  imagePath;
   private static String  symbolPath;
   private static boolean useNativeLookup;
@@ -514,81 +513,143 @@
     static {
 
      /*
-      * sawindbg.dll depends on dbgeng.dll which
-      * itself depends on dbghelp.dll. dbgeng.dll and dbghelp.dll.
-      * On systems newer than Windows 2000, these two .dlls are
-      * in the standard system directory so we will find them there.
-      * On Windows 2000 and earlier, these files do not exist.
-      * The user must download Debugging Tools For Windows (DTFW)
-      * and install it in order to use SA.
+      * sawindbg.dll depends on dbgeng.dll which itself depends on
+      * dbghelp.dll. We have to make sure that the dbgeng.dll and
+      * dbghelp.dll that we load are compatible with each other. We
+      * load both of those libraries from the same directory based
+      * on the theory that co-located libraries are compatible.
       *
-      * We have to make sure we use the two files from the same directory
-      * in case there are more than one copy on the system because
-      * one version of dbgeng.dll might not be compatible with a
-      * different version of dbghelp.dll.
-      * We first look for them in the directory pointed at by
-      * env. var. DEBUGGINGTOOLSFORWINDOWS, next in the default
-      * installation dir for DTFW, and lastly in the standard
-      * system directory.  We expect that that we will find
-      * them in the standard system directory on all systems
-      * newer than Windows 2000.
+      * On Windows 2000 and earlier, dbgeng.dll and dbghelp.dll were
+      * not included as part of the standard system directory. On
+      * systems newer than Windows 2000, dbgeng.dll and dbghelp.dll
+      * are included in the standard system directory. However, the
+      * versions included in the standard system directory may not
+      * be able to handle symbol information for the newer compilers.
+      *
+      * We search for and explicitly load the libraries using the
+      * following directory search order:
+      *
+      * - java.home/bin (same as $JAVA_HOME/jre/bin)
+      * - dir named by DEBUGGINGTOOLSFORWINDOWS environment variable
+      * - various "Debugging Tools For Windows" program directories
+      * - the system directory ($SYSROOT/system32)
+      *
+      * If SA is invoked with -Dsun.jvm.hotspot.loadLibrary.DEBUG=1,
+      * then debug messages about library loading are printed to
+      * System.err.
       */
-    String dirName = null;
-    DTFWHome = System.getenv("DEBUGGINGTOOLSFORWINDOWS");
 
-    if (DTFWHome == null) {
-      // See if we have the files in the default location.
+    String dbgengPath   = null;
+    String dbghelpPath  = null;
+    String sawindbgPath = null;
+    List   searchList   = new ArrayList();
+
+    boolean loadLibraryDEBUG =
+        System.getProperty("sun.jvm.hotspot.loadLibrary.DEBUG") != null;
+
+    {
+      // First place to search is co-located with sawindbg.dll in
+      // $JAVA_HOME/jre/bin (java.home property is set to $JAVA_HOME/jre):
+      searchList.add(System.getProperty("java.home") + File.separator + "bin");
+      sawindbgPath = (String) searchList.get(0) + File.separator +
+          "sawindbg.dll";
+
+      // second place to search is specified by an environment variable:
+      String DTFWHome = System.getenv("DEBUGGINGTOOLSFORWINDOWS");
+      if (DTFWHome != null) {
+        searchList.add(DTFWHome);
+      }
+
+      // The third place to search is the install directory for the
+      // "Debugging Tools For Windows" package; so far there are three
+      // name variations that we know of:
       String sysRoot = System.getenv("SYSTEMROOT");
-      DTFWHome = sysRoot + File.separator +
-          ".." + File.separator + "Program Files" +
-          File.separator + "Debugging Tools For Windows";
+      DTFWHome = sysRoot + File.separator + ".." + File.separator +
+          "Program Files" + File.separator + "Debugging Tools For Windows";
+      searchList.add(DTFWHome);
+      searchList.add(DTFWHome + " (x86)");
+      searchList.add(DTFWHome + " (x64)");
+
+      // The last place to search is the system directory:
+      searchList.add(sysRoot + File.separator + "system32");
     }
 
-    {
-      String dbghelp = DTFWHome + File.separator + "dbghelp.dll";
-      String dbgeng = DTFWHome + File.separator + "dbgeng.dll";
-      File fhelp = new File(dbghelp);
-      File feng = new File(dbgeng);
-      if (fhelp.exists() && feng.exists()) {
-        // found both, we are happy.
-        // NOTE: The order of loads is important! If we load dbgeng.dll
-        // first, then the dependency - dbghelp.dll - will be loaded
-        // from usual DLL search thereby defeating the purpose!
-        System.load(dbghelp);
-        System.load(dbgeng);
-      } else if (! fhelp.exists() && ! feng.exists()) {
-        // neither exist. We will ignore this dir and assume
-        // they are in the system dir.
-        DTFWHome = null;
-      } else {
-        // one exists but not the other
-        //System.err.println("Error: Both files dbghelp.dll and dbgeng.dll "
-        //                   "must exist in directory " + DTFWHome);
-        throw new UnsatisfiedLinkError("Both files dbghelp.dll and " +
-                                       "dbgeng.dll must exist in " +
-                                       "directory " + DTFWHome);
+    for (int i = 0; i < searchList.size(); i++) {
+      File dir = new File((String) searchList.get(i));
+      if (!dir.exists()) {
+        if (loadLibraryDEBUG) {
+          System.err.println("DEBUG: '" + searchList.get(i) +
+              "': directory does not exist.");
+        }
+        // this search directory doesn't exist so skip it
+        continue;
       }
-    }
-    if (DTFWHome == null) {
-      // The files better be in the system dir.
-      String sysDir = System.getenv("SYSTEMROOT") +
-          File.separator + "system32";
 
-      File feng = new File(sysDir + File.separator + "dbgeng.dll");
-      if (!feng.exists()) {
-        throw new UnsatisfiedLinkError("File dbgeng.dll does not exist in " +
-                                        sysDir + ".  Please search microsoft.com " +
-                                       "for Debugging Tools For Windows, and " +
-                                       "either download it to the default " +
-                                       "location, or download it to a custom " +
-                                       "location and set environment variable " +
-                                       "   DEBUGGINGTOOLSFORWINDOWS  "  +
-                                       "to the pathname of that location.");
+      dbgengPath = (String) searchList.get(i) + File.separator + "dbgeng.dll";
+      dbghelpPath = (String) searchList.get(i) + File.separator + "dbghelp.dll";
+
+      File feng = new File(dbgengPath);
+      File fhelp = new File(dbghelpPath);
+      if (feng.exists() && fhelp.exists()) {
+        // both files exist so we have a match
+        break;
       }
+
+      // At least one of the files does not exist; no warning if both
+      // don't exist. If just one doesn't exist then we don't check
+      // loadLibraryDEBUG because we have a mis-configured system.
+      if (feng.exists()) {
+        System.err.println("WARNING: found '" + dbgengPath +
+            "' but did not find '" + dbghelpPath + "'; ignoring '" +
+            dbgengPath + "'.");
+      } else if (fhelp.exists()) {
+        System.err.println("WARNING: found '" + dbghelpPath +
+            "' but did not find '" + dbgengPath + "'; ignoring '" +
+            dbghelpPath + "'.");
+      } else if (loadLibraryDEBUG) {
+        System.err.println("DEBUG: searched '" + searchList.get(i) +
+          "': dbgeng.dll and dbghelp.dll were not found.");
+      }
+      dbgengPath = null;
+      dbghelpPath = null;
     }
 
+    if (dbgengPath == null || dbghelpPath == null) {
+      // at least one of the files wasn't found anywhere we searched
+      String mesg = null;
+
+      if (dbgengPath == null && dbghelpPath == null) {
+        mesg = "dbgeng.dll and dbghelp.dll cannot be found. ";
+      } else if (dbgengPath == null) {
+        mesg = "dbgeng.dll cannot be found (dbghelp.dll was found). ";
+      } else {
+        mesg = "dbghelp.dll cannot be found (dbgeng.dll was found). ";
+      }
+      throw new UnsatisfiedLinkError(mesg +
+          "Please search microsoft.com for 'Debugging Tools For Windows', " +
+          "and either download it to the default location, or download it " +
+          "to a custom location and set environment variable " +
+          "'DEBUGGINGTOOLSFORWINDOWS' to the pathname of that location.");
+    }
+
+    // NOTE: The order of loads is important! If we load dbgeng.dll
+    // first, then the dependency - dbghelp.dll - will be loaded
+    // from usual DLL search thereby defeating the purpose!
+    if (loadLibraryDEBUG) {
+      System.err.println("DEBUG: loading '" + dbghelpPath + "'.");
+    }
+    System.load(dbghelpPath);
+    if (loadLibraryDEBUG) {
+      System.err.println("DEBUG: loading '" + dbgengPath + "'.");
+    }
+    System.load(dbgengPath);
+
     // Now, load sawindbg.dll
-    System.loadLibrary("sawindbg");
+    if (loadLibraryDEBUG) {
+      System.err.println("DEBUG: loading '" + sawindbgPath + "'.");
+    }
+    System.load(sawindbgPath);
+
     // where do I find '.exe', '.dll' files?
     imagePath = System.getProperty("sun.jvm.hotspot.debugger.windbg.imagePath");
     if (imagePath == null) {
--- a/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeLoadConstant.java	Tue Mar 01 15:05:39 2011 +0000
@@ -112,7 +112,7 @@
   }
 
   // return Symbol (if unresolved) or Klass (if resolved)
-  public Oop getKlass() {
+  public Object getKlass() {
     if (Assert.ASSERTS_ENABLED) {
       Assert.that(isKlassConstant(), "not a klass literal");
     }
@@ -121,11 +121,11 @@
     // decide based on the oop type.
     ConstantPool cpool = method().getConstants();
     int cpIndex = index();
-    Oop oop = cpool.getObjAt(cpIndex);
-    if (oop.isKlass()) {
-       return (Klass) oop;
-    } else if (oop.isSymbol()) {
-       return (Symbol) oop;
+    ConstantPool.CPSlot oop = cpool.getSlotAt(cpIndex);
+    if (oop.isOop()) {
+      return (Klass) oop.getOop();
+    } else if (oop.isMetaData()) {
+      return oop.getSymbol();
     } else {
        throw new RuntimeException("should not reach here");
     }
@@ -165,12 +165,12 @@
        // tag change from 'unresolved' to 'string' does not happen atomically.
        // We just look at the object at the corresponding index and
        // decide based on the oop type.
-       Oop obj = cpool.getObjAt(cpIndex);
-       if (obj.isSymbol()) {
-          Symbol sym = (Symbol) obj;
-          return "<String \"" + sym.asString() + "\">";
-       } else if (obj.isInstance()) {
-          return "<String \"" + OopUtilities.stringOopToString(obj) + "\">";
+       ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
+       if (obj.isMetaData()) {
+         Symbol sym = obj.getSymbol();
+         return "<String \"" + sym.asString() + "\">";
+       } else if (obj.isOop()) {
+         return "<String \"" + OopUtilities.stringOopToString(obj.getOop()) + "\">";
        } else {
           throw new RuntimeException("should not reach here");
        }
@@ -178,13 +178,13 @@
        // tag change from 'unresolved' to 'klass' does not happen atomically.
        // We just look at the object at the corresponding index and
        // decide based on the oop type.
-       Oop obj = cpool.getObjAt(cpIndex);
-       if (obj.isKlass()) {
-          Klass k = (Klass) obj;
-          return "<Class " + k.getName().asString() + "@" + k.getHandle() + ">";
-       } else if (obj.isSymbol()) {
-          Symbol sym = (Symbol) obj;
-          return "<Class " + sym.asString() + ">";
+       ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
+       if (obj.isOop()) {
+         Klass k = (Klass) obj.getOop();
+         return "<Class " + k.getName().asString() + "@" + k.getHandle() + ">";
+       } else if (obj.isMetaData()) {
+         Symbol sym = obj.getSymbol();
+         return "<Class " + sym.asString() + ">";
        } else {
           throw new RuntimeException("should not reach here");
        }
--- a/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/interpreter/BytecodeWithKlass.java	Tue Mar 01 15:05:39 2011 +0000
@@ -37,11 +37,11 @@
   }
 
   public Symbol getClassName() {
-    Oop obj = method().getConstants().getObjAt(index());
-    if (obj instanceof Symbol) {
-       return (Symbol)obj;
+    ConstantPool.CPSlot obj = method().getConstants().getSlotAt(index());
+    if (obj.isMetaData()) {
+      return obj.getSymbol();
     } else {
-       return ((Klass)obj).getName();
+      return ((Klass)obj.getOop()).getName();
     }
   }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/DictionaryEntry.java	Tue Mar 01 15:05:39 2011 +0000
@@ -63,7 +63,7 @@
   }
 
   public Klass klass() {
-    return (Klass) literal();
+    return (Klass)VM.getVM().getObjectHeap().newOop(literalValue().addOffsetToAsOopHandle(0));
   }
 
   public DictionaryEntry(Address addr) {
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/LoaderConstraintEntry.java	Tue Mar 01 15:05:39 2011 +0000
@@ -42,14 +42,14 @@
 
   private static synchronized void initialize(TypeDataBase db) {
     Type type = db.lookupType("LoaderConstraintEntry");
-    nameField = type.getOopField("_name");
+    nameField = type.getAddressField("_name");
     numLoadersField = type.getCIntegerField("_num_loaders");
     maxLoadersField = type.getCIntegerField("_max_loaders");
     loadersField = type.getAddressField("_loaders");
   }
 
   // Fields
-  private static sun.jvm.hotspot.types.OopField nameField;
+  private static AddressField nameField;
   private static CIntegerField numLoadersField;
   private static CIntegerField maxLoadersField;
   private static AddressField loadersField;
@@ -57,7 +57,7 @@
   // Accessors
 
   public Symbol name() {
-    return (Symbol) VM.getVM().getObjectHeap().newOop(nameField.getValue(addr));
+    return Symbol.create(nameField.getValue(addr));
   }
 
   public int numLoaders() {
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/PlaceholderEntry.java	Tue Mar 01 15:05:39 2011 +0000
@@ -58,7 +58,7 @@
   }
 
   public Symbol klass() {
-    return (Symbol) literal();
+    return Symbol.create(literalValue());
   }
 
   /* covariant return type :-(
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/StringTable.java	Tue Mar 01 15:05:39 2011 +0000
@@ -70,11 +70,13 @@
   }
 
   public void stringsDo(StringVisitor visitor) {
+    ObjectHeap oh = VM.getVM().getObjectHeap();
     int numBuckets = tableSize();
     for (int i = 0; i < numBuckets; i++) {
       for (HashtableEntry e = (HashtableEntry) bucket(i); e != null;
            e = (HashtableEntry) e.next()) {
-        visitor.visit((Instance) e.literal());
+        Instance s = (Instance)oh.newOop(e.literalValue().addOffsetToAsOopHandle(0));
+        visitor.visit(s);
       }
     }
   }
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Tue Mar 01 15:05:39 2011 +0000
@@ -85,7 +85,7 @@
     long hashValue = hashSymbol(name);
     for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) {
       if (e.hash() == hashValue) {
-         Symbol sym = (Symbol) e.literal();
+         Symbol sym = Symbol.create(e.literalValue());
          if (sym.equals(name)) {
            return sym;
          }
@@ -103,7 +103,7 @@
     for (int i = 0; i < numBuckets; i++) {
       for (HashtableEntry e = (HashtableEntry) bucket(i); e != null;
            e = (HashtableEntry) e.next()) {
-        visitor.visit((Symbol) e.literal());
+        visitor.visit(Symbol.create(e.literalValue()));
       }
     }
   }
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java	Tue Mar 01 15:05:39 2011 +0000
@@ -35,6 +35,38 @@
 // as described in the class file
 
 public class ConstantPool extends Oop implements ClassConstants {
+
+  public class CPSlot {
+    private Address ptr;
+
+    CPSlot(Address ptr) {
+      this.ptr = ptr;
+    }
+    CPSlot(Symbol sym) {
+      this.ptr = sym.getAddress().orWithMask(1);
+    }
+
+    public boolean isOop() {
+      return (ptr.minus(null) & 1) == 0;
+    }
+    public boolean isMetaData() {
+      return (ptr.minus(null) & 1) == 1;
+    }
+
+    public Symbol getSymbol() {
+      if (isMetaData()) {
+        return Symbol.create(ptr.xorWithMask(1));
+      }
+      throw new InternalError("not a symbol");
+    }
+    public Oop getOop() {
+      if (isOop()) {
+        return VM.getVM().getObjectHeap().newOop(ptr.addOffsetToAsOopHandle(0));
+      }
+      throw new InternalError("not an oop");
+    }
+  }
+
   // Used for debugging this code
   private static final boolean DEBUG = false;
 
@@ -110,12 +142,17 @@
     return new ConstantTag(getTags().getByteAt((int) index));
   }
 
-  public Oop getObjAt(long index){
+  public CPSlot getSlotAt(long index) {
+    return new CPSlot(getHandle().getAddressAt(indexOffset(index)));
+  }
+
+  public Oop getObjAtRaw(long index){
     return getHeap().newOop(getHandle().getOopHandleAt(indexOffset(index)));
   }
 
   public Symbol getSymbolAt(long index) {
-    return (Symbol) getObjAt(index);
+    CPSlot slot = getSlotAt(index);
+    return slot.getSymbol();
   }
 
   public int getIntAt(long index){
@@ -187,7 +224,7 @@
   // returns null, if not resolved.
   public Klass getKlassRefAt(int which) {
     if( ! getTagAt(which).isKlass()) return null;
-    return (Klass) getObjAt(which);
+    return (Klass) getObjAtRaw(which);
   }
 
   // returns null, if not resolved.
@@ -477,7 +514,7 @@
               case JVM_CONSTANT_Class: {
                   dos.writeByte(cpConstType);
                   // Klass already resolved. ConstantPool constains klassOop.
-                  Klass refKls = (Klass) getObjAt(ci);
+                  Klass refKls = (Klass) getObjAtRaw(ci);
                   String klassName = refKls.getName().asString();
                   Short s = (Short) utf8ToIndex.get(klassName);
                   dos.writeShort(s.shortValue());
@@ -498,7 +535,7 @@
 
               case JVM_CONSTANT_String: {
                   dos.writeByte(cpConstType);
-                  String str = OopUtilities.stringOopToString(getObjAt(ci));
+                  String str = OopUtilities.stringOopToString(getObjAtRaw(ci));
                   Short s = (Short) utf8ToIndex.get(str);
                   dos.writeShort(s.shortValue());
                   if (DEBUG) debugMessage("CP[" + ci + "] = string " + s);
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/GenerateOopMap.java	Tue Mar 01 15:05:39 2011 +0000
@@ -576,7 +576,7 @@
           ConstantPool cp       = method().getConstants();
           int nameAndTypeIdx    = cp.name_and_type_ref_index_at(idx);
           int signatureIdx      = cp.signature_ref_index_at(nameAndTypeIdx);
-          symbolOop signature   = cp.symbol_at(signatureIdx);
+          Symbol* signature     = cp.symbol_at(signatureIdx);
           tty.print("%s", signature.as_C_string());
         */
       }
@@ -616,7 +616,7 @@
           constantPoolOop cp    = method().constants();
           int nameAndTypeIdx    = cp.name_and_type_ref_index_at(idx);
           int signatureIdx      = cp.signature_ref_index_at(nameAndTypeIdx);
-          symbolOop signature   = cp.symbol_at(signatureIdx);
+          Symbol* signature     = cp.symbol_at(signatureIdx);
           tty.print("%s", signature.as_C_string());
         */
       }
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java	Tue Mar 01 15:05:39 2011 +0000
@@ -82,8 +82,8 @@
     classLoader          = new OopField(type.getOopField("_class_loader"), Oop.getHeaderSize());
     protectionDomain     = new OopField(type.getOopField("_protection_domain"), Oop.getHeaderSize());
     signers              = new OopField(type.getOopField("_signers"), Oop.getHeaderSize());
-    sourceFileName       = new OopField(type.getOopField("_source_file_name"), Oop.getHeaderSize());
-    sourceDebugExtension = new OopField(type.getOopField("_source_debug_extension"), Oop.getHeaderSize());
+    sourceFileName       = type.getAddressField("_source_file_name");
+    sourceDebugExtension = type.getAddressField("_source_debug_extension");
     innerClasses         = new OopField(type.getOopField("_inner_classes"), Oop.getHeaderSize());
     nonstaticFieldSize   = new CIntField(type.getCIntegerField("_nonstatic_field_size"), Oop.getHeaderSize());
     staticFieldSize      = new CIntField(type.getCIntegerField("_static_field_size"), Oop.getHeaderSize());
@@ -94,7 +94,7 @@
     vtableLen            = new CIntField(type.getCIntegerField("_vtable_len"), Oop.getHeaderSize());
     itableLen            = new CIntField(type.getCIntegerField("_itable_len"), Oop.getHeaderSize());
     breakpoints          = type.getAddressField("_breakpoints");
-    genericSignature     = new OopField(type.getOopField("_generic_signature"), Oop.getHeaderSize());
+    genericSignature     = type.getAddressField("_generic_signature");
     majorVersion         = new CIntField(type.getCIntegerField("_major_version"), Oop.getHeaderSize());
     minorVersion         = new CIntField(type.getCIntegerField("_minor_version"), Oop.getHeaderSize());
     headerSize           = alignObjectOffset(Oop.getHeaderSize() + type.getSize());
@@ -135,8 +135,8 @@
   private static OopField  classLoader;
   private static OopField  protectionDomain;
   private static OopField  signers;
-  private static OopField  sourceFileName;
-  private static OopField  sourceDebugExtension;
+  private static AddressField  sourceFileName;
+  private static AddressField  sourceDebugExtension;
   private static OopField  innerClasses;
   private static CIntField nonstaticFieldSize;
   private static CIntField staticFieldSize;
@@ -147,7 +147,7 @@
   private static CIntField vtableLen;
   private static CIntField itableLen;
   private static AddressField breakpoints;
-  private static OopField  genericSignature;
+  private static AddressField  genericSignature;
   private static CIntField majorVersion;
   private static CIntField minorVersion;
 
@@ -257,8 +257,8 @@
   public Oop       getClassLoader()         { return                classLoader.getValue(this); }
   public Oop       getProtectionDomain()    { return                protectionDomain.getValue(this); }
   public ObjArray  getSigners()             { return (ObjArray)     signers.getValue(this); }
-  public Symbol    getSourceFileName()      { return (Symbol)       sourceFileName.getValue(this); }
-  public Symbol    getSourceDebugExtension(){ return (Symbol)       sourceDebugExtension.getValue(this); }
+  public Symbol    getSourceFileName()      { return getSymbol(sourceFileName); }
+  public Symbol    getSourceDebugExtension(){ return getSymbol(sourceDebugExtension); }
   public TypeArray getInnerClasses()        { return (TypeArray)    innerClasses.getValue(this); }
   public long      getNonstaticFieldSize()  { return                nonstaticFieldSize.getValue(this); }
   public long      getStaticFieldSize()     { return                staticFieldSize.getValue(this); }
@@ -267,7 +267,7 @@
   public boolean   getIsMarkedDependent()   { return                isMarkedDependent.getValue(this) != 0; }
   public long      getVtableLen()           { return                vtableLen.getValue(this); }
   public long      getItableLen()           { return                itableLen.getValue(this); }
-  public Symbol    getGenericSignature()    { return (Symbol)       genericSignature.getValue(this); }
+  public Symbol    getGenericSignature()    { return getSymbol(genericSignature); }
   public long      majorVersion()           { return                majorVersion.getValue(this); }
   public long      minorVersion()           { return                minorVersion.getValue(this); }
 
@@ -308,12 +308,12 @@
           if (ioff != 0) {
              // only look at classes that are already loaded
              // since we are looking for the flags for our self.
-             Oop classInfo = getConstants().getObjAt(ioff);
+             ConstantPool.CPSlot classInfo = getConstants().getSlotAt(ioff);
              Symbol name = null;
-             if (classInfo instanceof Klass) {
-                name = ((Klass) classInfo).getName();
-             } else if (classInfo instanceof Symbol) {
-                name = (Symbol) classInfo;
+             if (classInfo.isOop()) {
+               name = ((Klass) classInfo.getOop()).getName();
+             } else if (classInfo.isMetaData()) {
+               name = classInfo.getSymbol();
              } else {
                 throw new RuntimeException("should not reach here");
              }
@@ -358,12 +358,12 @@
          // 'ioff' can be zero.
          // refer to JVM spec. section 4.7.5.
          if (ioff != 0) {
-            Oop iclassInfo = getConstants().getObjAt(ioff);
+            ConstantPool.CPSlot iclassInfo = getConstants().getSlotAt(ioff);
             Symbol innerName = null;
-            if (iclassInfo instanceof Klass) {
-               innerName = ((Klass) iclassInfo).getName();
-            } else if (iclassInfo instanceof Symbol) {
-               innerName = (Symbol) iclassInfo;
+            if (iclassInfo.isOop()) {
+              innerName = ((Klass) iclassInfo.getOop()).getName();
+            } else if (iclassInfo.isMetaData()) {
+              innerName = iclassInfo.getSymbol();
             } else {
                throw new RuntimeException("should not reach here");
             }
@@ -387,12 +387,12 @@
                   }
                }
             } else {
-               Oop oclassInfo = getConstants().getObjAt(ooff);
+               ConstantPool.CPSlot oclassInfo = getConstants().getSlotAt(ooff);
                Symbol outerName = null;
-               if (oclassInfo instanceof Klass) {
-                  outerName = ((Klass) oclassInfo).getName();
-               } else if (oclassInfo instanceof Symbol) {
-                  outerName = (Symbol) oclassInfo;
+               if (oclassInfo.isOop()) {
+                 outerName = ((Klass) oclassInfo.getOop()).getName();
+               } else if (oclassInfo.isMetaData()) {
+                 outerName = oclassInfo.getSymbol();
                } else {
                   throw new RuntimeException("should not reach here");
                }
@@ -450,7 +450,6 @@
       visitor.doOop(classLoader, true);
       visitor.doOop(protectionDomain, true);
       visitor.doOop(signers, true);
-      visitor.doOop(sourceFileName, true);
       visitor.doOop(innerClasses, true);
       visitor.doCInt(nonstaticFieldSize, true);
       visitor.doCInt(staticFieldSize, true);
@@ -467,7 +466,7 @@
     for (int index = 0; index < length; index += NEXT_OFFSET) {
       short accessFlags    = fields.getShortAt(index + ACCESS_FLAGS_OFFSET);
       short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET);
-      FieldType   type   = new FieldType((Symbol) getConstants().getObjAt(signatureIndex));
+      FieldType   type   = new FieldType(getConstants().getSymbolAt(signatureIndex));
       AccessFlags access = new AccessFlags(accessFlags);
       if (access.isStatic()) {
         visitField(visitor, type, index);
@@ -490,7 +489,7 @@
       short accessFlags    = fields.getShortAt(index + ACCESS_FLAGS_OFFSET);
       short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET);
 
-      FieldType   type   = new FieldType((Symbol) getConstants().getObjAt(signatureIndex));
+      FieldType   type   = new FieldType(getConstants().getSymbolAt(signatureIndex));
       AccessFlags access = new AccessFlags(accessFlags);
       if (!access.isStatic()) {
         visitField(visitor, type, index);
@@ -787,7 +786,7 @@
   private Field newField(int index) {
     TypeArray fields = getFields();
     short signatureIndex = fields.getShortAt(index + SIGNATURE_INDEX_OFFSET);
-    FieldType type = new FieldType((Symbol) getConstants().getObjAt(signatureIndex));
+    FieldType type = new FieldType(getConstants().getSymbolAt(signatureIndex));
     if (type.isOop()) {
      if (VM.getVM().isCompressedOopsEnabled()) {
         return new NarrowOopField(this, index);
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java	Tue Mar 01 15:05:39 2011 +0000
@@ -53,7 +53,7 @@
     javaMirror   = new OopField(type.getOopField("_java_mirror"), Oop.getHeaderSize());
     superField   = new OopField(type.getOopField("_super"), Oop.getHeaderSize());
     layoutHelper = new IntField(type.getJIntField("_layout_helper"), Oop.getHeaderSize());
-    name         = new OopField(type.getOopField("_name"), Oop.getHeaderSize());
+    name         = type.getAddressField("_name");
     accessFlags  = new CIntField(type.getCIntegerField("_access_flags"), Oop.getHeaderSize());
     subklass     = new OopField(type.getOopField("_subklass"), Oop.getHeaderSize());
     nextSibling  = new OopField(type.getOopField("_next_sibling"), Oop.getHeaderSize());
@@ -83,18 +83,26 @@
   private static OopField  javaMirror;
   private static OopField  superField;
   private static IntField layoutHelper;
-  private static OopField  name;
+  private static AddressField  name;
   private static CIntField accessFlags;
   private static OopField  subklass;
   private static OopField  nextSibling;
   private static CIntField allocCount;
 
+  private Address getValue(AddressField field) {
+    return getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize());
+  }
+
+  protected Symbol getSymbol(AddressField field) {
+    return Symbol.create(getHandle().getAddressAt(field.getOffset() + Oop.getHeaderSize()));
+  }
+
   // Accessors for declared fields
   public Instance getJavaMirror()       { return (Instance) javaMirror.getValue(this);   }
   public Klass    getSuper()            { return (Klass)    superField.getValue(this);   }
   public Klass    getJavaSuper()        { return null;  }
   public int      getLayoutHelper()     { return (int)           layoutHelper.getValue(this); }
-  public Symbol   getName()             { return (Symbol)   name.getValue(this);         }
+  public Symbol   getName()             { return getSymbol(name); }
   public long     getAccessFlags()      { return            accessFlags.getValue(this);  }
   // Convenience routine
   public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags());      }
@@ -162,7 +170,7 @@
       visitor.doOop(javaMirror, true);
       visitor.doOop(superField, true);
       visitor.doInt(layoutHelper, true);
-      visitor.doOop(name, true);
+      // visitor.doOop(name, true);
       visitor.doCInt(accessFlags, true);
       visitor.doOop(subklass, true);
       visitor.doOop(nextSibling, true);
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Tue Mar 01 15:05:39 2011 +0000
@@ -196,11 +196,11 @@
   public Address      getFromCompiledCodeEntryPoint() { return fromCompiledCodeEntryPointField.getValue(this); }
   */
   // Accessors
-  public Symbol  getName()          { return (Symbol) getConstants().getObjAt(getNameIndex());         }
-  public Symbol  getSignature()     { return (Symbol) getConstants().getObjAt(getSignatureIndex());    }
+  public Symbol  getName()          { return getConstants().getSymbolAt(getNameIndex());         }
+  public Symbol  getSignature()     { return getConstants().getSymbolAt(getSignatureIndex());    }
   public Symbol  getGenericSignature() {
      long index = getGenericSignatureIndex();
-     return (index != 0L) ? (Symbol) getConstants().getObjAt(index) : null;
+     return (index != 0L) ? getConstants().getSymbolAt(index) : null;
   }
 
   // Method holder (the Klass holding this method)
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Tue Mar 01 15:05:39 2011 +0000
@@ -47,7 +47,6 @@
     DEBUG = System.getProperty("sun.jvm.hotspot.oops.ObjectHeap.DEBUG") != null;
   }
 
-  private OopHandle              symbolKlassHandle;
   private OopHandle              methodKlassHandle;
   private OopHandle              constMethodKlassHandle;
   private OopHandle              methodDataKlassHandle;
@@ -68,7 +67,6 @@
   private OopHandle              arrayKlassKlassHandle;
   private OopHandle              compiledICHolderKlassHandle;
 
-  private SymbolKlass            symbolKlassObj;
   private MethodKlass            methodKlassObj;
   private ConstMethodKlass       constMethodKlassObj;
   private MethodDataKlass        methodDataKlassObj;
@@ -93,9 +91,6 @@
     // Lookup the roots in the object hierarchy.
     Type universeType = db.lookupType("Universe");
 
-    symbolKlassHandle         = universeType.getOopField("_symbolKlassObj").getValue();
-    symbolKlassObj            = new SymbolKlass(symbolKlassHandle, this);
-
     methodKlassHandle         = universeType.getOopField("_methodKlassObj").getValue();
     methodKlassObj            = new MethodKlass(methodKlassHandle, this);
 
@@ -199,7 +194,6 @@
   public long getDoubleSize()  { return doubleSize;  }
 
   // Accessors for well-known system classes (from Universe)
-  public SymbolKlass            getSymbolKlassObj()            { return symbolKlassObj; }
   public MethodKlass            getMethodKlassObj()            { return methodKlassObj; }
   public ConstMethodKlass       getConstMethodKlassObj()       { return constMethodKlassObj; }
   public MethodDataKlass        getMethodDataKlassObj()        { return methodDataKlassObj; }
@@ -337,7 +331,6 @@
     // First check if handle is one of the root objects
     if (handle.equals(methodKlassHandle))              return getMethodKlassObj();
     if (handle.equals(constMethodKlassHandle))         return getConstMethodKlassObj();
-    if (handle.equals(symbolKlassHandle))              return getSymbolKlassObj();
     if (handle.equals(constantPoolKlassHandle))        return getConstantPoolKlassObj();
     if (handle.equals(constantPoolCacheKlassHandle))   return getConstantPoolCacheKlassObj();
     if (handle.equals(instanceKlassKlassHandle))       return getInstanceKlassKlassObj();
@@ -363,7 +356,6 @@
     if (klass != null) {
       if (klass.equals(methodKlassHandle))              return new Method(handle, this);
       if (klass.equals(constMethodKlassHandle))         return new ConstMethod(handle, this);
-      if (klass.equals(symbolKlassHandle))              return new Symbol(handle, this);
       if (klass.equals(constantPoolKlassHandle))        return new ConstantPool(handle, this);
       if (klass.equals(constantPoolCacheKlassHandle))   return new ConstantPoolCache(handle, this);
       if (!VM.getVM().isCore()) {
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Symbol.java	Tue Mar 01 15:05:39 2011 +0000
@@ -34,7 +34,7 @@
 // A Symbol is a canonicalized string.
 // All Symbols reside in global symbolTable.
 
-public class Symbol extends Oop {
+public class Symbol extends VMObject {
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -44,9 +44,10 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type  = db.lookupType("symbolOopDesc");
-    length     = new CIntField(type.getCIntegerField("_length"), 0);
+    Type type  = db.lookupType("Symbol");
+    length     = type.getCIntegerField("_length");
     baseOffset = type.getField("_body").getOffset();
+    idHash = type.getCIntegerField("_identity_hash");
   }
 
   // Format:
@@ -55,8 +56,15 @@
   //   [length] byte size of uft8 string
   //   ..body..
 
-  Symbol(OopHandle handle, ObjectHeap heap) {
-    super(handle, heap);
+  public static Symbol create(Address addr) {
+    if (addr == null) {
+      return null;
+    }
+    return new Symbol(addr);
+  }
+
+  Symbol(Address addr) {
+    super(addr);
   }
 
   public boolean isSymbol()            { return true; }
@@ -64,15 +72,19 @@
   private static long baseOffset; // tells where the array part starts
 
   // Fields
-  private static CIntField length;
+  private static CIntegerField length;
 
   // Accessors for declared fields
-  public long   getLength() { return          length.getValue(this); }
+  public long   getLength() { return          length.getValue(this.addr); }
 
   public byte getByteAt(long index) {
-    return getHandle().getJByteAt(baseOffset + index);
+    return addr.getJByteAt(baseOffset + index);
   }
 
+  private static CIntegerField idHash;
+
+  public int identityHash() { return     (int)idHash.getValue(this.addr); }
+
   public boolean equals(byte[] modUTF8Chars) {
     int l = (int) getLength();
     if (l != modUTF8Chars.length) return false;
@@ -98,7 +110,9 @@
     // Decode the byte array and return the string.
     try {
       return readModifiedUTF8(asByteArray());
-    } catch(IOException e) {
+    } catch(Exception e) {
+      System.err.println(addr);
+      e.printStackTrace();
       return null;
     }
   }
@@ -111,28 +125,13 @@
     tty.print("#" + asString());
   }
 
-  public long getObjectSize() {
-    return alignObjectSize(baseOffset + getLength());
-  }
-
-  void iterateFields(OopVisitor visitor, boolean doVMFields) {
-    super.iterateFields(visitor, doVMFields);
-    if (doVMFields) {
-      visitor.doCInt(length, true);
-      int length = (int) getLength();
-      for (int index = 0; index < length; index++) {
-        visitor.doByte(new ByteField(new IndexableFieldIdentifier(index), baseOffset + index, false), true);
-      }
-    }
-  }
-
   /** Note: this comparison is used for vtable sorting only; it
       doesn't matter what order it defines, as long as it is a total,
-      time-invariant order Since symbolOops are in permSpace, their
+      time-invariant order Since Symbol* are in C_HEAP, their
       relative order in memory never changes, so use address
       comparison for speed. */
   public int fastCompare(Symbol other) {
-    return (int) getHandle().minus(other.getHandle());
+    return (int) addr.minus(other.addr);
   }
 
   private static String readModifiedUTF8(byte[] buf) throws IOException {
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/SymbolKlass.java	Wed Jan 05 10:06:07 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
- * 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 java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-// A SymbolKlass is the klass for all Symbols
-
-public class SymbolKlass extends Klass {
-  static {
-    VM.registerVMInitializedObserver(new Observer() {
-        public void update(Observable o, Object data) {
-          initialize(VM.getVM().getTypeDataBase());
-        }
-      });
-  }
-
-  private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
-    Type type  = db.lookupType("symbolKlass");
-    headerSize = type.getSize() + Oop.getHeaderSize();
-  }
-
-  SymbolKlass(OopHandle handle, ObjectHeap heap) {
-    super(handle, heap);
-  }
-
-  private static long headerSize;
-
-  public long getObjectSize() { return alignObjectSize(headerSize); }
-
-  public void printValueOn(PrintStream tty) {
-    tty.print("SymbolKlass");
-  }
-}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/LowMemoryDetectorThread.java	Wed Jan 05 10:06:07 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- * 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.runtime;
-
-import java.io.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.types.*;
-
-public class LowMemoryDetectorThread extends JavaThread {
-  public LowMemoryDetectorThread(Address addr) {
-    super(addr);
-  }
-
-  public boolean isJavaThread() { return false; }
-  public boolean isHiddenFromExternalView() { return true; }
-  public boolean isLowMemoryDetectorThread() { return true; }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ServiceThread.java	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2011 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.runtime;
+
+import java.io.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.types.*;
+
+public class ServiceThread extends JavaThread {
+  public ServiceThread(Address addr) {
+    super(addr);
+  }
+
+  public boolean isJavaThread() { return false; }
+  public boolean isHiddenFromExternalView() { return true; }
+  public boolean isServiceThread() { return true; }
+
+}
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Thread.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,7 +111,7 @@
   public boolean   isJvmtiAgentThread()        { return false; }
   public boolean   isWatcherThread()           { return false; }
   public boolean   isConcurrentMarkSweepThread() { return false; }
-  public boolean   isLowMemoryDetectorThread() { return false; }
+  public boolean   isServiceThread()           { return false; }
 
   /** Memory operations */
   public void oopsDo(AddressVisitor oopVisitor) {
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/Threads.java	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,14 +107,14 @@
         // for now, use JavaThread itself. fix it later with appropriate class if needed
         virtualConstructor.addMapping("SurrogateLockerThread", JavaThread.class);
         virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
-        virtualConstructor.addMapping("LowMemoryDetectorThread", LowMemoryDetectorThread.class);
+        virtualConstructor.addMapping("ServiceThread", ServiceThread.class);
     }
 
     public Threads() {
     }
 
     /** NOTE: this returns objects of type JavaThread, CompilerThread,
-      JvmtiAgentThread, and LowMemoryDetectorThread.
+      JvmtiAgentThread, and ServiceThread.
       The latter four are subclasses of the former. Most operations
       (fetching the top frame, etc.) are only allowed to be performed on
       a "pure" JavaThread. For this reason, {@link
@@ -143,7 +143,7 @@
             return thread;
         } catch (Exception e) {
             throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
-            " (expected type JavaThread, CompilerThread, LowMemoryDetectorThread, JvmtiAgentThread, or SurrogateLockerThread)", e);
+            " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, or SurrogateLockerThread)", e);
         }
     }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Tue Mar 01 15:05:39 2011 +0000
@@ -229,7 +229,7 @@
                 case JVM_CONSTANT_Class: {
                      dos.writeByte(cpConstType);
                      // Klass already resolved. ConstantPool constains klassOop.
-                     Klass refKls = (Klass) cpool.getObjAt(ci);
+                     Klass refKls = (Klass) cpool.getObjAtRaw(ci);
                      String klassName = refKls.getName().asString();
 
                      Short s = (Short) utf8ToIndex.get(klassName);
@@ -255,7 +255,7 @@
 
                 case JVM_CONSTANT_String: {
                      dos.writeByte(cpConstType);
-                     String str = OopUtilities.stringOopToString(cpool.getObjAt(ci));
+                     String str = OopUtilities.stringOopToString(cpool.getObjAtRaw(ci));
                      Short s = (Short) utf8ToIndex.get(str);
                      dos.writeShort(s.shortValue());
                      if (DEBUG) debugMessage("CP[" + ci + "] = string " + s);
--- a/agent/src/share/classes/sun/jvm/hotspot/types/Field.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/types/Field.java	Tue Mar 01 15:05:39 2011 +0000
@@ -56,7 +56,7 @@
     </PRE>
 
     FIXME: among other things, this interface is not sufficient to
-    describe fields which are themselves arrays (like symbolOop's
+    describe fields which are themselves arrays (like Symbol's
     jbyte _body[1]).  */
 public interface Field {
   /** Get the name of this field */
--- a/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/ui/classbrowser/HTMLGenerator.java	Tue Mar 01 15:05:39 2011 +0000
@@ -30,6 +30,7 @@
 import sun.jvm.hotspot.asm.sparc.*;
 import sun.jvm.hotspot.asm.x86.*;
 import sun.jvm.hotspot.asm.ia64.*;
+import sun.jvm.hotspot.asm.amd64.*;
 import sun.jvm.hotspot.code.*;
 import sun.jvm.hotspot.compiler.*;
 import sun.jvm.hotspot.debugger.*;
@@ -198,6 +199,8 @@
          cpuHelper = new SPARCHelper();
       } else if (cpu.equals("x86")) {
          cpuHelper = new X86Helper();
+      } else if (cpu.equals("amd64")) {
+         cpuHelper = new AMD64Helper();
       } else if (cpu.equals("ia64")) {
          cpuHelper = new IA64Helper();
       } else {
@@ -527,7 +530,7 @@
 
             case JVM_CONSTANT_Class:
                buf.cell("JVM_CONSTANT_Class");
-               Klass klass = (Klass) cpool.getObjAt(index);
+               Klass klass = (Klass) cpool.getObjAtRaw(index);
                if (klass instanceof InstanceKlass) {
                   buf.cell(genKlassLink((InstanceKlass) klass));
                } else {
@@ -552,7 +555,7 @@
             case JVM_CONSTANT_String:
                buf.cell("JVM_CONSTANT_String");
                buf.cell("\"" +
-                 escapeHTMLSpecialChars(OopUtilities.stringOopToString(cpool.getObjAt(index))) + "\"");
+                 escapeHTMLSpecialChars(OopUtilities.stringOopToString(cpool.getObjAtRaw(index))) + "\"");
                break;
 
             case JVM_CONSTANT_Fieldref:
@@ -669,11 +672,11 @@
             buf.beginTag("ul");
             for (int exp = 0; exp < exceptions.length; exp++) {
                short cpIndex = (short) exceptions[exp].getClassCPIndex();
-               Oop obj = cpool.getObjAt(cpIndex);
-               if (obj instanceof Symbol) {
-                  buf.li(((Symbol)obj).asString().replace('/', '.'));
+               ConstantPool.CPSlot obj = cpool.getSlotAt(cpIndex);
+               if (obj.isMetaData()) {
+                 buf.li((obj.getSymbol()).asString().replace('/', '.'));
                } else {
-                  buf.li(genKlassLink((InstanceKlass)obj));
+                 buf.li(genKlassLink((InstanceKlass)obj.getOop()));
                }
             }
             buf.endTag("ul");
@@ -753,7 +756,7 @@
                              } else if (instr instanceof BytecodeLoadConstant) {
                                 BytecodeLoadConstant ldc = (BytecodeLoadConstant) instr;
                                 if (ldc.isKlassConstant()) {
-                                   Oop oop = ldc.getKlass();
+                                   Object oop = ldc.getKlass();
                                    if (oop instanceof Klass) {
                                       buf.append("<a href='");
                                       buf.append(genKlassHref((InstanceKlass) oop));
@@ -800,13 +803,13 @@
                buf.cell(Integer.toString(exceptionTable.getIntAt(e + 1)));
                buf.cell(Integer.toString(exceptionTable.getIntAt(e + 2)));
                short cpIndex = (short) exceptionTable.getIntAt(e + 3);
-               Oop obj = cpIndex == 0? null : cpool.getObjAt(cpIndex);
+               ConstantPool.CPSlot obj = cpIndex == 0? null : cpool.getSlotAt(cpIndex);
                if (obj == null) {
                   buf.cell("Any");
-               } else if (obj instanceof Symbol) {
-                  buf.cell(((Symbol)obj).asString().replace('/', '.'));
+               } else if (obj.isMetaData()) {
+                 buf.cell(obj.getSymbol().asString().replace('/', '.'));
                } else {
-                  buf.cell(genKlassLink((InstanceKlass)obj));
+                 buf.cell(genKlassLink((InstanceKlass)obj.getOop()));
                }
                buf.endTag("tr");
             }
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java	Tue Mar 01 15:05:39 2011 +0000
@@ -40,7 +40,7 @@
 
   private static synchronized void initialize(TypeDataBase db) {
     // just to confirm that type exists
-    Type type = db.lookupType("Hashtable");
+    Type type = db.lookupType("Hashtable<intptr_t>");
   }
 
   // derived class may return Class<? extends HashtableEntry>
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HashtableEntry.java	Tue Mar 01 15:05:39 2011 +0000
@@ -41,16 +41,16 @@
   }
 
   private static synchronized void initialize(TypeDataBase db) {
-    Type type = db.lookupType("HashtableEntry");
-    literalField   = type.getOopField("_literal");
+    Type type = db.lookupType("HashtableEntry<intptr_t>");
+    literalField   = type.getAddressField("_literal");
   }
 
   // Fields
-  private static OopField      literalField;
+  private static AddressField      literalField;
 
   // Accessors
-  public Oop literal() {
-    return VM.getVM().getObjectHeap().newOop(literalField.getValue(addr));
+  public Address literalValue() {
+    return literalField.getValue(addr);
   }
 
   public HashtableEntry(Address addr) {
--- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Wed Jan 05 10:06:07 2011 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java	Tue Mar 01 15:05:39 2011 +0000
@@ -740,7 +740,7 @@
         for (Iterator itr = fields.iterator(); itr.hasNext();) {
             Field field = (Field) itr.next();
             Symbol name = symTbl.probe(field.getID().getName());
-            writeObjectID(name);
+            writeSymbolID(name);
             char typeCode = (char) field.getSignature().getByteAt(0);
             int kind = signatureToHprofKind(typeCode);
             out.writeByte((byte)kind);
@@ -852,7 +852,7 @@
     private void writeSymbol(Symbol sym) throws IOException {
         byte[] buf = sym.asString().getBytes("UTF-8");
         writeHeader(HPROF_UTF8, buf.length + OBJ_ID_SIZE);
-        writeObjectID(sym);
+        writeSymbolID(sym);
         out.write(buf);
     }
 
@@ -869,7 +869,7 @@
                         out.writeInt(serialNum);
                         writeObjectID(clazz);
                         out.writeInt(DUMMY_STACK_TRACE_ID);
-                        writeObjectID(k.getName());
+                        writeSymbolID(k.getName());
                         serialNum++;
                     } catch (IOException exp) {
                         throw new RuntimeException(exp);
@@ -901,6 +901,10 @@
         writeObjectID(address);
     }
 
+    private void writeSymbolID(Symbol sym) throws IOException {
+        writeObjectID(getAddressValue(sym.getAddress()));
+    }
+
     private void writeObjectID(long address) throws IOException {
         if (OBJ_ID_SIZE == 4) {
             out.writeInt((int) address);
--- a/make/Makefile	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/Makefile	Tue Mar 01 15:05:39 2011 +0000
@@ -73,6 +73,7 @@
   include defs.make
 endif
 
+include $(GAMMADIR)/make/altsrc.make
 
 ifneq ($(ALT_OUTPUTDIR),)
   ALT_OUT=ALT_OUTPUTDIR=$(ALT_OUTPUTDIR)
@@ -361,7 +362,8 @@
 $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/prims/%
 	$(install-file)
 
-$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h:  $(HS_SRC_DIR)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h
+HS_JNI_ARCH_SRC=$(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(HS_ARCH)/vm/jni_$(HS_ARCH).h)
+$(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h: $(HS_JNI_ARCH_SRC)
 	$(install-file)
 
 $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/services/%
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/altsrc.make	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,92 @@
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#  
+#
+
+# This file defines variables and macros which are used in the makefiles to 
+# allow distributions to augment or replace common hotspot code with 
+# distribution-specific source files.
+
+# Requires: GAMMADIR
+# Provides:
+#   variables: HS_COMMON_SRC, HS_ALT_SRC, HS_COMMON_SRC_REL, and HS_ALT_SRC_REL
+#   functions: altsrc-equiv, if-has-altsrc, altsrc, altsrc-replace
+
+HS_COMMON_SRC_REL=src
+
+# This needs to be changed to a more generic location, but we keep it as this 
+# for now for compatibility
+HS_ALT_SRC_REL=src/closed
+
+HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL)
+HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL)
+
+
+## altsrc-equiv 
+# 
+# Convert a common source path to an alternative source path
+#
+# Parameter: An absolute path into the common sources
+# Result: The matching path to the alternate-source location
+#
+altsrc-equiv=$(subst $(HS_COMMON_SRC)/,$(HS_ALT_SRC)/,$(1))
+
+
+## if-has-altsrc
+#
+# Conditional macro to test for the existence of an alternate source path
+#
+# Parameter: An absolute path into the common sources
+# Parameter: Result if the alternative-source location exists
+# Parameter: Result if the alternative-source location does not exist
+# Result: expands to parameter 2 or 3 depending on existence of alternate source
+#
+if-has-altsrc=$(if $(wildcard $(call altsrc-equiv,$(1))),$(2),$(3))
+
+
+## altsrc
+#
+# Converts common source path to alternate source path if the alternate 
+# path exists, otherwise evaluates to nul (empty string)
+# 
+# Parameter: An absolute path into the common sources
+# Result: The equivalent path to the alternate-source location, if such a 
+#         location exists on the filesystem.  Otherwise it expands to empty.
+# 
+altsrc=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)))
+
+## commonsrc
+# 
+# Returns parameter.
+#
+commonsrc=$(1)
+
+
+## altsrc-replace
+#
+# Converts a common source path to an alternate source path if the alternate
+# source path exists.  Otherwise it evaluates to the input common source path.
+#
+# Parameter: An absolute path into the common sources
+# Result: A path to either the common or alternate sources
+#
+altsrc-replace=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)),$(1))
--- a/make/hotspot_version	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/hotspot_version	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,11 @@
 #
 
 # Don't put quotes (fail windows build).
-HOTSPOT_VM_COPYRIGHT=Copyright 2010
+HOTSPOT_VM_COPYRIGHT=Copyright 2011
 
-HS_MAJOR_VER=20
+HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=05
+HS_BUILD_NUMBER=02
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/make/jprt.properties	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/jprt.properties	Tue Mar 01 15:05:39 2011 +0000
@@ -44,6 +44,11 @@
 
 jprt.sync.push=false
 
+# Note: we want both embedded releases and regular releases to build and test
+#       all platforms so that regressions are not introduced (eg. change to
+#       common code by SE breaks PPC/ARM; change to common code by SE-E breaks
+#       sparc etc.
+
 # Define the Solaris platforms we want for the various releases
 
 jprt.my.solaris.sparc.jdk7=solaris_sparc_5.10
@@ -55,6 +60,8 @@
 jprt.my.solaris.sparc.jdk6u14=solaris_sparc_5.8
 jprt.my.solaris.sparc.jdk6u18=solaris_sparc_5.8
 jprt.my.solaris.sparc.jdk6u20=solaris_sparc_5.8
+jprt.my.solaris.sparc.ejdk7=${jprt.my.solaris.sparc.jdk7}
+jprt.my.solaris.sparc.ejdk6=${jprt.my.solaris.sparc.jdk6}
 jprt.my.solaris.sparc=${jprt.my.solaris.sparc.${jprt.tools.default.release}}
 
 jprt.my.solaris.sparcv9.jdk7=solaris_sparcv9_5.10
@@ -66,6 +73,8 @@
 jprt.my.solaris.sparcv9.jdk6u14=solaris_sparcv9_5.8
 jprt.my.solaris.sparcv9.jdk6u18=solaris_sparcv9_5.8
 jprt.my.solaris.sparcv9.jdk6u20=solaris_sparcv9_5.8
+jprt.my.solaris.sparcv9.ejdk7=${jprt.my.solaris.sparcv9.jdk7}
+jprt.my.solaris.sparcv9.ejdk6=${jprt.my.solaris.sparcv9.jdk6}
 jprt.my.solaris.sparcv9=${jprt.my.solaris.sparcv9.${jprt.tools.default.release}}
 
 jprt.my.solaris.i586.jdk7=solaris_i586_5.10
@@ -77,6 +86,8 @@
 jprt.my.solaris.i586.jdk6u14=solaris_i586_5.8
 jprt.my.solaris.i586.jdk6u18=solaris_i586_5.8
 jprt.my.solaris.i586.jdk6u20=solaris_i586_5.8
+jprt.my.solaris.i586.ejdk7=${jprt.my.solaris.i586.jdk7}
+jprt.my.solaris.i586.ejdk6=${jprt.my.solaris.i586.jdk6}
 jprt.my.solaris.i586=${jprt.my.solaris.i586.${jprt.tools.default.release}}
 
 jprt.my.solaris.x64.jdk7=solaris_x64_5.10
@@ -88,6 +99,8 @@
 jprt.my.solaris.x64.jdk6u14=solaris_x64_5.10
 jprt.my.solaris.x64.jdk6u18=solaris_x64_5.10
 jprt.my.solaris.x64.jdk6u20=solaris_x64_5.10
+jprt.my.solaris.x64.ejdk7=${jprt.my.solaris.x64.jdk7}
+jprt.my.solaris.x64.ejdk6=${jprt.my.solaris.x64.jdk6}
 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
 
 jprt.my.linux.i586.jdk7=linux_i586_2.6
@@ -99,6 +112,8 @@
 jprt.my.linux.i586.jdk6u14=linux_i586_2.4
 jprt.my.linux.i586.jdk6u18=linux_i586_2.4
 jprt.my.linux.i586.jdk6u20=linux_i586_2.4
+jprt.my.linux.i586.ejdk7=linux_i586_2.6
+jprt.my.linux.i586.ejdk6=linux_i586_2.6
 jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
 
 jprt.my.linux.x64.jdk7=linux_x64_2.6
@@ -110,8 +125,45 @@
 jprt.my.linux.x64.jdk6u14=linux_x64_2.4
 jprt.my.linux.x64.jdk6u18=linux_x64_2.4
 jprt.my.linux.x64.jdk6u20=linux_x64_2.4
+jprt.my.linux.x64.ejdk7=${jprt.my.linux.x64.jdk7}
+jprt.my.linux.x64.ejdk6=${jprt.my.linux.x64.jdk6}
 jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
 
+jprt.my.linux.ppc.jdk7=linux_ppc_2.6
+jprt.my.linux.ppc.jdk7b107=linux_ppc_2.6
+jprt.my.linux.ppc.jdk7temp=linux_ppc_2.6
+jprt.my.linux.ppc.ejdk6=linux_ppc_2.6
+jprt.my.linux.ppc.ejdk7=linux_ppc_2.6
+jprt.my.linux.ppc=${jprt.my.linux.ppc.${jprt.tools.default.release}}
+
+jprt.my.linux.ppcv2.jdk7=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.jdk7b107=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.jdk7temp=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.ejdk6=linux_ppcv2_2.6
+jprt.my.linux.ppcv2.ejdk7=linux_ppcv2_2.6
+jprt.my.linux.ppcv2=${jprt.my.linux.ppcv2.${jprt.tools.default.release}}
+
+jprt.my.linux.ppcsflt.jdk7=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.jdk7b107=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.jdk7temp=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.ejdk6=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt.ejdk7=linux_ppcsflt_2.6
+jprt.my.linux.ppcsflt=${jprt.my.linux.ppcsflt.${jprt.tools.default.release}}
+
+jprt.my.linux.armvfp.jdk7=linux_armvfp_2.6
+jprt.my.linux.armvfp.jdk7b107=linux_armvfp_2.6
+jprt.my.linux.armvfp.jdk7temp=linux_armvfp_2.6
+jprt.my.linux.armvfp.ejdk6=linux_armvfp_2.6
+jprt.my.linux.armvfp.ejdk7=linux_armvfp_2.6
+jprt.my.linux.armvfp=${jprt.my.linux.armvfp.${jprt.tools.default.release}}
+
+jprt.my.linux.armsflt.jdk7=linux_armsflt_2.6
+jprt.my.linux.armsflt.jdk7b107=linux_armsflt_2.6
+jprt.my.linux.armsflt.jdk7temp=linux_armsflt_2.6
+jprt.my.linux.armsflt.ejdk6=linux_armsflt_2.6
+jprt.my.linux.armsflt.ejdk7=linux_armsflt_2.6
+jprt.my.linux.armsflt=${jprt.my.linux.armsflt.${jprt.tools.default.release}}
+
 jprt.my.windows.i586.jdk7=windows_i586_5.1
 jprt.my.windows.i586.jdk7b107=windows_i586_5.0
 jprt.my.windows.i586.jdk7temp=windows_i586_5.0
@@ -121,6 +173,8 @@
 jprt.my.windows.i586.jdk6u14=windows_i586_5.0
 jprt.my.windows.i586.jdk6u18=windows_i586_5.0
 jprt.my.windows.i586.jdk6u20=windows_i586_5.0
+jprt.my.windows.i586.ejdk7=${jprt.my.windows.i586.jdk7}
+jprt.my.windows.i586.ejdk6=${jprt.my.windows.i586.jdk6}
 jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
 
 jprt.my.windows.x64.jdk7=windows_x64_5.2
@@ -132,11 +186,13 @@
 jprt.my.windows.x64.jdk6u14=windows_x64_5.2
 jprt.my.windows.x64.jdk6u18=windows_x64_5.2
 jprt.my.windows.x64.jdk6u20=windows_x64_5.2
+jprt.my.windows.x64.ejdk7=${jprt.my.windows.x64.jdk7}
+jprt.my.windows.x64.ejdk6=${jprt.my.windows.x64.jdk6}
 jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
 
 # Standard list of jprt build targets for this source tree
 
-jprt.build.targets= \
+jprt.build.targets.standard= \
     ${jprt.my.solaris.sparc}-{product|fastdebug|debug}, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug|debug}, \
     ${jprt.my.solaris.i586}-{product|fastdebug|debug}, \
@@ -146,10 +202,35 @@
     ${jprt.my.windows.i586}-{product|fastdebug|debug}, \
     ${jprt.my.windows.x64}-{product|fastdebug|debug}
 
+jprt.build.targets.embedded= \
+    ${jprt.my.linux.i586}-{product|fastdebug|debug}, \
+    ${jprt.my.linux.ppc}-{product|fastdebug}, \
+    ${jprt.my.linux.ppcv2}-{product|fastdebug}, \
+    ${jprt.my.linux.ppcsflt}-{product|fastdebug}, \
+    ${jprt.my.linux.armvfp}-{product|fastdebug}, \
+    ${jprt.my.linux.armsflt}-{product|fastdebug}
+
+jprt.build.targets.all=${jprt.build.targets.standard}, \
+    ${jprt.build.targets.embedded}
+
+jprt.build.targets.jdk7=${jprt.build.targets.all}
+jprt.build.targets.jdk7temp=${jprt.build.targets.all}
+jprt.build.targets.jdk7b107=${jprt.build.targets.all}
+jprt.build.targets.jdk6=${jprt.build.targets.standard}
+jprt.build.targets.jdk6perf=${jprt.build.targets.standard}
+jprt.build.targets.jdk6u10=${jprt.build.targets.standard}
+jprt.build.targets.jdk6u14=${jprt.build.targets.standard}
+jprt.build.targets.jdk6u18=${jprt.build.targets.standard}
+jprt.build.targets.jdk6u20=${jprt.build.targets.standard}
+jprt.build.targets.ejdk6=${jprt.build.targets.all}
+jprt.build.targets.ejdk7=${jprt.build.targets.all}
+jprt.build.targets=${jprt.build.targets.${jprt.tools.default.release}}
+
 # Subset lists of test targets for this source tree
 
 jprt.my.solaris.sparc.test.targets= \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-jvm98, \
+    ${jprt.my.solaris.sparc}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-scimark, \
     ${jprt.my.solaris.sparc}-product-{c1|c2}-runThese, \
     ${jprt.my.solaris.sparc}-fastdebug-c1-runThese_Xshare, \
@@ -168,6 +249,7 @@
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-GCOld_G1, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-GCOld_ParOldGC, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-jbb_default, \
+    ${jprt.my.solaris.sparc}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-jbb_SerialGC, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-jbb_ParallelGC, \
     ${jprt.my.solaris.sparc}-{product|fastdebug}-{c1|c2}-jbb_CMS, \
@@ -176,6 +258,7 @@
 
 jprt.my.solaris.sparcv9.test.targets= \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jvm98, \
+    ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-scimark, \
     ${jprt.my.solaris.sparcv9}-product-c2-runThese, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCBasher_default, \
@@ -193,6 +276,7 @@
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCOld_G1, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-GCOld_ParOldGC, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jbb_SerialGC, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jbb_ParallelGC, \
     ${jprt.my.solaris.sparcv9}-{product|fastdebug}-c2-jbb_CMS, \
@@ -201,6 +285,7 @@
 
 jprt.my.solaris.x64.test.targets= \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jvm98, \
+    ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-scimark, \
     ${jprt.my.solaris.x64}-product-c2-runThese, \
     ${jprt.my.solaris.x64}-product-c2-runThese_Xcomp, \
@@ -219,6 +304,7 @@
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCOld_G1, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCOld_ParOldGC, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jbb_SerialGC, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-jbb_ParallelGC, \
     ${jprt.my.solaris.x64}-{product|fastdebug}-c2-GCOld_CMS, \
@@ -227,6 +313,7 @@
 
 jprt.my.solaris.i586.test.targets= \
     ${jprt.my.solaris.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
+    ${jprt.my.solaris.i586}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.solaris.i586}-{product|fastdebug}-{c1|c2}-scimark, \
     ${jprt.my.solaris.i586}-product-{c1|c2}-runThese_Xcomp, \
     ${jprt.my.solaris.i586}-fastdebug-c1-runThese_Xcomp, \
@@ -253,6 +340,7 @@
     ${jprt.my.solaris.i586}-product-c1-GCOld_G1, \
     ${jprt.my.solaris.i586}-product-c1-GCOld_ParOldGC, \
     ${jprt.my.solaris.i586}-fastdebug-c2-jbb_default, \
+    ${jprt.my.solaris.i586}-fastdebug-c2-jbb_default_tiered, \
     ${jprt.my.solaris.i586}-fastdebug-c2-jbb_ParallelGC, \
     ${jprt.my.solaris.i586}-fastdebug-c2-jbb_CMS, \
     ${jprt.my.solaris.i586}-fastdebug-c2-jbb_G1, \
@@ -260,6 +348,7 @@
 
 jprt.my.linux.i586.test.targets = \
     ${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
+    ${jprt.my.linux.i586}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.linux.i586}-{product|fastdebug}-{c1|c2}-scimark, \
     ${jprt.my.linux.i586}-product-c1-runThese_Xcomp, \
     ${jprt.my.linux.i586}-fastdebug-c1-runThese_Xshare, \
@@ -279,6 +368,7 @@
     ${jprt.my.linux.i586}-product-{c1|c2}-GCOld_G1, \
     ${jprt.my.linux.i586}-product-{c1|c2}-GCOld_ParOldGC, \
     ${jprt.my.linux.i586}-{product|fastdebug}-c1-jbb_default, \
+    ${jprt.my.linux.i586}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.linux.i586}-{product|fastdebug}-c1-jbb_ParallelGC, \
     ${jprt.my.linux.i586}-{product|fastdebug}-c1-jbb_CMS, \
     ${jprt.my.linux.i586}-{product|fastdebug}-c1-jbb_G1, \
@@ -286,6 +376,7 @@
 
 jprt.my.linux.x64.test.targets = \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jvm98, \
+    ${jprt.my.linux.x64}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-scimark, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-GCBasher_default, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-GCBasher_SerialGC, \
@@ -302,12 +393,14 @@
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-GCOld_G1, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-GCOld_ParOldGC, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_ParallelGC, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_G1, \
     ${jprt.my.linux.x64}-{product|fastdebug}-c2-jbb_ParOldGC
 
 jprt.my.windows.i586.test.targets = \
     ${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-jvm98, \
+    ${jprt.my.windows.i586}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-scimark, \
     ${jprt.my.windows.i586}-product-{c1|c2}-runThese, \
     ${jprt.my.windows.i586}-product-{c1|c2}-runThese_Xcomp, \
@@ -327,6 +420,7 @@
     ${jprt.my.windows.i586}-product-{c1|c2}-GCOld_G1, \
     ${jprt.my.windows.i586}-product-{c1|c2}-GCOld_ParOldGC, \
     ${jprt.my.windows.i586}-{product|fastdebug}-{c1|c2}-jbb_default, \
+    ${jprt.my.windows.i586}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.windows.i586}-product-{c1|c2}-jbb_ParallelGC, \
     ${jprt.my.windows.i586}-product-{c1|c2}-jbb_CMS, \
     ${jprt.my.windows.i586}-product-{c1|c2}-jbb_G1, \
@@ -334,6 +428,7 @@
 
 jprt.my.windows.x64.test.targets = \
     ${jprt.my.windows.x64}-{product|fastdebug}-c2-jvm98, \
+    ${jprt.my.windows.x64}-{product|fastdebug}-c2-jvm98_tiered, \
     ${jprt.my.windows.x64}-{product|fastdebug}-c2-scimark, \
     ${jprt.my.windows.x64}-product-c2-runThese, \
     ${jprt.my.windows.x64}-product-c2-runThese_Xcomp, \
@@ -351,14 +446,20 @@
     ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCOld_G1, \
     ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCOld_ParOldGC, \
     ${jprt.my.windows.x64}-{product|fastdebug}-c2-jbb_default, \
+    ${jprt.my.windows.x64}-{product|fastdebug}-c2-jbb_default_tiered, \
     ${jprt.my.windows.x64}-product-c2-jbb_CMS, \
     ${jprt.my.windows.x64}-product-c2-jbb_ParallelGC, \
     ${jprt.my.windows.x64}-product-c2-jbb_G1, \
     ${jprt.my.windows.x64}-product-c2-jbb_ParOldGC
 
+# Testing for actual embedded builds is different to standard
+jprt.my.linux.i586.test.targets.embedded = \
+    linux_i586_2.6-product-c1-scimark
+
 # The complete list of test targets for jprt
+# Note: no PPC or ARM tests at this stage
 
-jprt.test.targets = \
+jprt.test.targets.standard = \
   ${jprt.my.solaris.sparc.test.targets}, \
   ${jprt.my.solaris.sparcv9.test.targets}, \
   ${jprt.my.solaris.i586.test.targets}, \
@@ -368,15 +469,41 @@
   ${jprt.my.windows.i586.test.targets}, \
   ${jprt.my.windows.x64.test.targets}
 
+jprt.test.targets.embedded= 		\
+  ${jprt.my.linux.i586.test.targets.embedded}, \
+  ${jprt.my.solaris.sparc.test.targets}, \
+  ${jprt.my.solaris.sparcv9.test.targets}, \
+  ${jprt.my.solaris.i586.test.targets}, \
+  ${jprt.my.solaris.x64.test.targets}, \
+  ${jprt.my.linux.x64.test.targets}, \
+  ${jprt.my.windows.i586.test.targets}, \
+  ${jprt.my.windows.x64.test.targets}
+
+
+jprt.test.targets.jdk7=${jprt.test.targets.standard}
+jprt.test.targets.jdk7temp=${jprt.test.targets.standard}
+jprt.test.targets.jdk7b105=${jprt.test.targets.standard}
+jprt.test.targets.jdk6=${jprt.test.targets.standard}
+jprt.test.targets.jdk6perf=${jprt.test.targets.standard}
+jprt.test.targets.jdk6u10=${jprt.test.targets.standard}
+jprt.test.targets.jdk6u14=${jprt.test.targets.standard}
+jprt.test.targets.jdk6u18=${jprt.test.targets.standard}
+jprt.test.targets.jdk6u20=${jprt.test.targets.standard}
+jprt.test.targets.ejdk6=${jprt.test.targets.embedded}
+jprt.test.targets.ejdk7=${jprt.test.targets.embedded}
+jprt.test.targets=${jprt.test.targets.${jprt.tools.default.release}}
+
 # The default test/Makefile targets that should be run
 
 #jprt.make.rule.test.targets=*-product-*-packtest
 
-jprt.make.rule.test.targets = \
+jprt.make.rule.test.targets.standard.client = \
   ${jprt.my.solaris.sparc}-*-c1-clienttest, \
   ${jprt.my.solaris.i586}-*-c1-clienttest, \
   ${jprt.my.linux.i586}-*-c1-clienttest, \
-  ${jprt.my.windows.i586}-*-c1-clienttest, \
+  ${jprt.my.windows.i586}-*-c1-clienttest
+
+jprt.make.rule.test.targets.standard.server = \
   ${jprt.my.solaris.sparc}-*-c2-servertest, \
   ${jprt.my.solaris.sparcv9}-*-c2-servertest, \
   ${jprt.my.solaris.i586}-*-c2-servertest, \
@@ -386,3 +513,23 @@
   ${jprt.my.windows.i586}-*-c2-servertest, \
   ${jprt.my.windows.x64}-*-c2-servertest
 
+jprt.make.rule.test.targets.standard = \
+  ${jprt.make.rule.test.targets.standard.client}, \
+  ${jprt.make.rule.test.targets.standard.server}
+
+jprt.make.rule.test.targets.embedded = \
+  ${jprt.make.rule.test.targets.standard.client}
+
+jprt.make.rule.test.targets.jdk7=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk7temp=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk7b107=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6perf=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6u10=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6u14=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6u18=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.jdk6u20=${jprt.make.rule.test.targets.standard}
+jprt.make.rule.test.targets.ejdk6=${jprt.make.rule.test.targets.embedded}
+jprt.make.rule.test.targets.ejdk7=${jprt.make.rule.test.targets.embedded}
+jprt.make.rule.test.targets=${jprt.make.rule.test.targets.${jprt.tools.default.release}}
+
--- a/make/linux/Makefile	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/Makefile	Tue Mar 01 15:05:39 2011 +0000
@@ -208,7 +208,7 @@
 TARGETS_SHARK     = $(addsuffix shark,$(TARGETS))
 
 BUILDTREE_MAKE    = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
-BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) ARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
+BUILDTREE_VARS    = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH)
 BUILDTREE_VARS   += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 
 BUILDTREE         = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
--- a/make/linux/makefiles/adlc.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/adlc.make	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,8 +39,9 @@
 
 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad 
 
-SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
-	     $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad 
+SOURCES.AD = \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
 
 EXEC	= $(OUTDIR)/adlc
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/linux/makefiles/arm.make	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,10 @@
+#
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+Obj_Files += linux_arm.o
+
+LIBS += $(EXT_LIBS_PATH)/sflt_glibc.a 
+
+CFLAGS += -DVM_LITTLE_ENDIAN
--- a/make/linux/makefiles/buildtree.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/buildtree.make	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 
 # Usage:
 #
-# $(MAKE) -f buildtree.make ARCH=arch BUILDARCH=buildarch LIBARCH=libarch
+# $(MAKE) -f buildtree.make SRCARCH=srcarch BUILDARCH=buildarch LIBARCH=libarch
 #         GAMMADIR=dir OS_FAMILY=os VARIANT=variant
 #
 # The macros ARCH, GAMMADIR, OS_FAMILY and VARIANT must be defined in the
@@ -56,6 +56,8 @@
 # having to read the dependency files for the vm.
 
 include $(GAMMADIR)/make/scm.make
+include $(GAMMADIR)/make/altsrc.make
+
 
 # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
 QUIETLY$(MAKE_VERBOSE)	= @
@@ -127,7 +129,7 @@
         env.sh env.csh jdkpath.sh .dbxrc test_gamma
 
 BUILDTREE_VARS	= GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OS_FAMILY) \
-	ARCH=$(ARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
+	SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) VARIANT=$(VARIANT)
 
 # Define variables to be set in flags.make.
 # Default values are set in make/defs.make.
@@ -146,13 +148,7 @@
 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
 # or make/hotspot_distro.
 ifndef HOTSPOT_VM_DISTRO
-  CLOSED_DIR_EXISTS := $(shell                \
-    if [ -d $(GAMMADIR)/src/closed ] ; then \
-      echo true;                              \
-    else                                      \
-      echo false;                             \
-    fi)
-  ifeq ($(CLOSED_DIR_EXISTS), true)
+  ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
     include $(GAMMADIR)/make/hotspot_distro
   else
     include $(GAMMADIR)/make/openjdk_distro
@@ -177,6 +173,11 @@
 $(SIMPLE_DIRS):
 	$(QUIETLY) mkdir -p $@
 
+# Convenience macro which takes a source relative path, applies $(1) to the
+# absolute path, and then replaces $(GAMMADIR) in the result with a 
+# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.  
+gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))
+
 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
 	@echo Creating $@ ...
 	$(QUIETLY) ( \
@@ -187,7 +188,7 @@
 	echo; \
 	echo "GAMMADIR = $(GAMMADIR)"; \
 	echo "SYSDEFS = \$$(Platform_sysdefs)"; \
-	echo "SRCARCH = $(ARCH)"; \
+	echo "SRCARCH = $(SRCARCH)"; \
 	echo "BUILDARCH = $(BUILDARCH)"; \
 	echo "LIBARCH = $(LIBARCH)"; \
 	echo "TARGET = $(TARGET)"; \
@@ -208,16 +209,28 @@
 	echo; \
 	echo "Src_Dirs_V = \\"; \
 	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	echo; \
 	echo "Src_Dirs_I = \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,altsrc,share/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm) \\"; \
+	echo "$(call gamma-path,altsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(SRCARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	[ -n "$(CFLAGS_BROWSE)" ] && \
 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
@@ -241,9 +254,14 @@
 
 ../shared_dirs.lst:  $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
 	@echo Creating directory list $@
-	$(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \
+	$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
+          find $(HS_ALT_SRC)/share/vm/* -prune \
+	  -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
+          \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
+        fi;
+	$(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \
 	-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
-        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@
+        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
 
 Makefile: $(BUILDTREE_MAKE)
 	@echo Creating $@ ...
--- a/make/linux/makefiles/gcc.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/gcc.make	Tue Mar 01 15:05:39 2011 +0000
@@ -75,6 +75,11 @@
 CFLAGS += -fno-exceptions
 CFLAGS += -D_REENTRANT
 CFLAGS += -fcheck-new
+# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
+# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
+CFLAGS += -fvisibility=hidden
+endif
 
 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
 ARCHFLAG/i486    = -m32 -march=i586
--- a/make/linux/makefiles/mapfile-vers-debug	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/mapfile-vers-debug	Tue Mar 01 15:05:39 2011 +0000
@@ -262,14 +262,6 @@
                 JVM_SetField;
                 JVM_SetPrimitiveField;
 
-                # Needed for dropping VM into JDK 1.3.x, 1.4
-                _JVM_native_threads;
-                jdk_sem_init;
-                jdk_sem_post;
-                jdk_sem_wait;
-                jdk_pthread_sigmask;
-                jdk_waitpid;
-
                 # debug JVM
                 JVM_AccessVMBooleanFlag;
                 JVM_AccessVMIntFlag;
--- a/make/linux/makefiles/mapfile-vers-product	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/mapfile-vers-product	Tue Mar 01 15:05:39 2011 +0000
@@ -262,14 +262,6 @@
                 JVM_SetField;
                 JVM_SetPrimitiveField;
 
-                # Needed for dropping VM into JDK 1.3.x, 1.4
-                _JVM_native_threads;
-                jdk_sem_init;
-                jdk_sem_post;
-                jdk_sem_wait;
-                jdk_pthread_sigmask;
-                jdk_waitpid;
-
                 # miscellaneous functions
                 jio_fprintf;
                 jio_printf;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/linux/makefiles/ppc.make	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,11 @@
+#
+# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+#
+
+# The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
+OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
+
+# Must also specify if CPU is big endian
+CFLAGS += -DVM_BIG_ENDIAN
+
--- a/make/linux/makefiles/rules.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/rules.make	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -146,6 +146,8 @@
 include $(GAMMADIR)/make/pic.make
 endif
 
+include $(GAMMADIR)/make/altsrc.make
+
 # The non-PIC object files are only generated for 32 bit platforms.
 ifdef LP64
 %.o: %.cpp
--- a/make/linux/makefiles/top.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/top.make	Tue Mar 01 15:05:39 2011 +0000
@@ -39,6 +39,8 @@
 # Instead, use "gmake" (or "gnumake") from the command line.  --Rose
 #MAKE = gmake
 
+include $(GAMMADIR)/make/altsrc.make
+
 TOPDIR      = $(shell echo `pwd`)
 GENERATED   = $(TOPDIR)/../generated
 VM          = $(GAMMADIR)/src/share/vm
@@ -57,8 +59,8 @@
 
 AD_Dir   = $(GENERATED)/adfiles
 ADLC     = $(AD_Dir)/adlc
-AD_Spec  = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad
-AD_Src   = $(GAMMADIR)/src/share/vm/adlc
+AD_Spec  = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad)
+AD_Src   = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc)
 AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp
 AD_Files = $(AD_Names:%=$(AD_Dir)/%)
 
--- a/make/linux/makefiles/vm.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/linux/makefiles/vm.make	Tue Mar 01 15:05:39 2011 +0000
@@ -28,6 +28,7 @@
 # Common build rules.
 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
 include $(MAKEFILES_DIR)/rules.make
+include $(GAMMADIR)/make/altsrc.make
 
 default: build
 
@@ -119,17 +120,27 @@
 LIBJVM   = lib$(JVM).so
 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 
-CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
-CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
-CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
-CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
-CORE_PATHS += $(GENERATED)/jvmtifiles
+SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
 
-COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
+SOURCE_PATHS=\
+  $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
+      \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
 
-COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
-COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
-COMPILER2_PATHS +=  $(GENERATED)/adfiles
+CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
+CORE_PATHS+=$(GENERATED)/jvmtifiles
+
+COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
+COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
+
+COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
+COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
+COMPILER2_PATHS += $(GENERATED)/adfiles
 
 # Include dirs per type.
 Src_Dirs/CORE      := $(CORE_PATHS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/linux/platform_arm	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,17 @@
+os_family = linux
+
+arch = arm
+
+arch_model = arm
+
+os_arch = linux_arm
+
+os_arch_model = linux_arm
+
+lib_arch = arm
+
+compiler = gcc
+
+gnu_dis_arch = arm
+
+sysdefs = -DLINUX -D_GNU_SOURCE -DARM
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/linux/platform_ppc	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,17 @@
+os_family = linux
+
+arch = ppc
+
+arch_model = ppc
+
+os_arch = linux_ppc
+
+os_arch_model = linux_ppc
+
+lib_arch = ppc
+
+compiler = gcc
+
+gnu_dis_arch = ppc
+
+sysdefs = -DLINUX -D_GNU_SOURCE -DPPC
--- a/make/solaris/makefiles/adlc.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/solaris/makefiles/adlc.make	Tue Mar 01 15:05:39 2011 +0000
@@ -27,6 +27,7 @@
 # It knows how to compile, link, and run the adlc.
 
 include $(GAMMADIR)/make/$(Platform_os_family)/makefiles/rules.make
+include $(GAMMADIR)/make/altsrc.make
 
 # #########################################################################
 
@@ -39,8 +40,9 @@
 
 SOURCE.AD = $(OUTDIR)/$(OS)_$(Platform_arch_model).ad 
 
-SOURCES.AD = $(GAMMADIR)/src/cpu/$(ARCH)/vm/$(Platform_arch_model).ad \
-	     $(GAMMADIR)/src/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad 
+SOURCES.AD = \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(ARCH)/vm/$(Platform_arch_model).ad) \
+  $(call altsrc-replace,$(HS_COMMON_SRC)/os_cpu/$(OS)_$(ARCH)/vm/$(OS)_$(Platform_arch_model).ad)
 
 EXEC	= $(OUTDIR)/adlc
 
--- a/make/solaris/makefiles/buildtree.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/solaris/makefiles/buildtree.make	Tue Mar 01 15:05:39 2011 +0000
@@ -56,12 +56,13 @@
 # having to read the dependency files for the vm.
 
 include $(GAMMADIR)/make/scm.make
+include $(GAMMADIR)/make/altsrc.make
 
 # 'gmake MAKE_VERBOSE=y' or 'gmake QUIETLY=' gives all the gory details.
 QUIETLY$(MAKE_VERBOSE)	= @
 
 # For now, until the compiler is less wobbly:
-TESTFLAGS	= -Xbatch -showversion
+TESTFLAGS	= -Xbatch -Xmx32m -showversion
 
 ### maye ARCH_XXX instead?
 ifdef USE_GCC
@@ -139,13 +140,7 @@
 # Define HOTSPOT_VM_DISTRO based on settings in make/openjdk_distro
 # or make/hotspot_distro.
 ifndef HOTSPOT_VM_DISTRO
-  CLOSED_DIR_EXISTS := $(shell                \
-    if [ -d $(GAMMADIR)/src/closed ] ; then \
-      echo true;                              \
-    else                                      \
-      echo false;                             \
-    fi)
-  ifeq ($(CLOSED_DIR_EXISTS), true)
+  ifeq ($(call if-has-altsrc,$(HS_COMMON_SRC)/,true,false),true)
     include $(GAMMADIR)/make/hotspot_distro
   else
     include $(GAMMADIR)/make/openjdk_distro
@@ -170,6 +165,11 @@
 $(SIMPLE_DIRS):
 	$(QUIETLY) mkdir -p $@
 
+# Convenience macro which takes a source relative path, applies $(1) to the
+# absolute path, and then replaces $(GAMMADIR) in the result with a 
+# literal "$(GAMMADIR)/" suitable for inclusion in a Makefile.  
+gamma-path=$(subst $(GAMMADIR),\$$(GAMMADIR),$(call $(1),$(HS_COMMON_SRC)/$(2)))
+
 flags.make: $(BUILDTREE_MAKE) ../shared_dirs.lst
 	@echo Creating $@ ...
 	$(QUIETLY) ( \
@@ -202,16 +202,28 @@
 	echo; \
 	echo "Src_Dirs_V = \\"; \
 	sed 's/$$/ \\/;s|$(GAMMADIR)|$$(GAMMADIR)|' ../shared_dirs.lst; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	echo; \
 	echo "Src_Dirs_I = \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm \\"; \
-	echo "\$$(GAMMADIR)/src/share/vm/prims \\"; \
-	echo "\$$(GAMMADIR)/src/cpu/$(ARCH)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os/$(OS_FAMILY)/vm \\"; \
-	echo "\$$(GAMMADIR)/src/os_cpu/$(OS_FAMILY)_$(ARCH)/vm"; \
+	echo "$(call gamma-path,altsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm/prims) \\"; \
+	echo "$(call gamma-path,altsrc,share/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,share/vm) \\"; \
+	echo "$(call gamma-path,altsrc,cpu/$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,cpu/$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os_cpu/$(OS_FAMILY)_$(ARCH)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/$(OS_FAMILY)/vm) \\"; \
+	echo "$(call gamma-path,altsrc,os/posix/vm) \\"; \
+	echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
 	[ -n "$(CFLAGS_BROWSE)" ] && \
 	    echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
 	[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
@@ -235,9 +247,14 @@
 
 ../shared_dirs.lst:  $(BUILDTREE_MAKE) $(GAMMADIR)/src/share/vm
 	@echo Creating directory list $@
-	$(QUIETLY) find $(GAMMADIR)/src/share/vm/* -prune \
+	$(QUIETLY) if [ -d $(HS_ALT_SRC)/share/vm ]; then \
+          find $(HS_ALT_SRC)/share/vm/* -prune \
+	  -type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
+          \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@; \
+        fi;
+	$(QUIETLY) find $(HS_COMMON_SRC)/share/vm/* -prune \
 	-type d \! \( $(TOPLEVEL_EXCLUDE_DIRS) \) -exec find {} \
-        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; > $@
+        \( $(ALWAYS_EXCLUDE_DIRS) \) -prune -o -type d -print \; >> $@
 
 Makefile: $(BUILDTREE_MAKE)
 	@echo Creating $@ ...
--- a/make/solaris/makefiles/rules.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/solaris/makefiles/rules.make	Tue Mar 01 15:05:39 2011 +0000
@@ -146,6 +146,8 @@
 include $(GAMMADIR)/make/pic.make
 endif
 
+include $(GAMMADIR)/make/altsrc.make
+
 # Sun compiler for 64 bit Solaris does not support building non-PIC object files.
 ifdef LP64
 %.o: %.cpp
--- a/make/solaris/makefiles/top.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/solaris/makefiles/top.make	Tue Mar 01 15:05:39 2011 +0000
@@ -39,6 +39,8 @@
 # Instead, use "gmake" (or "gnumake") from the command line.  --Rose
 #MAKE = gmake
 
+include $(GAMMADIR)/make/altsrc.make
+
 GENERATED   = ../generated
 VM          = $(GAMMADIR)/src/share/vm
 Plat_File   = $(Platform_file)
@@ -48,8 +50,8 @@
 
 AD_Dir   = $(GENERATED)/adfiles
 ADLC     = $(AD_Dir)/adlc
-AD_Spec  = $(GAMMADIR)/src/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad
-AD_Src   = $(GAMMADIR)/src/share/vm/adlc
+AD_Spec  = $(call altsrc-replace,$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm/$(Platform_arch_model).ad)
+AD_Src   = $(call altsrc-replace,$(HS_COMMON_SRC)/share/vm/adlc)
 AD_Names = ad_$(Platform_arch_model).hpp ad_$(Platform_arch_model).cpp
 AD_Files = $(AD_Names:%=$(AD_Dir)/%)
 
--- a/make/solaris/makefiles/vm.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/solaris/makefiles/vm.make	Tue Mar 01 15:05:39 2011 +0000
@@ -28,6 +28,7 @@
 # Common build rules.
 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
 include $(MAKEFILES_DIR)/rules.make
+include $(GAMMADIR)/make/altsrc.make
 
 default: build
 
@@ -119,6 +120,10 @@
 LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc -ldemangle
 endif # sparcWorks
 
+ifeq ("${Platform_arch}", "sparc")
+LIBS += -lkstat
+endif
+
 # By default, link the *.o into the library, not the executable.
 LINK_INTO$(LINK_INTO) = LIBJVM
 
@@ -135,16 +140,26 @@
 LIBJVM   = lib$(JVM).so
 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 
-CORE_PATHS := $(shell find $(GAMMADIR)/src/share/vm/* -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \))
-CORE_PATHS += $(GAMMADIR)/src/os/$(Platform_os_family)/vm
-CORE_PATHS += $(GAMMADIR)/src/cpu/$(Platform_arch)/vm
-CORE_PATHS += $(GAMMADIR)/src/os_cpu/$(Platform_os_arch)/vm
-CORE_PATHS += $(GENERATED)/jvmtifiles
+SPECIAL_PATHS:=adlc c1 dist gc_implementation opto shark libadt
 
-COMPILER1_PATHS := $(GAMMADIR)/src/share/vm/c1
+SOURCE_PATHS=\
+  $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
+      \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
+SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
 
-COMPILER2_PATHS := $(GAMMADIR)/src/share/vm/opto
-COMPILER2_PATHS += $(GAMMADIR)/src/share/vm/libadt
+CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
+CORE_PATHS+=$(GENERATED)/jvmtifiles
+
+COMPILER1_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/c1)
+COMPILER1_PATHS += $(HS_COMMON_SRC)/share/vm/c1
+
+COMPILER2_PATHS := $(call altsrc,$(HS_COMMON_SRC)/share/vm/opto)
+COMPILER2_PATHS += $(call altsrc,$(HS_COMMON_SRC)/share/vm/libadt)
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/opto
+COMPILER2_PATHS += $(HS_COMMON_SRC)/share/vm/libadt
 COMPILER2_PATHS +=  $(GENERATED)/adfiles
 
 # Include dirs per type.
--- a/make/windows/create_obj_files.sh	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/windows/create_obj_files.sh	Tue Mar 01 15:05:39 2011 +0000
@@ -51,21 +51,48 @@
 WorkSpace=$4
 GENERATED=$5
 
-BASE_PATHS="` $FIND ${WorkSpace}/src/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)`"
-BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/share/vm/gc_implementation/shared"
-BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os/${Platform_os_family}/vm"
-BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/cpu/${Platform_arch}/vm"
-BASE_PATHS="${BASE_PATHS} ${WorkSpace}/src/os_cpu/${Platform_os_arch}/vm"
+COMMONSRC_REL=src
+ALTSRC_REL=src/closed # Change this to pick up alt sources from somewhere else
+
+COMMONSRC=${WorkSpace}/${COMMONSRC_REL}
+ALTSRC=${WorkSpace}/${ALTSRC_REL}
+
+BASE_PATHS="`if [ -d ${ALTSRC}/share/vm ]; then $FIND ${ALTSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \); fi`"
+BASE_PATHS="${BASE_PATHS} ` $FIND ${COMMONSRC}/share/vm ! -name vm -prune -type d \! \( -name adlc -o -name c1 -o -name gc_implementation -o -name opto -o -name shark -o -name libadt \)`"
+
+for sd in \
+    share/vm/gc_implementation/shared \
+    os/${Platform_os_family}/vm \
+    cpu/${Platform_arch}/vm \
+    os_cpu/${Platform_os_arch}/vm; do 
+  if [ -d "${ALTSRC}/${sd}" ]; then
+    BASE_PATHS="${BASE_PATHS} ${ALTSRC}/${sd}"
+  fi
+  BASE_PATHS="${BASE_PATHS} ${COMMONSRC}/${sd}"
+done
+
 BASE_PATHS="${BASE_PATHS} ${GENERATED}/jvmtifiles"
 
 CORE_PATHS="${BASE_PATHS}"
 # shared is already in BASE_PATHS. Should add vm/memory but that one is also in BASE_PATHS.
-CORE_PATHS="${CORE_PATHS} `$FIND ${WorkSpace}/src/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`"
+if [ -d "${ALTSRC}/share/vm/gc_implementation" ]; then
+  CORE_PATHS="${CORE_PATHS} `$FIND ${ALTSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`"
+fi
+CORE_PATHS="${CORE_PATHS} `$FIND ${COMMONSRC}/share/vm/gc_implementation ! -name gc_implementation -prune -type d \! -name shared`"
 
-COMPILER1_PATHS="${WorkSpace}/src/share/vm/c1"
+if [ -d "${ALTSRC}/share/vm/c1" ]; then
+  COMPILER1_PATHS="${ALTSRC}/share/vm/c1"
+fi
+COMPILER1_PATHS="${COMPILER1_PATHS} ${COMMONSRC}/share/vm/c1"
 
-COMPILER2_PATHS="${WorkSpace}/src/share/vm/opto"
-COMPILER2_PATHS="${COMPILER2_PATHS} ${WorkSpace}/src/share/vm/libadt"
+if [ -d "${ALTSRC}/share/vm/opto" ]; then
+  COMPILER2_PATHS="${ALTSRC}/share/vm/opto"
+fi
+COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/opto"
+if [ -d "${ALTSRC}/share/vm/libadt" ]; then
+  COMPILER2_PATHS="${COMPILER2_PATHS} ${ALTSRC}/share/vm/libadt"
+fi
+COMPILER2_PATHS="${COMPILER2_PATHS} ${COMMONSRC}/share/vm/libadt"
 COMPILER2_PATHS="${COMPILER2_PATHS} ${GENERATED}/adfiles"
 
 # Include dirs per type.
--- a/make/windows/makefiles/compile.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/windows/makefiles/compile.make	Tue Mar 01 15:05:39 2011 +0000
@@ -152,7 +152,7 @@
 !endif
 
 # Always add the _STATIC_CPPLIB flag
-STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
+STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB /D _DISABLE_DEPRECATE_STATIC_CPPLIB
 MS_RUNTIME_OPTION = $(MS_RUNTIME_OPTION) $(STATIC_CPPLIB_OPTION)
 CPP_FLAGS=$(CPP_FLAGS) $(MS_RUNTIME_OPTION)
 
--- a/make/windows/makefiles/vm.make	Wed Jan 05 10:06:07 2011 +0000
+++ b/make/windows/makefiles/vm.make	Tue Mar 01 15:05:39 2011 +0000
@@ -27,6 +27,9 @@
 
 !include ..\generated\objfiles.make
 
+COMMONSRC=$(WorkSpace)\src
+ALTSRC=$(WorkSpace)\src\closed
+
 !ifdef RELEASE 
 !ifdef DEVELOP
 CPP_FLAGS=$(CPP_FLAGS) /D "DEBUG"
@@ -111,13 +114,30 @@
   /export:JVM_GetThreadStateValues           \
   /export:JVM_InitAgentProperties
 
-CPP_INCLUDE_DIRS=\
-  /I "..\generated" \
-  /I "$(WorkSpace)\src\share\vm" \
-  /I "$(WorkSpace)\src\share\vm\prims" \
-  /I "$(WorkSpace)\src\os\windows\vm" \
-  /I "$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm" \
-  /I "$(WorkSpace)\src\cpu\$(Platform_arch)\vm"
+CPP_INCLUDE_DIRS=/I "..\generated"
+
+!if exists($(ALTSRC)\share\vm)
+CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\share\vm"
+!endif
+
+!if exists($(ALTSRC)\os\windows\vm)
+CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os\windows\vm"
+!endif
+
+!if exists($(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm)
+CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm"
+!endif
+
+!if exists($(ALTSRC)\cpu\$(Platform_arch)\vm)
+CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) /I "$(ALTSRC)\cpu\$(Platform_arch)\vm"
+!endif
+
+CPP_INCLUDE_DIRS=$(CPP_INCLUDE_DIRS) \
+  /I "$(COMMONSRC)\share\vm" \
+  /I "$(COMMONSRC)\share\vm\prims" \
+  /I "$(COMMONSRC)\os\windows\vm" \
+  /I "$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm" \
+  /I "$(COMMONSRC)\cpu\$(Platform_arch)\vm"
 
 CPP_DONT_USE_PCH=/D DONT_USE_PRECOMPILED_HEADER
 
@@ -127,7 +147,7 @@
 CPP_USE_PCH=$(CPP_DONT_USE_PCH)
 !endif
 
-# Where to find the source code for the virtual machine
+# Where to find the source code for the virtual machine (is this used?)
 VM_PATH=../generated
 VM_PATH=$(VM_PATH);../generated/adfiles
 VM_PATH=$(VM_PATH);../generated/jvmtifiles
@@ -188,81 +208,157 @@
         $(CPP) $(CPP_FLAGS) $(CPP_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp
 
 # Default rules for the Virtual Machine
-{$(WorkSpace)\src\share\vm\c1}.cpp.obj::
+{$(COMMONSRC)\share\vm\c1}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\compiler}.cpp.obj::
+{$(COMMONSRC)\share\vm\compiler}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\code}.cpp.obj::
+{$(COMMONSRC)\share\vm\code}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\interpreter}.cpp.obj::
+{$(COMMONSRC)\share\vm\interpreter}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\ci}.cpp.obj::
+{$(COMMONSRC)\share\vm\ci}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\classfile}.cpp.obj::
+{$(COMMONSRC)\share\vm\classfile}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_implementation\parallelScavenge}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_implementation\shared}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_implementation\shared}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_implementation\parNew}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_implementation\parNew}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_implementation\g1}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_implementation\g1}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\gc_interface}.cpp.obj::
+{$(COMMONSRC)\share\vm\gc_interface}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\asm}.cpp.obj::
+{$(COMMONSRC)\share\vm\asm}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\memory}.cpp.obj::
+{$(COMMONSRC)\share\vm\memory}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\oops}.cpp.obj::
+{$(COMMONSRC)\share\vm\oops}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\prims}.cpp.obj::
+{$(COMMONSRC)\share\vm\prims}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\runtime}.cpp.obj::
+{$(COMMONSRC)\share\vm\runtime}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\services}.cpp.obj::
+{$(COMMONSRC)\share\vm\services}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\utilities}.cpp.obj::
+{$(COMMONSRC)\share\vm\utilities}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\libadt}.cpp.obj::
+{$(COMMONSRC)\share\vm\libadt}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\share\vm\opto}.cpp.obj::
+{$(COMMONSRC)\share\vm\opto}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\os\windows\vm}.cpp.obj::
+{$(COMMONSRC)\os\windows\vm}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
 # This guy should remain a single colon rule because
 # otherwise we can't specify the output filename.
-{$(WorkSpace)\src\os\windows\vm}.rc.res:
+{$(COMMONSRC)\os\windows\vm}.rc.res:
         @$(RC) $(RC_FLAGS) /fo"$@" $<
 
-{$(WorkSpace)\src\cpu\$(Platform_arch)\vm}.cpp.obj::
+{$(COMMONSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
-{$(WorkSpace)\src\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
+{$(COMMONSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\c1}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\compiler}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\code}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\interpreter}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\ci}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\classfile}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_implementation\parallelScavenge}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_implementation\shared}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_implementation\parNew}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_implementation\concurrentMarkSweep}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_implementation\g1}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\gc_interface}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\asm}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\memory}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\oops}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\prims}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\runtime}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\services}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\utilities}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\libadt}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\share\vm\opto}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\os\windows\vm}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+# otherwise we can't specify the output filename.
+{$(ALTSRC)\os\windows\vm}.rc.res:
+        @$(RC) $(RC_FLAGS) /fo"$@" $<
+
+{$(ALTSRC)\cpu\$(Platform_arch)\vm}.cpp.obj::
+        $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
+
+{$(ALTSRC)\os_cpu\windows_$(Platform_arch)\vm}.cpp.obj::
         $(CPP) $(CPP_FLAGS) $(CPP_USE_PCH) /c $<
 
 {..\generated\incls}.cpp.obj::
--- a/src/cpu/sparc/vm/assembler_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/assembler_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "asm/assembler.hpp"
 #include "assembler_sparc.inline.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "interpreter/interpreter.hpp"
@@ -1327,37 +1328,38 @@
 }
 
 
-int MacroAssembler::size_of_sethi(address a, bool worst_case) {
+int MacroAssembler::insts_for_sethi(address a, bool worst_case) {
 #ifdef _LP64
-  if (worst_case) return 7;
-  intptr_t iaddr = (intptr_t)a;
-  int hi32 = (int)(iaddr >> 32);
-  int lo32 = (int)(iaddr);
-  int inst_count;
-  if (hi32 == 0 && lo32 >= 0)
-    inst_count = 1;
-  else if (hi32 == -1)
-    inst_count = 2;
+  if (worst_case)  return 7;
+  intptr_t iaddr = (intptr_t) a;
+  int msb32 = (int) (iaddr >> 32);
+  int lsb32 = (int) (iaddr);
+  int count;
+  if (msb32 == 0 && lsb32 >= 0)
+    count = 1;
+  else if (msb32 == -1)
+    count = 2;
   else {
-    inst_count = 2;
-    if ( hi32 & 0x3ff )
-      inst_count++;
-    if ( lo32 & 0xFFFFFC00 ) {
-      if( (lo32 >> 20) & 0xfff ) inst_count += 2;
-      if( (lo32 >> 10) & 0x3ff ) inst_count += 2;
+    count = 2;
+    if (msb32 & 0x3ff)
+      count++;
+    if (lsb32 & 0xFFFFFC00 ) {
+      if ((lsb32 >> 20) & 0xfff)  count += 2;
+      if ((lsb32 >> 10) & 0x3ff)  count += 2;
     }
   }
-  return BytesPerInstWord * inst_count;
+  return count;
 #else
-  return BytesPerInstWord;
+  return 1;
 #endif
 }
 
-int MacroAssembler::worst_case_size_of_set() {
-  return size_of_sethi(NULL, true) + 1;
+int MacroAssembler::worst_case_insts_for_set() {
+  return insts_for_sethi(NULL, true) + 1;
 }
 
 
+// Keep in sync with MacroAssembler::insts_for_internal_set
 void MacroAssembler::internal_set(const AddressLiteral& addrlit, Register d, bool ForceRelocatable) {
   intptr_t value = addrlit.value();
 
@@ -1379,6 +1381,23 @@
   }
 }
 
+// Keep in sync with MacroAssembler::internal_set
+int MacroAssembler::insts_for_internal_set(intptr_t value) {
+  // can optimize
+  if (-4096 <= value && value <= 4095) {
+    return 1;
+  }
+  if (inv_hi22(hi22(value)) == value) {
+    return insts_for_sethi((address) value);
+  }
+  int count = insts_for_sethi((address) value);
+  AddressLiteral al(value);
+  if (al.low10() != 0) {
+    count++;
+  }
+  return count;
+}
+
 void MacroAssembler::set(const AddressLiteral& al, Register d) {
   internal_set(al, d, false);
 }
@@ -1443,11 +1462,11 @@
   }
 }
 
-int MacroAssembler::size_of_set64(jlong value) {
+int MacroAssembler::insts_for_set64(jlong value) {
   v9_dep();
 
-  int hi = (int)(value >> 32);
-  int lo = (int)(value & ~0);
+  int hi = (int) (value >> 32);
+  int lo = (int) (value & ~0);
   int count = 0;
 
   // (Matcher::isSimpleConstant64 knows about the following optimizations.)
@@ -4083,11 +4102,15 @@
   store_klass(t2, top);
   verify_oop(top);
 
+  ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t1);
+  sub(top, t1, t1); // size of tlab's allocated portion
+  incr_allocated_bytes(t1, t2, t3);
+
   // refill the tlab with an eden allocation
   bind(do_refill);
   ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t1);
   sll_ptr(t1, LogHeapWordSize, t1);
-  // add object_size ??
+  // allocate new tlab, address returned in top
   eden_allocate(top, t1, 0, t2, t3, slow_case);
 
   st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset()));
@@ -4115,6 +4138,17 @@
   delayed()->nop();
 }
 
+void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes,
+                                          Register t1, Register t2) {
+  // Bump total bytes allocated by this thread
+  assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch
+  assert_different_registers(size_in_bytes.register_or_noreg(), t1, t2);
+  // v8 support has gone the way of the dodo
+  ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1);
+  add(t1, ensure_simm13_or_reg(size_in_bytes, t2), t1);
+  stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset()));
+}
+
 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) {
   switch (cond) {
     // Note some conditions are synonyms for others
--- a/src/cpu/sparc/vm/assembler_sparc.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -823,15 +823,23 @@
   };
 
   // test if x is within signed immediate range for nbits
-  static bool is_simm(int x, int nbits) { return -( 1 << nbits-1 )  <= x   &&   x  <  ( 1 << nbits-1 ); }
+  static bool is_simm(intptr_t x, int nbits) { return -( intptr_t(1) << nbits-1 )  <= x   &&   x  <  ( intptr_t(1) << nbits-1 ); }
 
   // test if -4096 <= x <= 4095
-  static bool is_simm13(int x) { return is_simm(x, 13); }
+  static bool is_simm13(intptr_t x) { return is_simm(x, 13); }
+
+  static bool is_in_wdisp_range(address a, address b, int nbits) {
+    intptr_t d = intptr_t(b) - intptr_t(a);
+    return is_simm(d, nbits + 2);
+  }
 
   // test if label is in simm16 range in words (wdisp16).
   bool is_in_wdisp16_range(Label& L) {
-    intptr_t d = intptr_t(pc()) - intptr_t(target(L));
-    return is_simm(d, 18);
+    return is_in_wdisp_range(target(L), pc(), 16);
+  }
+  // test if the distance between two addresses fits in simm30 range in words
+  static bool is_in_wdisp30_range(address a, address b) {
+    return is_in_wdisp_range(a, b, 30);
   }
 
   enum ASIs { // page 72, v9
@@ -1843,6 +1851,8 @@
   inline void jmp( Register s1, Register s2 );
   inline void jmp( Register s1, int simm13a, RelocationHolder const& rspec = RelocationHolder() );
 
+  // Check if the call target is out of wdisp30 range (relative to the code cache)
+  static inline bool is_far_target(address d);
   inline void call( address d,  relocInfo::relocType rt = relocInfo::runtime_call_type );
   inline void call( Label& L,   relocInfo::relocType rt = relocInfo::runtime_call_type );
   inline void callr( Register s1, Register s2 );
@@ -1884,23 +1894,24 @@
   void sethi(const AddressLiteral& addrlit, Register d);
   void patchable_sethi(const AddressLiteral& addrlit, Register d);
 
-  // compute the size of a sethi/set
-  static int  size_of_sethi( address a, bool worst_case = false );
-  static int  worst_case_size_of_set();
+  // compute the number of instructions for a sethi/set
+  static int  insts_for_sethi( address a, bool worst_case = false );
+  static int  worst_case_insts_for_set();
 
   // set may be either setsw or setuw (high 32 bits may be zero or sign)
 private:
   void internal_set(const AddressLiteral& al, Register d, bool ForceRelocatable);
+  static int insts_for_internal_set(intptr_t value);
 public:
   void set(const AddressLiteral& addrlit, Register d);
   void set(intptr_t value, Register d);
   void set(address addr, Register d, RelocationHolder const& rspec);
+  static int insts_for_set(intptr_t value) { return insts_for_internal_set(value); }
+
   void patchable_set(const AddressLiteral& addrlit, Register d);
   void patchable_set(intptr_t value, Register d);
   void set64(jlong value, Register d, Register tmp);
-
-  // Compute size of set64.
-  static int size_of_set64(jlong value);
+  static int insts_for_set64(jlong value);
 
   // sign-extend 32 to 64
   inline void signx( Register s, Register d ) { sra( s, G0, d); }
@@ -2388,6 +2399,8 @@
     Label&   slow_case                 // continuation point if fast allocation fails
   );
   void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
+  void incr_allocated_bytes(RegisterOrConstant size_in_bytes,
+                            Register t1, Register t2);
 
   // interface method calling
   void lookup_interface_method(Register recv_klass,
--- a/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/assembler_sparc.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -588,10 +588,13 @@
 inline void MacroAssembler::jmp( Register s1, Register s2 ) { jmpl( s1, s2, G0 ); }
 inline void MacroAssembler::jmp( Register s1, int simm13a, RelocationHolder const& rspec ) { jmpl( s1, simm13a, G0, rspec); }
 
+inline bool MacroAssembler::is_far_target(address d) {
+  return !is_in_wdisp30_range(d, CodeCache::low_bound()) || !is_in_wdisp30_range(d, CodeCache::high_bound());
+}
+
 // Call with a check to see if we need to deal with the added
 // expense of relocation and if we overflow the displacement
-// of the quick call instruction./
-// Check to see if we have to deal with relocations
+// of the quick call instruction.
 inline void MacroAssembler::call( address d, relocInfo::relocType rt ) {
 #ifdef _LP64
   intptr_t disp;
@@ -603,14 +606,12 @@
 
   // Is this address within range of the call instruction?
   // If not, use the expensive instruction sequence
-  disp = (intptr_t)d - (intptr_t)pc();
-  if ( disp != (intptr_t)(int32_t)disp ) {
+  if (is_far_target(d)) {
     relocate(rt);
     AddressLiteral dest(d);
     jumpl_to(dest, O7, O7);
-  }
-  else {
-    Assembler::call( d, rt );
+  } else {
+    Assembler::call(d, rt);
   }
 #else
   Assembler::call( d, rt );
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,27 +129,6 @@
 }
 
 
-// Implementation of ArrayStoreExceptionStub
-
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  __ bind(_entry);
-  __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type);
-  __ delayed()->nop();
-  ce->add_call_info_here(_info);
-  ce->verify_oop_map(_info);
-#ifdef ASSERT
-  __ should_not_reach_here();
-#endif
-}
-
-
-
-
 // Implementation of NewInstanceStub
 
 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1705,8 +1705,7 @@
 }
 
 
-void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result) {
-
+void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {
   Assembler::Condition acond;
   switch (condition) {
     case lir_cond_equal:        acond = Assembler::equal;        break;
@@ -1737,7 +1736,12 @@
     ShouldNotReachHere();
   }
   Label skip;
-  __ br(acond, false, Assembler::pt, skip);
+#ifdef _LP64
+    if  (type == T_INT) {
+      __ br(acond, false, Assembler::pt, skip);
+    } else
+#endif
+      __ brx(acond, false, Assembler::pt, skip); // checks icc on 32bit and xcc on 64bit
   if (opr1->is_constant() && opr1->type() == T_INT) {
     Register dest = result->as_register();
     if (Assembler::is_simm13(opr1->as_jint())) {
@@ -2354,6 +2358,8 @@
          op->tmp3()->as_register()  == G4 &&
          op->tmp4()->as_register()  == O1 &&
          op->klass()->as_register() == G5, "must be");
+
+  LP64_ONLY( __ signx(op->len()->as_register()); )
   if (UseSlowPath ||
       (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
       (!UseFastNewTypeArray   && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
@@ -2688,6 +2694,11 @@
 #ifdef _LP64
     __ mov(cmp_value_lo, t1);
     __ mov(new_value_lo, t2);
+    // perform the compare and swap operation
+    __ casx(addr, t1, t2);
+    // generate condition code - if the swap succeeded, t2 ("new value" reg) was
+    // overwritten with the original value in "addr" and will be equal to t1.
+    __ cmp(t1, t2);
 #else
     // move high and low halves of long values into single registers
     __ sllx(cmp_value_hi, 32, t1);         // shift high half into temp reg
@@ -2696,13 +2707,15 @@
     __ sllx(new_value_hi, 32, t2);
     __ srl(new_value_lo, 0, new_value_lo);
     __ or3(t2, new_value_lo, t2);          // t2 holds 64-bit value to swap
-#endif
     // perform the compare and swap operation
     __ casx(addr, t1, t2);
     // generate condition code - if the swap succeeded, t2 ("new value" reg) was
     // overwritten with the original value in "addr" and will be equal to t1.
-    __ cmp(t1, t2);
-
+    // Produce icc flag for 32bit.
+    __ sub(t1, t2, t2);
+    __ srlx(t2, 32, t1);
+    __ orcc(t2, t1, G0);
+#endif
   } else if (op->code() == lir_cas_int || op->code() == lir_cas_obj) {
     Register addr = op->addr()->as_pointer_register();
     Register cmp_value = op->cmp_value()->as_register();
--- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -662,7 +662,7 @@
 
   // generate conditional move of boolean result
   LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
+  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
 }
 
 
@@ -699,10 +699,10 @@
   else {
     ShouldNotReachHere();
   }
-
   // generate conditional move of boolean result
   LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
+  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
+           result, as_BasicType(type));
   if (type == objectType) {  // Write-barrier needed for Object fields.
     // Precise card mark since could either be object or array
     post_barrier(addr, val.result());
--- a/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -166,14 +166,17 @@
   Register obj,                        // result: pointer to object after successful allocation
   Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
   int      con_size_in_bytes,          // object size in bytes if   known at compile time
-  Register t1,                         // temp register
+  Register t1,                         // temp register, must be global register for incr_allocated_bytes
   Register t2,                         // temp register
   Label&   slow_case                   // continuation point if fast allocation fails
 ) {
+  RegisterOrConstant size_in_bytes = var_size_in_bytes->is_valid()
+    ? RegisterOrConstant(var_size_in_bytes) : RegisterOrConstant(con_size_in_bytes);
   if (UseTLAB) {
     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
   } else {
     eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
+    incr_allocated_bytes(size_in_bytes, t1, t2);
   }
 }
 
@@ -214,7 +217,7 @@
 void C1_MacroAssembler::allocate_object(
   Register obj,                        // result: pointer to object after successful allocation
   Register t1,                         // temp register
-  Register t2,                         // temp register
+  Register t2,                         // temp register, must be a global register for try_allocate
   Register t3,                         // temp register
   int      hdr_size,                   // object header size in words
   int      obj_size,                   // object size in words
--- a/src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_MacroAssembler_sparc.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -343,9 +343,10 @@
   // returned.
 
   restore_live_registers(sasm);
-  __ restore();
-  __ br(Assembler::always, false, Assembler::pt, deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
-  __ delayed()->nop();
+
+  AddressLiteral dest(deopt_blob->unpack_with_reexecution());
+  __ jump_to(dest, O0);
+  __ delayed()->restore();
 
   __ bind(no_deopt);
   restore_live_registers(sasm);
@@ -448,7 +449,9 @@
 
           // get the instance size
           __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
+
           __ tlab_allocate(O0_obj, G1_obj_size, 0, G3_t1, slow_path);
+
           __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
           __ verify_oop(O0_obj);
           __ mov(O0, I0);
@@ -459,6 +462,8 @@
           // get the instance size
           __ ld(G5_klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes(), G1_obj_size);
           __ eden_allocate(O0_obj, G1_obj_size, 0, G3_t1, G4_t2, slow_path);
+          __ incr_allocated_bytes(G1_obj_size, G3_t1, G4_t2);
+
           __ initialize_object(O0_obj, G5_klass, G1_obj_size, 0, G3_t1, G4_t2);
           __ verify_oop(O0_obj);
           __ mov(O0, I0);
@@ -573,6 +578,7 @@
           __ and3(G1_arr_size, ~MinObjAlignmentInBytesMask, G1_arr_size);
 
           __ eden_allocate(O0_obj, G1_arr_size, 0, G3_t1, O1_t2, slow_path);  // preserves G1_arr_size
+          __ incr_allocated_bytes(G1_arr_size, G3_t1, O1_t2);
 
           __ initialize_header(O0_obj, G5_klass, G4_length, G3_t1, O1_t2);
           __ ldub(klass_lh, G3_t1, klass_lh_header_size_offset);
@@ -704,7 +710,7 @@
     case throw_array_store_exception_id:
       {
         __ set_info("throw_array_store_exception", dont_gc_arguments);
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1295,16 +1295,13 @@
 // Get the method data pointer from the methodOop and set the
 // specified register to its value.
 
-void InterpreterMacroAssembler::set_method_data_pointer_offset(Register Roff) {
+void InterpreterMacroAssembler::set_method_data_pointer() {
   assert(ProfileInterpreter, "must be profiling interpreter");
   Label get_continue;
 
   ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr);
   test_method_data_pointer(get_continue);
   add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr);
-  if (Roff != noreg)
-    // Roff contains a method data index ("mdi").  It defaults to zero.
-    add(ImethodDataPtr, Roff, ImethodDataPtr);
   bind(get_continue);
 }
 
@@ -1315,10 +1312,11 @@
   Label zero_continue;
 
   // Test MDO to avoid the call if it is NULL.
-  ld_ptr(Lmethod, methodOopDesc::method_data_offset(), ImethodDataPtr);
+  ld_ptr(Lmethod, in_bytes(methodOopDesc::method_data_offset()), ImethodDataPtr);
   test_method_data_pointer(zero_continue);
   call_VM_leaf(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), Lmethod, Lbcp);
-  set_method_data_pointer_offset(O0);
+  add(ImethodDataPtr, in_bytes(methodDataOopDesc::data_offset()), ImethodDataPtr);
+  add(ImethodDataPtr, O0, ImethodDataPtr);
   bind(zero_continue);
 }
 
@@ -1369,7 +1367,6 @@
 }
 
 void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count,
-                                                                Register cur_bcp,
                                                                 Register Rtmp,
                                                                 Label &profile_continue) {
   assert(ProfileInterpreter, "must be profiling interpreter");
@@ -1400,8 +1397,8 @@
   delayed()->nop();
 
   // Build it now.
-  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), cur_bcp);
-  set_method_data_pointer_offset(O0);
+  call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
+  set_method_data_pointer_for_bcp();
   ba(false, profile_continue);
   delayed()->nop();
   bind(done);
--- a/src/cpu/sparc/vm/interp_masm_sparc.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/interp_masm_sparc.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -269,12 +269,11 @@
 
 #ifndef CC_INTERP
   // Interpreter profiling operations
-  void set_method_data_pointer() { set_method_data_pointer_offset(noreg); }
+  void set_method_data_pointer();
   void set_method_data_pointer_for_bcp();
-  void set_method_data_pointer_offset(Register mdi_reg);
   void test_method_data_pointer(Label& zero_continue);
   void verify_method_data_pointer();
-  void test_invocation_counter_for_mdp(Register invocation_count, Register cur_bcp, Register Rtmp, Label &profile_continue);
+  void test_invocation_counter_for_mdp(Register invocation_count, Register Rtmp, Label &profile_continue);
 
   void set_mdp_data_at(int constant, Register value);
   void increment_mdp_data_at(Address counter, Register bumped_count,
--- a/src/cpu/sparc/vm/jni_sparc.h	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/jni_sparc.h	Tue Mar 01 15:05:39 2011 +0000
@@ -23,8 +23,13 @@
  * questions.
  */
 
-#define JNIEXPORT
-#define JNIIMPORT
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+  #define JNIEXPORT     __attribute__((visibility("default")))
+  #define JNIIMPORT     __attribute__((visibility("default")))
+#else
+  #define JNIEXPORT
+  #define JNIIMPORT
+#endif
 #define JNICALL
 
 typedef int jint;
--- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -402,11 +402,16 @@
   // - G3: receiver method handle
   // - O5_savedSP: sender SP (must preserve)
 
-  Register O0_argslot = O0;
-  Register O1_scratch = O1;
-  Register O2_scratch = O2;
-  Register O3_scratch = O3;
-  Register G5_index   = G5;
+  const Register O0_argslot = O0;
+  const Register O1_scratch = O1;
+  const Register O2_scratch = O2;
+  const Register O3_scratch = O3;
+  const Register G5_index   = G5;
+
+  // Argument registers for _raise_exception.
+  const Register O0_code     = O0;
+  const Register O1_actual   = O1;
+  const Register O2_required = O2;
 
   guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
 
@@ -439,48 +444,37 @@
   case _raise_exception:
     {
       // Not a real MH entry, but rather shared code for raising an
-      // exception.  Extra local arguments are passed in scratch
-      // registers, as required type in O3, failing object (or NULL)
-      // in O2, failing bytecode type in O1.
+      // exception.  Since we use a C2I adapter to set up the
+      // interpreter state, arguments are expected in compiler
+      // argument registers.
+      assert(raise_exception_method(), "must be set");
+      address c2i_entry = raise_exception_method()->get_c2i_entry();
+      assert(c2i_entry, "method must be linked");
 
       __ mov(O5_savedSP, SP);  // Cut the stack back to where the caller started.
 
-      // Push arguments as if coming from the interpreter.
-      Register O0_scratch = O0_argslot;
-      int stackElementSize = Interpreter::stackElementSize;
-
-      // Make space on the stack for the arguments and set Gargs
-      // correctly.
-      __ sub(SP, 4*stackElementSize, SP);  // Keep stack aligned.
-      __ add(SP, (frame::varargs_offset)*wordSize - 1*Interpreter::stackElementSize + STACK_BIAS + BytesPerWord, Gargs);
-
-      // void raiseException(int code, Object actual, Object required)
-      __ st(    O1_scratch, Address(Gargs, 2*stackElementSize));  // code
-      __ st_ptr(O2_scratch, Address(Gargs, 1*stackElementSize));  // actual
-      __ st_ptr(O3_scratch, Address(Gargs, 0*stackElementSize));  // required
-
-      Label no_method;
+      Label L_no_method;
       // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
       __ set(AddressLiteral((address) &_raise_exception_method), G5_method);
       __ ld_ptr(Address(G5_method, 0), G5_method);
       __ tst(G5_method);
-      __ brx(Assembler::zero, false, Assembler::pn, no_method);
+      __ brx(Assembler::zero, false, Assembler::pn, L_no_method);
       __ delayed()->nop();
 
-      int jobject_oop_offset = 0;
+      const int jobject_oop_offset = 0;
       __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method);
       __ tst(G5_method);
-      __ brx(Assembler::zero, false, Assembler::pn, no_method);
+      __ brx(Assembler::zero, false, Assembler::pn, L_no_method);
       __ delayed()->nop();
 
       __ verify_oop(G5_method);
-      __ jump_indirect_to(G5_method_fie, O1_scratch);
+      __ jump_to(AddressLiteral(c2i_entry), O3_scratch);
       __ delayed()->nop();
 
       // If we get here, the Java runtime did not do its job of creating the exception.
       // Do something that is at least causes a valid throw from the interpreter.
-      __ bind(no_method);
-      __ unimplemented("_raise_exception no method");
+      __ bind(L_no_method);
+      __ unimplemented("call throw_WrongMethodType_entry");
     }
     break;
 
@@ -570,10 +564,10 @@
       // Throw an exception.
       // For historical reasons, it will be IncompatibleClassChangeError.
       __ unimplemented("not tested yet");
-      __ ld_ptr(Address(O1_intf, java_mirror_offset), O3_scratch);  // required interface
-      __ mov(O0_klass, O2_scratch);  // bad receiver
-      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot);
-      __ delayed()->mov(Bytecodes::_invokeinterface, O1_scratch);  // who is complaining?
+      __ ld_ptr(Address(O1_intf, java_mirror_offset), O2_required);  // required interface
+      __ mov(   O0_klass,                             O1_actual);    // bad receiver
+      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch);
+      __ delayed()->mov(Bytecodes::_invokeinterface,  O0_code);      // who is complaining?
     }
     break;
 
@@ -663,11 +657,10 @@
       __ check_klass_subtype(O1_scratch, G5_klass, O0_argslot, O2_scratch, done);
 
       // If we get here, the type check failed!
-      __ ldsw(G3_amh_vmargslot, O0_argslot);  // reload argslot field
-      __ load_heap_oop(G3_amh_argument, O3_scratch);  // required class
-      __ ld_ptr(vmarg, O2_scratch);  // bad object
-      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot);
-      __ delayed()->mov(Bytecodes::_checkcast, O1_scratch);  // who is complaining?
+      __ load_heap_oop(G3_amh_argument,        O2_required);  // required class
+      __ ld_ptr(       vmarg,                  O1_actual);    // bad object
+      __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch);
+      __ delayed()->mov(Bytecodes::_checkcast, O0_code);      // who is complaining?
 
       __ bind(done);
       // Get the new MH:
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -2541,7 +2541,7 @@
     in_sig_bt[i++] = bt;  // Collect remaining bits of signature
     out_sig_bt[total_c_args++] = bt;
     if( bt == T_OBJECT) {
-      symbolOop s = ss.as_symbol_or_null();
+      Symbol* s = ss.as_symbol_or_null();
       if (s == vmSymbols::java_lang_String()) {
         total_strings++;
         out_sig_bt[total_c_args-1] = T_ADDRESS;
--- a/src/cpu/sparc/vm/sparc.ad	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/sparc.ad	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -575,7 +575,11 @@
 
 int MachCallRuntimeNode::ret_addr_offset() {
 #ifdef _LP64
-  return NativeFarCall::instruction_size;  // farcall; delay slot
+  if (MacroAssembler::is_far_target(entry_point())) {
+    return NativeFarCall::instruction_size;
+  } else {
+    return NativeCall::instruction_size;
+  }
 #else
   return NativeCall::instruction_size;  // call; delay slot
 #endif
@@ -941,7 +945,7 @@
 #endif
 }
 
-void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false, bool force_far_call = false) {
+void emit_call_reloc(CodeBuffer &cbuf, intptr_t entry_point, relocInfo::relocType rtype, bool preserve_g2 = false) {
   // The method which records debug information at every safepoint
   // expects the call to be the first instruction in the snippet as
   // it creates a PcDesc structure which tracks the offset of a call
@@ -963,20 +967,7 @@
   int startpos = __ offset();
 #endif /* ASSERT */
 
-#ifdef _LP64
-  // Calls to the runtime or native may not be reachable from compiled code,
-  // so we generate the far call sequence on 64 bit sparc.
-  // This code sequence is relocatable to any address, even on LP64.
-  if ( force_far_call ) {
-    __ relocate(rtype);
-    AddressLiteral dest(entry_point);
-    __ jumpl_to(dest, O7, O7);
-  }
-  else
-#endif
-  {
-     __ call((address)entry_point, rtype);
-  }
+  __ call((address)entry_point, rtype);
 
   if (preserve_g2)   __ delayed()->mov(G2, L7);
   else __ delayed()->nop();
@@ -1086,9 +1077,9 @@
 uint MachConstantBaseNode::size(PhaseRegAlloc*) const {
   if (UseRDPCForConstantTableBase) {
     // This is really the worst case but generally it's only 1 instruction.
-    return 4 /*rdpc*/ + 4 /*sub*/ + MacroAssembler::worst_case_size_of_set();
+    return (1 /*rdpc*/ + 1 /*sub*/ + MacroAssembler::worst_case_insts_for_set()) * BytesPerInstWord;
   } else {
-    return MacroAssembler::worst_case_size_of_set();
+    return MacroAssembler::worst_case_insts_for_set() * BytesPerInstWord;
   }
 }
 
@@ -1240,7 +1231,7 @@
 
 int MachEpilogNode::safepoint_offset() const {
   assert( do_polling(), "no return for this epilog node");
-  return MacroAssembler::size_of_sethi(os::get_polling_page());
+  return MacroAssembler::insts_for_sethi(os::get_polling_page()) * BytesPerInstWord;
 }
 
 //=============================================================================
@@ -2507,7 +2498,7 @@
     // CALL directly to the runtime
     // The user of this is responsible for ensuring that R_L7 is empty (killed).
     emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type,
-                    /*preserve_g2=*/true, /*force far call*/true);
+                    /*preserve_g2=*/true);
   %}
 
   enc_class preserve_SP %{
@@ -3553,9 +3544,10 @@
   interface(CONST_INTER);
 %}
 
-// Pointer Immediate: 32 or 64-bit
+#ifdef _LP64
+// Pointer Immediate: 64-bit
 operand immP_set() %{
-  predicate(!VM_Version::is_niagara1_plus());
+  predicate(!VM_Version::is_niagara_plus());
   match(ConP);
 
   op_cost(5);
@@ -3564,10 +3556,10 @@
   interface(CONST_INTER);
 %}
 
-// Pointer Immediate: 32 or 64-bit
+// Pointer Immediate: 64-bit
 // From Niagara2 processors on a load should be better than materializing.
 operand immP_load() %{
-  predicate(VM_Version::is_niagara1_plus());
+  predicate(VM_Version::is_niagara_plus() && (n->bottom_type()->isa_oop_ptr() || (MacroAssembler::insts_for_set(n->get_ptr()) > 3)));
   match(ConP);
 
   op_cost(5);
@@ -3576,6 +3568,18 @@
   interface(CONST_INTER);
 %}
 
+// Pointer Immediate: 64-bit
+operand immP_no_oop_cheap() %{
+  predicate(VM_Version::is_niagara_plus() && !n->bottom_type()->isa_oop_ptr() && (MacroAssembler::insts_for_set(n->get_ptr()) <= 3));
+  match(ConP);
+
+  op_cost(5);
+  // formats are generated automatically for constants and base registers
+  format %{ %}
+  interface(CONST_INTER);
+%}
+#endif
+
 operand immP13() %{
   predicate((-4096 < n->get_ptr()) && (n->get_ptr() <= 4095));
   match(ConP);
@@ -3673,7 +3677,7 @@
 
 // Long Immediate: cheap (materialize in <= 3 instructions)
 operand immL_cheap() %{
-  predicate(!VM_Version::is_niagara1_plus() || MacroAssembler::size_of_set64(n->get_long()) <= 3);
+  predicate(!VM_Version::is_niagara_plus() || MacroAssembler::insts_for_set64(n->get_long()) <= 3);
   match(ConL);
   op_cost(0);
 
@@ -3683,7 +3687,7 @@
 
 // Long Immediate: expensive (materialize in > 3 instructions)
 operand immL_expensive() %{
-  predicate(VM_Version::is_niagara1_plus() && MacroAssembler::size_of_set64(n->get_long()) > 3);
+  predicate(VM_Version::is_niagara_plus() && MacroAssembler::insts_for_set64(n->get_long()) > 3);
   match(ConL);
   op_cost(0);
 
@@ -6094,8 +6098,18 @@
   ins_cost(MEMORY_REF_COST);
   format %{ "LD     [$constanttablebase + $constantoffset],$dst\t! load from constant table: ptr=$con" %}
   ins_encode %{
-      RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register);
-     __ ld_ptr($constanttablebase, con_offset, $dst$$Register);
+    RegisterOrConstant con_offset = __ ensure_simm13_or_reg($constantoffset($con), $dst$$Register);
+    __ ld_ptr($constanttablebase, con_offset, $dst$$Register);
+  %}
+  ins_pipe(loadConP);
+%}
+
+instruct loadConP_no_oop_cheap(iRegP dst, immP_no_oop_cheap con) %{
+  match(Set dst con);
+  ins_cost(DEFAULT_COST * 3/2);
+  format %{ "SET    $con,$dst\t! non-oop ptr" %}
+  ins_encode %{
+    __ set($con$$constant, $dst$$Register);
   %}
   ins_pipe(loadConP);
 %}
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1364,15 +1364,8 @@
       // We have decided to profile this method in the interpreter
       __ bind(profile_method);
 
-      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), Lbcp, true);
-
-#ifdef ASSERT
-      __ tst(O0);
-      __ breakpoint_trap(Assembler::notEqual);
-#endif
-
-      __ set_method_data_pointer();
-
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
+      __ set_method_data_pointer_for_bcp();
       __ ba(false, profile_method_continue);
       __ delayed()->nop();
     }
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1689,7 +1689,7 @@
       const Register G4_invoke_ctr = G4;
       __ increment_backedge_counter(G4_invoke_ctr, G1_scratch);
       if (ProfileInterpreter) {
-        __ test_invocation_counter_for_mdp(G4_invoke_ctr, Lbcp, G3_scratch, Lforward);
+        __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward);
         if (UseOnStackReplacement) {
           __ test_backedge_count_for_osr(O2_bumped_count, O0_cur_bcp, G3_scratch);
         }
@@ -3393,21 +3393,21 @@
     __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
 
     if (allow_shared_alloc) {
-    // Check if tlab should be discarded (refill_waste_limit >= free)
-    __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
-    __ sub(RendValue, RoldTopValue, RfreeValue);
+      // Check if tlab should be discarded (refill_waste_limit >= free)
+      __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
+      __ sub(RendValue, RoldTopValue, RfreeValue);
 #ifdef _LP64
-    __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
+      __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
 #else
-    __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
+      __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
 #endif
-    __ cmp(RtlabWasteLimitValue, RfreeValue);
-    __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
-    __ delayed()->nop();
-
-    // increment waste limit to prevent getting stuck on this slow path
-    __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
-    __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
+      __ cmp(RtlabWasteLimitValue, RfreeValue);
+      __ brx(Assembler::greaterEqualUnsigned, false, Assembler::pt, slow_case); // tlab waste is small
+      __ delayed()->nop();
+
+      // increment waste limit to prevent getting stuck on this slow path
+      __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
+      __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
     } else {
       // No allocation in the shared eden.
       __ br(Assembler::always, false, Assembler::pt, slow_case);
@@ -3445,6 +3445,10 @@
     __ cmp(RoldTopValue, RnewTopValue);
     __ brx(Assembler::notEqual, false, Assembler::pn, retry);
     __ delayed()->nop();
+
+    // bump total bytes allocated by this thread
+    // RoldTopValue and RtopAddr are dead, so can use G1 and G3
+    __ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
   }
 
   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
--- a/src/cpu/sparc/vm/vm_version_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/vm_version_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -38,12 +38,6 @@
 int VM_Version::_features = VM_Version::unknown_m;
 const char* VM_Version::_features_str = "";
 
-bool VM_Version::is_niagara1_plus() {
-  // This is a placeholder until the real test is determined.
-  return is_niagara1() &&
-    (os::processor_count() > maximum_niagara1_processor_count());
-}
-
 void VM_Version::initialize() {
   _features = determine_features();
   PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
@@ -69,11 +63,21 @@
 
   _supports_cx8               = has_v9();
 
-  if (is_niagara1()) {
+  if (is_niagara()) {
     // Indirect branch is the same cost as direct
     if (FLAG_IS_DEFAULT(UseInlineCaches)) {
       FLAG_SET_DEFAULT(UseInlineCaches, false);
     }
+    // Align loops on a single instruction boundary.
+    if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
+      FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
+    }
+    // When using CMS, we cannot use memset() in BOT updates because
+    // the sun4v/CMT version in libc_psr uses BIS which exposes
+    // "phantom zeros" to concurrent readers. See 6948537.
+    if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
+      FLAG_SET_DEFAULT(UseMemSetInBOT, false);
+    }
 #ifdef _LP64
     // 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.
@@ -89,7 +93,7 @@
     if (FLAG_IS_DEFAULT(InteriorEntryAlignment)) {
       FLAG_SET_DEFAULT(InteriorEntryAlignment, 4);
     }
-    if (is_niagara1_plus()) {
+    if (is_niagara_plus()) {
       if (has_blk_init() && AllocatePrefetchStyle > 0 &&
           FLAG_IS_DEFAULT(AllocatePrefetchStyle)) {
         // Use BIS instruction for allocation prefetch.
@@ -105,15 +109,6 @@
       }
     }
 #endif
-    if (FLAG_IS_DEFAULT(OptoLoopAlignment)) {
-      FLAG_SET_DEFAULT(OptoLoopAlignment, 4);
-    }
-    // When using CMS, we cannot use memset() in BOT updates because
-    // the sun4v/CMT version in libc_psr uses BIS which exposes
-    // "phantom zeros" to concurrent readers. See 6948537.
-    if (FLAG_IS_DEFAULT(UseMemSetInBOT) && UseConcMarkSweepGC) {
-      FLAG_SET_DEFAULT(UseMemSetInBOT, false);
-    }
   }
 
   // Use hardware population count instruction if available.
@@ -129,17 +124,18 @@
 #endif
 
   char buf[512];
-  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
+  jio_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                (has_v8() ? ", has_v8" : ""),
                (has_v9() ? ", has_v9" : ""),
                (has_hardware_popc() ? ", popc" : ""),
                (has_vis1() ? ", has_vis1" : ""),
                (has_vis2() ? ", has_vis2" : ""),
+               (has_vis3() ? ", has_vis3" : ""),
                (has_blk_init() ? ", has_blk_init" : ""),
                (is_ultra3() ? ", is_ultra3" : ""),
                (is_sun4v() ? ", is_sun4v" : ""),
-               (is_niagara1() ? ", is_niagara1" : ""),
-               (is_niagara1_plus() ? ", is_niagara1_plus" : ""),
+               (is_niagara() ? ", is_niagara" : ""),
+               (is_niagara_plus() ? ", is_niagara_plus" : ""),
                (is_sparc64() ? ", is_sparc64" : ""),
                (!has_hardware_mul32() ? ", no-mul32" : ""),
                (!has_hardware_div32() ? ", no-div32" : ""),
@@ -190,17 +186,18 @@
     warning("Cannot recognize SPARC version. Default to V9");
   }
 
-  if (UseNiagaraInstrs) {
-    if (is_niagara1(features)) {
+  assert(is_T_family(features) == is_niagara(features), "Niagara should be T series");
+  if (UseNiagaraInstrs) { // Force code generation for Niagara
+    if (is_T_family(features)) {
       // Happy to accomodate...
     } else {
       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Niagara");)
-      features = niagara1_m;
+      features |= T_family_m;
     }
   } else {
-    if (is_niagara1(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
+    if (is_T_family(features) && !FLAG_IS_DEFAULT(UseNiagaraInstrs)) {
       NOT_PRODUCT(if (PrintMiscellaneous && Verbose) tty->print_cr("Version is Forced-Not-Niagara");)
-      features &= ~niagara1_unique_m;
+      features &= ~(T_family_m | T1_model_m);
     } else {
       // Happy to accomodate...
     }
@@ -222,7 +219,7 @@
 
 unsigned int VM_Version::calc_parallel_worker_threads() {
   unsigned int result;
-  if (is_niagara1_plus()) {
+  if (is_niagara_plus()) {
     result = nof_parallel_worker_threads(5, 16, 8);
   } else {
     result = nof_parallel_worker_threads(5, 8, 8);
--- a/src/cpu/sparc/vm/vm_version_sparc.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/sparc/vm/vm_version_sparc.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -41,7 +41,12 @@
     vis2_instructions  = 7,
     sun4v_instructions = 8,
     blk_init_instructions = 9,
-    fmaf_instructions  = 10
+    fmaf_instructions  = 10,
+    fmau_instructions  = 11,
+    vis3_instructions  = 12,
+    sparc64_family     = 13,
+    T_family           = 14,
+    T1_model           = 15
   };
 
   enum Feature_Flag_Set {
@@ -59,6 +64,11 @@
     sun4v_m             = 1 << sun4v_instructions,
     blk_init_instructions_m = 1 << blk_init_instructions,
     fmaf_instructions_m = 1 << fmaf_instructions,
+    fmau_instructions_m = 1 << fmau_instructions,
+    vis3_instructions_m = 1 << vis3_instructions,
+    sparc64_family_m    = 1 << sparc64_family,
+    T_family_m          = 1 << T_family,
+    T1_model_m          = 1 << T1_model,
 
     generic_v8_m        = v8_instructions_m | hardware_mul32_m | hardware_div32_m | hardware_fsmuld_m,
     generic_v9_m        = generic_v8_m | v9_instructions_m,
@@ -76,8 +86,13 @@
   static int  determine_features();
   static int  platform_features(int features);
 
-  static bool is_niagara1(int features) { return (features & sun4v_m) != 0; }
-  static bool  is_sparc64(int features) { return (features & fmaf_instructions_m) != 0; }
+  // Returns true if the platform is in the niagara line (T series)
+  static bool is_T_family(int features) { return (features & T_family_m) != 0; }
+  static bool is_niagara() { return is_T_family(_features); }
+  DEBUG_ONLY( static bool is_niagara(int features)  { return (features & sun4v_m) != 0; } )
+
+  // Returns true if it is niagara1 (T1).
+  static bool is_T1_model(int features) { return is_T_family(features) && ((features & T1_model_m) != 0); }
 
   static int maximum_niagara1_processor_count() { return 32; }
 
@@ -94,6 +109,7 @@
   static bool has_hardware_popc()       { return (_features & hardware_popc_m) != 0; }
   static bool has_vis1()                { return (_features & vis1_instructions_m) != 0; }
   static bool has_vis2()                { return (_features & vis2_instructions_m) != 0; }
+  static bool has_vis3()                { return (_features & vis3_instructions_m) != 0; }
   static bool has_blk_init()            { return (_features & blk_init_instructions_m) != 0; }
 
   static bool supports_compare_and_exchange()
@@ -101,14 +117,14 @@
 
   static bool is_ultra3()               { return (_features & ultra3_m) == ultra3_m; }
   static bool is_sun4v()                { return (_features & sun4v_m) != 0; }
-  static bool is_niagara1()             { return is_niagara1(_features); }
-  // Returns true if the platform is in the niagara line and
-  // newer than the niagara1.
-  static bool is_niagara1_plus();
-  static bool is_sparc64()              { return is_sparc64(_features); }
+  // Returns true if the platform is in the niagara line (T series)
+  // and newer than the niagara1.
+  static bool is_niagara_plus()         { return is_T_family(_features) && !is_T1_model(_features); }
+  // Fujitsu SPARC64
+  static bool is_sparc64()              { return (_features & sparc64_family_m) != 0; }
 
-  static bool has_fast_fxtof()          { return has_v9() && !is_ultra3(); }
-  static bool has_fast_idiv()           { return is_niagara1_plus() || is_sparc64(); }
+  static bool has_fast_fxtof()          { return is_niagara() || is_sparc64() || has_v9() && !is_ultra3(); }
+  static bool has_fast_idiv()           { return is_niagara_plus() || is_sparc64(); }
 
   static const char* cpu_features()     { return _features_str; }
 
--- a/src/cpu/x86/vm/assembler_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/assembler_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -820,7 +820,20 @@
 }
 
 
-// Now the Assembler instruction (identical for 32/64 bits)
+// Now the Assembler instructions (identical for 32/64 bits)
+
+void Assembler::adcl(Address dst, int32_t imm32) {
+  InstructionMark im(this);
+  prefix(dst);
+  emit_arith_operand(0x81, rdx, dst, imm32);
+}
+
+void Assembler::adcl(Address dst, Register src) {
+  InstructionMark im(this);
+  prefix(dst, src);
+  emit_byte(0x11);
+  emit_operand(src, dst);
+}
 
 void Assembler::adcl(Register dst, int32_t imm32) {
   prefix(dst);
@@ -2195,9 +2208,7 @@
 void Assembler::orl(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefix(dst);
-  emit_byte(0x81);
-  emit_operand(rcx, dst, 4);
-  emit_long(imm32);
+  emit_arith_operand(0x81, rcx, dst, imm32);
 }
 
 void Assembler::orl(Register dst, int32_t imm32) {
@@ -2205,7 +2216,6 @@
   emit_arith(0x81, 0xC8, dst, imm32);
 }
 
-
 void Assembler::orl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
@@ -2213,7 +2223,6 @@
   emit_operand(dst, src);
 }
 
-
 void Assembler::orl(Register dst, Register src) {
   (void) prefix_and_encode(dst->encoding(), src->encoding());
   emit_arith(0x0B, 0xC0, dst, src);
@@ -2692,15 +2701,14 @@
 void Assembler::subl(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefix(dst);
-  if (is8bit(imm32)) {
-    emit_byte(0x83);
-    emit_operand(rbp, dst, 1);
-    emit_byte(imm32 & 0xFF);
-  } else {
-    emit_byte(0x81);
-    emit_operand(rbp, dst, 4);
-    emit_long(imm32);
-  }
+  emit_arith_operand(0x81, rbp, dst, imm32);
+}
+
+void Assembler::subl(Address dst, Register src) {
+  InstructionMark im(this);
+  prefix(dst, src);
+  emit_byte(0x29);
+  emit_operand(src, dst);
 }
 
 void Assembler::subl(Register dst, int32_t imm32) {
@@ -2708,13 +2716,6 @@
   emit_arith(0x81, 0xE8, dst, imm32);
 }
 
-void Assembler::subl(Address dst, Register src) {
-  InstructionMark im(this);
-  prefix(dst, src);
-  emit_byte(0x29);
-  emit_operand(src, dst);
-}
-
 void Assembler::subl(Register dst, Address src) {
   InstructionMark im(this);
   prefix(src, dst);
@@ -4333,6 +4334,7 @@
   emit_byte(0xD3);
   emit_byte(0xF8 | encode);
 }
+
 void Assembler::sbbq(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefixq(dst);
@@ -4392,15 +4394,14 @@
 void Assembler::subq(Address dst, int32_t imm32) {
   InstructionMark im(this);
   prefixq(dst);
-  if (is8bit(imm32)) {
-    emit_byte(0x83);
-    emit_operand(rbp, dst, 1);
-    emit_byte(imm32 & 0xFF);
-  } else {
-    emit_byte(0x81);
-    emit_operand(rbp, dst, 4);
-    emit_long(imm32);
-  }
+  emit_arith_operand(0x81, rbp, dst, imm32);
+}
+
+void Assembler::subq(Address dst, Register src) {
+  InstructionMark im(this);
+  prefixq(dst, src);
+  emit_byte(0x29);
+  emit_operand(src, dst);
 }
 
 void Assembler::subq(Register dst, int32_t imm32) {
@@ -4408,13 +4409,6 @@
   emit_arith(0x81, 0xE8, dst, imm32);
 }
 
-void Assembler::subq(Address dst, Register src) {
-  InstructionMark im(this);
-  prefixq(dst, src);
-  emit_byte(0x29);
-  emit_operand(src, dst);
-}
-
 void Assembler::subq(Register dst, Address src) {
   InstructionMark im(this);
   prefixq(src, dst);
@@ -7136,9 +7130,9 @@
 }
 
 // Preserves rbx, and rdx.
-void MacroAssembler::tlab_refill(Label& retry,
-                                 Label& try_eden,
-                                 Label& slow_case) {
+Register MacroAssembler::tlab_refill(Label& retry,
+                                     Label& try_eden,
+                                     Label& slow_case) {
   Register top = rax;
   Register t1  = rcx;
   Register t2  = rsi;
@@ -7185,7 +7179,7 @@
 
   // if tlab is currently allocated (top or end != null) then
   // fill [top, end + alignment_reserve) with array object
-  testptr (top, top);
+  testptr(top, top);
   jcc(Assembler::zero, do_refill);
 
   // set up the mark word
@@ -7197,16 +7191,20 @@
   movl(Address(top, arrayOopDesc::length_offset_in_bytes()), t1);
   // set klass to intArrayKlass
   // dubious reloc why not an oop reloc?
-  movptr(t1, ExternalAddress((address) Universe::intArrayKlassObj_addr()));
+  movptr(t1, ExternalAddress((address)Universe::intArrayKlassObj_addr()));
   // store klass last.  concurrent gcs assumes klass length is valid if
   // klass field is not null.
   store_klass(top, t1);
 
+  movptr(t1, top);
+  subptr(t1, Address(thread_reg, in_bytes(JavaThread::tlab_start_offset())));
+  incr_allocated_bytes(thread_reg, t1, 0);
+
   // refill the tlab with an eden allocation
   bind(do_refill);
   movptr(t1, Address(thread_reg, in_bytes(JavaThread::tlab_size_offset())));
   shlptr(t1, LogHeapWordSize);
-  // add object_size ??
+  // allocate new tlab, address returned in top
   eden_allocate(top, t1, 0, t2, slow_case);
 
   // Check that t1 was preserved in eden_allocate.
@@ -7234,6 +7232,34 @@
   movptr(Address(thread_reg, in_bytes(JavaThread::tlab_end_offset())), top);
   verify_tlab();
   jmp(retry);
+
+  return thread_reg; // for use by caller
+}
+
+void MacroAssembler::incr_allocated_bytes(Register thread,
+                                          Register var_size_in_bytes,
+                                          int con_size_in_bytes,
+                                          Register t1) {
+#ifdef _LP64
+  if (var_size_in_bytes->is_valid()) {
+    addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
+  } else {
+    addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
+  }
+#else
+  if (!thread->is_valid()) {
+    assert(t1->is_valid(), "need temp reg");
+    thread = t1;
+    get_thread(thread);
+  }
+
+  if (var_size_in_bytes->is_valid()) {
+    addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
+  } else {
+    addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
+  }
+  adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
+#endif
 }
 
 static const double     pi_4 =  0.7853981633974483;
--- a/src/cpu/x86/vm/assembler_x86.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/assembler_x86.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -674,12 +674,14 @@
   // Utilities
 
 #ifdef _LP64
- static bool is_simm(int64_t x, int nbits) { return -( CONST64(1) << (nbits-1) )  <= x   &&   x  <  ( CONST64(1) << (nbits-1) ); }
+ static bool is_simm(int64_t x, int nbits) { return -(CONST64(1) << (nbits-1)) <= x &&
+                                                    x < (CONST64(1) << (nbits-1)); }
  static bool is_simm32(int64_t x) { return x == (int64_t)(int32_t)x; }
 #else
- static bool is_simm(int32_t x, int nbits) { return -( 1 << (nbits-1) )  <= x   &&   x  <  ( 1 << (nbits-1) ); }
+ static bool is_simm(int32_t x, int nbits) { return -(1 << (nbits-1)) <= x &&
+                                                    x < (1 << (nbits-1)); }
  static bool is_simm32(int32_t x) { return true; }
-#endif // LP64
+#endif // _LP64
 
   // Generic instructions
   // Does 32bit or 64bit as needed for the platform. In some sense these
@@ -705,7 +707,6 @@
   void push(void* v);
   void pop(void* v);
 
-
   // These do register sized moves/scans
   void rep_mov();
   void rep_set();
@@ -716,6 +717,8 @@
 
   // Vanilla instructions in lexical order
 
+  void adcl(Address dst, int32_t imm32);
+  void adcl(Address dst, Register src);
   void adcl(Register dst, int32_t imm32);
   void adcl(Register dst, Address src);
   void adcl(Register dst, Register src);
@@ -724,7 +727,6 @@
   void adcq(Register dst, Address src);
   void adcq(Register dst, Register src);
 
-
   void addl(Address dst, int32_t imm32);
   void addl(Address dst, Register src);
   void addl(Register dst, int32_t imm32);
@@ -737,7 +739,6 @@
   void addq(Register dst, Address src);
   void addq(Register dst, Register src);
 
-
   void addr_nop_4();
   void addr_nop_5();
   void addr_nop_7();
@@ -759,7 +760,6 @@
   void andq(Register dst, Address src);
   void andq(Register dst, Register src);
 
-
   // Bitwise Logical AND of Packed Double-Precision Floating-Point Values
   void andpd(XMMRegister dst, Address src);
   void andpd(XMMRegister dst, XMMRegister src);
@@ -1151,7 +1151,7 @@
 #ifdef _LP64
   void movq(Register dst, Register src);
   void movq(Register dst, Address src);
-  void movq(Address dst, Register src);
+  void movq(Address  dst, Register src);
 #endif
 
   void movq(Address     dst, MMXRegister src );
@@ -1177,7 +1177,7 @@
   void movsbq(Register dst, Register src);
 
   // Move signed 32bit immediate to 64bit extending sign
-  void movslq(Address dst, int32_t imm64);
+  void movslq(Address  dst, int32_t imm64);
   void movslq(Register dst, int32_t imm64);
 
   void movslq(Register dst, Address src);
@@ -1857,7 +1857,10 @@
     Register t2,                       // temp register
     Label&   slow_case                 // continuation point if fast allocation fails
   );
-  void tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case);
+  Register tlab_refill(Label& retry_tlab, Label& try_eden, Label& slow_case); // returns TLS address
+  void incr_allocated_bytes(Register thread,
+                            Register var_size_in_bytes, int con_size_in_bytes,
+                            Register t1 = noreg);
 
   // interface method calling
   void lookup_interface_method(Register recv_klass,
@@ -2180,9 +2183,9 @@
   void divss(XMMRegister dst, Address src)        { Assembler::divss(dst, src); }
   void divss(XMMRegister dst, AddressLiteral src) { Assembler::divss(dst, as_Address(src)); }
 
-  void movsd(XMMRegister dst, XMMRegister src)    { Assembler::movsd(dst, src); }
-  void movsd(Address dst, XMMRegister src)        { Assembler::movsd(dst, src); }
-  void movsd(XMMRegister dst, Address src)        { Assembler::movsd(dst, src); }
+  void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); }
+  void movsd(Address dst, XMMRegister src)     { Assembler::movsd(dst, src); }
+  void movsd(XMMRegister dst, Address src)     { Assembler::movsd(dst, src); }
   void movsd(XMMRegister dst, AddressLiteral src) { Assembler::movsd(dst, as_Address(src)); }
 
   void mulsd(XMMRegister dst, XMMRegister src)    { Assembler::mulsd(dst, src); }
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -411,20 +411,6 @@
 }
 
 
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  assert(__ rsp_offset() == 0, "frame size should be fixed");
-  __ bind(_entry);
-  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_array_store_exception_id)));
-  ce->add_call_info_here(_info);
-  debug_only(__ should_not_reach_here());
-}
-
-
 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
   //---------------slow case: call to native-----------------
   __ bind(_entry);
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1641,12 +1641,14 @@
 }
 
 void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) {
+  Register len =  op->len()->as_register();
+  LP64_ONLY( __ movslq(len, len); )
+
   if (UseSlowPath ||
       (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) ||
       (!UseFastNewTypeArray   && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
     __ jmp(*op->stub()->entry());
   } else {
-    Register len =  op->len()->as_register();
     Register tmp1 = op->tmp1()->as_register();
     Register tmp2 = op->tmp2()->as_register();
     Register tmp3 = op->tmp3()->as_register();
@@ -2036,7 +2038,7 @@
   }
 }
 
-void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result) {
+void LIR_Assembler::cmove(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type) {
   Assembler::Condition acond, ncond;
   switch (condition) {
     case lir_cond_equal:        acond = Assembler::equal;        ncond = Assembler::notEqual;     break;
--- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -733,15 +733,15 @@
 
   // generate compare-and-swap; produces zero condition if swap occurs
   int value_offset = sun_misc_AtomicLongCSImpl::value_offset();
-  LIR_Opr addr = obj.result();
-  __ add(addr, LIR_OprFact::intConst(value_offset), addr);
+  LIR_Opr addr = new_pointer_register();
+  __ leal(LIR_OprFact::address(new LIR_Address(obj.result(), value_offset, T_LONG)), addr);
   LIR_Opr t1 = LIR_OprFact::illegalOpr;  // no temp needed
   LIR_Opr t2 = LIR_OprFact::illegalOpr;  // no temp needed
   __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2);
 
   // generate conditional move of boolean result
   LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
+  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result, T_LONG);
 }
 
 
@@ -810,7 +810,8 @@
 
   // generate conditional move of boolean result
   LIR_Opr result = rlock_result(x);
-  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0), result);
+  __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
+           result, as_BasicType(type));
   if (type == objectType) {   // Write-barrier needed for Object fields.
     // Seems to be precise
     post_barrier(addr, val.result());
--- a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -141,6 +141,7 @@
     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case);
   } else {
     eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
+    incr_allocated_bytes(noreg, var_size_in_bytes, con_size_in_bytes, t1);
   }
 }
 
@@ -234,7 +235,7 @@
 
 void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) {
   assert(obj == rax, "obj must be in rax, for cmpxchg");
-  assert(obj != t1 && obj != t2 && t1 != t2, "registers must be different"); // XXX really?
+  assert_different_registers(obj, t1, t2); // XXX really?
   assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
 
   try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case);
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -977,7 +977,6 @@
         // verify that that there is really a valid exception in rax,
         __ verify_not_null_oop(exception_oop);
 
-
         oop_maps = new OopMapSet();
         OopMap* oop_map = generate_oop_map(sasm, 1);
         generate_handle_exception(sasm, oop_maps, oop_map);
@@ -1037,13 +1036,16 @@
           // if we got here then the TLAB allocation failed, so try
           // refilling the TLAB or allocating directly from eden.
           Label retry_tlab, try_eden;
-          __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass)
+          const Register thread =
+            __ tlab_refill(retry_tlab, try_eden, slow_path); // does not destroy rdx (klass), returns rdi
 
           __ bind(retry_tlab);
 
           // get the instance size (size is postive so movl is fine for 64bit)
           __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
+
           __ tlab_allocate(obj, obj_size, 0, t1, t2, slow_path);
+
           __ initialize_object(obj, klass, obj_size, 0, t1, t2);
           __ verify_oop(obj);
           __ pop(rbx);
@@ -1053,7 +1055,10 @@
           __ bind(try_eden);
           // get the instance size (size is postive so movl is fine for 64bit)
           __ movl(obj_size, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
+
           __ eden_allocate(obj, obj_size, 0, t1, slow_path);
+          __ incr_allocated_bytes(thread, obj_size, 0);
+
           __ initialize_object(obj, klass, obj_size, 0, t1, t2);
           __ verify_oop(obj);
           __ pop(rbx);
@@ -1143,12 +1148,13 @@
           // if we got here then the TLAB allocation failed, so try
           // refilling the TLAB or allocating directly from eden.
           Label retry_tlab, try_eden;
-          __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves rbx, & rdx
+          const Register thread =
+            __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves rbx & rdx, returns rdi
 
           __ bind(retry_tlab);
 
           // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
-          // since size is postive movl does right thing on 64bit
+          // since size is positive movl does right thing on 64bit
           __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
           // since size is postive movl does right thing on 64bit
           __ movl(arr_size, length);
@@ -1175,7 +1181,7 @@
 
           __ bind(try_eden);
           // get the allocation size: round_up(hdr + length << (layout_helper & 0x1F))
-          // since size is postive movl does right thing on 64bit
+          // since size is positive movl does right thing on 64bit
           __ movl(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes()));
           // since size is postive movl does right thing on 64bit
           __ movl(arr_size, length);
@@ -1188,6 +1194,7 @@
           __ andptr(arr_size, ~MinObjAlignmentInBytesMask);
 
           __ eden_allocate(obj, arr_size, 0, t1, slow_path);  // preserves arr_size
+          __ incr_allocated_bytes(thread, arr_size, 0);
 
           __ initialize_header(obj, klass, length, t1, t2);
           __ movb(t1, Address(klass, klassOopDesc::header_size() * HeapWordSize + Klass::layout_helper_offset_in_bytes() + (Klass::_lh_header_size_shift / BitsPerByte)));
@@ -1330,7 +1337,7 @@
       { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
         // tos + 0: link
         //     + 1: return address
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/cpu/x86/vm/globals_x86.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/globals_x86.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -62,7 +62,7 @@
 // due to lack of optimization caused by C++ compiler bugs
 define_pd_global(intx, StackShadowPages, SOLARIS_ONLY(20) NOT_SOLARIS(6) DEBUG_ONLY(+2));
 #else
-define_pd_global(intx, StackShadowPages, 3 DEBUG_ONLY(+1));
+define_pd_global(intx, StackShadowPages, 3 DEBUG_ONLY(+5));
 #endif // AMD64
 
 define_pd_global(intx, PreInflateSpin,           10);
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -819,7 +819,7 @@
 // Set the method data pointer for the current bcp.
 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
   assert(ProfileInterpreter, "must be profiling interpreter");
-  Label zero_continue;
+  Label set_mdp;
   push(rax);
   push(rbx);
 
@@ -827,21 +827,17 @@
   // Test MDO to avoid the call if it is NULL.
   movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
   testptr(rax, rax);
-  jcc(Assembler::zero, zero_continue);
-
+  jcc(Assembler::zero, set_mdp);
   // rbx,: method
   // rsi: bcp
   call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, rsi);
   // rax,: mdi
-
+  // mdo is guaranteed to be non-zero here, we checked for it before the call.
   movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
-  testptr(rbx, rbx);
-  jcc(Assembler::zero, zero_continue);
   addptr(rbx, in_bytes(methodDataOopDesc::data_offset()));
-  addptr(rbx, rax);
-  movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx);
-
-  bind(zero_continue);
+  addptr(rax, rbx);
+  bind(set_mdp);
+  movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
   pop(rbx);
   pop(rax);
 }
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -855,7 +855,7 @@
 // Set the method data pointer for the current bcp.
 void InterpreterMacroAssembler::set_method_data_pointer_for_bcp() {
   assert(ProfileInterpreter, "must be profiling interpreter");
-  Label zero_continue;
+  Label set_mdp;
   push(rax);
   push(rbx);
 
@@ -863,21 +863,17 @@
   // Test MDO to avoid the call if it is NULL.
   movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
   testptr(rax, rax);
-  jcc(Assembler::zero, zero_continue);
-
+  jcc(Assembler::zero, set_mdp);
   // rbx: method
   // r13: bcp
   call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::bcp_to_di), rbx, r13);
   // rax: mdi
-
+  // mdo is guaranteed to be non-zero here, we checked for it before the call.
   movptr(rbx, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
-  testptr(rbx, rbx);
-  jcc(Assembler::zero, zero_continue);
   addptr(rbx, in_bytes(methodDataOopDesc::data_offset()));
-  addptr(rbx, rax);
-  movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rbx);
-
-  bind(zero_continue);
+  addptr(rax, rbx);
+  bind(set_mdp);
+  movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
   pop(rbx);
   pop(rax);
 }
--- a/src/cpu/x86/vm/jni_x86.h	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/jni_x86.h	Tue Mar 01 15:05:39 2011 +0000
@@ -27,10 +27,16 @@
 #define _JAVASOFT_JNI_MD_H_
 
 #if defined(SOLARIS) || defined(LINUX)
+
+#if defined(__GNUC__) && (__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2)
+  #define JNIEXPORT     __attribute__((visibility("default")))
+  #define JNIIMPORT     __attribute__((visibility("default")))
+#else
   #define JNIEXPORT
   #define JNIIMPORT
+#endif
+
   #define JNICALL
-
   typedef int jint;
 
 #ifdef _LP64
--- a/src/cpu/x86/vm/methodHandles_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -385,6 +385,9 @@
   // FIXME: MethodHandlesTest gets a crash if we enable OP_SPREAD_ARGS.
 }
 
+//------------------------------------------------------------------------------
+// MethodHandles::generate_method_handle_stub
+//
 // Generate an "entry" field for a method handle.
 // This determines how the method handle will respond to calls.
 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) {
@@ -396,14 +399,21 @@
   // - rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted)
   // - rdx: garbage temp, can blow away
 
-  Register rcx_recv    = rcx;
-  Register rax_argslot = rax;
-  Register rbx_temp    = rbx;
-  Register rdx_temp    = rdx;
+  const Register rcx_recv    = rcx;
+  const Register rax_argslot = rax;
+  const Register rbx_temp    = rbx;
+  const Register rdx_temp    = rdx;
 
   // This guy is set up by prepare_to_jump_from_interpreted (from interpreted calls)
   // and gen_c2i_adapter (from compiled calls):
-  Register saved_last_sp = LP64_ONLY(r13) NOT_LP64(rsi);
+  const Register saved_last_sp = LP64_ONLY(r13) NOT_LP64(rsi);
+
+  // Argument registers for _raise_exception.
+  // 32-bit: Pass first two oop/int args in registers ECX and EDX.
+  const Register rarg0_code     = LP64_ONLY(j_rarg0) NOT_LP64(rcx);
+  const Register rarg1_actual   = LP64_ONLY(j_rarg1) NOT_LP64(rdx);
+  const Register rarg2_required = LP64_ONLY(j_rarg2) NOT_LP64(rdi);
+  assert_different_registers(rarg0_code, rarg1_actual, rarg2_required, saved_last_sp);
 
   guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
 
@@ -437,47 +447,42 @@
   switch ((int) ek) {
   case _raise_exception:
     {
-      // Not a real MH entry, but rather shared code for raising an exception.
-      // Extra local arguments are pushed on stack, as required type at TOS+8,
-      // failing object (or NULL) at TOS+4, failing bytecode type at TOS.
-      // Beyond those local arguments are the PC, of course.
-      Register rdx_code = rdx_temp;
-      Register rcx_fail = rcx_recv;
-      Register rax_want = rax_argslot;
-      Register rdi_pc   = rdi;
-      __ pop(rdx_code);  // TOS+0
-      __ pop(rcx_fail);  // TOS+4
-      __ pop(rax_want);  // TOS+8
-      __ pop(rdi_pc);    // caller PC
+      // Not a real MH entry, but rather shared code for raising an
+      // exception.  Since we use a C2I adapter to set up the
+      // interpreter state, arguments are expected in compiler
+      // argument registers.
+      assert(raise_exception_method(), "must be set");
+      address c2i_entry = raise_exception_method()->get_c2i_entry();
+      assert(c2i_entry, "method must be linked");
 
-      __ mov(rsp, rsi);   // cut the stack back to where the caller started
-
-      // Repush the arguments as if coming from the interpreter.
-      __ push(rdx_code);
-      __ push(rcx_fail);
-      __ push(rax_want);
+      const Register rdi_pc = rax;
+      __ pop(rdi_pc);  // caller PC
+      __ mov(rsp, saved_last_sp);  // cut the stack back to where the caller started
 
       Register rbx_method = rbx_temp;
-      Label no_method;
+      Label L_no_method;
       // FIXME: fill in _raise_exception_method with a suitable sun.dyn method
       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
       __ testptr(rbx_method, rbx_method);
-      __ jccb(Assembler::zero, no_method);
-      int jobject_oop_offset = 0;
+      __ jccb(Assembler::zero, L_no_method);
+
+      const int jobject_oop_offset = 0;
       __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset));  // dereference the jobject
       __ testptr(rbx_method, rbx_method);
-      __ jccb(Assembler::zero, no_method);
+      __ jccb(Assembler::zero, L_no_method);
       __ verify_oop(rbx_method);
-      __ push(rdi_pc);          // and restore caller PC
-      __ jmp(rbx_method_fie);
+
+      // 32-bit: push remaining arguments as if coming from the compiler.
+      NOT_LP64(__ push(rarg2_required));
+
+      __ push(rdi_pc);  // restore caller PC
+      __ jump(ExternalAddress(c2i_entry));  // do C2I transition
 
       // If we get here, the Java runtime did not do its job of creating the exception.
       // Do something that is at least causes a valid throw from the interpreter.
-      __ bind(no_method);
-      __ pop(rax_want);
-      __ pop(rcx_fail);
-      __ push(rax_want);
-      __ push(rcx_fail);
+      __ bind(L_no_method);
+      __ push(rarg2_required);
+      __ push(rarg1_actual);
       __ jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry()));
     }
     break;
@@ -572,9 +577,11 @@
       __ bind(no_such_interface);
       // Throw an exception.
       // For historical reasons, it will be IncompatibleClassChangeError.
-      __ pushptr(Address(rdx_intf, java_mirror_offset));  // required interface
-      __ push(rcx_recv);        // bad receiver
-      __ push((int)Bytecodes::_invokeinterface);  // who is complaining?
+      __ mov(rbx_temp, rcx_recv);  // rarg2_required might be RCX
+      assert_different_registers(rarg2_required, rbx_temp);
+      __ movptr(rarg2_required, Address(rdx_intf, java_mirror_offset));  // required interface
+      __ mov(   rarg1_actual,   rbx_temp);                               // bad receiver
+      __ movl(  rarg0_code,     (int) Bytecodes::_invokeinterface);      // who is complaining?
       __ jump(ExternalAddress(from_interpreted_entry(_raise_exception)));
     }
     break;
@@ -669,10 +676,10 @@
       __ movl(rax_argslot, rcx_amh_vmargslot);  // reload argslot field
       __ movptr(rdx_temp, vmarg);
 
-      __ load_heap_oop(rbx_klass, rcx_amh_argument); // required class
-      __ push(rbx_klass);
-      __ push(rdx_temp);                             // bad object
-      __ push((int)Bytecodes::_checkcast);           // who is complaining?
+      assert_different_registers(rarg2_required, rdx_temp);
+      __ load_heap_oop(rarg2_required, rcx_amh_argument);             // required class
+      __ mov(          rarg1_actual,   rdx_temp);                     // bad object
+      __ movl(         rarg0_code,     (int) Bytecodes::_checkcast);  // who is complaining?
       __ jump(ExternalAddress(from_interpreted_entry(_raise_exception)));
 
       __ bind(done);
@@ -1189,16 +1196,18 @@
 
       __ bind(bad_array_klass);
       UNPUSH_RSI_RDI;
-      __ pushptr(Address(rdx_array_klass, java_mirror_offset)); // required type
-      __ pushptr(vmarg);                // bad array
-      __ push((int)Bytecodes::_aaload); // who is complaining?
+      assert(!vmarg.uses(rarg2_required), "must be different registers");
+      __ movptr(rarg2_required, Address(rdx_array_klass, java_mirror_offset));  // required type
+      __ movptr(rarg1_actual,   vmarg);                                         // bad array
+      __ movl(  rarg0_code,     (int) Bytecodes::_aaload);                      // who is complaining?
       __ jump(ExternalAddress(from_interpreted_entry(_raise_exception)));
 
       __ bind(bad_array_length);
       UNPUSH_RSI_RDI;
-      __ push(rcx_recv);        // AMH requiring a certain length
-      __ pushptr(vmarg);        // bad array
-      __ push((int)Bytecodes::_arraylength); // who is complaining?
+      assert(!vmarg.uses(rarg2_required), "must be different registers");
+      __ mov   (rarg2_required, rcx_recv);                       // AMH requiring a certain length
+      __ movptr(rarg1_actual,   vmarg);                          // bad array
+      __ movl(  rarg0_code,     (int) Bytecodes::_arraylength);  // who is complaining?
       __ jump(ExternalAddress(from_interpreted_entry(_raise_exception)));
 
 #undef UNPUSH_RSI_RDI
--- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1974,7 +1974,7 @@
     in_sig_bt[i++] = bt;  // Collect remaining bits of signature
     out_sig_bt[total_c_args++] = bt;
     if( bt == T_OBJECT) {
-      symbolOop s = ss.as_symbol_or_null();
+      Symbol* s = ss.as_symbol_or_null();   // symbol is created
       if (s == vmSymbols::java_lang_String()) {
         total_strings++;
         out_sig_bt[total_c_args-1] = T_ADDRESS;
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1980,7 +1980,7 @@
     in_sig_bt[i++] = bt;  // Collect remaining bits of signature
     out_sig_bt[total_c_args++] = bt;
     if( bt == T_OBJECT) {
-      symbolOop s = ss.as_symbol_or_null();
+      Symbol* s = ss.as_symbol_or_null();   // symbol is created
       if (s == vmSymbols::java_lang_String()) {
         total_strings++;
         out_sig_bt[total_c_args-1] = T_ADDRESS;
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1367,15 +1367,9 @@
     if (ProfileInterpreter) {
       // We have decided to profile this method in the interpreter
       __ bind(profile_method);
-
-      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), rsi, true);
-
-      __ movptr(rbx, Address(rbp, method_offset));   // restore methodOop
-      __ movptr(rax, Address(rbx, in_bytes(methodOopDesc::method_data_offset())));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
-      __ test_method_data_pointer(rax, profile_method_continue);
-      __ addptr(rax, in_bytes(methodDataOopDesc::data_offset()));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rax);
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
+      __ set_method_data_pointer_for_bcp();
+      __ get_method(rbx);
       __ jmp(profile_method_continue);
     }
     // Handle overflow of counter and compile method
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1383,20 +1383,9 @@
     if (ProfileInterpreter) {
       // We have decided to profile this method in the interpreter
       __ bind(profile_method);
-
-      __ call_VM(noreg,
-                 CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method),
-                 r13, true);
-
-      __ movptr(rbx, Address(rbp, method_offset)); // restore methodOop
-      __ movptr(rax, Address(rbx,
-                             in_bytes(methodOopDesc::method_data_offset())));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize),
-                rax);
-      __ test_method_data_pointer(rax, profile_method_continue);
-      __ addptr(rax, in_bytes(methodDataOopDesc::data_offset()));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize),
-              rax);
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
+      __ set_method_data_pointer_for_bcp();
+      __ get_method(rbx);
       __ jmp(profile_method_continue);
     }
     // Handle overflow of counter and compile method
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1665,16 +1665,9 @@
     if (ProfileInterpreter) {
       // Out-of-line code to allocate method data oop.
       __ bind(profile_method);
-      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method), rsi);
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
       __ load_unsigned_byte(rbx, Address(rsi, 0));  // restore target bytecode
-      __ movptr(rcx, Address(rbp, method_offset));
-      __ movptr(rcx, Address(rcx, in_bytes(methodOopDesc::method_data_offset())));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rcx);
-      __ test_method_data_pointer(rcx, dispatch);
-      // offset non-null mdp by MDO::data_offset() + IR::profile_method()
-      __ addptr(rcx, in_bytes(methodDataOopDesc::data_offset()));
-      __ addptr(rcx, rax);
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), rcx);
+      __ set_method_data_pointer_for_bcp();
       __ jmp(dispatch);
     }
 
@@ -3203,10 +3196,12 @@
   const bool allow_shared_alloc =
     Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
 
+  const Register thread = rcx;
+  if (UseTLAB || allow_shared_alloc) {
+    __ get_thread(thread);
+  }
+
   if (UseTLAB) {
-    const Register thread = rcx;
-
-    __ get_thread(thread);
     __ movptr(rax, Address(thread, in_bytes(JavaThread::tlab_top_offset())));
     __ lea(rbx, Address(rax, rdx, Address::times_1));
     __ cmpptr(rbx, Address(thread, in_bytes(JavaThread::tlab_end_offset())));
@@ -3247,6 +3242,8 @@
 
     // if someone beat us on the allocation, try again, otherwise continue
     __ jcc(Assembler::notEqual, retry);
+
+    __ incr_allocated_bytes(thread, rdx, 0);
   }
 
   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
@@ -3256,12 +3253,12 @@
     __ decrement(rdx, sizeof(oopDesc));
     __ jcc(Assembler::zero, initialize_header);
 
-  // Initialize topmost object field, divide rdx by 8, check if odd and
-  // test if zero.
+    // Initialize topmost object field, divide rdx by 8, check if odd and
+    // test if zero.
     __ xorl(rcx, rcx);    // use zero reg to clear memory (shorter code)
     __ shrl(rdx, LogBytesPerLong); // divide by 2*oopSize and set carry flag if odd
 
-  // rdx must have been multiple of 8
+    // rdx must have been multiple of 8
 #ifdef ASSERT
     // make sure rdx was multiple of 8
     Label L;
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1695,21 +1695,9 @@
     if (ProfileInterpreter) {
       // Out-of-line code to allocate method data oop.
       __ bind(profile_method);
-      __ call_VM(noreg,
-                 CAST_FROM_FN_PTR(address,
-                                  InterpreterRuntime::profile_method), r13);
+      __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method));
       __ load_unsigned_byte(rbx, Address(r13, 0));  // restore target bytecode
-      __ movptr(rcx, Address(rbp, method_offset));
-      __ movptr(rcx, Address(rcx,
-                             in_bytes(methodOopDesc::method_data_offset())));
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize),
-                rcx);
-      __ test_method_data_pointer(rcx, dispatch);
-      // offset non-null mdp by MDO::data_offset() + IR::profile_method()
-      __ addptr(rcx, in_bytes(methodDataOopDesc::data_offset()));
-      __ addptr(rcx, rax);
-      __ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize),
-                rcx);
+      __ set_method_data_pointer_for_bcp();
       __ jmp(dispatch);
     }
 
@@ -3266,6 +3254,8 @@
 
     // if someone beat us on the allocation, try again, otherwise continue
     __ jcc(Assembler::notEqual, retry);
+
+    __ incr_allocated_bytes(r15_thread, rdx, 0);
   }
 
   if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
--- a/src/cpu/zero/vm/jni_zero.h	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/cpu/zero/vm/jni_zero.h	Tue Mar 01 15:05:39 2011 +0000
@@ -24,8 +24,14 @@
  * questions.
  */
 
-#define JNIEXPORT
-#define JNIIMPORT
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+  #define JNIEXPORT     __attribute__((visibility("default")))
+  #define JNIIMPORT     __attribute__((visibility("default")))
+#else
+  #define JNIEXPORT
+  #define JNIIMPORT
+#endif
 #define JNICALL
 
 typedef int jint;
--- a/src/os/linux/vm/jvm_linux.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/jvm_linux.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -29,11 +29,6 @@
 
 #include <signal.h>
 
-/*
- * FIXME: This is temporary hack to keep Linux Runtime.exec()
- * code happy. See $JDK/src/linux/native/java/lang/UnixProcess_md.c
- */
-int _JVM_native_threads = 1;
 
 // sun.misc.Signal ///////////////////////////////////////////////////////////
 // Signal code is mostly copied from classic vm, signals_md.c   1.4 98/08/23
--- a/src/os/linux/vm/osThread_linux.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/osThread_linux.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -39,6 +39,12 @@
 #ifdef TARGET_ARCH_zero
 # include "assembler_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+#endif
 
 
 void OSThread::pd_initialize() {
--- a/src/os/linux/vm/os_linux.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/os_linux.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,14 @@
 # include "assembler_zero.inline.hpp"
 # include "nativeInst_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+# include "nativeInst_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+# include "nativeInst_ppc.hpp"
+#endif
 #ifdef COMPILER1
 #include "c1/c1_Runtime1.hpp"
 #endif
@@ -123,6 +131,7 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 #define SEC_IN_NANOSECS  1000000000LL
 
+#define LARGEPAGES_BIT (1 << 6)
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Linux::_physical_memory = 0;
@@ -1610,10 +1619,9 @@
 
 const char* os::dll_file_extension() { return ".so"; }
 
-const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  return prop == NULL ? "/tmp" : prop;
-}
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
+const char* os::get_temp_directory() { return "/tmp"; }
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
@@ -2510,8 +2518,10 @@
   return end;
 }
 
-extern "C" void numa_warn(int number, char *where, ...) { }
-extern "C" void numa_error(char *where) { }
+// Something to do with the numa-aware allocator needs these symbols
+extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+extern "C" JNIEXPORT void numa_error(char *where) { }
+extern "C" JNIEXPORT int fork1() { return fork(); }
 
 
 // If we are running with libnuma version > 2, then we should
@@ -2808,6 +2818,43 @@
   return linux_mprotect(addr, size, PROT_READ|PROT_WRITE);
 }
 
+/*
+* Set the coredump_filter bits to include largepages in core dump (bit 6)
+*
+* From the coredump_filter documentation:
+*
+* - (bit 0) anonymous private memory
+* - (bit 1) anonymous shared memory
+* - (bit 2) file-backed private memory
+* - (bit 3) file-backed shared memory
+* - (bit 4) ELF header pages in file-backed private memory areas (it is
+*           effective only if the bit 2 is cleared)
+* - (bit 5) hugetlb private memory
+* - (bit 6) hugetlb shared memory
+*/
+static void set_coredump_filter(void) {
+  FILE *f;
+  long cdm;
+
+  if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
+    return;
+  }
+
+  if (fscanf(f, "%lx", &cdm) != 1) {
+    fclose(f);
+    return;
+  }
+
+  rewind(f);
+
+  if ((cdm & LARGEPAGES_BIT) == 0) {
+    cdm |= LARGEPAGES_BIT;
+    fprintf(f, "%#lx", cdm);
+  }
+
+  fclose(f);
+}
+
 // Large page support
 
 static size_t _large_page_size = 0;
@@ -2865,6 +2912,8 @@
     _page_sizes[2] = 0;
   }
 
+  set_coredump_filter();
+
   // Large page support is available on 2.6 or newer kernel, some vendors
   // (e.g. Redhat) have backported it to their 2.4 based distributions.
   // We optimistically assume the support is available. If later it turns out
@@ -3484,7 +3533,7 @@
 // Note that the VM will print warnings if it detects conflicting signal
 // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
 //
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_linux_signal(int signo, siginfo_t* siginfo,
                         void* ucontext, int abort_if_unrecognized);
 
@@ -4679,44 +4728,6 @@
   }
 }
 
-extern "C" {
-
-/**
- * NOTE: the following code is to keep the green threads code
- * in the libjava.so happy. Once the green threads is removed,
- * these code will no longer be needed.
- */
-int
-jdk_waitpid(pid_t pid, int* status, int options) {
-    return waitpid(pid, status, options);
-}
-
-int
-fork1() {
-    return fork();
-}
-
-int
-jdk_sem_init(sem_t *sem, int pshared, unsigned int value) {
-    return sem_init(sem, pshared, value);
-}
-
-int
-jdk_sem_post(sem_t *sem) {
-    return sem_post(sem);
-}
-
-int
-jdk_sem_wait(sem_t *sem) {
-    return sem_wait(sem);
-}
-
-int
-jdk_pthread_sigmask(int how , const sigset_t* newmask, sigset_t* oldmask) {
-    return pthread_sigmask(how , newmask, oldmask);
-}
-
-}
 
 // Refer to the comments in os_solaris.cpp park-unpark.
 //
--- a/src/os/linux/vm/os_linux.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/os_linux.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -39,6 +39,14 @@
 # include "atomic_linux_zero.inline.hpp"
 # include "orderAccess_linux_zero.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_linux_arm
+# include "atomic_linux_arm.inline.hpp"
+# include "orderAccess_linux_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_ppc
+# include "atomic_linux_ppc.inline.hpp"
+# include "orderAccess_linux_ppc.inline.hpp"
+#endif
 
 // System includes
 
--- a/src/os/linux/vm/perfMemory_linux.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/perfMemory_linux.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -635,7 +635,29 @@
     return -1;
   }
 
-  return fd;
+  // Verify that we have enough disk space for this file.
+  // We'll get random SIGBUS crashes on memory accesses if
+  // we don't.
+
+  for (size_t seekpos = 0; seekpos < size; seekpos += os::vm_page_size()) {
+    int zero_int = 0;
+    result = (int)os::seek_to_file_offset(fd, (jlong)(seekpos));
+    if (result == -1 ) break;
+    RESTARTABLE(::write(fd, &zero_int, 1), result);
+    if (result != 1) {
+      if (errno == ENOSPC) {
+        warning("Insufficient space for shared memory file:\n   %s\nTry using the -Djava.io.tmpdir= option to select an alternate temp location.\n", filename);
+      }
+      break;
+    }
+  }
+
+  if (result != -1) {
+    return fd;
+  } else {
+    RESTARTABLE(::close(fd), result);
+    return -1;
+  }
 }
 
 // open the shared memory file for the given user and vmid. returns
--- a/src/os/linux/vm/thread_linux.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/linux/vm/thread_linux.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -44,6 +44,16 @@
 # include "orderAccess_linux_zero.inline.hpp"
 # include "prefetch_linux_zero.inline.hpp"
 #endif
+#ifdef TARGET_OS_ARCH_linux_arm
+# include "atomic_linux_arm.inline.hpp"
+# include "orderAccess_linux_arm.inline.hpp"
+# include "prefetch_linux_arm.inline.hpp"
+#endif
+#ifdef TARGET_OS_ARCH_linux_ppc
+# include "atomic_linux_ppc.inline.hpp"
+# include "orderAccess_linux_ppc.inline.hpp"
+# include "prefetch_linux_ppc.inline.hpp"
+#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os/posix/launcher/java_md.c	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/posix/launcher/java_md.c	Tue Mar 01 15:05:39 2011 +0000
@@ -28,7 +28,6 @@
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <inttypes.h>
-#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/os/posix/vm/os_posix.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*
+*/
+
+#include "prims/jvm.h"
+#include "runtime/os.hpp"
+#include "utilities/vmError.hpp"
+
+#include <unistd.h>
+#include <sys/resource.h>
+
+// Check core dump limit and report possible place where core can be found
+void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
+  struct rlimit rlim;
+  static char cwd[O_BUFLEN];
+  bool success;
+
+  get_current_directory(cwd, sizeof(cwd));
+
+  if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
+    jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id());
+    success = true;
+  } else {
+    switch(rlim.rlim_cur) {
+      case RLIM_INFINITY:
+        jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id());
+        success = true;
+        break;
+      case 0:
+        jio_snprintf(buffer, bufferSize, "Core dumps have been disabled. To enable core dumping, try \"ulimit -c unlimited\" before starting Java again");
+        success = false;
+        break;
+      default:
+        jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
+        success = true;
+        break;
+    }
+  }
+  VMError::report_coredump_status(buffer, success);
+}
+
--- a/src/os/solaris/dtrace/generateJvmOffsets.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/dtrace/generateJvmOffsets.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -49,7 +49,7 @@
 #include "oops/klass.hpp"
 #include "oops/methodOop.hpp"
 #include "oops/oop.hpp"
-#include "oops/symbolOop.hpp"
+#include "oops/symbol.hpp"
 #include "runtime/virtualspace.hpp"
 #include "runtime/vmStructs.hpp"
 #include "utilities/accessFlags.hpp"
@@ -215,8 +215,8 @@
   GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE);
   GEN_VALUE(constMethodOopDesc_has_linenumber_table, constMethodOopDesc::_has_linenumber_table);
   GEN_OFFS(AccessFlags, _flags);
-  GEN_OFFS(symbolOopDesc, _length);
-  GEN_OFFS(symbolOopDesc, _body);
+  GEN_OFFS(Symbol, _length);
+  GEN_OFFS(Symbol, _body);
   printf("\n");
 
   GEN_OFFS(methodOopDesc, _constMethod);
--- a/src/os/solaris/dtrace/jhelper.d	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/dtrace/jhelper.d	Tue Mar 01 15:05:39 2011 +0000
@@ -114,8 +114,8 @@
   copyin_offset(OFFSET_HeapBlockHeader_used);
   copyin_offset(OFFSET_oopDesc_metadata);
 
-  copyin_offset(OFFSET_symbolOopDesc_length);
-  copyin_offset(OFFSET_symbolOopDesc_body);
+  copyin_offset(OFFSET_Symbol_length);
+  copyin_offset(OFFSET_Symbol_body);
 
   copyin_offset(OFFSET_methodOopDesc_constMethod);
   copyin_offset(OFFSET_methodOopDesc_constants);
@@ -366,13 +366,13 @@
       this->nameIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
 
   this->nameSymbolLength = copyin_uint16(this->nameSymbol +
-      OFFSET_symbolOopDesc_length);
+      OFFSET_Symbol_length);
 
   this->signatureSymbol = copyin_ptr(this->constantPool +
       this->signatureIndex * sizeof (pointer) + SIZE_constantPoolOopDesc);
 
   this->signatureSymbolLength = copyin_uint16(this->signatureSymbol +
-      OFFSET_symbolOopDesc_length);
+      OFFSET_Symbol_length);
 
   this->klassPtr = copyin_ptr(this->constantPool +
       OFFSET_constantPoolOopDesc_pool_holder);
@@ -381,7 +381,7 @@
       OFFSET_Klass_name + SIZE_oopDesc);
 
   this->klassSymbolLength = copyin_uint16(this->klassSymbol +
-      OFFSET_symbolOopDesc_length);
+      OFFSET_Symbol_length);
 
   /*
    * Enough for three strings, plus the '.', plus the trailing '\0'.
@@ -390,7 +390,7 @@
       this->nameSymbolLength +
       this->signatureSymbolLength + 2 + 1);
 
-  copyinto(this->klassSymbol + OFFSET_symbolOopDesc_body,
+  copyinto(this->klassSymbol + OFFSET_Symbol_body,
       this->klassSymbolLength, this->result);
 
   /*
@@ -398,11 +398,11 @@
    */
   this->result[this->klassSymbolLength] = '.';
 
-  copyinto(this->nameSymbol + OFFSET_symbolOopDesc_body,
+  copyinto(this->nameSymbol + OFFSET_Symbol_body,
       this->nameSymbolLength,
       this->result + this->klassSymbolLength + 1);
 
-  copyinto(this->signatureSymbol + OFFSET_symbolOopDesc_body,
+  copyinto(this->signatureSymbol + OFFSET_Symbol_body,
       this->signatureSymbolLength,
       this->result + this->klassSymbolLength +
       this->nameSymbolLength + 1);
--- a/src/os/solaris/dtrace/libjvm_db.c	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/dtrace/libjvm_db.c	Tue Mar 01 15:05:39 2011 +0000
@@ -524,10 +524,10 @@
   CHECK_FAIL(err);
   err = read_pointer(J, constantPool + nameIndex * POINTER_SIZE + SIZE_constantPoolOopDesc, &nameSymbol);
   CHECK_FAIL(err);
-  err = ps_pread(J->P, nameSymbol + OFFSET_symbolOopDesc_length, &nameSymbolLength, 2);
+  err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_length, &nameSymbolLength, 2);
   CHECK_FAIL(err);
   nameString = (char*)calloc(nameSymbolLength + 1, 1);
-  err = ps_pread(J->P, nameSymbol + OFFSET_symbolOopDesc_body, nameString, nameSymbolLength);
+  err = ps_pread(J->P, nameSymbol + OFFSET_Symbol_body, nameString, nameSymbolLength);
   CHECK_FAIL(err);
 
   /* To get signature string */
@@ -535,10 +535,10 @@
   CHECK_FAIL(err);
   err = read_pointer(J, constantPool + signatureIndex * POINTER_SIZE + SIZE_constantPoolOopDesc, &signatureSymbol);
   CHECK_FAIL(err);
-  err = ps_pread(J->P, signatureSymbol + OFFSET_symbolOopDesc_length, &signatureSymbolLength, 2);
+  err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_length, &signatureSymbolLength, 2);
   CHECK_FAIL(err);
   signatureString = (char*)calloc(signatureSymbolLength + 1, 1);
-  err = ps_pread(J->P, signatureSymbol + OFFSET_symbolOopDesc_body, signatureString, signatureSymbolLength);
+  err = ps_pread(J->P, signatureSymbol + OFFSET_Symbol_body, signatureString, signatureSymbolLength);
   CHECK_FAIL(err);
 
   /* To get klass string */
@@ -546,10 +546,10 @@
   CHECK_FAIL(err);
   err = read_pointer(J, klassPtr + OFFSET_Klass_name + SIZE_oopDesc, &klassSymbol);
   CHECK_FAIL(err);
-  err = ps_pread(J->P, klassSymbol + OFFSET_symbolOopDesc_length, &klassSymbolLength, 2);
+  err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_length, &klassSymbolLength, 2);
   CHECK_FAIL(err);
   klassString = (char*)calloc(klassSymbolLength + 1, 1);
-  err = ps_pread(J->P, klassSymbol + OFFSET_symbolOopDesc_body, klassString, klassSymbolLength);
+  err = ps_pread(J->P, klassSymbol + OFFSET_Symbol_body, klassString, klassSymbolLength);
   CHECK_FAIL(err);
 
   result[0] = '\0';
--- a/src/os/solaris/vm/dtraceJSDT_solaris.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/vm/dtraceJSDT_solaris.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -142,7 +142,7 @@
     ++strcount;
     for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
       JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      symbolOop sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
+      Symbol* sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
       // function + name + one per argument
       strcount += 2 + ArgumentCount(sig).size();
     }
@@ -178,7 +178,7 @@
       stroffs[curstr++] = string_index;
       string_index += strlen(name) + 1;
 
-      symbolOop sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
+      Symbol* sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
       SignatureStream ss(sig);
       for ( ; !ss.at_return_type(); ss.next()) {
         BasicType bt = ss.type();
@@ -227,7 +227,7 @@
     uint32_t argscount = 0;
     for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
        JVM_DTraceProbe* p = &(provider->probes[prbc]);
-       symbolOop sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
+       Symbol* sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
        argscount += ArgumentCount(sig).size();
     }
     secoffs[argoffs_sec] = align_size_up(offset, alignment_for[ARG_OFFSETS]);
@@ -298,7 +298,7 @@
       strcpy(str, name);
       str += strlen(name) + 1;
 
-      symbolOop sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
+      Symbol* sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
       SignatureStream ss(sig);
       for ( ; !ss.at_return_type(); ss.next()) {
         BasicType bt = ss.type();
@@ -433,7 +433,7 @@
     uint8_t* par = (uint8_t*)(dof + sec->dofs_offset);
     for (int prbc = 0; prbc < provider->probe_count; ++prbc) {
       JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      symbolOop sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
+      Symbol* sig = JNIHandles::resolve_jmethod_id(p->method)->signature();
       uint8_t count = (uint8_t)ArgumentCount(sig).size();
       for (uint8_t i = 0; i < count; ++i) {
         *par++ = i;
--- a/src/os/solaris/vm/os_solaris.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/vm/os_solaris.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -80,6 +80,7 @@
 // put OS-includes here
 # include <dlfcn.h>
 # include <errno.h>
+# include <exception>
 # include <link.h>
 # include <poll.h>
 # include <pthread.h>
@@ -282,7 +283,7 @@
                is_error_reported(),
               "sp must be inside of selected thread stack");
 
-    thread->_self_raw_id = raw_id;  // mark for quick retrieval
+    thread->set_self_raw_id(raw_id);  // mark for quick retrieval
     _get_thread_cache[ index ] = thread;
   }
   return thread;
@@ -1475,6 +1476,13 @@
   return &allowdebug_blocked_sigs;
 }
 
+
+void _handle_uncaught_cxx_exception() {
+  VMError err("An uncaught C++ exception");
+  err.report_and_die();
+}
+
+
 // First crack at OS-specific initialization, from inside the new thread.
 void os::initialize_thread() {
   int r = thr_main() ;
@@ -1564,6 +1572,7 @@
    // use the dynamic check for T2 libthread.
 
   os::Solaris::init_thread_fpu_state();
+  std::set_terminate(_handle_uncaught_cxx_exception);
 }
 
 
@@ -1875,10 +1884,9 @@
 
 const char* os::dll_file_extension() { return ".so"; }
 
-const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  return prop == NULL ? "/tmp" : prop;
-}
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
+const char* os::get_temp_directory() { return "/tmp"; }
 
 static bool file_exists(const char* filename) {
   struct stat statbuf;
@@ -3081,7 +3089,7 @@
     if (addr == NULL) {
       jio_snprintf(buf, sizeof(buf), ": %s", strerror(err));
     }
-    warning("attempt_reserve_memory_at: couldn't reserve %d bytes at "
+    warning("attempt_reserve_memory_at: couldn't reserve " SIZE_FORMAT " bytes at "
             PTR_FORMAT ": reserve_memory_helper returned " PTR_FORMAT
             "%s", bytes, requested_addr, addr, buf);
   }
@@ -4213,7 +4221,9 @@
 // Note that the VM will print warnings if it detects conflicting signal
 // handlers, unless invoked with the option "-XX:+AllowUserSignalHandlers".
 //
-extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized);
+extern "C" JNIEXPORT int
+JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext,
+                          int abort_if_unrecognized);
 
 
 void signalHandler(int sig, siginfo_t* info, void* ucVoid) {
@@ -5188,7 +5198,7 @@
   int o_delete = (oflag & O_DELETE);
   oflag = oflag & ~O_DELETE;
 
-  fd = ::open(path, oflag, mode);
+  fd = ::open64(path, oflag, mode);
   if (fd == -1) return -1;
 
   //If the open succeeded, the file might still be a directory
--- a/src/os/solaris/vm/thread_solaris.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/solaris/vm/thread_solaris.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,10 +53,10 @@
 
   uintptr_t raw = pd_raw_thread_id();
   int ix = pd_cache_index(raw);
-  Thread *Candidate = ThreadLocalStorage::_get_thread_cache[ix];
-  if (Candidate->_self_raw_id == raw) {
+  Thread* candidate = ThreadLocalStorage::_get_thread_cache[ix];
+  if (candidate->self_raw_id() == raw) {
     // hit
-    return Candidate;
+    return candidate;
   } else {
     return ThreadLocalStorage::get_thread_via_cache_slowly(raw, ix);
   }
--- a/src/os/windows/vm/os_windows.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/windows/vm/os_windows.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -915,6 +915,85 @@
   }
 }
 
+
+static BOOL  (WINAPI *_MiniDumpWriteDump)  ( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
+                                            PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION);
+
+void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
+  HINSTANCE dbghelp;
+  EXCEPTION_POINTERS ep;
+  MINIDUMP_EXCEPTION_INFORMATION mei;
+  HANDLE hProcess = GetCurrentProcess();
+  DWORD processId = GetCurrentProcessId();
+  HANDLE dumpFile;
+  MINIDUMP_TYPE dumpType;
+  static const char* cwd;
+
+  // If running on a client version of Windows and user has not explicitly enabled dumping
+  if (!os::win32::is_windows_server() && !CreateMinidumpOnCrash) {
+    VMError::report_coredump_status("Minidumps are not enabled by default on client versions of Windows", false);
+    return;
+    // If running on a server version of Windows and user has explictly disabled dumping
+  } else if (os::win32::is_windows_server() && !FLAG_IS_DEFAULT(CreateMinidumpOnCrash) && !CreateMinidumpOnCrash) {
+    VMError::report_coredump_status("Minidump has been disabled from the command line", false);
+    return;
+  }
+
+  dbghelp = LoadLibrary("DBGHELP.DLL");
+
+  if (dbghelp == NULL) {
+    VMError::report_coredump_status("Failed to load dbghelp.dll", false);
+    return;
+  }
+
+  _MiniDumpWriteDump = CAST_TO_FN_PTR(
+    BOOL(WINAPI *)( HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION,
+    PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION),
+    GetProcAddress(dbghelp, "MiniDumpWriteDump"));
+
+  if (_MiniDumpWriteDump == NULL) {
+    VMError::report_coredump_status("Failed to find MiniDumpWriteDump() in module dbghelp.dll", false);
+    return;
+  }
+
+  dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData);
+
+// Older versions of dbghelp.h doesn't contain all the dumptypes we want, dbghelp.h with
+// API_VERSION_NUMBER 11 or higher contains the ones we want though
+#if API_VERSION_NUMBER >= 11
+  dumpType = (MINIDUMP_TYPE)(dumpType | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo |
+    MiniDumpWithUnloadedModules);
+#endif
+
+  cwd = get_current_directory(NULL, 0);
+  jio_snprintf(buffer, bufferSize, "%s\\hs_err_pid%u.mdmp",cwd, current_process_id());
+  dumpFile = CreateFile(buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+
+  if (dumpFile == INVALID_HANDLE_VALUE) {
+    VMError::report_coredump_status("Failed to create file for dumping", false);
+    return;
+  }
+
+  ep.ContextRecord = (PCONTEXT) contextRecord;
+  ep.ExceptionRecord = (PEXCEPTION_RECORD) exceptionRecord;
+
+  mei.ThreadId = GetCurrentThreadId();
+  mei.ExceptionPointers = &ep;
+
+  // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all
+  // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then.
+  if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, &mei, NULL, NULL) == false &&
+      _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, &mei, NULL, NULL) == false) {
+    VMError::report_coredump_status("Call to MiniDumpWriteDump() failed", false);
+  } else {
+    VMError::report_coredump_status(buffer, true);
+  }
+
+  CloseHandle(dumpFile);
+}
+
+
+
 void os::abort(bool dump_core)
 {
   os::shutdown();
@@ -1044,9 +1123,9 @@
     return 0;
 }
 
+// This must be hard coded because it's the system's temporary
+// directory not the java application's temp directory, ala java.io.tmpdir.
 const char* os::get_temp_directory() {
-  const char *prop = Arguments::get_property("java.io.tmpdir");
-  if (prop != 0) return prop;
   static char path_buf[MAX_PATH];
   if (GetTempPath(MAX_PATH, path_buf)>0)
     return path_buf;
@@ -2004,6 +2083,16 @@
   int   number;
 };
 
+// All Visual C++ exceptions thrown from code generated by the Microsoft Visual
+// C++ compiler contain this error code. Because this is a compiler-generated
+// error, the code is not listed in the Win32 API header files.
+// The code is actually a cryptic mnemonic device, with the initial "E"
+// standing for "exception" and the final 3 bytes (0x6D7363) representing the
+// ASCII values of "msc".
+
+#define EXCEPTION_UNCAUGHT_CXX_EXCEPTION    0xE06D7363
+
+
 struct siglabel exceptlabels[] = {
     def_excpt(EXCEPTION_ACCESS_VIOLATION),
     def_excpt(EXCEPTION_DATATYPE_MISALIGNMENT),
@@ -2028,6 +2117,7 @@
     def_excpt(EXCEPTION_INVALID_DISPOSITION),
     def_excpt(EXCEPTION_GUARD_PAGE),
     def_excpt(EXCEPTION_INVALID_HANDLE),
+    def_excpt(EXCEPTION_UNCAUGHT_CXX_EXCEPTION),
     NULL, 0
 };
 
@@ -2261,7 +2351,6 @@
     }
   }
 
-
   if (t != NULL && t->is_Java_thread()) {
     JavaThread* thread = (JavaThread*) t;
     bool in_java = thread->thread_state() == _thread_in_Java;
@@ -2465,8 +2554,9 @@
       } // switch
     }
 #ifndef _WIN64
-    if ((thread->thread_state() == _thread_in_Java) ||
-        (thread->thread_state() == _thread_in_native) )
+    if (((thread->thread_state() == _thread_in_Java) ||
+        (thread->thread_state() == _thread_in_native)) &&
+        exception_code != EXCEPTION_UNCAUGHT_CXX_EXCEPTION)
     {
       LONG result=Handle_FLT_Exception(exceptionInfo);
       if (result==EXCEPTION_CONTINUE_EXECUTION) return result;
@@ -2490,6 +2580,7 @@
       case EXCEPTION_ILLEGAL_INSTRUCTION_2:
       case EXCEPTION_INT_OVERFLOW:
       case EXCEPTION_INT_DIVIDE_BY_ZERO:
+      case EXCEPTION_UNCAUGHT_CXX_EXCEPTION:
       {  report_error(t, exception_code, pc, exceptionInfo->ExceptionRecord,
                        exceptionInfo->ContextRecord);
       }
@@ -3262,7 +3353,7 @@
 
 bool   os::win32::_is_nt              = false;
 bool   os::win32::_is_windows_2003    = false;
-
+bool   os::win32::_is_windows_server  = false;
 
 void os::win32::initialize_system_info() {
   SYSTEM_INFO si;
@@ -3281,9 +3372,9 @@
   GlobalMemoryStatusEx(&ms);
   _physical_memory = ms.ullTotalPhys;
 
-  OSVERSIONINFO oi;
-  oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-  GetVersionEx(&oi);
+  OSVERSIONINFOEX oi;
+  oi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+  GetVersionEx((OSVERSIONINFO*)&oi);
   switch(oi.dwPlatformId) {
     case VER_PLATFORM_WIN32_WINDOWS: _is_nt = false; break;
     case VER_PLATFORM_WIN32_NT:
@@ -3293,6 +3384,10 @@
         if (os_vers == 5002) {
           _is_windows_2003 = true;
         }
+        if (oi.wProductType == VER_NT_DOMAIN_CONTROLLER ||
+          oi.wProductType == VER_NT_SERVER) {
+            _is_windows_server = true;
+        }
       }
       break;
     default: fatal("Unknown platform");
--- a/src/os/windows/vm/os_windows.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os/windows/vm/os_windows.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
   static size_t _default_stack_size;
   static bool   _is_nt;
   static bool   _is_windows_2003;
+  static bool   _is_windows_server;
 
  public:
   // Windows-specific interface:
@@ -64,6 +65,9 @@
   // Tells whether the platform is NT or Windown95
   static bool is_nt() { return _is_nt; }
 
+  // Tells whether this is a server version of Windows
+  static bool is_windows_server() { return _is_windows_server; }
+
   // Tells whether the platform is Windows 2003
   static bool is_windows_2003() { return _is_windows_2003; }
 
--- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,8 @@
 inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
 inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
 
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
   intptr_t rv;
   __asm__ volatile(
--- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -542,7 +542,7 @@
   return false;
 }
 
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_linux_signal(int sig,
                         siginfo_t* info,
                         void* ucVoid,
--- a/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,11 +100,6 @@
   return exchange_value;
 }
 
-extern "C" {
-  // defined in linux_x86.s
-  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
-}
-
 #ifdef AMD64
 inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
 inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
@@ -164,9 +159,9 @@
   return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
 }
 
-#else
-//inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-//inline void Atomic::store  (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
+#else // !AMD64
 
 inline intptr_t Atomic::add_ptr(intptr_t add_value, volatile intptr_t* dest) {
   return (intptr_t)Atomic::add((jint)add_value, (volatile jint*)dest);
@@ -189,6 +184,12 @@
   return (intptr_t)xchg((jint)exchange_value, (volatile jint*)dest);
 }
 
+extern "C" {
+  // defined in linux_x86.s
+  jlong _Atomic_cmpxchg_long(jlong, volatile jlong*, jlong, bool);
+  void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
+}
+
 inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value) {
   return _Atomic_cmpxchg_long(exchange_value, dest, compare_value, os::is_MP());
 }
@@ -200,6 +201,21 @@
 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
 }
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  _Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
 #endif // AMD64
 
 #endif // OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP
--- a/src/os_cpu/linux_x86/vm/linux_x86_32.s	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_x86/vm/linux_x86_32.s	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
 	.globl _mmx_Copy_arrayof_conjoint_jshorts
 
         .globl _Atomic_cmpxchg_long
+        .globl _Atomic_move_long
 
 	.text
 
@@ -653,3 +654,15 @@
         popl     %ebx
         ret
 
+
+        # Support for jlong Atomic::load and Atomic::store.
+        # void _Atomic_move_long(volatile jlong* src, volatile jlong* dst)
+        .p2align 4,,15
+	.type    _Atomic_move_long,@function
+_Atomic_move_long:
+        movl     4(%esp), %eax   # src
+        fildll    (%eax)
+        movl     8(%esp), %eax   # dest
+        fistpll   (%eax)
+        ret
+
--- a/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
 #define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
 
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "vm_version_x86.hpp"
 
@@ -64,11 +65,11 @@
 inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
 inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
 inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return *p; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
 inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
 inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
 inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return *p; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
 inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
 inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
 
@@ -79,11 +80,11 @@
 inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
 inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
 inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
 inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
 
@@ -178,7 +179,7 @@
                           : "0" (v), "r" (p)
                           : "memory");
 #else
-  *p = v; fence();
+  release_store(p, v); fence();
 #endif // AMD64
 }
 
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -216,7 +216,7 @@
 extern "C" void FetchNResume () ;
 #endif // AMD64
 
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_linux_signal(int sig,
                         siginfo_t* info,
                         void* ucVoid,
--- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -116,7 +116,7 @@
   ShouldNotCallThis();
 }
 
-extern "C" int
+extern "C" JNIEXPORT int
 JVM_handle_linux_signal(int sig,
                         siginfo_t* info,
                         void* ucVoid,
--- a/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,14 +35,12 @@
 inline void Atomic::store    (jbyte    store_value, jbyte*    dest) { *dest = store_value; }
 inline void Atomic::store    (jshort   store_value, jshort*   dest) { *dest = store_value; }
 inline void Atomic::store    (jint     store_value, jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
 inline void Atomic::store_ptr(intptr_t store_value, intptr_t* dest) { *dest = store_value; }
 inline void Atomic::store_ptr(void*    store_value, void*     dest) { *(void**)dest = store_value; }
 
 inline void Atomic::store    (jbyte    store_value, volatile jbyte*    dest) { *dest = store_value; }
 inline void Atomic::store    (jshort   store_value, volatile jshort*   dest) { *dest = store_value; }
 inline void Atomic::store    (jint     store_value, volatile jint*     dest) { *dest = store_value; }
-inline void Atomic::store    (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
 inline void Atomic::store_ptr(intptr_t store_value, volatile intptr_t* dest) { *dest = store_value; }
 inline void Atomic::store_ptr(void*    store_value, volatile void*     dest) { *(void* volatile *)dest = store_value; }
 
@@ -54,8 +52,49 @@
 inline void Atomic::dec_ptr(volatile intptr_t* dest) { (void)add_ptr(-1, dest); }
 inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest); }
 
+
+#ifdef _LP64
+
+inline void Atomic::store(jlong store_value, jlong* dest) { *dest = store_value; }
+inline void Atomic::store(jlong store_value, volatile jlong* dest) { *dest = store_value; }
 inline jlong Atomic::load(volatile jlong* src) { return *src; }
 
+#else
+
+extern "C" void _Atomic_move_long_v8(volatile jlong* src, volatile jlong* dst);
+extern "C" void _Atomic_move_long_v9(volatile jlong* src, volatile jlong* dst);
+
+inline void Atomic_move_long(volatile jlong* src, volatile jlong* dst) {
+#ifdef COMPILER2
+  // Compiler2 does not support v8, it is used only for v9.
+  assert (VM_Version::v9_instructions_work(), "only supported on v9");
+  _Atomic_move_long_v9(src, dst);
+#else
+  // The branch is cheaper then emulated LDD.
+  if (VM_Version::v9_instructions_work()) {
+    _Atomic_move_long_v9(src, dst);
+  } else {
+    _Atomic_move_long_v8(src, dst);
+  }
+#endif
+}
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  Atomic_move_long(src, &dest);
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
+#endif
+
 #ifdef _GNU_SOURCE
 
 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
--- a/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,11 +77,11 @@
 inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
 inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
 inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return *p; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
 inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
 inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
 inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return *p; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
 inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
 inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
 
@@ -92,11 +92,11 @@
 inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
 inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
 inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
 inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
 
@@ -120,11 +120,11 @@
 inline void     OrderAccess::release_store_fence(volatile jbyte*   p, jbyte   v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jshort*  p, jshort  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jint*    p, jint    v) { *p = v; fence(); }
-inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { *p = v; fence(); }
+inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { release_store(p, v); fence(); }
 inline void     OrderAccess::release_store_fence(volatile jubyte*  p, jubyte  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile juint*   p, juint   v) { *p = v; fence(); }
-inline void     OrderAccess::release_store_fence(volatile julong*  p, julong  v) { *p = v; fence(); }
+inline void     OrderAccess::release_store_fence(volatile julong*  p, julong  v) { release_store(p, v); fence(); }
 inline void     OrderAccess::release_store_fence(volatile jfloat*  p, jfloat  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
 
--- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -317,9 +317,9 @@
 extern "C" void FetchNPFI () ;
 extern "C" void FetchNResume () ;
 
-extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized);
-
-int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) {
+extern "C" JNIEXPORT int
+JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
+                          int abort_if_unrecognized) {
   ucontext_t* uc = (ucontext_t*) ucVoid;
 
   Thread* t = ThreadLocalStorage::get_thread_slow();
@@ -585,6 +585,13 @@
   sigaddset(&newset, sig);
   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 
+  // Determine which sort of error to throw.  Out of swap may signal
+  // on the thread stack, which could get a mapping error when touched.
+  address addr = (address) info->si_addr;
+  if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
+    vm_exit_out_of_memory(0, "Out of swap space to map in thread stack.");
+  }
+
   VMError err(t, sig, pc, info, ucVoid);
   err.report_and_die();
 
--- a/src/os_cpu/solaris_sparc/vm/solaris_sparc.il	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_sparc/vm/solaris_sparc.il	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -152,6 +152,39 @@
         .nonvolatile
         .end
 
+  // Support for jlong Atomic::load and Atomic::store on v8.
+  //
+  // void _Atomic_move_long_v8(volatile jlong* src, volatile jlong* dst)
+  //
+  // Arguments:
+  //      src:  O0
+  //      dest: O1
+  //
+  // Overwrites O2 and O3
+
+        .inline _Atomic_move_long_v8,2
+        .volatile
+        ldd     [%o0], %o2
+        std     %o2, [%o1]
+        .nonvolatile
+        .end
+
+  // Support for jlong Atomic::load and Atomic::store on v9.
+  //
+  // void _Atomic_move_long_v9(volatile jlong* src, volatile jlong* dst)
+  //
+  // Arguments:
+  //      src:  O0
+  //      dest: O1
+  //
+  // Overwrites O2
+
+        .inline _Atomic_move_long_v9,2
+        .volatile
+        ldx     [%o0], %o2
+        stx     %o2, [%o1]
+        .nonvolatile
+        .end
 
   // Support for jint Atomic::add(jint add_value, volatile jint* dest).
   //
--- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -29,6 +29,7 @@
 # include <sys/auxv.h>
 # include <sys/auxv_SPARC.h>
 # include <sys/systeminfo.h>
+# include <kstat.h>
 
 // We need to keep these here as long as we have to build on Solaris
 // versions before 10.
@@ -96,11 +97,23 @@
 #ifndef AV_SPARC_ASI_BLK_INIT
 #define AV_SPARC_ASI_BLK_INIT 0x0080  /* ASI_BLK_INIT_xxx ASI */
 #endif
+    if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
+
 #ifndef AV_SPARC_FMAF
-#define AV_SPARC_FMAF 0x0100  /* Sparc64 Fused Multiply-Add */
+#define AV_SPARC_FMAF 0x0100        /* Fused Multiply-Add */
 #endif
-    if (av & AV_SPARC_ASI_BLK_INIT) features |= blk_init_instructions_m;
     if (av & AV_SPARC_FMAF)         features |= fmaf_instructions_m;
+
+#ifndef AV_SPARC_FMAU
+#define    AV_SPARC_FMAU    0x0200  /* Unfused Multiply-Add */
+#endif
+    if (av & AV_SPARC_FMAU)         features |= fmau_instructions_m;
+
+#ifndef AV_SPARC_VIS3
+#define    AV_SPARC_VIS3    0x0400  /* VIS3 instruction set extensions */
+#endif
+    if (av & AV_SPARC_VIS3)         features |= vis3_instructions_m;
+
   } else {
     // getisax(2) failed, use the old legacy code.
 #ifndef PRODUCT
@@ -140,5 +153,59 @@
   // Determine the machine type.
   do_sysinfo(SI_MACHINE, "sun4v", &features, sun4v_m);
 
+  {
+    // Using kstat to determine the machine type.
+    kstat_ctl_t* kc = kstat_open();
+    kstat_t* ksp = kstat_lookup(kc, (char*)"cpu_info", -1, NULL);
+    const char* implementation = "UNKNOWN";
+    if (ksp != NULL) {
+      if (kstat_read(kc, ksp, NULL) != -1 && ksp->ks_data != NULL) {
+        kstat_named_t* knm = (kstat_named_t *)ksp->ks_data;
+        for (int i = 0; i < ksp->ks_ndata; i++) {
+          if (strcmp((const char*)&(knm[i].name),"implementation") == 0) {
+#ifndef KSTAT_DATA_STRING
+#define KSTAT_DATA_STRING   9
+#endif
+            if (knm[i].data_type == KSTAT_DATA_CHAR) {
+              // VM is running on Solaris 8 which does not have value.str.
+              implementation = &(knm[i].value.c[0]);
+            } else if (knm[i].data_type == KSTAT_DATA_STRING) {
+              // VM is running on Solaris 10.
+#ifndef KSTAT_NAMED_STR_PTR
+              // Solaris 8 was used to build VM, define the structure it misses.
+              struct str_t {
+                union {
+                  char *ptr;     /* NULL-term string */
+                  char __pad[8]; /* 64-bit padding */
+                } addr;
+                uint32_t len;    /* # bytes for strlen + '\0' */
+              };
+#define KSTAT_NAMED_STR_PTR(knptr) (( (str_t*)&((knptr)->value) )->addr.ptr)
+#endif
+              implementation = KSTAT_NAMED_STR_PTR(&knm[i]);
+            }
+#ifndef PRODUCT
+            if (PrintMiscellaneous && Verbose) {
+              tty->print_cr("cpu_info.implementation: %s", implementation);
+            }
+#endif
+            if (strncmp(implementation, "SPARC64", 7) == 0) {
+              features |= sparc64_family_m;
+            } else if (strncmp(implementation, "UltraSPARC-T", 12) == 0) {
+              features |= T_family_m;
+              if (strncmp(implementation, "UltraSPARC-T1", 13) == 0) {
+                features |= T1_model_m;
+              }
+            }
+            break;
+          }
+        } // for(
+      }
+    }
+    assert(strcmp(implementation, "UNKNOWN") != 0,
+           "unknown cpu info (changed kstat interface?)");
+    kstat_close(kc);
+  }
+
   return features;
 }
--- a/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -151,14 +151,22 @@
   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
 }
 
-extern "C" void _Atomic_load_long(volatile jlong* src, volatile jlong* dst);
+extern "C" void _Atomic_move_long(volatile jlong* src, volatile jlong* dst);
 
 inline jlong Atomic::load(volatile jlong* src) {
   volatile jlong dest;
-  _Atomic_load_long(src, &dest);
+  _Atomic_move_long(src, &dest);
   return dest;
 }
 
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, (volatile jlong*)dest);
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  _Atomic_move_long((volatile jlong*)&store_value, dest);
+}
+
 #endif // AMD64
 
 #ifdef _GNU_SOURCE
--- a/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
 #define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
 
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "vm_version_x86.hpp"
 
@@ -80,11 +81,11 @@
 inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
 inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
 inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return *p; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
 inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
 inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
 inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return *p; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
 inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
 inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
 
@@ -95,11 +96,11 @@
 inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
 inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
 inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
 inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
 
@@ -123,11 +124,11 @@
 inline void     OrderAccess::release_store_fence(volatile jbyte*   p, jbyte   v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jshort*  p, jshort  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jint*    p, jint    v) { *p = v; fence(); }
-inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { *p = v; fence(); }
+inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { release_store(p, v); fence(); }
 inline void     OrderAccess::release_store_fence(volatile jubyte*  p, jubyte  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jushort* p, jushort v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile juint*   p, juint   v) { *p = v; fence(); }
-inline void     OrderAccess::release_store_fence(volatile julong*  p, julong  v) { *p = v; fence(); }
+inline void     OrderAccess::release_store_fence(volatile julong*  p, julong  v) { release_store(p, v); fence(); }
 inline void     OrderAccess::release_store_fence(volatile jfloat*  p, jfloat  v) { *p = v; fence(); }
 inline void     OrderAccess::release_store_fence(volatile jdouble* p, jdouble v) { *p = v; fence(); }
 
--- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -365,8 +365,6 @@
 
 }
 
-extern "C" int JVM_handle_solaris_signal(int signo, siginfo_t* siginfo, void* ucontext, int abort_if_unrecognized);
-
 extern "C" void Fetch32PFI () ;
 extern "C" void Fetch32Resume () ;
 #ifdef AMD64
@@ -374,7 +372,9 @@
 extern "C" void FetchNResume () ;
 #endif // AMD64
 
-int JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid, int abort_if_unrecognized) {
+extern "C" JNIEXPORT int
+JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
+                          int abort_if_unrecognized) {
   ucontext_t* uc = (ucontext_t*) ucVoid;
 
 #ifndef AMD64
@@ -742,6 +742,13 @@
   sigaddset(&newset, sig);
   sigprocmask(SIG_UNBLOCK, &newset, NULL);
 
+  // Determine which sort of error to throw.  Out of swap may signal
+  // on the thread stack, which could get a mapping error when touched.
+  address addr = (address) info->si_addr;
+  if (sig == SIGBUS && info->si_code == BUS_OBJERR && info->si_errno == ENOMEM) {
+    vm_exit_out_of_memory(0, "Out of swap space to map in thread stack.");
+  }
+
   VMError err(t, sig, pc, info, ucVoid);
   err.report_and_die();
 
--- a/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/solaris_x86/vm/solaris_x86_32.il	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -104,8 +104,9 @@
       popl     %ebx
       .end
 
-  // Support for void Atomic::load(volatile jlong* src, volatile jlong* dest).
-      .inline _Atomic_load_long,2
+  // Support for jlong Atomic::load and Atomic::store.
+  // void _Atomic_move_long(volatile jlong* src, volatile jlong* dst)
+      .inline _Atomic_move_long,2
       movl     0(%esp), %eax   // src
       fildll    (%eax)
       movl     4(%esp), %eax   // dest
--- a/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,10 +137,10 @@
   return (void*)cmpxchg((jlong)exchange_value, (volatile jlong*)dest, (jlong)compare_value);
 }
 
+inline jlong Atomic::load(volatile jlong* src) { return *src; }
+
 #else // !AMD64
 
-//inline void Atomic::store    (jlong    store_value, jlong*    dest) { *dest = store_value; }
-//inline void Atomic::store  (jlong    store_value, volatile jlong*    dest) { *dest = store_value; }
 inline jint     Atomic::add    (jint     add_value, volatile jint*     dest) {
   int mp = os::is_MP();
   __asm {
@@ -254,6 +254,33 @@
 inline void*    Atomic::cmpxchg_ptr(void*    exchange_value, volatile void*     dest, void*    compare_value) {
   return (void*)cmpxchg((jint)exchange_value, (volatile jint*)dest, (jint)compare_value);
 }
+
+inline jlong Atomic::load(volatile jlong* src) {
+  volatile jlong dest;
+  volatile jlong* pdest = &dest;
+  __asm {
+    mov eax, src
+    fild     qword ptr [eax]
+    mov eax, pdest
+    fistp    qword ptr [eax]
+  }
+  return dest;
+}
+
+inline void Atomic::store(jlong store_value, volatile jlong* dest) {
+  volatile jlong* src = &store_value;
+  __asm {
+    mov eax, src
+    fild     qword ptr [eax]
+    mov eax, dest
+    fistp    qword ptr [eax]
+  }
+}
+
+inline void Atomic::store(jlong store_value, jlong* dest) {
+  Atomic::store(store_value, (volatile jlong*)dest);
+}
+
 #endif // AMD64
 
 #pragma warning(default: 4035) // Enables warnings reporting missing return statement
--- a/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
 #define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
 
+#include "runtime/atomic.hpp"
 #include "runtime/orderAccess.hpp"
 #include "vm_version_x86.hpp"
 
@@ -65,11 +66,11 @@
 inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
 inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
 inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return *p; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
 inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
 inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
 inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return *p; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
 inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
 inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return *p; }
 
@@ -80,11 +81,11 @@
 inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
 inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
 inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
 inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { *p = v; }
 
@@ -188,7 +189,7 @@
 #endif // AMD64
 }
 
-inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { *p = v; fence(); }
+inline void     OrderAccess::release_store_fence(volatile jlong*   p, jlong   v) { release_store(p, v); fence(); }
 
 inline void     OrderAccess::release_store_fence(volatile jubyte*  p, jubyte  v) { release_store_fence((volatile jbyte*)p,  (jbyte)v);  }
 inline void     OrderAccess::release_store_fence(volatile jushort* p, jushort v) { release_store_fence((volatile jshort*)p, (jshort)v); }
--- a/src/share/vm/adlc/dict2.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/adlc/dict2.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -34,7 +34,7 @@
 #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 short xsum[MAXID + 1];
+static short xsum[MAXID];
 
 //------------------------------bucket---------------------------------------
 class bucket {
@@ -66,7 +66,7 @@
   // Precompute table of null character hashes
   if( !initflag ) {             // Not initializated yet?
     xsum[0] = (1<<shft[0])+1;   // Initialize
-    for( i = 1; i < MAXID + 1; i++) {
+    for( i = 1; i < MAXID; i++) {
       xsum[i] = (1<<shft[i])+1+xsum[i-1];
     }
     initflag = 1;               // Never again
@@ -291,7 +291,7 @@
     c = (c<<1)+1;               // Characters are always odd!
     sum += c + (c<<shft[k++]);  // Universal hash function
   }
-  assert( k < (MAXID + 1), "Exceeded maximum name length");
+  assert( k < (MAXID), "Exceeded maximum name length");
   return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
 }
 
--- a/src/share/vm/asm/assembler.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/asm/assembler.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -37,6 +37,12 @@
 #ifdef TARGET_ARCH_zero
 # include "assembler_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+#endif
 
 
 // Implementation of AbstractAssembler
--- a/src/share/vm/asm/assembler.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/asm/assembler.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -43,6 +43,14 @@
 # include "register_zero.hpp"
 # include "vm_version_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "register_arm.hpp"
+# include "vm_version_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "register_ppc.hpp"
+# include "vm_version_ppc.hpp"
+#endif
 
 // This file contains platform-independent assembler declarations.
 
@@ -395,6 +403,12 @@
 #ifdef TARGET_ARCH_zero
 # include "assembler_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.hpp"
+#endif
 
 
 #endif // SHARE_VM_ASM_ASSEMBLER_HPP
--- a/src/share/vm/asm/codeBuffer.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/asm/codeBuffer.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -566,6 +566,12 @@
 #ifdef TARGET_ARCH_zero
 # include "codeBuffer_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "codeBuffer_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "codeBuffer_ppc.hpp"
+#endif
 
 };
 
--- a/src/share/vm/c1/c1_Canonicalizer.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Canonicalizer.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -898,4 +898,4 @@
 void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
-
+void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {}
--- a/src/share/vm/c1/c1_Canonicalizer.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Canonicalizer.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,6 +102,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 #endif // SHARE_VM_C1_C1_CANONICALIZER_HPP
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -476,18 +476,12 @@
 
 
 
-class ArrayStoreExceptionStub: public CodeStub {
+class ArrayStoreExceptionStub: public SimpleExceptionStub {
  private:
   CodeEmitInfo* _info;
 
  public:
-  ArrayStoreExceptionStub(CodeEmitInfo* info);
-  virtual void emit_code(LIR_Assembler* emit);
-  virtual CodeEmitInfo* info() const             { return _info; }
-  virtual bool is_exception_throw_stub() const   { return true; }
-  virtual void visit(LIR_OpVisitState* visitor) {
-    visitor->do_slow_case(_info);
-  }
+  ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
 #ifndef PRODUCT
   virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
 #endif // PRODUCT
--- a/src/share/vm/c1/c1_Compilation.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Compilation.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -245,7 +245,7 @@
 }
 
 
-void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
+bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
   // Preinitialize the consts section to some large size:
   int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
   char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
@@ -253,15 +253,20 @@
                                         locs_buffer_size / sizeof(relocInfo));
   code->initialize_consts_size(Compilation::desired_max_constant_size());
   // Call stubs + two deopt handlers (regular and MH) + exception handler
-  code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) +
-                              LIR_Assembler::exception_handler_size +
-                              2 * LIR_Assembler::deopt_handler_size);
+  int stub_size = (call_stub_estimate * LIR_Assembler::call_stub_size) +
+                   LIR_Assembler::exception_handler_size +
+                   (2 * LIR_Assembler::deopt_handler_size);
+  if (stub_size >= code->insts_capacity()) return false;
+  code->initialize_stubs_size(stub_size);
+  return true;
 }
 
 
 int Compilation::emit_code_body() {
   // emit code
-  setup_code_buffer(code(), allocator()->num_calls());
+  if (!setup_code_buffer(code(), allocator()->num_calls())) {
+    BAILOUT_("size requested greater than avail code buffer size", 0);
+  }
   code()->initialize_oop_recorder(env()->oop_recorder());
 
   _masm = new C1_MacroAssembler(code());
--- a/src/share/vm/c1/c1_Compilation.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Compilation.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -192,7 +192,7 @@
     return desired_max_code_buffer_size() / 10;
   }
 
-  static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate);
+  static bool setup_code_buffer(CodeBuffer* cb, int call_stub_estimate);
 
   // timers
   static void print_timers();
--- a/src/share/vm/c1/c1_Defs.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Defs.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -35,6 +35,12 @@
 #ifdef TARGET_ARCH_zero
 # include "register_zero.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "register_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "register_ppc.hpp"
+#endif
 
 // set frame size and return address offset to these values in blobs
 // (if the compiled frame uses ebp as link pointer on IA; otherwise,
@@ -50,6 +56,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_Defs_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_Defs_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_Defs_ppc.hpp"
+#endif
 
 
 // native word offsets from memory address
--- a/src/share/vm/c1/c1_FpuStackSim.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_FpuStackSim.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -38,6 +38,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_FpuStackSim_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_FpuStackSim_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_FpuStackSim_ppc.hpp"
+#endif
 
 
 #endif // SHARE_VM_C1_C1_FPUSTACKSIM_HPP
--- a/src/share/vm/c1/c1_FrameMap.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_FrameMap.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -35,6 +35,12 @@
 #ifdef TARGET_ARCH_zero
 # include "vmreg_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "vmreg_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "vmreg_ppc.inline.hpp"
+#endif
 
 
 
@@ -92,7 +98,7 @@
     if (opr->is_address()) {
       LIR_Address* addr = opr->as_address_ptr();
       assert(addr->disp() == (int)addr->disp(), "out of range value");
-      out_preserve = MAX2(out_preserve, (intptr_t)addr->disp() / 4);
+      out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
     }
     i += type2size[t];
   }
@@ -143,7 +149,7 @@
     args->append(opr);
     if (opr->is_address()) {
       LIR_Address* addr = opr->as_address_ptr();
-      out_preserve = MAX2(out_preserve, (intptr_t)addr->disp() / 4);
+      out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
     }
     i += type2size[t];
   }
--- a/src/share/vm/c1/c1_FrameMap.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_FrameMap.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -88,6 +88,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_FrameMap_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_FrameMap_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_FrameMap_ppc.hpp"
+#endif
 
 
   friend class LIR_OprDesc;
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -319,24 +319,24 @@
 
       case Bytecodes::_tableswitch: {
         // set block for each case
-        Bytecode_tableswitch *switch_ = Bytecode_tableswitch_at(s.cur_bcp());
-        int l = switch_->length();
+        Bytecode_tableswitch sw(&s);
+        int l = sw.length();
         for (int i = 0; i < l; i++) {
-          make_block_at(cur_bci + switch_->dest_offset_at(i), current);
+          make_block_at(cur_bci + sw.dest_offset_at(i), current);
         }
-        make_block_at(cur_bci + switch_->default_offset(), current);
+        make_block_at(cur_bci + sw.default_offset(), current);
         current = NULL;
         break;
       }
 
       case Bytecodes::_lookupswitch: {
         // set block for each case
-        Bytecode_lookupswitch *switch_ = Bytecode_lookupswitch_at(s.cur_bcp());
-        int l = switch_->number_of_pairs();
+        Bytecode_lookupswitch sw(&s);
+        int l = sw.number_of_pairs();
         for (int i = 0; i < l; i++) {
-          make_block_at(cur_bci + switch_->pair_at(i)->offset(), current);
+          make_block_at(cur_bci + sw.pair_at(i).offset(), current);
         }
-        make_block_at(cur_bci + switch_->default_offset(), current);
+        make_block_at(cur_bci + sw.default_offset(), current);
         current = NULL;
         break;
       }
@@ -1275,15 +1275,15 @@
 
 
 void GraphBuilder::table_switch() {
-  Bytecode_tableswitch* switch_ = Bytecode_tableswitch_at(method()->code() + bci());
-  const int l = switch_->length();
+  Bytecode_tableswitch sw(stream());
+  const int l = sw.length();
   if (CanonicalizeNodes && l == 1) {
     // total of 2 successors => use If instead of switch
     // Note: This code should go into the canonicalizer as soon as it can
     //       can handle canonicalized forms that contain more than one node.
-    Value key = append(new Constant(new IntConstant(switch_->low_key())));
-    BlockBegin* tsux = block_at(bci() + switch_->dest_offset_at(0));
-    BlockBegin* fsux = block_at(bci() + switch_->default_offset());
+    Value key = append(new Constant(new IntConstant(sw.low_key())));
+    BlockBegin* tsux = block_at(bci() + sw.dest_offset_at(0));
+    BlockBegin* fsux = block_at(bci() + sw.default_offset());
     bool is_bb = tsux->bci() < bci() || fsux->bci() < bci();
     ValueStack* state_before = is_bb ? copy_state_before() : NULL;
     append(new If(ipop(), If::eql, true, key, tsux, fsux, state_before, is_bb));
@@ -1293,29 +1293,29 @@
     int i;
     bool has_bb = false;
     for (i = 0; i < l; i++) {
-      sux->at_put(i, block_at(bci() + switch_->dest_offset_at(i)));
-      if (switch_->dest_offset_at(i) < 0) has_bb = true;
+      sux->at_put(i, block_at(bci() + sw.dest_offset_at(i)));
+      if (sw.dest_offset_at(i) < 0) has_bb = true;
     }
     // add default successor
-    sux->at_put(i, block_at(bci() + switch_->default_offset()));
+    sux->at_put(i, block_at(bci() + sw.default_offset()));
     ValueStack* state_before = has_bb ? copy_state_before() : NULL;
-    append(new TableSwitch(ipop(), sux, switch_->low_key(), state_before, has_bb));
+    append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb));
   }
 }
 
 
 void GraphBuilder::lookup_switch() {
-  Bytecode_lookupswitch* switch_ = Bytecode_lookupswitch_at(method()->code() + bci());
-  const int l = switch_->number_of_pairs();
+  Bytecode_lookupswitch sw(stream());
+  const int l = sw.number_of_pairs();
   if (CanonicalizeNodes && l == 1) {
     // total of 2 successors => use If instead of switch
     // Note: This code should go into the canonicalizer as soon as it can
     //       can handle canonicalized forms that contain more than one node.
     // simplify to If
-    LookupswitchPair* pair = switch_->pair_at(0);
-    Value key = append(new Constant(new IntConstant(pair->match())));
-    BlockBegin* tsux = block_at(bci() + pair->offset());
-    BlockBegin* fsux = block_at(bci() + switch_->default_offset());
+    LookupswitchPair pair = sw.pair_at(0);
+    Value key = append(new Constant(new IntConstant(pair.match())));
+    BlockBegin* tsux = block_at(bci() + pair.offset());
+    BlockBegin* fsux = block_at(bci() + sw.default_offset());
     bool is_bb = tsux->bci() < bci() || fsux->bci() < bci();
     ValueStack* state_before = is_bb ? copy_state_before() : NULL;
     append(new If(ipop(), If::eql, true, key, tsux, fsux, state_before, is_bb));
@@ -1326,13 +1326,13 @@
     int i;
     bool has_bb = false;
     for (i = 0; i < l; i++) {
-      LookupswitchPair* pair = switch_->pair_at(i);
-      if (pair->offset() < 0) has_bb = true;
-      sux->at_put(i, block_at(bci() + pair->offset()));
-      keys->at_put(i, pair->match());
+      LookupswitchPair pair = sw.pair_at(i);
+      if (pair.offset() < 0) has_bb = true;
+      sux->at_put(i, block_at(bci() + pair.offset()));
+      keys->at_put(i, pair.match());
     }
     // add default successor
-    sux->at_put(i, block_at(bci() + switch_->default_offset()));
+    sux->at_put(i, block_at(bci() + sw.default_offset()));
     ValueStack* state_before = has_bb ? copy_state_before() : NULL;
     append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb));
   }
@@ -1396,6 +1396,13 @@
   if (continuation() != NULL) {
     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
 
+    if (compilation()->env()->dtrace_method_probes()) {
+      // Report exit from inline methods
+      Values* args = new Values(1);
+      args->push(append(new Constant(new ObjectConstant(method()))));
+      append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
+    }
+
     // If the inlined method is synchronized, the monitor must be
     // released before we jump to the continuation block.
     if (method()->is_synchronized()) {
@@ -3301,6 +3308,13 @@
   Value exception = append_with_bci(new ExceptionObject(), SynchronizationEntryBCI);
   assert(exception->is_pinned(), "must be");
 
+  if (compilation()->env()->dtrace_method_probes()) {
+    // Report exit from inline methods
+    Values* args = new Values(1);
+    args->push(append(new Constant(new ObjectConstant(method()))));
+    append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
+  }
+
   int bci = SynchronizationEntryBCI;
   if (lock) {
     assert(state()->locks_size() > 0 && state()->lock_at(state()->locks_size() - 1) == lock, "lock is missing");
@@ -3486,6 +3500,11 @@
     inline_sync_entry(lock, sync_handler);
   }
 
+  if (compilation()->env()->dtrace_method_probes()) {
+    Values* args = new Values(1);
+    args->push(append(new Constant(new ObjectConstant(method()))));
+    append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
+  }
 
   BlockBegin* callee_start_block = block_at(0);
   if (callee_start_block != NULL) {
--- a/src/share/vm/c1/c1_Instruction.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Instruction.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,7 @@
 class         UnsafePrefetchWrite;
 class   ProfileCall;
 class   ProfileInvoke;
+class   RuntimeCall;
 
 // A Value is a reference to the instruction creating the value
 typedef Instruction* Value;
@@ -202,6 +203,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
+  virtual void do_RuntimeCall    (RuntimeCall*     x) = 0;
 };
 
 
@@ -314,6 +316,8 @@
     return res;
   }
 
+  static const int no_bci = -99;
+
   enum InstructionFlag {
     NeedsNullCheckFlag = 0,
     CanTrapFlag,
@@ -2267,6 +2271,38 @@
   virtual void input_values_do(ValueVisitor* f)   { if (_recv != NULL) f->visit(&_recv); }
 };
 
+
+// Call some C runtime function that doesn't safepoint,
+// optionally passing the current thread as the first argument.
+LEAF(RuntimeCall, Instruction)
+ private:
+  const char* _entry_name;
+  address     _entry;
+  Values*     _args;
+  bool        _pass_thread;  // Pass the JavaThread* as an implicit first argument
+
+ public:
+  RuntimeCall(ValueType* type, const char* entry_name, address entry, Values* args, bool pass_thread = true)
+    : Instruction(type)
+    , _entry(entry)
+    , _args(args)
+    , _entry_name(entry_name)
+    , _pass_thread(pass_thread) {
+    ASSERT_VALUES
+    pin();
+  }
+
+  const char* entry_name() const  { return _entry_name; }
+  address entry() const           { return _entry; }
+  int number_of_arguments() const { return _args->length(); }
+  Value argument_at(int i) const  { return _args->at(i); }
+  bool pass_thread() const        { return _pass_thread; }
+
+  virtual void input_values_do(ValueVisitor* f)   {
+    for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
+  }
+};
+
 // Use to trip invocation counter of an inlined method
 
 LEAF(ProfileInvoke, Instruction)
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -841,4 +841,13 @@
 
 }
 
+void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
+  output()->print("call_rt %s(", x->entry_name());
+  for (int i = 0; i < x->number_of_arguments(); i++) {
+    if (i > 0) output()->print(", ");
+    print_value(x->argument_at(i));
+  }
+  output()->put(')');
+}
+
 #endif // PRODUCT
--- a/src/share/vm/c1/c1_InstructionPrinter.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_InstructionPrinter.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,6 +131,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 #endif // PRODUCT
 
--- a/src/share/vm/c1/c1_LIR.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIR.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -396,7 +396,7 @@
   , _should_profile(false)
 {
   if (code == lir_store_check) {
-    _stub = new ArrayStoreExceptionStub(info_for_exception);
+    _stub = new ArrayStoreExceptionStub(object, info_for_exception);
     assert(info_for_exception != NULL, "store_check throws exceptions");
   } else {
     ShouldNotReachHere();
--- a/src/share/vm/c1/c1_LIR.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIR.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1568,15 +1568,16 @@
     assert(code == lir_cmp, "code check");
   }
 
-  LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result)
+  LIR_Op2(LIR_Code code, LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result, BasicType type)
     : LIR_Op(code, result, NULL)
     , _opr1(opr1)
     , _opr2(opr2)
-    , _type(T_ILLEGAL)
+    , _type(type)
     , _condition(condition)
     , _fpu_stack_size(0)
     , _tmp(LIR_OprFact::illegalOpr) {
     assert(code == lir_cmove, "code check");
+    assert(type != T_ILLEGAL, "cmove should have type");
   }
 
   LIR_Op2(LIR_Code code, LIR_Opr opr1, LIR_Opr opr2, LIR_Opr result = LIR_OprFact::illegalOpr,
@@ -1993,8 +1994,8 @@
   void cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info);
   void cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Address* addr, CodeEmitInfo* info);
 
-  void cmove(LIR_Condition condition, LIR_Opr src1, LIR_Opr src2, LIR_Opr dst) {
-    append(new LIR_Op2(lir_cmove, condition, src1, src2, dst));
+  void cmove(LIR_Condition condition, LIR_Opr src1, LIR_Opr src2, LIR_Opr dst, BasicType type) {
+    append(new LIR_Op2(lir_cmove, condition, src1, src2, dst, type));
   }
 
   void cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
--- a/src/share/vm/c1/c1_LIRAssembler.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIRAssembler.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -42,6 +42,14 @@
 # include "nativeInst_zero.hpp"
 # include "vmreg_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "nativeInst_arm.hpp"
+# include "vmreg_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "nativeInst_ppc.hpp"
+# include "vmreg_ppc.inline.hpp"
+#endif
 
 
 void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
@@ -685,7 +693,7 @@
       break;
 
     case lir_cmove:
-      cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->result_opr());
+      cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->type());
       break;
 
     case lir_shl:
--- a/src/share/vm/c1/c1_LIRAssembler.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIRAssembler.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -217,7 +217,7 @@
   void volatile_move_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info);
   void comp_mem_op(LIR_Opr src, LIR_Opr result, BasicType type, CodeEmitInfo* info);  // info set for null exceptions
   void comp_fl2i(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr result, LIR_Op2* op);
-  void cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr result);
+  void cmove(LIR_Condition code, LIR_Opr left, LIR_Opr right, LIR_Opr result, BasicType type);
 
   void call(        LIR_OpJavaCall* op, relocInfo::relocType rtype);
   void ic_call(     LIR_OpJavaCall* op);
@@ -252,6 +252,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_LIRAssembler_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_LIRAssembler_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_LIRAssembler_ppc.hpp"
+#endif
 
 };
 
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -856,7 +856,7 @@
     __ cmove(lir_cond(cond),
              LIR_OprFact::intptrConst(taken_count_offset),
              LIR_OprFact::intptrConst(not_taken_count_offset),
-             data_offset_reg);
+             data_offset_reg, as_BasicType(if_instr->x()->type()));
 
     // MDO cells are intptr_t, so the data_reg width is arch-dependent.
     LIR_Opr data_reg = new_pointer_register();
@@ -1990,9 +1990,8 @@
 
   LIR_Opr reg = reg = rlock_result(x, x->basic_type());
 
+  get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile());
   if (x->is_volatile() && os::is_MP()) __ membar_acquire();
-  get_Object_unsafe(reg, src.result(), off.result(), type, x->is_volatile());
-  if (x->is_volatile() && os::is_MP()) __ membar();
 }
 
 
@@ -2014,6 +2013,7 @@
 
   if (x->is_volatile() && os::is_MP()) __ membar_release();
   put_Object_unsafe(src.result(), off.result(), data.result(), type, x->is_volatile());
+  if (x->is_volatile() && os::is_MP()) __ membar();
 }
 
 
@@ -2591,7 +2591,7 @@
   LIR_Opr reg = rlock_result(x);
 
   __ cmp(lir_cond(x->cond()), left.result(), right.result());
-  __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg);
+  __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
 }
 
 
@@ -2741,6 +2741,31 @@
   }
 }
 
+void LIRGenerator::do_RuntimeCall(RuntimeCall* x) {
+  LIR_OprList* args = new LIR_OprList(x->number_of_arguments());
+  BasicTypeList* signature = new BasicTypeList(x->number_of_arguments());
+
+  if (x->pass_thread()) {
+    signature->append(T_ADDRESS);
+    args->append(getThreadPointer());
+  }
+
+  for (int i = 0; i < x->number_of_arguments(); i++) {
+    Value a = x->argument_at(i);
+    LIRItem* item = new LIRItem(a, this);
+    item->load_item();
+    args->append(item->result());
+    signature->append(as_BasicType(a->type()));
+  }
+
+  LIR_Opr result = call_runtime(signature, args, x->entry(), x->type(), NULL);
+  if (x->type() == voidType) {
+    set_no_result(x);
+  } else {
+    __ move(result, rlock_result(x));
+  }
+}
+
 LIR_Opr LIRGenerator::call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info) {
   LIRItemList args(1);
   LIRItem value(arg1, this);
--- a/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,6 +522,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 
--- a/src/share/vm/c1/c1_LinearScan.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LinearScan.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -41,6 +41,12 @@
 #ifdef TARGET_ARCH_zero
 # include "vmreg_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "vmreg_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "vmreg_ppc.inline.hpp"
+#endif
 
 
 #ifndef PRODUCT
@@ -90,6 +96,7 @@
  , _intervals(0)   // initialized later with correct length
  , _new_intervals_from_allocation(new IntervalList())
  , _sorted_intervals(NULL)
+ , _needs_full_resort(false)
  , _lir_ops(0)     // initialized later with correct length
  , _block_of_op(0) // initialized later with correct length
  , _has_info(0)
@@ -1520,6 +1527,14 @@
 void LinearScan::sort_intervals_before_allocation() {
   TIME_LINEAR_SCAN(timer_sort_intervals_before);
 
+  if (_needs_full_resort) {
+    // There is no known reason why this should occur but just in case...
+    assert(false, "should never occur");
+    // Re-sort existing interval list because an Interval::from() has changed
+    _sorted_intervals->sort(interval_cmp);
+    _needs_full_resort = false;
+  }
+
   IntervalList* unsorted_list = &_intervals;
   int unsorted_len = unsorted_list->length();
   int sorted_len = 0;
@@ -1559,11 +1574,18 @@
     }
   }
   _sorted_intervals = sorted_list;
+  assert(is_sorted(_sorted_intervals), "intervals unsorted");
 }
 
 void LinearScan::sort_intervals_after_allocation() {
   TIME_LINEAR_SCAN(timer_sort_intervals_after);
 
+  if (_needs_full_resort) {
+    // Re-sort existing interval list because an Interval::from() has changed
+    _sorted_intervals->sort(interval_cmp);
+    _needs_full_resort = false;
+  }
+
   IntervalArray* old_list      = _sorted_intervals;
   IntervalList*  new_list      = _new_intervals_from_allocation;
   int old_len = old_list->length();
@@ -1571,6 +1593,7 @@
 
   if (new_len == 0) {
     // no intervals have been added during allocation, so sorted list is already up to date
+    assert(is_sorted(_sorted_intervals), "intervals unsorted");
     return;
   }
 
@@ -1593,6 +1616,7 @@
   }
 
   _sorted_intervals = combined_list;
+  assert(is_sorted(_sorted_intervals), "intervals unsorted");
 }
 
 
@@ -1825,6 +1849,8 @@
       interval = interval->split(from_op_id);
       interval->assign_reg(reg, regHi);
       append_interval(interval);
+    } else {
+      _needs_full_resort = true;
     }
     assert(interval->from() == from_op_id, "must be true now");
 
@@ -4492,7 +4518,8 @@
     }
   } else {
     type_name = type2name(type());
-    if (assigned_reg() != -1) {
+    if (assigned_reg() != -1 &&
+        (LinearScan::num_physical_regs(type()) == 1 || assigned_regHi() != -1)) {
       opr = LinearScan::calc_operand_for_interval(this);
     }
   }
--- a/src/share/vm/c1/c1_LinearScan.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_LinearScan.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -148,6 +148,7 @@
   IntervalList              _intervals;         // mapping from register number to interval
   IntervalList*             _new_intervals_from_allocation; // list with all intervals created during allocation when an existing interval is split
   IntervalArray*            _sorted_intervals;  // intervals sorted by Interval::from()
+  bool                      _needs_full_resort; // set to true if an Interval::from() is changed and _sorted_intervals must be resorted
 
   LIR_OpArray               _lir_ops;           // mapping from LIR_Op id to LIR_Op node
   BlockBeginArray           _block_of_op;       // mapping from LIR_Op id to the BlockBegin containing this instruction
@@ -971,6 +972,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_LinearScan_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_LinearScan_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_LinearScan_ppc.hpp"
+#endif
 
 
 #endif // SHARE_VM_C1_C1_LINEARSCAN_HPP
--- a/src/share/vm/c1/c1_MacroAssembler.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_MacroAssembler.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -35,6 +35,12 @@
 #ifdef TARGET_ARCH_zero
 # include "assembler_zero.inline.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "assembler_arm.inline.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "assembler_ppc.inline.hpp"
+#endif
 
 class CodeEmitInfo;
 
@@ -61,6 +67,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_MacroAssembler_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_MacroAssembler_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_MacroAssembler_ppc.hpp"
+#endif
 
 };
 
--- a/src/share/vm/c1/c1_Optimizer.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Optimizer.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -496,6 +496,7 @@
   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   void do_ProfileCall    (ProfileCall*     x);
   void do_ProfileInvoke  (ProfileInvoke*   x);
+  void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 
@@ -664,6 +665,7 @@
 void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void NullCheckVisitor::do_ProfileCall    (ProfileCall*     x) { nce()->clear_last_explicit_null_check(); }
 void NullCheckVisitor::do_ProfileInvoke  (ProfileInvoke*   x) {}
+void NullCheckVisitor::do_RuntimeCall    (RuntimeCall*     x) {}
 
 
 void NullCheckEliminator::visit(Value* p) {
--- a/src/share/vm/c1/c1_Runtime1.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Runtime1.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -339,8 +339,10 @@
 JRT_END
 
 
-JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread))
-  THROW(vmSymbolHandles::java_lang_ArrayStoreException());
+JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
+  ResourceMark rm(thread);
+  const char* klass_name = Klass::cast(obj->klass())->external_name();
+  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
 JRT_END
 
 
@@ -369,7 +371,7 @@
   if (branch_bci != InvocationEntryBci) {
     // Compute desination bci
     address pc = method()->code_base() + branch_bci;
-    Bytecodes::Code branch = Bytecodes::code_at(pc, method());
+    Bytecodes::Code branch = Bytecodes::code_at(method(), pc);
     int offset = 0;
     switch (branch) {
       case Bytecodes::_if_icmplt: case Bytecodes::_iflt:
@@ -659,14 +661,14 @@
 
 
 static klassOop resolve_field_return_klass(methodHandle caller, int bci, TRAPS) {
-  Bytecode_field* field_access = Bytecode_field_at(caller, bci);
+  Bytecode_field field_access(caller, bci);
   // This can be static or non-static field access
-  Bytecodes::Code code       = field_access->code();
+  Bytecodes::Code code       = field_access.code();
 
   // We must load class, initialize class and resolvethe field
   FieldAccessInfo result; // initialize class if needed
   constantPoolHandle constants(THREAD, caller->constants());
-  LinkResolver::resolve_field(result, constants, field_access->index(), Bytecodes::java_code(code), false, CHECK_NULL);
+  LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK_NULL);
   return result.klass()();
 }
 
@@ -767,7 +769,7 @@
 
   Events::log("patch_code @ " INTPTR_FORMAT , caller_frame.pc());
 
-  Bytecodes::Code code = Bytecode_at(caller_method->bcp_from(bci))->java_code();
+  Bytecodes::Code code = caller_method()->java_code_at(bci);
 
 #ifndef PRODUCT
   // this is used by assertions in the access_field_patching_id
@@ -779,11 +781,11 @@
   Handle load_klass(THREAD, NULL);                // oop needed by load_klass_patching code
   if (stub_id == Runtime1::access_field_patching_id) {
 
-    Bytecode_field* field_access = Bytecode_field_at(caller_method, bci);
+    Bytecode_field field_access(caller_method, bci);
     FieldAccessInfo result; // initialize class if needed
-    Bytecodes::Code code = field_access->code();
+    Bytecodes::Code code = field_access.code();
     constantPoolHandle constants(THREAD, caller_method->constants());
-    LinkResolver::resolve_field(result, constants, field_access->index(), Bytecodes::java_code(code), false, CHECK);
+    LinkResolver::resolve_field(result, constants, field_access.index(), Bytecodes::java_code(code), false, CHECK);
     patch_field_offset = result.field_offset();
 
     // If we're patching a field which is volatile then at compile it
@@ -811,36 +813,36 @@
         }
         break;
       case Bytecodes::_new:
-        { Bytecode_new* bnew = Bytecode_new_at(caller_method->bcp_from(bci));
-          k = caller_method->constants()->klass_at(bnew->index(), CHECK);
+        { Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
+          k = caller_method->constants()->klass_at(bnew.index(), CHECK);
         }
         break;
       case Bytecodes::_multianewarray:
-        { Bytecode_multianewarray* mna = Bytecode_multianewarray_at(caller_method->bcp_from(bci));
-          k = caller_method->constants()->klass_at(mna->index(), CHECK);
+        { Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci));
+          k = caller_method->constants()->klass_at(mna.index(), CHECK);
         }
         break;
       case Bytecodes::_instanceof:
-        { Bytecode_instanceof* io = Bytecode_instanceof_at(caller_method->bcp_from(bci));
-          k = caller_method->constants()->klass_at(io->index(), CHECK);
+        { Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci));
+          k = caller_method->constants()->klass_at(io.index(), CHECK);
         }
         break;
       case Bytecodes::_checkcast:
-        { Bytecode_checkcast* cc = Bytecode_checkcast_at(caller_method->bcp_from(bci));
-          k = caller_method->constants()->klass_at(cc->index(), CHECK);
+        { Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci));
+          k = caller_method->constants()->klass_at(cc.index(), CHECK);
         }
         break;
       case Bytecodes::_anewarray:
-        { Bytecode_anewarray* anew = Bytecode_anewarray_at(caller_method->bcp_from(bci));
-          klassOop ek = caller_method->constants()->klass_at(anew->index(), CHECK);
+        { Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
+          klassOop ek = caller_method->constants()->klass_at(anew.index(), CHECK);
           k = Klass::cast(ek)->array_klass(CHECK);
         }
         break;
       case Bytecodes::_ldc:
       case Bytecodes::_ldc_w:
         {
-          Bytecode_loadconstant* cc = Bytecode_loadconstant_at(caller_method, bci);
-          k = cc->resolve_constant(CHECK);
+          Bytecode_loadconstant cc(caller_method, bci);
+          k = cc.resolve_constant(CHECK);
           assert(k != NULL && !k->is_klass(), "must be class mirror or other Java constant");
         }
         break;
--- a/src/share/vm/c1/c1_Runtime1.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_Runtime1.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,9 +143,9 @@
   static void throw_index_exception(JavaThread* thread, int index);
   static void throw_div0_exception(JavaThread* thread);
   static void throw_null_pointer_exception(JavaThread* thread);
-  static void throw_class_cast_exception(JavaThread* thread, oopDesc* obect);
+  static void throw_class_cast_exception(JavaThread* thread, oopDesc* object);
   static void throw_incompatible_class_change_error(JavaThread* thread);
-  static void throw_array_store_exception(JavaThread* thread);
+  static void throw_array_store_exception(JavaThread* thread, oopDesc* object);
 
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
--- a/src/share/vm/c1/c1_ValueMap.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_ValueMap.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -192,11 +192,12 @@
   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
   void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ }
-  void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
   void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
   void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ }
   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
+  void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
+  void do_RuntimeCall    (RuntimeCall*     x) { /* nothing to do */ };
 };
 
 
--- a/src/share/vm/c1/c1_globals.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/c1/c1_globals.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -32,6 +32,12 @@
 #ifdef TARGET_ARCH_sparc
 # include "c1_globals_sparc.hpp"
 #endif
+#ifdef TARGET_ARCH_arm
+# include "c1_globals_arm.hpp"
+#endif
+#ifdef TARGET_ARCH_ppc
+# include "c1_globals_ppc.hpp"
+#endif
 #ifdef TARGET_OS_FAMILY_linux
 # include "c1_globals_linux.hpp"
 #endif
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -233,6 +233,10 @@
 
   // compute size of arguments
   int arg_size = target->arg_size();
+  if (code == Bytecodes::_invokedynamic) {
+    assert(!target->is_static(), "receiver explicit in method");
+    arg_size--;  // implicit, not really on stack
+  }
   if (!target->is_loaded() && code == Bytecodes::_invokestatic) {
     arg_size--;
   }
@@ -250,6 +254,10 @@
     ArgumentMap arg = state._stack[i];
     skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base));
   }
+  // For now we conservatively skip invokedynamic.
+  if (code == Bytecodes::_invokedynamic) {
+    skip_callee = true;
+  }
   if (skip_callee) {
     TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8()));
     for (i = 0; i < arg_size; i++) {
@@ -761,15 +769,15 @@
       case Bytecodes::_tableswitch:
         {
           state.spop();
-          Bytecode_tableswitch* switch_ = Bytecode_tableswitch_at(s.cur_bcp());
-          int len = switch_->length();
+          Bytecode_tableswitch sw(&s);
+          int len = sw.length();
           int dest_bci;
           for (int i = 0; i < len; i++) {
-            dest_bci = s.cur_bci() + switch_->dest_offset_at(i);
+            dest_bci = s.cur_bci() + sw.dest_offset_at(i);
             assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block");
             successors.push(_methodBlocks->block_containing(dest_bci));
           }
-          dest_bci = s.cur_bci() + switch_->default_offset();
+          dest_bci = s.cur_bci() + sw.default_offset();
           assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block");
           successors.push(_methodBlocks->block_containing(dest_bci));
           assert(s.next_bci() == limit_bci, "branch must end block");
@@ -779,15 +787,15 @@
       case Bytecodes::_lookupswitch:
         {
           state.spop();
-          Bytecode_lookupswitch* switch_ = Bytecode_lookupswitch_at(s.cur_bcp());
-          int len = switch_->number_of_pairs();
+          Bytecode_lookupswitch sw(&s);
+          int len = sw.number_of_pairs();
           int dest_bci;
           for (int i = 0; i < len; i++) {
-            dest_bci = s.cur_bci() + switch_->pair_at(i)->offset();
+            dest_bci = s.cur_bci() + sw.pair_at(i).offset();
             assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block");
             successors.push(_methodBlocks->block_containing(dest_bci));
           }
-          dest_bci = s.cur_bci() + switch_->default_offset();
+          dest_bci = s.cur_bci() + sw.default_offset();
           assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block");
           successors.push(_methodBlocks->block_containing(dest_bci));
           fall_through = false;
--- a/src/share/vm/ci/ciClassList.hpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/ci/ciClassList.hpp	Tue Mar 01 15:05:39 2011 +0000
@@ -60,7 +60,6 @@
 class    ciKlass;
 class     ciInstanceKlass;
 class     ciMethodKlass;
-class     ciSymbolKlass;
 class     ciArrayKlass;
 class       ciObjArrayKlass;
 class       ciTypeArrayKlass;
@@ -112,7 +111,6 @@
 friend class ciKlass;                  \
 friend class ciInstanceKlass;          \
 friend class ciMethodKlass;            \
-friend class ciSymbolKlass;            \
 friend class ciArrayKlass;             \
 friend class ciObjArrayKlass;          \
 friend class ciTypeArrayKlass;         \
--- a/src/share/vm/ci/ciEnv.cpp	Wed Jan 05 10:06:07 2011 +0000
+++ b/src/share/vm/ci/ciEnv.cpp	Tue Mar 01 15:05:39 2011 +0000
@@ -68,7 +68,6 @@
 
 ciObject*              ciEnv::_null_object_instance;
 ciMethodKlass*         ciEnv::_method_klass_instance;
-ciSymbolKlass*         ciEnv::_symbol_klass_instance;
 ciKlassKlass*          ciEnv::_klass_klass_instance;
 ciInstanceKlassKlass*  ciEnv::_instance_klass_klass_instance;
 ciTypeArrayKlassKlass* ciEnv::_type_array_klass_klass_instance;
@@ -202,6 +201,7 @@
 
 ciEnv::~ciEnv() {
   CompilerThread* current_thread = CompilerThread::current();
+  _factory->remove_symbols();
   current_thread->set_env(NULL);
 }
 
@@ -234,7 +234,7 @@
 
 // ------------------------------------------------------------------
 // helper for lazy exception creation
-ciInstance* ciEnv::get_or_create_exception(jobject& handle, symbolHandle name) {
+ciInstance* ciEnv::get_or_create_exception(jobject& handle, Symbol* name) {
   VM_ENTRY_MARK;
   if (handle == NULL) {
     // Cf. universe.cpp, creation of Universe::_null_ptr_exception_instance.
@@ -261,7 +261,7 @@
   if (_ArrayIndexOutOfBoundsException_instance == NULL) {
     _ArrayIndexOutOfBoundsException_instance
           = get_or_create_exception(_ArrayIndexOutOfBoundsException_handle,
-          vmSymbolHandles::java_lang_ArrayIndexOutOfBoundsException());
+          vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
   }
   return _ArrayIndexOutOfBoundsException_instance;
 }
@@ -269,7 +269,7 @@
   if (_ArrayStoreException_instance == NULL) {
     _ArrayStoreException_instance
           = get_or_create_exception(_ArrayStoreException_handle,
-          vmSymbolHandles::java_lang_ArrayStoreException());
+          vmSymbols::java_lang_ArrayStoreException());
   }
   return _ArrayStoreException_instance;
 }
@@ -277,7 +277,7 @@
   if (_ClassCastException_instance == NULL) {
     _ClassCastException_instance
           = get_or_create_exception(_ClassCastException_handle,
-          vmSymbolHandles::java_lang_ClassCastException());
+          vmSymbols::java_lang_ClassCastException());
   }
   return _ClassCastException_instance;
 }
@@ -377,14 +377,16 @@
   EXCEPTION_CONTEXT;
 
   // Now we need to check the SystemDictionary
-  symbolHandle sym(THREAD, name->get_symbolOop());
+  Symbol* sym = name->get_symbol();
   if (sym->byte_at(0) == 'L' &&
     sym->byte_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
-    sym = oopFactory::new_symbol_handle(sym->as_utf8()+1,
-                                        sym->utf8_length()-2,
-                                        KILL_COMPILE_ON_FATAL_(_unloaded_ciinstance_klass));
-    name = get_object(sym())->as_symbol();
+    // Call recursive to keep scope of strippedsym.
+    TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
+                    sym->utf8_length()-2,
+                    KILL_COMPILE_ON_FATAL_(_unloaded_ciinstance_klass));
+    ciSymbol* strippedname = get_symbol(strippedsym);
+    return get_klass_by_name_impl(accessing_klass, strippedname, require_local);
   }
 
   // Check for prior unloaded klass.  The SystemDictionary's answers
@@ -409,15 +411,15 @@
   } else {
     fail_type = _unloaded_ciinstance_klass;
   }
-  klassOop found_klass;
+  KlassHandle found_klass;
   if (!require_local) {
-    found_klass =
-      SystemDictionary::find_constrained_instance_or_array_klass(sym, loader,
-                                                                 KILL_COMPILE_ON_FATAL_(fail_type));
+    klassOop kls = SystemDictionary::find_constrained_instance_or_array_klass(
+        sym, loader, KILL_COMPILE_ON_FATAL_(fail_type));
+    found_klass = KlassHandle(THREAD, kls);
   } else {
-    found_klass =
-      SystemDictionary::find_instance_or_array_klass(sym, loader, domain,
-                                                     KILL_COMPILE_ON_FATAL_(fail_type));
+    klassOop kls = SystemDictionary::find_instance_or_array_klass(
+        sym, loader, domain, KILL_COMPILE_ON_FATAL_(fail_type));
+    found_klass = KlassHandle(THREAD, kls);
   }
 
   // If we fail to find an array klass, look again for its element type.
@@ -430,13 +432,14 @@
       (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
-    symbolOop elem_sym = oopFactory::new_symbol(sym->as_utf8()+1,
-                                                sym->utf8_length()-1,
-                                                KILL_COMPILE_ON_FATAL_(fail_type));
+    TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
+                                                 sym->utf8_length()-1,
+                                                 KILL_COMPILE_ON_FATAL_(fail_type));
+
     // Get element ciKlass recursively.
     ciKlass* elem_klass =
       get_klass_by_name_impl(accessing_klass,
-                             get_object(elem_sym)->as_symbol(),
+                             get_symbol(elem_sym),
                              require_local);
     if (elem_klass != NULL && elem_klass->is_loaded()) {
       // Now make an array for it
@@ -444,9 +447,9 @@
     }
   }
 
-  if (found_klass != NULL) {
+  if (found_klass() != NULL) {
     // Found it.  Build a CI handle.
-    return get_object(found_klass)->as_klass();
+    return get_object(found_klass())->as_klass();
   }
 
   if (require_local)  return NULL;
@@ -475,7 +478,7 @@
                                         ciInstanceKlass* accessor) {
   EXCEPTION_CONTEXT;
   KlassHandle klass (THREAD, constantPoolOopDesc::klass_at_if_loaded(cpool, index));
-  symbolHandle klass_name;
+  Symbol* klass_name = NULL;
   if (klass.is_null()) {
     // The klass has not been inserted into the constant pool.
     // Try to look it up by name.
@@ -490,10 +493,10 @@
         // very recently.
         klass = KlassHandle(THREAD, cpool->resolved_klass_at(index));
       } else if (tag.is_symbol()) {
-        klass_name = symbolHandle(THREAD, cpool->symbol_at(index));
+        klass_name = cpool->symbol_at(index);
       } else {
         assert(cpool->tag_at(index).is_unresolved_klass(), "wrong tag");
-        klass_name = symbolHandle(THREAD, cpool->unresolved_klass_at(index));
+        klass_name = cpool->unresolved_klass_at(index);
       }
     }
   }
@@ -501,7 +504,7 @@
   if (klass.is_null()) {
     // Not found in constant pool.  Use the name to do the lookup.
     ciKlass* k = get_klass_by_name_impl(accessor,
-                                        get_object(klass_name())->as_symbol(),
+                                        get_symbol(klass_name),
                                         false);
     // Calculate accessibility the hard way.
     if (!k->is_loaded()) {
@@ -519,7 +522,7 @@
 
   // Check for prior unloaded klass.  The SystemDictionary's answers
   // can vary over time but the compiler needs consistency.
-  ciSymbol* name = get_object(klass()->klass_part()->name())->as_symbol();
+  ciSymbol* name = get_symbol(klass()->klass_part()->name());
   ciKlass* unloaded_klass = check_get_unloaded_klass(accessor, name);
   if (unloaded_klass != NULL) {
     is_accessible = false;
@@ -605,7 +608,7 @@
     return ciConstant(T_OBJECT, ciobj);
   } else if (tag.is_method_type()) {
     // must execute Java code to link this CP entry into cache[i].f1
-    ciSymbol* signature = get_object(cpool->method_type_signature_at(index))->as_symbol();
+    ciSymbol* signature = get_symbol(cpool->method_type_signature_at(index));
     ciObject* ciobj = get_unloaded_method_type_constant(signature);
     return ciConstant(T_OBJECT, ciobj);
   } else if (tag.is_method_handle()) {
@@ -613,8 +616,8 @@
     int ref_kind        = cpool->method_handle_ref_kind_at(index);
     int callee_index    = cpool->method_handle_klass_index_at(index);
     ciKlass* callee     = get_klass_by_index_impl(cpool, callee_index, ignore_will_link, accessor);
-    ciSymbol* name      = get_object(cpool->method_handle_name_ref_at(index))->as_symbol();
-    ciSymbol* signature = get_object(cpool->method_handle_signature_ref_at(index))->as_symbol();
+    ciSymbol* name      = get_symbol(cpool->method_handle_name_ref_at(index));
+    ciSymbol* signature = get_symbol(cpool->method_handle_signature_ref_at(index));
     ciObject* ciobj     = get_unloaded_method_handle_constant(callee, name, signature, ref_kind);
     return ciConstant(T_OBJECT, ciobj);
   } else {
@@ -674,33 +677,31 @@
 // name, signature, and bytecode.
 methodOop ciEnv::lookup_method(instanceKlass*  accessor,
                                instanceKlass*  holder,
-                               symbolOop       name,
-                               symbolOop       sig,
+                               Symbol*       name,
+                               Symbol*       sig,
                                Bytecodes::Code bc) {
   EXCEPTION_CONTEXT;
   KlassHandle h_accessor(THREAD, accessor);
   KlassHandle h_holder(THREAD, holder);
-  symbolHandle h_name(THREAD, name);
-  symbolHandle h_sig(THREAD, sig);
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
   switch (bc) {
   case Bytecodes::_invokestatic:
     dest_method =
-      LinkResolver::resolve_static_call_or_null(h_holder, h_name, h_sig, h_accessor);
+      LinkResolver::resolve_static_call_or_null(h_holder, name, sig, h_accessor);
     break;
   case Bytecodes::_invokespecial:
     dest_method =
-      LinkResolver::resolve_special_call_or_null(h_holder, h_name, h_sig, h_accessor);
+      LinkResolver::resolve_special_call_or_null(h_holder, name, sig, h_accessor);
     break;
   case Bytecodes::_invokeinterface:
     dest_method =
-      LinkResolver::linktime_resolve_interface_method_or_null(h_holder, h_name, h_sig,
+      LinkResolver::linktime_resolve_interface_method_or_null(h_holder, name, sig,
                                                               h_accessor, true);
     break;
   case Bytecodes::_invokevirtual:
     dest_method =
-      LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, h_name, h_sig,
+      LinkResolver::linktime_resolve_virtual_method_or_null(h_holder, name, sig,
                                                             h_accessor, true);
     break;
   default: ShouldNotReachHere();
@@ -721,8 +722,8 @@
   ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder);
 
   // Get the method's name and signature.
-  symbolOop name_sym = cpool->name_ref_at(index);
-  symbolOop sig_sym  = cpool->signature_ref_at(index);
+  Symbol* name_sym = cpool->name_ref_at(index);
+  Symbol* sig_sym  = cpool->signature_ref_at(index);
 
   if (holder_is_accessible) { // Our declared holder is loaded.
     instanceKlass* lookup = declared_holder->get_instanceKlass();
@@ -738,8 +739,8 @@
   // lookup.