changeset 7890:f83851ae258e

Merge
author kvn
date Thu, 26 Feb 2015 10:56:54 -0800
parents 00f3abb1f174 f717f8d3538c
children 21f64f2bbdc8
files make/linux/makefiles/build_vm_def.sh src/os/bsd/vm/dtraceJSDT_bsd.cpp src/os/linux/vm/dtraceJSDT_linux.cpp src/os/linux/vm/os_linux.cpp src/os/solaris/vm/dtraceJSDT_solaris.cpp src/os/windows/vm/dtraceJSDT_windows.cpp src/share/vm/asm/codeBuffer.hpp src/share/vm/c1/c1_LIR.cpp src/share/vm/c1/c1_LIR.hpp src/share/vm/c1/c1_LIRAssembler.hpp src/share/vm/compiler/disassembler.cpp src/share/vm/oops/oop.inline2.hpp src/share/vm/opto/graphKit.cpp src/share/vm/opto/memnode.hpp src/share/vm/opto/parse2.cpp src/share/vm/runtime/arguments.cpp src/share/vm/runtime/dtraceJSDT.cpp src/share/vm/runtime/dtraceJSDT.hpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/os.hpp src/share/vm/runtime/vmStructs.cpp src/share/vm/utilities/globalDefinitions.hpp test/serviceability/dcmd/ClassLoaderStatsTest.java test/serviceability/dcmd/DcmdUtil.java test/serviceability/dcmd/DynLibDcmdTest.java
diffstat 466 files changed, 11032 insertions(+), 7295 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Fri Feb 06 10:36:46 2015 -0800
+++ b/.hgtags	Thu Feb 26 10:56:54 2015 -0800
@@ -449,3 +449,8 @@
 43a44b56dca61a4d766a20f0528fdd8b5ceff873 jdk9-b44
 5dc8184af1e2bb30b0103113d1f1a58a21a80c37 jdk9-b45
 a184ee1d717297bd35b7c3e35393e137921a3ed2 jdk9-b46
+3b241fb72b8925b75941d612db762a6d5da66d02 jdk9-b47
+cc775a4a24c7f5d9e624b4205e9fbd48a17331f6 jdk9-b48
+360cd1fc42f10941a9fd17cc32d5b85a22d12a0b jdk9-b49
+e0947f58c9c1426aa0d98b98ebb78357b27a7b99 jdk9-b50
+403b9cbadb04d3d1201823591cf931dc93b38e3a jdk9-b51
--- a/agent/src/os/linux/ps_proc.c	Fri Feb 06 10:36:46 2015 -0800
+++ b/agent/src/os/linux/ps_proc.c	Thu Feb 26 10:56:54 2015 -0800
@@ -27,9 +27,11 @@
 #include <string.h>
 #include <signal.h>
 #include <errno.h>
+#include <elf.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <sys/ptrace.h>
+#include <sys/uio.h>
 #include "libproc_impl.h"
 
 #if defined(x86_64) && !defined(amd64)
@@ -138,6 +140,15 @@
    return false;
  }
  return true;
+#elif defined(PTRACE_GETREGSET)
+ struct iovec iov;
+ iov.iov_base = user;
+ iov.iov_len = sizeof(*user);
+ if (ptrace(PTRACE_GETREGSET, pid, NT_PRSTATUS, (void*) &iov) < 0) {
+   print_debug("ptrace(PTRACE_GETREGSET, ...) failed for lwp %d\n", pid);
+   return false;
+ }
+ return true;
 #else
  print_debug("ptrace(PTRACE_GETREGS, ...) not supported\n");
  return false;
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Fri Feb 06 10:36:46 2015 -0800
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,15 +44,22 @@
   private static synchronized void initialize(TypeDataBase db) {
     Type type = db.lookupType("SymbolTable");
     theTableField  = type.getAddressField("_the_table");
+    sharedTableField = type.getAddressField("_shared_table");
   }
 
   // Fields
   private static AddressField theTableField;
+  private static AddressField sharedTableField;
+
+  private CompactHashTable sharedTable;
 
   // Accessors
   public static SymbolTable getTheTable() {
     Address tmp = theTableField.getValue();
-    return (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
+    SymbolTable table = (SymbolTable) VMObjectFactory.newObject(SymbolTable.class, tmp);
+    Address shared = sharedTableField.getStaticFieldAddress();
+    table.sharedTable = (CompactHashTable)VMObjectFactory.newObject(CompactHashTable.class, shared);
+    return table;
   }
 
   public SymbolTable(Address addr) {
@@ -73,8 +80,9 @@
 
   /** Clone of VM's "temporary" probe routine, as the SA currently
       does not support mutation so lookup() would have no effect
-      anyway. Returns null if the given string is not in the symbol
-      table. */
+      anyway. Searches the regular symbol table and the shared symbol
+      table. Null is returned if the given name is not found in both
+      tables. */
   public Symbol probe(byte[] name) {
     long hashValue = hashSymbol(name);
     for (HashtableEntry e = (HashtableEntry) bucket(hashToIndex(hashValue)); e != null; e = (HashtableEntry) e.next()) {
@@ -85,7 +93,8 @@
          }
       }
     }
-    return null;
+
+    return sharedTable.probe(name, hashValue);
   }
 
   public interface SymbolVisitor {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Fri Feb 06 10:36:46 2015 -0800
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassWriter.java	Thu Feb 26 10:56:54 2015 -0800
@@ -423,12 +423,22 @@
 
     protected void writeMethods() throws IOException {
         MethodArray methods = klass.getMethods();
-        final int len = methods.length();
+        ArrayList<Method> valid_methods = new ArrayList<Method>();
+        for (int i = 0; i < methods.length(); i++) {
+            Method m = methods.at(i);
+            long accessFlags = m.getAccessFlags();
+            // overpass method
+            if (accessFlags == (JVM_ACC_PUBLIC | JVM_ACC_SYNTHETIC | JVM_ACC_BRIDGE)) {
+                continue;
+            }
+            valid_methods.add(m);
+        }
+        final int len = valid_methods.size();
         // write number of methods
         dos.writeShort((short) len);
         if (DEBUG) debugMessage("number of methods = " + len);
         for (int m = 0; m < len; m++) {
-            writeMethod(methods.at(m));
+            writeMethod(valid_methods.get(m));
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java	Thu Feb 26 10:56:54 2015 -0800
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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.utilities;
+
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.oops.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class CompactHashTable extends VMObject {
+  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("SymbolCompactHashTable");
+    baseAddressField = type.getAddressField("_base_address");
+    bucketCountField = type.getCIntegerField("_bucket_count");
+    tableEndOffsetField = type.getCIntegerField("_table_end_offset");
+    bucketsField = type.getAddressField("_buckets");
+    uintSize = db.lookupType("juint").getSize();
+  }
+
+  // Fields
+  private static CIntegerField bucketCountField;
+  private static CIntegerField tableEndOffsetField;
+  private static AddressField  baseAddressField;
+  private static AddressField  bucketsField;
+  private static long uintSize;
+
+  private static int BUCKET_OFFSET_MASK = 0x3FFFFFFF;
+  private static int BUCKET_TYPE_SHIFT = 30;
+  private static int COMPACT_BUCKET_TYPE = 1;
+
+  public CompactHashTable(Address addr) {
+    super(addr);
+  }
+
+  private int bucketCount() {
+    return (int)bucketCountField.getValue(addr);
+  }
+
+  private int tableEndOffset() {
+    return (int)tableEndOffsetField.getValue(addr);
+  }
+
+  private boolean isCompactBucket(int bucket_info) {
+    return (bucket_info >> BUCKET_TYPE_SHIFT) == COMPACT_BUCKET_TYPE;
+  }
+
+  private int bucketOffset(int bucket_info) {
+    return bucket_info & BUCKET_OFFSET_MASK;
+  }
+
+  public Symbol probe(byte[] name, long hash) {
+    long    symOffset;
+    Symbol  sym;
+    Address baseAddress = baseAddressField.getValue(addr);
+    Address bucket = bucketsField.getValue(addr);
+    Address bucketEnd = bucket;
+    long index = hash % bucketCount();
+    int bucketInfo = (int)bucket.getCIntegerAt(index * uintSize, uintSize, true);
+    int bucketOffset = bucketOffset(bucketInfo);
+    int nextBucketInfo = (int)bucket.getCIntegerAt((index+1) * uintSize, uintSize, true);
+    int nextBucketOffset = bucketOffset(nextBucketInfo);
+
+    bucket = bucket.addOffsetTo(bucketOffset * uintSize);
+
+    if (isCompactBucket(bucketInfo)) {
+      symOffset = bucket.getCIntegerAt(0, uintSize, true);
+      sym = Symbol.create(baseAddress.addOffsetTo(symOffset));
+      if (sym.equals(name)) {
+        return sym;
+      }
+    } else {
+      bucketEnd = bucket.addOffsetTo(nextBucketOffset * uintSize);
+      while (bucket.lessThan(bucketEnd)) {
+        long symHash = bucket.getCIntegerAt(0, uintSize, true);
+        if (symHash == hash) {
+          symOffset = bucket.getCIntegerAt(uintSize, uintSize, true);
+          Address symAddr = baseAddress.addOffsetTo(symOffset);
+          sym = Symbol.create(symAddr);
+          if (sym.equals(name)) {
+            return sym;
+          }
+        }
+        bucket = bucket.addOffsetTo(2 * uintSize);
+      }
+    }
+    return null;
+  }
+}
--- a/make/aix/Makefile	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/aix/Makefile	Thu Feb 26 10:56:54 2015 -0800
@@ -246,8 +246,7 @@
 XSLT_CHECK	= $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
 # If not found then fail fast.
 check_j2se_version:
-	$(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
-	if [ $$? -ne 0 ]; then \
+	$(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \
 	  $(REMOTE) $(RUN.JAVA) -version; \
 	  echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
 	  "to bootstrap this build" 1>&2; \
--- a/make/aix/makefiles/mapfile-vers-debug	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/aix/makefiles/mapfile-vers-debug	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/aix/makefiles/mapfile-vers-product	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/aix/makefiles/mapfile-vers-product	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -130,6 +125,7 @@
                 JVM_GetMethodIxNameUTF;
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/aix/makefiles/xlc.make	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/aix/makefiles/xlc.make	Thu Feb 26 10:56:54 2015 -0800
@@ -74,6 +74,12 @@
 # no xlc counterpart for -fcheck-new
 # CFLAGS += -fcheck-new
 
+# We need to define this on the command line if we want to use the the
+# predefined format specifiers from "inttypes.h". Otherwise system headrs
+# can indirectly include inttypes.h before we define __STDC_FORMAT_MACROS
+# in globalDefinitions.hpp
+CFLAGS += -D__STDC_FORMAT_MACROS
+
 ARCHFLAG = -q64
 
 CFLAGS     += $(ARCHFLAG)
--- a/make/bsd/Makefile	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/Makefile	Thu Feb 26 10:56:54 2015 -0800
@@ -240,8 +240,7 @@
 XSLT_CHECK	= $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
 # If not found then fail fast.
 check_j2se_version:
-	$(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
-	if [ $$? -ne 0 ]; then \
+	$(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \
 	  $(REMOTE) $(RUN.JAVA) -version; \
 	  echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
 	  "to bootstrap this build" 1>&2; \
--- a/make/bsd/makefiles/dtrace.make	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/dtrace.make	Thu Feb 26 10:56:54 2015 -0800
@@ -179,23 +179,23 @@
 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
 $(JVMOFFS).h: $(GENOFFS)
 	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -header > $@.tmp; touch $@; \
-	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
-	then rm -f $@; mv $@.tmp $@; \
-	else rm -f $@.tmp; \
+	if diff $@.tmp $@ > /dev/null 2>&1 ; \
+	then rm -f $@.tmp; \
+	else rm -f $@; mv $@.tmp $@; \
 	fi
 
 $(JVMOFFS)Index.h: $(GENOFFS)
 	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -index > $@.tmp; touch $@; \
-	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
-	then rm -f $@; mv $@.tmp $@; \
-	else rm -f $@.tmp; \
+	if diff $@.tmp $@ > /dev/null 2>&1 ; \
+	then rm -f $@.tmp; \
+	else rm -f $@; mv $@.tmp $@; \
 	fi
 
 $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
 	$(QUIETLY) DYLD_LIBRARY_PATH=.:$(DYLD_LIBRARY_PATH) ./$(GENOFFS) -table > $@.tmp; touch $@; \
-	if [ `diff $@.tmp $@ > /dev/null 2>&1; echo $$?` -ne 0 ] ; \
-	then rm -f $@; mv $@.tmp $@; \
-	else rm -f $@.tmp; \
+	if diff $@.tmp $@ > /dev/null 2>&1; \
+	then rm -f $@.tmp; \
+	else rm -f $@; mv $@.tmp $@; \
 	fi
 
 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
--- a/make/bsd/makefiles/mapfile-vers-darwin-debug	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/mapfile-vers-darwin-debug	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -60,11 +60,6 @@
                 _JVM_DefineClassWithSourceCond
                 _JVM_DesiredAssertionStatus
                 _JVM_DoPrivileged
-                _JVM_DTraceGetVersion
-                _JVM_DTraceActivate
-                _JVM_DTraceIsProbeEnabled
-                _JVM_DTraceIsSupported
-                _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
                 _JVM_FillInStackTrace
@@ -130,6 +125,7 @@
                 _JVM_GetMethodIxSignatureUTF
                 _JVM_GetMethodParameters
                 _JVM_GetMethodTypeAnnotations
+                _JVM_GetNanoTimeAdjustment
                 _JVM_GetPrimitiveArrayElement
                 _JVM_GetProtectionDomain
                 _JVM_GetStackAccessControlContext
--- a/make/bsd/makefiles/mapfile-vers-darwin-product	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/mapfile-vers-darwin-product	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -60,11 +60,6 @@
                 _JVM_DefineClassWithSourceCond
                 _JVM_DesiredAssertionStatus
                 _JVM_DoPrivileged
-                _JVM_DTraceGetVersion
-                _JVM_DTraceActivate
-                _JVM_DTraceIsProbeEnabled
-                _JVM_DTraceIsSupported
-                _JVM_DTraceDispose
                 _JVM_DumpAllStacks
                 _JVM_DumpThreads
                 _JVM_FillInStackTrace
@@ -130,6 +125,7 @@
                 _JVM_GetMethodIxSignatureUTF
                 _JVM_GetMethodParameters
                 _JVM_GetMethodTypeAnnotations
+                _JVM_GetNanoTimeAdjustment
                 _JVM_GetPrimitiveArrayElement
                 _JVM_GetProtectionDomain
                 _JVM_GetStackAccessControlContext
--- a/make/bsd/makefiles/mapfile-vers-debug	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/mapfile-vers-debug	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/bsd/makefiles/mapfile-vers-product	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/mapfile-vers-product	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/bsd/makefiles/universal.gmk	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/bsd/makefiles/universal.gmk	Thu Feb 26 10:56:54 2015 -0800
@@ -59,7 +59,7 @@
 
 # Package built libraries in a universal binary
 $(UNIVERSAL_LIPO_LIST):
-	BUILT_LIPO_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) 2>/dev/null`"; \
+	BUILT_LIPO_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) 2>/dev/null`" || test $$? = "1"; \
 	if [ -n "$${BUILT_LIPO_FILES}" ]; then \
 	  $(MKDIR) -p $(shell dirname $@); \
 	  lipo -create -output $@ $${BUILT_LIPO_FILES}; \
@@ -70,7 +70,7 @@
 # - copies directories; including empty dirs
 # - copies files, symlinks, other non-directory files
 $(UNIVERSAL_COPY_LIST):
-	BUILT_COPY_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) -prune 2>/dev/null`"; \
+	BUILT_COPY_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) -prune 2>/dev/null`" || test $$? = "1"; \
 	if [ -n "$${BUILT_COPY_FILES}" ]; then \
 	  for i in $${BUILT_COPY_FILES}; do \
 	    $(MKDIR) -p $(shell dirname $@); \
--- a/make/linux/Makefile	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/linux/Makefile	Thu Feb 26 10:56:54 2015 -0800
@@ -246,8 +246,7 @@
 XSLT_CHECK	= $(REMOTE) $(RUN.JAVAP) javax.xml.transform.TransformerFactory
 # If not found then fail fast.
 check_j2se_version:
-	$(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
-	if [ $$? -ne 0 ]; then \
+	$(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \
 	  $(REMOTE) $(RUN.JAVA) -version; \
 	  echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
 	  "to bootstrap this build" 1>&2; \
--- a/make/linux/makefiles/build_vm_def.sh	Fri Feb 06 10:36:46 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# If we're cross compiling use that path for nm
-if [ "$CROSS_COMPILE_ARCH" != "" ]; then 
-NM=$ALT_COMPILER_PATH/nm
-else
-NM=nm
-fi
-
-$NM --defined-only $* \
-    | awk '{
-              if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";"
-              if ($3 ~ /^UseSharedSpaces$/) print "\t" $3 ";"
-              if ($3 ~ /^_ZN9Arguments17SharedArchivePathE$/) print "\t" $3 ";"
-          }' \
-    | sort -u
--- a/make/linux/makefiles/mapfile-vers-debug	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/linux/makefiles/mapfile-vers-debug	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/linux/makefiles/mapfile-vers-product	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/linux/makefiles/mapfile-vers-product	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/make/linux/makefiles/vm.make	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/linux/makefiles/vm.make	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -239,8 +239,14 @@
 	rm -f $@
 	cat $^ > $@
 
+VMDEF_PAT  = ^_ZTV
+VMDEF_PAT := ^gHotSpotVM|$(VMDEF_PAT)
+VMDEF_PAT := ^UseSharedSpaces$$|$(VMDEF_PAT)
+VMDEF_PAT := ^_ZN9Arguments17SharedArchivePathE$$|$(VMDEF_PAT)
+
 vm.def: $(Res_Files) $(Obj_Files)
-	sh $(GAMMADIR)/make/linux/makefiles/build_vm_def.sh *.o > $@
+	$(QUIETLY) $(NM) --defined-only $(Obj_Files) | sort -k3 -u | \
+	awk '$$3 ~ /$(VMDEF_PAT)/ { print "\t" $$3 ";" }' > $@
 
 mapfile_ext:
 	rm -f $@
@@ -334,10 +340,8 @@
 	    rm -f $@.1; ln -s $@ $@.1;                                  \
             if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then                    \
 	      if [ -x /usr/sbin/selinuxenabled ] ; then                 \
-	        /usr/sbin/selinuxenabled;                               \
-                if [ $$? = 0 ] ; then					\
-		  /usr/bin/chcon -t textrel_shlib_t $@;                 \
-		  if [ $$? != 0 ]; then                                 \
+                if /usr/sbin/selinuxenabled; then			\
+		  if ! /usr/bin/chcon -t textrel_shlib_t $@; then       \
 		    echo "ERROR: Cannot chcon $@";			\
 		  fi							\
 	        fi							\
--- a/make/sa.files	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/sa.files	Thu Feb 26 10:56:54 2015 -0800
@@ -39,6 +39,7 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/asm/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/c1/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/ci/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/classfile/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/code/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/compiler/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/*.java \
@@ -49,8 +50,10 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/cdbg/basic/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/dummy/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/ia64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ia64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/linux/sparc/*.java \
@@ -71,6 +74,7 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/win32/coff/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/ia64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windows/amd64/*.java \
@@ -101,6 +105,8 @@
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/solaris_x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/sparc/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/x86/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/win32_amd64/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/win32_x86/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/runtime/ppc64/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/*.java \
 $(AGENT_SRC_DIR)/sun/jvm/hotspot/tools/jcore/*.java \
--- a/make/solaris/Makefile	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/solaris/Makefile	Thu Feb 26 10:56:54 2015 -0800
@@ -190,8 +190,7 @@
 XSLT_CHECK	= $(RUN.JAVAP) javax.xml.transform.TransformerFactory
 # If not found then fail fast.
 check_j2se_version:
-	$(QUIETLY) $(XSLT_CHECK) > /dev/null 2>&1; \
-	if [ $$? -ne 0 ]; then \
+	$(QUIETLY) if ! $(XSLT_CHECK) > /dev/null 2>&1; then \
 	  $(RUN.JAVA) -version; \
 	  echo "*** An XSLT processor (J2SE 1.4.x or newer) is required" \
 	  "to bootstrap this build" 1>&2; \
--- a/make/solaris/makefiles/dtrace.make	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/solaris/makefiles/dtrace.make	Thu Feb 26 10:56:54 2015 -0800
@@ -171,11 +171,11 @@
 		./lib$(GENOFFS).so
 
 CONDITIONALLY_UPDATE_JVMOFFS_TARGET = \
-	cmp -s $@ $@.tmp; \
-	case $$? in \
-	0) rm -f $@.tmp;; \
-	*) rm -f $@ && mv $@.tmp $@ && echo Updated $@;; \
-	esac
+	if cmp -s $@ $@.tmp; then \
+	  rm -f $@.tmp; \
+	else \
+	  rm -f $@ && mv $@.tmp $@ && echo Updated $@; \
+	fi
 
 # $@.tmp is created first to avoid an empty $(JVMOFFS).h if an error occurs.
 $(JVMOFFS).h: $(GENOFFS)
@@ -336,16 +336,10 @@
 
 .PHONY: dtraceCheck
 
-SYSTEM_DTRACE_H = /usr/include/dtrace.h
 SYSTEM_DTRACE_PROG = /usr/sbin/dtrace
 PATCH_DTRACE_PROG = /opt/SUNWdtrd/sbin/dtrace
 systemDtraceFound := $(wildcard ${SYSTEM_DTRACE_PROG})
 patchDtraceFound := $(wildcard ${PATCH_DTRACE_PROG})
-systemDtraceHdrFound := $(wildcard $(SYSTEM_DTRACE_H))
-
-ifneq ("$(systemDtraceHdrFound)", "") 
-CFLAGS += -DHAVE_DTRACE_H
-endif
 
 ifneq ("$(patchDtraceFound)", "")
 DTRACE_PROG=$(PATCH_DTRACE_PROG)
--- a/make/solaris/makefiles/mapfile-vers	Fri Feb 06 10:36:46 2015 -0800
+++ b/make/solaris/makefiles/mapfile-vers	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -62,11 +62,6 @@
                 JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
-                JVM_DTraceGetVersion;
-                JVM_DTraceActivate;
-                JVM_DTraceIsProbeEnabled;
-                JVM_DTraceIsSupported;
-                JVM_DTraceDispose;
                 JVM_DumpAllStacks;
                 JVM_DumpThreads;
                 JVM_FillInStackTrace;
@@ -132,6 +127,7 @@
                 JVM_GetMethodIxSignatureUTF;
                 JVM_GetMethodParameters;
                 JVM_GetMethodTypeAnnotations;
+                JVM_GetNanoTimeAdjustment;
                 JVM_GetPrimitiveArrayElement;
                 JVM_GetProtectionDomain;
                 JVM_GetStackAccessControlContext;
--- a/src/cpu/ppc/vm/icBuffer_ppc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/icBuffer_ppc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2013 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -32,7 +32,6 @@
 #include "memory/resourceArea.hpp"
 #include "nativeInst_ppc.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 #define __ masm.
 
--- a/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -29,6 +29,7 @@
 #include "interp_masm_ppc_64.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "prims/jvmtiThreadState.hpp"
+#include "runtime/sharedRuntime.hpp"
 
 #ifdef PRODUCT
 #define BLOCK_COMMENT(str) // nothing
--- a/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/macroAssembler_ppc.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -567,16 +567,21 @@
   inline void load_with_trap_null_check(Register d, int si16, Register s1);
 
   // Load heap oop and decompress. Loaded oop may not be null.
-  inline void load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1 = noreg);
+  // Specify tmp to save one cycle.
+  inline void load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1 = noreg,
+                                     Register tmp = noreg);
+  // Store heap oop and decompress.  Decompressed oop may not be null.
+  // Specify tmp register if d should not be changed.
   inline void store_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1,
-                                      /*specify if d must stay uncompressed*/ Register tmp = noreg);
+                                      Register tmp = noreg);
 
   // Null allowed.
   inline void load_heap_oop(Register d, RegisterOrConstant offs, Register s1 = noreg);
 
   // Encode/decode heap oop. Oop may not be null, else en/decoding goes wrong.
+  // src == d allowed.
   inline Register encode_heap_oop_not_null(Register d, Register src = noreg);
-  inline void decode_heap_oop_not_null(Register d);
+  inline Register decode_heap_oop_not_null(Register d, Register src = noreg);
 
   // Null allowed.
   inline void decode_heap_oop(Register d);
--- a/src/cpu/ppc/vm/macroAssembler_ppc.inline.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/macroAssembler_ppc.inline.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -311,11 +311,14 @@
   ld(d, si16, s1);
 }
 
-inline void MacroAssembler::load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1) {
+inline void MacroAssembler::load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1, Register tmp) {
   if (UseCompressedOops) {
-    lwz(d, offs, s1);
+    // In disjoint mode decoding can save a cycle if src != dst.
+    Register narrowOop = (tmp != noreg && Universe::narrow_oop_base_disjoint()) ? tmp : d;
+    lwz(narrowOop, offs, s1);
     // Attention: no null check here!
-    decode_heap_oop_not_null(d);
+    Register res = decode_heap_oop_not_null(d, narrowOop);
+    assert(res == d, "caller will not consume loaded value");
   } else {
     ld(d, offs, s1);
   }
@@ -340,26 +343,36 @@
 }
 
 inline Register MacroAssembler::encode_heap_oop_not_null(Register d, Register src) {
-  Register current = (src!=noreg) ? src : d; // Compressed oop is in d if no src provided.
-  if (Universe::narrow_oop_base() != NULL) {
+  Register current = (src != noreg) ? src : d; // Oop to be compressed is in d if no src provided.
+  if (Universe::narrow_oop_base_overlaps()) {
     sub(d, current, R30);
     current = d;
   }
   if (Universe::narrow_oop_shift() != 0) {
-    srdi(d, current, LogMinObjAlignmentInBytes);
+    rldicl(d, current, 64-Universe::narrow_oop_shift(), 32);  // Clears the upper bits.
     current = d;
   }
   return current; // Encoded oop is in this register.
 }
 
-inline void MacroAssembler::decode_heap_oop_not_null(Register d) {
+inline Register MacroAssembler::decode_heap_oop_not_null(Register d, Register src) {
+  if (Universe::narrow_oop_base_disjoint() && src != noreg && src != d &&
+      Universe::narrow_oop_shift() != 0) {
+    mr(d, R30);
+    rldimi(d, src, Universe::narrow_oop_shift(), 32-Universe::narrow_oop_shift());
+    return d;
+  }
+
+  Register current = (src != noreg) ? src : d; // Compressed oop is in d if no src provided.
   if (Universe::narrow_oop_shift() != 0) {
-    assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
-    sldi(d, d, LogMinObjAlignmentInBytes);
+    sldi(d, current, Universe::narrow_oop_shift());
+    current = d;
   }
   if (Universe::narrow_oop_base() != NULL) {
-    add(d, d, R30);
+    add(d, current, R30);
+    current = d;
   }
+  return current; // Decoded oop is in this register.
 }
 
 inline void MacroAssembler::decode_heap_oop(Register d) {
@@ -368,13 +381,7 @@
     cmpwi(CCR0, d, 0);
     beq(CCR0, isNull);
   }
-  if (Universe::narrow_oop_shift() != 0) {
-    assert (LogMinObjAlignmentInBytes == Universe::narrow_oop_shift(), "decode alg wrong");
-    sldi(d, d, LogMinObjAlignmentInBytes);
-  }
-  if (Universe::narrow_oop_base() != NULL) {
-    add(d, d, R30);
-  }
+  decode_heap_oop_not_null(d);
   bind(isNull);
 }
 
--- a/src/cpu/ppc/vm/methodHandles_ppc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/methodHandles_ppc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -25,6 +25,7 @@
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.inline.hpp"
+#include "classfile/javaClasses.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "memory/allocation.inline.hpp"
 #include "prims/methodHandles.hpp"
@@ -172,15 +173,15 @@
 
   // Load the invoker, as MH -> MH.form -> LF.vmentry
   __ verify_oop(recv);
-  __ load_heap_oop_not_null(method_temp, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes()), recv);
+  __ load_heap_oop_not_null(method_temp, NONZERO(java_lang_invoke_MethodHandle::form_offset_in_bytes()), recv, temp2);
   __ verify_oop(method_temp);
-  __ load_heap_oop_not_null(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes()), method_temp);
+  __ load_heap_oop_not_null(method_temp, NONZERO(java_lang_invoke_LambdaForm::vmentry_offset_in_bytes()), method_temp, temp2);
   __ verify_oop(method_temp);
-  // the following assumes that a Method* is normally compressed in the vmtarget field:
+  // The following assumes that a Method* is normally compressed in the vmtarget field:
   __ ld(method_temp, NONZERO(java_lang_invoke_MemberName::vmtarget_offset_in_bytes()), method_temp);
 
   if (VerifyMethodHandles && !for_compiler_entry) {
-    // make sure recv is already on stack
+    // Make sure recv is already on stack.
     __ ld(temp2, in_bytes(Method::const_offset()), method_temp);
     __ load_sized_value(temp2, in_bytes(ConstMethod::size_of_parameters_offset()), temp2,
                         sizeof(u2), /*is_signed*/ false);
@@ -259,8 +260,9 @@
   }
 
   if (TraceMethodHandles) {
-    if (tmp_mh != noreg)
+    if (tmp_mh != noreg) {
       __ mr(R23_method_handle, tmp_mh);  // make stub happy
+    }
     trace_method_handle_interpreter_entry(_masm, iid);
   }
 
@@ -332,7 +334,7 @@
       if (VerifyMethodHandles && iid != vmIntrinsics::_linkToInterface) {
         Label L_ok;
         Register temp2_defc = temp2;
-        __ load_heap_oop_not_null(temp2_defc, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg);
+        __ load_heap_oop_not_null(temp2_defc, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg, temp3);
         load_klass_from_Class(_masm, temp2_defc, temp3, temp4);
         __ verify_klass_ptr(temp2_defc);
         __ check_klass_subtype(temp1_recv_klass, temp2_defc, temp3, temp4, L_ok);
@@ -407,7 +409,7 @@
       }
 
       Register temp2_intf = temp2;
-      __ load_heap_oop_not_null(temp2_intf, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg);
+      __ load_heap_oop_not_null(temp2_intf, NONZERO(java_lang_invoke_MemberName::clazz_offset_in_bytes()), member_reg, temp3);
       load_klass_from_Class(_masm, temp2_intf, temp3, temp4);
       __ verify_klass_ptr(temp2_intf);
 
@@ -464,7 +466,7 @@
                  strstr(adaptername, "linkTo") == NULL);    // static linkers don't have MH
   const char* mh_reg_name = has_mh ? "R23_method_handle" : "G23";
   tty->print_cr("MH %s %s="INTPTR_FORMAT " sp=" INTPTR_FORMAT,
-                adaptername, mh_reg_name, (intptr_t) mh, (intptr_t) entry_sp);
+                adaptername, mh_reg_name, (intptr_t) mh, entry_sp);
 
   if (Verbose) {
     tty->print_cr("Registers:");
@@ -535,23 +537,22 @@
 
   BLOCK_COMMENT("trace_method_handle {");
 
-  int nbytes_save = 10 * 8;             // 10 volatile gprs
-  __ save_LR_CR(R0);
-  __ mr(R0, R1_SP);                     // saved_sp
-  assert(Assembler::is_simm(-nbytes_save, 16), "Overwriting R0");
-  // Push_frame_reg_args only uses R0 if nbytes_save is wider than 16 bit.
-  __ push_frame_reg_args(nbytes_save, R0);
-  __ save_volatile_gprs(R1_SP, frame::abi_reg_args_size); // Except R0.
+  const Register tmp = R11; // Will be preserved.
+  const int nbytes_save = 11*8; // volatile gprs except R0
+  __ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
+  __ save_LR_CR(tmp); // save in old frame
 
-  __ load_const(R3_ARG1, (address)adaptername);
+  __ mr(R5_ARG3, R1_SP);     // saved_sp
+  __ push_frame_reg_args(nbytes_save, tmp);
+
+  __ load_const_optimized(R3_ARG1, (address)adaptername, tmp);
   __ mr(R4_ARG2, R23_method_handle);
-  __ mr(R5_ARG3, R0);        // saved_sp
   __ mr(R6_ARG4, R1_SP);
   __ call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub));
 
-  __ restore_volatile_gprs(R1_SP, 112); // Except R0.
   __ pop_frame();
-  __ restore_LR_CR(R0);
+  __ restore_LR_CR(tmp);
+  __ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
 
   BLOCK_COMMENT("} trace_method_handle");
 }
--- a/src/cpu/ppc/vm/ppc.ad	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/ppc.ad	Thu Feb 26 10:56:54 2015 -0800
@@ -1,6 +1,6 @@
 //
-// Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-// Copyright 2012, 2014 SAP AG. All rights reserved.
+// Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+// Copyright 2012, 2015 SAP AG. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -2698,7 +2698,7 @@
         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
         __ relocate(a.rspec());
       } else if (constant_reloc == relocInfo::metadata_type) {
-        AddressLiteral a = __ allocate_metadata_address((Metadata *)val);
+        AddressLiteral a = __ constant_metadata_address((Metadata *)val);
         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
         __ relocate(a.rspec());
       } else {
@@ -2727,7 +2727,7 @@
         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
         __ relocate(a.rspec());
       } else if (constant_reloc == relocInfo::metadata_type) {
-        AddressLiteral a = __ allocate_metadata_address((Metadata *)val);
+        AddressLiteral a = __ constant_metadata_address((Metadata *)val);
         const_toc_addr = __ address_constant((address)a.value(), RelocationHolder::none);
         __ relocate(a.rspec());
       } else {  // non-oop pointers, e.g. card mark base, heap top
@@ -6029,6 +6029,20 @@
   ins_pipe(pipe_class_default);
 %}
 
+// Optimize DecodeN for disjoint base.
+// Load base of compressed oops into a register
+instruct loadBase(iRegLdst dst) %{
+  effect(DEF dst);
+
+  format %{ "MR      $dst, r30_heapbase" %}
+  size(4);
+  ins_encode %{
+    // TODO: PPC port $archOpcode(ppc64Opcode_or);
+    __ mr($dst$$Register, R30);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
 // Loading ConN must be postalloc expanded so that edges between
 // the nodes are safe. They may not interfere with a safepoint.
 // GL TODO: This needs three instructions: better put this into the constant pool.
@@ -6351,58 +6365,6 @@
 // Prefetch instructions.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr(indirectMemory mem, iRegLsrc src) %{
-  match(PrefetchRead (AddP mem src));
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem, 0, $src \t// Prefetch read-many" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
-    __ dcbt($src$$Register, $mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchr_no_offset(indirectMemory mem) %{
-  match(PrefetchRead mem);
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbt);
-    __ dcbt($mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchw(indirectMemory mem, iRegLsrc src) %{
-  match(PrefetchWrite (AddP mem src));
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem, 2, $src \t// Prefetch write-many (and read)" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
-    __ dcbtst($src$$Register, $mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
-instruct prefetchw_no_offset(indirectMemory mem) %{
-  match(PrefetchWrite mem);
-  ins_cost(MEMORY_REF_COST);
-
-  format %{ "PREFETCH $mem" %}
-  size(4);
-  ins_encode %{
-    // TODO: PPC port $archOpcode(ppc64Opcode_dcbtst);
-    __ dcbtst($mem$$base$$Register);
-  %}
-  ins_pipe(pipe_class_memory);
-%}
-
 // Special prefetch versions which use the dcbz instruction.
 instruct prefetch_alloc_zero(indirectMemory mem, iRegLsrc src) %{
   match(PrefetchAllocation (AddP mem src));
@@ -6724,13 +6686,12 @@
   ins_pipe(pipe_class_default);
 %}
 
-// base != 0
-// 32G aligned narrow oop base.
-instruct encodeP_32GAligned(iRegNdst dst, iRegPsrc src) %{
+// Disjoint narrow oop base.
+instruct encodeP_Disjoint(iRegNdst dst, iRegPsrc src) %{
   match(Set dst (EncodeP src));
-  predicate(false /* TODO: PPC port Universe::narrow_oop_base_disjoint()*/);
-
-  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with 32G aligned base" %}
+  predicate(Universe::narrow_oop_base_disjoint());
+
+  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
   size(4);
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
@@ -6745,7 +6706,7 @@
   effect(TEMP crx);
   predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull &&
             Universe::narrow_oop_shift() != 0 &&
-            true /* TODO: PPC port Universe::narrow_oop_base_overlaps()*/);
+            Universe::narrow_oop_base_overlaps());
 
   format %{ "EncodeP $dst, $crx, $src \t// postalloc expanded" %}
   postalloc_expand( postalloc_expand_encode_oop(dst, src, crx));
@@ -6756,7 +6717,7 @@
   match(Set dst (EncodeP src));
   predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull &&
             Universe::narrow_oop_shift() != 0 &&
-            true /* TODO: PPC port Universe::narrow_oop_base_overlaps()*/);
+            Universe::narrow_oop_base_overlaps());
 
   format %{ "EncodeP $dst, $src\t// $src != Null, postalloc expanded" %}
   postalloc_expand( postalloc_expand_encode_oop_not_null(dst, src) );
@@ -6876,6 +6837,7 @@
              n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
             Universe::narrow_oop_shift() != 0 &&
             Universe::narrow_oop_base() != 0);
+  ins_cost(4 * DEFAULT_COST); // Should be more expensive than decodeN_Disjoint_isel_Ex.
   effect(TEMP crx);
 
   format %{ "DecodeN $dst, $src \t// Kills $crx, postalloc expanded" %}
@@ -6897,6 +6859,106 @@
   ins_pipe(pipe_class_default);
 %}
 
+// Optimize DecodeN for disjoint base.
+// Shift narrow oop and or it into register that already contains the heap base.
+// Base == dst must hold, and is assured by construction in postaloc_expand.
+instruct decodeN_mergeDisjoint(iRegPdst dst, iRegNsrc src, iRegLsrc base) %{
+  match(Set dst (DecodeN src));
+  effect(TEMP base);
+  predicate(false);
+
+  format %{ "RLDIMI  $dst, $src, shift, 32-shift \t// DecodeN (disjoint base)" %}
+  size(4);
+  ins_encode %{
+    // TODO: PPC port $archOpcode(ppc64Opcode_rldimi);
+    __ rldimi($dst$$Register, $src$$Register, Universe::narrow_oop_shift(), 32-Universe::narrow_oop_shift());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Optimize DecodeN for disjoint base.
+// This node requires only one cycle on the critical path.
+// We must postalloc_expand as we can not express use_def effects where
+// the used register is L and the def'ed register P.
+instruct decodeN_Disjoint_notNull_Ex(iRegPdst dst, iRegNsrc src) %{
+  match(Set dst (DecodeN src));
+  effect(TEMP_DEF dst);
+  predicate((n->bottom_type()->is_oopptr()->ptr() == TypePtr::NotNull ||
+             n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
+            Universe::narrow_oop_base_disjoint());
+  ins_cost(DEFAULT_COST);
+
+  format %{ "MOV     $dst, R30 \t\n"
+            "RLDIMI  $dst, $src, shift, 32-shift \t// decode with disjoint base" %}
+  postalloc_expand %{
+    loadBaseNode *n1 = new loadBaseNode();
+    n1->add_req(NULL);
+    n1->_opnds[0] = op_dst;
+
+    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
+    n2->add_req(n_region, n_src, n1);
+    n2->_opnds[0] = op_dst;
+    n2->_opnds[1] = op_src;
+    n2->_opnds[2] = op_dst;
+    n2->_bottom_type = _bottom_type;
+
+    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
+    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
+
+    nodes->push(n1);
+    nodes->push(n2);
+  %}
+%}
+
+instruct decodeN_Disjoint_isel_Ex(iRegPdst dst, iRegNsrc src, flagsReg crx) %{
+  match(Set dst (DecodeN src));
+  effect(TEMP_DEF dst, TEMP crx);
+  predicate((n->bottom_type()->is_oopptr()->ptr() != TypePtr::NotNull &&
+             n->bottom_type()->is_oopptr()->ptr() != TypePtr::Constant) &&
+            Universe::narrow_oop_base_disjoint() && VM_Version::has_isel());
+  ins_cost(3 * DEFAULT_COST);
+
+  format %{ "DecodeN  $dst, $src \t// decode with disjoint base using isel" %}
+  postalloc_expand %{
+    loadBaseNode *n1 = new loadBaseNode();
+    n1->add_req(NULL);
+    n1->_opnds[0] = op_dst;
+
+    cmpN_reg_imm0Node *n_compare  = new cmpN_reg_imm0Node();
+    n_compare->add_req(n_region, n_src);
+    n_compare->_opnds[0] = op_crx;
+    n_compare->_opnds[1] = op_src;
+    n_compare->_opnds[2] = new immN_0Oper(TypeNarrowOop::NULL_PTR);
+    
+    decodeN_mergeDisjointNode *n2 = new decodeN_mergeDisjointNode();
+    n2->add_req(n_region, n_src, n1);
+    n2->_opnds[0] = op_dst;
+    n2->_opnds[1] = op_src;
+    n2->_opnds[2] = op_dst;
+    n2->_bottom_type = _bottom_type;
+
+    cond_set_0_ptrNode *n_cond_set = new cond_set_0_ptrNode();
+    n_cond_set->add_req(n_region, n_compare, n2);
+    n_cond_set->_opnds[0] = op_dst;
+    n_cond_set->_opnds[1] = op_crx;
+    n_cond_set->_opnds[2] = op_dst;
+    n_cond_set->_bottom_type = _bottom_type;
+
+    assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
+    ra_->set_oop(n_cond_set, true);
+    
+    ra_->set_pair(n1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
+    ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
+    ra_->set_pair(n2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
+    ra_->set_pair(n_cond_set->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
+
+    nodes->push(n1);
+    nodes->push(n_compare);
+    nodes->push(n2);
+    nodes->push(n_cond_set);
+  %}
+%}
+
 // src != 0, shift != 0, base != 0
 instruct decodeN_notNull_addBase_Ex(iRegPdst dst, iRegNsrc src) %{
   match(Set dst (DecodeN src));
@@ -6904,6 +6966,7 @@
              n->bottom_type()->is_oopptr()->ptr() == TypePtr::Constant) &&
             Universe::narrow_oop_shift() != 0 &&
             Universe::narrow_oop_base() != 0);
+  ins_cost(2 * DEFAULT_COST);
 
   format %{ "DecodeN $dst, $src \t// $src != NULL, postalloc expanded" %}
   postalloc_expand( postalloc_expand_decode_oop_not_null(dst, src));
@@ -6973,13 +7036,12 @@
   ins_pipe(pipe_class_default);
 %}
 
-// base != 0
-// 32G aligned narrow oop base.
-instruct encodePKlass_32GAligned(iRegNdst dst, iRegPsrc src) %{
+// Disjoint narrow oop base.
+instruct encodePKlass_Disjoint(iRegNdst dst, iRegPsrc src) %{
   match(Set dst (EncodePKlass src));
   predicate(false /* TODO: PPC port Universe::narrow_klass_base_disjoint()*/);
 
-  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with 32G aligned base" %}
+  format %{ "EXTRDI  $dst, $src, #32, #3 \t// encode with disjoint base" %}
   size(4);
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_rldicl);
@@ -7486,7 +7548,7 @@
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     __ cmpxchgd($crx$$CondRegister, R0, $oldVal$$Register, $newVal$$Register, $mem_ptr$$Register,
-                MacroAssembler::MemBarNone, MacroAssembler::cmpxchgx_hint_atomic_update(),
+                MacroAssembler::MemBarAcq, MacroAssembler::cmpxchgx_hint_atomic_update(),
                 noreg, NULL, true);
   %}
   ins_pipe(pipe_class_default);
@@ -10476,7 +10538,7 @@
   match(Set crx (CmpN src1 src2));
 
   size(4);
-  ins_cost(DEFAULT_COST);
+  ins_cost(2);
   format %{ "CMPLW   $crx, $src1, $src2 \t// compressed ptr" %}
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_cmpl);
@@ -10488,7 +10550,7 @@
 instruct cmpN_reg_imm0(flagsReg crx, iRegNsrc src1, immN_0 src2) %{
   match(Set crx (CmpN src1 src2));
   // Make this more expensive than zeroCheckN_iReg_imm0.
-  ins_cost(DEFAULT_COST);
+  ins_cost(2);
 
   format %{ "CMPLWI  $crx, $src1, $src2 \t// compressed ptr" %}
   size(4);
@@ -10508,6 +10570,7 @@
             _kids[0]->_leaf->as_Bool()->_test._test == BoolTest::ne &&
             _leaf->as_If()->_prob >= PROB_LIKELY_MAG(4) &&
             Matcher::branches_to_uncommon_trap(_leaf));
+  ins_cost(1); // Should not be cheaper than zeroCheckN.
 
   ins_is_TrapBasedCheckNode(true);
 
@@ -10889,7 +10952,7 @@
 instruct partialSubtypeCheck(iRegPdst result, iRegP_N2P subklass, iRegP_N2P superklass,
                              iRegPdst tmp_klass, iRegPdst tmp_arrayptr) %{
   match(Set result (PartialSubtypeCheck subklass superklass));
-  effect(TEMP result, TEMP tmp_klass, TEMP tmp_arrayptr);
+  effect(TEMP_DEF result, TEMP tmp_klass, TEMP tmp_arrayptr);
   ins_cost(DEFAULT_COST*10);
 
   format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
@@ -11000,7 +11063,7 @@
   predicate(SpecialStringIndexOf);  // type check implicit by parameter type, See Matcher::match_rule_supported
   match(Set result (StrIndexOf (Binary haystack haycnt) (Binary (AddP needleImm offsetImm) needlecntImm)));
 
-  effect(TEMP result, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1);
+  effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, KILL cr0, KILL cr1);
 
   ins_cost(150);
   format %{ "String IndexOf CSCL1 $haystack[0..$haycnt], $needleImm+$offsetImm[0..$needlecntImm]"
@@ -11037,7 +11100,7 @@
                              iRegIdst tmp1, iRegIdst tmp2,
                              flagsRegCR0 cr0, flagsRegCR1 cr1) %{
   match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
-  effect(USE_KILL needle, /* TDEF needle, */ TEMP result,
+  effect(USE_KILL needle, /* TDEF needle, */ TEMP_DEF result,
          TEMP tmp1, TEMP tmp2);
   // Required for EA: check if it is still a type_array.
   predicate(SpecialStringIndexOf && n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
@@ -11084,7 +11147,7 @@
                             iRegIdst tmp1, iRegIdst tmp2, iRegIdst tmp3, iRegIdst tmp4, iRegIdst tmp5,
                             flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6) %{
   match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecntImm)));
-  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP result,
+  effect(USE_KILL haycnt, /* better: TDEF haycnt, */ TEMP_DEF result,
          TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5, KILL cr0, KILL cr1, KILL cr6);
   // Required for EA: check if it is still a type_array.
   predicate(SpecialStringIndexOf && n->in(3)->in(1)->bottom_type()->is_aryptr()->const_oop() &&
@@ -11118,7 +11181,7 @@
                         flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6) %{
   match(Set result (StrIndexOf (Binary haystack haycnt) (Binary needle needlecnt)));
   effect(USE_KILL haycnt, USE_KILL needlecnt, /*better: TDEF haycnt, TDEF needlecnt,*/
-         TEMP result,
+         TEMP_DEF result,
          TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, KILL cr0, KILL cr1, KILL cr6);
   predicate(SpecialStringIndexOf);  // See Matcher::match_rule_supported.
   ins_cost(300);
@@ -11142,7 +11205,7 @@
                            iRegPdst tmp1, iRegPdst tmp2,
                            flagsRegCR0 cr0, flagsRegCR6 cr6, regCTR ctr) %{
   match(Set result (StrEquals (Binary str1 str2) cntImm));
-  effect(TEMP result, TEMP tmp1, TEMP tmp2,
+  effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2,
          KILL cr0, KILL cr6, KILL ctr);
   predicate(SpecialStringEquals);  // See Matcher::match_rule_supported.
   ins_cost(250);
@@ -11165,7 +11228,7 @@
                        iRegPdst tmp1, iRegPdst tmp2, iRegPdst tmp3, iRegPdst tmp4, iRegPdst tmp5,
                        flagsRegCR0 cr0, flagsRegCR1 cr1, flagsRegCR6 cr6, regCTR ctr) %{
   match(Set result (StrEquals (Binary str1 str2) cnt));
-  effect(TEMP result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
+  effect(TEMP_DEF result, TEMP tmp1, TEMP tmp2, TEMP tmp3, TEMP tmp4, TEMP tmp5,
          KILL cr0, KILL cr1, KILL cr6, KILL ctr);
   predicate(SpecialStringEquals);  // See Matcher::match_rule_supported.
   ins_cost(300);
@@ -11188,7 +11251,7 @@
 instruct string_compare(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
                         iRegPdst tmp, flagsRegCR0 cr0, regCTR ctr) %{
   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
-  effect(USE_KILL cnt1, USE_KILL cnt2, USE_KILL str1, USE_KILL str2, TEMP result, TEMP tmp, KILL cr0, KILL ctr);
+  effect(USE_KILL cnt1, USE_KILL cnt2, USE_KILL str1, USE_KILL str2, TEMP_DEF result, TEMP tmp, KILL cr0, KILL ctr);
   ins_cost(300);
 
   ins_alignment(8); // 'compute_padding()' gets called, up to this number-1 nops will get inserted.
--- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -143,7 +143,6 @@
       }
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       ShouldNotReachHere();
       break;
     default:
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -483,15 +483,6 @@
 
 }
 
-jbyte* G1PostBarrierStub::_byte_map_base = NULL;
-
-jbyte* G1PostBarrierStub::byte_map_base_slow() {
-  BarrierSet* bs = Universe::heap()->barrier_set();
-  assert(bs->is_a(BarrierSet::G1SATBCTLogging),
-         "Must be if we're using this.");
-  return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
-}
-
 void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
 
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1436,26 +1436,6 @@
 }
 
 
-void LIR_Assembler::prefetchr(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::has_v9()) {
-    __ prefetch(from_addr, Assembler::severalReads);
-  }
-}
-
-
-void LIR_Assembler::prefetchw(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::has_v9()) {
-    __ prefetch(from_addr, Assembler::severalWritesAndPossiblyReads);
-  }
-}
-
-
 void LIR_Assembler::stack2reg(LIR_Opr src, LIR_Opr dest, BasicType type) {
   Address addr;
   if (src->is_single_word()) {
--- a/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/c1_MacroAssembler_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/os.hpp"
+#include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 
 void C1_MacroAssembler::inline_cache_check(Register receiver, Register iCache) {
--- a/src/cpu/sparc/vm/icBuffer_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/icBuffer_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,6 @@
 #include "memory/resourceArea.hpp"
 #include "nativeInst_sparc.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 int InlineCacheBuffer::ic_stub_code_size() {
 #ifdef _LP64
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1374,6 +1374,7 @@
 }
 
 void InterpreterMacroAssembler::test_invocation_counter_for_mdp(Register invocation_count,
+                                                                Register method_counters,
                                                                 Register Rtmp,
                                                                 Label &profile_continue) {
   assert(ProfileInterpreter, "must be profiling interpreter");
@@ -1386,9 +1387,8 @@
   br_notnull_short(ImethodDataPtr, Assembler::pn, done);
 
   // Test to see if we should create a method data oop
-  AddressLiteral profile_limit((address) &InvocationCounter::InterpreterProfileLimit);
-  sethi(profile_limit, Rtmp);
-  ld(Rtmp, profile_limit.low10(), Rtmp);
+  Address profile_limit(method_counters, MethodCounters::interpreter_profile_limit_offset());
+  ld(profile_limit, Rtmp);
   cmp(invocation_count, Rtmp);
   // Use long branches because call_VM() code and following code generated by
   // test_backedge_count_for_osr() is large in debug VM.
@@ -2375,6 +2375,7 @@
 
 #ifndef CC_INTERP
 void InterpreterMacroAssembler::test_backedge_count_for_osr( Register backedge_count,
+                                                             Register method_counters,
                                                              Register branch_bcp,
                                                              Register Rtmp ) {
   Label did_not_overflow;
@@ -2382,8 +2383,8 @@
   assert_different_registers(backedge_count, Rtmp, branch_bcp);
   assert(UseOnStackReplacement,"Must UseOnStackReplacement to test_backedge_count_for_osr");
 
-  AddressLiteral limit(&InvocationCounter::InterpreterBackwardBranchLimit);
-  load_contents(limit, Rtmp);
+  Address limit(method_counters, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset()));
+  ld(limit, Rtmp);
   cmp_and_br_short(backedge_count, Rtmp, Assembler::lessUnsigned, Assembler::pt, did_not_overflow);
 
   // When ProfileInterpreter is on, the backedge_count comes from the
@@ -2500,17 +2501,13 @@
 
 // Jump if ((*counter_addr += increment) & mask) satisfies the condition.
 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
-                                                        int increment, int mask,
+                                                        int increment, Address mask_addr,
                                                         Register scratch1, Register scratch2,
                                                         Condition cond, Label *where) {
   ld(counter_addr, scratch1);
   add(scratch1, increment, scratch1);
-  if (is_simm13(mask)) {
-    andcc(scratch1, mask, G0);
-  } else {
-    set(mask, scratch2);
-    andcc(scratch1, scratch2,  G0);
-  }
+  ld(mask_addr, scratch2);
+  andcc(scratch1, scratch2,  G0);
   br(cond, false, Assembler::pn, *where);
   delayed()->st(scratch1, counter_addr);
 }
--- a/src/cpu/sparc/vm/interp_masm_sparc.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/interp_masm_sparc.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -267,7 +267,7 @@
   void increment_invocation_counter( Register Rcounters, Register Rtmp, Register Rtmp2 );
   void increment_backedge_counter( Register Rcounters, Register Rtmp, Register Rtmp2 );
 #ifndef CC_INTERP
-  void test_backedge_count_for_osr( Register backedge_count, Register branch_bcp, Register Rtmp );
+  void test_backedge_count_for_osr(Register backedge_count, Register method_counters, Register branch_bcp, Register Rtmp );
 
 #endif /* CC_INTERP */
   // Object locking
@@ -280,7 +280,7 @@
   void set_method_data_pointer_for_bcp();
   void test_method_data_pointer(Label& zero_continue);
   void verify_method_data_pointer();
-  void test_invocation_counter_for_mdp(Register invocation_count, Register Rtmp, Label &profile_continue);
+  void test_invocation_counter_for_mdp(Register invocation_count, Register method_counters, Register Rtmp, Label &profile_continue);
 
   void set_mdp_data_at(int constant, Register value);
   void increment_mdp_data_at(Address counter, Register bumped_count,
@@ -291,7 +291,7 @@
                              Register bumped_count, Register scratch2,
                              bool decrement = false);
   void increment_mask_and_jump(Address counter_addr,
-                               int increment, int mask,
+                               int increment, Address mask_addr,
                                Register scratch1, Register scratch2,
                                Condition cond, Label *where);
   void set_mdp_flag_at(int flag_constant, Register scratch);
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2943,24 +2943,14 @@
       }
 
       bind   (IsInflated);
-      if (EmitSync & 64) {
-         // If m->owner != null goto IsLocked
-         // Test-and-CAS vs CAS
-         // Pessimistic form avoids futile (doomed) CAS attempts
-         // The optimistic form avoids RTS->RTO cache line upgrades.
-         ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
-         andcc(Rscratch, Rscratch, G0);
-         brx(Assembler::notZero, false, Assembler::pn, done);
-         delayed()->nop();
-         // m->owner == null : it's unlocked.
-      }
 
       // Try to CAS m->owner from null to Self
       // Invariant: if we acquire the lock then _recursions should be 0.
       add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
       mov(G2_thread, Rscratch);
       cas_ptr(Rmark, G0, Rscratch);
-      cmp(Rscratch, G0);
+      andcc(Rscratch, Rscratch, G0);             // set ICCs for done: icc.zf iff success
+      // set icc.zf : 1=success 0=failure
       // ST box->displaced_header = NonZero.
       // Any non-zero value suffices:
       //    markOopDesc::unused_mark(), G2_thread, RBox, RScratch, rsp, etc.
--- a/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.inline.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -630,7 +630,12 @@
 
 inline void MacroAssembler::ldf(FloatRegisterImpl::Width w, const Address& a, FloatRegister d, int offset) {
   relocate(a.rspec(offset));
-  ldf(w, a.base(), a.disp() + offset, d);
+  if (a.has_index()) {
+    assert(offset == 0, "");
+    ldf(w, a.base(), a.index(), d);
+  } else {
+    ldf(w, a.base(), a.disp() + offset, d);
+  }
 }
 
 // returns if membar generates anything, obviously this code should mirror
--- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.hpp"
+#include "classfile/javaClasses.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interp_masm.hpp"
 #include "memory/allocation.inline.hpp"
--- a/src/cpu/sparc/vm/nativeInst_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/nativeInst_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -36,11 +36,6 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
-
-bool NativeInstruction::is_dtrace_trap() {
-  return !is_nop();
-}
-
 void NativeInstruction::set_data64_sethi(address instaddr, intptr_t x) {
   ResourceMark rm;
   CodeBuffer buf(instaddr, 10 * BytesPerInstWord );
--- a/src/cpu/sparc/vm/nativeInst_sparc.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/nativeInst_sparc.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -51,7 +51,6 @@
     nop_instruction_size        =    4
   };
 
-  bool is_dtrace_trap();
   bool is_nop()                        { return long_at(0) == nop_instruction(); }
   bool is_call()                       { return is_op(long_at(0), Assembler::call_op); }
   bool is_sethi()                      { return (is_op2(long_at(0), Assembler::sethi_op2)
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -2758,540 +2758,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-static int  fp_offset[ConcreteRegisterImpl::number_of_registers] = { 0 };
-static bool offsets_initialized = false;
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(
-    MacroAssembler *masm, methodHandle method) {
-
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  // Skip the receiver as dtrace doesn't want to see it
-  if( !method->is_static() ) {
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      Symbol* s = ss.as_symbol_or_null();
-      if (s == vmSymbols::java_lang_String()) {
-        total_strings++;
-        out_sig_bt[total_c_args-1] = T_ADDRESS;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Byte()) {
-        out_sig_bt[total_c_args-1] = T_BYTE;
-      } else if (s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Short()) {
-        out_sig_bt[total_c_args-1] = T_SHORT;
-      } else if (s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      // We convert double to long
-      out_sig_bt[total_c_args-1] = T_LONG;
-      out_sig_bt[total_c_args++] = T_VOID;
-    } else if ( bt == T_FLOAT) {
-      // We convert float to int
-      out_sig_bt[total_c_args-1] = T_INT;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // We have received a description of where all the java arg are located
-  // on entry to the wrapper. We need to convert these args to where
-  // the a  native (non-jni) function would expect them. To figure out
-  // where they go we convert the java signature to a C signature and remove
-  // T_VOID for any long/double we might have received.
-
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots but space for storing
-  // the 1st six register arguments). It's weird see int_stk_helper.
-  //
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Plus a temp for possible converion of float/double/long register args
-
-  int conversion_temp = stack_slots;
-  stack_slots += 2;
-
-
-  // Now space for the string(s) we must convert
-
-  int string_locs = stack_slots;
-  stack_slots += total_strings *
-                   (max_dtrace_string_size / VMRegImpl::stack_slot_size);
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | temp                |
-  //      |---------------------| <- conversion_temp
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 4 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  {
-    Label L;
-    const Register temp_reg = G3_scratch;
-    AddressLiteral ic_miss(SharedRuntime::get_ic_miss_stub());
-    __ verify_oop(O0);
-    __ ld_ptr(O0, oopDesc::klass_offset_in_bytes(), temp_reg);
-    __ cmp_and_brx_short(temp_reg, G5_inline_cache_reg, Assembler::equal, Assembler::pt, L);
-
-    __ jump_to(ic_miss, temp_reg);
-    __ delayed()->nop();
-    __ align(CodeEntryAlignment);
-    __ bind(L);
-  }
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check before creating frame
-  __ generate_stack_overflow_check(stack_size);
-
-  assert(((intptr_t)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ save(SP, -stack_size, SP);
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-#ifdef ASSERT
-  bool reg_destroyed[RegisterImpl::number_of_registers];
-  bool freg_destroyed[FloatRegisterImpl::number_of_registers];
-  for ( int r = 0 ; r < RegisterImpl::number_of_registers ; r++ ) {
-    reg_destroyed[r] = false;
-  }
-  for ( int f = 0 ; f < FloatRegisterImpl::number_of_registers ; f++ ) {
-    freg_destroyed[f] = false;
-  }
-
-#endif /* ASSERT */
-
-  VMRegPair zero;
-  const Register g0 = G0; // without this we get a compiler warning (why??)
-  zero.set2(g0->as_VMReg());
-
-  int c_arg, j_arg;
-
-  Register conversion_off = noreg;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-#ifdef ASSERT
-    if (src.first()->is_Register()) {
-      assert(!reg_destroyed[src.first()->as_Register()->encoding()], "ack!");
-    } else if (src.first()->is_FloatRegister()) {
-      assert(!freg_destroyed[src.first()->as_FloatRegister()->encoding(
-                                               FloatRegisterImpl::S)], "ack!");
-    }
-    if (dst.first()->is_Register()) {
-      reg_destroyed[dst.first()->as_Register()->encoding()] = true;
-    } else if (dst.first()->is_FloatRegister()) {
-      freg_destroyed[dst.first()->as_FloatRegister()->encoding(
-                                                 FloatRegisterImpl::S)] = true;
-    }
-#endif /* ASSERT */
-
-    switch (in_sig_bt[j_arg]) {
-      case T_ARRAY:
-      case T_OBJECT:
-        {
-          if (out_sig_bt[c_arg] == T_BYTE  || out_sig_bt[c_arg] == T_SHORT ||
-              out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-            // need to unbox a one-slot value
-            Register in_reg = L0;
-            Register tmp = L2;
-            if ( src.first()->is_reg() ) {
-              in_reg = src.first()->as_Register();
-            } else {
-              assert(Assembler::is_simm13(reg2offset(src.first()) + STACK_BIAS),
-                     "must be");
-              __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, in_reg);
-            }
-            // If the final destination is an acceptable register
-            if ( dst.first()->is_reg() ) {
-              if ( dst.is_single_phys_reg() || out_sig_bt[c_arg] != T_LONG ) {
-                tmp = dst.first()->as_Register();
-              }
-            }
-
-            Label skipUnbox;
-            if ( wordSize == 4 && out_sig_bt[c_arg] == T_LONG ) {
-              __ mov(G0, tmp->successor());
-            }
-            __ br_null(in_reg, true, Assembler::pn, skipUnbox);
-            __ delayed()->mov(G0, tmp);
-
-            BasicType bt = out_sig_bt[c_arg];
-            int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-            switch (bt) {
-                case T_BYTE:
-                  __ ldub(in_reg, box_offset, tmp); break;
-                case T_SHORT:
-                  __ lduh(in_reg, box_offset, tmp); break;
-                case T_INT:
-                  __ ld(in_reg, box_offset, tmp); break;
-                case T_LONG:
-                  __ ld_long(in_reg, box_offset, tmp); break;
-                default: ShouldNotReachHere();
-            }
-
-            __ bind(skipUnbox);
-            // If tmp wasn't final destination copy to final destination
-            if (tmp == L2) {
-              VMRegPair tmp_as_VM = reg64_to_VMRegPair(L2);
-              if (out_sig_bt[c_arg] == T_LONG) {
-                long_move(masm, tmp_as_VM, dst);
-              } else {
-                move32_64(masm, tmp_as_VM, out_regs[c_arg]);
-              }
-            }
-            if (out_sig_bt[c_arg] == T_LONG) {
-              assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-              ++c_arg; // move over the T_VOID to keep the loop indices in sync
-            }
-          } else if (out_sig_bt[c_arg] == T_ADDRESS) {
-            Register s =
-                src.first()->is_reg() ? src.first()->as_Register() : L2;
-            Register d =
-                dst.first()->is_reg() ? dst.first()->as_Register() : L2;
-
-            // We store the oop now so that the conversion pass can reach
-            // while in the inner frame. This will be the only store if
-            // the oop is NULL.
-            if (s != L2) {
-              // src is register
-              if (d != L2) {
-                // dst is register
-                __ mov(s, d);
-              } else {
-                assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                          STACK_BIAS), "must be");
-                __ st_ptr(s, SP, reg2offset(dst.first()) + STACK_BIAS);
-              }
-            } else {
-                // src not a register
-                assert(Assembler::is_simm13(reg2offset(src.first()) +
-                           STACK_BIAS), "must be");
-                __ ld_ptr(FP, reg2offset(src.first()) + STACK_BIAS, d);
-                if (d == L2) {
-                  assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                             STACK_BIAS), "must be");
-                  __ st_ptr(d, SP, reg2offset(dst.first()) + STACK_BIAS);
-                }
-            }
-          } else if (out_sig_bt[c_arg] != T_VOID) {
-            // Convert the arg to NULL
-            if (dst.first()->is_reg()) {
-              __ mov(G0, dst.first()->as_Register());
-            } else {
-              assert(Assembler::is_simm13(reg2offset(dst.first()) +
-                         STACK_BIAS), "must be");
-              __ st_ptr(G0, SP, reg2offset(dst.first()) + STACK_BIAS);
-            }
-          }
-        }
-        break;
-      case T_VOID:
-        break;
-
-      case T_FLOAT:
-        if (src.first()->is_stack()) {
-          // Stack to stack/reg is simple
-          move32_64(masm, src, dst);
-        } else {
-          if (dst.first()->is_reg()) {
-            // freg -> reg
-            int off =
-              STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-            Register d = dst.first()->as_Register();
-            if (Assembler::is_simm13(off)) {
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, off);
-              __ ld(SP, off, d);
-            } else {
-              if (conversion_off == noreg) {
-                __ set(off, L6);
-                conversion_off = L6;
-              }
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, conversion_off);
-              __ ld(SP, conversion_off , d);
-            }
-          } else {
-            // freg -> mem
-            int off = STACK_BIAS + reg2offset(dst.first());
-            if (Assembler::is_simm13(off)) {
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, off);
-            } else {
-              if (conversion_off == noreg) {
-                __ set(off, L6);
-                conversion_off = L6;
-              }
-              __ stf(FloatRegisterImpl::S, src.first()->as_FloatRegister(),
-                     SP, conversion_off);
-            }
-          }
-        }
-        break;
-
-      case T_DOUBLE:
-        assert( j_arg + 1 < total_args_passed &&
-                in_sig_bt[j_arg + 1] == T_VOID &&
-                out_sig_bt[c_arg+1] == T_VOID, "bad arg list");
-        if (src.first()->is_stack()) {
-          // Stack to stack/reg is simple
-          long_move(masm, src, dst);
-        } else {
-          Register d = dst.first()->is_reg() ? dst.first()->as_Register() : L2;
-
-          // Destination could be an odd reg on 32bit in which case
-          // we can't load direct to the destination.
-
-          if (!d->is_even() && wordSize == 4) {
-            d = L2;
-          }
-          int off = STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-          if (Assembler::is_simm13(off)) {
-            __ stf(FloatRegisterImpl::D, src.first()->as_FloatRegister(),
-                   SP, off);
-            __ ld_long(SP, off, d);
-          } else {
-            if (conversion_off == noreg) {
-              __ set(off, L6);
-              conversion_off = L6;
-            }
-            __ stf(FloatRegisterImpl::D, src.first()->as_FloatRegister(),
-                   SP, conversion_off);
-            __ ld_long(SP, conversion_off, d);
-          }
-          if (d == L2) {
-            long_move(masm, reg64_to_VMRegPair(L2), dst);
-          }
-        }
-        break;
-
-      case T_LONG :
-        // 32bit can't do a split move of something like g1 -> O0, O1
-        // so use a memory temp
-        if (src.is_single_phys_reg() && wordSize == 4) {
-          Register tmp = L2;
-          if (dst.first()->is_reg() &&
-              (wordSize == 8 || dst.first()->as_Register()->is_even())) {
-            tmp = dst.first()->as_Register();
-          }
-
-          int off = STACK_BIAS + conversion_temp * VMRegImpl::stack_slot_size;
-          if (Assembler::is_simm13(off)) {
-            __ stx(src.first()->as_Register(), SP, off);
-            __ ld_long(SP, off, tmp);
-          } else {
-            if (conversion_off == noreg) {
-              __ set(off, L6);
-              conversion_off = L6;
-            }
-            __ stx(src.first()->as_Register(), SP, conversion_off);
-            __ ld_long(SP, conversion_off, tmp);
-          }
-
-          if (tmp == L2) {
-            long_move(masm, reg64_to_VMRegPair(L2), dst);
-          }
-        } else {
-          long_move(masm, src, dst);
-        }
-        break;
-
-      case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-      default:
-        move32_64(masm, src, dst);
-    }
-  }
-
-
-  // If we have any strings we must store any register based arg to the stack
-  // This includes any still live xmm registers too.
-
-  if (total_strings > 0 ) {
-
-    // protect all the arg registers
-    __ save_frame(0);
-    __ mov(G2_thread, L7_thread_cache);
-    const Register L2_string_off = L2;
-
-    // Get first string offset
-    __ set(string_locs * VMRegImpl::stack_slot_size, L2_string_off);
-
-    for (c_arg = 0 ; c_arg < total_c_args ; c_arg++ ) {
-      if (out_sig_bt[c_arg] == T_ADDRESS) {
-
-        VMRegPair dst = out_regs[c_arg];
-        const Register d = dst.first()->is_reg() ?
-            dst.first()->as_Register()->after_save() : noreg;
-
-        // It's a string the oop and it was already copied to the out arg
-        // position
-        if (d != noreg) {
-          __ mov(d, O0);
-        } else {
-          assert(Assembler::is_simm13(reg2offset(dst.first()) + STACK_BIAS),
-                 "must be");
-          __ ld_ptr(FP,  reg2offset(dst.first()) + STACK_BIAS, O0);
-        }
-        Label skip;
-
-        __ br_null(O0, false, Assembler::pn, skip);
-        __ delayed()->add(FP, L2_string_off, O1);
-
-        if (d != noreg) {
-          __ mov(O1, d);
-        } else {
-          assert(Assembler::is_simm13(reg2offset(dst.first()) + STACK_BIAS),
-                 "must be");
-          __ st_ptr(O1, FP,  reg2offset(dst.first()) + STACK_BIAS);
-        }
-
-        __ call(CAST_FROM_FN_PTR(address, SharedRuntime::get_utf),
-                relocInfo::runtime_call_type);
-        __ delayed()->add(L2_string_off, max_dtrace_string_size, L2_string_off);
-
-        __ bind(skip);
-
-      }
-
-    }
-    __ mov(L7_thread_cache, G2_thread);
-    __ restore();
-
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ ret();
-  __ delayed()->restore();
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
--- a/src/cpu/sparc/vm/sparc.ad	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/sparc.ad	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -889,8 +889,6 @@
           !(n->ideal_Opcode()==Op_LoadD_unaligned && ld_op==Op_LoadF) &&
           !(n->ideal_Opcode()==Op_ConvI2F   && ld_op==Op_LoadF) &&
           !(n->ideal_Opcode()==Op_ConvI2D   && ld_op==Op_LoadF) &&
-          !(n->ideal_Opcode()==Op_PrefetchRead  && ld_op==Op_LoadI) &&
-          !(n->ideal_Opcode()==Op_PrefetchWrite && ld_op==Op_LoadI) &&
           !(n->ideal_Opcode()==Op_PrefetchAllocation && ld_op==Op_LoadI) &&
           !(n->ideal_Opcode()==Op_LoadVector && ld_op==Op_LoadD) &&
           !(n->rule() == loadUB_rule)) {
@@ -2996,7 +2994,7 @@
   %}
 
 enc_class enc_String_Equals(o0RegP str1, o1RegP str2, g3RegI cnt, notemp_iRegI result) %{
-    Label Lword_loop, Lpost_word, Lchar, Lchar_loop, Ldone;
+    Label Lchar, Lchar_loop, Ldone;
     MacroAssembler _masm(&cbuf);
 
     Register   str1_reg = reg_to_register_object($str1$$reg);
@@ -6316,33 +6314,9 @@
   ins_pipe(loadConFD);
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr( memory mem ) %{
-  match( PrefetchRead mem );
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-
-  format %{ "PREFETCH $mem,0\t! Prefetch read-many" %}
-  opcode(Assembler::prefetch_op3);
-  ins_encode( form3_mem_prefetch_read( mem ) );
-  ins_pipe(iload_mem);
-%}
-
-instruct prefetchw( memory mem ) %{
-  match( PrefetchWrite mem );
-  ins_cost(MEMORY_REF_COST);
-  size(4);
-
-  format %{ "PREFETCH $mem,2\t! Prefetch write-many (and read)" %}
-  opcode(Assembler::prefetch_op3);
-  ins_encode( form3_mem_prefetch_write( mem ) );
-  ins_pipe(iload_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc( memory mem ) %{
   predicate(AllocatePrefetchInstr == 0);
   match( PrefetchAllocation mem );
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -282,12 +282,11 @@
 void InterpreterGenerator::generate_counter_incr(Label* overflow, Label* profile_method, Label* profile_method_continue) {
   // Note: In tiered we increment either counters in MethodCounters* or in
   // MDO depending if we're profiling or not.
-  const Register Rcounters = G3_scratch;
+  const Register G3_method_counters = G3_scratch;
   Label done;
 
   if (TieredCompilation) {
     const int increment = InvocationCounter::count_increment;
-    const int mask = ((1 << Tier0InvokeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
     Label no_mdo;
     if (ProfileInterpreter) {
       // If no method data exists, go to profile_continue.
@@ -297,6 +296,7 @@
       Address mdo_invocation_counter(G4_scratch,
                                      in_bytes(MethodData::invocation_counter_offset()) +
                                      in_bytes(InvocationCounter::counter_offset()));
+      Address mask(G4_scratch, in_bytes(MethodData::invoke_mask_offset()));
       __ increment_mask_and_jump(mdo_invocation_counter, increment, mask,
                                  G3_scratch, Lscratch,
                                  Assembler::zero, overflow);
@@ -305,20 +305,21 @@
 
     // Increment counter in MethodCounters*
     __ bind(no_mdo);
-    Address invocation_counter(Rcounters,
+    Address invocation_counter(G3_method_counters,
             in_bytes(MethodCounters::invocation_counter_offset()) +
             in_bytes(InvocationCounter::counter_offset()));
-    __ get_method_counters(Lmethod, Rcounters, done);
+    __ get_method_counters(Lmethod, G3_method_counters, done);
+    Address mask(G3_method_counters, in_bytes(MethodCounters::invoke_mask_offset()));
     __ increment_mask_and_jump(invocation_counter, increment, mask,
                                G4_scratch, Lscratch,
                                Assembler::zero, overflow);
     __ bind(done);
-  } else {
+  } else { // not TieredCompilation
     // Update standard invocation counters
-    __ get_method_counters(Lmethod, Rcounters, done);
-    __ increment_invocation_counter(Rcounters, O0, G4_scratch);
+    __ get_method_counters(Lmethod, G3_method_counters, done);
+    __ increment_invocation_counter(G3_method_counters, O0, G4_scratch);
     if (ProfileInterpreter) {
-      Address interpreter_invocation_counter(Rcounters,
+      Address interpreter_invocation_counter(G3_method_counters,
             in_bytes(MethodCounters::interpreter_invocation_counter_offset()));
       __ ld(interpreter_invocation_counter, G4_scratch);
       __ inc(G4_scratch);
@@ -327,16 +328,16 @@
 
     if (ProfileInterpreter && profile_method != NULL) {
       // Test to see if we should create a method data oop
-      AddressLiteral profile_limit((address)&InvocationCounter::InterpreterProfileLimit);
-      __ load_contents(profile_limit, G3_scratch);
-      __ cmp_and_br_short(O0, G3_scratch, Assembler::lessUnsigned, Assembler::pn, *profile_method_continue);
+      Address profile_limit(G3_method_counters, in_bytes(MethodCounters::interpreter_profile_limit_offset()));
+      __ ld(profile_limit, G1_scratch);
+      __ cmp_and_br_short(O0, G1_scratch, Assembler::lessUnsigned, Assembler::pn, *profile_method_continue);
 
       // if no method data exists, go to profile_method
       __ test_method_data_pointer(*profile_method);
     }
 
-    AddressLiteral invocation_limit((address)&InvocationCounter::InterpreterInvocationLimit);
-    __ load_contents(invocation_limit, G3_scratch);
+    Address invocation_limit(G3_method_counters, in_bytes(MethodCounters::interpreter_invocation_limit_offset()));
+    __ ld(invocation_limit, G3_scratch);
     __ cmp(O0, G3_scratch);
     __ br(Assembler::greaterEqualUnsigned, false, Assembler::pn, *overflow); // Far distance
     __ delayed()->nop();
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -115,7 +115,6 @@
       }
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       ShouldNotReachHere();
       break;
     default      :
@@ -1599,13 +1598,12 @@
     // Bump bytecode pointer by displacement (take the branch)
     __ delayed()->add( O1_disp, Lbcp, Lbcp );     // add to bc addr
 
-    const Register Rcounters = G3_scratch;
-    __ get_method_counters(Lmethod, Rcounters, Lforward);
+    const Register G3_method_counters = G3_scratch;
+    __ get_method_counters(Lmethod, G3_method_counters, Lforward);
 
     if (TieredCompilation) {
       Label Lno_mdo, Loverflow;
       int increment = InvocationCounter::count_increment;
-      int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
       if (ProfileInterpreter) {
         // If no method data exists, go to profile_continue.
         __ ld_ptr(Lmethod, Method::method_data_offset(), G4_scratch);
@@ -1614,6 +1612,7 @@
         // Increment backedge counter in the MDO
         Address mdo_backedge_counter(G4_scratch, in_bytes(MethodData::backedge_counter_offset()) +
                                                  in_bytes(InvocationCounter::counter_offset()));
+        Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0,
                                    Assembler::notZero, &Lforward);
         __ ba_short(Loverflow);
@@ -1621,9 +1620,10 @@
 
       // If there's no MDO, increment counter in MethodCounters*
       __ bind(Lno_mdo);
-      Address backedge_counter(Rcounters,
+      Address backedge_counter(G3_method_counters,
               in_bytes(MethodCounters::backedge_counter_offset()) +
               in_bytes(InvocationCounter::counter_offset()));
+      Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset()));
       __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0,
                                  Assembler::notZero, &Lforward);
       __ bind(Loverflow);
@@ -1663,18 +1663,19 @@
       __ jmp(O2, G0);
       __ delayed()->nop();
 
-    } else {
+    } else { // not TieredCompilation
       // Update Backedge branch separately from invocations
       const Register G4_invoke_ctr = G4;
-      __ increment_backedge_counter(Rcounters, G4_invoke_ctr, G1_scratch);
+      __ increment_backedge_counter(G3_method_counters, G4_invoke_ctr, G1_scratch);
       if (ProfileInterpreter) {
-        __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_scratch, Lforward);
+        __ test_invocation_counter_for_mdp(G4_invoke_ctr, G3_method_counters, G1_scratch, Lforward);
         if (UseOnStackReplacement) {
-          __ test_backedge_count_for_osr(O2_bumped_count, l_cur_bcp, G3_scratch);
+
+          __ test_backedge_count_for_osr(O2_bumped_count, G3_method_counters, l_cur_bcp, G1_scratch);
         }
       } else {
         if (UseOnStackReplacement) {
-          __ test_backedge_count_for_osr(G4_invoke_ctr, l_cur_bcp, G3_scratch);
+          __ test_backedge_count_for_osr(G4_invoke_ctr, G3_method_counters, l_cur_bcp, G1_scratch);
         }
       }
     }
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -541,15 +541,6 @@
 
 }
 
-jbyte* G1PostBarrierStub::_byte_map_base = NULL;
-
-jbyte* G1PostBarrierStub::byte_map_base_slow() {
-  BarrierSet* bs = Universe::heap()->barrier_set();
-  assert(bs->is_a(BarrierSet::G1SATBCTLogging),
-         "Must be if we're using this.");
-  return ((G1SATBCardTableModRefBS*)bs)->byte_map_base;
-}
-
 void G1PostBarrierStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
   assert(addr()->is_register(), "Precondition.");
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1398,50 +1398,6 @@
 }
 
 
-void LIR_Assembler::prefetchr(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::supports_sse()) {
-    switch (ReadPrefetchInstr) {
-      case 0:
-        __ prefetchnta(from_addr); break;
-      case 1:
-        __ prefetcht0(from_addr); break;
-      case 2:
-        __ prefetcht2(from_addr); break;
-      default:
-        ShouldNotReachHere(); break;
-    }
-  } else if (VM_Version::supports_3dnow_prefetch()) {
-    __ prefetchr(from_addr);
-  }
-}
-
-
-void LIR_Assembler::prefetchw(LIR_Opr src) {
-  LIR_Address* addr = src->as_address_ptr();
-  Address from_addr = as_Address(addr);
-
-  if (VM_Version::supports_sse()) {
-    switch (AllocatePrefetchInstr) {
-      case 0:
-        __ prefetchnta(from_addr); break;
-      case 1:
-        __ prefetcht0(from_addr); break;
-      case 2:
-        __ prefetcht2(from_addr); break;
-      case 3:
-        __ prefetchw(from_addr); break;
-      default:
-        ShouldNotReachHere(); break;
-    }
-  } else if (VM_Version::supports_3dnow_prefetch()) {
-    __ prefetchw(from_addr);
-  }
-}
-
-
 NEEDS_CLEANUP; // This could be static?
 Address::ScaleFactor LIR_Assembler::array_element_size(BasicType type) const {
   int elem_size = type2aelembytes(type);
--- a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/os.hpp"
+#include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 
 int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Register scratch, Label& slow_case) {
--- a/src/cpu/x86/vm/frame_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/frame_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -123,7 +123,9 @@
     }
 
     intptr_t* sender_sp = NULL;
+    intptr_t* sender_unextended_sp = NULL;
     address   sender_pc = NULL;
+    intptr_t* saved_fp =  NULL;
 
     if (is_interpreted_frame()) {
       // fp must be safe
@@ -132,7 +134,12 @@
       }
 
       sender_pc = (address) this->fp()[return_addr_offset];
+      // for interpreted frames, the value below is the sender "raw" sp,
+      // which can be different from the sender unextended sp (the sp seen
+      // by the sender) because of current frame local variables
       sender_sp = (intptr_t*) addr_at(sender_sp_offset);
+      sender_unextended_sp = (intptr_t*) this->fp()[interpreter_frame_sender_sp_offset];
+      saved_fp = (intptr_t*) this->fp()[link_offset];
 
     } else {
       // must be some sort of compiled/runtime frame
@@ -144,8 +151,11 @@
       }
 
       sender_sp = _unextended_sp + _cb->frame_size();
+      sender_unextended_sp = sender_sp;
       // On Intel the return_address is always the word on the stack
       sender_pc = (address) *(sender_sp-1);
+      // Note: frame::sender_sp_offset is only valid for compiled frame
+      saved_fp = (intptr_t*) *(sender_sp - frame::sender_sp_offset);
     }
 
 
@@ -156,7 +166,6 @@
       // only if the sender is interpreted/call_stub (c1 too?) are we certain that the saved ebp
       // is really a frame pointer.
 
-      intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
       bool saved_fp_safe = ((address)saved_fp < thread->stack_base()) && (saved_fp > sender_sp);
 
       if (!saved_fp_safe) {
@@ -165,7 +174,7 @@
 
       // construct the potential sender
 
-      frame sender(sender_sp, saved_fp, sender_pc);
+      frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
 
       return sender.is_interpreted_frame_valid(thread);
 
@@ -194,7 +203,6 @@
 
     // Could be the call_stub
     if (StubRoutines::returns_to_call_stub(sender_pc)) {
-      intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
       bool saved_fp_safe = ((address)saved_fp < thread->stack_base()) && (saved_fp > sender_sp);
 
       if (!saved_fp_safe) {
@@ -203,7 +211,7 @@
 
       // construct the potential sender
 
-      frame sender(sender_sp, saved_fp, sender_pc);
+      frame sender(sender_sp, sender_unextended_sp, saved_fp, sender_pc);
 
       // Validate the JavaCallWrapper an entry frame must have
       address jcw = (address)sender.entry_frame_call_wrapper();
@@ -568,8 +576,11 @@
   if (!m->is_valid_method()) return false;
 
   // stack frames shouldn't be much larger than max_stack elements
-
-  if (fp() - sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
+  // this test requires the use the unextended_sp which is the sp as seen by
+  // the current frame, and not sp which is the "raw" pc which could point
+  // further because of local variables of the callee method inserted after
+  // method arguments
+  if (fp() - unextended_sp() > 1024 + m->max_stack()*Interpreter::stackElementSize) {
     return false;
   }
 
--- a/src/cpu/x86/vm/globals_x86.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/globals_x86.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -90,9 +90,6 @@
   product(intx, FenceInstruction, 0,                                        \
           "(Unsafe,Unstable) Experimental")                                 \
                                                                             \
-  product(intx,  ReadPrefetchInstr, 0,                                      \
-          "Prefetch instruction to prefetch ahead")                         \
-                                                                            \
   product(bool, UseStoreImmI16, true,                                       \
           "Use store immediate 16-bits value instruction on x86")           \
                                                                             \
--- a/src/cpu/x86/vm/icBuffer_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/icBuffer_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +31,6 @@
 #include "memory/resourceArea.hpp"
 #include "nativeInst_x86.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 int InlineCacheBuffer::ic_stub_code_size() {
   return NativeMovConstReg::instruction_size +
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1360,7 +1360,7 @@
 
 // Jump if ((*counter_addr += increment) & mask) satisfies the condition.
 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
-                                                        int increment, int mask,
+                                                        int increment, Address mask,
                                                         Register scratch, bool preloaded,
                                                         Condition cond, Label* where) {
   if (!preloaded) {
--- a/src/cpu/x86/vm/interp_masm_x86_32.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_32.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -182,7 +182,7 @@
   void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
                              bool decrement = false);
   void increment_mask_and_jump(Address counter_addr,
-                               int increment, int mask,
+                               int increment, Address mask,
                                Register scratch, bool preloaded,
                                Condition cond, Label* where);
   void set_mdp_flag_at(Register mdp_in, int flag_constant);
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1426,7 +1426,7 @@
 
 // Jump if ((*counter_addr += increment) & mask) satisfies the condition.
 void InterpreterMacroAssembler::increment_mask_and_jump(Address counter_addr,
-                                                        int increment, int mask,
+                                                        int increment, Address mask,
                                                         Register scratch, bool preloaded,
                                                         Condition cond, Label* where) {
   if (!preloaded) {
--- a/src/cpu/x86/vm/interp_masm_x86_64.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/interp_masm_x86_64.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -191,7 +191,7 @@
   void increment_mdp_data_at(Register mdp_in, Register reg, int constant,
                              bool decrement = false);
   void increment_mask_and_jump(Address counter_addr,
-                               int increment, int mask,
+                               int increment, Address mask,
                                Register scratch, bool preloaded,
                                Condition cond, Label* where);
   void set_mdp_flag_at(Register mdp_in, int flag_constant);
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1718,27 +1718,6 @@
       // Force all sync thru slow-path: slow_enter() and slow_exit()
       movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
       cmpptr (rsp, (int32_t)NULL_WORD);
-  } else
-  if (EmitSync & 2) {
-      Label DONE_LABEL ;
-      if (UseBiasedLocking) {
-         // Note: tmpReg maps to the swap_reg argument and scrReg to the tmp_reg argument.
-         biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters);
-      }
-
-      movptr(tmpReg, Address(objReg, 0));           // fetch markword
-      orptr (tmpReg, 0x1);
-      movptr(Address(boxReg, 0), tmpReg);           // Anticipate successful CAS
-      if (os::is_MP()) {
-        lock();
-      }
-      cmpxchgptr(boxReg, Address(objReg, 0));       // Updates tmpReg
-      jccb(Assembler::equal, DONE_LABEL);
-      // Recursive locking
-      subptr(tmpReg, rsp);
-      andptr(tmpReg, (int32_t) (NOT_LP64(0xFFFFF003) LP64_ONLY(7 - os::vm_page_size())) );
-      movptr(Address(boxReg, 0), tmpReg);
-      bind(DONE_LABEL);
   } else {
     // Possible cases that we'll encounter in fast_lock
     // ------------------------------------------------
@@ -1923,29 +1902,19 @@
     }
 #else // _LP64
     // It's inflated
-
-    // TODO: someday avoid the ST-before-CAS penalty by
-    // relocating (deferring) the following ST.
-    // We should also think about trying a CAS without having
-    // fetched _owner.  If the CAS is successful we may
-    // avoid an RTO->RTS upgrade on the $line.
-
-    // Without cast to int32_t a movptr will destroy r10 which is typically obj
-    movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
-
-    movptr (boxReg, tmpReg);
-    movptr(tmpReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
-    testptr(tmpReg, tmpReg);
-    jccb   (Assembler::notZero, DONE_LABEL);
-
-    // It's inflated and appears unlocked
+    movq(scrReg, tmpReg);
+    xorq(tmpReg, tmpReg);
+
     if (os::is_MP()) {
       lock();
     }
-    cmpxchgptr(r15_thread, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+    cmpxchgptr(r15_thread, Address(scrReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+    // Unconditionally set box->_displaced_header = markOopDesc::unused_mark().
+    // Without cast to int32_t movptr will destroy r10 which is typically obj.
+    movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
     // Intentional fall-through into DONE_LABEL ...
+    // Propagate ICC.ZF from CAS above into DONE_LABEL.
 #endif // _LP64
-
 #if INCLUDE_RTM_OPT
     } // use_rtm()
 #endif
@@ -6194,7 +6163,7 @@
   ShortBranchVerifier sbv(this);
   assert(UseSSE42Intrinsics, "SSE4.2 is required");
 
-  // This method uses pcmpestri inxtruction with bound registers
+  // This method uses pcmpestri instruction with bound registers
   //   inputs:
   //     xmm - substring
   //     rax - substring length (elements count)
@@ -6355,7 +6324,7 @@
   //
   assert(int_cnt2 == -1 || (0 < int_cnt2 && int_cnt2 < 8), "should be != 0");
 
-  // This method uses pcmpestri inxtruction with bound registers
+  // This method uses pcmpestri instruction with bound registers
   //   inputs:
   //     xmm - substring
   //     rax - substring length (elements count)
@@ -6644,7 +6613,6 @@
     // start from first character again because it has aligned address.
     int stride2 = 16;
     int adr_stride  = stride  << scale;
-    int adr_stride2 = stride2 << scale;
 
     assert(result == rax && cnt2 == rdx && cnt1 == rcx, "pcmpestri");
     // rax and rdx are used by pcmpestri as elements counters
@@ -6743,7 +6711,7 @@
     //   inputs:
     //     vec1- substring
     //     rax - negative string length (elements count)
-    //     mem - scaned string
+    //     mem - scanned string
     //     rdx - string length (elements count)
     //     pcmpmask - cmp mode: 11000 (string compare with negated result)
     //               + 00 (unsigned bytes) or  + 01 (unsigned shorts)
--- a/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "asm/macroAssembler.hpp"
+#include "classfile/javaClasses.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "memory/allocation.inline.hpp"
--- a/src/cpu/x86/vm/nativeInst_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/nativeInst_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -602,7 +602,3 @@
   else
     return addr_at(0) + length + sbyte_at(offset);
 }
-
-bool NativeInstruction::is_dtrace_trap() {
-  return (*(int32_t*)this & 0xff) == 0xcc;
-}
--- a/src/cpu/x86/vm/nativeInst_x86.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/nativeInst_x86.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -59,7 +59,6 @@
   };
 
   bool is_nop()                        { return ubyte_at(0) == nop_instruction_code; }
-  bool is_dtrace_trap();
   inline bool is_call();
   inline bool is_illegal();
   inline bool is_return();
--- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -2415,381 +2415,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(
-    MacroAssembler *masm, methodHandle method) {
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  if( !method->is_static() ) {  // Pass in receiver first
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  // We need to convert the java args to where a native (non-jni) function
-  // would expect them. To figure out where they go we convert the java
-  // signature to a C signature.
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      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;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Byte() ||
-                 s == vmSymbols::java_lang_Short() ||
-                 s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      out_sig_bt[total_c_args++] = T_VOID;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots).
-
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Now space for the string(s) we must convert
-
-  int* string_locs   = NEW_RESOURCE_ARRAY(int, total_strings + 1);
-  for (i = 0; i < total_strings ; i++) {
-    string_locs[i] = stack_slots;
-    stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
-  }
-
-  // + 2 for return address (which we own) and saved rbp,
-
-  stack_slots += 2;
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 2 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  // We are free to use all registers as temps without saving them and
-  // restoring them except rbp. rbp, is the only callee save register
-  // as far as the interpreter and the compiler(s) are concerned.
-
-  const Register ic_reg = rax;
-  const Register receiver = rcx;
-  Label hit;
-  Label exception_pending;
-
-
-  __ verify_oop(receiver);
-  __ cmpl(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes()));
-  __ jcc(Assembler::equal, hit);
-
-  __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
-
-  // verified entry must be aligned for code patching.
-  // and the first 5 bytes must be in the same cache line
-  // if we align at 8 then we will be sure 5 bytes are in the same line
-  __ align(8);
-
-  __ bind(hit);
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check
-
-
-  if (UseStackBanging) {
-    if (stack_size <= StackShadowPages*os::vm_page_size()) {
-      __ bang_stack_with_offset(StackShadowPages*os::vm_page_size());
-    } else {
-      __ movl(rax, stack_size);
-      __ bang_stack_size(rax, rbx);
-    }
-  } else {
-    // need a 5 byte instruction to allow MT safe patching to non-entrant
-    __ fat_nop();
-  }
-
-  assert(((int)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ enter();
-
-  // -2 because return address is already present and so is saved rbp,
-  if (stack_size - 2*wordSize != 0) {
-    __ subl(rsp, stack_size - 2*wordSize);
-  }
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-  // First thing we do store all the args as if we are doing the call.
-  // Since the C calling convention is stack based that ensures that
-  // all the Java register args are stored before we need to convert any
-  // string we might have.
-
-  int sid = 0;
-  int c_arg, j_arg;
-  int string_reg = 0;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-    assert(dst.first()->is_stack() || in_sig_bt[j_arg] == T_VOID,
-           "stack based abi assumed");
-
-    switch (in_sig_bt[j_arg]) {
-
-      case T_ARRAY:
-      case T_OBJECT:
-        if (out_sig_bt[c_arg] == T_ADDRESS) {
-          // Any register based arg for a java string after the first
-          // will be destroyed by the call to get_utf so we store
-          // the original value in the location the utf string address
-          // will eventually be stored.
-          if (src.first()->is_reg()) {
-            if (string_reg++ != 0) {
-              simple_move32(masm, src, dst);
-            }
-          }
-        } else if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-          // need to unbox a one-word value
-          Register in_reg = rax;
-          if ( src.first()->is_reg() ) {
-            in_reg = src.first()->as_Register();
-          } else {
-            simple_move32(masm, src, in_reg->as_VMReg());
-          }
-          Label skipUnbox;
-          __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
-          if ( out_sig_bt[c_arg] == T_LONG ) {
-            __ movl(Address(rsp, reg2offset_out(dst.second())), NULL_WORD);
-          }
-          __ testl(in_reg, in_reg);
-          __ jcc(Assembler::zero, skipUnbox);
-          assert(dst.first()->is_stack() &&
-                 (!dst.second()->is_valid() || dst.second()->is_stack()),
-                 "value(s) must go into stack slots");
-
-          BasicType bt = out_sig_bt[c_arg];
-          int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-          if ( bt == T_LONG ) {
-            __ movl(rbx, Address(in_reg,
-                                 box_offset + VMRegImpl::stack_slot_size));
-            __ movl(Address(rsp, reg2offset_out(dst.second())), rbx);
-          }
-          __ movl(in_reg,  Address(in_reg, box_offset));
-          __ movl(Address(rsp, reg2offset_out(dst.first())), in_reg);
-          __ bind(skipUnbox);
-        } else {
-          // Convert the arg to NULL
-          __ movl(Address(rsp, reg2offset_out(dst.first())), NULL_WORD);
-        }
-        if (out_sig_bt[c_arg] == T_LONG) {
-          assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-          ++c_arg; // Move over the T_VOID To keep the loop indices in sync
-        }
-        break;
-
-      case T_VOID:
-        break;
-
-      case T_FLOAT:
-        float_move(masm, src, dst);
-        break;
-
-      case T_DOUBLE:
-        assert( j_arg + 1 < total_args_passed &&
-                in_sig_bt[j_arg + 1] == T_VOID, "bad arg list");
-        double_move(masm, src, dst);
-        break;
-
-      case T_LONG :
-        long_move(masm, src, dst);
-        break;
-
-      case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-      default:
-        simple_move32(masm, src, dst);
-    }
-  }
-
-  // Now we must convert any string we have to utf8
-  //
-
-  for (sid = 0, j_arg = first_arg_to_pass, c_arg = 0 ;
-       sid < total_strings ; j_arg++, c_arg++ ) {
-
-    if (out_sig_bt[c_arg] == T_ADDRESS) {
-
-      Address utf8_addr = Address(
-          rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-      __ leal(rax, utf8_addr);
-
-      // The first string we find might still be in the original java arg
-      // register
-      VMReg orig_loc = in_regs[j_arg].first();
-      Register string_oop;
-
-      // This is where the argument will eventually reside
-      Address dest = Address(rsp, reg2offset_out(out_regs[c_arg].first()));
-
-      if (sid == 1 && orig_loc->is_reg()) {
-        string_oop = orig_loc->as_Register();
-        assert(string_oop != rax, "smashed arg");
-      } else {
-
-        if (orig_loc->is_reg()) {
-          // Get the copy of the jls object
-          __ movl(rcx, dest);
-        } else {
-          // arg is still in the original location
-          __ movl(rcx, Address(rbp, reg2offset_in(orig_loc)));
-        }
-        string_oop = rcx;
-
-      }
-      Label nullString;
-      __ movl(dest, NULL_WORD);
-      __ testl(string_oop, string_oop);
-      __ jcc(Assembler::zero, nullString);
-
-      // Now we can store the address of the utf string as the argument
-      __ movl(dest, rax);
-
-      // And do the conversion
-      __ call_VM_leaf(CAST_FROM_FN_PTR(
-             address, SharedRuntime::get_utf), string_oop, rax);
-      __ bind(nullString);
-    }
-
-    if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-      assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-      ++c_arg; // Move over the T_VOID To keep the loop indices in sync
-    }
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ leave();
-  __ ret(0);
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals ) {
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -2650,630 +2650,6 @@
 
 }
 
-#ifdef HAVE_DTRACE_H
-// ---------------------------------------------------------------------------
-// Generate a dtrace nmethod for a given signature.  The method takes arguments
-// in the Java compiled code convention, marshals them to the native
-// abi and then leaves nops at the position you would expect to call a native
-// function. When the probe is enabled the nops are replaced with a trap
-// instruction that dtrace inserts and the trace will cause a notification
-// to dtrace.
-//
-// The probes are only able to take primitive types and java/lang/String as
-// arguments.  No other java types are allowed. Strings are converted to utf8
-// strings so that from dtrace point of view java strings are converted to C
-// strings. There is an arbitrary fixed limit on the total space that a method
-// can use for converting the strings. (256 chars per string in the signature).
-// So any java string larger then this is truncated.
-
-static int  fp_offset[ConcreteRegisterImpl::number_of_registers] = { 0 };
-static bool offsets_initialized = false;
-
-
-nmethod *SharedRuntime::generate_dtrace_nmethod(MacroAssembler *masm,
-                                                methodHandle method) {
-
-
-  // generate_dtrace_nmethod is guarded by a mutex so we are sure to
-  // be single threaded in this method.
-  assert(AdapterHandlerLibrary_lock->owned_by_self(), "must be");
-
-  if (!offsets_initialized) {
-    fp_offset[c_rarg0->as_VMReg()->value()] = -1 * wordSize;
-    fp_offset[c_rarg1->as_VMReg()->value()] = -2 * wordSize;
-    fp_offset[c_rarg2->as_VMReg()->value()] = -3 * wordSize;
-    fp_offset[c_rarg3->as_VMReg()->value()] = -4 * wordSize;
-    fp_offset[c_rarg4->as_VMReg()->value()] = -5 * wordSize;
-    fp_offset[c_rarg5->as_VMReg()->value()] = -6 * wordSize;
-
-    fp_offset[c_farg0->as_VMReg()->value()] = -7 * wordSize;
-    fp_offset[c_farg1->as_VMReg()->value()] = -8 * wordSize;
-    fp_offset[c_farg2->as_VMReg()->value()] = -9 * wordSize;
-    fp_offset[c_farg3->as_VMReg()->value()] = -10 * wordSize;
-    fp_offset[c_farg4->as_VMReg()->value()] = -11 * wordSize;
-    fp_offset[c_farg5->as_VMReg()->value()] = -12 * wordSize;
-    fp_offset[c_farg6->as_VMReg()->value()] = -13 * wordSize;
-    fp_offset[c_farg7->as_VMReg()->value()] = -14 * wordSize;
-
-    offsets_initialized = true;
-  }
-  // Fill in the signature array, for the calling-convention call.
-  int total_args_passed = method->size_of_parameters();
-
-  BasicType* in_sig_bt  = NEW_RESOURCE_ARRAY(BasicType, total_args_passed);
-  VMRegPair  *in_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed);
-
-  // The signature we are going to use for the trap that dtrace will see
-  // java/lang/String is converted. We drop "this" and any other object
-  // is converted to NULL.  (A one-slot java/lang/Long object reference
-  // is converted to a two-slot long, which is why we double the allocation).
-  BasicType* out_sig_bt = NEW_RESOURCE_ARRAY(BasicType, total_args_passed * 2);
-  VMRegPair* out_regs   = NEW_RESOURCE_ARRAY(VMRegPair, total_args_passed * 2);
-
-  int i=0;
-  int total_strings = 0;
-  int first_arg_to_pass = 0;
-  int total_c_args = 0;
-
-  // Skip the receiver as dtrace doesn't want to see it
-  if( !method->is_static() ) {
-    in_sig_bt[i++] = T_OBJECT;
-    first_arg_to_pass = 1;
-  }
-
-  // We need to convert the java args to where a native (non-jni) function
-  // would expect them. To figure out where they go we convert the java
-  // signature to a C signature.
-
-  SignatureStream ss(method->signature());
-  for ( ; !ss.at_return_type(); ss.next()) {
-    BasicType bt = ss.type();
-    in_sig_bt[i++] = bt;  // Collect remaining bits of signature
-    out_sig_bt[total_c_args++] = bt;
-    if( bt == T_OBJECT) {
-      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;
-      } else if (s == vmSymbols::java_lang_Boolean() ||
-                 s == vmSymbols::java_lang_Character() ||
-                 s == vmSymbols::java_lang_Byte() ||
-                 s == vmSymbols::java_lang_Short() ||
-                 s == vmSymbols::java_lang_Integer() ||
-                 s == vmSymbols::java_lang_Float()) {
-        out_sig_bt[total_c_args-1] = T_INT;
-      } else if (s == vmSymbols::java_lang_Long() ||
-                 s == vmSymbols::java_lang_Double()) {
-        out_sig_bt[total_c_args-1] = T_LONG;
-        out_sig_bt[total_c_args++] = T_VOID;
-      }
-    } else if ( bt == T_LONG || bt == T_DOUBLE ) {
-      in_sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-      // We convert double to long
-      out_sig_bt[total_c_args-1] = T_LONG;
-      out_sig_bt[total_c_args++] = T_VOID;
-    } else if ( bt == T_FLOAT) {
-      // We convert float to int
-      out_sig_bt[total_c_args-1] = T_INT;
-    }
-  }
-
-  assert(i==total_args_passed, "validly parsed signature");
-
-  // Now get the compiled-Java layout as input arguments
-  int comp_args_on_stack;
-  comp_args_on_stack = SharedRuntime::java_calling_convention(
-      in_sig_bt, in_regs, total_args_passed, false);
-
-  // Now figure out where the args must be stored and how much stack space
-  // they require (neglecting out_preserve_stack_slots but space for storing
-  // the 1st six register arguments). It's weird see int_stk_helper.
-
-  int out_arg_slots;
-  out_arg_slots = c_calling_convention(out_sig_bt, out_regs, NULL, total_c_args);
-
-  // Calculate the total number of stack slots we will need.
-
-  // First count the abi requirement plus all of the outgoing args
-  int stack_slots = SharedRuntime::out_preserve_stack_slots() + out_arg_slots;
-
-  // Now space for the string(s) we must convert
-  int* string_locs   = NEW_RESOURCE_ARRAY(int, total_strings + 1);
-  for (i = 0; i < total_strings ; i++) {
-    string_locs[i] = stack_slots;
-    stack_slots += max_dtrace_string_size / VMRegImpl::stack_slot_size;
-  }
-
-  // Plus the temps we might need to juggle register args
-  // regs take two slots each
-  stack_slots += (Argument::n_int_register_parameters_c +
-                  Argument::n_float_register_parameters_c) * 2;
-
-
-  // + 4 for return address (which we own) and saved rbp,
-
-  stack_slots += 4;
-
-  // Ok The space we have allocated will look like:
-  //
-  //
-  // FP-> |                     |
-  //      |---------------------|
-  //      | string[n]           |
-  //      |---------------------| <- string_locs[n]
-  //      | string[n-1]         |
-  //      |---------------------| <- string_locs[n-1]
-  //      | ...                 |
-  //      | ...                 |
-  //      |---------------------| <- string_locs[1]
-  //      | string[0]           |
-  //      |---------------------| <- string_locs[0]
-  //      | outbound memory     |
-  //      | based arguments     |
-  //      |                     |
-  //      |---------------------|
-  //      |                     |
-  // SP-> | out_preserved_slots |
-  //
-  //
-
-  // Now compute actual number of stack words we need rounding to make
-  // stack properly aligned.
-  stack_slots = round_to(stack_slots, 4 * VMRegImpl::slots_per_word);
-
-  int stack_size = stack_slots * VMRegImpl::stack_slot_size;
-
-  intptr_t start = (intptr_t)__ pc();
-
-  // First thing make an ic check to see if we should even be here
-
-  // We are free to use all registers as temps without saving them and
-  // restoring them except rbp. rbp, is the only callee save register
-  // as far as the interpreter and the compiler(s) are concerned.
-
-  const Register ic_reg = rax;
-  const Register receiver = rcx;
-  Label hit;
-  Label exception_pending;
-
-
-  __ verify_oop(receiver);
-  __ cmpl(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes()));
-  __ jcc(Assembler::equal, hit);
-
-  __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
-
-  // verified entry must be aligned for code patching.
-  // and the first 5 bytes must be in the same cache line
-  // if we align at 8 then we will be sure 5 bytes are in the same line
-  __ align(8);
-
-  __ bind(hit);
-
-  int vep_offset = ((intptr_t)__ pc()) - start;
-
-
-  // The instruction at the verified entry point must be 5 bytes or longer
-  // because it can be patched on the fly by make_non_entrant. The stack bang
-  // instruction fits that requirement.
-
-  // Generate stack overflow check
-
-  if (UseStackBanging) {
-    if (stack_size <= StackShadowPages*os::vm_page_size()) {
-      __ bang_stack_with_offset(StackShadowPages*os::vm_page_size());
-    } else {
-      __ movl(rax, stack_size);
-      __ bang_stack_size(rax, rbx);
-    }
-  } else {
-    // need a 5 byte instruction to allow MT safe patching to non-entrant
-    __ fat_nop();
-  }
-
-  assert(((uintptr_t)__ pc() - start - vep_offset) >= 5,
-         "valid size for make_non_entrant");
-
-  // Generate a new frame for the wrapper.
-  __ enter();
-
-  // -4 because return address is already present and so is saved rbp,
-  if (stack_size - 2*wordSize != 0) {
-    __ subq(rsp, stack_size - 2*wordSize);
-  }
-
-  // Frame is now completed as far a size and linkage.
-
-  int frame_complete = ((intptr_t)__ pc()) - start;
-
-  int c_arg, j_arg;
-
-  // State of input register args
-
-  bool  live[ConcreteRegisterImpl::number_of_registers];
-
-  live[j_rarg0->as_VMReg()->value()] = false;
-  live[j_rarg1->as_VMReg()->value()] = false;
-  live[j_rarg2->as_VMReg()->value()] = false;
-  live[j_rarg3->as_VMReg()->value()] = false;
-  live[j_rarg4->as_VMReg()->value()] = false;
-  live[j_rarg5->as_VMReg()->value()] = false;
-
-  live[j_farg0->as_VMReg()->value()] = false;
-  live[j_farg1->as_VMReg()->value()] = false;
-  live[j_farg2->as_VMReg()->value()] = false;
-  live[j_farg3->as_VMReg()->value()] = false;
-  live[j_farg4->as_VMReg()->value()] = false;
-  live[j_farg5->as_VMReg()->value()] = false;
-  live[j_farg6->as_VMReg()->value()] = false;
-  live[j_farg7->as_VMReg()->value()] = false;
-
-
-  bool rax_is_zero = false;
-
-  // All args (except strings) destined for the stack are moved first
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-    // Get the real reg value or a dummy (rsp)
-
-    int src_reg = src.first()->is_reg() ?
-                  src.first()->value() :
-                  rsp->as_VMReg()->value();
-
-    bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                    (in_sig_bt[j_arg] == T_OBJECT &&
-                     out_sig_bt[c_arg] != T_INT &&
-                     out_sig_bt[c_arg] != T_ADDRESS &&
-                     out_sig_bt[c_arg] != T_LONG);
-
-    live[src_reg] = !useless;
-
-    if (dst.first()->is_stack()) {
-
-      // Even though a string arg in a register is still live after this loop
-      // after the string conversion loop (next) it will be dead so we take
-      // advantage of that now for simpler code to manage live.
-
-      live[src_reg] = false;
-      switch (in_sig_bt[j_arg]) {
-
-        case T_ARRAY:
-        case T_OBJECT:
-          {
-            Address stack_dst(rsp, reg2offset_out(dst.first()));
-
-            if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-              // need to unbox a one-word value
-              Register in_reg = rax;
-              if ( src.first()->is_reg() ) {
-                in_reg = src.first()->as_Register();
-              } else {
-                __ movq(rax, Address(rbp, reg2offset_in(src.first())));
-                rax_is_zero = false;
-              }
-              Label skipUnbox;
-              __ movptr(Address(rsp, reg2offset_out(dst.first())),
-                        (int32_t)NULL_WORD);
-              __ testq(in_reg, in_reg);
-              __ jcc(Assembler::zero, skipUnbox);
-
-              BasicType bt = out_sig_bt[c_arg];
-              int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-              Address src1(in_reg, box_offset);
-              if ( bt == T_LONG ) {
-                __ movq(in_reg,  src1);
-                __ movq(stack_dst, in_reg);
-                assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-                ++c_arg; // skip over T_VOID to keep the loop indices in sync
-              } else {
-                __ movl(in_reg,  src1);
-                __ movl(stack_dst, in_reg);
-              }
-
-              __ bind(skipUnbox);
-            } else if (out_sig_bt[c_arg] != T_ADDRESS) {
-              // Convert the arg to NULL
-              if (!rax_is_zero) {
-                __ xorq(rax, rax);
-                rax_is_zero = true;
-              }
-              __ movq(stack_dst, rax);
-            }
-          }
-          break;
-
-        case T_VOID:
-          break;
-
-        case T_FLOAT:
-          // This does the right thing since we know it is destined for the
-          // stack
-          float_move(masm, src, dst);
-          break;
-
-        case T_DOUBLE:
-          // This does the right thing since we know it is destined for the
-          // stack
-          double_move(masm, src, dst);
-          break;
-
-        case T_LONG :
-          long_move(masm, src, dst);
-          break;
-
-        case T_ADDRESS: assert(false, "found T_ADDRESS in java args");
-
-        default:
-          move32_64(masm, src, dst);
-      }
-    }
-
-  }
-
-  // If we have any strings we must store any register based arg to the stack
-  // This includes any still live xmm registers too.
-
-  int sid = 0;
-
-  if (total_strings > 0 ) {
-    for (j_arg = first_arg_to_pass, c_arg = 0 ;
-         j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-      VMRegPair src = in_regs[j_arg];
-      VMRegPair dst = out_regs[c_arg];
-
-      if (src.first()->is_reg()) {
-        Address src_tmp(rbp, fp_offset[src.first()->value()]);
-
-        // string oops were left untouched by the previous loop even if the
-        // eventual (converted) arg is destined for the stack so park them
-        // away now (except for first)
-
-        if (out_sig_bt[c_arg] == T_ADDRESS) {
-          Address utf8_addr = Address(
-              rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-          if (sid != 1) {
-            // The first string arg won't be killed until after the utf8
-            // conversion
-            __ movq(utf8_addr, src.first()->as_Register());
-          }
-        } else if (dst.first()->is_reg()) {
-          if (in_sig_bt[j_arg] == T_FLOAT || in_sig_bt[j_arg] == T_DOUBLE) {
-
-            // Convert the xmm register to an int and store it in the reserved
-            // location for the eventual c register arg
-            XMMRegister f = src.first()->as_XMMRegister();
-            if (in_sig_bt[j_arg] == T_FLOAT) {
-              __ movflt(src_tmp, f);
-            } else {
-              __ movdbl(src_tmp, f);
-            }
-          } else {
-            // If the arg is an oop type we don't support don't bother to store
-            // it remember string was handled above.
-            bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                            (in_sig_bt[j_arg] == T_OBJECT &&
-                             out_sig_bt[c_arg] != T_INT &&
-                             out_sig_bt[c_arg] != T_LONG);
-
-            if (!useless) {
-              __ movq(src_tmp, src.first()->as_Register());
-            }
-          }
-        }
-      }
-      if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-        assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-        ++c_arg; // skip over T_VOID to keep the loop indices in sync
-      }
-    }
-
-    // Now that the volatile registers are safe, convert all the strings
-    sid = 0;
-
-    for (j_arg = first_arg_to_pass, c_arg = 0 ;
-         j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-      if (out_sig_bt[c_arg] == T_ADDRESS) {
-        // It's a string
-        Address utf8_addr = Address(
-            rsp, string_locs[sid++] * VMRegImpl::stack_slot_size);
-        // The first string we find might still be in the original java arg
-        // register
-
-        VMReg src = in_regs[j_arg].first();
-
-        // We will need to eventually save the final argument to the trap
-        // in the von-volatile location dedicated to src. This is the offset
-        // from fp we will use.
-        int src_off = src->is_reg() ?
-            fp_offset[src->value()] : reg2offset_in(src);
-
-        // This is where the argument will eventually reside
-        VMRegPair dst = out_regs[c_arg];
-
-        if (src->is_reg()) {
-          if (sid == 1) {
-            __ movq(c_rarg0, src->as_Register());
-          } else {
-            __ movq(c_rarg0, utf8_addr);
-          }
-        } else {
-          // arg is still in the original location
-          __ movq(c_rarg0, Address(rbp, reg2offset_in(src)));
-        }
-        Label done, convert;
-
-        // see if the oop is NULL
-        __ testq(c_rarg0, c_rarg0);
-        __ jcc(Assembler::notEqual, convert);
-
-        if (dst.first()->is_reg()) {
-          // Save the ptr to utf string in the origina src loc or the tmp
-          // dedicated to it
-          __ movq(Address(rbp, src_off), c_rarg0);
-        } else {
-          __ movq(Address(rsp, reg2offset_out(dst.first())), c_rarg0);
-        }
-        __ jmp(done);
-
-        __ bind(convert);
-
-        __ lea(c_rarg1, utf8_addr);
-        if (dst.first()->is_reg()) {
-          __ movq(Address(rbp, src_off), c_rarg1);
-        } else {
-          __ movq(Address(rsp, reg2offset_out(dst.first())), c_rarg1);
-        }
-        // And do the conversion
-        __ call(RuntimeAddress(
-                CAST_FROM_FN_PTR(address, SharedRuntime::get_utf)));
-
-        __ bind(done);
-      }
-      if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-        assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-        ++c_arg; // skip over T_VOID to keep the loop indices in sync
-      }
-    }
-    // The get_utf call killed all the c_arg registers
-    live[c_rarg0->as_VMReg()->value()] = false;
-    live[c_rarg1->as_VMReg()->value()] = false;
-    live[c_rarg2->as_VMReg()->value()] = false;
-    live[c_rarg3->as_VMReg()->value()] = false;
-    live[c_rarg4->as_VMReg()->value()] = false;
-    live[c_rarg5->as_VMReg()->value()] = false;
-
-    live[c_farg0->as_VMReg()->value()] = false;
-    live[c_farg1->as_VMReg()->value()] = false;
-    live[c_farg2->as_VMReg()->value()] = false;
-    live[c_farg3->as_VMReg()->value()] = false;
-    live[c_farg4->as_VMReg()->value()] = false;
-    live[c_farg5->as_VMReg()->value()] = false;
-    live[c_farg6->as_VMReg()->value()] = false;
-    live[c_farg7->as_VMReg()->value()] = false;
-  }
-
-  // Now we can finally move the register args to their desired locations
-
-  rax_is_zero = false;
-
-  for (j_arg = first_arg_to_pass, c_arg = 0 ;
-       j_arg < total_args_passed ; j_arg++, c_arg++ ) {
-
-    VMRegPair src = in_regs[j_arg];
-    VMRegPair dst = out_regs[c_arg];
-
-    // Only need to look for args destined for the interger registers (since we
-    // convert float/double args to look like int/long outbound)
-    if (dst.first()->is_reg()) {
-      Register r =  dst.first()->as_Register();
-
-      // Check if the java arg is unsupported and thereofre useless
-      bool useless =  in_sig_bt[j_arg] == T_ARRAY ||
-                      (in_sig_bt[j_arg] == T_OBJECT &&
-                       out_sig_bt[c_arg] != T_INT &&
-                       out_sig_bt[c_arg] != T_ADDRESS &&
-                       out_sig_bt[c_arg] != T_LONG);
-
-
-      // If we're going to kill an existing arg save it first
-      if (live[dst.first()->value()]) {
-        // you can't kill yourself
-        if (src.first() != dst.first()) {
-          __ movq(Address(rbp, fp_offset[dst.first()->value()]), r);
-        }
-      }
-      if (src.first()->is_reg()) {
-        if (live[src.first()->value()] ) {
-          if (in_sig_bt[j_arg] == T_FLOAT) {
-            __ movdl(r, src.first()->as_XMMRegister());
-          } else if (in_sig_bt[j_arg] == T_DOUBLE) {
-            __ movdq(r, src.first()->as_XMMRegister());
-          } else if (r != src.first()->as_Register()) {
-            if (!useless) {
-              __ movq(r, src.first()->as_Register());
-            }
-          }
-        } else {
-          // If the arg is an oop type we don't support don't bother to store
-          // it
-          if (!useless) {
-            if (in_sig_bt[j_arg] == T_DOUBLE ||
-                in_sig_bt[j_arg] == T_LONG  ||
-                in_sig_bt[j_arg] == T_OBJECT ) {
-              __ movq(r, Address(rbp, fp_offset[src.first()->value()]));
-            } else {
-              __ movl(r, Address(rbp, fp_offset[src.first()->value()]));
-            }
-          }
-        }
-        live[src.first()->value()] = false;
-      } else if (!useless) {
-        // full sized move even for int should be ok
-        __ movq(r, Address(rbp, reg2offset_in(src.first())));
-      }
-
-      // At this point r has the original java arg in the final location
-      // (assuming it wasn't useless). If the java arg was an oop
-      // we have a bit more to do
-
-      if (in_sig_bt[j_arg] == T_ARRAY || in_sig_bt[j_arg] == T_OBJECT ) {
-        if (out_sig_bt[c_arg] == T_INT || out_sig_bt[c_arg] == T_LONG) {
-          // need to unbox a one-word value
-          Label skip;
-          __ testq(r, r);
-          __ jcc(Assembler::equal, skip);
-          BasicType bt = out_sig_bt[c_arg];
-          int box_offset = java_lang_boxing_object::value_offset_in_bytes(bt);
-          Address src1(r, box_offset);
-          if ( bt == T_LONG ) {
-            __ movq(r, src1);
-          } else {
-            __ movl(r, src1);
-          }
-          __ bind(skip);
-
-        } else if (out_sig_bt[c_arg] != T_ADDRESS) {
-          // Convert the arg to NULL
-          __ xorq(r, r);
-        }
-      }
-
-      // dst can longer be holding an input value
-      live[dst.first()->value()] = false;
-    }
-    if (in_sig_bt[j_arg] == T_OBJECT && out_sig_bt[c_arg] == T_LONG) {
-      assert(out_sig_bt[c_arg+1] == T_VOID, "must be");
-      ++c_arg; // skip over T_VOID to keep the loop indices in sync
-    }
-  }
-
-
-  // Ok now we are done. Need to place the nop that dtrace wants in order to
-  // patch in the trap
-  int patch_offset = ((intptr_t)__ pc()) - start;
-
-  __ nop();
-
-
-  // Return
-
-  __ leave();
-  __ ret(0);
-
-  __ flush();
-
-  nmethod *nm = nmethod::new_dtrace_nmethod(
-      method, masm->code(), vep_offset, patch_offset, frame_complete,
-      stack_slots / VMRegImpl::slots_per_word);
-  return nm;
-
-}
-
-#endif // HAVE_DTRACE_H
-
 // this function returns the adjust size (in number of words) to a c2i adapter
 // activation for use during deoptimization
 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals ) {
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -346,7 +346,6 @@
   // depending if we're profiling or not.
   if (TieredCompilation) {
     int increment = InvocationCounter::count_increment;
-    int mask = ((1 << Tier0InvokeNotifyFreqLog)  - 1) << InvocationCounter::count_shift;
     Label no_mdo;
     if (ProfileInterpreter) {
       // Are we profiling?
@@ -356,6 +355,7 @@
       // Increment counter in the MDO
       const Address mdo_invocation_counter(rax, in_bytes(MethodData::invocation_counter_offset()) +
                                                 in_bytes(InvocationCounter::counter_offset()));
+      const Address mask(rax, in_bytes(MethodData::invoke_mask_offset()));
       __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow);
       __ jmp(done);
     }
@@ -366,11 +366,12 @@
                   InvocationCounter::counter_offset());
 
     __ get_method_counters(rbx, rax, done);
+    const Address mask(rax, in_bytes(MethodCounters::invoke_mask_offset()));
     __ increment_mask_and_jump(invocation_counter, increment, mask,
                                rcx, false, Assembler::zero, overflow);
     __ bind(done);
-  } else {
-    const Address backedge_counter  (rax,
+  } else { // not TieredCompilation
+    const Address backedge_counter(rax,
                   MethodCounters::backedge_counter_offset() +
                   InvocationCounter::counter_offset());
     const Address invocation_counter(rax,
@@ -400,16 +401,16 @@
 
     if (ProfileInterpreter && profile_method != NULL) {
       // Test to see if we should create a method data oop
-      __ cmp32(rcx,
-               ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit));
+      __ movptr(rax, Address(rbx, Method::method_counters_offset()));
+      __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_profile_limit_offset())));
       __ jcc(Assembler::less, *profile_method_continue);
 
       // if no method data exists, go to profile_method
       __ test_method_data_pointer(rax, *profile_method);
     }
 
-    __ cmp32(rcx,
-             ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit));
+    __ movptr(rax, Address(rbx, Method::method_counters_offset()));
+    __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_invocation_limit_offset())));
     __ jcc(Assembler::aboveEqual, *overflow);
     __ bind(done);
   }
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -299,7 +299,6 @@
   // Note: In tiered we increment either counters in Method* or in MDO depending if we're profiling or not.
   if (TieredCompilation) {
     int increment = InvocationCounter::count_increment;
-    int mask = ((1 << Tier0InvokeNotifyFreqLog)  - 1) << InvocationCounter::count_shift;
     Label no_mdo;
     if (ProfileInterpreter) {
       // Are we profiling?
@@ -309,6 +308,7 @@
       // Increment counter in the MDO
       const Address mdo_invocation_counter(rax, in_bytes(MethodData::invocation_counter_offset()) +
                                                 in_bytes(InvocationCounter::counter_offset()));
+      const Address mask(rax, in_bytes(MethodData::invoke_mask_offset()));
       __ increment_mask_and_jump(mdo_invocation_counter, increment, mask, rcx, false, Assembler::zero, overflow);
       __ jmp(done);
     }
@@ -318,10 +318,11 @@
                   MethodCounters::invocation_counter_offset() +
                   InvocationCounter::counter_offset());
     __ get_method_counters(rbx, rax, done);
+    const Address mask(rax, in_bytes(MethodCounters::invoke_mask_offset()));
     __ increment_mask_and_jump(invocation_counter, increment, mask, rcx,
                                false, Assembler::zero, overflow);
     __ bind(done);
-  } else {
+  } else { // not TieredCompilation
     const Address backedge_counter(rax,
                   MethodCounters::backedge_counter_offset() +
                   InvocationCounter::counter_offset());
@@ -350,14 +351,16 @@
 
     if (ProfileInterpreter && profile_method != NULL) {
       // Test to see if we should create a method data oop
-      __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterProfileLimit));
+      __ movptr(rax, Address(rbx, Method::method_counters_offset()));
+      __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_profile_limit_offset())));
       __ jcc(Assembler::less, *profile_method_continue);
 
       // if no method data exists, go to profile_method
       __ test_method_data_pointer(rax, *profile_method);
     }
 
-    __ cmp32(rcx, ExternalAddress((address)&InvocationCounter::InterpreterInvocationLimit));
+    __ movptr(rax, Address(rbx, Method::method_counters_offset()));
+    __ cmp32(rcx, Address(rax, in_bytes(MethodCounters::interpreter_invocation_limit_offset())));
     __ jcc(Assembler::aboveEqual, *overflow);
     __ bind(done);
   }
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -185,7 +185,6 @@
       }
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       if (val == noreg) {
         __ movptr(obj, NULL_WORD);
       } else {
@@ -1621,7 +1620,6 @@
     if (TieredCompilation) {
       Label no_mdo;
       int increment = InvocationCounter::count_increment;
-      int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
       if (ProfileInterpreter) {
         // Are we profiling?
         __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
@@ -1630,6 +1628,7 @@
         // Increment the MDO backedge counter
         const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
                                                 in_bytes(InvocationCounter::counter_offset()));
+        const Address mask(rbx, in_bytes(MethodData::backedge_mask_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
                                    rax, false, Assembler::zero, &backedge_counter_overflow);
         __ jmp(dispatch);
@@ -1637,9 +1636,10 @@
       __ bind(no_mdo);
       // Increment backedge counter in MethodCounters*
       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
+      const Address mask(rcx, in_bytes(MethodCounters::backedge_mask_offset()));
       __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
                                  rax, false, Assembler::zero, &backedge_counter_overflow);
-    } else {
+    } else { // not TieredCompilation
       // increment counter
       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
       __ movl(rax, Address(rcx, be_offset));        // load backedge counter
@@ -1653,8 +1653,7 @@
 
       if (ProfileInterpreter) {
         // Test to see if we should create a method data oop
-        __ cmp32(rax,
-                 ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
+        __ cmp32(rax, Address(rcx, in_bytes(MethodCounters::interpreter_profile_limit_offset())));
         __ jcc(Assembler::less, dispatch);
 
         // if no method data exists, go to profile method
@@ -1662,8 +1661,7 @@
 
         if (UseOnStackReplacement) {
           // check for overflow against rbx, which is the MDO taken count
-          __ cmp32(rbx,
-                   ExternalAddress((address) &InvocationCounter::InterpreterBackwardBranchLimit));
+          __ cmp32(rbx, Address(rcx, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset())));
           __ jcc(Assembler::below, dispatch);
 
           // When ProfileInterpreter is on, the backedge_count comes from the
@@ -1678,8 +1676,7 @@
       } else {
         if (UseOnStackReplacement) {
           // check for overflow against rax, which is the sum of the counters
-          __ cmp32(rax,
-                   ExternalAddress((address) &InvocationCounter::InterpreterBackwardBranchLimit));
+          __ cmp32(rax, Address(rcx, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset())));
           __ jcc(Assembler::aboveEqual, backedge_counter_overflow);
 
         }
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -189,7 +189,6 @@
       }
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       if (val == noreg) {
         __ store_heap_oop_null(obj);
       } else {
@@ -1642,7 +1641,6 @@
     if (TieredCompilation) {
       Label no_mdo;
       int increment = InvocationCounter::count_increment;
-      int mask = ((1 << Tier0BackedgeNotifyFreqLog) - 1) << InvocationCounter::count_shift;
       if (ProfileInterpreter) {
         // Are we profiling?
         __ movptr(rbx, Address(rcx, in_bytes(Method::method_data_offset())));
@@ -1651,6 +1649,7 @@
         // Increment the MDO backedge counter
         const Address mdo_backedge_counter(rbx, in_bytes(MethodData::backedge_counter_offset()) +
                                            in_bytes(InvocationCounter::counter_offset()));
+        const Address mask(rbx, in_bytes(MethodData::backedge_mask_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask,
                                    rax, false, Assembler::zero, &backedge_counter_overflow);
         __ jmp(dispatch);
@@ -1658,9 +1657,10 @@
       __ bind(no_mdo);
       // Increment backedge counter in MethodCounters*
       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
+         const Address mask(rcx, in_bytes(MethodCounters::backedge_mask_offset()));
       __ increment_mask_and_jump(Address(rcx, be_offset), increment, mask,
                                  rax, false, Assembler::zero, &backedge_counter_overflow);
-    } else {
+    } else { // not TieredCompilation
       // increment counter
       __ movptr(rcx, Address(rcx, Method::method_counters_offset()));
       __ movl(rax, Address(rcx, be_offset));        // load backedge counter
@@ -1674,8 +1674,7 @@
 
       if (ProfileInterpreter) {
         // Test to see if we should create a method data oop
-        __ cmp32(rax,
-                 ExternalAddress((address) &InvocationCounter::InterpreterProfileLimit));
+        __ cmp32(rax, Address(rcx, in_bytes(MethodCounters::interpreter_profile_limit_offset())));
         __ jcc(Assembler::less, dispatch);
 
         // if no method data exists, go to profile method
@@ -1683,8 +1682,7 @@
 
         if (UseOnStackReplacement) {
           // check for overflow against ebx which is the MDO taken count
-          __ cmp32(rbx,
-                   ExternalAddress((address) &InvocationCounter::InterpreterBackwardBranchLimit));
+          __ cmp32(rbx, Address(rcx, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset())));
           __ jcc(Assembler::below, dispatch);
 
           // When ProfileInterpreter is on, the backedge_count comes
@@ -1702,8 +1700,7 @@
         if (UseOnStackReplacement) {
           // check for overflow against eax, which is the sum of the
           // counters
-          __ cmp32(rax,
-                   ExternalAddress((address) &InvocationCounter::InterpreterBackwardBranchLimit));
+          __ cmp32(rax, Address(rcx, in_bytes(MethodCounters::interpreter_backward_branch_limit_offset())));
           __ jcc(Assembler::aboveEqual, backedge_counter_overflow);
 
         }
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -924,15 +924,9 @@
   }
 #endif // COMPILER2
 
-  assert(0 <= ReadPrefetchInstr && ReadPrefetchInstr <= 3, "invalid value");
   assert(0 <= AllocatePrefetchInstr && AllocatePrefetchInstr <= 3, "invalid value");
 
   // set valid Prefetch instruction
-  if( ReadPrefetchInstr < 0 ) ReadPrefetchInstr = 0;
-  if( ReadPrefetchInstr > 3 ) ReadPrefetchInstr = 3;
-  if( ReadPrefetchInstr == 3 && !supports_3dnow_prefetch() ) ReadPrefetchInstr = 0;
-  if( !supports_sse() && supports_3dnow_prefetch() ) ReadPrefetchInstr = 3;
-
   if( AllocatePrefetchInstr < 0 ) AllocatePrefetchInstr = 0;
   if( AllocatePrefetchInstr > 3 ) AllocatePrefetchInstr = 3;
   if( AllocatePrefetchInstr == 3 && !supports_3dnow_prefetch() ) AllocatePrefetchInstr=0;
--- a/src/cpu/x86/vm/x86_32.ad	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/x86_32.ad	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -6061,103 +6061,9 @@
   ins_pipe( fpu_reg_mem );
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
-  match(PrefetchRead mem);
-  ins_cost(0);
-  size(0);
-  format %{ "PREFETCHR (non-SSE is empty encoding)" %}
-  ins_encode();
-  ins_pipe(empty);
-%}
-
-instruct prefetchr( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch() || ReadPrefetchInstr==3);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHR $mem\t! Prefetch into level 1 cache for read" %}
-  ins_encode %{
-    __ prefetchr($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrNTA( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==0);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHNTA $mem\t! Prefetch into non-temporal cache for read" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT0( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==1);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHT0 $mem\t! Prefetch into L1 and L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht0($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT2( memory mem ) %{
-  predicate(UseSSE>=1 && ReadPrefetchInstr==2);
-  match(PrefetchRead mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHT2 $mem\t! Prefetch into L2 cache for read" %}
-  ins_encode %{
-    __ prefetcht2($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchw0( memory mem ) %{
-  predicate(UseSSE==0 && !VM_Version::supports_3dnow_prefetch());
-  match(PrefetchWrite mem);
-  ins_cost(0);
-  size(0);
-  format %{ "Prefetch (non-SSE is empty encoding)" %}
-  ins_encode();
-  ins_pipe(empty);
-%}
-
-instruct prefetchw( memory mem ) %{
-  predicate(UseSSE==0 && VM_Version::supports_3dnow_prefetch());
-  match( PrefetchWrite mem );
-  ins_cost(100);
-
-  format %{ "PREFETCHW $mem\t! Prefetch into L1 cache and mark modified" %}
-  ins_encode %{
-    __ prefetchw($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchwNTA( memory mem ) %{
-  predicate(UseSSE>=1);
-  match(PrefetchWrite mem);
-  ins_cost(100);
-
-  format %{ "PREFETCHNTA $mem\t! Prefetch into non-temporal cache for write" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc0( memory mem ) %{
   predicate(UseSSE==0 && AllocatePrefetchInstr!=3);
   match(PrefetchAllocation mem);
--- a/src/cpu/x86/vm/x86_64.ad	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/x86/vm/x86_64.ad	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
 // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 //
 // This code is free software; you can redistribute it and/or modify it
@@ -5319,70 +5319,9 @@
   ins_pipe(pipe_slow); // XXX
 %}
 
-// Prefetch instructions.
+// Prefetch instructions for allocation.
 // Must be safe to execute with invalid address (cannot fault).
 
-instruct prefetchr( memory mem ) %{
-  predicate(ReadPrefetchInstr==3);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHR $mem\t# Prefetch into level 1 cache" %}
-  ins_encode %{
-    __ prefetchr($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrNTA( memory mem ) %{
-  predicate(ReadPrefetchInstr==0);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHNTA $mem\t# Prefetch into non-temporal cache for read" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT0( memory mem ) %{
-  predicate(ReadPrefetchInstr==1);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHT0 $mem\t# prefetch into L1 and L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht0($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchrT2( memory mem ) %{
-  predicate(ReadPrefetchInstr==2);
-  match(PrefetchRead mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHT2 $mem\t# prefetch into L2 caches for read" %}
-  ins_encode %{
-    __ prefetcht2($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-instruct prefetchwNTA( memory mem ) %{
-  match(PrefetchWrite mem);
-  ins_cost(125);
-
-  format %{ "PREFETCHNTA $mem\t# Prefetch to non-temporal cache for write" %}
-  ins_encode %{
-    __ prefetchnta($mem$$Address);
-  %}
-  ins_pipe(ialu_mem);
-%}
-
-// Prefetch instructions for allocation.
-
 instruct prefetchAlloc( memory mem ) %{
   predicate(AllocatePrefetchInstr==3);
   match(PrefetchAllocation mem);
--- a/src/cpu/zero/vm/icBuffer_zero.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/cpu/zero/vm/icBuffer_zero.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -32,7 +32,6 @@
 #include "memory/resourceArea.hpp"
 #include "nativeInst_zero.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 int InlineCacheBuffer::ic_stub_code_size() {
   // NB set this once the functions below are implemented
--- a/src/os/aix/vm/os_aix.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/aix/vm/os_aix.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -1115,6 +1115,15 @@
   return jlong(time.tv_sec) * 1000 + jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "aix error at gettimeofday()");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
+
 // We need to manually declare mread_real_time,
 // because IBM didn't provide a prototype in time.h.
 // (they probably only ever tested in C, not C++)
--- a/src/os/aix/vm/perfMemory_aix.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/aix/vm/perfMemory_aix.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -31,6 +31,7 @@
 #include "os_aix.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/perfMemory.hpp"
+#include "services/memTracker.hpp"
 #include "utilities/exceptions.hpp"
 
 // put OS-includes here
@@ -196,12 +197,37 @@
   return pid;
 }
 
+// Check if the given statbuf is considered a secure directory for
+// the backing store files. Returns true if the directory is considered
+// a secure location. Returns false if the statbuf is a symbolic link or
+// if an error occurred.
+static bool is_statbuf_secure(struct stat *statp) {
+  if (S_ISLNK(statp->st_mode) || !S_ISDIR(statp->st_mode)) {
+    // The path represents a link or some non-directory file type,
+    // which is not what we expected. Declare it insecure.
+    //
+    return false;
+  }
+  // We have an existing directory, check if the permissions are safe.
+  if ((statp->st_mode & (S_IWGRP|S_IWOTH)) != 0) {
+    // The directory is open for writing and could be subjected
+    // to a symlink or a hard link attack. Declare it insecure.
+    return false;
+  }
+  // See if the uid of the directory matches the effective uid of the process.
+  //
+  if (statp->st_uid != geteuid()) {
+    // The directory was not created by this user, declare it insecure.
+    return false;
+  }
+  return true;
+}
 
-// check if the given path is considered a secure directory for
+
+// Check if the given path is considered a secure directory for
 // the backing store files. Returns true if the directory exists
 // and is considered a secure location. Returns false if the path
 // is a symbolic link or if an error occurred.
-//
 static bool is_directory_secure(const char* path) {
   struct stat statbuf;
   int result = 0;
@@ -211,38 +237,276 @@
     return false;
   }
 
-  // the path exists, now check it's mode
-  if (S_ISLNK(statbuf.st_mode) || !S_ISDIR(statbuf.st_mode)) {
-    // the path represents a link or some non-directory file type,
-    // which is not what we expected. declare it insecure.
-    //
+  // The path exists, see if it is secure.
+  return is_statbuf_secure(&statbuf);
+}
+
+// (Taken over from Solaris to support the O_NOFOLLOW case on AIX.)
+// Check if the given directory file descriptor is considered a secure
+// directory for the backing store files. Returns true if the directory
+// exists and is considered a secure location. Returns false if the path
+// is a symbolic link or if an error occurred.
+static bool is_dirfd_secure(int dir_fd) {
+  struct stat statbuf;
+  int result = 0;
+
+  RESTARTABLE(::fstat(dir_fd, &statbuf), result);
+  if (result == OS_ERR) {
     return false;
   }
-  else {
-    // we have an existing directory, check if the permissions are safe.
-    //
-    if ((statbuf.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
-      // the directory is open for writing and could be subjected
-      // to a symlnk attack. declare it insecure.
-      //
-      return false;
+
+  // The path exists, now check its mode.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check to make sure fd1 and fd2 are referencing the same file system object.
+static bool is_same_fsobject(int fd1, int fd2) {
+  struct stat statbuf1;
+  struct stat statbuf2;
+  int result = 0;
+
+  RESTARTABLE(::fstat(fd1, &statbuf1), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+  RESTARTABLE(::fstat(fd2, &statbuf2), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+
+  if ((statbuf1.st_ino == statbuf2.st_ino) &&
+      (statbuf1.st_dev == statbuf2.st_dev)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+// Helper functions for open without O_NOFOLLOW which is not present on AIX 5.3/6.1.
+// We use the jdk6 implementation here.
+#ifndef O_NOFOLLOW
+// The O_NOFOLLOW oflag doesn't exist before solaris 5.10, this is to simulate that behaviour
+// was done in jdk 5/6 hotspot by Oracle this way
+static int open_o_nofollow_impl(const char* path, int oflag, mode_t mode, bool use_mode) {
+  struct stat orig_st;
+  struct stat new_st;
+  bool create;
+  int error;
+  int fd;
+
+  create = false;
+
+  if (lstat(path, &orig_st) != 0) {
+    if (errno == ENOENT && (oflag & O_CREAT) != 0) {
+      // File doesn't exist, but_we want to create it, add O_EXCL flag
+      // to make sure no-one creates it (or a symlink) before us
+      // This works as we expect with symlinks, from posix man page:
+      // 'If O_EXCL  and  O_CREAT  are set, and path names a symbolic
+      // link, open() shall fail and set errno to [EEXIST]'.
+      oflag |= O_EXCL;
+      create = true;
+    } else {
+      // File doesn't exist, and we are not creating it.
+      return OS_ERR;
     }
+  } else {
+    // Lstat success, check if existing file is a link.
+    if ((orig_st.st_mode & S_IFMT) == S_IFLNK)  {
+      // File is a symlink.
+      errno = ELOOP;
+      return OS_ERR;
+    }
+  }
+
+  if (use_mode == true) {
+    fd = open(path, oflag, mode);
+  } else {
+    fd = open(path, oflag);
+  }
+
+  if (fd == OS_ERR) {
+    return fd;
+  }
+
+  // Can't do inode checks on before/after if we created the file.
+  if (create == false) {
+    if (fstat(fd, &new_st) != 0) {
+      // Keep errno from fstat, in case close also fails.
+      error = errno;
+      ::close(fd);
+      errno = error;
+      return OS_ERR;
+    }
+
+    if (orig_st.st_dev != new_st.st_dev || orig_st.st_ino != new_st.st_ino) {
+      // File was tampered with during race window.
+      ::close(fd);
+      errno = EEXIST;
+      if (PrintMiscellaneous && Verbose) {
+        warning("possible file tampering attempt detected when opening %s", path);
+      }
+      return OS_ERR;
+    }
+  }
+
+  return fd;
+}
+
+static int open_o_nofollow(const char* path, int oflag, mode_t mode) {
+  return open_o_nofollow_impl(path, oflag, mode, true);
+}
+
+static int open_o_nofollow(const char* path, int oflag) {
+  return open_o_nofollow_impl(path, oflag, 0, false);
+}
+#endif
+
+// Open the directory of the given path and validate it.
+// Return a DIR * of the open directory.
+static DIR *open_directory_secure(const char* dirname) {
+  // Open the directory using open() so that it can be verified
+  // to be secure by calling is_dirfd_secure(), opendir() and then check
+  // to see if they are the same file system object.  This method does not
+  // introduce a window of opportunity for the directory to be attacked that
+  // calling opendir() and is_directory_secure() does.
+  int result;
+  DIR *dirp = NULL;
+
+  // No O_NOFOLLOW defined at buildtime, and it is not documented for open;
+  // so provide a workaround in this case.
+#ifdef O_NOFOLLOW
+  RESTARTABLE(::open(dirname, O_RDONLY|O_NOFOLLOW), result);
+#else
+  // workaround (jdk6 coding)
+  RESTARTABLE(::open_o_nofollow(dirname, O_RDONLY), result);
+#endif
+
+  if (result == OS_ERR) {
+    // Directory doesn't exist or is a symlink, so there is nothing to cleanup.
+    if (PrintMiscellaneous && Verbose) {
+      if (errno == ELOOP) {
+        warning("directory %s is a symlink and is not secure\n", dirname);
+      } else {
+        warning("could not open directory %s: %s\n", dirname, strerror(errno));
+      }
+    }
+    return dirp;
+  }
+  int fd = result;
+
+  // Determine if the open directory is secure.
+  if (!is_dirfd_secure(fd)) {
+    // The directory is not a secure directory.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Open the directory.
+  dirp = ::opendir(dirname);
+  if (dirp == NULL) {
+    // The directory doesn't exist, close fd and return.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Check to make sure fd and dirp are referencing the same file system object.
+  if (!is_same_fsobject(fd, dirp->dd_fd)) {
+    // The directory is not secure.
+    os::close(fd);
+    os::closedir(dirp);
+    dirp = NULL;
+    return dirp;
+  }
+
+  // Close initial open now that we know directory is secure
+  os::close(fd);
+
+  return dirp;
+}
+
+// NOTE: The code below uses fchdir(), open() and unlink() because
+// fdopendir(), openat() and unlinkat() are not supported on all
+// versions.  Once the support for fdopendir(), openat() and unlinkat()
+// is available on all supported versions the code can be changed
+// to use these functions.
+
+// Open the directory of the given path, validate it and set the
+// current working directory to it.
+// Return a DIR * of the open directory and the saved cwd fd.
+//
+static DIR *open_directory_secure_cwd(const char* dirname, int *saved_cwd_fd) {
+
+  // Open the directory.
+  DIR* dirp = open_directory_secure(dirname);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so there is nothing to cleanup.
+    return dirp;
+  }
+  int fd = dirp->dd_fd;
+
+  // Open a fd to the cwd and save it off.
+  int result;
+  RESTARTABLE(::open(".", O_RDONLY), result);
+  if (result == OS_ERR) {
+    *saved_cwd_fd = -1;
+  } else {
+    *saved_cwd_fd = result;
+  }
+
+  // Set the current directory to dirname by using the fd of the directory.
+  result = fchdir(fd);
+
+  return dirp;
+}
+
+// Close the directory and restore the current working directory.
+static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
+
+  int result;
+  // If we have a saved cwd change back to it and close the fd.
+  if (saved_cwd_fd != -1) {
+    result = fchdir(saved_cwd_fd);
+    ::close(saved_cwd_fd);
+  }
+
+  // Close the directory.
+  os::closedir(dirp);
+}
+
+// Check if the given file descriptor is considered a secure.
+static bool is_file_secure(int fd, const char *filename) {
+
+  int result;
+  struct stat statbuf;
+
+  // Determine if the file is secure.
+  RESTARTABLE(::fstat(fd, &statbuf), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("fstat failed on %s: %s\n", filename, strerror(errno));
+    }
+    return false;
+  }
+  if (statbuf.st_nlink > 1) {
+    // A file with multiple links is not expected.
+    if (PrintMiscellaneous && Verbose) {
+      warning("file %s has multiple links\n", filename);
+    }
+    return false;
   }
   return true;
 }
 
-
-// return the user name for the given user id
+// Return the user name for the given user id.
 //
-// the caller is expected to free the allocated memory.
-//
+// The caller is expected to free the allocated memory.
 static char* get_user_name(uid_t uid) {
 
   struct passwd pwent;
 
-  // determine the max pwbuf size from sysconf, and hardcode
+  // Determine the max pwbuf size from sysconf, and hardcode
   // a default if this not available through sysconf.
-  //
   long bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
   if (bufsize == -1)
     bufsize = 1024;
@@ -344,7 +608,8 @@
     strcat(usrdir_name, "/");
     strcat(usrdir_name, dentry->d_name);
 
-    DIR* subdirp = os::opendir(usrdir_name);
+    // Open the user directory.
+    DIR* subdirp = open_directory_secure(usrdir_name);
 
     if (subdirp == NULL) {
       FREE_C_HEAP_ARRAY(char, usrdir_name);
@@ -464,28 +729,7 @@
   }
 }
 
-
-// remove file
-//
-// this method removes the file with the given file name in the
-// named directory.
-//
-static void remove_file(const char* dirname, const char* filename) {
-
-  size_t nbytes = strlen(dirname) + strlen(filename) + 2;
-  char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
-
-  strcpy(path, dirname);
-  strcat(path, "/");
-  strcat(path, filename);
-
-  remove_file(path);
-
-  FREE_C_HEAP_ARRAY(char, path);
-}
-
-
-// cleanup stale shared memory resources
+// Cleanup stale shared memory resources
 //
 // This method attempts to remove all stale shared memory files in
 // the named user temporary directory. It scans the named directory
@@ -493,33 +737,26 @@
 // process id is extracted from the file name and a test is run to
 // determine if the process is alive. If the process is not alive,
 // any stale file resources are removed.
-//
 static void cleanup_sharedmem_resources(const char* dirname) {
 
-  // open the user temp directory
-  DIR* dirp = os::opendir(dirname);
-
+  int saved_cwd_fd;
+  // Open the directory.
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
   if (dirp == NULL) {
-    // directory doesn't exist, so there is nothing to cleanup
+     // Directory doesn't exist or is insecure, so there is nothing to cleanup.
     return;
   }
 
-  if (!is_directory_secure(dirname)) {
-    // the directory is not a secure directory
-    os::closedir(dirp);
-    return;
-  }
-
-  // for each entry in the directory that matches the expected file
+  // For each entry in the directory that matches the expected file
   // name pattern, determine if the file resources are stale and if
   // so, remove the file resources. Note, instrumented HotSpot processes
   // for this user may start and/or terminate during this search and
   // remove or create new files in this directory. The behavior of this
   // loop under these conditions is dependent upon the implementation of
   // opendir/readdir.
-  //
   struct dirent* entry;
   char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
+
   errno = 0;
   while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
 
@@ -529,56 +766,55 @@
 
       if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
 
-        // attempt to remove all unexpected files, except "." and ".."
-        remove_file(dirname, entry->d_name);
+        // Attempt to remove all unexpected files, except "." and "..".
+        unlink(entry->d_name);
       }
 
       errno = 0;
       continue;
     }
 
-    // we now have a file name that converts to a valid integer
+    // We now have a file name that converts to a valid integer
     // that could represent a process id . if this process id
     // matches the current process id or the process is not running,
     // then remove the stale file resources.
     //
-    // process liveness is detected by sending signal number 0 to
+    // Process liveness is detected by sending signal number 0 to
     // the process id (see kill(2)). if kill determines that the
     // process does not exist, then the file resources are removed.
     // if kill determines that that we don't have permission to
     // signal the process, then the file resources are assumed to
     // be stale and are removed because the resources for such a
     // process should be in a different user specific directory.
-    //
     if ((pid == os::current_process_id()) ||
         (kill(pid, 0) == OS_ERR && (errno == ESRCH || errno == EPERM))) {
 
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
     }
     errno = 0;
   }
-  os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf);
+
+  // Close the directory and reset the current working directory.
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
+
+  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
 }
 
-// make the user specific temporary directory. Returns true if
+// Make the user specific temporary directory. Returns true if
 // the directory exists and is secure upon return. Returns false
 // if the directory exists but is either a symlink, is otherwise
 // insecure, or if an error occurred.
-//
 static bool make_user_tmp_dir(const char* dirname) {
 
-  // create the directory with 0755 permissions. note that the directory
+  // Create the directory with 0755 permissions. note that the directory
   // will be owned by euid::egid, which may not be the same as uid::gid.
-  //
   if (mkdir(dirname, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) == OS_ERR) {
     if (errno == EEXIST) {
       // The directory already exists and was probably created by another
       // JVM instance. However, this could also be the result of a
       // deliberate symlink. Verify that the existing directory is safe.
-      //
       if (!is_directory_secure(dirname)) {
-        // directory is not secure
+        // Directory is not secure.
         if (PrintMiscellaneous && Verbose) {
           warning("%s directory is insecure\n", dirname);
         }
@@ -614,19 +850,63 @@
     return -1;
   }
 
+  int saved_cwd_fd;
+  // Open the directory and set the current working directory to it.
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so cannot create shared
+    // memory file.
+    return -1;
+  }
+
+  // Open the filename in the current directory.
+  // Cannot use O_TRUNC here; truncation of an existing file has to happen
+  // after the is_file_secure() check below.
   int result;
 
-  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE), result);
+  // No O_NOFOLLOW defined at buildtime, and it is not documented for open;
+  // so provide a workaround in this case.
+#ifdef O_NOFOLLOW
+  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
+#else
+  // workaround function (jdk6 code)
+  RESTARTABLE(::open_o_nofollow(filename, O_RDWR|O_CREAT, S_IREAD|S_IWRITE), result);
+#endif
+
   if (result == OS_ERR) {
     if (PrintMiscellaneous && Verbose) {
-      warning("could not create file %s: %s\n", filename, strerror(errno));
+      if (errno == ELOOP) {
+        warning("file %s is a symlink and is not secure\n", filename);
+      } else {
+        warning("could not create file %s: %s\n", filename, strerror(errno));
+      }
     }
+    // Close the directory and reset the current working directory.
+    close_directory_secure_cwd(dirp, saved_cwd_fd);
+
     return -1;
   }
+  // Close the directory and reset the current working directory.
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
 
   // save the file descriptor
   int fd = result;
 
+  // Check to see if the file is secure.
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  // Truncate the file to get rid of any existing data.
+  RESTARTABLE(::ftruncate(fd, (off_t)0), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("could not truncate shared memory file: %s\n", strerror(errno));
+    }
+    ::close(fd);
+    return -1;
+  }
   // set the file size
   RESTARTABLE(::ftruncate(fd, (off_t)size), result);
   if (result == OS_ERR) {
@@ -648,7 +928,14 @@
 
   // open the file
   int result;
+  // No O_NOFOLLOW defined at buildtime, and it is not documented for open;
+  // so provide a workaround in this case
+#ifdef O_NOFOLLOW
   RESTARTABLE(::open(filename, oflags), result);
+#else
+  RESTARTABLE(::open_o_nofollow(filename, oflags), result);
+#endif
+
   if (result == OS_ERR) {
     if (errno == ENOENT) {
       THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
@@ -662,8 +949,15 @@
       THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno));
     }
   }
+  int fd = result;
 
-  return result;
+  // Check to see if the file is secure.
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  return fd;
 }
 
 // create a named shared memory region. returns the address of the
@@ -695,13 +989,21 @@
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
 
+  // Get the short filename.
+  char* short_filename = strrchr(filename, '/');
+  if (short_filename == NULL) {
+    short_filename = filename;
+  } else {
+    short_filename++;
+  }
+
   // cleanup any stale shared memory files
   cleanup_sharedmem_resources(dirname);
 
   assert(((size > 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemory region size");
 
-  fd = create_sharedmem_resources(dirname, filename, size);
+  fd = create_sharedmem_resources(dirname, short_filename, size);
 
   FREE_C_HEAP_ARRAY(char, user_name);
   FREE_C_HEAP_ARRAY(char, dirname);
@@ -733,6 +1035,9 @@
   // clear the shared memory region
   (void)::memset((void*) mapAddress, 0, size);
 
+  // It does not go through os api, the operation has to record from here.
+  MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC, mtInternal);
+
   return mapAddress;
 }
 
@@ -807,7 +1112,7 @@
   char* mapAddress;
   int result;
   int fd;
-  size_t size;
+  size_t size = 0;
   const char* luser = NULL;
 
   int mmap_prot;
@@ -819,12 +1124,18 @@
   // constructs for the file and the shared memory mapping.
   if (mode == PerfMemory::PERF_MODE_RO) {
     mmap_prot = PROT_READ;
+
+  // No O_NOFOLLOW defined at buildtime, and it is not documented for open.
+#ifdef O_NOFOLLOW
+    file_flags = O_RDONLY | O_NOFOLLOW;
+#else
     file_flags = O_RDONLY;
+#endif
   }
   else if (mode == PerfMemory::PERF_MODE_RW) {
 #ifdef LATER
     mmap_prot = PROT_READ | PROT_WRITE;
-    file_flags = O_RDWR;
+    file_flags = O_RDWR | O_NOFOLLOW;
 #else
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Unsupported access mode");
@@ -853,9 +1164,9 @@
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname);
+    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser);
+      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -901,6 +1212,9 @@
               "Could not map PerfMemory");
   }
 
+  // It does not go through os api, the operation has to record from here.
+  MemTracker::record_virtual_memory_reserve((address)mapAddress, size, CURRENT_PC, mtInternal);
+
   *addr = mapAddress;
   *sizep = size;
 
--- a/src/os/aix/vm/vmError_aix.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/aix/vm/vmError_aix.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -80,7 +80,6 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  // Handle all program errors.
   for (int i = 0; i < NUM_SIGNALS; i++) {
     if (SIGNALS[i] == sig) {
       return resettedSigflags[i];
@@ -90,7 +89,6 @@
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  // Handle all program errors.
   for (int i = 0; i < NUM_SIGNALS; i++) {
     if (SIGNALS[i] == sig) {
       return resettedSighandler[i];
@@ -100,12 +98,19 @@
 }
 
 static void crash_handler(int sig, siginfo_t* info, void* ucVoid) {
+
   // Unmask current signal.
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
+  // and all other synchronous signals too.
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  sigthreadmask(SIG_UNBLOCK, &newset, NULL);
 
-  Unimplemented();
+  VMError err(NULL, sig, NULL, info, ucVoid);
+  err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
--- a/src/os/bsd/vm/dtraceJSDT_bsd.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 1997, 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
- * 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 "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-/*
- * JSDT java dtrace probes have never been implemented in macosx.  It is unknown if the solaris implementation
- * is close or if significant implementation work is necessary.  The future of the solaris implementation also
- * appears to be unclear since compiling code with JSDT probes produces the following warning:
- * "warning: ProviderFactory is internal proprietary API and may be removed in a future release"
- */
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/src/os/bsd/vm/os_bsd.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/bsd/vm/os_bsd.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -984,6 +984,14 @@
   return jlong(time.tv_sec) * 1000  +  jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "bsd error");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
 #ifndef __APPLE__
   #ifndef CLOCK_MONOTONIC
     #define CLOCK_MONOTONIC (1)
--- a/src/os/bsd/vm/perfMemory_bsd.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/bsd/vm/perfMemory_bsd.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -197,7 +197,38 @@
 }
 
 
-// check if the given path is considered a secure directory for
+// Check if the given statbuf is considered a secure directory for
+// the backing store files. Returns true if the directory is considered
+// a secure location. Returns false if the statbuf is a symbolic link or
+// if an error occurred.
+//
+static bool is_statbuf_secure(struct stat *statp) {
+  if (S_ISLNK(statp->st_mode) || !S_ISDIR(statp->st_mode)) {
+    // The path represents a link or some non-directory file type,
+    // which is not what we expected. Declare it insecure.
+    //
+    return false;
+  }
+  // We have an existing directory, check if the permissions are safe.
+  //
+  if ((statp->st_mode & (S_IWGRP|S_IWOTH)) != 0) {
+    // The directory is open for writing and could be subjected
+    // to a symlink or a hard link attack. Declare it insecure.
+    //
+    return false;
+  }
+  // See if the uid of the directory matches the effective uid of the process.
+  //
+  if (statp->st_uid != geteuid()) {
+    // The directory was not created by this user, declare it insecure.
+    //
+    return false;
+  }
+  return true;
+}
+
+
+// Check if the given path is considered a secure directory for
 // the backing store files. Returns true if the directory exists
 // and is considered a secure location. Returns false if the path
 // is a symbolic link or if an error occurred.
@@ -211,27 +242,185 @@
     return false;
   }
 
-  // the path exists, now check it's mode
-  if (S_ISLNK(statbuf.st_mode) || !S_ISDIR(statbuf.st_mode)) {
-    // the path represents a link or some non-directory file type,
-    // which is not what we expected. declare it insecure.
-    //
+  // The path exists, see if it is secure.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check if the given directory file descriptor is considered a secure
+// directory for the backing store files. Returns true if the directory
+// exists and is considered a secure location. Returns false if the path
+// is a symbolic link or if an error occurred.
+//
+static bool is_dirfd_secure(int dir_fd) {
+  struct stat statbuf;
+  int result = 0;
+
+  RESTARTABLE(::fstat(dir_fd, &statbuf), result);
+  if (result == OS_ERR) {
     return false;
   }
-  else {
-    // we have an existing directory, check if the permissions are safe.
-    //
-    if ((statbuf.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
-      // the directory is open for writing and could be subjected
-      // to a symlnk attack. declare it insecure.
-      //
-      return false;
+
+  // The path exists, now check its mode.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check to make sure fd1 and fd2 are referencing the same file system object.
+//
+static bool is_same_fsobject(int fd1, int fd2) {
+  struct stat statbuf1;
+  struct stat statbuf2;
+  int result = 0;
+
+  RESTARTABLE(::fstat(fd1, &statbuf1), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+  RESTARTABLE(::fstat(fd2, &statbuf2), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+
+  if ((statbuf1.st_ino == statbuf2.st_ino) &&
+      (statbuf1.st_dev == statbuf2.st_dev)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+
+// Open the directory of the given path and validate it.
+// Return a DIR * of the open directory.
+//
+static DIR *open_directory_secure(const char* dirname) {
+  // Open the directory using open() so that it can be verified
+  // to be secure by calling is_dirfd_secure(), opendir() and then check
+  // to see if they are the same file system object.  This method does not
+  // introduce a window of opportunity for the directory to be attacked that
+  // calling opendir() and is_directory_secure() does.
+  int result;
+  DIR *dirp = NULL;
+  RESTARTABLE(::open(dirname, O_RDONLY|O_NOFOLLOW), result);
+  if (result == OS_ERR) {
+    // Directory doesn't exist or is a symlink, so there is nothing to cleanup.
+    if (PrintMiscellaneous && Verbose) {
+      if (errno == ELOOP) {
+        warning("directory %s is a symlink and is not secure\n", dirname);
+      } else {
+        warning("could not open directory %s: %s\n", dirname, strerror(errno));
+      }
     }
+    return dirp;
+  }
+  int fd = result;
+
+  // Determine if the open directory is secure.
+  if (!is_dirfd_secure(fd)) {
+    // The directory is not a secure directory.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Open the directory.
+  dirp = ::opendir(dirname);
+  if (dirp == NULL) {
+    // The directory doesn't exist, close fd and return.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Check to make sure fd and dirp are referencing the same file system object.
+  if (!is_same_fsobject(fd, dirfd(dirp))) {
+    // The directory is not secure.
+    os::close(fd);
+    os::closedir(dirp);
+    dirp = NULL;
+    return dirp;
+  }
+
+  // Close initial open now that we know directory is secure
+  os::close(fd);
+
+  return dirp;
+}
+
+// NOTE: The code below uses fchdir(), open() and unlink() because
+// fdopendir(), openat() and unlinkat() are not supported on all
+// versions.  Once the support for fdopendir(), openat() and unlinkat()
+// is available on all supported versions the code can be changed
+// to use these functions.
+
+// Open the directory of the given path, validate it and set the
+// current working directory to it.
+// Return a DIR * of the open directory and the saved cwd fd.
+//
+static DIR *open_directory_secure_cwd(const char* dirname, int *saved_cwd_fd) {
+
+  // Open the directory.
+  DIR* dirp = open_directory_secure(dirname);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so there is nothing to cleanup.
+    return dirp;
+  }
+  int fd = dirfd(dirp);
+
+  // Open a fd to the cwd and save it off.
+  int result;
+  RESTARTABLE(::open(".", O_RDONLY), result);
+  if (result == OS_ERR) {
+    *saved_cwd_fd = -1;
+  } else {
+    *saved_cwd_fd = result;
+  }
+
+  // Set the current directory to dirname by using the fd of the directory.
+  result = fchdir(fd);
+
+  return dirp;
+}
+
+// Close the directory and restore the current working directory.
+//
+static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
+
+  int result;
+  // If we have a saved cwd change back to it and close the fd.
+  if (saved_cwd_fd != -1) {
+    result = fchdir(saved_cwd_fd);
+    ::close(saved_cwd_fd);
+  }
+
+  // Close the directory.
+  os::closedir(dirp);
+}
+
+// Check if the given file descriptor is considered a secure.
+//
+static bool is_file_secure(int fd, const char *filename) {
+
+  int result;
+  struct stat statbuf;
+
+  // Determine if the file is secure.
+  RESTARTABLE(::fstat(fd, &statbuf), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("fstat failed on %s: %s\n", filename, strerror(errno));
+    }
+    return false;
+  }
+  if (statbuf.st_nlink > 1) {
+    // A file with multiple links is not expected.
+    if (PrintMiscellaneous && Verbose) {
+      warning("file %s has multiple links\n", filename);
+    }
+    return false;
   }
   return true;
 }
 
-
 // return the user name for the given user id
 //
 // the caller is expected to free the allocated memory.
@@ -317,9 +506,11 @@
 
   const char* tmpdirname = os::get_temp_directory();
 
+  // open the temp directory
   DIR* tmpdirp = os::opendir(tmpdirname);
 
   if (tmpdirp == NULL) {
+    // Cannot open the directory to get the user name, return.
     return NULL;
   }
 
@@ -344,25 +535,14 @@
     strcat(usrdir_name, "/");
     strcat(usrdir_name, dentry->d_name);
 
-    DIR* subdirp = os::opendir(usrdir_name);
+    // open the user directory
+    DIR* subdirp = open_directory_secure(usrdir_name);
 
     if (subdirp == NULL) {
       FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
-    // Since we don't create the backing store files in directories
-    // pointed to by symbolic links, we also don't follow them when
-    // looking for the files. We check for a symbolic link after the
-    // call to opendir in order to eliminate a small window where the
-    // symlink can be exploited.
-    //
-    if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name);
-      os::closedir(subdirp);
-      continue;
-    }
-
     struct dirent* udentry;
     char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
     errno = 0;
@@ -465,26 +645,6 @@
 }
 
 
-// remove file
-//
-// this method removes the file with the given file name in the
-// named directory.
-//
-static void remove_file(const char* dirname, const char* filename) {
-
-  size_t nbytes = strlen(dirname) + strlen(filename) + 2;
-  char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
-
-  strcpy(path, dirname);
-  strcat(path, "/");
-  strcat(path, filename);
-
-  remove_file(path);
-
-  FREE_C_HEAP_ARRAY(char, path);
-}
-
-
 // cleanup stale shared memory resources
 //
 // This method attempts to remove all stale shared memory files in
@@ -496,17 +656,11 @@
 //
 static void cleanup_sharedmem_resources(const char* dirname) {
 
-  // open the user temp directory
-  DIR* dirp = os::opendir(dirname);
-
+  int saved_cwd_fd;
+  // open the directory and set the current working directory to it
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
   if (dirp == NULL) {
-    // directory doesn't exist, so there is nothing to cleanup
-    return;
-  }
-
-  if (!is_directory_secure(dirname)) {
-    // the directory is not a secure directory
-    os::closedir(dirp);
+    // directory doesn't exist or is insecure, so there is nothing to cleanup
     return;
   }
 
@@ -520,6 +674,7 @@
   //
   struct dirent* entry;
   char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
+
   errno = 0;
   while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
 
@@ -530,7 +685,7 @@
       if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
 
         // attempt to remove all unexpected files, except "." and ".."
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
       }
 
       errno = 0;
@@ -553,11 +708,14 @@
     if ((pid == os::current_process_id()) ||
         (kill(pid, 0) == OS_ERR && (errno == ESRCH || errno == EPERM))) {
 
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
     }
     errno = 0;
   }
-  os::closedir(dirp);
+
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
+
   FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
@@ -614,19 +772,54 @@
     return -1;
   }
 
+  int saved_cwd_fd;
+  // open the directory and set the current working directory to it
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so cannot create shared
+    // memory file.
+    return -1;
+  }
+
+  // Open the filename in the current directory.
+  // Cannot use O_TRUNC here; truncation of an existing file has to happen
+  // after the is_file_secure() check below.
   int result;
-
-  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE), result);
+  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
   if (result == OS_ERR) {
     if (PrintMiscellaneous && Verbose) {
-      warning("could not create file %s: %s\n", filename, strerror(errno));
+      if (errno == ELOOP) {
+        warning("file %s is a symlink and is not secure\n", filename);
+      } else {
+        warning("could not create file %s: %s\n", filename, strerror(errno));
+      }
     }
+    // close the directory and reset the current working directory
+    close_directory_secure_cwd(dirp, saved_cwd_fd);
+
     return -1;
   }
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
 
   // save the file descriptor
   int fd = result;
 
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  // truncate the file to get rid of any existing data
+  RESTARTABLE(::ftruncate(fd, (off_t)0), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("could not truncate shared memory file: %s\n", strerror(errno));
+    }
+    ::close(fd);
+    return -1;
+  }
   // set the file size
   RESTARTABLE(::ftruncate(fd, (off_t)size), result);
   if (result == OS_ERR) {
@@ -684,8 +877,15 @@
       THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
     }
   }
+  int fd = result;
 
-  return result;
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  return fd;
 }
 
 // create a named shared memory region. returns the address of the
@@ -717,13 +917,21 @@
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
 
+  // get the short filename
+  char* short_filename = strrchr(filename, '/');
+  if (short_filename == NULL) {
+    short_filename = filename;
+  } else {
+    short_filename++;
+  }
+
   // cleanup any stale shared memory files
   cleanup_sharedmem_resources(dirname);
 
   assert(((size > 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemory region size");
 
-  fd = create_sharedmem_resources(dirname, filename, size);
+  fd = create_sharedmem_resources(dirname, short_filename, size);
 
   FREE_C_HEAP_ARRAY(char, user_name);
   FREE_C_HEAP_ARRAY(char, dirname);
@@ -838,12 +1046,12 @@
   // constructs for the file and the shared memory mapping.
   if (mode == PerfMemory::PERF_MODE_RO) {
     mmap_prot = PROT_READ;
-    file_flags = O_RDONLY;
+    file_flags = O_RDONLY | O_NOFOLLOW;
   }
   else if (mode == PerfMemory::PERF_MODE_RW) {
 #ifdef LATER
     mmap_prot = PROT_READ | PROT_WRITE;
-    file_flags = O_RDWR;
+    file_flags = O_RDWR | O_NOFOLLOW;
 #else
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Unsupported access mode");
--- a/src/os/bsd/vm/vmError_bsd.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/bsd/vm/vmError_bsd.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -63,9 +63,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -78,19 +84,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -100,16 +106,25 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 }
--- a/src/os/linux/vm/dtraceJSDT_linux.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 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
- * 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 "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/src/os/linux/vm/os_linux.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/linux/vm/os_linux.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1324,6 +1324,15 @@
   return jlong(time.tv_sec) * 1000  +  jlong(time.tv_usec / 1000);
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval time;
+  int status = gettimeofday(&time, NULL);
+  assert(status != -1, "linux error");
+  seconds = jlong(time.tv_sec);
+  nanos = jlong(time.tv_usec) * 1000;
+}
+
+
 #ifndef CLOCK_MONOTONIC
   #define CLOCK_MONOTONIC (1)
 #endif
--- a/src/os/linux/vm/perfMemory_linux.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/linux/vm/perfMemory_linux.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -197,7 +197,38 @@
 }
 
 
-// check if the given path is considered a secure directory for
+// Check if the given statbuf is considered a secure directory for
+// the backing store files. Returns true if the directory is considered
+// a secure location. Returns false if the statbuf is a symbolic link or
+// if an error occurred.
+//
+static bool is_statbuf_secure(struct stat *statp) {
+  if (S_ISLNK(statp->st_mode) || !S_ISDIR(statp->st_mode)) {
+    // The path represents a link or some non-directory file type,
+    // which is not what we expected. Declare it insecure.
+    //
+    return false;
+  }
+  // We have an existing directory, check if the permissions are safe.
+  //
+  if ((statp->st_mode & (S_IWGRP|S_IWOTH)) != 0) {
+    // The directory is open for writing and could be subjected
+    // to a symlink or a hard link attack. Declare it insecure.
+    //
+    return false;
+  }
+  // See if the uid of the directory matches the effective uid of the process.
+  //
+  if (statp->st_uid != geteuid()) {
+    // The directory was not created by this user, declare it insecure.
+    //
+    return false;
+  }
+  return true;
+}
+
+
+// Check if the given path is considered a secure directory for
 // the backing store files. Returns true if the directory exists
 // and is considered a secure location. Returns false if the path
 // is a symbolic link or if an error occurred.
@@ -211,22 +242,180 @@
     return false;
   }
 
-  // the path exists, now check it's mode
-  if (S_ISLNK(statbuf.st_mode) || !S_ISDIR(statbuf.st_mode)) {
-    // the path represents a link or some non-directory file type,
-    // which is not what we expected. declare it insecure.
-    //
+  // The path exists, see if it is secure.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check if the given directory file descriptor is considered a secure
+// directory for the backing store files. Returns true if the directory
+// exists and is considered a secure location. Returns false if the path
+// is a symbolic link or if an error occurred.
+//
+static bool is_dirfd_secure(int dir_fd) {
+  struct stat statbuf;
+  int result = 0;
+
+  RESTARTABLE(::fstat(dir_fd, &statbuf), result);
+  if (result == OS_ERR) {
     return false;
   }
-  else {
-    // we have an existing directory, check if the permissions are safe.
-    //
-    if ((statbuf.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
-      // the directory is open for writing and could be subjected
-      // to a symlnk attack. declare it insecure.
-      //
-      return false;
+
+  // The path exists, now check its mode.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check to make sure fd1 and fd2 are referencing the same file system object.
+//
+static bool is_same_fsobject(int fd1, int fd2) {
+  struct stat statbuf1;
+  struct stat statbuf2;
+  int result = 0;
+
+  RESTARTABLE(::fstat(fd1, &statbuf1), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+  RESTARTABLE(::fstat(fd2, &statbuf2), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+
+  if ((statbuf1.st_ino == statbuf2.st_ino) &&
+      (statbuf1.st_dev == statbuf2.st_dev)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+
+// Open the directory of the given path and validate it.
+// Return a DIR * of the open directory.
+//
+static DIR *open_directory_secure(const char* dirname) {
+  // Open the directory using open() so that it can be verified
+  // to be secure by calling is_dirfd_secure(), opendir() and then check
+  // to see if they are the same file system object.  This method does not
+  // introduce a window of opportunity for the directory to be attacked that
+  // calling opendir() and is_directory_secure() does.
+  int result;
+  DIR *dirp = NULL;
+  RESTARTABLE(::open(dirname, O_RDONLY|O_NOFOLLOW), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      if (errno == ELOOP) {
+        warning("directory %s is a symlink and is not secure\n", dirname);
+      } else {
+        warning("could not open directory %s: %s\n", dirname, strerror(errno));
+      }
     }
+    return dirp;
+  }
+  int fd = result;
+
+  // Determine if the open directory is secure.
+  if (!is_dirfd_secure(fd)) {
+    // The directory is not a secure directory.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Open the directory.
+  dirp = ::opendir(dirname);
+  if (dirp == NULL) {
+    // The directory doesn't exist, close fd and return.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Check to make sure fd and dirp are referencing the same file system object.
+  if (!is_same_fsobject(fd, dirfd(dirp))) {
+    // The directory is not secure.
+    os::close(fd);
+    os::closedir(dirp);
+    dirp = NULL;
+    return dirp;
+  }
+
+  // Close initial open now that we know directory is secure
+  os::close(fd);
+
+  return dirp;
+}
+
+// NOTE: The code below uses fchdir(), open() and unlink() because
+// fdopendir(), openat() and unlinkat() are not supported on all
+// versions.  Once the support for fdopendir(), openat() and unlinkat()
+// is available on all supported versions the code can be changed
+// to use these functions.
+
+// Open the directory of the given path, validate it and set the
+// current working directory to it.
+// Return a DIR * of the open directory and the saved cwd fd.
+//
+static DIR *open_directory_secure_cwd(const char* dirname, int *saved_cwd_fd) {
+
+  // Open the directory.
+  DIR* dirp = open_directory_secure(dirname);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so there is nothing to cleanup.
+    return dirp;
+  }
+  int fd = dirfd(dirp);
+
+  // Open a fd to the cwd and save it off.
+  int result;
+  RESTARTABLE(::open(".", O_RDONLY), result);
+  if (result == OS_ERR) {
+    *saved_cwd_fd = -1;
+  } else {
+    *saved_cwd_fd = result;
+  }
+
+  // Set the current directory to dirname by using the fd of the directory.
+  result = fchdir(fd);
+
+  return dirp;
+}
+
+// Close the directory and restore the current working directory.
+//
+static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
+
+  int result;
+  // If we have a saved cwd change back to it and close the fd.
+  if (saved_cwd_fd != -1) {
+    result = fchdir(saved_cwd_fd);
+    ::close(saved_cwd_fd);
+  }
+
+  // Close the directory.
+  os::closedir(dirp);
+}
+
+// Check if the given file descriptor is considered a secure.
+//
+static bool is_file_secure(int fd, const char *filename) {
+
+  int result;
+  struct stat statbuf;
+
+  // Determine if the file is secure.
+  RESTARTABLE(::fstat(fd, &statbuf), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("fstat failed on %s: %s\n", filename, strerror(errno));
+    }
+    return false;
+  }
+  if (statbuf.st_nlink > 1) {
+    // A file with multiple links is not expected.
+    if (PrintMiscellaneous && Verbose) {
+      warning("file %s has multiple links\n", filename);
+    }
+    return false;
   }
   return true;
 }
@@ -317,9 +506,11 @@
 
   const char* tmpdirname = os::get_temp_directory();
 
+  // open the temp directory
   DIR* tmpdirp = os::opendir(tmpdirname);
 
   if (tmpdirp == NULL) {
+    // Cannot open the directory to get the user name, return.
     return NULL;
   }
 
@@ -344,7 +535,8 @@
     strcat(usrdir_name, "/");
     strcat(usrdir_name, dentry->d_name);
 
-    DIR* subdirp = os::opendir(usrdir_name);
+    // open the user directory
+    DIR* subdirp = open_directory_secure(usrdir_name);
 
     if (subdirp == NULL) {
       FREE_C_HEAP_ARRAY(char, usrdir_name);
@@ -465,26 +657,6 @@
 }
 
 
-// remove file
-//
-// this method removes the file with the given file name in the
-// named directory.
-//
-static void remove_file(const char* dirname, const char* filename) {
-
-  size_t nbytes = strlen(dirname) + strlen(filename) + 2;
-  char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
-
-  strcpy(path, dirname);
-  strcat(path, "/");
-  strcat(path, filename);
-
-  remove_file(path);
-
-  FREE_C_HEAP_ARRAY(char, path);
-}
-
-
 // cleanup stale shared memory resources
 //
 // This method attempts to remove all stale shared memory files in
@@ -496,17 +668,11 @@
 //
 static void cleanup_sharedmem_resources(const char* dirname) {
 
-  // open the user temp directory
-  DIR* dirp = os::opendir(dirname);
-
+  int saved_cwd_fd;
+  // open the directory
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
   if (dirp == NULL) {
-    // directory doesn't exist, so there is nothing to cleanup
-    return;
-  }
-
-  if (!is_directory_secure(dirname)) {
-    // the directory is not a secure directory
-    os::closedir(dirp);
+    // directory doesn't exist or is insecure, so there is nothing to cleanup
     return;
   }
 
@@ -520,6 +686,7 @@
   //
   struct dirent* entry;
   char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
+
   errno = 0;
   while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
 
@@ -528,9 +695,8 @@
     if (pid == 0) {
 
       if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
-
         // attempt to remove all unexpected files, except "." and ".."
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
       }
 
       errno = 0;
@@ -552,12 +718,14 @@
     //
     if ((pid == os::current_process_id()) ||
         (kill(pid, 0) == OS_ERR && (errno == ESRCH || errno == EPERM))) {
-
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
     }
     errno = 0;
   }
-  os::closedir(dirp);
+
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
+
   FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
@@ -614,19 +782,54 @@
     return -1;
   }
 
+  int saved_cwd_fd;
+  // open the directory and set the current working directory to it
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so cannot create shared
+    // memory file.
+    return -1;
+  }
+
+  // Open the filename in the current directory.
+  // Cannot use O_TRUNC here; truncation of an existing file has to happen
+  // after the is_file_secure() check below.
   int result;
-
-  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE), result);
+  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
   if (result == OS_ERR) {
     if (PrintMiscellaneous && Verbose) {
-      warning("could not create file %s: %s\n", filename, strerror(errno));
+      if (errno == ELOOP) {
+        warning("file %s is a symlink and is not secure\n", filename);
+      } else {
+        warning("could not create file %s: %s\n", filename, strerror(errno));
+      }
     }
+    // close the directory and reset the current working directory
+    close_directory_secure_cwd(dirp, saved_cwd_fd);
+
     return -1;
   }
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
 
   // save the file descriptor
   int fd = result;
 
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  // truncate the file to get rid of any existing data
+  RESTARTABLE(::ftruncate(fd, (off_t)0), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("could not truncate shared memory file: %s\n", strerror(errno));
+    }
+    ::close(fd);
+    return -1;
+  }
   // set the file size
   RESTARTABLE(::ftruncate(fd, (off_t)size), result);
   if (result == OS_ERR) {
@@ -684,8 +887,15 @@
       THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
     }
   }
+  int fd = result;
 
-  return result;
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  return fd;
 }
 
 // create a named shared memory region. returns the address of the
@@ -716,6 +926,13 @@
 
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
+  // get the short filename
+  char* short_filename = strrchr(filename, '/');
+  if (short_filename == NULL) {
+    short_filename = filename;
+  } else {
+    short_filename++;
+  }
 
   // cleanup any stale shared memory files
   cleanup_sharedmem_resources(dirname);
@@ -723,7 +940,7 @@
   assert(((size > 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemory region size");
 
-  fd = create_sharedmem_resources(dirname, filename, size);
+  fd = create_sharedmem_resources(dirname, short_filename, size);
 
   FREE_C_HEAP_ARRAY(char, user_name);
   FREE_C_HEAP_ARRAY(char, dirname);
@@ -838,12 +1055,12 @@
   // constructs for the file and the shared memory mapping.
   if (mode == PerfMemory::PERF_MODE_RO) {
     mmap_prot = PROT_READ;
-    file_flags = O_RDONLY;
+    file_flags = O_RDONLY | O_NOFOLLOW;
   }
   else if (mode == PerfMemory::PERF_MODE_RW) {
 #ifdef LATER
     mmap_prot = PROT_READ | PROT_WRITE;
-    file_flags = O_RDWR;
+    file_flags = O_RDWR | O_NOFOLLOW;
 #else
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Unsupported access mode");
--- a/src/os/linux/vm/vmError_linux.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/linux/vm/vmError_linux.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -63,9 +63,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -78,19 +84,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -100,16 +106,26 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  pthread_sigmask(SIG_UNBLOCK, &newset, NULL);
+
 }
--- a/src/os/solaris/vm/dtraceJSDT_solaris.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,655 +0,0 @@
-/*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-#ifdef HAVE_DTRACE_H
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dtrace.h>
-
-static const char* devname    = "/dev/dtrace/helper";
-static const char* olddevname = "/devices/pseudo/dtrace@0:helper";
-
-static const char* string_sig = "uintptr_t";
-static const char* int_sig    = "long";
-static const char* long_sig   = "long long";
-
-static void printDOFHelper(dof_helper_t* helper);
-
-static int dofhelper_open() {
-  int fd;
-  if ((fd = open64(devname, O_RDWR)) < 0) {
-    // Optimize next calls
-    devname = olddevname;
-    if ((fd = open64(devname, O_RDWR)) < 0) {
-      return -1;
-    }
-  }
-  return fd;
-}
-
-static jint dof_register(jstring module, uint8_t* dof, void* modaddr) {
-  int probe;
-  dof_helper_t dh;
-  int fd;
-
-  memset(&dh, 0, sizeof(dh));
-
-  char* module_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(module));
-  jio_snprintf(dh.dofhp_mod, sizeof(dh.dofhp_mod), "%s", module_name);
-  dh.dofhp_dof  = (uint64_t)dof;
-  dh.dofhp_addr = (uint64_t)modaddr;
-
-  fd = dofhelper_open();
-  if (fd < 0)
-    return -1;
-  probe = ioctl(fd, DTRACEHIOC_ADDDOF, &dh);
-  close(fd);
-  if (PrintDTraceDOF) {
-    printDOFHelper(&dh);
-    tty->print_cr("DOF helper id = %d", probe);
-  }
-  return probe;
-}
-
-int DTraceJSDT::pd_activate(
-    void* moduleBaseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-
-  // We need sections:
-  //  (1) STRTAB
-  //  (
-  //    (2) PROVIDER
-  //    (3) PROBES
-  //    (4) PROBOFFS
-  //    (5) PROBARGS
-  //  ) * Number of Providers
-
-  // Type of sections we create
-  enum {
-    STRTAB = 0,
-    PROVIDERS = 1,
-    PROBES = 2,
-    PROBE_OFFSETS = 3,
-    ARG_OFFSETS = 4,
-    NUM_SECTIONS = 5
-  };
-
-  static int alignment_for[NUM_SECTIONS] = { 1, 4, 8, 4, 1 };
-
-  ResourceMark rm;
-
-  uint32_t num_sections = 1 + 4 * providers_count;
-  uint32_t offset = sizeof(dof_hdr_t) + (num_sections * sizeof(dof_sec_t));
-  uint32_t* secoffs = NEW_RESOURCE_ARRAY(uint32_t, num_sections);
-  uint32_t* secsize = NEW_RESOURCE_ARRAY(uint32_t, num_sections);
-
-  // Store offsets of all strings here in such order:
-  //  zero-string (always 0)
-  //  provider1-name
-  //    probe1-function
-  //    probe1-name
-  //    arg-1
-  //    arg-2
-  //    ...
-  //    probe2-function
-  //    probe2-name
-  //    arg-1
-  //    arg-2
-  //  provider2-name
-  //    ...
-
-  uint32_t strcount  = 0;
-  // Count the number of strings we'll need
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    // Provider name
-    ++strcount;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      // function + name + one per argument
-      strcount += 2 + ArgumentCount(sig).size();
-    }
-  }
-
-  // Create place for string offsets
-  uint32_t* stroffs = NEW_RESOURCE_ARRAY(uint32_t, strcount + 1);
-  uint32_t string_index = 0;
-  uint32_t curstr = 0;
-
-  // First we need an empty string: ""
-  stroffs[curstr++] = string_index;
-  string_index += strlen("") + 1;
-
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    char* provider_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(provider->name));
-    stroffs[curstr++] = string_index;
-    string_index += strlen(provider_name) + 1;
-
-    // All probes
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-
-      char* function = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->function));
-      stroffs[curstr++] = string_index;
-      string_index += strlen(function) + 1;
-
-      char* name = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->name));
-      stroffs[curstr++] = string_index;
-      string_index += strlen(name) + 1;
-
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      SignatureStream ss(sig);
-      for ( ; !ss.at_return_type(); ss.next()) {
-        BasicType bt = ss.type();
-        const char* t = NULL;
-        if (bt == T_OBJECT &&
-            ss.as_symbol_or_null() == vmSymbols::java_lang_String()) {
-          t = string_sig;
-        } else if (bt == T_LONG) {
-          t = long_sig;
-        } else {
-          t = int_sig;
-        }
-        stroffs[curstr++] = string_index;
-        string_index += strlen(t) + 1;
-      }
-    }
-  }
-  secoffs[STRTAB] = offset;
-  secsize[STRTAB] = string_index;
-  offset += string_index;
-
-  // Calculate the size of the rest
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    size_t provider_sec  = PROVIDERS     + prvc * 4;
-    size_t probe_sec     = PROBES        + prvc * 4;
-    size_t probeoffs_sec = PROBE_OFFSETS + prvc * 4;
-    size_t argoffs_sec   = ARG_OFFSETS   + prvc * 4;
-
-    // Allocate space for the provider data struction
-    secoffs[provider_sec] = align_size_up(offset, alignment_for[PROVIDERS]);
-    secsize[provider_sec] = sizeof(dof_provider_t);
-    offset = secoffs[provider_sec] + secsize[provider_sec];
-
-    // Allocate space for all the probes
-    secoffs[probe_sec] = align_size_up(offset, alignment_for[PROBES]);
-    secsize[probe_sec] = sizeof(dof_probe_t) * provider->probe_count;
-    offset = secoffs[probe_sec] + secsize[probe_sec];
-
-    // Allocate space for the probe offsets
-    secoffs[probeoffs_sec] = align_size_up(offset, alignment_for[PROBE_OFFSETS]);
-    secsize[probeoffs_sec] = sizeof(uint32_t) * provider->probe_count;
-    offset = secoffs[probeoffs_sec] + secsize[probeoffs_sec];
-
-    // We need number of arguments argoffs
-    uint32_t argscount = 0;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-       JVM_DTraceProbe* p = &(provider->probes[prbc]);
-       Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-       argscount += ArgumentCount(sig).size();
-    }
-    secoffs[argoffs_sec] = align_size_up(offset, alignment_for[ARG_OFFSETS]);
-    secsize[argoffs_sec] = sizeof(uint8_t) * argscount;
-    offset = secoffs[argoffs_sec] + secsize[argoffs_sec];
-  }
-
-  uint32_t size = offset;
-
-  uint8_t* dof = NEW_RESOURCE_ARRAY(uint8_t, size);
-  if (!dof) {
-    return -1;
-  }
-  memset((void*)dof, 0, size);
-
-  // Fill memory with proper values
-  dof_hdr_t* hdr = (dof_hdr_t*)dof;
-  hdr->dofh_ident[DOF_ID_MAG0]     = DOF_MAG_MAG0;
-  hdr->dofh_ident[DOF_ID_MAG1]     = DOF_MAG_MAG1;
-  hdr->dofh_ident[DOF_ID_MAG2]     = DOF_MAG_MAG2;
-  hdr->dofh_ident[DOF_ID_MAG3]     = DOF_MAG_MAG3;
-  hdr->dofh_ident[DOF_ID_MODEL]    = DOF_MODEL_NATIVE;  // No variants
-  hdr->dofh_ident[DOF_ID_ENCODING] = DOF_ENCODE_NATIVE; // No variants
-  hdr->dofh_ident[DOF_ID_VERSION]  = DOF_VERSION_1;     // No variants
-  hdr->dofh_ident[DOF_ID_DIFVERS]  = DIF_VERSION_2;     // No variants
-  // all other fields of ident to zero
-
-  hdr->dofh_flags   = 0;
-  hdr->dofh_hdrsize = sizeof(dof_hdr_t);
-  hdr->dofh_secsize = sizeof(dof_sec_t);
-  hdr->dofh_secnum  = num_sections;
-  hdr->dofh_secoff  = sizeof(dof_hdr_t);
-  hdr->dofh_loadsz  = size;
-  hdr->dofh_filesz  = size;
-
-  // First section: STRTAB
-  dof_sec_t* sec = (dof_sec_t*)(dof + sizeof(dof_hdr_t));
-  sec->dofs_type    = DOF_SECT_STRTAB;
-  sec->dofs_align   = alignment_for[STRTAB];
-  sec->dofs_flags   = DOF_SECF_LOAD;
-  sec->dofs_entsize = 0;
-  sec->dofs_offset  = secoffs[STRTAB];
-  sec->dofs_size    = secsize[STRTAB];
-  // Make data for this section
-  char* str = (char*)(dof + sec->dofs_offset);
-
-  *str = 0; str += 1; // ""
-
-  // Run through all strings again
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    char* provider_name = java_lang_String::as_utf8_string(
-        JNIHandles::resolve_non_null(provider->name));
-    strcpy(str, provider_name);
-    str += strlen(provider_name) + 1;
-
-    // All probes
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-
-      char* function = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->function));
-      strcpy(str, function);
-      str += strlen(str) + 1;
-
-      char* name = java_lang_String::as_utf8_string(
-          JNIHandles::resolve_non_null(p->name));
-      strcpy(str, name);
-      str += strlen(name) + 1;
-
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      SignatureStream ss(sig);
-      for ( ; !ss.at_return_type(); ss.next()) {
-        BasicType bt = ss.type();
-        const char* t;
-        if (bt == T_OBJECT &&
-            ss.as_symbol_or_null() == vmSymbols::java_lang_String()) {
-          t = string_sig;
-        } else if (bt == T_LONG) {
-          t = long_sig;
-        } else {
-          t = int_sig;
-        }
-        strcpy(str, t);
-        str += strlen(t) + 1;
-      }
-    }
-  }
-
-  curstr = 1;
-  for(int prvc = 0; prvc < providers_count; ++prvc) {
-    JVM_DTraceProvider* provider = &providers[prvc];
-    size_t provider_sec  = PROVIDERS     + prvc * 4;
-    size_t probe_sec     = PROBES        + prvc * 4;
-    size_t probeoffs_sec = PROBE_OFFSETS + prvc * 4;
-    size_t argoffs_sec   = ARG_OFFSETS   + prvc * 4;
-
-    // PROVIDER ///////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * provider_sec);
-    sec->dofs_type    = DOF_SECT_PROVIDER;
-    sec->dofs_align   = alignment_for[PROVIDERS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = 0;
-    sec->dofs_offset  = secoffs[provider_sec];
-    sec->dofs_size    = secsize[provider_sec];
-    // Make provider decriiption
-    dof_provider_t* prv = (dof_provider_t*)(dof + sec->dofs_offset);
-    prv->dofpv_strtab   = STRTAB;
-    prv->dofpv_probes   = probe_sec;
-    prv->dofpv_prargs   = argoffs_sec;
-    prv->dofpv_proffs   = probeoffs_sec;
-    prv->dofpv_name     = stroffs[curstr++]; // Index in string table
-    prv->dofpv_provattr = DOF_ATTR(
-        provider->providerAttributes.nameStability,
-        provider->providerAttributes.dataStability,
-        provider->providerAttributes.dependencyClass);
-    prv->dofpv_modattr = DOF_ATTR(
-        provider->moduleAttributes.nameStability,
-        provider->moduleAttributes.dataStability,
-        provider->moduleAttributes.dependencyClass);
-    prv->dofpv_funcattr = DOF_ATTR(
-        provider->functionAttributes.nameStability,
-        provider->functionAttributes.dataStability,
-        provider->functionAttributes.dependencyClass);
-    prv->dofpv_nameattr = DOF_ATTR(
-        provider->nameAttributes.nameStability,
-        provider->nameAttributes.dataStability,
-        provider->nameAttributes.dependencyClass);
-    prv->dofpv_argsattr = DOF_ATTR(
-        provider->argsAttributes.nameStability,
-        provider->argsAttributes.dataStability,
-        provider->argsAttributes.dependencyClass);
-
-    // PROBES /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * probe_sec);
-    sec->dofs_type    = DOF_SECT_PROBES;
-    sec->dofs_align   = alignment_for[PROBES];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(dof_probe_t);
-    sec->dofs_offset  = secoffs[probe_sec];
-    sec->dofs_size    = secsize[probe_sec];
-    // Make probes descriptions
-    uint32_t argsoffs = 0;
-    for(int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* probe = &(provider->probes[prbc]);
-      Method* m = Method::resolve_jmethod_id(probe->method);
-      int arg_count = ArgumentCount(m->signature()).size();
-      assert(m->code() != NULL, "must have an nmethod");
-
-      dof_probe_t* prb =
-         (dof_probe_t*)(dof + sec->dofs_offset + prbc * sizeof(dof_probe_t));
-
-      prb->dofpr_addr   = (uint64_t)m->code()->entry_point();
-      prb->dofpr_func   = stroffs[curstr++]; // Index in string table
-      prb->dofpr_name   = stroffs[curstr++]; // Index in string table
-      prb->dofpr_nargv  = stroffs[curstr  ]; // Index in string table
-      // We spent siglen strings here
-      curstr += arg_count;
-      prb->dofpr_xargv  = prb->dofpr_nargv;  // Same bunch of strings
-      prb->dofpr_argidx = argsoffs;
-      prb->dofpr_offidx = prbc;
-      prb->dofpr_nargc  = arg_count;
-      prb->dofpr_xargc  = arg_count;
-      prb->dofpr_noffs  = 1; // Number of offsets
-      // Next bunch of offsets
-      argsoffs += arg_count;
-    }
-
-    // PROFFS /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * probeoffs_sec);
-    sec->dofs_type    = DOF_SECT_PROFFS;
-    sec->dofs_align   = alignment_for[PROBE_OFFSETS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(uint32_t);
-    sec->dofs_offset  = secoffs[probeoffs_sec];
-    sec->dofs_size    = secsize[probeoffs_sec];
-    // Make offsets
-    for (int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      uint32_t* pof =
-          (uint32_t*)(dof + sec->dofs_offset + sizeof(uint32_t) * prbc);
-      JVM_DTraceProbe* probe = &(provider->probes[prbc]);
-      Method* m = Method::resolve_jmethod_id(probe->method);
-      *pof = m->code()->trap_offset();
-    }
-
-    // PRARGS /////////////////////////////////////////////////////////////////
-    // Section header
-    sec = (dof_sec_t*)
-        (dof + sizeof(dof_hdr_t) + sizeof(dof_sec_t) * argoffs_sec);
-    sec->dofs_type    = DOF_SECT_PRARGS;
-    sec->dofs_align   = alignment_for[ARG_OFFSETS];
-    sec->dofs_flags   = DOF_SECF_LOAD;
-    sec->dofs_entsize = sizeof(uint8_t);
-    sec->dofs_offset  = secoffs[argoffs_sec];
-    sec->dofs_size    = secsize[argoffs_sec];
-    // Make arguments
-    uint8_t* par = (uint8_t*)(dof + sec->dofs_offset);
-    for (int prbc = 0; prbc < provider->probe_count; ++prbc) {
-      JVM_DTraceProbe* p = &(provider->probes[prbc]);
-      Symbol* sig = Method::resolve_jmethod_id(p->method)->signature();
-      uint8_t count = (uint8_t)ArgumentCount(sig).size();
-      for (uint8_t i = 0; i < count; ++i) {
-        *par++ = i;
-      }
-    }
-  }
-
-  // Register module
-  return dof_register(module, dof, moduleBaseAddress);
-}
-
-
-void DTraceJSDT::pd_dispose(int handle) {
-  int fd;
-  if (handle == -1) {
-    return;
-  }
-  fd = dofhelper_open();
-  if (fd < 0)
-    return;
-  ioctl(fd, DTRACEHIOC_REMOVE, handle);
-  close(fd);
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  int fd = dofhelper_open();
-  if (fd < 0) {
-    return false;
-  }
-  close(fd);
-  return true;
-}
-
-static const char* dofSecTypeFor(uint32_t type) {
-  switch (type) {
-    case 0:  return "DOF_SECT_NONE";
-    case 1:  return "DOF_SECT_COMMENTS";
-    case 2:  return "DOF_SECT_SOURCE";
-    case 3:  return "DOF_SECT_ECBDESC";
-    case 4:  return "DOF_SECT_PROBEDESC";
-    case 5:  return "DOF_SECT_ACTDESC";
-    case 6:  return "DOF_SECT_DIFOHDR";
-    case 7:  return "DOF_SECT_DIF";
-    case 8:  return "DOF_SECT_STRTAB";
-    case 9:  return "DOF_SECT_VARTAB";
-    case 10: return "DOF_SECT_RELTAB";
-    case 11: return "DOF_SECT_TYPETAB";
-    case 12: return "DOF_SECT_URELHDR";
-    case 13: return "DOF_SECT_KRELHDR";
-    case 14: return "DOF_SECT_OPTDESC";
-    case 15: return "DOF_SECT_PROVIDER";
-    case 16: return "DOF_SECT_PROBES";
-    case 17: return "DOF_SECT_PRARGS";
-    case 18: return "DOF_SECT_PROFFS";
-    case 19: return "DOF_SECT_INTTAB";
-    case 20: return "DOF_SECT_UTSNAME";
-    case 21: return "DOF_SECT_XLTAB";
-    case 22: return "DOF_SECT_XLMEMBERS";
-    case 23: return "DOF_SECT_XLIMPORT";
-    case 24: return "DOF_SECT_XLEXPORT";
-    case 25: return "DOF_SECT_PREXPORT";
-    case 26: return "DOF_SECT_PRENOFFS";
-    default: return "<unknown>";
-  }
-}
-
-static void printDOFStringTabSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   String Table:");
-  for (size_t idx = 0; idx < limit; /*empty*/) {
-    char* str = ((char*)dof) + tab + idx;
-    tty->print_cr("//   [0x%x + 0x%x] '%s'", tab, idx, str);
-    idx += strlen(str) + 1;
-  }
-}
-
-static void printDOFProviderSec(void* dof, dof_sec_t* sec) {
-  dof_provider_t* prov = (dof_provider_t*)((char*)dof + sec->dofs_offset);
-  tty->print_cr("//   dof_provider_t {");
-  tty->print_cr("//     dofpv_strtab = %d", prov->dofpv_strtab);
-  tty->print_cr("//     dofpv_probes = %d", prov->dofpv_probes);
-  tty->print_cr("//     dofpv_prargs = %d", prov->dofpv_prargs);
-  tty->print_cr("//     dofpv_proffs = %d", prov->dofpv_proffs);
-  tty->print_cr("//     dofpv_name = 0x%x", prov->dofpv_name);
-  tty->print_cr("//     dofpv_provattr = 0x%08x", prov->dofpv_provattr);
-  tty->print_cr("//     dofpv_modattr = 0x%08x", prov->dofpv_modattr);
-  tty->print_cr("//     dofpv_funcattr = 0x%08x", prov->dofpv_funcattr);
-  tty->print_cr("//     dofpv_nameattr = 0x%08x", prov->dofpv_nameattr);
-  tty->print_cr("//     dofpv_argsattr = 0x%08x", prov->dofpv_argsattr);
-  tty->print_cr("//   }");
-}
-
-static void printDOFProbesSec(void* dof, dof_sec_t* sec) {
-  size_t idx = sec->dofs_offset;
-  size_t limit = idx + sec->dofs_size;
-  for (size_t idx = sec->dofs_offset; idx < limit; idx += sec->dofs_entsize) {
-    dof_probe_t* prb = (dof_probe_t*)((char*)dof + idx);
-    tty->print_cr("//   dof_probe_t {");
-    tty->print_cr("//     dofpr_addr = 0x%016llx", prb->dofpr_addr);
-    tty->print_cr("//     dofpr_func = 0x%x", prb->dofpr_func);
-    tty->print_cr("//     dofpr_name = 0x%x", prb->dofpr_name);
-    tty->print_cr("//     dofpr_nargv = 0x%x", prb->dofpr_nargv);
-    tty->print_cr("//     dofpr_xargv = 0x%x", prb->dofpr_xargv);
-    tty->print_cr("//     dofpr_argidx = 0x%x", prb->dofpr_argidx);
-    tty->print_cr("//     dofpr_offidx = 0x%x", prb->dofpr_offidx);
-    tty->print_cr("//     dofpr_nargc = %d", prb->dofpr_nargc);
-    tty->print_cr("//     dofpr_xargc = %d", prb->dofpr_xargc);
-    tty->print_cr("//     dofpr_noffs = %d", prb->dofpr_noffs);
-    tty->print_cr("//   }");
-  }
-}
-
-static void printDOFOffsetsSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   Offsets:");
-  for (size_t idx = 0; idx < limit; idx += sec->dofs_entsize) {
-    uint32_t* off = (uint32_t*)((char*)dof + tab + idx);
-    tty->print_cr("//   [0x%x + 0x%x]: %d", tab, idx, *off);
-  }
-}
-
-static void printDOFArgsSec(void* dof, dof_sec_t* sec) {
-  size_t tab = sec->dofs_offset;
-  size_t limit = sec->dofs_size;
-  tty->print_cr("//   Arguments:");
-  for (size_t idx = 0; idx < limit; idx += sec->dofs_entsize) {
-    uint8_t* arg = (uint8_t*)((char*)dof + tab + idx);
-    tty->print_cr("//   [0x%x + 0x%x]: %d", tab, idx, *arg);
-  }
-}
-
-static void printDOFSection(void* dof, dof_sec_t* sec) {
-  tty->print_cr("//   dof_sec_t {");
-  tty->print_cr("//     dofs_type = 0x%x /* %s */",
-                sec->dofs_type, dofSecTypeFor(sec->dofs_type));
-  tty->print_cr("//     dofs_align = %d", sec->dofs_align);
-  tty->print_cr("//     dofs_flags = 0x%x", sec->dofs_flags);
-  tty->print_cr("//     dofs_entsize = %d", sec->dofs_entsize);
-  tty->print_cr("//     dofs_offset = 0x%llx", sec->dofs_offset);
-  tty->print_cr("//     dofs_size = %lld", sec->dofs_size);
-  tty->print_cr("//   }");
-  switch (sec->dofs_type) {
-    case DOF_SECT_STRTAB:    printDOFStringTabSec(dof, sec); break;
-    case DOF_SECT_PROVIDER:  printDOFProviderSec(dof, sec);  break;
-    case DOF_SECT_PROBES:    printDOFProbesSec(dof, sec);    break;
-    case DOF_SECT_PROFFS:    printDOFOffsetsSec(dof, sec);   break;
-    case DOF_SECT_PRARGS:    printDOFArgsSec(dof, sec);      break;
-    default: tty->print_cr("//   <section type not recognized>");
-  }
-}
-
-static void printDOFHeader(dof_hdr_t* hdr) {
-  tty->print_cr("//   dof_hdr_t {");
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG0] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG0]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG1] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG1]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG2] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG2]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MAG3] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MAG3]);
-  tty->print_cr("//     dofh_ident[DOF_ID_MODEL] = 0x%x",
-                hdr->dofh_ident[DOF_ID_MODEL]);
-  tty->print_cr("//     dofh_ident[DOF_ID_ENCODING] = 0x%x",
-                hdr->dofh_ident[DOF_ID_ENCODING]);
-  tty->print_cr("//     dofh_ident[DOF_ID_VERSION] = 0x%x",
-                hdr->dofh_ident[DOF_ID_VERSION]);
-  tty->print_cr("//     dofh_ident[DOF_ID_DIFVERS] = 0x%x",
-                hdr->dofh_ident[DOF_ID_DIFVERS]);
-  tty->print_cr("//     dofh_flags = 0x%x", hdr->dofh_flags);
-  tty->print_cr("//     dofh_hdrsize = %d", hdr->dofh_hdrsize);
-  tty->print_cr("//     dofh_secsize = %d", hdr->dofh_secsize);
-  tty->print_cr("//     dofh_secnum = %d", hdr->dofh_secnum);
-  tty->print_cr("//     dofh_secoff = %lld", hdr->dofh_secoff);
-  tty->print_cr("//     dofh_loadsz = %lld", hdr->dofh_loadsz);
-  tty->print_cr("//     dofh_filesz = %lld", hdr->dofh_filesz);
-  tty->print_cr("//   }");
-}
-
-static void printDOF(void* dof) {
-  dof_hdr_t* hdr = (dof_hdr_t*)dof;
-  printDOFHeader(hdr);
-  for (int i = 0; i < hdr->dofh_secnum; ++i) {
-    dof_sec_t* sec =
-      (dof_sec_t*)((char*)dof + sizeof(dof_hdr_t) + i * sizeof(dof_sec_t));
-    tty->print_cr("//   [Section #%d]", i);
-    printDOFSection(dof, sec);
-  }
-}
-
-static void printDOFHelper(dof_helper_t* helper) {
-  tty->print_cr("// dof_helper_t {");
-  tty->print_cr("//   dofhp_mod = \"%s\"", helper->dofhp_mod);
-  tty->print_cr("//   dofhp_addr = 0x%016llx", helper->dofhp_addr);
-  tty->print_cr("//   dofhp_dof = 0x%016llx", helper->dofhp_dof);
-  printDOF((void*)helper->dofhp_dof);
-  tty->print_cr("// }");
-  size_t len = ((dof_hdr_t*)helper)->dofh_loadsz;
-  tty->print_data((void*)helper->dofhp_dof, len, true);
-}
-
-#else // ndef HAVE_DTRACE_H
-
-// Get here if we're not building on at least Solaris 10
-int DTraceJSDT::pd_activate(
-  void* baseAddress, jstring module,
-  jint provider_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
-#endif
--- a/src/os/solaris/vm/os_solaris.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/solaris/vm/os_solaris.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1475,6 +1475,16 @@
   return jlong(t.tv_sec) * 1000  +  jlong(t.tv_usec) / 1000;
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  timeval t;
+  if (gettimeofday(&t, NULL) == -1) {
+    fatal(err_msg("os::javaTimeSystemUTC: gettimeofday (%s)", strerror(errno)));
+  }
+  seconds = jlong(t.tv_sec);
+  nanos = jlong(t.tv_usec) * 1000;
+}
+
+
 jlong os::javaTimeNanos() {
   return (jlong)getTimeNanos();
 }
--- a/src/os/solaris/vm/perfMemory_solaris.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/solaris/vm/perfMemory_solaris.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -199,7 +199,38 @@
 }
 
 
-// check if the given path is considered a secure directory for
+// Check if the given statbuf is considered a secure directory for
+// the backing store files. Returns true if the directory is considered
+// a secure location. Returns false if the statbuf is a symbolic link or
+// if an error occurred.
+//
+static bool is_statbuf_secure(struct stat *statp) {
+  if (S_ISLNK(statp->st_mode) || !S_ISDIR(statp->st_mode)) {
+    // The path represents a link or some non-directory file type,
+    // which is not what we expected. Declare it insecure.
+    //
+    return false;
+  }
+  // We have an existing directory, check if the permissions are safe.
+  //
+  if ((statp->st_mode & (S_IWGRP|S_IWOTH)) != 0) {
+    // The directory is open for writing and could be subjected
+    // to a symlink or a hard link attack. Declare it insecure.
+    //
+    return false;
+  }
+  // See if the uid of the directory matches the effective uid of the process.
+  //
+  if (statp->st_uid != geteuid()) {
+    // The directory was not created by this user, declare it insecure.
+    //
+    return false;
+  }
+  return true;
+}
+
+
+// Check if the given path is considered a secure directory for
 // the backing store files. Returns true if the directory exists
 // and is considered a secure location. Returns false if the path
 // is a symbolic link or if an error occurred.
@@ -213,27 +244,185 @@
     return false;
   }
 
-  // the path exists, now check it's mode
-  if (S_ISLNK(statbuf.st_mode) || !S_ISDIR(statbuf.st_mode)) {
-    // the path represents a link or some non-directory file type,
-    // which is not what we expected. declare it insecure.
-    //
+  // The path exists, see if it is secure.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check if the given directory file descriptor is considered a secure
+// directory for the backing store files. Returns true if the directory
+// exists and is considered a secure location. Returns false if the path
+// is a symbolic link or if an error occurred.
+//
+static bool is_dirfd_secure(int dir_fd) {
+  struct stat statbuf;
+  int result = 0;
+
+  RESTARTABLE(::fstat(dir_fd, &statbuf), result);
+  if (result == OS_ERR) {
     return false;
   }
-  else {
-    // we have an existing directory, check if the permissions are safe.
-    //
-    if ((statbuf.st_mode & (S_IWGRP|S_IWOTH)) != 0) {
-      // the directory is open for writing and could be subjected
-      // to a symlnk attack. declare it insecure.
-      //
-      return false;
+
+  // The path exists, now check its mode.
+  return is_statbuf_secure(&statbuf);
+}
+
+
+// Check to make sure fd1 and fd2 are referencing the same file system object.
+//
+static bool is_same_fsobject(int fd1, int fd2) {
+  struct stat statbuf1;
+  struct stat statbuf2;
+  int result = 0;
+
+  RESTARTABLE(::fstat(fd1, &statbuf1), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+  RESTARTABLE(::fstat(fd2, &statbuf2), result);
+  if (result == OS_ERR) {
+    return false;
+  }
+
+  if ((statbuf1.st_ino == statbuf2.st_ino) &&
+      (statbuf1.st_dev == statbuf2.st_dev)) {
+    return true;
+  } else {
+    return false;
+  }
+}
+
+
+// Open the directory of the given path and validate it.
+// Return a DIR * of the open directory.
+//
+static DIR *open_directory_secure(const char* dirname) {
+  // Open the directory using open() so that it can be verified
+  // to be secure by calling is_dirfd_secure(), opendir() and then check
+  // to see if they are the same file system object.  This method does not
+  // introduce a window of opportunity for the directory to be attacked that
+  // calling opendir() and is_directory_secure() does.
+  int result;
+  DIR *dirp = NULL;
+  RESTARTABLE(::open(dirname, O_RDONLY|O_NOFOLLOW), result);
+  if (result == OS_ERR) {
+    // Directory doesn't exist or is a symlink, so there is nothing to cleanup.
+    if (PrintMiscellaneous && Verbose) {
+      if (errno == ELOOP) {
+        warning("directory %s is a symlink and is not secure\n", dirname);
+      } else {
+        warning("could not open directory %s: %s\n", dirname, strerror(errno));
+      }
     }
+    return dirp;
+  }
+  int fd = result;
+
+  // Determine if the open directory is secure.
+  if (!is_dirfd_secure(fd)) {
+    // The directory is not a secure directory.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Open the directory.
+  dirp = ::opendir(dirname);
+  if (dirp == NULL) {
+    // The directory doesn't exist, close fd and return.
+    os::close(fd);
+    return dirp;
+  }
+
+  // Check to make sure fd and dirp are referencing the same file system object.
+  if (!is_same_fsobject(fd, dirp->dd_fd)) {
+    // The directory is not secure.
+    os::close(fd);
+    os::closedir(dirp);
+    dirp = NULL;
+    return dirp;
+  }
+
+  // Close initial open now that we know directory is secure
+  os::close(fd);
+
+  return dirp;
+}
+
+// NOTE: The code below uses fchdir(), open() and unlink() because
+// fdopendir(), openat() and unlinkat() are not supported on all
+// versions.  Once the support for fdopendir(), openat() and unlinkat()
+// is available on all supported versions the code can be changed
+// to use these functions.
+
+// Open the directory of the given path, validate it and set the
+// current working directory to it.
+// Return a DIR * of the open directory and the saved cwd fd.
+//
+static DIR *open_directory_secure_cwd(const char* dirname, int *saved_cwd_fd) {
+
+  // Open the directory.
+  DIR* dirp = open_directory_secure(dirname);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so there is nothing to cleanup.
+    return dirp;
+  }
+  int fd = dirp->dd_fd;
+
+  // Open a fd to the cwd and save it off.
+  int result;
+  RESTARTABLE(::open(".", O_RDONLY), result);
+  if (result == OS_ERR) {
+    *saved_cwd_fd = -1;
+  } else {
+    *saved_cwd_fd = result;
+  }
+
+  // Set the current directory to dirname by using the fd of the directory.
+  result = fchdir(fd);
+
+  return dirp;
+}
+
+// Close the directory and restore the current working directory.
+//
+static void close_directory_secure_cwd(DIR* dirp, int saved_cwd_fd) {
+
+  int result;
+  // If we have a saved cwd change back to it and close the fd.
+  if (saved_cwd_fd != -1) {
+    result = fchdir(saved_cwd_fd);
+    ::close(saved_cwd_fd);
+  }
+
+  // Close the directory.
+  os::closedir(dirp);
+}
+
+// Check if the given file descriptor is considered a secure.
+//
+static bool is_file_secure(int fd, const char *filename) {
+
+  int result;
+  struct stat statbuf;
+
+  // Determine if the file is secure.
+  RESTARTABLE(::fstat(fd, &statbuf), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("fstat failed on %s: %s\n", filename, strerror(errno));
+    }
+    return false;
+  }
+  if (statbuf.st_nlink > 1) {
+    // A file with multiple links is not expected.
+    if (PrintMiscellaneous && Verbose) {
+      warning("file %s has multiple links\n", filename);
+    }
+    return false;
   }
   return true;
 }
 
-
 // return the user name for the given user id
 //
 // the caller is expected to free the allocated memory.
@@ -308,9 +497,11 @@
 
   const char* tmpdirname = os::get_temp_directory();
 
+  // open the temp directory
   DIR* tmpdirp = os::opendir(tmpdirname);
 
   if (tmpdirp == NULL) {
+    // Cannot open the directory to get the user name, return.
     return NULL;
   }
 
@@ -335,7 +526,8 @@
     strcat(usrdir_name, "/");
     strcat(usrdir_name, dentry->d_name);
 
-    DIR* subdirp = os::opendir(usrdir_name);
+    // open the user directory
+    DIR* subdirp = open_directory_secure(usrdir_name);
 
     if (subdirp == NULL) {
       FREE_C_HEAP_ARRAY(char, usrdir_name);
@@ -504,26 +696,6 @@
 }
 
 
-// remove file
-//
-// this method removes the file with the given file name in the
-// named directory.
-//
-static void remove_file(const char* dirname, const char* filename) {
-
-  size_t nbytes = strlen(dirname) + strlen(filename) + 2;
-  char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
-
-  strcpy(path, dirname);
-  strcat(path, "/");
-  strcat(path, filename);
-
-  remove_file(path);
-
-  FREE_C_HEAP_ARRAY(char, path);
-}
-
-
 // cleanup stale shared memory resources
 //
 // This method attempts to remove all stale shared memory files in
@@ -535,17 +707,11 @@
 //
 static void cleanup_sharedmem_resources(const char* dirname) {
 
-  // open the user temp directory
-  DIR* dirp = os::opendir(dirname);
-
+  int saved_cwd_fd;
+  // open the directory
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
   if (dirp == NULL) {
-    // directory doesn't exist, so there is nothing to cleanup
-    return;
-  }
-
-  if (!is_directory_secure(dirname)) {
-    // the directory is not a secure directory
-    os::closedir(dirp);
+    // directory doesn't exist or is insecure, so there is nothing to cleanup
     return;
   }
 
@@ -559,6 +725,7 @@
   //
   struct dirent* entry;
   char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
+
   errno = 0;
   while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
 
@@ -569,7 +736,7 @@
       if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0) {
 
         // attempt to remove all unexpected files, except "." and ".."
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
       }
 
       errno = 0;
@@ -592,11 +759,14 @@
     if ((pid == os::current_process_id()) ||
         (kill(pid, 0) == OS_ERR && (errno == ESRCH || errno == EPERM))) {
 
-        remove_file(dirname, entry->d_name);
+        unlink(entry->d_name);
     }
     errno = 0;
   }
-  os::closedir(dirp);
+
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
+
   FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
@@ -653,19 +823,54 @@
     return -1;
   }
 
+  int saved_cwd_fd;
+  // open the directory and set the current working directory to it
+  DIR* dirp = open_directory_secure_cwd(dirname, &saved_cwd_fd);
+  if (dirp == NULL) {
+    // Directory doesn't exist or is insecure, so cannot create shared
+    // memory file.
+    return -1;
+  }
+
+  // Open the filename in the current directory.
+  // Cannot use O_TRUNC here; truncation of an existing file has to happen
+  // after the is_file_secure() check below.
   int result;
-
-  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE), result);
+  RESTARTABLE(::open(filename, O_RDWR|O_CREAT|O_NOFOLLOW, S_IREAD|S_IWRITE), result);
   if (result == OS_ERR) {
     if (PrintMiscellaneous && Verbose) {
-      warning("could not create file %s: %s\n", filename, strerror(errno));
+      if (errno == ELOOP) {
+        warning("file %s is a symlink and is not secure\n", filename);
+      } else {
+        warning("could not create file %s: %s\n", filename, strerror(errno));
+      }
     }
+    // close the directory and reset the current working directory
+    close_directory_secure_cwd(dirp, saved_cwd_fd);
+
     return -1;
   }
+  // close the directory and reset the current working directory
+  close_directory_secure_cwd(dirp, saved_cwd_fd);
 
   // save the file descriptor
   int fd = result;
 
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  // truncate the file to get rid of any existing data
+  RESTARTABLE(::ftruncate(fd, (off_t)0), result);
+  if (result == OS_ERR) {
+    if (PrintMiscellaneous && Verbose) {
+      warning("could not truncate shared memory file: %s\n", strerror(errno));
+    }
+    ::close(fd);
+    return -1;
+  }
   // set the file size
   RESTARTABLE(::ftruncate(fd, (off_t)size), result);
   if (result == OS_ERR) {
@@ -701,8 +906,15 @@
       THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
     }
   }
+  int fd = result;
 
-  return result;
+  // check to see if the file is secure
+  if (!is_file_secure(fd, filename)) {
+    ::close(fd);
+    return -1;
+  }
+
+  return fd;
 }
 
 // create a named shared memory region. returns the address of the
@@ -734,13 +946,21 @@
   char* dirname = get_user_tmp_dir(user_name);
   char* filename = get_sharedmem_filename(dirname, vmid);
 
+  // get the short filename
+  char* short_filename = strrchr(filename, '/');
+  if (short_filename == NULL) {
+    short_filename = filename;
+  } else {
+    short_filename++;
+  }
+
   // cleanup any stale shared memory files
   cleanup_sharedmem_resources(dirname);
 
   assert(((size > 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemory region size");
 
-  fd = create_sharedmem_resources(dirname, filename, size);
+  fd = create_sharedmem_resources(dirname, short_filename, size);
 
   FREE_C_HEAP_ARRAY(char, user_name);
   FREE_C_HEAP_ARRAY(char, dirname);
@@ -856,12 +1076,12 @@
   // constructs for the file and the shared memory mapping.
   if (mode == PerfMemory::PERF_MODE_RO) {
     mmap_prot = PROT_READ;
-    file_flags = O_RDONLY;
+    file_flags = O_RDONLY | O_NOFOLLOW;
   }
   else if (mode == PerfMemory::PERF_MODE_RW) {
 #ifdef LATER
     mmap_prot = PROT_READ | PROT_WRITE;
-    file_flags = O_RDWR;
+    file_flags = O_RDWR | O_NOFOLLOW;
 #else
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Unsupported access mode");
--- a/src/os/solaris/vm/vmError_solaris.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/solaris/vm/vmError_solaris.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -30,6 +30,7 @@
 
 #include <sys/types.h>
 #include <sys/wait.h>
+#include <thread.h>
 #include <signal.h>
 
 void VMError::show_message_box(char *buf, int buflen) {
@@ -59,9 +60,15 @@
   } while (yes);
 }
 
+// handle all synchronous program error signals which may happen during error
+// reporting. They must be unblocked, caught, handled.
+
+static const int SIGNALS[] = { SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP }; // add more if needed
+static const int NUM_SIGNALS = sizeof(SIGNALS) / sizeof(int);
+
 // Space for our "saved" signal flags and handlers
-static int resettedSigflags[2];
-static address resettedSighandler[2];
+static int resettedSigflags[NUM_SIGNALS];
+static address resettedSighandler[NUM_SIGNALS];
 
 static void save_signal(int idx, int sig)
 {
@@ -74,19 +81,19 @@
 }
 
 int VMError::get_resetted_sigflags(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSigflags[0];
-  } else if(SIGBUS == sig) {
-    return resettedSigflags[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSigflags[i];
+    }
   }
   return -1;
 }
 
 address VMError::get_resetted_sighandler(int sig) {
-  if(SIGSEGV == sig) {
-    return resettedSighandler[0];
-  } else if(SIGBUS == sig) {
-    return resettedSighandler[1];
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    if (SIGNALS[i] == sig) {
+      return resettedSighandler[i];
+    }
   }
   return NULL;
 }
@@ -96,16 +103,25 @@
   sigset_t newset;
   sigemptyset(&newset);
   sigaddset(&newset, sig);
-  sigprocmask(SIG_UNBLOCK, &newset, NULL);
+  // also unmask other synchronous signals
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
 
   VMError err(NULL, sig, NULL, info, ucVoid);
   err.report_and_die();
 }
 
 void VMError::reset_signal_handlers() {
-  // Save sigflags for resetted signals
-  save_signal(0, SIGSEGV);
-  save_signal(1, SIGBUS);
-  os::signal(SIGSEGV, CAST_FROM_FN_PTR(void *, crash_handler));
-  os::signal(SIGBUS, CAST_FROM_FN_PTR(void *, crash_handler));
+  // install signal handlers for all synchronous program error signals
+  sigset_t newset;
+  sigemptyset(&newset);
+
+  for (int i = 0; i < NUM_SIGNALS; i++) {
+    save_signal(i, SIGNALS[i]);
+    os::signal(SIGNALS[i], CAST_FROM_FN_PTR(void *, crash_handler));
+    sigaddset(&newset, SIGNALS[i]);
+  }
+  thr_sigsetmask(SIG_UNBLOCK, &newset, NULL);
 }
--- a/src/os/windows/vm/dtraceJSDT_windows.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1997, 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
- * 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 "precompiled.hpp"
-#include "classfile/javaClasses.hpp"
-#include "code/codeBlob.hpp"
-#include "memory/allocation.hpp"
-#include "prims/jvm.h"
-#include "runtime/dtraceJSDT.hpp"
-#include "runtime/jniHandles.hpp"
-#include "runtime/os.hpp"
-#include "runtime/signature.hpp"
-#include "utilities/globalDefinitions.hpp"
-
-int DTraceJSDT::pd_activate(
-    void* baseAddress, jstring module,
-    jint providers_count, JVM_DTraceProvider* providers) {
-  return -1;
-}
-
-void DTraceJSDT::pd_dispose(int handle) {
-}
-
-jboolean DTraceJSDT::pd_is_supported() {
-  return false;
-}
--- a/src/os/windows/vm/os_windows.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/os/windows/vm/os_windows.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -428,9 +428,9 @@
   }
 
   // Diagnostic code to investigate JDK-6573254
-  int res = 50115;  // non-java thread
+  int res = 30115;  // non-java thread
   if (thread->is_Java_thread()) {
-    res = 40115;    // java thread
+    res = 20115;    // java thread
   }
 
   // Install a win32 structured exception handler around every thread created
@@ -839,6 +839,12 @@
   return (a - offset()) / 10000;
 }
 
+// Returns time ticks in (10th of micro seconds)
+jlong windows_to_time_ticks(FILETIME wt) {
+  jlong a = jlong_from(wt.dwHighDateTime, wt.dwLowDateTime);
+  return (a - offset());
+}
+
 FILETIME java_to_windows_time(jlong l) {
   jlong a = (l * 10000) + offset();
   FILETIME result;
@@ -874,6 +880,15 @@
   }
 }
 
+void os::javaTimeSystemUTC(jlong &seconds, jlong &nanos) {
+  FILETIME wt;
+  GetSystemTimeAsFileTime(&wt);
+  jlong ticks = windows_to_time_ticks(wt); // 10th of micros
+  jlong secs = jlong(ticks / 10000000); // 10000 * 1000
+  seconds = secs;
+  nanos = jlong(ticks - (secs*10000000)) * 100;
+}
+
 jlong os::javaTimeNanos() {
   if (!win32::_has_performance_count) {
     return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do.
@@ -1693,7 +1708,7 @@
     }
     break;
 
-  case 6004:
+  case 10000:
     if (is_workstation) {
       st->print("10");
     } else {
@@ -3791,6 +3806,7 @@
 
     static INIT_ONCE init_once_crit_sect = INIT_ONCE_STATIC_INIT;
     static CRITICAL_SECTION crit_sect;
+    static volatile jint process_exiting = 0;
     int i, j;
     DWORD res;
     HANDLE hproc, hthr;
@@ -3798,10 +3814,10 @@
     // The first thread that reached this point, initializes the critical section.
     if (!InitOnceExecuteOnce(&init_once_crit_sect, init_crit_sect_call, &crit_sect, NULL)) {
       warning("crit_sect initialization failed in %s: %d\n", __FILE__, __LINE__);
-    } else {
+    } else if (OrderAccess::load_acquire(&process_exiting) == 0) {
       EnterCriticalSection(&crit_sect);
 
-      if (what == EPT_THREAD) {
+      if (what == EPT_THREAD && OrderAccess::load_acquire(&process_exiting) == 0) {
         // Remove from the array those handles of the threads that have completed exiting.
         for (i = 0, j = 0; i < handle_count; ++i) {
           res = WaitForSingleObject(handles[i], 0 /* don't wait */);
@@ -3856,7 +3872,7 @@
         // The current exiting thread has stored its handle in the array, and now
         // should leave the critical section before calling _endthreadex().
 
-      } else { // what != EPT_THREAD
+      } else if (what != EPT_THREAD) {
         if (handle_count > 0) {
           // Before ending the process, make sure all the threads that had called
           // _endthreadex() completed.
@@ -3882,24 +3898,28 @@
           handle_count = 0;
         }
 
-        // End the process, not leaving critical section.
-        // This makes sure no other thread executes exit-related code at the same
-        // time, thus a race is avoided.
-        if (what == EPT_PROCESS) {
-          ::exit(exit_code);
-        } else {
-          _exit(exit_code);
-        }
+        OrderAccess::release_store(&process_exiting, 1);
       }
 
       LeaveCriticalSection(&crit_sect);
     }
+
+    if (what == EPT_THREAD) {
+      while (OrderAccess::load_acquire(&process_exiting) != 0) {
+        // Some other thread is about to call exit(), so we
+        // don't let the current thread proceed to _endthreadex()
+        SuspendThread(GetCurrentThread());
+        // Avoid busy-wait loop, if SuspendThread() failed.
+        Sleep(EXIT_TIMEOUT);
+      }
+    }
   }
 
   // We are here if either
   // - there's no 'race at exit' bug on this OS release;
   // - initialization of the critical section failed (unlikely);
-  // - the current thread has stored its handle and left the critical section.
+  // - the current thread has stored its handle and left the critical section;
+  // - the process-exiting thread has raised the flag and left the critical section.
   if (what == EPT_THREAD) {
     _endthreadex((unsigned)exit_code);
   } else if (what == EPT_PROCESS) {
--- a/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/LogParser.java	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,12 +24,12 @@
 
 /**
  * A SAX based parser of LogCompilation output from HotSpot.  It takes a complete
- * @author never
  */
 
 package com.sun.hotspot.tools.compiler;
 
 import java.io.FileReader;
+import java.io.PrintStream;
 import java.io.Reader;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -134,6 +134,44 @@
         }
     };
 
+    class Jvms {
+        Jvms(Method method, int bci) {
+            this.method = method;
+            this.bci = bci;
+        }
+        final public Method method;
+        final public int bci;
+        final public String toString() {
+            return "@" + bci + " " + method;
+        }
+    }
+
+    class LockElimination extends BasicLogEvent {
+
+        ArrayList<Jvms> jvms = new ArrayList<Jvms>(1);
+        final String kind;
+        final String classId;
+        final String tagName;
+        LockElimination(String tagName, double start, String id, String kind, String classId) {
+            super(start, id);
+            this.kind = kind;
+            this.classId = classId;
+            this.tagName = tagName;
+        }
+
+        @Override
+        public void print(PrintStream stream) {
+            stream.printf("%s %s %s %s  %.3f ", getId(), tagName, kind, classId, getStart());
+            stream.print(jvms.toString());
+            stream.print("\n");
+        }
+
+        void addJVMS(Method method, int bci) {
+            jvms.add(new Jvms(method, bci));
+        }
+
+    }
+
     private ArrayList<LogEvent> events = new ArrayList<LogEvent>();
 
     private HashMap<String, String> types = new HashMap<String, String>();
@@ -147,6 +185,7 @@
     private CallSite site;
     private CallSite methodHandleSite;
     private Stack<Phase> phaseStack = new Stack<Phase>();
+    private LockElimination currentLockElimination;
     private UncommonTrapEvent currentTrap;
     private Stack<CallSite> lateInlineScope;
     private boolean lateInlining;
@@ -192,7 +231,12 @@
         }
 
         LogParser log = new LogParser();
-        p.parse(new InputSource(reader), log);
+        try {
+            p.parse(new InputSource(reader), log);
+        } catch (Throwable th) {
+            th.printStackTrace();
+            // Carry on with what we've got...
+        }
 
         // Associate compilations with their NMethods
         for (NMethod nm : log.nmethods.values()) {
@@ -418,8 +462,23 @@
                 // uncommon trap inserted during parsing.
                 // ignore for now
             }
+        } else if (qname.startsWith("eliminate_lock")) {
+            String id = atts.getValue("compile_id");
+            if (id != null) {
+                id = makeId(atts);
+                String kind = atts.getValue("kind");
+                String classId = atts.getValue("class_id");
+                currentLockElimination = new LockElimination(qname, Double.parseDouble(search(atts, "stamp")), id, kind, classId);
+                events.add(currentLockElimination);
+            }
         } else if (qname.equals("late_inline")) {
-            long inlineId = Long.parseLong(search(atts, "inline_id"));
+            long inlineId = 0;
+            try {
+                Long.parseLong(search(atts, "inline_id"));
+            } catch (InternalError ex) {
+                // Log files from older hotspots may lack inline_id,
+                // and zero is an acceptable substitute that allows processing to continue.
+            }
             lateInlineScope = new Stack<CallSite>();
             site = new CallSite(-999, method(search(atts, "method")));
             site.setInlineId(inlineId);
@@ -428,13 +487,14 @@
             // <jvms bci='4' method='java/io/DataInputStream readChar ()C' bytes='40' count='5815' iicount='20815'/>
             if (currentTrap != null) {
                 currentTrap.addJVMS(atts.getValue("method"), Integer.parseInt(atts.getValue("bci")));
+            } else if (currentLockElimination != null) {
+                  currentLockElimination.addJVMS(method(atts.getValue("method")), Integer.parseInt(atts.getValue("bci")));
             } else if (lateInlineScope != null) {
                 bci = Integer.parseInt(search(atts, "bci"));
                 site = new CallSite(bci, method(search(atts, "method")));
                 lateInlineScope.push(site);
             } else {
                 // Ignore <eliminate_allocation type='667'>,
-                //        <eliminate_lock lock='1'>,
                 //        <replace_string_concat arguments='2' string_alloc='0' multiple='0'>
             }
         } else if (qname.equals("inline_id")) {
@@ -512,6 +572,8 @@
             }
         } else if (qname.equals("uncommon_trap")) {
             currentTrap = null;
+        } else if (qname.startsWith("eliminate_lock")) {
+            currentLockElimination = null;
         } else if (qname.equals("late_inline")) {
             // Populate late inlining info.
             if (scopes.size() != 0) {
@@ -522,8 +584,8 @@
             CallSite caller = lateInlineScope.pop();
             Method m = compile.getMethod();
             if (m != caller.getMethod()) {
-                System.out.println(m);
-                System.out.println(caller.getMethod() + " bci: " + bci);
+                System.err.println(m);
+                System.err.println(caller.getMethod() + " bci: " + bci);
                 throw new InternalError("call site and late_inline info don't match");
             }
 
--- a/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/tools/LogCompilation/src/com/sun/hotspot/tools/compiler/UncommonTrapEvent.java	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
     }
 
     public void print(PrintStream stream) {
-        stream.printf("%s uncommon trap %s %s\n", getId(), getReason(), getAction());
+        stream.printf("%s uncommon trap %.3f %s %s\n", getId(), getStart(), getReason(), getAction());
         stream.print(getJvms());
     }
 
--- a/src/share/vm/adlc/formssel.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/adlc/formssel.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3489,9 +3489,7 @@
     "GetAndAddL", "GetAndSetL", "GetAndSetN",
   };
   int cnt = sizeof(needs_ideal_memory_list)/sizeof(char*);
-  if( strcmp(_opType,"PrefetchRead")==0 ||
-      strcmp(_opType,"PrefetchWrite")==0 ||
-      strcmp(_opType,"PrefetchAllocation")==0 )
+  if( strcmp(_opType,"PrefetchAllocation")==0 )
     return 1;
   if( _lChild ) {
     const char *opType = _lChild->_opType;
--- a/src/share/vm/adlc/main.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/adlc/main.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -220,7 +220,6 @@
   AD.addInclude(AD._CPP_file, "oops/markOop.hpp");
   AD.addInclude(AD._CPP_file, "oops/method.hpp");
   AD.addInclude(AD._CPP_file, "oops/oop.inline.hpp");
-  AD.addInclude(AD._CPP_file, "oops/oop.inline2.hpp");
   AD.addInclude(AD._CPP_file, "opto/cfgnode.hpp");
   AD.addInclude(AD._CPP_file, "opto/locknode.hpp");
   AD.addInclude(AD._CPP_file, "opto/opcodes.hpp");
--- a/src/share/vm/asm/codeBuffer.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/asm/codeBuffer.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -42,7 +42,6 @@
                  Verified_Entry,
                  Frame_Complete, // Offset in the code where the frame setup is (for forte stackwalks) is complete
                  OSR_Entry,
-                 Dtrace_trap = OSR_Entry,  // dtrace probes can never have an OSR entry so reuse it
                  Exceptions,     // Offset where exception handler lives
                  Deopt,          // Offset where deopt handler lives
                  DeoptMH,        // Offset where MethodHandle deopt handler lives
--- a/src/share/vm/c1/c1_Canonicalizer.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -964,8 +964,6 @@
 void Canonicalizer::do_UnsafeGetObject(UnsafeGetObject* x) {}
 void Canonicalizer::do_UnsafePutObject(UnsafePutObject* x) {}
 void Canonicalizer::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
-void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead*  x) {}
-void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
 void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
--- a/src/share/vm/c1/c1_Canonicalizer.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_Canonicalizer.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,8 +101,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType*  x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -601,15 +601,6 @@
   LIR_Opr _addr;
   LIR_Opr _new_val;
 
-  static jbyte* _byte_map_base;
-  static jbyte* byte_map_base_slow();
-  static jbyte* byte_map_base() {
-    if (_byte_map_base == NULL) {
-      _byte_map_base = byte_map_base_slow();
-    }
-    return _byte_map_base;
-  }
-
  public:
   // addr (the address of the object head) and new_val must be registers.
   G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { }
--- a/src/share/vm/c1/c1_Compilation.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_Compilation.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,12 +29,12 @@
 #include "c1/c1_LIRAssembler.hpp"
 #include "c1/c1_LinearScan.hpp"
 #include "c1/c1_MacroAssembler.hpp"
+#include "c1/c1_RangeCheckElimination.hpp"
 #include "c1/c1_ValueMap.hpp"
 #include "c1/c1_ValueStack.hpp"
 #include "code/debugInfoRec.hpp"
 #include "compiler/compileLog.hpp"
-#include "c1/c1_RangeCheckElimination.hpp"
-
+#include "runtime/sharedRuntime.hpp"
 
 typedef enum {
   _t_compile,
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "ci/ciMemberName.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/bytecode.hpp"
+#include "oops/oop.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/vm_version.hpp"
@@ -3497,11 +3498,6 @@
     case vmIntrinsics::_putFloat_raw  : return append_unsafe_put_raw(callee, T_FLOAT);
     case vmIntrinsics::_putDouble_raw : return append_unsafe_put_raw(callee, T_DOUBLE);
 
-    case vmIntrinsics::_prefetchRead        : return append_unsafe_prefetch(callee, false, false);
-    case vmIntrinsics::_prefetchWrite       : return append_unsafe_prefetch(callee, false, true);
-    case vmIntrinsics::_prefetchReadStatic  : return append_unsafe_prefetch(callee, true,  false);
-    case vmIntrinsics::_prefetchWriteStatic : return append_unsafe_prefetch(callee, true,  true);
-
     case vmIntrinsics::_checkIndex    :
       if (!InlineNIOCheckIndex) return false;
       preserves_state = true;
@@ -4258,27 +4254,6 @@
 }
 
 
-bool GraphBuilder::append_unsafe_prefetch(ciMethod* callee, bool is_static, bool is_store) {
-  if (InlineUnsafeOps) {
-    Values* args = state()->pop_arguments(callee->arg_size());
-    int obj_arg_index = 1; // Assume non-static case
-    if (is_static) {
-      obj_arg_index = 0;
-    } else {
-      null_check(args->at(0));
-    }
-    Instruction* offset = args->at(obj_arg_index + 1);
-#ifndef _LP64
-    offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT)));
-#endif
-    Instruction* op = is_store ? append(new UnsafePrefetchWrite(args->at(obj_arg_index), offset))
-                               : append(new UnsafePrefetchRead (args->at(obj_arg_index), offset));
-    compilation()->set_has_unsafe_access(true);
-  }
-  return InlineUnsafeOps;
-}
-
-
 void GraphBuilder::append_unsafe_CAS(ciMethod* callee) {
   ValueStack* state_before = copy_state_for_exception();
   ValueType* result_type = as_ValueType(callee->return_type());
--- a/src/share/vm/c1/c1_GraphBuilder.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_GraphBuilder.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -368,7 +368,6 @@
   bool append_unsafe_put_obj(ciMethod* callee, BasicType t, bool is_volatile);
   bool append_unsafe_get_raw(ciMethod* callee, BasicType t);
   bool append_unsafe_put_raw(ciMethod* callee, BasicType t);
-  bool append_unsafe_prefetch(ciMethod* callee, bool is_store, bool is_static);
   void append_unsafe_CAS(ciMethod* callee);
   bool append_unsafe_get_and_set_obj(ciMethod* callee, bool is_add);
 
--- a/src/share/vm/c1/c1_Instruction.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_Instruction.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,9 +103,6 @@
 class       UnsafeGetObject;
 class       UnsafePutObject;
 class         UnsafeGetAndSetObject;
-class       UnsafePrefetch;
-class         UnsafePrefetchRead;
-class         UnsafePrefetchWrite;
 class   ProfileCall;
 class   ProfileReturnType;
 class   ProfileInvoke;
@@ -209,8 +206,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0;
   virtual void do_UnsafePutObject(UnsafePutObject* x) = 0;
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) = 0;
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) = 0;
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
   virtual void do_ProfileReturnType (ProfileReturnType*  x) = 0;
   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
@@ -2442,34 +2437,6 @@
                                                    f->visit(&_value); }
 };
 
-BASE(UnsafePrefetch, UnsafeObjectOp)
- public:
-  UnsafePrefetch(Value object, Value offset)
-  : UnsafeObjectOp(T_VOID, object, offset, false, false)
-  {
-  }
-};
-
-
-LEAF(UnsafePrefetchRead, UnsafePrefetch)
- public:
-  UnsafePrefetchRead(Value object, Value offset)
-  : UnsafePrefetch(object, offset)
-  {
-    ASSERT_VALUES
-  }
-};
-
-
-LEAF(UnsafePrefetchWrite, UnsafePrefetch)
- public:
-  UnsafePrefetchWrite(Value object, Value offset)
-  : UnsafePrefetch(object, offset)
-  {
-    ASSERT_VALUES
-  }
-};
-
 LEAF(ProfileCall, Instruction)
  private:
   ciMethod*        _method;
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -853,11 +853,6 @@
   output()->put(')');
 }
 
-void InstructionPrinter::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
-  print_unsafe_object_op(x, "UnsafePrefetchRead");
-  output()->put(')');
-}
-
 void InstructionPrinter::do_RangeCheckPredicate(RangeCheckPredicate* x) {
 
   if (x->x() != NULL && x->y() != NULL) {
@@ -880,11 +875,6 @@
 }
 #endif
 
-void InstructionPrinter::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
-  print_unsafe_object_op(x, "UnsafePrefetchWrite");
-  output()->put(')');
-}
-
 void InstructionPrinter::do_ProfileCall(ProfileCall* x) {
   output()->print("profile ");
   print_value(x->recv());
--- a/src/share/vm/c1/c1_InstructionPrinter.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_InstructionPrinter.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +129,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType*  x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/src/share/vm/c1/c1_LIR.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIR.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -531,8 +531,6 @@
     case lir_move:           // input and result always valid, may have info
     case lir_pack64:         // input and result always valid
     case lir_unpack64:       // input and result always valid
-    case lir_prefetchr:      // input always valid, result and info always invalid
-    case lir_prefetchw:      // input always valid, result and info always invalid
     {
       assert(op->as_Op1() != NULL, "must be");
       LIR_Op1* op1 = (LIR_Op1*)op;
@@ -1270,13 +1268,6 @@
 }
 
 
-void LIR_List::prefetch(LIR_Address* addr, bool is_store) {
-  append(new LIR_Op1(
-            is_store ? lir_prefetchw : lir_prefetchr,
-            LIR_OprFact::address(addr)));
-}
-
-
 void LIR_List::store_mem_int(jint v, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code) {
   append(new LIR_Op1(
             lir_move,
--- a/src/share/vm/c1/c1_LIR.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIR.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,8 +925,6 @@
       , lir_branch
       , lir_cond_float_branch
       , lir_move
-      , lir_prefetchr
-      , lir_prefetchw
       , lir_convert
       , lir_alloc_object
       , lir_monaddr
@@ -2212,8 +2210,6 @@
 
   void load(LIR_Address* addr, LIR_Opr src, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none);
 
-  void prefetch(LIR_Address* addr, bool is_store);
-
   void store_mem_int(jint v,    LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code = lir_patch_none);
   void store_mem_oop(jobject o, LIR_Opr base, int offset_in_bytes, BasicType type, CodeEmitInfo* info, LIR_PatchCode patch_code = lir_patch_none);
   void store(LIR_Opr src, LIR_Address* addr, CodeEmitInfo* info = NULL, LIR_PatchCode patch_code = lir_patch_none);
--- a/src/share/vm/c1/c1_LIRAssembler.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIRAssembler.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -503,14 +503,6 @@
       }
       break;
 
-    case lir_prefetchr:
-      prefetchr(op->in_opr());
-      break;
-
-    case lir_prefetchw:
-      prefetchw(op->in_opr());
-      break;
-
     case lir_roundfp: {
       LIR_OpRoundFP* round_op = op->as_OpRoundFP();
       roundfp_op(round_op->in_opr(), round_op->tmp(), round_op->result_opr(), round_op->pop_fpu_stack());
--- a/src/share/vm/c1/c1_LIRAssembler.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIRAssembler.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -182,9 +182,6 @@
                    LIR_PatchCode patch_code,
                    CodeEmitInfo* info, bool wide, bool unaligned);
 
-  void prefetchr  (LIR_Opr src);
-  void prefetchw  (LIR_Opr src);
-
   void shift_op(LIR_Code code, LIR_Opr left, LIR_Opr count, LIR_Opr dest, LIR_Opr tmp);
   void shift_op(LIR_Code code, LIR_Opr left, jint  count, LIR_Opr dest);
 
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
 #include "ci/ciArrayKlass.hpp"
 #include "ci/ciInstance.hpp"
 #include "ci/ciObjArray.hpp"
+#include "memory/cardTableModRefBS.hpp"
+#include "runtime/arguments.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/vm_version.hpp"
@@ -1431,7 +1433,6 @@
       // No pre barriers
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       // No pre barriers
       break;
     default      :
@@ -1453,7 +1454,6 @@
       CardTableModRef_post_barrier(addr,  new_val);
       break;
     case BarrierSet::ModRef:
-    case BarrierSet::Other:
       // No post barriers
       break;
     default      :
@@ -2386,35 +2386,6 @@
 }
 
 
-void LIRGenerator::do_UnsafePrefetch(UnsafePrefetch* x, bool is_store) {
-  LIRItem src(x->object(), this);
-  LIRItem off(x->offset(), this);
-
-  src.load_item();
-  if (off.is_constant() && can_inline_as_constant(x->offset())) {
-    // let it be a constant
-    off.dont_load_item();
-  } else {
-    off.load_item();
-  }
-
-  set_no_result(x);
-
-  LIR_Address* addr = generate_address(src.result(), off.result(), 0, 0, T_BYTE);
-  __ prefetch(addr, is_store);
-}
-
-
-void LIRGenerator::do_UnsafePrefetchRead(UnsafePrefetchRead* x) {
-  do_UnsafePrefetch(x, false);
-}
-
-
-void LIRGenerator::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {
-  do_UnsafePrefetch(x, true);
-}
-
-
 void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux) {
   int lng = x->length();
 
@@ -3351,7 +3322,12 @@
   if (!x->inlinee()->is_accessor()) {
     CodeEmitInfo* info = state_for(x, x->state(), true);
     // Notify the runtime very infrequently only to take care of counter overflows
-    increment_event_counter_impl(info, x->inlinee(), (1 << Tier23InlineeNotifyFreqLog) - 1, InvocationEntryBci, false, true);
+    int freq_log = Tier23InlineeNotifyFreqLog;
+    double scale;
+    if (_method->has_option_value("CompileThresholdScaling", scale)) {
+      freq_log = Arguments::scaled_freq_log(freq_log, scale);
+    }
+    increment_event_counter_impl(info, x->inlinee(), right_n_bits(freq_log), InvocationEntryBci, false, true);
   }
 }
 
@@ -3366,7 +3342,11 @@
     ShouldNotReachHere();
   }
   // Increment the appropriate invocation/backedge counter and notify the runtime.
-  increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
+  double scale;
+  if (_method->has_option_value("CompileThresholdScaling", scale)) {
+    freq_log = Arguments::scaled_freq_log(freq_log, scale);
+  }
+  increment_event_counter_impl(info, info->scope()->method(), right_n_bits(freq_log), bci, backedge, true);
 }
 
 void LIRGenerator::decrement_age(CodeEmitInfo* info) {
--- a/src/share/vm/c1/c1_LIRGenerator.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -251,8 +251,6 @@
   void do_Reference_get(Intrinsic* x);
   void do_update_CRC32(Intrinsic* x);
 
-  void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store);
-
   LIR_Opr call_runtime(BasicTypeArray* signature, LIRItemList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
   LIR_Opr call_runtime(BasicTypeArray* signature, LIR_OprList* args, address entry, ValueType* result_type, CodeEmitInfo* info);
 
@@ -539,8 +537,6 @@
   virtual void do_UnsafeGetObject(UnsafeGetObject* x);
   virtual void do_UnsafePutObject(UnsafePutObject* x);
   virtual void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  virtual void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileReturnType (ProfileReturnType* x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
--- a/src/share/vm/c1/c1_Optimizer.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_Optimizer.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -528,8 +528,6 @@
   void do_UnsafeGetObject(UnsafeGetObject* x);
   void do_UnsafePutObject(UnsafePutObject* x);
   void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x);
-  void do_UnsafePrefetchRead (UnsafePrefetchRead*  x);
-  void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   void do_ProfileCall    (ProfileCall*     x);
   void do_ProfileReturnType (ProfileReturnType*  x);
   void do_ProfileInvoke  (ProfileInvoke*   x);
@@ -716,8 +714,6 @@
 void NullCheckVisitor::do_UnsafeGetObject(UnsafeGetObject* x) {}
 void NullCheckVisitor::do_UnsafePutObject(UnsafePutObject* x) {}
 void NullCheckVisitor::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
-void NullCheckVisitor::do_UnsafePrefetchRead (UnsafePrefetchRead*  x) {}
-void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void NullCheckVisitor::do_ProfileCall    (ProfileCall*     x) { nce()->clear_last_explicit_null_check();
                                                                 nce()->handle_ProfileCall(x); }
 void NullCheckVisitor::do_ProfileReturnType (ProfileReturnType* x) { nce()->handle_ProfileReturnType(x); }
--- a/src/share/vm/c1/c1_RangeCheckElimination.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_RangeCheckElimination.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -159,8 +159,6 @@
     void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ };
     void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ };
     void do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* 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_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ };
     void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
--- a/src/share/vm/c1/c1_ValueMap.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/c1/c1_ValueMap.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -200,8 +200,6 @@
   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
   void do_UnsafeGetRaw   (UnsafeGetRaw*    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_ProfileReturnType (ProfileReturnType*  x) { /* nothing to do */ }
   void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 #include "ci/ciMethodBlocks.hpp"
 #include "ci/ciStreams.hpp"
 #include "interpreter/bytecode.hpp"
+#include "oops/oop.inline.hpp"
 #include "utilities/bitMap.inline.hpp"
 
 
@@ -89,8 +90,8 @@
 public:
   ArgumentMap *_vars;
   ArgumentMap *_stack;
-  short _stack_height;
-  short _max_stack;
+  int _stack_height;
+  int _max_stack;
   bool _initialized;
   ArgumentMap empty_map;
 
--- a/src/share/vm/ci/ciArray.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciArray.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,8 @@
 #include "ci/ciConstant.hpp"
 #include "ci/ciKlass.hpp"
 #include "ci/ciUtilities.hpp"
-#include "oops/objArrayOop.hpp"
+#include "oops/objArrayOop.inline.hpp"
+#include "oops/oop.inline.hpp"
 #include "oops/typeArrayOop.hpp"
 
 // ciArray
--- a/src/share/vm/ci/ciBaseObject.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciBaseObject.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 #include "ci/ciBaseObject.hpp"
 #include "ci/ciUtilities.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 // ------------------------------------------------------------------
 // ciBaseObject::set_ident
--- a/src/share/vm/ci/ciCallSite.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciCallSite.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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 "classfile/javaClasses.inline.hpp"
 #include "ci/ciCallSite.hpp"
 #include "ci/ciUtilities.hpp"
 
--- a/src/share/vm/ci/ciEnv.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciEnv.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,8 @@
 #include "memory/universe.inline.hpp"
 #include "oops/methodData.hpp"
 #include "oops/objArrayKlass.hpp"
+#include "oops/objArrayOop.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/init.hpp"
 #include "runtime/reflection.hpp"
--- a/src/share/vm/ci/ciField.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciField.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +31,6 @@
 #include "interpreter/linkResolver.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
-#include "oops/oop.inline2.hpp"
 #include "runtime/fieldDescriptor.hpp"
 
 // ciField
--- a/src/share/vm/ci/ciInstance.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciInstance.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 #include "ci/ciObject.hpp"
 #include "oops/instanceOop.hpp"
+#include "oops/oop.hpp"
 
 // ciInstance
 //
--- a/src/share/vm/ci/ciInstanceKlass.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciInstanceKlass.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -501,32 +501,31 @@
   return fields;
 }
 
-void ciInstanceKlass::compute_injected_fields_helper() {
+bool ciInstanceKlass::compute_injected_fields_helper() {
   ASSERT_IN_VM;
   InstanceKlass* k = get_instanceKlass();
 
   for (InternalFieldStream fs(k); !fs.done(); fs.next()) {
     if (fs.access_flags().is_static())  continue;
-    _has_injected_fields++;
-    break;
+    return true;
   }
+  return false;
 }
 
-bool ciInstanceKlass::compute_injected_fields() {
-  assert(_has_injected_fields == -1, "shouldn't be initialized yet");
+void ciInstanceKlass::compute_injected_fields() {
   assert(is_loaded(), "must be loaded");
 
+  int has_injected_fields = 0;
   if (super() != NULL && super()->has_injected_fields()) {
-    _has_injected_fields = 1;
-    return true;
+    has_injected_fields = 1;
+  } else {
+    GUARDED_VM_ENTRY({
+        has_injected_fields = compute_injected_fields_helper() ? 1 : 0;
+      });
   }
-
-  _has_injected_fields = 0;
-  GUARDED_VM_ENTRY({
-      compute_injected_fields_helper();
-    });
-
-  return _has_injected_fields > 0 ? true : false;
+  // may be concurrently initialized for shared ciInstanceKlass objects
+  assert(_has_injected_fields == -1 || _has_injected_fields == has_injected_fields, "broken concurrent initialization");
+  _has_injected_fields = has_injected_fields;
 }
 
 // ------------------------------------------------------------------
--- a/src/share/vm/ci/ciInstanceKlass.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciInstanceKlass.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -72,8 +72,8 @@
   //   Itsef: more than one implementors.
   ciInstanceKlass*       _implementor;
 
-  bool compute_injected_fields();
-  void compute_injected_fields_helper();
+  void compute_injected_fields();
+  bool compute_injected_fields_helper();
 
 protected:
   ciInstanceKlass(KlassHandle h_k);
@@ -193,7 +193,7 @@
 
   bool has_injected_fields() {
     if (_has_injected_fields == -1) {
-      return compute_injected_fields();
+      compute_injected_fields();
     }
     return _has_injected_fields > 0 ? true : false;
   }
--- a/src/share/vm/ci/ciMetadata.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciMetadata.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 #include "ci/ciObject.hpp"
 #include "ci/ciUtilities.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
-#include "oops/oop.inline2.hpp"
 
 // ------------------------------------------------------------------
 // ciMetadata::print
--- a/src/share/vm/ci/ciMethod.cpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciMethod.cpp	Thu Feb 26 10:56:54 2015 -0800
@@ -70,7 +70,8 @@
 // Loaded method.
 ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
   ciMetadata(h_m()),
-  _holder(holder)
+  _holder(holder),
+  _has_injected_profile(false)
 {
   assert(h_m() != NULL, "no null method");
 
@@ -168,7 +169,8 @@
   _liveness(               NULL),
   _can_be_statically_bound(false),
   _method_blocks(          NULL),
-  _method_data(            NULL)
+  _method_data(            NULL),
+  _has_injected_profile(   false)
 #if defined(COMPILER2) || defined(SHARK)
   ,
   _flow(                   NULL),
--- a/src/share/vm/ci/ciMethod.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciMethod.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -79,6 +79,7 @@
   bool _is_c1_compilable;
   bool _is_c2_compilable;
   bool _can_be_statically_bound;
+  bool _has_injected_profile;
 
   // Lazy fields, filled in on demand
   address              _code;
@@ -286,6 +287,9 @@
   int instructions_size();
   int scale_count(int count, float prof_factor = 1.);  // make MDO count commensurate with IIC
 
+  bool has_injected_profile() const { return _has_injected_profile;     }
+  void set_injected_profile(bool x) {        _has_injected_profile = x; }
+
   // Stack walking support
   bool is_ignored_by_security_stack_walk() const;
 
--- a/src/share/vm/ci/ciMethodData.hpp	Fri Feb 06 10:36:46 2015 -0800
+++ b/src/share/vm/ci/ciMethodData.hpp	Thu Feb 26 10:56:54 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rig