changeset 11943:176fb0d13598

Merge
author rprotacio
date Tue, 06 Sep 2016 22:52:35 +0200
parents 14336f84e4cc c54ebf67ef13
children 6d3c44100184 6048300c748e
files src/share/vm/classfile/classFileParser.cpp src/share/vm/gc/g1/g1Predictions.cpp src/share/vm/gc/shared/memset_with_concurrent_readers.cpp src/share/vm/gc/shared/referencePendingListLocker.cpp src/share/vm/gc/shared/referencePendingListLocker.hpp test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java test/serviceability/sa/jmap-hashcode/Test8028623.java
diffstat 282 files changed, 4301 insertions(+), 2261 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Sep 06 16:29:32 2016 -0400
+++ b/.hgtags	Tue Sep 06 22:52:35 2016 +0200
@@ -535,3 +535,4 @@
 7d54c7056328b6a2bf4877458b8f4d8cd870f93b jdk-9+130
 943bf73b49c33c2d7cbd796f6a4ae3c7a00ae932 jdk-9+131
 713951c08aa26813375175c2ab6cc99ff2a56903 jdk-9+132
+a25e0fb6033245ab075136e744d362ce765464cd jdk-9+133
--- a/make/symbols/symbols-unix	Tue Sep 06 16:29:32 2016 -0400
+++ b/make/symbols/symbols-unix	Tue Sep 06 22:52:35 2016 +0200
@@ -67,6 +67,7 @@
 JVM_FreeMemory
 JVM_GC
 JVM_GetAllThreads
+JVM_GetAndClearReferencePendingList
 JVM_GetArrayElement
 JVM_GetArrayLength
 JVM_GetCallerClass
@@ -130,6 +131,7 @@
 JVM_GetTemporaryDirectory
 JVM_GetVmArguments
 JVM_Halt
+JVM_HasReferencePendingList
 JVM_HoldsLock
 JVM_IHashCode
 JVM_InitProperties
@@ -179,6 +181,7 @@
 JVM_ToStackTraceElement
 JVM_TotalMemory
 JVM_UnloadLibrary
+JVM_WaitForReferencePendingList
 JVM_Yield
 
 # Module related API's
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java	Tue Sep 06 22:52:35 2016 +0200
@@ -24,6 +24,7 @@
 
 package sun.jvm.hotspot.gc.g1;
 
+import java.io.PrintStream;
 import java.util.Iterator;
 import java.util.Observable;
 import java.util.Observer;
@@ -125,6 +126,15 @@
         return CollectedHeapName.G1_COLLECTED_HEAP;
     }
 
+    @Override
+    public void printOn(PrintStream tty) {
+        MemRegion mr = reservedRegion();
+
+        tty.print("garbage-first heap");
+        tty.print(" [" + mr.start() + ", " + mr.end() + "]");
+        tty.println(" region size " + (HeapRegion.grainBytes() / 1024) + "K");
+    }
+
     public G1CollectedHeap(Address addr) {
         super(addr);
     }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue Sep 06 22:52:35 2016 +0200
@@ -36,6 +36,7 @@
 public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
   static int TypeProfileWidth = 2;
   static int BciProfileWidth = 2;
+  static int MethodProfileWidth = 0;
   static int CompileThreshold;
 
   static int Reason_many;                 // indicates presence of several reasons
@@ -142,6 +143,8 @@
         TypeProfileWidth = (int)flag.getIntx();
       } else if (flag.getName().equals("BciProfileWidth")) {
         BciProfileWidth = (int)flag.getIntx();
+      } else if (flag.getName().equals("MethodProfileWidth")) {
+        MethodProfileWidth = (int)flag.getIntx();
       } else if (flag.getName().equals("CompileThreshold")) {
         CompileThreshold = (int)flag.getIntx();
       }
@@ -154,7 +157,7 @@
 
     parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0);
 
-    sizeofMethodDataOopDesc = (int)type.getSize();;
+    sizeofMethodDataOopDesc = (int)type.getSize();
 
     Reason_many            = db.lookupIntConstant("Deoptimization::Reason_many").intValue();
     Reason_none            = db.lookupIntConstant("Deoptimization::Reason_none").intValue();
@@ -257,7 +260,7 @@
 
   ParametersTypeData<Klass,Method> parametersTypeData() {
     int di = (int)parametersTypeDataDi.getValue(getAddress());
-    if (di == -1) {
+    if (di == -1 || di == -2) {
       return null;
     }
     DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset());
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,9 +38,21 @@
 // that the check is reached, and a series of (Klass, count) pairs
 // which are used to store a type profile for the receiver of the check.
 public class ReceiverTypeData<K,M> extends CounterData {
-  static final int   receiver0Offset = counterCellCount;
-  static final int     count0Offset = receiver0Offset + 1;
-  static final int     receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  static final int INCLUDE_JVMCI;
+  static final int nonProfiledCountOffset = counterCellCount;
+  static final int receiver0Offset;
+  static final int count0Offset;
+  static final int receiverTypeRowCellCount;
+  static {
+    INCLUDE_JVMCI = VM.getVM().getTypeDataBase().lookupIntConstant("INCLUDE_JVMCI");
+    if (INCLUDE_JVMCI == 1) {
+        receiver0Offset = nonProfiledCountOffset + 1;
+    } else {
+        receiver0Offset = counterCellCount;
+    }
+    count0Offset = receiver0Offset + 1;
+    receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  }
   final MethodDataInterface<K,M> methodData;
 
   public ReceiverTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
@@ -53,7 +65,11 @@
   boolean isReceivertypedata() { return true; }
 
   static int staticCellCount() {
-    return counterCellCount + MethodData.TypeProfileWidth * receiverTypeRowCellCount;
+    int cellCount = counterCellCount + MethodData.TypeProfileWidth * receiverTypeRowCellCount;
+    if (INCLUDE_JVMCI == 1) {
+      cellCount += 1;
+    }
+    return cellCount;
   }
 
   public int cellCount() {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +44,11 @@
   static int staticCellCount() {
     // At this point we could add more profile state, e.g., for arguments.
     // But for now it's the same size as the base record type.
-    return ReceiverTypeData.staticCellCount();
+    int cellCount = ReceiverTypeData.staticCellCount();
+    if (INCLUDE_JVMCI == 1) {
+      cellCount += MethodData.MethodProfileWidth * receiverTypeRowCellCount;
+    }
+    return cellCount;
   }
 
   public int cellCount() {
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java	Tue Sep 06 22:52:35 2016 +0200
@@ -129,8 +129,6 @@
             virtualConstructor.addMapping("CompilerThread", CompilerThread.class);
             virtualConstructor.addMapping("CodeCacheSweeperThread", CodeCacheSweeperThread.class);
         }
-        // for now, use JavaThread itself. fix it later with appropriate class if needed
-        virtualConstructor.addMapping("ReferencePendingListLockerThread", JavaThread.class);
         virtualConstructor.addMapping("JvmtiAgentThread", JvmtiAgentThread.class);
         virtualConstructor.addMapping("ServiceThread", ServiceThread.class);
     }
@@ -172,7 +170,7 @@
             return thread;
         } catch (Exception e) {
             throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
-            " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread, ReferencePendingListLockerThread, or CodeCacheSweeperThread)", e);
+            " (expected type JavaThread, CompilerThread, ServiceThread, JvmtiAgentThread or CodeCacheSweeperThread)", e);
         }
     }
 
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/soql/sa.js	Tue Sep 06 22:52:35 2016 +0200
@@ -837,7 +837,6 @@
 vmType2Class["JavaThread"] = sapkg.runtime.JavaThread;
 vmType2Class["CompilerThread"] = sapkg.runtime.CompilerThread;
 vmType2Class["CodeCacheSweeperThread"] = sapkg.runtime.CodeCacheSweeperThread;
-vmType2Class["ReferencePendingListLockerThread"] = sapkg.runtime.JavaThread;
 vmType2Class["DebuggerThread"] = sapkg.runtime.DebuggerThread;
 
 // gc
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Tue Sep 06 22:52:35 2016 +0200
@@ -244,17 +244,21 @@
     native void resolveInvokeDynamicInPool(HotSpotConstantPool constantPool, int cpi);
 
     /**
-     * Ensures that the type referenced by the entry for a
+     * If {@code cpi} denotes an entry representing a
      * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
-     * polymorphic</a> method at index {@code cpi} in {@code constantPool} is loaded and
-     * initialized.
-     *
-     * The behavior of this method is undefined if {@code cpi} does not denote an entry representing
-     * a signature polymorphic method.
+     * polymorphic</a> method, this method ensures that the type referenced by the entry is loaded
+     * and initialized. It {@code cpi} does not denote a signature polymorphic method, this method
+     * does nothing.
      */
     native void resolveInvokeHandleInPool(HotSpotConstantPool constantPool, int cpi);
 
     /**
+     * Gets the list of type names (in the format of {@link JavaType#getName()}) denoting the
+     * classes that define signature polymorphic methods.
+     */
+    native String[] getSignaturePolymorphicHolders();
+
+    /**
      * Gets the resolved type denoted by the entry at index {@code cpi} in {@code constantPool}.
      *
      * The behavior of this method is undefined if {@code cpi} does not denote an entry representing
@@ -348,6 +352,7 @@
      *         [String name, Long value, ...] vmConstants,
      *         [String name, Long value, ...] vmAddresses,
      *         VMFlag[] vmFlags
+     *         VMIntrinsicMethod[] vmIntrinsics
      *     ]
      * </pre>
      *
@@ -610,4 +615,5 @@
      * @return the number of bytes required for deoptimization of this frame state
      */
     native int interpreterFrameSize(BytecodeFrame frame);
+
 }
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Tue Sep 06 22:52:35 2016 +0200
@@ -282,7 +282,7 @@
      * @return constant pool tag
      */
     private JVM_CONSTANT getTagAt(int index) {
-        assertBounds(index);
+        assert checkBounds(index);
         HotSpotVMConfig config = config();
         final long metaspaceConstantPoolTags = UNSAFE.getAddress(getMetaspaceConstantPool() + config.constantPoolTagsOffset);
         final int tag = UNSAFE.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index);
@@ -299,7 +299,7 @@
      * @return constant pool entry
      */
     private long getEntryAt(int index) {
-        assertBounds(index);
+        assert checkBounds(index);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getAddress(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -311,7 +311,7 @@
      * @return integer constant pool entry at index
      */
     private int getIntAt(int index) {
-        assertTag(index, JVM_CONSTANT.Integer);
+        assert checkTag(index, JVM_CONSTANT.Integer);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -323,7 +323,7 @@
      * @return long constant pool entry
      */
     private long getLongAt(int index) {
-        assertTag(index, JVM_CONSTANT.Long);
+        assert checkTag(index, JVM_CONSTANT.Long);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getLong(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -335,7 +335,7 @@
      * @return float constant pool entry
      */
     private float getFloatAt(int index) {
-        assertTag(index, JVM_CONSTANT.Float);
+        assert checkTag(index, JVM_CONSTANT.Float);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getFloat(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -347,7 +347,7 @@
      * @return float constant pool entry
      */
     private double getDoubleAt(int index) {
-        assertTag(index, JVM_CONSTANT.Double);
+        assert checkTag(index, JVM_CONSTANT.Double);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getDouble(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -359,7 +359,7 @@
      * @return {@code JVM_CONSTANT_NameAndType} constant pool entry
      */
     private int getNameAndTypeAt(int index) {
-        assertTag(index, JVM_CONSTANT.NameAndType);
+        assert checkTag(index, JVM_CONSTANT.NameAndType);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         return UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
     }
@@ -441,7 +441,7 @@
      * @return klass reference index
      */
     private int getUncachedKlassRefIndexAt(int index) {
-        assertTagIsFieldOrMethod(index);
+        assert checkTagIsFieldOrMethod(index);
         int offset = index * runtime().getHostJVMCIBackend().getTarget().wordSize;
         final int refIndex = UNSAFE.getInt(getMetaspaceConstantPool() + config().constantPoolSize + offset);
         // klass ref index is in the low 16-bits.
@@ -449,23 +449,27 @@
     }
 
     /**
-     * Asserts that the constant pool index {@code index} is in the bounds of the constant pool.
+     * Checks that the constant pool index {@code index} is in the bounds of the constant pool.
      *
      * @param index constant pool index
+     * @throws AssertionError if the check fails
      */
-    private void assertBounds(int index) {
+    private boolean checkBounds(int index) {
         assert 0 <= index && index < length() : "index " + index + " not between 0 and " + length();
+        return true;
     }
 
     /**
-     * Asserts that the constant pool tag at index {@code index} is equal to {@code tag}.
+     * Checks that the constant pool tag at index {@code index} is equal to {@code tag}.
      *
      * @param index constant pool index
      * @param tag expected tag
+     * @throws AssertionError if the check fails
      */
-    private void assertTag(int index, JVM_CONSTANT tag) {
+    private boolean checkTag(int index, JVM_CONSTANT tag) {
         final JVM_CONSTANT tagAt = getTagAt(index);
         assert tagAt == tag : "constant pool tag at index " + index + " is " + tagAt + " but expected " + tag;
+        return true;
     }
 
     /**
@@ -473,10 +477,12 @@
      * or a {@link JVM_CONSTANT#MethodRef}, or a {@link JVM_CONSTANT#InterfaceMethodref}.
      *
      * @param index constant pool index
+     * @throws AssertionError if the check fails
      */
-    private void assertTagIsFieldOrMethod(int index) {
+    private boolean checkTagIsFieldOrMethod(int index) {
         final JVM_CONSTANT tagAt = getTagAt(index);
         assert tagAt == JVM_CONSTANT.Fieldref || tagAt == JVM_CONSTANT.MethodRef || tagAt == JVM_CONSTANT.InterfaceMethodref : tagAt;
+        return true;
     }
 
     @Override
@@ -523,7 +529,7 @@
 
     @Override
     public String lookupUtf8(int cpi) {
-        assertTag(cpi, JVM_CONSTANT.Utf8);
+        assert checkTag(cpi, JVM_CONSTANT.Utf8);
         return compilerToVM().getSymbol(getEntryAt(cpi));
     }
 
@@ -690,11 +696,10 @@
                     UNSAFE.ensureClassInitialized(klass);
                 }
                 if (tag == JVM_CONSTANT.MethodRef) {
-                    if (Bytecodes.isInvokeHandleAlias(opcode)) {
+                    if (Bytecodes.isInvokeHandleAlias(opcode) && isSignaturePolymorphicHolder(type)) {
                         final int methodRefCacheIndex = rawIndexToConstantPoolIndex(cpi, opcode);
-                        if (isInvokeHandle(methodRefCacheIndex, type)) {
-                            compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
-                        }
+                        assert checkTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef);
+                        compilerToVM().resolveInvokeHandleInPool(this, methodRefCacheIndex);
                     }
                 }
 
@@ -708,11 +713,26 @@
                 // nothing
                 break;
         }
+
     }
 
-    private boolean isInvokeHandle(int methodRefCacheIndex, HotSpotResolvedObjectTypeImpl klass) {
-        assertTag(compilerToVM().constantPoolRemapInstructionOperandFromCache(this, methodRefCacheIndex), JVM_CONSTANT.MethodRef);
-        return ResolvedJavaMethod.isSignaturePolymorphic(klass, getNameOf(methodRefCacheIndex), runtime().getHostJVMCIBackend().getMetaAccess());
+    // Lazily initialized.
+    private static String[] signaturePolymorphicHolders;
+
+    /**
+     * Determines if {@code type} contains signature polymorphic methods.
+     */
+    private static boolean isSignaturePolymorphicHolder(final HotSpotResolvedObjectTypeImpl type) {
+        String name = type.getName();
+        if (signaturePolymorphicHolders == null) {
+            signaturePolymorphicHolders = compilerToVM().getSignaturePolymorphicHolders();
+        }
+        for (String holder : signaturePolymorphicHolders) {
+            if (name.equals(holder)) {
+                return true;
+            }
+        }
+        return false;
     }
 
     @Override
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Sep 06 22:52:35 2016 +0200
@@ -497,6 +497,9 @@
         for (Map.Entry<String, Long> e : typeSizes.entrySet()) {
             printConfigLine(vm, "[vmconfig:type size] %s = %d%n", e.getKey(), e.getValue());
         }
+        for (VMIntrinsicMethod e : store.getIntrinsics()) {
+            printConfigLine(vm, "[vmconfig:intrinsic] %d = %s.%s %s%n", e.id, e.declaringClass, e.name, e.descriptor);
+        }
     }
 
     public OutputStream getLogStream() {
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java	Tue Sep 06 22:52:35 2016 +0200
@@ -112,6 +112,15 @@
     int intrinsicId();
 
     /**
+     * Determines if this method denotes itself as a candidate for intrinsification. As of JDK 9,
+     * this is denoted by the {@code HotSpotIntrinsicCandidate} annotation. In earlier JDK versions,
+     * this method returns true.
+     *
+     * @see <a href="https://bugs.openjdk.java.net/browse/JDK-8076112">JDK-8076112</a>
+     */
+    boolean isIntrinsicCandidate();
+
+    /**
      * Allocates a compile id for this method by asking the VM for one.
      *
      * @param entryBCI entry bci
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl.java	Tue Sep 06 22:52:35 2016 +0200
@@ -693,6 +693,10 @@
         return UNSAFE.getChar(metaspaceMethod + config.methodIntrinsicIdOffset);
     }
 
+    public boolean isIntrinsicCandidate() {
+        return (getFlags() & config().methodFlagsIntrinsicCandidate) != 0;
+    }
+
     @Override
     public JavaConstant invoke(JavaConstant receiver, JavaConstant[] arguments) {
         assert !isConstructor();
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Sep 06 22:52:35 2016 +0200
@@ -144,6 +144,7 @@
 
     final int methodFlagsCallerSensitive = getConstant("Method::_caller_sensitive", Integer.class);
     final int methodFlagsForceInline = getConstant("Method::_force_inline", Integer.class);
+    final int methodFlagsIntrinsicCandidate = getConstant("Method::_intrinsic_candidate", Integer.class);
     final int methodFlagsDontInline = getConstant("Method::_dont_inline", Integer.class);
     final int methodFlagsReservedStackAccess = getConstant("Method::_reserved_stack_access", Integer.class);
     final int nonvirtualVtableIndex = getConstant("Method::nonvirtual_vtable_index", Integer.class);
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigAccess.java	Tue Sep 06 22:52:35 2016 +0200
@@ -30,6 +30,13 @@
 public class HotSpotVMConfigAccess {
 
     /**
+     * Gets the available configuration data.
+     */
+    public HotSpotVMConfigStore getStore() {
+        return store;
+    }
+
+    /**
      * Gets the address of a C++ symbol.
      *
      * @param name name of C++ symbol
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigStore.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfigStore.java	Tue Sep 06 22:52:35 2016 +0200
@@ -24,8 +24,10 @@
 
 import static jdk.vm.ci.common.InitTimer.timer;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import jdk.vm.ci.common.InitTimer;
@@ -80,11 +82,19 @@
         return Collections.unmodifiableMap(vmFields);
     }
 
+    /**
+     * Gets the VM intrinsic descriptions exposed by this object.
+     */
+    public List<VMIntrinsicMethod> getIntrinsics() {
+        return Collections.unmodifiableList(vmIntrinsics);
+    }
+
     final HashMap<String, VMField> vmFields;
     final HashMap<String, Long> vmTypeSizes;
     final HashMap<String, Long> vmConstants;
     final HashMap<String, Long> vmAddresses;
     final HashMap<String, VMFlag> vmFlags;
+    final List<VMIntrinsicMethod> vmIntrinsics;
 
     /**
      * Reads the database of VM info. The return value encodes the info in a nested object array
@@ -97,6 +107,7 @@
      *         [String name, Long value, ...] vmConstants,
      *         [String name, Long value, ...] vmAddresses,
      *         VMFlag[] vmFlags
+     *         VMIntrinsicMethod[] vmIntrinsics
      *     ]
      * </pre>
      */
@@ -106,7 +117,7 @@
         try (InitTimer t = timer("CompilerToVm readConfiguration")) {
             data = compilerToVm.readConfiguration();
         }
-        assert data.length == 5 : data.length;
+        assert data.length == 6 : data.length;
 
         // @formatter:off
         VMField[] vmFieldsInfo    = (VMField[]) data[0];
@@ -115,11 +126,12 @@
         Object[] vmAddressesInfo  = (Object[])  data[3];
         VMFlag[] vmFlagsInfo      = (VMFlag[])  data[4];
 
-        vmFields    = new HashMap<>(vmFieldsInfo.length);
-        vmTypeSizes = new HashMap<>(vmTypesSizesInfo.length);
-        vmConstants = new HashMap<>(vmConstantsInfo.length);
-        vmAddresses = new HashMap<>(vmAddressesInfo.length);
-        vmFlags     = new HashMap<>(vmFlagsInfo.length);
+        vmFields     = new HashMap<>(vmFieldsInfo.length);
+        vmTypeSizes  = new HashMap<>(vmTypesSizesInfo.length);
+        vmConstants  = new HashMap<>(vmConstantsInfo.length);
+        vmAddresses  = new HashMap<>(vmAddressesInfo.length);
+        vmFlags      = new HashMap<>(vmFlagsInfo.length);
+        vmIntrinsics = Arrays.asList((VMIntrinsicMethod[]) data[5]);
         // @formatter:on
 
         try (InitTimer t = timer("HotSpotVMConfigStore<init> fill maps")) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/VMIntrinsicMethod.java	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 jdk.vm.ci.hotspot;
+
+import jdk.vm.ci.meta.Signature;
+
+/**
+ * Describes a method for which the VM has an intrinsic implementation.
+ */
+public final class VMIntrinsicMethod {
+
+    /**
+     * The name of the class declaring the intrinsified method. The name is in
+     * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.2.1">class
+     * file format</a> (e.g., {@code "java/lang/Thread"} instead of {@code "java.lang.Thread"}).
+     */
+    public final String declaringClass;
+
+    /**
+     * The name of the intrinsified method. This is not guaranteed to be a legal method name (e.g.,
+     * there is a HotSpot intrinsic with the name {@code "<compiledLambdaForm>"}).
+     */
+    public final String name;
+
+    /**
+     * The {@link Signature#toMethodDescriptor() descriptor} of the intrinsified method. This is not
+     * guaranteed to be a legal method descriptor (e.g., intrinsics for signature polymorphic
+     * methods have a descriptor of {@code "*"}).
+     */
+    public final String descriptor;
+
+    /**
+     * The unique VM identifier for the intrinsic.
+     */
+    public final int id;
+
+    VMIntrinsicMethod(String declaringClass, String name, String descriptor, int id) {
+        this.declaringClass = declaringClass;
+        this.name = name;
+        this.descriptor = descriptor;
+        this.id = id;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof VMIntrinsicMethod) {
+            VMIntrinsicMethod that = (VMIntrinsicMethod) obj;
+            if (that.id == this.id) {
+                assert that.name.equals(this.name) &&
+                                that.declaringClass.equals(this.declaringClass) &&
+                                that.descriptor.equals(this.descriptor);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return id;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("IntrinsicMethod[declaringClass=%s, name=%s, descriptor=%s, id=%d]", declaringClass, name, descriptor, id);
+    }
+}
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaMethod.java	Tue Sep 06 22:52:35 2016 +0200
@@ -23,7 +23,6 @@
 package jdk.vm.ci.meta;
 
 import java.lang.annotation.Annotation;
-import java.lang.invoke.MethodHandle;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Array;
 import java.lang.reflect.Method;
@@ -330,22 +329,4 @@
     }
 
     SpeculationLog getSpeculationLog();
-
-    /**
-     * Determines if the method identified by its holder and name is a
-     * <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html#jvms-2.9">signature
-     * polymorphic</a> method.
-     */
-    static boolean isSignaturePolymorphic(JavaType holder, String name, MetaAccessProvider metaAccess) {
-        if (!holder.getName().equals("Ljava/lang/invoke/MethodHandle;")) {
-            return false;
-        }
-        ResolvedJavaType methodHandleType = metaAccess.lookupJavaType(MethodHandle.class);
-        Signature signature = metaAccess.parseMethodDescriptor("([Ljava/lang/Object;)Ljava/lang/Object;");
-        ResolvedJavaMethod method = methodHandleType.findMethod(name, signature);
-        if (method == null) {
-            return false;
-        }
-        return method.isNative() && method.isVarArgs();
-    }
 }
--- a/src/os/aix/vm/os_aix.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os/aix/vm/os_aix.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3800,10 +3800,6 @@
   return ::stat(pathbuf, sbuf);
 }
 
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/src/os/bsd/vm/os_bsd.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os/bsd/vm/os_bsd.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3780,11 +3780,6 @@
   return diff;
 }
 
-
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/src/os/linux/vm/os_linux.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os/linux/vm/os_linux.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -5174,10 +5174,6 @@
   return ::stat(pathbuf, sbuf);
 }
 
-bool os::check_heap(bool force) {
-  return true;
-}
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/src/os/solaris/vm/os_solaris.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os/solaris/vm/os_solaris.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -4589,10 +4589,6 @@
   }
 }
 
-// OS interface.
-
-bool os::check_heap(bool force) { return true; }
-
 // Is a (classpath) directory empty?
 bool os::dir_is_empty(const char* path) {
   DIR *dir = NULL;
--- a/src/os/windows/vm/os_windows.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os/windows/vm/os_windows.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -5258,75 +5258,6 @@
   }
 }
 
-//--------------------------------------------------------------------------------------------------
-// Non-product code
-
-static int mallocDebugIntervalCounter = 0;
-static int mallocDebugCounter = 0;
-
-// For debugging possible bugs inside HeapWalk (a ring buffer)
-#define SAVE_COUNT 8
-static PROCESS_HEAP_ENTRY saved_heap_entries[SAVE_COUNT];
-static int saved_heap_entry_index;
-
-bool os::check_heap(bool force) {
-  if (++mallocDebugCounter < MallocVerifyStart && !force) return true;
-  if (++mallocDebugIntervalCounter >= MallocVerifyInterval || force) {
-    // Note: HeapValidate executes two hardware breakpoints when it finds something
-    // wrong; at these points, eax contains the address of the offending block (I think).
-    // To get to the exlicit error message(s) below, just continue twice.
-    //
-    // Note:  we want to check the CRT heap, which is not necessarily located in the
-    // process default heap.
-    HANDLE heap = (HANDLE) _get_heap_handle();
-    if (!heap) {
-      return true;
-    }
-
-    // If we fail to lock the heap, then gflags.exe has been used
-    // or some other special heap flag has been set that prevents
-    // locking. We don't try to walk a heap we can't lock.
-    if (HeapLock(heap) != 0) {
-      PROCESS_HEAP_ENTRY phe;
-      phe.lpData = NULL;
-      memset(saved_heap_entries, 0, sizeof(saved_heap_entries));
-      saved_heap_entry_index = 0;
-      int count = 0;
-
-      while (HeapWalk(heap, &phe) != 0) {
-        count ++;
-        if ((phe.wFlags & PROCESS_HEAP_ENTRY_BUSY) &&
-            !HeapValidate(heap, 0, phe.lpData)) {
-          tty->print_cr("C heap has been corrupted (time: %d allocations)", mallocDebugCounter);
-          tty->print_cr("corrupted block near address %#x, length %d, count %d", phe.lpData, phe.cbData, count);
-          HeapUnlock(heap);
-          fatal("corrupted C heap");
-        } else {
-          // Save previous seen entries in a ring buffer. We have seen strange
-          // heap corruption fatal errors that produced mdmp files, but when we load
-          // these mdmp files in WinDBG, "!heap -triage" shows no error.
-          // We can examine the saved_heap_entries[] array in the mdmp file to
-          // diagnose such seemingly spurious errors reported by HeapWalk.
-          saved_heap_entries[saved_heap_entry_index++] = phe;
-          if (saved_heap_entry_index >= SAVE_COUNT) {
-            saved_heap_entry_index = 0;
-          }
-        }
-      }
-      DWORD err = GetLastError();
-      if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED &&
-         (err == ERROR_INVALID_FUNCTION && phe.lpData != NULL)) {
-        HeapUnlock(heap);
-        fatal("heap walk aborted with error %d", err);
-      }
-      HeapUnlock(heap);
-    }
-    mallocDebugIntervalCounter = 0;
-  }
-  return true;
-}
-
-
 bool os::find(address addr, outputStream* st) {
   int offset = -1;
   bool result = false;
--- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -444,7 +444,7 @@
 
 
     if (thread->thread_state() == _thread_in_vm) {
-      if (sig == SIGBUS && info->si_code == BUS_OBJERR && thread->doing_unsafe_access()) {
+      if (sig == SIGBUS && thread->doing_unsafe_access()) {
         stub = SharedRuntime::handle_unsafe_access(thread, npc);
       }
     }
--- a/src/share/vm/c1/c1_Compiler.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/c1/c1_Compiler.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -221,6 +221,9 @@
   case vmIntrinsics::_putCharStringU:
 #ifdef TRACE_HAVE_INTRINSICS
   case vmIntrinsics::_counterTime:
+#if defined(_LP64) || !defined(TRACE_ID_CLASS_SHIFT)
+  case vmIntrinsics::_getClassId:
+#endif
 #endif
     break;
   default:
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -683,6 +683,7 @@
   , _cleanup_block(NULL)
   , _cleanup_return_prev(NULL)
   , _cleanup_state(NULL)
+  , _ignore_return(false)
 {
   if (parent != NULL) {
     _max_inline_size = (intx) ((float) NestedInliningSizeRatio * (float) parent->max_inline_size() / 100.0f);
@@ -1445,7 +1446,7 @@
 }
 
 
-void GraphBuilder::method_return(Value x) {
+void GraphBuilder::method_return(Value x, bool ignore_return) {
   if (RegisterFinalizersAtInit &&
       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
     call_register_finalizer();
@@ -1518,7 +1519,9 @@
     int invoke_bci = state()->caller_state()->bci();
     set_state(state()->caller_state()->copy_for_parsing());
     if (x != NULL) {
-      state()->push(x->type(), x);
+      if (!ignore_return) {
+        state()->push(x->type(), x);
+      }
       if (profile_return() && x->type()->is_object_kind()) {
         ciMethod* caller = state()->scope()->method();
         ciMethodData* md = caller->method_data_or_null();
@@ -1563,6 +1566,7 @@
       append(new MemBar(lir_membar_storestore));
   }
 
+  assert(!ignore_return, "Ignoring return value works only for inlining");
   append(new Return(x));
 }
 
@@ -1981,7 +1985,7 @@
         code == Bytecodes::_invokedynamic) {
       ciMethod* inline_target = (cha_monomorphic_target != NULL) ? cha_monomorphic_target : target;
       // static binding => check if callee is ok
-      bool success = try_inline(inline_target, (cha_monomorphic_target != NULL) || (exact_target != NULL), code, better_receiver);
+      bool success = try_inline(inline_target, (cha_monomorphic_target != NULL) || (exact_target != NULL), false, code, better_receiver);
 
       CHECK_BAILOUT();
       clear_inline_bailout();
@@ -2611,6 +2615,8 @@
     push_exception = true;
   }
 
+  bool ignore_return = scope_data()->ignore_return();
+
   while (!bailed_out() && last()->as_BlockEnd() == NULL &&
          (code = stream()->next()) != ciBytecodeStream::EOBC() &&
          (block_at(s.cur_bci()) == NULL || block_at(s.cur_bci()) == block())) {
@@ -2806,12 +2812,12 @@
       case Bytecodes::_ret            : ret(s.get_index()); break;
       case Bytecodes::_tableswitch    : table_switch(); break;
       case Bytecodes::_lookupswitch   : lookup_switch(); break;
-      case Bytecodes::_ireturn        : method_return(ipop()); break;
-      case Bytecodes::_lreturn        : method_return(lpop()); break;
-      case Bytecodes::_freturn        : method_return(fpop()); break;
-      case Bytecodes::_dreturn        : method_return(dpop()); break;
-      case Bytecodes::_areturn        : method_return(apop()); break;
-      case Bytecodes::_return         : method_return(NULL  ); break;
+      case Bytecodes::_ireturn        : method_return(ipop(), ignore_return); break;
+      case Bytecodes::_lreturn        : method_return(lpop(), ignore_return); break;
+      case Bytecodes::_freturn        : method_return(fpop(), ignore_return); break;
+      case Bytecodes::_dreturn        : method_return(dpop(), ignore_return); break;
+      case Bytecodes::_areturn        : method_return(apop(), ignore_return); break;
+      case Bytecodes::_return         : method_return(NULL  , ignore_return); break;
       case Bytecodes::_getstatic      : // fall through
       case Bytecodes::_putstatic      : // fall through
       case Bytecodes::_getfield       : // fall through
@@ -3336,7 +3342,7 @@
 }
 
 
-bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, Bytecodes::Code bc, Value receiver) {
+bool GraphBuilder::try_inline(ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc, Value receiver) {
   const char* msg = NULL;
 
   // clear out any existing inline bailout condition
@@ -3351,7 +3357,7 @@
 
   // method handle invokes
   if (callee->is_method_handle_intrinsic()) {
-    if (try_method_handle_inline(callee)) {
+    if (try_method_handle_inline(callee, ignore_return)) {
       if (callee->has_reserved_stack_access()) {
         compilation()->set_has_reserved_stack_access(true);
       }
@@ -3363,7 +3369,7 @@
   // handle intrinsics
   if (callee->intrinsic_id() != vmIntrinsics::_none &&
       (CheckIntrinsics ? callee->intrinsic_candidate() : true)) {
-    if (try_inline_intrinsics(callee)) {
+    if (try_inline_intrinsics(callee, ignore_return)) {
       print_inlining(callee, "intrinsic");
       if (callee->has_reserved_stack_access()) {
         compilation()->set_has_reserved_stack_access(true);
@@ -3384,7 +3390,7 @@
   if (bc == Bytecodes::_illegal) {
     bc = code();
   }
-  if (try_inline_full(callee, holder_known, bc, receiver)) {
+  if (try_inline_full(callee, holder_known, ignore_return, bc, receiver)) {
     if (callee->has_reserved_stack_access()) {
       compilation()->set_has_reserved_stack_access(true);
     }
@@ -3415,7 +3421,7 @@
   return NULL;
 }
 
-void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee) {
+void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_return) {
   vmIntrinsics::ID id = callee->intrinsic_id();
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 
@@ -3509,14 +3515,16 @@
                                     vmIntrinsics::can_trap(id));
   // append instruction & push result
   Value value = append_split(result);
-  if (result_type != voidType) push(result_type, value);
+  if (result_type != voidType && !ignore_return) {
+    push(result_type, value);
+  }
 
   if (callee != method() && profile_return() && result_type->is_object_kind()) {
     profile_return_type(result, callee);
   }
 }
 
-bool GraphBuilder::try_inline_intrinsics(ciMethod* callee) {
+bool GraphBuilder::try_inline_intrinsics(ciMethod* callee, bool ignore_return) {
   // For calling is_intrinsic_available we need to transition to
   // the '_thread_in_vm' state because is_intrinsic_available()
   // accesses critical VM-internal data.
@@ -3536,7 +3544,7 @@
       return false;
     }
   }
-  build_graph_for_intrinsic(callee);
+  build_graph_for_intrinsic(callee, ignore_return);
   return true;
 }
 
@@ -3691,7 +3699,7 @@
 }
 
 
-bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecodes::Code bc, Value receiver) {
+bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc, Value receiver) {
   assert(!callee->is_native(), "callee must not be native");
   if (CompilationPolicy::policy()->should_not_inline(compilation()->env(), callee)) {
     INLINE_BAILOUT("inlining prohibited by policy");
@@ -3889,6 +3897,7 @@
 
   // Clear out bytecode stream
   scope_data()->set_stream(NULL);
+  scope_data()->set_ignore_return(ignore_return);
 
   CompileLog* log = compilation()->log();
   if (log != NULL) log->head("parse method='%d'", log->identify(callee));
@@ -3958,7 +3967,7 @@
 }
 
 
-bool GraphBuilder::try_method_handle_inline(ciMethod* callee) {
+bool GraphBuilder::try_method_handle_inline(ciMethod* callee, bool ignore_return) {
   ValueStack* state_before = copy_state_before();
   vmIntrinsics::ID iid = callee->intrinsic_id();
   switch (iid) {
@@ -3972,7 +3981,8 @@
         // We don't do CHA here so only inline static and statically bindable methods.
         if (target->is_static() || target->can_be_statically_bound()) {
           Bytecodes::Code bc = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual;
-          if (try_inline(target, /*holder_known*/ true, bc)) {
+          ignore_return = ignore_return || (callee->return_type()->is_void() && !target->return_type()->is_void());
+          if (try_inline(target, /*holder_known*/ true, ignore_return, bc)) {
             return true;
           }
         } else {
@@ -3994,10 +4004,11 @@
       ValueType* type = apop()->type();
       if (type->is_constant()) {
         ciMethod* target = type->as_ObjectType()->constant_value()->as_member_name()->get_vmtarget();
+        ignore_return = ignore_return || (callee->return_type()->is_void() && !target->return_type()->is_void());
         // If the target is another method handle invoke, try to recursively get
         // a better target.
         if (target->is_method_handle_intrinsic()) {
-          if (try_method_handle_inline(target)) {
+          if (try_method_handle_inline(target, ignore_return)) {
             return true;
           }
         } else {
@@ -4032,7 +4043,7 @@
           // We don't do CHA here so only inline static and statically bindable methods.
           if (target->is_static() || target->can_be_statically_bound()) {
             Bytecodes::Code bc = target->is_static() ? Bytecodes::_invokestatic : Bytecodes::_invokevirtual;
-            if (try_inline(target, /*holder_known*/ true, bc)) {
+            if (try_inline(target, /*holder_known*/ true, ignore_return, bc)) {
               return true;
             }
           } else {
@@ -4255,7 +4266,7 @@
 #if INCLUDE_TRACE
   EventCompilerInlining event;
   if (event.should_commit()) {
-    event.set_compileID(compilation()->env()->task()->compile_id());
+    event.set_compileId(compilation()->env()->task()->compile_id());
     event.set_message(msg);
     event.set_succeeded(success);
     event.set_bci(bci());
--- a/src/share/vm/c1/c1_GraphBuilder.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/c1/c1_GraphBuilder.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -100,6 +100,9 @@
     Instruction* _cleanup_return_prev; // Instruction before return instruction
     ValueStack*  _cleanup_state;       // State of that block (not yet pinned)
 
+    // When inlining do not push the result on the stack
+    bool         _ignore_return;
+
    public:
     ScopeData(ScopeData* parent);
 
@@ -163,6 +166,9 @@
     BlockBegin*  inline_cleanup_block() const      { return _cleanup_block; }
     Instruction* inline_cleanup_return_prev() const{ return _cleanup_return_prev; }
     ValueStack*  inline_cleanup_state() const      { return _cleanup_state; }
+
+    bool ignore_return() const                     { return _ignore_return;          }
+    void set_ignore_return(bool ignore_return)     { _ignore_return = ignore_return; }
   };
 
   // for all GraphBuilders
@@ -246,7 +252,7 @@
   void ret(int local_index);
   void table_switch();
   void lookup_switch();
-  void method_return(Value x);
+  void method_return(Value x, bool ignore_return = false);
   void call_register_finalizer();
   void access_field(Bytecodes::Code code);
   void invoke(Bytecodes::Code code);
@@ -340,19 +346,19 @@
   void inline_sync_entry(Value lock, BlockBegin* sync_handler);
   void fill_sync_handler(Value lock, BlockBegin* sync_handler, bool default_handler = false);
 
-  void build_graph_for_intrinsic(ciMethod* callee);
+  void build_graph_for_intrinsic(ciMethod* callee, bool ignore_return);
 
   // inliners
-  bool try_inline(           ciMethod* callee, bool holder_known, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
-  bool try_inline_intrinsics(ciMethod* callee);
-  bool try_inline_full(      ciMethod* callee, bool holder_known, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
+  bool try_inline(           ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
+  bool try_inline_intrinsics(ciMethod* callee, bool ignore_return = false);
+  bool try_inline_full(      ciMethod* callee, bool holder_known, bool ignore_return, Bytecodes::Code bc = Bytecodes::_illegal, Value receiver = NULL);
   bool try_inline_jsr(int jsr_dest_bci);
 
   const char* check_can_parse(ciMethod* callee) const;
   const char* should_not_inline(ciMethod* callee) const;
 
   // JSR 292 support
-  bool try_method_handle_inline(ciMethod* callee);
+  bool try_method_handle_inline(ciMethod* callee, bool ignore_return);
 
   // helpers
   void inline_bailout(const char* msg);
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3083,6 +3083,37 @@
   __ cmove(lir_cond(x->cond()), t_val.result(), f_val.result(), reg, as_BasicType(x->x()->type()));
 }
 
+#ifdef TRACE_HAVE_INTRINSICS
+void LIRGenerator::do_ClassIDIntrinsic(Intrinsic* x) {
+  CodeEmitInfo* info = state_for(x);
+  CodeEmitInfo* info2 = new CodeEmitInfo(info); // Clone for the second null check
+
+  assert(info != NULL, "must have info");
+  LIRItem arg(x->argument_at(0), this);
+
+  arg.load_item();
+  LIR_Opr klass = new_register(T_METADATA);
+  __ move(new LIR_Address(arg.result(), java_lang_Class::klass_offset_in_bytes(), T_ADDRESS), klass, info);
+  LIR_Opr id = new_register(T_LONG);
+  ByteSize offset = TRACE_KLASS_TRACE_ID_OFFSET;
+  LIR_Address* trace_id_addr = new LIR_Address(klass, in_bytes(offset), T_LONG);
+
+  __ move(trace_id_addr, id);
+  __ logical_or(id, LIR_OprFact::longConst(0x01l), id);
+  __ store(id, trace_id_addr);
+
+#ifdef TRACE_ID_META_BITS
+  __ logical_and(id, LIR_OprFact::longConst(~TRACE_ID_META_BITS), id);
+#endif
+#ifdef TRACE_ID_CLASS_SHIFT
+  __ unsigned_shift_right(id, TRACE_ID_CLASS_SHIFT, id);
+#endif
+
+  __ move(id, rlock_result(x));
+}
+#endif
+
+
 void LIRGenerator::do_RuntimeCall(address routine, Intrinsic* x) {
   assert(x->number_of_arguments() == 0, "wrong type");
   // Enforce computation of _reserved_argument_area_size which is required on some platforms.
@@ -3108,6 +3139,9 @@
   }
 
 #ifdef TRACE_HAVE_INTRINSICS
+  case vmIntrinsics::_getClassId:
+    do_ClassIDIntrinsic(x);
+    break;
   case vmIntrinsics::_counterTime:
     do_RuntimeCall(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), x);
     break;
--- a/src/share/vm/c1/c1_LIRGenerator.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -438,6 +438,10 @@
   SwitchRangeArray* create_lookup_ranges(LookupSwitch* x);
   void do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux);
 
+#ifdef TRACE_HAVE_INTRINSICS
+  void do_ClassIDIntrinsic(Intrinsic* x);
+#endif
+
   void do_RuntimeCall(address routine, Intrinsic* x);
 
   ciKlass* profile_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k,
--- a/src/share/vm/ci/ciEnv.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/ci/ciEnv.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1149,10 +1149,10 @@
 
 void ciEnv::report_failure(const char* reason) {
   // Create and fire JFR event
-  EventCompilerFailure event;
+  EventCompilationFailure event;
   if (event.should_commit()) {
-    event.set_compileID(compile_id());
-    event.set_failure(reason);
+    event.set_compileId(compile_id());
+    event.set_failureMessage(reason);
     event.commit();
   }
 }
--- a/src/share/vm/ci/ciMethod.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/ci/ciMethod.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1410,11 +1410,11 @@
 }
 
 #if INCLUDE_TRACE
-TraceStructCiMethod ciMethod::to_trace_struct() const {
-  TraceStructCiMethod result;
-  result.set_class(holder()->name()->as_utf8());
+TraceStructCalleeMethod ciMethod::to_trace_struct() const {
+  TraceStructCalleeMethod result;
+  result.set_type(holder()->name()->as_utf8());
   result.set_name(name()->as_utf8());
-  result.set_signature(signature()->as_symbol()->as_utf8());
+  result.set_descriptor(signature()->as_symbol()->as_utf8());
   return result;
 }
 #endif
--- a/src/share/vm/ci/ciMethod.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/ci/ciMethod.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -342,7 +342,7 @@
   void print_short_name(outputStream* st = tty);
 
 #if INCLUDE_TRACE
-  TraceStructCiMethod to_trace_struct() const;
+  TraceStructCalleeMethod to_trace_struct() const;
 #endif
 };
 
--- a/src/share/vm/ci/ciReplay.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/ci/ciReplay.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -29,7 +29,6 @@
 #include "ci/ciKlass.hpp"
 #include "ci/ciUtilities.hpp"
 #include "compiler/compileBroker.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
@@ -577,9 +576,7 @@
     Method* method = parse_method(CHECK);
     if (had_error()) return;
     /* just copied from Method, to build interpret data*/
-    if (ReferencePendingListLocker::is_locked_by_self()) {
-      return;
-    }
+
     // To be properly initialized, some profiling in the MDO needs the
     // method to be rewritten (number of arguments at a call for
     // instance)
--- a/src/share/vm/classfile/altHashing.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/altHashing.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -205,103 +205,3 @@
 juint AltHashing::murmur3_32(const int* data, int len) {
   return murmur3_32(0, data, len);
 }
-
-#ifndef PRODUCT
-// Overloaded versions for internal test.
-juint AltHashing::murmur3_32(const jbyte* data, int len) {
-  return murmur3_32(0, data, len);
-}
-
-juint AltHashing::murmur3_32(const jchar* data, int len) {
-  return murmur3_32(0, data, len);
-}
-
-// Internal test for alternate hashing.  Translated from JDK version
-// test/sun/misc/Hashing.java
-static const jbyte ONE_BYTE[] = { (jbyte) 0x80};
-static const jbyte TWO_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81};
-static const jchar ONE_CHAR[] = { (jchar) 0x8180};
-static const jbyte THREE_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82};
-static const jbyte FOUR_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83};
-static const jchar TWO_CHAR[] = { (jchar) 0x8180, (jchar) 0x8382};
-static const jint ONE_INT[] = { (jint)0x83828180};
-static const jbyte SIX_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85};
-static const jchar THREE_CHAR[] = { (jchar) 0x8180, (jchar) 0x8382, (jchar) 0x8584};
-static const jbyte EIGHT_BYTE[] = {
-  (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82,
-  (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85,
-  (jbyte) 0x86, (jbyte) 0x87};
-static const jchar FOUR_CHAR[] = {
-  (jchar) 0x8180, (jchar) 0x8382,
-  (jchar) 0x8584, (jchar) 0x8786};
-
-static const jint TWO_INT[] = { (jint)0x83828180, (jint)0x87868584};
-
-static const juint MURMUR3_32_X86_CHECK_VALUE = 0xB0F57EE3;
-
-void AltHashing::testMurmur3_32_ByteArray() {
-  // printf("testMurmur3_32_ByteArray\n");
-
-  jbyte vector[256];
-  jbyte hashes[4 * 256];
-
-  for (int i = 0; i < 256; i++) {
-    vector[i] = (jbyte) i;
-  }
-
-  // Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255}
-  for (int i = 0; i < 256; i++) {
-    juint hash = murmur3_32(256 - i, vector, i);
-    hashes[i * 4] = (jbyte) hash;
-    hashes[i * 4 + 1] = (jbyte)(hash >> 8);
-    hashes[i * 4 + 2] = (jbyte)(hash >> 16);
-    hashes[i * 4 + 3] = (jbyte)(hash >> 24);
-  }
-
-  // hash to get const result.
-  juint final_hash = murmur3_32(hashes, 4*256);
-
-  assert (MURMUR3_32_X86_CHECK_VALUE == final_hash,
-          "Calculated hash result not as expected. Expected %08X got %08X\n",
-          MURMUR3_32_X86_CHECK_VALUE,
-          final_hash);
-}
-
-void AltHashing::testEquivalentHashes() {
-  juint jbytes, jchars, ints;
-
-  // printf("testEquivalentHashes\n");
-
-  jbytes = murmur3_32(TWO_BYTE, 2);
-  jchars = murmur3_32(ONE_CHAR, 1);
-  assert (jbytes == jchars,
-          "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars);
-
-  jbytes = murmur3_32(FOUR_BYTE, 4);
-  jchars = murmur3_32(TWO_CHAR, 2);
-  ints = murmur3_32(ONE_INT, 1);
-  assert ((jbytes == jchars) && (jbytes == ints),
-          "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints);
-
-  jbytes = murmur3_32(SIX_BYTE, 6);
-  jchars = murmur3_32(THREE_CHAR, 3);
-  assert (jbytes == jchars,
-         "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars);
-
-  jbytes = murmur3_32(EIGHT_BYTE, 8);
-  jchars = murmur3_32(FOUR_CHAR, 4);
-  ints = murmur3_32(TWO_INT, 2);
-  assert ((jbytes == jchars) && (jbytes == ints),
-          "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints);
-}
-
-// Returns true if the alternate hashcode is correct
-void AltHashing::test_alt_hash() {
-  testMurmur3_32_ByteArray();
-  testEquivalentHashes();
-}
-
-void AltHashing_test() {
-  AltHashing::test_alt_hash();
-}
-#endif // PRODUCT
--- a/src/share/vm/classfile/altHashing.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/altHashing.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,26 +37,18 @@
  */
 
 class AltHashing : AllStatic {
+  friend class AltHashingTest;
 
   // utility function copied from java/lang/Integer
   static juint Integer_rotateLeft(juint i, int distance) {
-    return (i << distance) | (i >> (32-distance));
+    return (i << distance) | (i >> (32 - distance));
   }
   static juint murmur3_32(const int* data, int len);
   static juint murmur3_32(juint seed, const int* data, int len);
 
-#ifndef PRODUCT
-  // Hashing functions used for internal testing
-  static juint murmur3_32(const jbyte* data, int len);
-  static juint murmur3_32(const jchar* data, int len);
-  static void testMurmur3_32_ByteArray();
-  static void testEquivalentHashes();
-#endif // PRODUCT
-
  public:
   static juint compute_seed();
   static juint murmur3_32(juint seed, const jbyte* data, int len);
   static juint murmur3_32(juint seed, const jchar* data, int len);
-  NOT_PRODUCT(static void test_alt_hash();)
 };
 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP
--- a/src/share/vm/classfile/classFileParser.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/classFileParser.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -5407,6 +5407,17 @@
   debug_only(ik->verify();)
 }
 
+static bool relax_format_check_for(ClassLoaderData* loader_data) {
+  bool trusted = (loader_data->is_the_null_class_loader_data() ||
+                  SystemDictionary::is_platform_class_loader(loader_data->class_loader()));
+  bool need_verify =
+    // verifyAll
+    (BytecodeVerificationLocal && BytecodeVerificationRemote) ||
+    // verifyRemote
+    (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted);
+  return !need_verify;
+}
+
 ClassFileParser::ClassFileParser(ClassFileStream* stream,
                                  Symbol* name,
                                  ClassLoaderData* loader_data,
@@ -5495,7 +5506,7 @@
 
   // Check if verification needs to be relaxed for this class file
   // Do not restrict it to jdk1.0 or jdk1.1 to maintain backward compatibility (4982376)
-  _relax_verify = Verifier::relax_verify_for(_loader_data->class_loader());
+  _relax_verify = relax_format_check_for(_loader_data);
 
   parse_stream(stream, CHECK);
 
--- a/src/share/vm/classfile/classLoader.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/classLoader.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -50,12 +50,14 @@
 
 class ClassPathEntry : public CHeapObj<mtClass> {
 private:
-  ClassPathEntry* _next;
+  ClassPathEntry* volatile _next;
 public:
   // Next entry in class path
-  ClassPathEntry* next() const { return _next; }
+  ClassPathEntry* next() const {
+    return (ClassPathEntry*) OrderAccess::load_ptr_acquire(&_next);
+  }
   void set_next(ClassPathEntry* next) {
-    // may have unlocked readers, so write atomically.
+    // may have unlocked readers, so ensure visibility.
     OrderAccess::release_store_ptr(&_next, next);
   }
   virtual bool is_jrt() = 0;
--- a/src/share/vm/classfile/javaClasses.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/javaClasses.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3015,41 +3015,6 @@
   }
 }
 
-
-// Support for java_lang_ref_Reference
-HeapWord *java_lang_ref_Reference::pending_list_lock_addr() {
-  InstanceKlass* ik = SystemDictionary::Reference_klass();
-  address addr = ik->static_field_addr(static_lock_offset);
-  return (HeapWord*) addr;
-}
-
-oop java_lang_ref_Reference::pending_list_lock() {
-  InstanceKlass* ik = SystemDictionary::Reference_klass();
-  address addr = ik->static_field_addr(static_lock_offset);
-  if (UseCompressedOops) {
-    return oopDesc::load_decode_heap_oop((narrowOop *)addr);
-  } else {
-    return oopDesc::load_decode_heap_oop((oop*)addr);
-  }
-}
-
-HeapWord *java_lang_ref_Reference::pending_list_addr() {
-  InstanceKlass* ik = SystemDictionary::Reference_klass();
-  address addr = ik->static_field_addr(static_pending_offset);
-  // XXX This might not be HeapWord aligned, almost rather be char *.
-  return (HeapWord*)addr;
-}
-
-oop java_lang_ref_Reference::pending_list() {
-  char *addr = (char *)pending_list_addr();
-  if (UseCompressedOops) {
-    return oopDesc::load_decode_heap_oop((narrowOop *)addr);
-  } else {
-    return oopDesc::load_decode_heap_oop((oop*)addr);
-  }
-}
-
-
 // Support for java_lang_ref_SoftReference
 
 jlong java_lang_ref_SoftReference::timestamp(oop ref) {
@@ -3616,8 +3581,6 @@
 int java_lang_ref_Reference::queue_offset;
 int java_lang_ref_Reference::next_offset;
 int java_lang_ref_Reference::discovered_offset;
-int java_lang_ref_Reference::static_lock_offset;
-int java_lang_ref_Reference::static_pending_offset;
 int java_lang_ref_Reference::number_of_fake_oop_fields;
 int java_lang_ref_SoftReference::timestamp_offset;
 int java_lang_ref_SoftReference::static_clock_offset;
@@ -3772,8 +3735,6 @@
   java_lang_ref_Reference::queue_offset = java_lang_ref_Reference::hc_queue_offset * x + header;
   java_lang_ref_Reference::next_offset  = java_lang_ref_Reference::hc_next_offset * x + header;
   java_lang_ref_Reference::discovered_offset  = java_lang_ref_Reference::hc_discovered_offset * x + header;
-  java_lang_ref_Reference::static_lock_offset = java_lang_ref_Reference::hc_static_lock_offset *  x;
-  java_lang_ref_Reference::static_pending_offset = java_lang_ref_Reference::hc_static_pending_offset * x;
   // Artificial fields for java_lang_ref_Reference
   // The first field is for the discovered field added in 1.4
   java_lang_ref_Reference::number_of_fake_oop_fields = 1;
@@ -4006,8 +3967,6 @@
   CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, next, "Ljava/lang/ref/Reference;");
   // Fake field
   //CHECK_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, discovered, "Ljava/lang/ref/Reference;");
-  CHECK_STATIC_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, lock, "Ljava/lang/ref/Reference$Lock;");
-  CHECK_STATIC_OFFSET("java/lang/ref/Reference", java_lang_ref_Reference, pending, "Ljava/lang/ref/Reference;");
 
   // java.lang.ref.SoftReference
 
--- a/src/share/vm/classfile/javaClasses.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/javaClasses.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -886,17 +886,11 @@
    hc_next_offset       = 2,
    hc_discovered_offset = 3  // Is not last, see SoftRefs.
   };
-  enum {
-   hc_static_lock_offset    = 0,
-   hc_static_pending_offset = 1
-  };
 
   static int referent_offset;
   static int queue_offset;
   static int next_offset;
   static int discovered_offset;
-  static int static_lock_offset;
-  static int static_pending_offset;
   static int number_of_fake_oop_fields;
 
   // Accessors
@@ -912,13 +906,6 @@
   static inline void set_discovered(oop ref, oop value);
   static inline void set_discovered_raw(oop ref, oop value);
   static inline HeapWord* discovered_addr(oop ref);
-
-  // Accessors for statics
-  static oop  pending_list_lock();
-  static oop  pending_list();
-
-  static HeapWord*  pending_list_lock_addr();
-  static HeapWord*  pending_list_addr();
 };
 
 
--- a/src/share/vm/classfile/systemDictionary.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/systemDictionary.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1641,7 +1641,6 @@
       JvmtiExport::post_class_load((JavaThread *) THREAD, k());
 
   }
-  TRACE_KLASS_DEFINITION(k, THREAD);
   class_define_event(k);
 }
 
--- a/src/share/vm/classfile/verifier.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/verifier.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -67,12 +67,12 @@
 static volatile jint _is_new_verify_byte_codes_fn = (jint) true;
 
 static void* verify_byte_codes_fn() {
-  if (_verify_byte_codes_fn == NULL) {
+  if (OrderAccess::load_ptr_acquire(&_verify_byte_codes_fn) == NULL) {
     void *lib_handle = os::native_java_library();
     void *func = os::dll_lookup(lib_handle, "VerifyClassCodesForMajorVersion");
     OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func);
     if (func == NULL) {
-      OrderAccess::release_store(&_is_new_verify_byte_codes_fn, false);
+      _is_new_verify_byte_codes_fn = false;
       func = os::dll_lookup(lib_handle, "VerifyClassCodes");
       OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func);
     }
@@ -88,7 +88,7 @@
     BytecodeVerificationLocal : BytecodeVerificationRemote;
 }
 
-bool Verifier::relax_verify_for(oop loader) {
+bool Verifier::relax_access_for(oop loader) {
   bool trusted = java_lang_ClassLoader::is_trusted_loader(loader);
   bool need_verify =
     // verifyAll
--- a/src/share/vm/classfile/verifier.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/verifier.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,8 +58,8 @@
   // -Xverify:all/none override this value
   static bool should_verify_for(oop class_loader, bool should_verify_class);
 
-  // Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
-  static bool relax_verify_for(oop class_loader);
+  // Relax certain access checks to enable some broken 1.1 apps to run on 1.2.
+  static bool relax_access_for(oop class_loader);
 
   // Print output for class+resolve
   static void trace_class_resolution(Klass* resolve_class, InstanceKlass* verify_class);
--- a/src/share/vm/classfile/vmSymbols.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/classfile/vmSymbols.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -366,6 +366,7 @@
   switch(id) {
 #ifdef TRACE_HAVE_INTRINSICS
   case vmIntrinsics::_counterTime:
+  case vmIntrinsics::_getClassId:
 #endif
   case vmIntrinsics::_currentTimeMillis:
   case vmIntrinsics::_nanoTime:
--- a/src/share/vm/code/codeCache.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/code/codeCache.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -437,7 +437,7 @@
  * run the constructor for the CodeBlob subclass he is busy
  * instantiating.
  */
-CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool strict) {
+CodeBlob* CodeCache::allocate(int size, int code_blob_type, int orig_code_blob_type) {
   // Possibly wakes up the sweeper thread.
   NMethodSweeper::notify(code_blob_type);
   assert_locked_or_safepoint(CodeCache_lock);
@@ -455,32 +455,41 @@
     cb = (CodeBlob*)heap->allocate(size);
     if (cb != NULL) break;
     if (!heap->expand_by(CodeCacheExpansionSize)) {
+      // Save original type for error reporting
+      if (orig_code_blob_type == CodeBlobType::All) {
+        orig_code_blob_type = code_blob_type;
+      }
       // Expansion failed
-      if (SegmentedCodeCache && !strict) {
+      if (SegmentedCodeCache) {
         // Fallback solution: Try to store code in another code heap.
+        // NonNMethod -> MethodNonProfiled -> MethodProfiled (-> MethodNonProfiled)
         // Note that in the sweeper, we check the reverse_free_ratio of the code heap
         // and force stack scanning if less than 10% of the code heap are free.
         int type = code_blob_type;
         switch (type) {
         case CodeBlobType::NonNMethod:
           type = CodeBlobType::MethodNonProfiled;
-          strict = false;   // Allow recursive search for other heaps
-          break;
-        case CodeBlobType::MethodProfiled:
-          type = CodeBlobType::MethodNonProfiled;
-          strict = true;
           break;
         case CodeBlobType::MethodNonProfiled:
           type = CodeBlobType::MethodProfiled;
-          strict = true;
+          break;
+        case CodeBlobType::MethodProfiled:
+          // Avoid loop if we already tried that code heap
+          if (type == orig_code_blob_type) {
+            type = CodeBlobType::MethodNonProfiled;
+          }
           break;
         }
-        if (heap_available(type)) {
-          return allocate(size, type, strict);
+        if (type != code_blob_type && type != orig_code_blob_type && heap_available(type)) {
+          if (PrintCodeCacheExtension) {
+            tty->print_cr("Extension of %s failed. Trying to allocate in %s.",
+                          heap->name(), get_code_heap(type)->name());
+          }
+          return allocate(size, type, orig_code_blob_type);
         }
       }
       MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-      CompileBroker::handle_full_code_cache(code_blob_type);
+      CompileBroker::handle_full_code_cache(orig_code_blob_type);
       return NULL;
     }
     if (PrintCodeCacheExtension) {
--- a/src/share/vm/code/codeCache.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/code/codeCache.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -126,7 +126,7 @@
   static void initialize();
 
   // Allocation/administration
-  static CodeBlob* allocate(int size, int code_blob_type, bool strict = false); // allocates a new CodeBlob
+  static CodeBlob* allocate(int size, int code_blob_type, int orig_code_blob_type = CodeBlobType::All); // allocates a new CodeBlob
   static void commit(CodeBlob* cb);                        // called when the allocated CodeBlob has been filled
   static int  alignment_unit();                            // guaranteed alignment of all CodeBlobs
   static int  alignment_offset();                          // guaranteed offset of first CodeBlob byte within alignment unit (i.e., allocation header)
--- a/src/share/vm/compiler/compileBroker.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/compiler/compileBroker.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -32,7 +32,6 @@
 #include "compiler/compileLog.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "compiler/directivesParser.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "interpreter/linkResolver.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
@@ -893,15 +892,6 @@
     return;
   }
 
-  // If the requesting thread is holding the pending list lock
-  // then we just return. We can't risk blocking while holding
-  // the pending list lock or a 3-way deadlock may occur
-  // between the reference handler thread, a GC (instigated
-  // by a compiler thread), and compiled method registration.
-  if (ReferencePendingListLocker::is_locked_by_self()) {
-    return;
-  }
-
   if (TieredCompilation) {
     // Tiered policy requires MethodCounters to exist before adding a method to
     // the queue. Create if we don't have them yet.
@@ -1755,7 +1745,7 @@
   assert(task->compile_id() != CICrashAt, "just as planned");
   if (event.should_commit()) {
     event.set_method(task->method());
-    event.set_compileID(task->compile_id());
+    event.set_compileId(task->compile_id());
     event.set_compileLevel(task->comp_level());
     event.set_succeded(task->is_success());
     event.set_isOsr(task->osr_bci() != CompileBroker::standard_entry_bci);
@@ -2399,4 +2389,3 @@
     }
   }
 }
-
--- a/src/share/vm/gc/cms/concurrentMarkSweepThread.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/cms/concurrentMarkSweepThread.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -28,7 +28,6 @@
 #include "gc/cms/concurrentMarkSweepThread.hpp"
 #include "gc/shared/gcId.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -77,23 +76,6 @@
     log_warning(gc)("Couldn't bind CMS thread to processor " UINTX_FORMAT, CPUForCMSThread);
   }
 
-  {
-    MutexLockerEx x(CGC_lock, true);
-    set_CMS_flag(CMS_cms_wants_token);
-    assert(is_init_completed() && Universe::is_fully_initialized(), "ConcurrentGCThread::run() should have waited for this.");
-
-    // Wait until the surrogate locker thread that will do
-    // pending list locking on our behalf has been created.
-    // We cannot start the SLT thread ourselves since we need
-    // to be a JavaThread to do so.
-    CMSLoopCountWarn loopY("CMS::run", "waiting for SLT installation", 2);
-    while (!ReferencePendingListLocker::is_initialized() && !should_terminate()) {
-      CGC_lock->wait(true, 200);
-      loopY.tick();
-    }
-    clear_CMS_flag(CMS_cms_wants_token);
-  }
-
   while (!should_terminate()) {
     sleepBeforeNextCycle();
     if (should_terminate()) break;
--- a/src/share/vm/gc/cms/vmCMSOperations.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/cms/vmCMSOperations.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -37,14 +37,6 @@
 //////////////////////////////////////////////////////////
 // Methods in abstract class VM_CMS_Operation
 //////////////////////////////////////////////////////////
-void VM_CMS_Operation::acquire_pending_list_lock() {
-  _pending_list_locker.lock();
-}
-
-void VM_CMS_Operation::release_and_notify_pending_list_lock() {
-  _pending_list_locker.unlock();
-}
-
 void VM_CMS_Operation::verify_before_gc() {
   if (VerifyBeforeGC &&
       GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
@@ -85,17 +77,10 @@
   assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
          "Possible deadlock");
 
-  if (needs_pending_list_lock()) {
-    acquire_pending_list_lock();
-  }
-  // Get the Heap_lock after the pending_list_lock.
   Heap_lock->lock();
   if (lost_race()) {
     assert(_prologue_succeeded == false, "Initialized in c'tor");
     Heap_lock->unlock();
-    if (needs_pending_list_lock()) {
-      release_and_notify_pending_list_lock();
-    }
   } else {
     _prologue_succeeded = true;
   }
@@ -108,11 +93,10 @@
   assert(!ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
          "Possible deadlock");
 
-  // Release the Heap_lock first.
+  if (Universe::has_reference_pending_list()) {
+    Heap_lock->notify_all();
+  }
   Heap_lock->unlock();
-  if (needs_pending_list_lock()) {
-    release_and_notify_pending_list_lock();
-  }
 }
 
 //////////////////////////////////////////////////////////
@@ -230,9 +214,11 @@
   Thread* thr = Thread::current();
   assert(thr->is_Java_thread(), "just checking");
   JavaThread* jt = (JavaThread*)thr;
-  // Release the Heap_lock first.
+
+  if (Universe::has_reference_pending_list()) {
+    Heap_lock->notify_all();
+  }
   Heap_lock->unlock();
-  release_and_notify_pending_list_lock();
 
   // It is fine to test whether completed collections has
   // exceeded our request count without locking because
--- a/src/share/vm/gc/cms/vmCMSOperations.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/cms/vmCMSOperations.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -28,7 +28,6 @@
 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
 #include "gc/shared/gcCause.hpp"
 #include "gc/shared/gcId.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "gc/shared/vmGCOperations.hpp"
 #include "runtime/vm_operations.hpp"
 
@@ -52,9 +51,6 @@
 class CMSCollector;
 
 class VM_CMS_Operation: public VM_Operation {
- private:
-  ReferencePendingListLocker _pending_list_locker;
-
  protected:
   CMSCollector*  _collector;                 // associated collector
   bool           _prologue_succeeded;     // whether doit_prologue succeeded
@@ -62,10 +58,6 @@
 
   bool lost_race() const;
 
-  // java.lang.ref.Reference support
-  void acquire_pending_list_lock();
-  void release_and_notify_pending_list_lock();
-
  public:
   VM_CMS_Operation(CMSCollector* collector):
     _collector(collector),
--- a/src/share/vm/gc/g1/concurrentMarkThread.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/concurrentMarkThread.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -175,7 +175,7 @@
                                 TimeHelper::counter_to_millis(mark_end - mark_start));
 
           CMCheckpointRootsFinalClosure final_cl(_cm);
-          VM_CGC_Operation op(&final_cl, "Pause Remark", true /* needs_pll */);
+          VM_CGC_Operation op(&final_cl, "Pause Remark");
           VMThread::execute(&op);
         }
         if (cm()->restart_for_overflow()) {
@@ -199,7 +199,7 @@
         delay_to_keep_mmu(g1_policy, false /* cleanup */);
 
         CMCleanUp cl_cl(_cm);
-        VM_CGC_Operation op(&cl_cl, "Pause Cleanup", false /* needs_pll */);
+        VM_CGC_Operation op(&cl_cl, "Pause Cleanup");
         VMThread::execute(&op);
       } else {
         // We don't want to update the marking status if a GC pause
--- a/src/share/vm/gc/g1/g1Analytics.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1Analytics.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -316,14 +316,10 @@
   return get_new_size_prediction(_pending_cards_seq);
 }
 
-double G1Analytics::oldest_known_gc_end_time_sec() const {
+double G1Analytics::last_known_gc_end_time_sec() const {
   return _recent_prev_end_times_for_all_gcs_sec->oldest();
 }
 
-double G1Analytics::last_known_gc_end_time_sec() const {
-  return _recent_prev_end_times_for_all_gcs_sec->last();
-}
-
 void G1Analytics::update_recent_gc_times(double end_time_sec,
                                          double pause_time_ms) {
   _recent_gc_times_ms->add(pause_time_ms);
--- a/src/share/vm/gc/g1/g1Analytics.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1Analytics.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -155,7 +155,6 @@
   void update_recent_gc_times(double end_time_sec, double elapsed_ms);
   void compute_pause_time_ratio(double interval_ms, double pause_time_ms);
 
-  double oldest_known_gc_end_time_sec() const;
   double last_known_gc_end_time_sec() const;
 };
 
--- a/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1CodeCacheRemSet.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "code/codeCache.hpp"
 #include "code/nmethod.hpp"
+#include "gc/g1/g1CodeRootSetTable.hpp"
 #include "gc/g1/g1CodeCacheRemSet.hpp"
 #include "gc/g1/heapRegion.hpp"
 #include "memory/heap.hpp"
@@ -33,58 +34,13 @@
 #include "utilities/hashtable.inline.hpp"
 #include "utilities/stack.inline.hpp"
 
-class CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
-  friend class G1CodeRootSetTest;
-  typedef HashtableEntry<nmethod*, mtGC> Entry;
+G1CodeRootSetTable* volatile G1CodeRootSetTable::_purge_list = NULL;
 
-  static CodeRootSetTable* volatile _purge_list;
-
-  CodeRootSetTable* _purge_next;
-
-  unsigned int compute_hash(nmethod* nm) {
-    uintptr_t hash = (uintptr_t)nm;
-    return hash ^ (hash >> 7); // code heap blocks are 128byte aligned
-  }
-
-  void remove_entry(Entry* e, Entry* previous);
-  Entry* new_entry(nmethod* nm);
-
- public:
-  CodeRootSetTable(int size) : Hashtable<nmethod*, mtGC>(size, sizeof(Entry)), _purge_next(NULL) {}
-  ~CodeRootSetTable();
-
-  // Needs to be protected locks
-  bool add(nmethod* nm);
-  bool remove(nmethod* nm);
-
-  // Can be called without locking
-  bool contains(nmethod* nm);
-
-  int entry_size() const { return BasicHashtable<mtGC>::entry_size(); }
-
-  void copy_to(CodeRootSetTable* new_table);
-  void nmethods_do(CodeBlobClosure* blk);
-
-  template<typename CB>
-  int remove_if(CB& should_remove);
-
-  static void purge_list_append(CodeRootSetTable* tbl);
-  static void purge();
-
-  static size_t static_mem_size() {
-    return sizeof(_purge_list);
-  }
-
-  size_t mem_size();
-};
-
-CodeRootSetTable* volatile CodeRootSetTable::_purge_list = NULL;
-
-size_t CodeRootSetTable::mem_size() {
-  return sizeof(CodeRootSetTable) + (entry_size() * number_of_entries()) + (sizeof(HashtableBucket<mtGC>) * table_size());
+size_t G1CodeRootSetTable::mem_size() {
+  return sizeof(G1CodeRootSetTable) + (entry_size() * number_of_entries()) + (sizeof(HashtableBucket<mtGC>) * table_size());
 }
 
-CodeRootSetTable::Entry* CodeRootSetTable::new_entry(nmethod* nm) {
+G1CodeRootSetTable::Entry* G1CodeRootSetTable::new_entry(nmethod* nm) {
   unsigned int hash = compute_hash(nm);
   Entry* entry = (Entry*) new_entry_free_list();
   if (entry == NULL) {
@@ -96,7 +52,7 @@
   return entry;
 }
 
-void CodeRootSetTable::remove_entry(Entry* e, Entry* previous) {
+void G1CodeRootSetTable::remove_entry(Entry* e, Entry* previous) {
   int index = hash_to_index(e->hash());
   assert((e == bucket(index)) == (previous == NULL), "if e is the first entry then previous should be null");
 
@@ -108,7 +64,7 @@
   free_entry(e);
 }
 
-CodeRootSetTable::~CodeRootSetTable() {
+G1CodeRootSetTable::~G1CodeRootSetTable() {
   for (int index = 0; index < table_size(); ++index) {
     for (Entry* e = bucket(index); e != NULL; ) {
       Entry* to_remove = e;
@@ -125,7 +81,7 @@
   }
 }
 
-bool CodeRootSetTable::add(nmethod* nm) {
+bool G1CodeRootSetTable::add(nmethod* nm) {
   if (!contains(nm)) {
     Entry* e = new_entry(nm);
     int index = hash_to_index(e->hash());
@@ -135,7 +91,7 @@
   return false;
 }
 
-bool CodeRootSetTable::contains(nmethod* nm) {
+bool G1CodeRootSetTable::contains(nmethod* nm) {
   int index = hash_to_index(compute_hash(nm));
   for (Entry* e = bucket(index); e != NULL; e = e->next()) {
     if (e->literal() == nm) {
@@ -145,7 +101,7 @@
   return false;
 }
 
-bool CodeRootSetTable::remove(nmethod* nm) {
+bool G1CodeRootSetTable::remove(nmethod* nm) {
   int index = hash_to_index(compute_hash(nm));
   Entry* previous = NULL;
   for (Entry* e = bucket(index); e != NULL; previous = e, e = e->next()) {
@@ -157,7 +113,7 @@
   return false;
 }
 
-void CodeRootSetTable::copy_to(CodeRootSetTable* new_table) {
+void G1CodeRootSetTable::copy_to(G1CodeRootSetTable* new_table) {
   for (int index = 0; index < table_size(); ++index) {
     for (Entry* e = bucket(index); e != NULL; e = e->next()) {
       new_table->add(e->literal());
@@ -166,7 +122,7 @@
   new_table->copy_freelist(this);
 }
 
-void CodeRootSetTable::nmethods_do(CodeBlobClosure* blk) {
+void G1CodeRootSetTable::nmethods_do(CodeBlobClosure* blk) {
   for (int index = 0; index < table_size(); ++index) {
     for (Entry* e = bucket(index); e != NULL; e = e->next()) {
       blk->do_code_blob(e->literal());
@@ -175,7 +131,7 @@
 }
 
 template<typename CB>
-int CodeRootSetTable::remove_if(CB& should_remove) {
+int G1CodeRootSetTable::remove_if(CB& should_remove) {
   int num_removed = 0;
   for (int index = 0; index < table_size(); ++index) {
     Entry* previous = NULL;
@@ -198,52 +154,52 @@
   delete _table;
 }
 
-CodeRootSetTable* G1CodeRootSet::load_acquire_table() {
-  return (CodeRootSetTable*) OrderAccess::load_ptr_acquire(&_table);
+G1CodeRootSetTable* G1CodeRootSet::load_acquire_table() {
+  return (G1CodeRootSetTable*) OrderAccess::load_ptr_acquire(&_table);
 }
 
 void G1CodeRootSet::allocate_small_table() {
-  CodeRootSetTable* temp = new CodeRootSetTable(SmallSize);
+  G1CodeRootSetTable* temp = new G1CodeRootSetTable(SmallSize);
 
   OrderAccess::release_store_ptr(&_table, temp);
 }
 
-void CodeRootSetTable::purge_list_append(CodeRootSetTable* table) {
+void G1CodeRootSetTable::purge_list_append(G1CodeRootSetTable* table) {
   for (;;) {
     table->_purge_next = _purge_list;
-    CodeRootSetTable* old = (CodeRootSetTable*) Atomic::cmpxchg_ptr(table, &_purge_list, table->_purge_next);
+    G1CodeRootSetTable* old = (G1CodeRootSetTable*) Atomic::cmpxchg_ptr(table, &_purge_list, table->_purge_next);
     if (old == table->_purge_next) {
       break;
     }
   }
 }
 
-void CodeRootSetTable::purge() {
-  CodeRootSetTable* table = _purge_list;
+void G1CodeRootSetTable::purge() {
+  G1CodeRootSetTable* table = _purge_list;
   _purge_list = NULL;
   while (table != NULL) {
-    CodeRootSetTable* to_purge = table;
+    G1CodeRootSetTable* to_purge = table;
     table = table->_purge_next;
     delete to_purge;
   }
 }
 
 void G1CodeRootSet::move_to_large() {
-  CodeRootSetTable* temp = new CodeRootSetTable(LargeSize);
+  G1CodeRootSetTable* temp = new G1CodeRootSetTable(LargeSize);
 
   _table->copy_to(temp);
 
-  CodeRootSetTable::purge_list_append(_table);
+  G1CodeRootSetTable::purge_list_append(_table);
 
   OrderAccess::release_store_ptr(&_table, temp);
 }
 
 void G1CodeRootSet::purge() {
-  CodeRootSetTable::purge();
+  G1CodeRootSetTable::purge();
 }
 
 size_t G1CodeRootSet::static_mem_size() {
-  return CodeRootSetTable::static_mem_size();
+  return G1CodeRootSetTable::static_mem_size();
 }
 
 void G1CodeRootSet::add(nmethod* method) {
@@ -278,7 +234,7 @@
 }
 
 bool G1CodeRootSet::contains(nmethod* method) {
-  CodeRootSetTable* table = load_acquire_table(); // contains() may be called outside of lock, so ensure mem sync.
+  G1CodeRootSetTable* table = load_acquire_table(); // contains() may be called outside of lock, so ensure mem sync.
   if (table != NULL) {
     return table->contains(method);
   }
@@ -348,67 +304,3 @@
     clear();
   }
 }
-
-#ifndef PRODUCT
-
-class G1CodeRootSetTest {
- public:
-  static void test() {
-    {
-      G1CodeRootSet set1;
-      assert(set1.is_empty(), "Code root set must be initially empty but is not.");
-
-      assert(G1CodeRootSet::static_mem_size() == sizeof(void*),
-             "The code root set's static memory usage is incorrect, " SIZE_FORMAT " bytes", G1CodeRootSet::static_mem_size());
-
-      set1.add((nmethod*)1);
-      assert(set1.length() == 1, "Added exactly one element, but set contains "
-             SIZE_FORMAT " elements", set1.length());
-
-      const size_t num_to_add = (size_t)G1CodeRootSet::Threshold + 1;
-
-      for (size_t i = 1; i <= num_to_add; i++) {
-        set1.add((nmethod*)1);
-      }
-      assert(set1.length() == 1,
-             "Duplicate detection should not have increased the set size but "
-             "is " SIZE_FORMAT, set1.length());
-
-      for (size_t i = 2; i <= num_to_add; i++) {
-        set1.add((nmethod*)(uintptr_t)(i));
-      }
-      assert(set1.length() == num_to_add,
-             "After adding in total " SIZE_FORMAT " distinct code roots, they "
-             "need to be in the set, but there are only " SIZE_FORMAT,
-             num_to_add, set1.length());
-
-      assert(CodeRootSetTable::_purge_list != NULL, "should have grown to large hashtable");
-
-      size_t num_popped = 0;
-      for (size_t i = 1; i <= num_to_add; i++) {
-        bool removed = set1.remove((nmethod*)i);
-        if (removed) {
-          num_popped += 1;
-        } else {
-          break;
-        }
-      }
-      assert(num_popped == num_to_add,
-             "Managed to pop " SIZE_FORMAT " code roots, but only " SIZE_FORMAT " "
-             "were added", num_popped, num_to_add);
-      assert(CodeRootSetTable::_purge_list != NULL, "should have grown to large hashtable");
-
-      G1CodeRootSet::purge();
-
-      assert(CodeRootSetTable::_purge_list == NULL, "should have purged old small tables");
-
-    }
-
-  }
-};
-
-void TestCodeCacheRemSet_test() {
-  G1CodeRootSetTest::test();
-}
-
-#endif
--- a/src/share/vm/gc/g1/g1CodeCacheRemSet.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1CodeCacheRemSet.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,7 @@
 #include "memory/allocation.hpp"
 
 class CodeBlobClosure;
-class CodeRootSetTable;
+class G1CodeRootSetTable;
 class HeapRegion;
 class nmethod;
 
@@ -42,8 +42,8 @@
   const static size_t Threshold = 24;
   const static size_t LargeSize = 512;
 
-  CodeRootSetTable* _table;
-  CodeRootSetTable* load_acquire_table();
+  G1CodeRootSetTable* _table;
+  G1CodeRootSetTable* load_acquire_table();
 
   size_t _length;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/gc/g1/g1CodeRootSetTable.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+#ifndef SHARE_VM_GC_G1_G1CODEROOTSETTABLE_HPP
+#define SHARE_VM_GC_G1_G1CODEROOTSETTABLE_HPP
+
+#include "utilities/hashtable.hpp"
+
+class nmethod;
+
+class G1CodeRootSetTable : public Hashtable<nmethod*, mtGC> {
+  friend class G1CodeRootSetTest;
+  typedef HashtableEntry<nmethod*, mtGC> Entry;
+
+  static G1CodeRootSetTable* volatile _purge_list;
+
+  G1CodeRootSetTable* _purge_next;
+
+  unsigned int compute_hash(nmethod* nm) {
+    uintptr_t hash = (uintptr_t)nm;
+    return hash ^ (hash >> 7); // code heap blocks are 128byte aligned
+  }
+
+  void remove_entry(Entry* e, Entry* previous);
+  Entry* new_entry(nmethod* nm);
+
+ public:
+  G1CodeRootSetTable(int size) : Hashtable<nmethod*, mtGC>(size, sizeof(Entry)), _purge_next(NULL) {}
+  ~G1CodeRootSetTable();
+
+  // Needs to be protected by locks
+  bool add(nmethod* nm);
+  bool remove(nmethod* nm);
+
+  // Can be called without locking
+  bool contains(nmethod* nm);
+
+  int entry_size() const { return BasicHashtable<mtGC>::entry_size(); }
+
+  void copy_to(G1CodeRootSetTable* new_table);
+  void nmethods_do(CodeBlobClosure* blk);
+
+  template<typename CB>
+  int remove_if(CB& should_remove);
+
+  static void purge_list_append(G1CodeRootSetTable* tbl);
+  static void purge();
+
+  static size_t static_mem_size() {
+    return sizeof(_purge_list);
+  }
+
+  size_t mem_size();
+};
+
+#endif /* SHARE_VM_GC_G1_G1CODEROOTSETTABLE_HPP */
--- a/src/share/vm/gc/g1/g1CollectedHeap.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1CollectedHeap.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -28,7 +28,6 @@
 #include "classfile/symbolTable.hpp"
 #include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
-#include "gc/g1/g1Analytics.hpp"
 #include "gc/g1/bufferingOopClosure.hpp"
 #include "gc/g1/concurrentG1Refine.hpp"
 #include "gc/g1/concurrentG1RefineThread.hpp"
@@ -2474,19 +2473,8 @@
 }
 
 jlong G1CollectedHeap::millis_since_last_gc() {
-  jlong now = os::elapsed_counter() / NANOSECS_PER_MILLISEC;
-  const G1Analytics* analytics = _g1_policy->analytics();
-  double last = analytics->last_known_gc_end_time_sec();
-  jlong ret_val = now - (last * 1000);
-  if (ret_val < 0) {
-    // See the notes in GenCollectedHeap::millis_since_last_gc()
-    // for more information about the implementation.
-    log_warning(gc)("Detected clock going backwards. "
-      "Milliseconds since last GC would be " JLONG_FORMAT
-      ". returning zero instead.", ret_val);
-    return 0;
-  }
-  return ret_val;
+  // assert(false, "NYI");
+  return 0;
 }
 
 void G1CollectedHeap::prepare_for_verify() {
@@ -4525,6 +4513,7 @@
 #if defined(COMPILER2) || INCLUDE_JVMCI
   DerivedPointerTable::update_pointers();
 #endif
+  g1_policy()->print_age_table();
 }
 
 void G1CollectedHeap::record_obj_copy_mem_stats() {
--- a/src/share/vm/gc/g1/g1CollectedHeap.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1CollectedHeap.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1273,12 +1273,6 @@
     return true;
   }
 
-  // The reference pending list lock is acquired from from the
-  // ConcurrentMarkThread.
-  virtual bool needs_reference_pending_list_locker_thread() const {
-    return true;
-  }
-
   inline bool is_in_young(const oop obj);
 
   virtual bool is_scavengable(const void* addr);
--- a/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1DefaultPolicy.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -604,7 +604,7 @@
     _analytics->report_alloc_rate_ms(alloc_rate_ms);
 
     double interval_ms =
-      (end_time_sec - _analytics->oldest_known_gc_end_time_sec()) * 1000.0;
+      (end_time_sec - _analytics->last_known_gc_end_time_sec()) * 1000.0;
     _analytics->update_recent_gc_times(end_time_sec, pause_time_ms);
     _analytics->compute_pause_time_ratio(interval_ms, pause_time_ms);
   }
@@ -885,6 +885,15 @@
   return _young_gen_sizer.adaptive_young_list_length();
 }
 
+size_t G1DefaultPolicy::desired_survivor_size() const {
+  size_t const survivor_capacity = HeapRegion::GrainWords * _max_survivor_regions;
+  return (size_t)((((double)survivor_capacity) * TargetSurvivorRatio) / 100);
+}
+
+void G1DefaultPolicy::print_age_table() {
+  _survivors_age_table.print_age_table(_tenuring_threshold);
+}
+
 void G1DefaultPolicy::update_max_gc_locker_expansion() {
   uint expansion_region_num = 0;
   if (GCLockerEdenExpansionPercent > 0) {
@@ -908,8 +917,11 @@
   // smaller than 1.0) we'll get 1.
   _max_survivor_regions = (uint) ceil(max_survivor_regions_d);
 
-  _tenuring_threshold = _survivors_age_table.compute_tenuring_threshold(
-      HeapRegion::GrainWords * _max_survivor_regions, _policy_counters);
+  _tenuring_threshold = _survivors_age_table.compute_tenuring_threshold(desired_survivor_size());
+  if (UsePerfData) {
+    _policy_counters->tenuring_threshold()->set_value(_tenuring_threshold);
+    _policy_counters->desired_survivor_size()->set_value(desired_survivor_size() * oopSize);
+  }
 }
 
 bool G1DefaultPolicy::force_initial_mark_if_outside_cycle(GCCause::Cause gc_cause) {
--- a/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1DefaultPolicy.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -360,6 +360,8 @@
 
   AgeTable _survivors_age_table;
 
+protected:
+  size_t desired_survivor_size() const;
 public:
   uint tenuring_threshold() const { return _tenuring_threshold; }
 
@@ -379,6 +381,8 @@
     _survivors_age_table.merge(age_table);
   }
 
+  void print_age_table();
+
   void update_max_gc_locker_expansion();
 
   void update_survivors_policy();
--- a/src/share/vm/gc/g1/g1Policy.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1Policy.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -181,6 +181,9 @@
   virtual void note_stop_adding_survivor_regions() = 0;
 
   virtual void record_age_table(AgeTable* age_table) = 0;
+  virtual void print_age_table() = 0;
+protected:
+  virtual size_t desired_survivor_size() const = 0;
 };
 
 #endif // SHARE_VM_GC_G1_G1POLICY_HPP
--- a/src/share/vm/gc/g1/g1Predictions.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- */
-
-#include "precompiled.hpp"
-#include "gc/g1/g1Predictions.hpp"
-
-#ifndef PRODUCT
-
-void G1Predictions::test() {
-  double const epsilon = 1e-6;
-  {
-    // Some basic formula tests with confidence = 0.0
-    G1Predictions predictor(0.0);
-    TruncatedSeq s;
-
-    double p0 = predictor.get_new_prediction(&s);
-    assert(p0 < epsilon, "Initial prediction of empty sequence must be 0.0 but is %f", p0);
-
-    s.add(5.0);
-    double p1 = predictor.get_new_prediction(&s);
-    assert(fabs(p1 - 5.0) < epsilon, "Prediction should be 5.0 but is %f", p1);
-    for (int i = 0; i < 40; i++) {
-      s.add(5.0);
-    }
-    double p2 = predictor.get_new_prediction(&s);
-    assert(fabs(p2 - 5.0) < epsilon, "Prediction should be 5.0 but is %f", p1);
-  }
-
-  {
-    // The following tests checks that the initial predictions are based on the
-    // average of the sequence and not on the stddev (which is 0).
-    G1Predictions predictor(0.5);
-    TruncatedSeq s;
-
-    s.add(1.0);
-    double p1 = predictor.get_new_prediction(&s);
-    assert(p1 > 1.0, "First prediction must be larger than average, but avg is %f and prediction %f", s.davg(), p1);
-    s.add(1.0);
-    double p2 = predictor.get_new_prediction(&s);
-    assert(p2 < p1, "First prediction must be larger than second, but they are %f %f", p1, p2);
-    s.add(1.0);
-    double p3 = predictor.get_new_prediction(&s);
-    assert(p3 < p2, "Second prediction must be larger than third, but they are %f %f", p2, p3);
-    s.add(1.0);
-    s.add(1.0); // Five elements are now in the sequence.
-    double p5 = predictor.get_new_prediction(&s);
-    assert(p5 < p3, "Fifth prediction must be smaller than third, but they are %f %f", p3, p5);
-    assert(fabs(p5 - 1.0) < epsilon, "Prediction must be 1.0+epsilon, but is %f", p5);
-  }
-
-  {
-    // The following tests checks that initially prediction based on the average is
-    // used, that gets overridden by the stddev prediction at the end.
-    G1Predictions predictor(0.5);
-    TruncatedSeq s;
-
-    s.add(0.5);
-    double p1 = predictor.get_new_prediction(&s);
-    assert(p1 > 0.5, "First prediction must be larger than average, but avg is %f and prediction %f", s.davg(), p1);
-    s.add(0.2);
-    double p2 = predictor.get_new_prediction(&s);
-    assert(p2 < p1, "First prediction must be larger than second, but they are %f %f", p1, p2);
-    s.add(0.5);
-    double p3 = predictor.get_new_prediction(&s);
-    assert(p3 < p2, "Second prediction must be larger than third, but they are %f %f", p2, p3);
-    s.add(0.2);
-    s.add(2.0);
-    double p5 = predictor.get_new_prediction(&s);
-    assert(p5 > p3, "Fifth prediction must be bigger than third, but they are %f %f", p3, p5);
-  }
-}
-
-void TestPredictions_test() {
-  G1Predictions::test();
-}
-
-#endif
--- a/src/share/vm/gc/g1/g1Predictions.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/g1Predictions.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,10 +57,6 @@
   double get_new_prediction(TruncatedSeq const* seq) const {
     return seq->davg() + _sigma * stddev_estimate(seq);
   }
-
-#ifndef PRODUCT
-  static void test();
-#endif
 };
 
 #endif // SHARE_VM_GC_G1_G1PREDICTIONS_HPP
--- a/src/share/vm/gc/g1/heapRegionTracer.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/heapRegionTracer.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -39,7 +39,7 @@
     e.set_to(to);
     e.set_start(start);
     e.set_used(used);
-    e.set_allocContext(allocationContext);
+    e.set_allocationContext(allocationContext);
     e.commit();
   }
 }
--- a/src/share/vm/gc/g1/vm_operations_g1.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/vm_operations_g1.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -204,14 +204,6 @@
   }
 }
 
-void VM_CGC_Operation::acquire_pending_list_lock() {
-  _pending_list_locker.lock();
-}
-
-void VM_CGC_Operation::release_and_notify_pending_list_lock() {
-  _pending_list_locker.unlock();
-}
-
 void VM_CGC_Operation::doit() {
   GCIdMark gc_id_mark(_gc_id);
   GCTraceCPUTime tcpu;
@@ -222,20 +214,13 @@
 }
 
 bool VM_CGC_Operation::doit_prologue() {
-  // Note the relative order of the locks must match that in
-  // VM_GC_Operation::doit_prologue() or deadlocks can occur
-  if (_needs_pending_list_lock) {
-    acquire_pending_list_lock();
-  }
   Heap_lock->lock();
   return true;
 }
 
 void VM_CGC_Operation::doit_epilogue() {
-  // Note the relative order of the unlocks must match that in
-  // VM_GC_Operation::doit_epilogue()
+  if (Universe::has_reference_pending_list()) {
+    Heap_lock->notify_all();
+  }
   Heap_lock->unlock();
-  if (_needs_pending_list_lock) {
-    release_and_notify_pending_list_lock();
-  }
 }
--- a/src/share/vm/gc/g1/vm_operations_g1.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/g1/vm_operations_g1.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
 
 #include "gc/g1/g1AllocationContext.hpp"
 #include "gc/shared/gcId.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "gc/shared/vmGCOperations.hpp"
 
 // VM_operations for the G1 collector.
@@ -103,20 +102,13 @@
 // Concurrent GC stop-the-world operations such as remark and cleanup;
 // consider sharing these with CMS's counterparts.
 class VM_CGC_Operation: public VM_Operation {
-  VoidClosure*               _cl;
-  const char*                _printGCMessage;
-  bool                       _needs_pending_list_lock;
-  ReferencePendingListLocker _pending_list_locker;
-  uint                       _gc_id;
-
-protected:
-  // java.lang.ref.Reference support
-  void acquire_pending_list_lock();
-  void release_and_notify_pending_list_lock();
+  VoidClosure* _cl;
+  const char*  _printGCMessage;
+  uint         _gc_id;
 
 public:
-  VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg, bool needs_pending_list_lock)
-    : _cl(cl), _printGCMessage(printGCMsg), _needs_pending_list_lock(needs_pending_list_lock), _gc_id(GCId::current()) {}
+  VM_CGC_Operation(VoidClosure* cl, const char *printGCMsg)
+    : _cl(cl), _printGCMessage(printGCMsg), _gc_id(GCId::current()) {}
   virtual VMOp_Type type() const { return VMOp_CGC_Operation; }
   virtual void doit();
   virtual bool doit_prologue();
--- a/src/share/vm/gc/parallel/psAdaptiveSizePolicy.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/parallel/psAdaptiveSizePolicy.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1133,18 +1133,3 @@
 
   return false;
 }
-
-#ifndef PRODUCT
-
-void TestOldFreeSpaceCalculation_test() {
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(100, 20) == 25, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(100, 50) == 100, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(100, 60) == 150, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(100, 75) == 300, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(400, 20) == 100, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(400, 50) == 400, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(400, 60) == 600, "Calculation of free memory failed");
-  assert(PSAdaptiveSizePolicy::calculate_free_based_on_live(400, 75) == 1200, "Calculation of free memory failed");
-}
-
-#endif /* !PRODUCT */
--- a/src/share/vm/gc/serial/defNewGeneration.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/serial/defNewGeneration.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -564,9 +564,18 @@
 
 void DefNewGeneration::adjust_desired_tenuring_threshold() {
   // Set the desired survivor size to half the real survivor space
-  GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->gen_policy()->counters();
-  _tenuring_threshold =
-    age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize, gc_counters);
+  size_t const survivor_capacity = to()->capacity() / HeapWordSize;
+  size_t const desired_survivor_size = (size_t)((((double)survivor_capacity) * TargetSurvivorRatio) / 100);
+
+  _tenuring_threshold = age_table()->compute_tenuring_threshold(desired_survivor_size);
+
+  if (UsePerfData) {
+    GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->gen_policy()->counters();
+    gc_counters->tenuring_threshold()->set_value(_tenuring_threshold);
+    gc_counters->desired_survivor_size()->set_value(desired_survivor_size * oopSize);
+  }
+
+  age_table()->print_age_table(_tenuring_threshold);
 }
 
 void DefNewGeneration::collect(bool   full,
--- a/src/share/vm/gc/shared/ageTable.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/ageTable.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
 #include "gc/shared/ageTableTracer.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/collectorPolicy.hpp"
-#include "gc/shared/gcPolicyCounters.hpp"
 #include "memory/resourceArea.hpp"
 #include "logging/log.hpp"
 #include "oops/oop.inline.hpp"
@@ -75,8 +74,7 @@
   }
 }
 
-uint AgeTable::compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters) {
-  size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
+uint AgeTable::compute_tenuring_threshold(size_t desired_survivor_size) {
   uint result;
 
   if (AlwaysTenure || NeverTenure) {
@@ -99,9 +97,16 @@
 
 
   log_debug(gc, age)("Desired survivor size " SIZE_FORMAT " bytes, new threshold " UINTX_FORMAT " (max threshold " UINTX_FORMAT ")",
-                     desired_survivor_size*oopSize, (uintx) result, MaxTenuringThreshold);
+                     desired_survivor_size * oopSize, (uintx) result, MaxTenuringThreshold);
 
+  return result;
+}
+
+void AgeTable::print_age_table(uint tenuring_threshold) {
   if (log_is_enabled(Trace, gc, age) || UsePerfData || AgeTableTracer::is_tenuring_distribution_event_enabled()) {
+    log_trace(gc, age)("Age table with threshold %u (max threshold " UINTX_FORMAT ")",
+                       tenuring_threshold, MaxTenuringThreshold);
+
     size_t total = 0;
     uint age = 1;
     while (age < table_size) {
@@ -109,20 +114,14 @@
       total += wordSize;
       if (wordSize > 0) {
         log_trace(gc, age)("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
-                            age, wordSize*oopSize, total*oopSize);
+                            age, wordSize * oopSize, total * oopSize);
       }
-      AgeTableTracer::send_tenuring_distribution_event(age, wordSize*oopSize);
+      AgeTableTracer::send_tenuring_distribution_event(age, wordSize * oopSize);
       if (UsePerfData) {
-        _perf_sizes[age]->set_value(wordSize*oopSize);
+        _perf_sizes[age]->set_value(wordSize * oopSize);
       }
       age++;
     }
-    if (UsePerfData) {
-      gc_counters->tenuring_threshold()->set_value(result);
-      gc_counters->desired_survivor_size()->set_value(
-        desired_survivor_size*oopSize);
-    }
   }
+}
 
-  return result;
-}
--- a/src/share/vm/gc/shared/ageTable.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/ageTable.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -29,8 +29,6 @@
 #include "oops/oop.hpp"
 #include "runtime/perfData.hpp"
 
-class GCPolicyCounters;
-
 /* Copyright (c) 1992, 2016, Oracle and/or its affiliates, and Stanford University.
    See the LICENSE file for license information. */
 
@@ -67,10 +65,12 @@
   // for parallel young generation gc.
   void merge(AgeTable* subTable);
 
-  // calculate new tenuring threshold based on age information
-  uint compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters);
+  // Calculate new tenuring threshold based on age information.
+  uint compute_tenuring_threshold(size_t desired_survivor_size);
+  void print_age_table(uint tenuring_threshold);
 
  private:
+
   PerfVariable* _perf_sizes[table_size];
 };
 
--- a/src/share/vm/gc/shared/allocTracer.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/allocTracer.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -29,18 +29,18 @@
 #include "utilities/globalDefinitions.hpp"
 
 void AllocTracer::send_allocation_outside_tlab_event(KlassHandle klass, size_t alloc_size) {
-  EventAllocObjectOutsideTLAB event;
+  EventObjectAllocationOutsideTLAB event;
   if (event.should_commit()) {
-    event.set_class(klass());
+    event.set_objectClass(klass());
     event.set_allocationSize(alloc_size);
     event.commit();
   }
 }
 
 void AllocTracer::send_allocation_in_new_tlab_event(KlassHandle klass, size_t tlab_size, size_t alloc_size) {
-  EventAllocObjectInNewTLAB event;
+  EventObjectAllocationInNewTLAB event;
   if (event.should_commit()) {
-    event.set_class(klass());
+    event.set_objectClass(klass());
     event.set_allocationSize(alloc_size);
     event.set_tlabSize(tlab_size);
     event.commit();
--- a/src/share/vm/gc/shared/collectedHeap.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/collectedHeap.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -441,12 +441,6 @@
   // remembered set.
   virtual void flush_deferred_store_barrier(JavaThread* thread);
 
-  // Should return true if the reference pending list lock is
-  // acquired from non-Java threads, such as a concurrent GC thread.
-  virtual bool needs_reference_pending_list_locker_thread() const {
-    return false;
-  }
-
   // Perform a collection of the heap; intended for use in implementing
   // "System.gc".  This probably implies as full a collection as the
   // "CollectedHeap" supports.
--- a/src/share/vm/gc/shared/gcTraceSend.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/gcTraceSend.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -43,7 +43,7 @@
 typedef uintptr_t TraceAddress;
 
 void GCTracer::send_garbage_collection_event() const {
-  EventGCGarbageCollection event(UNTIMED);
+  EventGarbageCollection event(UNTIMED);
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
     event.set_name(_shared_gc_info.name());
@@ -91,7 +91,7 @@
 }
 
 void ParallelOldTracer::send_parallel_old_event() const {
-  EventGCParallelOld e(UNTIMED);
+  EventParallelOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_densePrefix((TraceAddress)_parallel_old_gc_info.dense_prefix());
@@ -102,7 +102,7 @@
 }
 
 void YoungGCTracer::send_young_gc_event() const {
-  EventGCYoungGarbageCollection e(UNTIMED);
+  EventYoungGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_tenuringThreshold(_tenuring_threshold);
@@ -127,7 +127,7 @@
   EventPromoteObjectInNewPLAB event;
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
-    event.set_class(klass);
+    event.set_objectClass(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
     event.set_tenuringAge(age);
@@ -142,7 +142,7 @@
   EventPromoteObjectOutsidePLAB event;
   if (event.should_commit()) {
     event.set_gcId(GCId::current());
-    event.set_class(klass);
+    event.set_objectClass(klass);
     event.set_objectSize(obj_size);
     event.set_tenured(tenured);
     event.set_tenuringAge(age);
@@ -151,7 +151,7 @@
 }
 
 void OldGCTracer::send_old_gc_event() const {
-  EventGCOldGarbageCollection e(UNTIMED);
+  EventOldGarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_starttime(_shared_gc_info.start_timestamp());
@@ -173,7 +173,7 @@
   EventPromotionFailed e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
-    e.set_data(to_trace_struct(pf_info));
+    e.set_promotionFailed(to_trace_struct(pf_info));
     e.set_thread(pf_info.thread_trace_id());
     e.commit();
   }
@@ -190,7 +190,7 @@
 
 #if INCLUDE_ALL_GCS
 void G1NewTracer::send_g1_young_gc_event() {
-  EventGCG1GarbageCollection e(UNTIMED);
+  EventG1GarbageCollection e(UNTIMED);
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_type(_g1_young_gc_info.type());
@@ -201,7 +201,7 @@
 }
 
 void G1MMUTracer::send_g1_mmu_event(double timeSlice, double gcTime, double maxTime) {
-  EventGCG1MMU e;
+  EventG1MMU e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_timeSlice(timeSlice);
@@ -212,15 +212,15 @@
 }
 
 void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
-  EventEvacuationInfo e;
+  EventEvacuationInformation e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
     e.set_cSetRegions(info->collectionset_regions());
     e.set_cSetUsedBefore(info->collectionset_used_before());
     e.set_cSetUsedAfter(info->collectionset_used_after());
     e.set_allocationRegions(info->allocation_regions());
-    e.set_allocRegionsUsedBefore(info->alloc_regions_used_before());
-    e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
+    e.set_allocationRegionsUsedBefore(info->alloc_regions_used_before());
+    e.set_allocationRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
     e.set_bytesCopied(info->bytes_copied());
     e.set_regionsFreed(info->regions_freed());
     e.commit();
@@ -231,13 +231,14 @@
   EventEvacuationFailed e;
   if (e.should_commit()) {
     e.set_gcId(GCId::current());
-    e.set_data(to_trace_struct(ef_info));
+    e.set_evacuationFailed(to_trace_struct(ef_info));
     e.commit();
   }
 }
 
-static TraceStructG1EvacStats create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
-  TraceStructG1EvacStats s;
+static TraceStructG1EvacuationStatistics
+create_g1_evacstats(unsigned gcid, const G1EvacSummary& summary) {
+  TraceStructG1EvacuationStatistics s;
   s.set_gcId(gcid);
   s.set_allocated(summary.allocated() * HeapWordSize);
   s.set_wasted(summary.wasted() * HeapWordSize);
@@ -252,17 +253,17 @@
 }
 
 void G1NewTracer::send_young_evacuation_statistics(const G1EvacSummary& summary) const {
-  EventGCG1EvacuationYoungStatistics surv_evt;
+  EventG1EvacuationYoungStatistics surv_evt;
   if (surv_evt.should_commit()) {
-    surv_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
+    surv_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
     surv_evt.commit();
   }
 }
 
 void G1NewTracer::send_old_evacuation_statistics(const G1EvacSummary& summary) const {
-  EventGCG1EvacuationOldStatistics old_evt;
+  EventG1EvacuationOldStatistics old_evt;
   if (old_evt.should_commit()) {
-    old_evt.set_stats(create_g1_evacstats(GCId::current(), summary));
+    old_evt.set_statistics(create_g1_evacstats(GCId::current(), summary));
     old_evt.commit();
   }
 }
@@ -273,7 +274,7 @@
                                              size_t last_allocation_size,
                                              double last_allocation_duration,
                                              double last_marking_length) {
-  EventGCG1BasicIHOP evt;
+  EventG1BasicIHOP evt;
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
@@ -295,7 +296,7 @@
                                                 double predicted_allocation_rate,
                                                 double predicted_marking_length,
                                                 bool prediction_active) {
-  EventGCG1AdaptiveIHOP evt;
+  EventG1AdaptiveIHOP evt;
   if (evt.should_commit()) {
     evt.set_gcId(GCId::current());
     evt.set_threshold(threshold);
--- a/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/genCollectedHeap.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1256,21 +1256,21 @@
 };
 
 jlong GenCollectedHeap::millis_since_last_gc() {
-  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
-  // provided the underlying platform provides such a time source
-  // (and it is bug free). So we still have to guard against getting
-  // back a time later than 'now'.
+  // We need a monotonically non-decreasing time in ms but
+  // os::javaTimeMillis() does not guarantee monotonicity.
   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
   GenTimeOfLastGCClosure tolgc_cl(now);
   // iterate over generations getting the oldest
   // time that a generation was collected
   generation_iterate(&tolgc_cl, false);
 
+  // javaTimeNanos() is guaranteed to be monotonically non-decreasing
+  // provided the underlying platform provides such a time source
+  // (and it is bug free). So we still have to guard against getting
+  // back a time later than 'now'.
   jlong retVal = now - tolgc_cl.time();
   if (retVal < 0) {
-    log_warning(gc)("Detected clock going backwards. "
-      "Milliseconds since last GC would be " JLONG_FORMAT
-      ". returning zero instead.", retVal);
+    NOT_PRODUCT(log_warning(gc)("time warp: " JLONG_FORMAT, retVal);)
     return 0;
   }
   return retVal;
--- a/src/share/vm/gc/shared/genCollectedHeap.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/genCollectedHeap.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -281,10 +281,6 @@
     return UseConcMarkSweepGC;
   }
 
-  virtual bool needs_reference_pending_list_locker_thread() const {
-    return UseConcMarkSweepGC;
-  }
-
   // We don't need barriers for stores to objects in the
   // young gen and, a fortiori, for initializing stores to
   // objects therein. This applies to DefNew+Tenured and ParNew+CMS
--- a/src/share/vm/gc/shared/memset_with_concurrent_readers.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- */
-
-#include "precompiled.hpp"
-
-#include <string.h>
-#include "gc/shared/memset_with_concurrent_readers.hpp"
-#include "utilities/debug.hpp"
-#include "utilities/globalDefinitions.hpp"
-#include "utilities/macros.hpp"
-#include "utilities/ostream.hpp"
-
-#if INCLUDE_ALL_GCS
-
-// Unit test
-#ifndef PRODUCT
-
-static unsigned line_byte(const char* line, size_t i) {
-  return unsigned(line[i]) & 0xFF;
-}
-
-// Verify memset_with_concurrent_readers mimics memset.
-// We don't attempt to verify the concurrent reader case.
-void test_memset_with_concurrent_readers() {
-  const size_t chunk_size = 8 * BytesPerWord;
-  const unsigned chunk_count = 4;
-  const size_t block_size = (chunk_count + 4) * chunk_size;
-  char block[block_size];
-  char clear_block[block_size];
-  char set_block[block_size];
-
-  // block format:
-  // 0: unused leading chunk
-  // 1: chunk written from start index to end of chunk
-  // ... nchunks fully written chunks
-  // N: chunk written from start of chunk to end index
-  // N+1: unused trailing chunk
-
-  const int clear_value = 0;
-  const int set_value = 0xAC;
-
-  memset(clear_block, clear_value, block_size);
-  memset(set_block, set_value, block_size);
-
-  for (unsigned nchunks = 0; nchunks <= chunk_count; ++nchunks) {
-    for (size_t start = 1; start <= chunk_size; ++start) {
-      for (size_t end = 0; end <= chunk_size; ++end) {
-        size_t set_start = chunk_size + start;
-        size_t set_end = (2 + nchunks) * chunk_size + end;
-        size_t set_size = set_end - set_start;
-
-        memset(block, clear_value, block_size);
-        memset_with_concurrent_readers(&block[set_start], set_value, set_size);
-        bool head_clear = !memcmp(clear_block, block, set_start);
-        bool middle_set = !memcmp(set_block, block + set_start, set_size);
-        bool tail_clear = !memcmp(clear_block, block + set_end, block_size - set_end);
-        if (!(head_clear && middle_set && tail_clear)) {
-          tty->print_cr("*** memset_with_concurrent_readers failed: "
-                        "set start " SIZE_FORMAT ", set end " SIZE_FORMAT,
-                        set_start, set_end);
-          for (unsigned chunk = 0; chunk < (block_size / chunk_size); ++chunk) {
-            for (unsigned line = 0; line < (chunk_size / BytesPerWord); ++line) {
-              const char* lp = &block[chunk * chunk_size + line * BytesPerWord];
-              tty->print_cr("%d,%d: %2x %2x  %2x %2x  %2x %2x  %2x %2x",
-                            chunk, line,
-                            line_byte(lp, 0), line_byte(lp, 1),
-                            line_byte(lp, 2), line_byte(lp, 3),
-                            line_byte(lp, 4), line_byte(lp, 5),
-                            line_byte(lp, 6), line_byte(lp, 7));
-            }
-          }
-          assert(head_clear, "leading byte not clear");
-          assert(middle_set, "memset byte not set");
-          assert(tail_clear, "trailing bye not clear");
-        }
-      }
-    }
-  }
-}
-
-#endif // end unit test
-
-#endif // INCLUDE_ALL_GCS
--- a/src/share/vm/gc/shared/objectCountEventSender.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/objectCountEventSender.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -40,7 +40,7 @@
 
   EventObjectCountAfterGC event(UNTIMED);
   event.set_gcId(GCId::current());
-  event.set_class(entry->klass());
+  event.set_objectClass(entry->klass());
   event.set_count(entry->count());
   event.set_totalSize(entry->words() * BytesPerWord);
   event.set_endtime(timestamp);
--- a/src/share/vm/gc/shared/referencePendingListLocker.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * 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 "classfile/systemDictionary.hpp"
-#include "gc/shared/collectedHeap.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
-#include "memory/universe.hpp"
-#include "runtime/javaCalls.hpp"
-#include "utilities/preserveException.hpp"
-
-ReferencePendingListLockerThread::ReferencePendingListLockerThread() :
-  JavaThread(&start),
-  _monitor(Monitor::nonleaf, "ReferencePendingListLocker", false, Monitor::_safepoint_check_sometimes),
-  _message(NONE) {}
-
-ReferencePendingListLockerThread* ReferencePendingListLockerThread::create(TRAPS) {
-  // Create Java thread objects
-  instanceKlassHandle thread_klass = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK_NULL);
-  instanceHandle thread_object = thread_klass->allocate_instance_handle(CHECK_NULL);
-  Handle thread_name = java_lang_String::create_from_str("Reference Pending List Locker", CHECK_NULL);
-  Handle thread_group = Universe::system_thread_group();
-  JavaValue result(T_VOID);
-  JavaCalls::call_special(&result,
-                          thread_object,
-                          thread_klass,
-                          vmSymbols::object_initializer_name(),
-                          vmSymbols::threadgroup_string_void_signature(),
-                          thread_group,
-                          thread_name,
-                          CHECK_NULL);
-
-  {
-    MutexLocker ml(Threads_lock);
-
-    // Allocate thread
-    ReferencePendingListLockerThread* thread = new ReferencePendingListLockerThread();
-    if (thread == NULL || thread->osthread() == NULL) {
-      vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                    os::native_thread_creation_failed_msg());
-    }
-
-    // Initialize thread
-    java_lang_Thread::set_thread(thread_object(), thread);
-    java_lang_Thread::set_priority(thread_object(), NearMaxPriority);
-    java_lang_Thread::set_daemon(thread_object());
-    thread->set_threadObj(thread_object());
-
-    // Start thread
-    Threads::add(thread);
-    Thread::start(thread);
-
-    return thread;
-  }
-}
-
-void ReferencePendingListLockerThread::start(JavaThread* thread, TRAPS) {
-  ReferencePendingListLockerThread* locker_thread = static_cast<ReferencePendingListLockerThread*>(thread);
-  locker_thread->receive_and_handle_messages();
-}
-
-bool ReferencePendingListLockerThread::is_hidden_from_external_view() const {
-  return true;
-}
-
-void ReferencePendingListLockerThread::send_message(Message message) {
-  assert(message != NONE, "Should not be none");
-  MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
-
-  // Wait for completion of current message
-  while (_message != NONE) {
-    ml.wait(Monitor::_no_safepoint_check_flag);
-  }
-
-  // Send new message
-  _message = message;
-  ml.notify_all();
-
-  // Wait for completion of new message
-  while (_message != NONE) {
-    ml.wait(Monitor::_no_safepoint_check_flag);
-  }
-}
-
-void ReferencePendingListLockerThread::receive_and_handle_messages() {
-  ReferencePendingListLocker pending_list_locker;
-  MonitorLockerEx ml(&_monitor);
-
-  // Main loop, never terminates
-  for (;;) {
-    // Wait for message
-    while (_message == NONE) {
-      ml.wait();
-    }
-
-    // Handle message
-    if (_message == LOCK) {
-      pending_list_locker.lock();
-    } else if (_message == UNLOCK) {
-      pending_list_locker.unlock();
-    } else {
-      ShouldNotReachHere();
-    }
-
-    // Clear message
-    _message = NONE;
-    ml.notify_all();
-  }
-}
-
-void ReferencePendingListLockerThread::lock() {
-  send_message(LOCK);
-}
-
-void ReferencePendingListLockerThread::unlock() {
-  send_message(UNLOCK);
-}
-
-bool ReferencePendingListLocker::_is_initialized = false;
-ReferencePendingListLockerThread* ReferencePendingListLocker::_locker_thread = NULL;
-
-void ReferencePendingListLocker::initialize(bool needs_locker_thread, TRAPS) {
-  if (needs_locker_thread) {
-    _locker_thread = ReferencePendingListLockerThread::create(CHECK);
-  }
-
-  _is_initialized = true;
-}
-
-bool ReferencePendingListLocker::is_initialized() {
-  return _is_initialized;
-}
-
-bool ReferencePendingListLocker::is_locked_by_self() {
-  oop pending_list_lock = java_lang_ref_Reference::pending_list_lock();
-  if (pending_list_lock == NULL) {
-    return false;
-  }
-
-  JavaThread* thread = JavaThread::current();
-  Handle handle(thread, pending_list_lock);
-  return ObjectSynchronizer::current_thread_holds_lock(thread, handle);
-}
-
-void ReferencePendingListLocker::lock() {
-  assert(!Heap_lock->owned_by_self(), "Heap_lock must not be owned by requesting thread");
-
-  if (Thread::current()->is_Java_thread()) {
-    assert(java_lang_ref_Reference::pending_list_lock() != NULL, "Not initialized");
-
-    // We may enter this with a pending exception
-    PRESERVE_EXCEPTION_MARK;
-
-    HandleMark hm;
-    Handle handle(THREAD, java_lang_ref_Reference::pending_list_lock());
-
-    // Lock
-    ObjectSynchronizer::fast_enter(handle, &_basic_lock, false, THREAD);
-
-    assert(is_locked_by_self(), "Locking failed");
-
-    if (HAS_PENDING_EXCEPTION) {
-      CLEAR_PENDING_EXCEPTION;
-    }
-  } else {
-    // Delegate operation to locker thread
-    assert(_locker_thread != NULL, "Locker thread not created");
-    _locker_thread->lock();
-  }
-}
-
-void ReferencePendingListLocker::unlock() {
-  if (Thread::current()->is_Java_thread()) {
-    assert(java_lang_ref_Reference::pending_list_lock() != NULL, "Not initialized");
-
-    // We may enter this with a pending exception
-    PRESERVE_EXCEPTION_MARK;
-
-    HandleMark hm;
-    Handle handle(THREAD, java_lang_ref_Reference::pending_list_lock());
-
-    assert(is_locked_by_self(), "Should be locked by self");
-
-    // Notify waiters if the pending list is non-empty
-    if (java_lang_ref_Reference::pending_list() != NULL) {
-      ObjectSynchronizer::notifyall(handle, THREAD);
-    }
-
-    // Unlock
-    ObjectSynchronizer::fast_exit(handle(), &_basic_lock, THREAD);
-
-    if (HAS_PENDING_EXCEPTION) {
-      CLEAR_PENDING_EXCEPTION;
-    }
-  } else {
-    // Delegate operation to locker thread
-    assert(_locker_thread != NULL, "Locker thread not created");
-    _locker_thread->unlock();
-  }
-}
--- a/src/share/vm/gc/shared/referencePendingListLocker.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
- * 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.
- *
- */
-
-#ifndef SHARE_VM_GC_SHARED_REFERENCEPENDINGLISTLOCKER_HPP
-#define SHARE_VM_GC_SHARED_REFERENCEPENDINGLISTLOCKER_HPP
-
-#include "memory/allocation.hpp"
-#include "runtime/basicLock.hpp"
-#include "runtime/mutex.hpp"
-#include "runtime/thread.hpp"
-#include "utilities/exceptions.hpp"
-
-//
-// The ReferencePendingListLockerThread locks and unlocks the reference
-// pending list lock on behalf a non-Java thread, typically a concurrent
-// GC thread. This interface should not be directly accessed. All uses
-// should instead go through the ReferencePendingListLocker, which calls
-// this thread if needed.
-//
-class ReferencePendingListLockerThread : public JavaThread {
-private:
-  enum Message {
-    NONE,
-    LOCK,
-    UNLOCK
-  };
-
-  Monitor _monitor;
-  Message _message;
-
-  ReferencePendingListLockerThread();
-
-  static void start(JavaThread* thread, TRAPS);
-
-  void send_message(Message message);
-  void receive_and_handle_messages();
-
-public:
-  static ReferencePendingListLockerThread* create(TRAPS);
-
-  virtual bool is_hidden_from_external_view() const;
-
-  void lock();
-  void unlock();
-};
-
-//
-// The ReferencePendingListLocker is the main interface for locking and
-// unlocking the reference pending list lock, which needs to be held by
-// the GC when adding references to the pending list. Since this is a
-// Java-level monitor it can only be locked/unlocked by a Java thread.
-// For this reason there is an option to spawn a helper thread, the
-// ReferencePendingListLockerThread, during initialization. If a helper
-// thread is spawned all lock operations from non-Java threads will be
-// delegated to the helper thread. The helper thread is typically needed
-// by concurrent GCs.
-//
-class ReferencePendingListLocker VALUE_OBJ_CLASS_SPEC {
-private:
-  static bool                              _is_initialized;
-  static ReferencePendingListLockerThread* _locker_thread;
-  BasicLock                                _basic_lock;
-
-public:
-  static void initialize(bool needs_locker_thread, TRAPS);
-  static bool is_initialized();
-
-  static bool is_locked_by_self();
-
-  void lock();
-  void unlock();
-};
-
-#endif // SHARE_VM_GC_SHARED_REFERENCEPENDINGLISTLOCKER_HPP
--- a/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/referenceProcessor.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -289,39 +289,16 @@
   complete_gc->do_void();
 }
 
-
-template <class T>
-bool enqueue_discovered_ref_helper(ReferenceProcessor* ref,
-                                   AbstractRefProcTaskExecutor* task_executor) {
-
-  // Remember old value of pending references list
-  T* pending_list_addr = (T*)java_lang_ref_Reference::pending_list_addr();
-  T old_pending_list_value = *pending_list_addr;
-
+void ReferenceProcessor::enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor) {
   // Enqueue references that are not made active again, and
   // clear the decks for the next collection (cycle).
-  ref->enqueue_discovered_reflists((HeapWord*)pending_list_addr, task_executor);
-  // Do the post-barrier on pending_list_addr missed in
-  // enqueue_discovered_reflist.
-  oopDesc::bs()->write_ref_field(pending_list_addr, oopDesc::load_decode_heap_oop(pending_list_addr));
+  enqueue_discovered_reflists(task_executor);
 
   // Stop treating discovered references specially.
-  ref->disable_discovery();
-
-  // Return true if new pending references were added
-  return old_pending_list_value != *pending_list_addr;
+  disable_discovery();
 }
 
-bool ReferenceProcessor::enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor) {
-  if (UseCompressedOops) {
-    return enqueue_discovered_ref_helper<narrowOop>(this, task_executor);
-  } else {
-    return enqueue_discovered_ref_helper<oop>(this, task_executor);
-  }
-}
-
-void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list,
-                                                    HeapWord* pending_list_addr) {
+void ReferenceProcessor::enqueue_discovered_reflist(DiscoveredList& refs_list) {
   // Given a list of refs linked through the "discovered" field
   // (java.lang.ref.Reference.discovered), self-loop their "next" field
   // thus distinguishing them from active References, then
@@ -354,10 +331,9 @@
       oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), next_d);
     } else {
       // This is the last object.
-      // Swap refs_list into pending_list_addr and
-      // set obj's discovered to what we read from pending_list_addr.
-      oop old = oopDesc::atomic_exchange_oop(refs_list.head(), pending_list_addr);
-      // Need post-barrier on pending_list_addr. See enqueue_discovered_ref_helper() above.
+      // Swap refs_list into pending list and set obj's
+      // discovered to what we read from the pending list.
+      oop old = Universe::swap_reference_pending_list(refs_list.head());
       java_lang_ref_Reference::set_discovered_raw(obj, old); // old may be NULL
       oopDesc::bs()->write_ref_field(java_lang_ref_Reference::discovered_addr(obj), old);
     }
@@ -369,10 +345,8 @@
 public:
   RefProcEnqueueTask(ReferenceProcessor& ref_processor,
                      DiscoveredList      discovered_refs[],
-                     HeapWord*           pending_list_addr,
                      int                 n_queues)
-    : EnqueueTask(ref_processor, discovered_refs,
-                  pending_list_addr, n_queues)
+    : EnqueueTask(ref_processor, discovered_refs, n_queues)
   { }
 
   virtual void work(unsigned int work_id) {
@@ -387,8 +361,7 @@
     for (int j = 0;
          j < ReferenceProcessor::number_of_subclasses_of_ref();
          j++, index += _n_queues) {
-      _ref_processor.enqueue_discovered_reflist(
-        _refs_lists[index], _pending_list_addr);
+      _ref_processor.enqueue_discovered_reflist(_refs_lists[index]);
       _refs_lists[index].set_head(NULL);
       _refs_lists[index].set_length(0);
     }
@@ -396,17 +369,15 @@
 };
 
 // Enqueue references that are not made active again
-void ReferenceProcessor::enqueue_discovered_reflists(HeapWord* pending_list_addr,
-  AbstractRefProcTaskExecutor* task_executor) {
+void ReferenceProcessor::enqueue_discovered_reflists(AbstractRefProcTaskExecutor* task_executor) {
   if (_processing_is_mt && task_executor != NULL) {
     // Parallel code
-    RefProcEnqueueTask tsk(*this, _discovered_refs,
-                           pending_list_addr, _max_num_q);
+    RefProcEnqueueTask tsk(*this, _discovered_refs, _max_num_q);
     task_executor->execute(tsk);
   } else {
     // Serial code: call the parent class's implementation
     for (uint i = 0; i < _max_num_q * number_of_subclasses_of_ref(); i++) {
-      enqueue_discovered_reflist(_discovered_refs[i], pending_list_addr);
+      enqueue_discovered_reflist(_discovered_refs[i]);
       _discovered_refs[i].set_head(NULL);
       _discovered_refs[i].set_length(0);
     }
--- a/src/share/vm/gc/shared/referenceProcessor.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/referenceProcessor.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -290,7 +290,7 @@
                       VoidClosure*       complete_gc);
 
   // Enqueue references with a certain reachability level
-  void enqueue_discovered_reflist(DiscoveredList& refs_list, HeapWord* pending_list_addr);
+  void enqueue_discovered_reflist(DiscoveredList& refs_list);
 
   // "Preclean" all the discovered reference lists
   // by removing references with strongly reachable referents.
@@ -311,7 +311,7 @@
   // occupying the i / _num_q slot.
   const char* list_name(uint i);
 
-  void enqueue_discovered_reflists(HeapWord* pending_list_addr, AbstractRefProcTaskExecutor* task_executor);
+  void enqueue_discovered_reflists(AbstractRefProcTaskExecutor* task_executor);
 
  protected:
   // "Preclean" the given discovered reference list
@@ -424,7 +424,7 @@
                                 GCTimer *gc_timer);
 
   // Enqueue references at end of GC (called by the garbage collector)
-  bool enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL);
+  void enqueue_discovered_references(AbstractRefProcTaskExecutor* task_executor = NULL);
 
   // If a discovery is in process that is being superceded, abandon it: all
   // the discovered lists will be empty, and all the objects on them will
@@ -613,11 +613,9 @@
 protected:
   EnqueueTask(ReferenceProcessor& ref_processor,
               DiscoveredList      refs_lists[],
-              HeapWord*           pending_list_addr,
               int                 n_queues)
     : _ref_processor(ref_processor),
       _refs_lists(refs_lists),
-      _pending_list_addr(pending_list_addr),
       _n_queues(n_queues)
   { }
 
@@ -627,7 +625,6 @@
 protected:
   ReferenceProcessor& _ref_processor;
   DiscoveredList*     _refs_lists;
-  HeapWord*           _pending_list_addr;
   int                 _n_queues;
 };
 
--- a/src/share/vm/gc/shared/space.inline.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/space.inline.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -293,10 +293,11 @@
 
   verify_up_to_first_dead(space);
 
+  HeapWord* const bottom = space->bottom();
   HeapWord* const end_of_live = space->_end_of_live;
 
   assert(space->_first_dead <= end_of_live, "Invariant. _first_dead: " PTR_FORMAT " <= end_of_live: " PTR_FORMAT, p2i(space->_first_dead), p2i(end_of_live));
-  if (space->_first_dead == end_of_live && !oop(space->bottom())->is_gc_marked()) {
+  if (space->_first_dead == end_of_live && (bottom == end_of_live || !oop(bottom)->is_gc_marked())) {
     // Nothing to compact. The space is either empty or all live object should be left in place.
     clear_empty_region(space);
     return;
@@ -305,8 +306,8 @@
   const intx scan_interval = PrefetchScanIntervalInBytes;
   const intx copy_interval = PrefetchCopyIntervalInBytes;
 
-  assert(space->bottom() < end_of_live, "bottom: " PTR_FORMAT " should be < end_of_live: " PTR_FORMAT, p2i(space->bottom()), p2i(end_of_live));
-  HeapWord* cur_obj = space->bottom();
+  assert(bottom < end_of_live, "bottom: " PTR_FORMAT " should be < end_of_live: " PTR_FORMAT, p2i(bottom), p2i(end_of_live));
+  HeapWord* cur_obj = bottom;
   if (space->_first_dead > cur_obj && !oop(cur_obj)->is_gc_marked()) {
     // All object before _first_dead can be skipped. They should not be moved.
     // A pointer to the first live object is stored at the memory location for _first_dead.
--- a/src/share/vm/gc/shared/vmGCOperations.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/vmGCOperations.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -62,14 +62,6 @@
   HS_DTRACE_WORKAROUND_TAIL_CALL_BUG();
 }
 
-void VM_GC_Operation::acquire_pending_list_lock() {
-  _pending_list_locker.lock();
-}
-
-void VM_GC_Operation::release_and_notify_pending_list_lock() {
-  _pending_list_locker.unlock();
-}
-
 // Allocations may fail in several threads at about the same time,
 // resulting in multiple gc requests.  We only want to do one of them.
 // In case a GC locker is active and the need for a GC is already signaled,
@@ -102,16 +94,13 @@
               proper_unit_for_byte_size(NewSize)));
   }
 
-  acquire_pending_list_lock();
   // If the GC count has changed someone beat us to the collection
-  // Get the Heap_lock after the pending_list_lock.
   Heap_lock->lock();
 
   // Check invocations
   if (skip_operation()) {
     // skip collection
     Heap_lock->unlock();
-    release_and_notify_pending_list_lock();
     _prologue_succeeded = false;
   } else {
     _prologue_succeeded = true;
@@ -122,9 +111,10 @@
 
 void VM_GC_Operation::doit_epilogue() {
   assert(Thread::current()->is_Java_thread(), "just checking");
-  // Release the Heap_lock first.
+  if (Universe::has_reference_pending_list()) {
+    Heap_lock->notify_all();
+  }
   Heap_lock->unlock();
-  release_and_notify_pending_list_lock();
 }
 
 bool VM_GC_HeapInspection::skip_operation() const {
--- a/src/share/vm/gc/shared/vmGCOperations.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/gc/shared/vmGCOperations.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
 
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "memory/heapInspection.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/handles.hpp"
@@ -70,9 +69,6 @@
 //
 
 class VM_GC_Operation: public VM_Operation {
- private:
-  ReferencePendingListLocker _pending_list_locker;
-
  protected:
   uint           _gc_count_before;         // gc count before acquiring PLL
   uint           _full_gc_count_before;    // full gc count before acquiring PLL
@@ -83,10 +79,6 @@
 
   virtual bool skip_operation() const;
 
-  // java.lang.ref.Reference support
-  void acquire_pending_list_lock();
-  void release_and_notify_pending_list_lock();
-
  public:
   VM_GC_Operation(uint gc_count_before,
                   GCCause::Cause _cause,
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -203,6 +203,40 @@
 #undef SET_TRIGFUNC
 }
 
+objArrayHandle CompilerToVM::initialize_intrinsics(TRAPS) {
+  objArrayHandle vmIntrinsics = oopFactory::new_objArray(VMIntrinsicMethod::klass(), (vmIntrinsics::ID_LIMIT - 1), CHECK_(objArrayHandle()));
+  int index = 0;
+  // The intrinsics for a class are usually adjacent to each other.
+  // When they are, the string for the class name can be reused.
+  vmSymbols::SID kls_sid = vmSymbols::NO_SID;
+  Handle kls_str;
+#define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n)
+#define VM_SYMBOL_TO_STRING(s) \
+  java_lang_String::create_from_symbol(vmSymbols::symbol_at(SID_ENUM(s)), CHECK_(objArrayHandle()))
+#define VM_INTRINSIC_INFO(id, kls, name, sig, ignore_fcode) {             \
+    instanceHandle vmIntrinsicMethod = InstanceKlass::cast(VMIntrinsicMethod::klass())->allocate_instance_handle(CHECK_(objArrayHandle())); \
+    if (kls_sid != SID_ENUM(kls)) {                                       \
+      kls_str = VM_SYMBOL_TO_STRING(kls);                                 \
+      kls_sid = SID_ENUM(kls);                                            \
+    }                                                                     \
+    Handle name_str = VM_SYMBOL_TO_STRING(name);                          \
+    Handle sig_str = VM_SYMBOL_TO_STRING(sig);                            \
+    VMIntrinsicMethod::set_declaringClass(vmIntrinsicMethod, kls_str());  \
+    VMIntrinsicMethod::set_name(vmIntrinsicMethod, name_str());           \
+    VMIntrinsicMethod::set_descriptor(vmIntrinsicMethod, sig_str());      \
+    VMIntrinsicMethod::set_id(vmIntrinsicMethod, vmIntrinsics::id);       \
+      vmIntrinsics->obj_at_put(index++, vmIntrinsicMethod());             \
+  }
+
+  VM_INTRINSICS_DO(VM_INTRINSIC_INFO, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE)
+#undef SID_ENUM
+#undef VM_SYMBOL_TO_STRING
+#undef VM_INTRINSIC_INFO
+  assert(index == vmIntrinsics::ID_LIMIT - 1, "must be");
+
+  return vmIntrinsics;
+}
+
 C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env))
 #define BOXED_LONG(name, value) oop name; do { jvalue p; p.j = (jlong) (value); name = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL);} while(0)
 #define BOXED_DOUBLE(name, value) oop name; do { jvalue p; p.d = (jdouble) (value); name = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL);} while(0)
@@ -211,8 +245,9 @@
 
   CompilerToVM::Data::initialize();
 
-  VMField::klass()->initialize(thread);
-  VMFlag::klass()->initialize(thread);
+  VMField::klass()->initialize(CHECK_NULL);
+  VMFlag::klass()->initialize(CHECK_NULL);
+  VMIntrinsicMethod::klass()->initialize(CHECK_NULL);
 
   int len = JVMCIVMStructs::localHotSpotVMStructs_count();
   objArrayHandle vmFields = oopFactory::new_objArray(VMField::klass(), len, CHECK_NULL);
@@ -220,7 +255,7 @@
     VMStructEntry vmField = JVMCIVMStructs::localHotSpotVMStructs[i];
     instanceHandle vmFieldObj = InstanceKlass::cast(VMField::klass())->allocate_instance_handle(CHECK_NULL);
     size_t name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */;
-    char* name_buf = NEW_RESOURCE_ARRAY(char, name_buf_len + 1);
+    char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_len + 1);
     sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName);
     Handle name = java_lang_String::create_from_str(name_buf, CHECK_NULL);
     Handle type = java_lang_String::create_from_str(vmField.typeString, CHECK_NULL);
@@ -338,12 +373,15 @@
     vmFlags->obj_at_put(i, vmFlagObj());
   }
 
-  objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 5, CHECK_NULL);
+  objArrayHandle vmIntrinsics = CompilerToVM::initialize_intrinsics(CHECK_NULL);
+
+  objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 6, CHECK_NULL);
   data->obj_at_put(0, vmFields());
   data->obj_at_put(1, vmTypes());
   data->obj_at_put(2, vmConstants());
   data->obj_at_put(3, vmAddresses());
   data->obj_at_put(4, vmFlags());
+  data->obj_at_put(5, vmIntrinsics());
 
   return (jobjectArray) JNIHandles::make_local(THREAD, data);
 #undef BOXED_LONG
@@ -1266,10 +1304,23 @@
 
 C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
   constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
-  CallInfo callInfo;
-  LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK);
-  ConstantPoolCacheEntry* cp_cache_entry = cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index));
-  cp_cache_entry->set_method_handle(cp, callInfo);
+  KlassHandle holder = cp->klass_ref_at(index, CHECK);
+  Symbol* name = cp->name_ref_at(index);
+  if (MethodHandles::is_signature_polymorphic_name(holder(), name)) {
+    CallInfo callInfo;
+    LinkResolver::resolve_invoke(callInfo, Handle(), cp, index, Bytecodes::_invokehandle, CHECK);
+    ConstantPoolCacheEntry* cp_cache_entry = cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index));
+    cp_cache_entry->set_method_handle(cp, callInfo);
+  }
+C2V_END
+
+C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject))
+  objArrayHandle holders = oopFactory::new_objArray(SystemDictionary::String_klass(), 2, CHECK_NULL);
+  Handle mh = java_lang_String::create_from_str("Ljava/lang/invoke/MethodHandle;", CHECK_NULL);
+  Handle vh = java_lang_String::create_from_str("Ljava/lang/invoke/VarHandle;", CHECK_NULL);
+  holders->obj_at_put(0, mh());
+  holders->obj_at_put(1, vh());
+  return JNIHandles::make_local(THREAD, holders());
 C2V_END
 
 C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject))
@@ -1511,6 +1562,7 @@
   {CC "resolveInvokeDynamicInPool",                   CC "(" HS_CONSTANT_POOL "I)V",                                                        FN_PTR(resolveInvokeDynamicInPool)},
   {CC "resolveInvokeHandleInPool",                    CC "(" HS_CONSTANT_POOL "I)V",                                                        FN_PTR(resolveInvokeHandleInPool)},
   {CC "resolveMethod",                                CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD, FN_PTR(resolveMethod)},
+  {CC "getSignaturePolymorphicHolders",               CC "()[" STRING,                                                                      FN_PTR(getSignaturePolymorphicHolders)},
   {CC "getVtableIndexForInterfaceMethod",             CC "(" HS_RESOLVED_KLASS HS_RESOLVED_METHOD ")I",                                     FN_PTR(getVtableIndexForInterfaceMethod)},
   {CC "getClassInitializer",                          CC "(" HS_RESOLVED_KLASS ")" HS_RESOLVED_METHOD,                                      FN_PTR(getClassInitializer)},
   {CC "hasFinalizableSubclass",                       CC "(" HS_RESOLVED_KLASS ")Z",                                                        FN_PTR(hasFinalizableSubclass)},
--- a/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -83,8 +83,10 @@
     }
   };
 
+  static JNINativeMethod methods[];
+
+  static objArrayHandle initialize_intrinsics(TRAPS);
  public:
-  static JNINativeMethod methods[];
   static int methods_count();
 
   static inline Method* asMethod(jobject jvmci_method) {
--- a/src/share/vm/jvmci/jvmciJavaClasses.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/jvmciJavaClasses.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -124,6 +124,12 @@
     oop_field(VMFlag, type, "Ljava/lang/String;")                                                                                                              \
     oop_field(VMFlag, value, "Ljava/lang/Object;")                                                                                                             \
   end_class                                                                                                                                                    \
+  start_class(VMIntrinsicMethod)                                                                                                                               \
+    oop_field(VMIntrinsicMethod, declaringClass, "Ljava/lang/String;")                                                                                         \
+    oop_field(VMIntrinsicMethod, name, "Ljava/lang/String;")                                                                                                   \
+    oop_field(VMIntrinsicMethod, descriptor, "Ljava/lang/String;")                                                                                             \
+    int_field(VMIntrinsicMethod, id)                                                                                                                           \
+  end_class                                                                                                                                                    \
   start_class(Assumptions_NoFinalizableSubclass)                                                                                                               \
     oop_field(Assumptions_NoFinalizableSubclass, receiverType, "Ljdk/vm/ci/meta/ResolvedJavaType;")                                                            \
   end_class                                                                                                                                                    \
--- a/src/share/vm/jvmci/jvmci_globals.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/jvmci_globals.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -84,6 +84,7 @@
   CHECK_NOT_SET(JVMCICountersExcludeCompiler, EnableJVMCI)
   CHECK_NOT_SET(JVMCIUseFastLocking,          EnableJVMCI)
   CHECK_NOT_SET(JVMCINMethodSizeLimit,        EnableJVMCI)
+  CHECK_NOT_SET(MethodProfileWidth,           EnableJVMCI)
   CHECK_NOT_SET(TraceUncollectedSpeculations, EnableJVMCI)
 
 #ifndef PRODUCT
--- a/src/share/vm/jvmci/jvmci_globals.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/jvmci_globals.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -88,6 +88,9 @@
   experimental(intx, JVMCINMethodSizeLimit, (80*K)*wordSize,                \
           "Maximum size of a compiled method.")                             \
                                                                             \
+  experimental(intx, MethodProfileWidth, 0,                                 \
+          "Number of methods to record in call profile")                    \
+                                                                            \
   develop(bool, TraceUncollectedSpeculations, false,                        \
           "Print message when a failed speculation was not collected")
 
--- a/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/systemDictionary_jvmci.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -51,6 +51,7 @@
   do_klass(HotSpotCompilationRequestResult_klass,        jdk_vm_ci_hotspot_HotSpotCompilationRequestResult,     Jvmci) \
   do_klass(VMField_klass,                                jdk_vm_ci_hotspot_VMField,                             Jvmci) \
   do_klass(VMFlag_klass,                                 jdk_vm_ci_hotspot_VMFlag,                              Jvmci) \
+  do_klass(VMIntrinsicMethod_klass,                      jdk_vm_ci_hotspot_VMIntrinsicMethod,                   Jvmci) \
   do_klass(Assumptions_ConcreteMethod_klass,             jdk_vm_ci_meta_Assumptions_ConcreteMethod,             Jvmci) \
   do_klass(Assumptions_NoFinalizableSubclass_klass,      jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass,      Jvmci) \
   do_klass(Assumptions_ConcreteSubtype_klass,            jdk_vm_ci_meta_Assumptions_ConcreteSubtype,            Jvmci) \
--- a/src/share/vm/jvmci/vmStructs_jvmci.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/vmStructs_jvmci.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -493,6 +493,7 @@
   declare_constant(Method::_force_inline)                                 \
   declare_constant(Method::_dont_inline)                                  \
   declare_constant(Method::_hidden)                                       \
+  declare_constant(Method::_intrinsic_candidate)                          \
   declare_constant(Method::_reserved_stack_access)                        \
                                                                           \
   declare_constant(Method::nonvirtual_vtable_index)                       \
--- a/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/jvmci/vmSymbols_jvmci.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -52,6 +52,7 @@
   template(jdk_vm_ci_hotspot_HotSpotCompilationRequestResult,     "jdk/vm/ci/hotspot/HotSpotCompilationRequestResult")     \
   template(jdk_vm_ci_hotspot_VMField,                             "jdk/vm/ci/hotspot/VMField")                             \
   template(jdk_vm_ci_hotspot_VMFlag,                              "jdk/vm/ci/hotspot/VMFlag")                              \
+  template(jdk_vm_ci_hotspot_VMIntrinsicMethod,                   "jdk/vm/ci/hotspot/VMIntrinsicMethod")                   \
   template(jdk_vm_ci_meta_JavaConstant,                           "jdk/vm/ci/meta/JavaConstant")                           \
   template(jdk_vm_ci_meta_PrimitiveConstant,                      "jdk/vm/ci/meta/PrimitiveConstant")                      \
   template(jdk_vm_ci_meta_RawConstant,                            "jdk/vm/ci/meta/RawConstant")                            \
--- a/src/share/vm/logging/log.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/log.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1161,7 +1161,7 @@
 
   // Attempt to log to a directory (existing log not a regular file)
   create_directory(target_name);
-  LogFileOutput bad_file("tmplogdir");
+  LogFileOutput bad_file("file=tmplogdir");
   assert(bad_file.initialize("", &ss) == false, "file was initialized "
          "when there was an existing directory with the same name");
   assert(strstr(ss.as_string(), "tmplogdir is not a regular file") != NULL,
--- a/src/share/vm/logging/logConfiguration.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logConfiguration.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -44,6 +44,9 @@
 LogConfiguration::UpdateListenerFunction* LogConfiguration::_listener_callbacks = NULL;
 size_t      LogConfiguration::_n_listener_callbacks = 0;
 
+// LogFileOutput is the default type of output, its type prefix should be used if no type was specified
+static const char* implicit_output_prefix = LogFileOutput::Prefix;
+
 // Stack object to take the lock for configuring the logging.
 // Should only be held during the critical parts of the configuration
 // (when calling configure_output or reading/modifying the outputs array).
@@ -107,6 +110,55 @@
   FREE_C_HEAP_ARRAY(LogOutput*, _outputs);
 }
 
+// Normalizes the given LogOutput name to type=name form.
+// For example, foo, "foo", file="foo", will all be normalized to file=foo (no quotes, prefixed).
+static bool normalize_output_name(const char* full_name, char* buffer, size_t len, outputStream* errstream) {
+  const char* start_quote = strchr(full_name, '"');
+  const char* equals = strchr(full_name, '=');
+  const bool quoted = start_quote != NULL;
+  const bool is_stdout_or_stderr = (strcmp(full_name, "stdout") == 0 || strcmp(full_name, "stderr") == 0);
+
+  // ignore equals sign within quotes
+  if (quoted && equals > start_quote) {
+    equals = NULL;
+  }
+
+  const char* prefix = "";
+  size_t prefix_len = 0;
+  const char* name = full_name;
+  if (equals != NULL) {
+    // split on equals sign
+    name = equals + 1;
+    prefix = full_name;
+    prefix_len = equals - full_name + 1;
+  } else if (!is_stdout_or_stderr) {
+    prefix = implicit_output_prefix;
+    prefix_len = strlen(prefix);
+  }
+  size_t name_len = strlen(name);
+
+  if (quoted) {
+    const char* end_quote = strchr(start_quote + 1, '"');
+    if (end_quote == NULL) {
+      errstream->print_cr("Output name has opening quote but is missing a terminating quote.");
+      return false;
+    }
+    if (start_quote != name || end_quote[1] != '\0') {
+      errstream->print_cr("Output name can not be partially quoted."
+                          " Either surround the whole name with quotation marks,"
+                          " or do not use quotation marks at all.");
+      return false;
+    }
+    // strip start and end quote
+    name++;
+    name_len -= 2;
+  }
+
+  int ret = jio_snprintf(buffer, len, "%.*s%.*s", prefix_len, prefix, name_len, name);
+  assert(ret > 0, "buffer issue");
+  return true;
+}
+
 size_t LogConfiguration::find_output(const char* name) {
   for (size_t i = 0; i < _n_outputs; i++) {
     if (strcmp(_outputs[i]->name(), name) == 0) {
@@ -116,39 +168,14 @@
   return SIZE_MAX;
 }
 
-LogOutput* LogConfiguration::new_output(char* name, const char* options, outputStream* errstream) {
-  const char* type;
-  char* equals_pos = strchr(name, '=');
-  if (equals_pos == NULL) {
-    type = "file";
-  } else {
-    *equals_pos = '\0';
-    type = name;
-    name = equals_pos + 1;
-  }
-
-  // Check if name is quoted, and if so, strip the quotes
-  char* quote = strchr(name, '"');
-  if (quote != NULL) {
-    char* end_quote = strchr(name + 1, '"');
-    if (end_quote == NULL) {
-      errstream->print_cr("Output name has opening quote but is missing a terminating quote.");
-      return NULL;
-    } else if (quote != name || end_quote[1] != '\0') {
-      errstream->print_cr("Output name can not be partially quoted."
-                          " Either surround the whole name with quotation marks,"
-                          " or do not use quotation marks at all.");
-      return NULL;
-    }
-    name++;
-    *end_quote = '\0';
-  }
-
+LogOutput* LogConfiguration::new_output(const char* name,
+                                        const char* options,
+                                        outputStream* errstream) {
   LogOutput* output;
-  if (strcmp(type, "file") == 0) {
+  if (strncmp(name, LogFileOutput::Prefix, strlen(LogFileOutput::Prefix)) == 0) {
     output = new LogFileOutput(name);
   } else {
-    errstream->print_cr("Unsupported log output type.");
+    errstream->print_cr("Unsupported log output type: %s", name);
     return NULL;
   }
 
@@ -243,6 +270,7 @@
 }
 
 void LogConfiguration::disable_output(size_t idx) {
+  assert(idx < _n_outputs, "invalid index: " SIZE_FORMAT " (_n_outputs: " SIZE_FORMAT ")", idx, _n_outputs);
   LogOutput* out = _outputs[idx];
 
   // Remove the output from all tagsets.
@@ -253,7 +281,7 @@
 
   // Delete the output unless stdout/stderr
   if (out != LogOutput::Stderr && out != LogOutput::Stdout) {
-    delete_output(find_output(out->name()));
+    delete_output(idx);
   } else {
     out->set_config_string("all=off");
   }
@@ -261,8 +289,8 @@
 
 void LogConfiguration::disable_logging() {
   ConfigurationLock cl;
-  for (size_t i = 0; i < _n_outputs; i++) {
-    disable_output(i);
+  for (size_t i = _n_outputs; i > 0; i--) {
+    disable_output(i - 1);
   }
   notify_update_listeners();
 }
@@ -289,6 +317,8 @@
   }
   expr.set_level(level);
   expr.new_combination();
+  assert(expr.verify_tagsets(),
+         "configure_stdout() called with invalid/non-existing tag set");
 
   // Apply configuration to stdout (output #0), with the same decorators as before.
   ConfigurationLock cl;
@@ -334,9 +364,16 @@
   char errbuf[512];
   stringStream ss(errbuf, sizeof(errbuf));
   bool success = parse_log_arguments(output, what, decorators, output_options, &ss);
-  if (!success) {
-    errbuf[strlen(errbuf) - 1] = '\0'; // Strip trailing newline.
-    log_error(logging)("%s", errbuf);
+
+  if (ss.size() > 0) {
+    errbuf[strlen(errbuf) - 1] = '\0'; // Strip trailing newline
+    // If it failed, log the error. If it didn't fail, but something was written
+    // to the stream, log it as a warning.
+    if (!success) {
+      log_error(logging)("%s", ss.base());
+    } else {
+      log_warning(logging)("%s", ss.base());
+    }
   }
 
   os::free(copy);
@@ -364,28 +401,39 @@
 
   ConfigurationLock cl;
   size_t idx;
-  if (outputstr[0] == '#') {
-    int ret = sscanf(outputstr+1, SIZE_FORMAT, &idx);
+  if (outputstr[0] == '#') { // Output specified using index
+    int ret = sscanf(outputstr + 1, SIZE_FORMAT, &idx);
     if (ret != 1 || idx >= _n_outputs) {
       errstream->print_cr("Invalid output index '%s'", outputstr);
       return false;
     }
-  } else {
-    idx = find_output(outputstr);
+  } else { // Output specified using name
+    // Normalize the name, stripping quotes and ensures it includes type prefix
+    size_t len = strlen(outputstr) + strlen(implicit_output_prefix) + 1;
+    char* normalized = NEW_C_HEAP_ARRAY(char, len, mtLogging);
+    if (!normalize_output_name(outputstr, normalized, len, errstream)) {
+      return false;
+    }
+
+    idx = find_output(normalized);
     if (idx == SIZE_MAX) {
-      char* tmp = os::strdup_check_oom(outputstr, mtLogging);
-      LogOutput* output = new_output(tmp, output_options, errstream);
-      os::free(tmp);
-      if (output == NULL) {
-        return false;
+      // Attempt to create and add the output
+      LogOutput* output = new_output(normalized, output_options, errstream);
+      if (output != NULL) {
+        idx = add_output(output);
       }
-      idx = add_output(output);
     } else if (output_options != NULL && strlen(output_options) > 0) {
       errstream->print_cr("Output options for existing outputs are ignored.");
     }
+
+    FREE_C_HEAP_ARRAY(char, normalized);
+    if (idx == SIZE_MAX) {
+      return false;
+    }
   }
   configure_output(idx, expr, decorators);
   notify_update_listeners();
+  expr.verify_tagsets(errstream);
   return true;
 }
 
--- a/src/share/vm/logging/logConfiguration.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logConfiguration.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -59,7 +59,7 @@
   static size_t                     _n_listener_callbacks;
 
   // Create a new output. Returns NULL if failed.
-  static LogOutput* new_output(char* name, const char* options, outputStream* errstream);
+  static LogOutput* new_output(const char* name, const char* options, outputStream* errstream);
 
   // Add an output to the list of configured outputs. Returns the assigned index.
   static size_t add_output(LogOutput* out);
--- a/src/share/vm/logging/logFileOutput.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logFileOutput.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -31,6 +31,7 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/defaultStream.hpp"
 
+const char* LogFileOutput::Prefix = "file=";
 const char* LogFileOutput::FileOpenMode = "a";
 const char* LogFileOutput::PidFilenamePlaceholder = "%p";
 const char* LogFileOutput::TimestampFilenamePlaceholder = "%t";
@@ -45,7 +46,8 @@
       _file_name(NULL), _archive_name(NULL), _archive_name_len(0),
       _rotate_size(DefaultFileSize), _file_count(DefaultFileCount),
       _current_size(0), _current_file(0), _rotation_semaphore(1) {
-  _file_name = make_file_name(name, _pid_str, _vm_start_time_str);
+  assert(strstr(name, Prefix) == name, "invalid output name '%s': missing prefix: %s", name, Prefix);
+  _file_name = make_file_name(name + strlen(Prefix), _pid_str, _vm_start_time_str);
 }
 
 void LogFileOutput::set_file_name_parameters(jlong vm_start_time) {
--- a/src/share/vm/logging/logFileOutput.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logFileOutput.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -91,6 +91,7 @@
     return _name;
   }
 
+  static const char* Prefix;
   static void set_file_name_parameters(jlong start_time);
 };
 
--- a/src/share/vm/logging/logTagLevelExpression.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logTagLevelExpression.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -29,6 +29,65 @@
 
 const char* LogTagLevelExpression::DefaultExpressionString = "all";
 
+static bool matches_tagset(const LogTagType tags[],
+                           bool allow_other_tags,
+                           const LogTagSet& ts) {
+  bool contains_all = true;
+  size_t tag_idx;
+  for (tag_idx = 0; tag_idx < LogTag::MaxTags && tags[tag_idx] != LogTag::__NO_TAG; tag_idx++) {
+    if (!ts.contains(tags[tag_idx])) {
+      contains_all = false;
+      break;
+    }
+  }
+  // All tags in the expression must be part of the tagset,
+  // and either the expression allows other tags (has a wildcard),
+  // or the number of tags in the expression and tagset must match.
+  return contains_all && (allow_other_tags || tag_idx == ts.ntags());
+}
+
+bool LogTagLevelExpression::verify_tagsets(outputStream* out) const {
+  bool valid = true;
+
+  for (size_t i = 0; i < _ncombinations; i++) {
+    bool matched = false;
+    for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) {
+      if (matches_tagset(_tags[i], _allow_other_tags[i], *ts)) {
+        matched = true;
+        break;
+      }
+    }
+
+    if (!matched) {
+      // If this was the first invalid combination, write the message header
+      if (valid && out != NULL) {
+        out->print("No tag set matches selection(s): ");
+      }
+      valid = false;
+
+      // Break as soon as possible unless listing all invalid combinations
+      if (out == NULL) {
+        break;
+      }
+
+      // List the combination on the outputStream
+      for (size_t t = 0; t < LogTag::MaxTags && _tags[i][t] != LogTag::__NO_TAG; t++) {
+        out->print("%s%s", (t == 0 ? "" : "+"), LogTag::name(_tags[i][t]));
+      }
+      if (_allow_other_tags[i]) {
+        out->print("*");
+      }
+      out->print(" ");
+    }
+  }
+
+  if (!valid && out != NULL) {
+    out->cr();
+  }
+
+  return valid;
+}
+
 bool LogTagLevelExpression::parse(const char* str, outputStream* errstream) {
   bool success = true;
   if (str == NULL || strcmp(str, "") == 0) {
@@ -105,7 +164,14 @@
         success = false;
         break;
       }
-      add_tag(tag);
+      if (!add_tag(tag)) {
+        if (errstream != NULL) {
+          errstream->print_cr("Tag combination have duplicate tag '%s' in what-expression.",
+                              cur_tag);
+        }
+        success = false;
+        break;
+      }
       cur_tag = plus_pos + 1;
     } while (plus_pos != NULL);
 
@@ -120,20 +186,10 @@
   // Return NotMentioned if the given tagset isn't covered by this expression.
   LogLevelType level = LogLevel::NotMentioned;
   for (size_t combination = 0; combination < _ncombinations; combination++) {
-    bool contains_all = true;
-    size_t tag_idx;
-    for (tag_idx = 0; tag_idx < LogTag::MaxTags && _tags[combination][tag_idx] != LogTag::__NO_TAG; tag_idx++) {
-      if (!ts.contains(_tags[combination][tag_idx])) {
-        contains_all = false;
-        break;
-      }
-    }
-    // All tags in the expression must be part of the tagset,
-    // and either the expression allows other tags (has a wildcard),
-    // or the number of tags in the expression and tagset must match.
-    if (contains_all && (_allow_other_tags[combination] || tag_idx == ts.ntags())) {
+    if (matches_tagset(_tags[combination], _allow_other_tags[combination], ts)) {
       level = _level[combination];
     }
   }
   return level;
 }
+
--- a/src/share/vm/logging/logTagLevelExpression.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logTagLevelExpression.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -59,9 +59,15 @@
     _ntags = 0;
   }
 
-  void add_tag(LogTagType tag) {
+  bool add_tag(LogTagType tag) {
     assert(_ntags < LogTag::MaxTags, "Can't have more tags than MaxTags!");
+    for (size_t i = 0; i < _ntags; i++) {
+      if (_tags[_ncombinations][i] == tag) {
+        return false;
+      }
+    }
     _tags[_ncombinations][_ntags++] = tag;
+    return true;
   }
 
   void set_level(LogLevelType level) {
@@ -83,6 +89,11 @@
 
   bool parse(const char* str, outputStream* errstream = NULL);
   LogLevelType level_for(const LogTagSet& ts) const;
+
+  // Verify the tagsets/selections mentioned in this expression.
+  // Returns false if some invalid tagset was found. If given an outputstream,
+  // this function will list all the invalid selections on the stream.
+  bool verify_tagsets(outputStream* out = NULL) const;
 };
 
 #endif // SHARE_VM_LOGGING_LOGTAGLEVELEXPRESSION_HPP
--- a/src/share/vm/logging/logTagSet.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/logging/logTagSet.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -86,7 +86,7 @@
   }
 
   bool contains(LogTagType tag) const {
-    for (size_t i = 0; _tag[i] != LogTag::__NO_TAG; i++) {
+    for (size_t i = 0; i < LogTag::MaxTags && _tag[i] != LogTag::__NO_TAG; i++) {
       if (tag == _tag[i]) {
         return true;
       }
--- a/src/share/vm/memory/universe.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/memory/universe.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -135,6 +135,7 @@
 oop Universe::_virtual_machine_error_instance         = NULL;
 oop Universe::_vm_exception                           = NULL;
 oop Universe::_allocation_context_notification_obj    = NULL;
+oop Universe::_reference_pending_list                 = NULL;
 
 Array<int>* Universe::_the_empty_int_array            = NULL;
 Array<u2>* Universe::_the_empty_short_array           = NULL;
@@ -212,6 +213,7 @@
   f->do_oop((oop*)&_system_thread_group);
   f->do_oop((oop*)&_vm_exception);
   f->do_oop((oop*)&_allocation_context_notification_obj);
+  f->do_oop((oop*)&_reference_pending_list);
   debug_only(f->do_oop((oop*)&_fullgc_alot_dummy_array);)
 }
 
@@ -488,6 +490,35 @@
   java_lang_Class::set_fixup_mirror_list(NULL);
 }
 
+#define assert_pll_locked(test) \
+  assert(Heap_lock->test(), "Reference pending list access requires lock")
+
+#define assert_pll_ownership() assert_pll_locked(owned_by_self)
+
+oop Universe::reference_pending_list() {
+  assert_pll_ownership();
+  return _reference_pending_list;
+}
+
+void Universe::set_reference_pending_list(oop list) {
+  assert_pll_ownership();
+  _reference_pending_list = list;
+}
+
+bool Universe::has_reference_pending_list() {
+  assert_pll_ownership();
+  return _reference_pending_list != NULL;
+}
+
+oop Universe::swap_reference_pending_list(oop list) {
+  assert_pll_locked(is_locked);
+  return (oop)Atomic::xchg_ptr(list, &_reference_pending_list);
+}
+
+#undef assert_pll_locked
+#undef assert_pll_ownership
+
+
 static bool has_run_finalizers_on_exit = false;
 
 void Universe::run_finalizers_on_exit() {
@@ -565,12 +596,14 @@
 
 oop Universe::gen_out_of_memory_error(oop default_err) {
   // generate an out of memory error:
-  // - if there is a preallocated error with backtrace available then return it wth
-  //   a filled in stack trace.
-  // - if there are no preallocated errors with backtrace available then return
-  //   an error without backtrace.
+  // - if there is a preallocated error and stack traces are available
+  //   (j.l.Throwable is initialized), then return the preallocated
+  //   error with a filled in stack trace, and with the message
+  //   provided by the default error.
+  // - otherwise, return the default error, without a stack trace.
   int next;
-  if (_preallocated_out_of_memory_error_avail_count > 0) {
+  if ((_preallocated_out_of_memory_error_avail_count > 0) &&
+      SystemDictionary::Throwable_klass()->is_initialized()) {
     next = (int)Atomic::add(-1, &_preallocated_out_of_memory_error_avail_count);
     assert(next < (int)PreallocatedOutOfMemoryErrorCount, "avail count is corrupt");
   } else {
@@ -1129,8 +1162,6 @@
       verify_flags |= Verify_MetaspaceAux;
     } else if (strcmp(token, "jni_handles") == 0) {
       verify_flags |= Verify_JNIHandles;
-    } else if (strcmp(token, "c-heap") == 0) {
-      verify_flags |= Verify_CHeap;
     } else if (strcmp(token, "codecache_oops") == 0) {
       verify_flags |= Verify_CodeCacheOops;
     } else {
@@ -1208,10 +1239,6 @@
     log_debug(gc, verify)("JNIHandles");
     JNIHandles::verify();
   }
-  if (should_verify_subset(Verify_CHeap)) {
-    log_debug(gc, verify)("C-heap");
-    os::check_heap();
-  }
   if (should_verify_subset(Verify_CodeCacheOops)) {
     log_debug(gc, verify)("CodeCache Oops");
     CodeCache::verify_oops();
--- a/src/share/vm/memory/universe.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/memory/universe.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -185,6 +185,9 @@
 
   static oop          _allocation_context_notification_obj;
 
+  // References waiting to be transferred to the ReferenceHandler
+  static oop          _reference_pending_list;
+
   // The particular choice of collected heap.
   static CollectedHeap* _collectedHeap;
 
@@ -334,6 +337,17 @@
   static inline oop   allocation_context_notification_obj();
   static inline void  set_allocation_context_notification_obj(oop obj);
 
+  // Reference pending list manipulation.  Access is protected by
+  // Heap_lock.  The getter, setter and predicate require the caller
+  // owns the lock.  Swap is used by parallel non-concurrent reference
+  // processing threads, where some higher level controller owns
+  // Heap_lock, so requires the lock is locked, but not necessarily by
+  // the current thread.
+  static oop          reference_pending_list();
+  static void         set_reference_pending_list(oop list);
+  static bool         has_reference_pending_list();
+  static oop          swap_reference_pending_list(oop list);
+
   static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
   static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
   static Array<Method*>* the_empty_method_array() { return _the_empty_method_array; }
@@ -480,8 +494,7 @@
     Verify_ClassLoaderDataGraph = 64,
     Verify_MetaspaceAux = 128,
     Verify_JNIHandles = 256,
-    Verify_CHeap = 512,
-    Verify_CodeCacheOops = 1024,
+    Verify_CodeCacheOops = 512,
     Verify_All = -1
   };
   static void initialize_verify_flags();
--- a/src/share/vm/oops/arrayKlass.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/arrayKlass.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -56,7 +56,9 @@
   void set_dimension(int dimension)     { _dimension = dimension; }
 
   Klass* higher_dimension() const     { return _higher_dimension; }
+  inline Klass* higher_dimension_acquire() const; // load with acquire semantics
   void set_higher_dimension(Klass* k) { _higher_dimension = k; }
+  inline void release_set_higher_dimension(Klass* k); // store with release semantics
   Klass** adr_higher_dimension()      { return (Klass**)&this->_higher_dimension;}
 
   Klass* lower_dimension() const      { return _lower_dimension; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/oops/arrayKlass.inline.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_OOPS_ARRAYKLASS_INLINE_HPP
+#define SHARE_VM_OOPS_ARRAYKLASS_INLINE_HPP
+
+#include "runtime/orderAccess.inline.hpp"
+#include "oops/arrayKlass.hpp"
+
+inline Klass* ArrayKlass::higher_dimension_acquire() const {
+  return (Klass*) OrderAccess::load_ptr_acquire(&_higher_dimension);
+}
+
+inline void ArrayKlass::release_set_higher_dimension(Klass* k) {
+  OrderAccess::release_store_ptr(&_higher_dimension, k);
+}
+
+#endif // SHARE_VM_OOPS_ARRAYKLASS_INLINE_HPP
--- a/src/share/vm/oops/instanceKlass.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/instanceKlass.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1041,7 +1041,8 @@
 }
 
 Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_k, bool or_null, int n, TRAPS) {
-  if (this_k->array_klasses() == NULL) {
+  // Need load-acquire for lock-free read
+  if (this_k->array_klasses_acquire() == NULL) {
     if (or_null) return NULL;
 
     ResourceMark rm;
@@ -1054,7 +1055,8 @@
       // Check if update has already taken place
       if (this_k->array_klasses() == NULL) {
         Klass*    k = ObjArrayKlass::allocate_objArray_klass(this_k->class_loader_data(), 1, this_k, CHECK_NULL);
-        this_k->set_array_klasses(k);
+        // use 'release' to pair with lock-free load
+        this_k->release_set_array_klasses(k);
       }
     }
   }
--- a/src/share/vm/oops/instanceKlass.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/instanceKlass.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -148,7 +148,7 @@
   // Package this class is defined in
   PackageEntry*   _package_entry;
   // Array classes holding elements of this class.
-  Klass*          _array_klasses;
+  Klass* volatile _array_klasses;
   // Constant pool for this class.
   ConstantPool* _constants;
   // The InnerClasses attribute and EnclosingMethod attribute. The
@@ -230,7 +230,7 @@
   OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
   MemberNameTable* _member_names;        // Member names
   JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
-  jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
+  jmethodID*      volatile _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
   intptr_t        _dep_context;          // packed DependencyContext structure
   nmethod*        _osr_nmethods_head;    // Head of list of on-stack replacement nmethods for this class
 #if INCLUDE_JVMTI
@@ -368,7 +368,9 @@
 
   // array klasses
   Klass* array_klasses() const             { return _array_klasses; }
+  inline Klass* array_klasses_acquire() const; // load with acquire semantics
   void set_array_klasses(Klass* k)         { _array_klasses = k; }
+  inline void release_set_array_klasses(Klass* k); // store with release semantics
 
   // methods
   Array<Method*>* methods() const          { return _methods; }
@@ -1238,10 +1240,8 @@
   // cache management logic if the caches can grow instead of just
   // going from NULL to non-NULL.
   bool idnum_can_increment() const      { return has_been_redefined(); }
-  jmethodID* methods_jmethod_ids_acquire() const
-         { return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids); }
-  void release_set_methods_jmethod_ids(jmethodID* jmeths)
-         { OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths); }
+  inline jmethodID* methods_jmethod_ids_acquire() const;
+  inline void release_set_methods_jmethod_ids(jmethodID* jmeths);
 
   // Lock during initialization
 public:
--- a/src/share/vm/oops/instanceKlass.inline.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/instanceKlass.inline.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -29,10 +29,27 @@
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
 
+inline Klass* InstanceKlass::array_klasses_acquire() const {
+  return (Klass*) OrderAccess::load_ptr_acquire(&_array_klasses);
+}
+
+inline void InstanceKlass::release_set_array_klasses(Klass* k) {
+  OrderAccess::release_store_ptr(&_array_klasses, k);
+}
+
+inline jmethodID* InstanceKlass::methods_jmethod_ids_acquire() const {
+  return (jmethodID*)OrderAccess::load_ptr_acquire(&_methods_jmethod_ids);
+}
+
+inline void InstanceKlass::release_set_methods_jmethod_ids(jmethodID* jmeths) {
+  OrderAccess::release_store_ptr(&_methods_jmethod_ids, jmeths);
+}
+
 // The iteration over the oops in objects is a hot path in the GC code.
 // By force inlining the following functions, we get similar GC performance
 // as the previous macro based implementation.
--- a/src/share/vm/oops/method.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/method.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -30,7 +30,6 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "gc/shared/gcLocker.hpp"
 #include "gc/shared/generation.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "interpreter/bytecodeStream.hpp"
 #include "interpreter/bytecodeTracer.hpp"
 #include "interpreter/bytecodes.hpp"
@@ -400,12 +399,6 @@
     return;
   }
 
-  // Do not profile method if current thread holds the pending list lock,
-  // which avoids deadlock for acquiring the MethodData_lock.
-  if (ReferencePendingListLocker::is_locked_by_self()) {
-    return;
-  }
-
   // Grab a lock here to prevent multiple
   // MethodData*s from being created.
   MutexLocker ml(MethodData_lock, THREAD);
--- a/src/share/vm/oops/methodData.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/methodData.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -30,6 +30,9 @@
 #include "oops/method.hpp"
 #include "oops/oop.hpp"
 #include "runtime/orderAccess.hpp"
+#if INCLUDE_JVMCI
+#include "jvmci/jvmci_globals.hpp"
+#endif
 
 class BytecodeStream;
 class KlassSizeStats;
--- a/src/share/vm/oops/objArrayKlass.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/objArrayKlass.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -34,6 +34,7 @@
 #include "memory/metadataFactory.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.inline.hpp"
+#include "oops/arrayKlass.inline.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/objArrayKlass.inline.hpp"
@@ -42,7 +43,6 @@
 #include "oops/symbol.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/macros.hpp"
 
@@ -321,7 +321,8 @@
   int dim = dimension();
   if (dim == n) return this;
 
-  if (higher_dimension() == NULL) {
+  // lock-free read needs acquire semantics
+  if (higher_dimension_acquire() == NULL) {
     if (or_null)  return NULL;
 
     ResourceMark rm;
@@ -339,8 +340,8 @@
           ObjArrayKlass::allocate_objArray_klass(class_loader_data(), dim + 1, this, CHECK_NULL);
         ObjArrayKlass* ak = ObjArrayKlass::cast(k);
         ak->set_lower_dimension(this);
-        OrderAccess::storestore();
-        set_higher_dimension(ak);
+        // use 'release' to pair with lock-free load
+        release_set_higher_dimension(ak);
         assert(ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
       }
     }
--- a/src/share/vm/oops/symbol.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/symbol.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -229,24 +229,25 @@
 }
 
 void Symbol::increment_refcount() {
-  // Only increment the refcount if positive.  If negative either
+  // Only increment the refcount if non-negative.  If negative either
   // overflow has occurred or it is a permanent symbol in a read only
   // shared archive.
-  if (_refcount >= 0) {
+  if (_refcount >= 0) { // not a permanent symbol
     Atomic::inc(&_refcount);
     NOT_PRODUCT(Atomic::inc(&_total_count);)
   }
 }
 
 void Symbol::decrement_refcount() {
-  if (_refcount >= 0) {
-    Atomic::dec(&_refcount);
+  if (_refcount >= 0) { // not a permanent symbol
+    jshort new_value = Atomic::add(-1, &_refcount);
 #ifdef ASSERT
-    if (_refcount < 0) {
+    if (new_value == -1) { // we have transitioned from 0 -> -1
       print();
       assert(false, "reference count underflow for symbol");
     }
 #endif
+    (void)new_value;
   }
 }
 
--- a/src/share/vm/oops/typeArrayKlass.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/oops/typeArrayKlass.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -34,6 +34,7 @@
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
 #include "memory/universe.inline.hpp"
+#include "oops/arrayKlass.inline.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/objArrayKlass.hpp"
@@ -41,7 +42,6 @@
 #include "oops/typeArrayKlass.inline.hpp"
 #include "oops/typeArrayOop.inline.hpp"
 #include "runtime/handles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
 #include "utilities/macros.hpp"
 
 bool TypeArrayKlass::compute_is_subtype_of(Klass* k) {
@@ -166,7 +166,8 @@
     if (dim == n)
       return this;
 
-  if (higher_dimension() == NULL) {
+  // lock-free read needs acquire semantics
+  if (higher_dimension_acquire() == NULL) {
     if (or_null)  return NULL;
 
     ResourceMark rm;
@@ -181,8 +182,8 @@
               class_loader_data(), dim + 1, this, CHECK_NULL);
         ObjArrayKlass* h_ak = ObjArrayKlass::cast(oak);
         h_ak->set_lower_dimension(this);
-        OrderAccess::storestore();
-        set_higher_dimension(h_ak);
+        // use 'release' to pair with lock-free load
+        release_set_higher_dimension(h_ak);
         assert(h_ak->is_objArray_klass(), "incorrect initialization of ObjArrayKlass");
       }
     }
--- a/src/share/vm/opto/block.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/block.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1212,6 +1212,9 @@
       if (j >= 1 && n->is_Mach() && n->as_Mach()->ideal_Opcode() == Op_CreateEx) {
         assert(j == 1 || block->get_node(j-1)->is_Phi(), "CreateEx must be first instruction in block");
       }
+      if (n->needs_anti_dependence_check()) {
+        verify_anti_dependences(block, n);
+      }
       for (uint k = 0; k < n->req(); k++) {
         Node *def = n->in(k);
         if (def && def != n) {
--- a/src/share/vm/opto/block.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/block.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -186,14 +186,13 @@
   Block* lone_fall_through();   // Return lone fall-through Block or null
 
   Block* dom_lca(Block* that);  // Compute LCA in dominator tree.
-#ifdef ASSERT
+
   bool dominates(Block* that) {
     int dom_diff = this->_dom_depth - that->_dom_depth;
     if (dom_diff > 0)  return false;
     for (; dom_diff < 0; dom_diff++)  that = that->_idom;
     return this == that;
   }
-#endif
 
   // Report the alignment required by this block.  Must be a power of 2.
   // The previous block will insert nops to get this alignment.
@@ -481,9 +480,9 @@
   MachNode* _goto;
 
   Block* insert_anti_dependences(Block* LCA, Node* load, bool verify = false);
-  void verify_anti_dependences(Block* LCA, Node* load) {
+  void verify_anti_dependences(Block* LCA, Node* load) const {
     assert(LCA == get_block_for_node(load), "should already be scheduled");
-    insert_anti_dependences(LCA, load, true);
+    const_cast<PhaseCFG*>(this)->insert_anti_dependences(LCA, load, true);
   }
 
   bool move_to_next(Block* bx, uint b_index);
--- a/src/share/vm/opto/bytecodeInfo.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/bytecodeInfo.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -508,7 +508,7 @@
 #if INCLUDE_TRACE
   EventCompilerInlining event;
   if (event.should_commit()) {
-    event.set_compileID(C->compile_id());
+    event.set_compileId(C->compile_id());
     event.set_message(inline_msg);
     event.set_succeeded(success);
     event.set_bci(caller_bci);
--- a/src/share/vm/opto/c2compiler.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/c2compiler.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -530,6 +530,7 @@
   case vmIntrinsics::_isInterrupted:
 #ifdef TRACE_HAVE_INTRINSICS
   case vmIntrinsics::_counterTime:
+  case vmIntrinsics::_getClassId:
 #endif
   case vmIntrinsics::_currentTimeMillis:
   case vmIntrinsics::_nanoTime:
--- a/src/share/vm/opto/callGenerator.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/callGenerator.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1164,7 +1164,10 @@
   GraphKit kit(jvms);
   kit.C->print_inlining_update(this);
   // Take the trap with arguments pushed on the stack.  (Cf. null_check_receiver).
-  int nargs = method()->arg_size();
+  // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
+  // Use callsite signature always.
+  ciMethod* declared_method = kit.method()->get_method_at_bci(kit.bci());
+  int nargs = declared_method->arg_size();
   kit.inc_sp(nargs);
   assert(nargs <= kit.sp() && kit.sp() <= jvms->stk_size(), "sane sp w/ args pushed");
   if (_reason == Deoptimization::Reason_class_check &&
--- a/src/share/vm/opto/cfgnode.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/cfgnode.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -119,6 +119,9 @@
 // input in slot 0.
 class PhiNode : public TypeNode {
   const TypePtr* const _adr_type; // non-null only for Type::MEMORY nodes.
+  // The following fields are only used for data PhiNodes to indicate
+  // that the PhiNode represents the value of a known instance field.
+        int _inst_mem_id; // Instance memory id (node index of the memory Phi)
   const int _inst_id;     // Instance id of the memory slice.
   const int _inst_index;  // Alias index of the instance memory slice.
   // Array elements references have the same alias_idx but different offset.
@@ -138,11 +141,13 @@
   };
 
   PhiNode( Node *r, const Type *t, const TypePtr* at = NULL,
+           const int imid = -1,
            const int iid = TypeOopPtr::InstanceTop,
            const int iidx = Compile::AliasIdxTop,
            const int ioffs = Type::OffsetTop )
     : TypeNode(t,r->req()),
       _adr_type(at),
+      _inst_mem_id(imid),
       _inst_id(iid),
       _inst_index(iidx),
       _inst_offset(ioffs)
@@ -194,11 +199,14 @@
   virtual bool pinned() const { return in(0) != 0; }
   virtual const TypePtr *adr_type() const { verify_adr_type(true); return _adr_type; }
 
+  void  set_inst_mem_id(int inst_mem_id) { _inst_mem_id = inst_mem_id; }
+  const int inst_mem_id() const { return _inst_mem_id; }
   const int inst_id()     const { return _inst_id; }
   const int inst_index()  const { return _inst_index; }
   const int inst_offset() const { return _inst_offset; }
-  bool is_same_inst_field(const Type* tp, int id, int index, int offset) {
+  bool is_same_inst_field(const Type* tp, int mem_id, int id, int index, int offset) {
     return type()->basic_type() == tp->basic_type() &&
+           inst_mem_id() == mem_id &&
            inst_id()     == id     &&
            inst_index()  == index  &&
            inst_offset() == offset &&
--- a/src/share/vm/opto/compile.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/compile.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1708,16 +1708,21 @@
   const TypePtr* flat = flatten_alias_type(adr_type);
 
 #ifdef ASSERT
-  assert(flat == flatten_alias_type(flat), "idempotent");
-  assert(flat != TypePtr::BOTTOM,     "cannot alias-analyze an untyped ptr");
-  if (flat->isa_oopptr() && !flat->isa_klassptr()) {
-    const TypeOopPtr* foop = flat->is_oopptr();
-    // Scalarizable allocations have exact klass always.
-    bool exact = !foop->klass_is_exact() || foop->is_known_instance();
-    const TypePtr* xoop = foop->cast_to_exactness(exact)->is_ptr();
-    assert(foop == flatten_alias_type(xoop), "exactness must not affect alias type");
+  {
+    ResourceMark rm;
+    assert(flat == flatten_alias_type(flat), "not idempotent: adr_type = %s; flat = %s => %s",
+           Type::str(adr_type), Type::str(flat), Type::str(flatten_alias_type(flat)));
+    assert(flat != TypePtr::BOTTOM, "cannot alias-analyze an untyped ptr: adr_type = %s",
+           Type::str(adr_type));
+    if (flat->isa_oopptr() && !flat->isa_klassptr()) {
+      const TypeOopPtr* foop = flat->is_oopptr();
+      // Scalarizable allocations have exact klass always.
+      bool exact = !foop->klass_is_exact() || foop->is_known_instance();
+      const TypePtr* xoop = foop->cast_to_exactness(exact)->is_ptr();
+      assert(foop == flatten_alias_type(xoop), "exactness must not affect alias type: foop = %s; xoop = %s",
+             Type::str(foop), Type::str(xoop));
+    }
   }
-  assert(flat == flatten_alias_type(flat), "exact bit doesn't matter");
 #endif
 
   int idx = AliasIdxTop;
@@ -3159,45 +3164,65 @@
     break;
 #endif
 
-  case Op_ModI:
+  case Op_ModI: {
+    Node* di = NULL;
     if (UseDivMod) {
       // Check if a%b and a/b both exist
-      Node* d = n->find_similar(Op_DivI);
-      if (d) {
+      di = n->find_similar(Op_DivI);
+      if (di) {
         // Replace them with a fused divmod if supported
         if (Matcher::has_match_rule(Op_DivModI)) {
           DivModINode* divmod = DivModINode::make(n);
-          d->subsume_by(divmod->div_proj(), this);
+          di->subsume_by(divmod->div_proj(), this);
           n->subsume_by(divmod->mod_proj(), this);
         } else {
           // replace a%b with a-((a/b)*b)
-          Node* mult = new MulINode(d, d->in(2));
-          Node* sub  = new SubINode(d->in(1), mult);
+          Node* mult = new MulINode(di, di->in(2));
+          Node* sub  = new SubINode(di->in(1), mult);
           n->subsume_by(sub, this);
         }
       }
     }
+    if (di == NULL) {
+      // Remove useless control edge in case of not mod-zero.
+      const Type *t = n->in(2)->bottom_type();
+      const TypeInt *ti = t->is_int();
+      if (n->in(0) && (ti->_hi < 0 || ti->_lo > 0)) {
+        n->set_req(0, NULL);
+      }
+    }
     break;
-
-  case Op_ModL:
+  }
+
+  case Op_ModL: {
+    Node* dl = NULL;
     if (UseDivMod) {
       // Check if a%b and a/b both exist
-      Node* d = n->find_similar(Op_DivL);
-      if (d) {
+      dl = n->find_similar(Op_DivL);
+      if (dl) {
         // Replace them with a fused divmod if supported
         if (Matcher::has_match_rule(Op_DivModL)) {
           DivModLNode* divmod = DivModLNode::make(n);
-          d->subsume_by(divmod->div_proj(), this);
+          dl->subsume_by(divmod->div_proj(), this);
           n->subsume_by(divmod->mod_proj(), this);
         } else {
           // replace a%b with a-((a/b)*b)
-          Node* mult = new MulLNode(d, d->in(2));
-          Node* sub  = new SubLNode(d->in(1), mult);
+          Node* mult = new MulLNode(dl, dl->in(2));
+          Node* sub  = new SubLNode(dl->in(1), mult);
           n->subsume_by(sub, this);
         }
       }
     }
+    if (dl == NULL) {
+      // Remove useless control edge in case of not mod-zero.
+      const Type *t = n->in(2)->bottom_type();
+      const TypeLong *tl = t->is_long();
+      if (n->in(0) && (tl->_hi < 0 || tl->_lo > 0)) {
+        n->set_req(0, NULL);
+      }
+    }
     break;
+  }
 
   case Op_LoadVector:
   case Op_StoreVector:
--- a/src/share/vm/opto/compile.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/compile.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -729,7 +729,7 @@
     if (event.should_commit()) {
       event.set_starttime(C->_latest_stage_start_counter);
       event.set_phase((u1) cpt);
-      event.set_compileID(C->_compile_id);
+      event.set_compileId(C->_compile_id);
       event.set_phaseLevel(level);
       event.commit();
     }
@@ -748,7 +748,7 @@
     if (event.should_commit()) {
       event.set_starttime(C->_latest_stage_start_counter);
       event.set_phase((u1) PHASE_END);
-      event.set_compileID(C->_compile_id);
+      event.set_compileId(C->_compile_id);
       event.set_phaseLevel(level);
       event.commit();
     }
--- a/src/share/vm/opto/divnode.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/divnode.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -853,13 +853,6 @@
   if( t == Type::TOP ) return NULL;
   const TypeInt *ti = t->is_int();
 
-  // Check for useless control input
-  // Check for excluding mod-zero case
-  if( in(0) && (ti->_hi < 0 || ti->_lo > 0) ) {
-    set_req(0, NULL);        // Yank control input
-    return this;
-  }
-
   // See if we are MOD'ing by 2^k or 2^k-1.
   if( !ti->is_con() ) return NULL;
   jint con = ti->get_con();
@@ -1024,13 +1017,6 @@
   if( t == Type::TOP ) return NULL;
   const TypeLong *tl = t->is_long();
 
-  // Check for useless control input
-  // Check for excluding mod-zero case
-  if( in(0) && (tl->_hi < 0 || tl->_lo > 0) ) {
-    set_req(0, NULL);        // Yank control input
-    return this;
-  }
-
   // See if we are MOD'ing by 2^k or 2^k-1.
   if( !tl->is_con() ) return NULL;
   jlong con = tl->get_con();
--- a/src/share/vm/opto/graphKit.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/graphKit.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -664,7 +664,10 @@
   // callee (with all arguments still on the stack).
   Node* null_check_receiver_before_call(ciMethod* callee) {
     assert(!callee->is_static(), "must be a virtual method");
-    const int nargs = callee->arg_size();
+    // Callsite signature can be different from actual method being called (i.e _linkTo* sites).
+    // Use callsite signature always.
+    ciMethod* declared_method = method()->get_method_at_bci(bci());
+    const int nargs = declared_method->arg_size();
     inc_sp(nargs);
     Node* n = null_check_receiver();
     dec_sp(nargs);
--- a/src/share/vm/opto/lcm.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/lcm.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -240,6 +240,14 @@
       continue;
     }
 
+    // Check that node's control edge is not-null block's head or dominates it,
+    // otherwise we can't hoist it because there are other control dependencies.
+    Node* ctrl = mach->in(0);
+    if (ctrl != NULL && !(ctrl == not_null_block->head() ||
+        get_block_for_node(ctrl)->dominates(not_null_block))) {
+      continue;
+    }
+
     // check if the offset is not too high for implicit exception
     {
       intptr_t offset = 0;
@@ -379,9 +387,12 @@
   block->add_inst(best);
   map_node_to_block(best, block);
 
-  // Move the control dependence
-  if (best->in(0) && best->in(0) == old_block->head())
-    best->set_req(0, block->head());
+  // Move the control dependence if it is pinned to not-null block.
+  // Don't change it in other cases: NULL or dominating control.
+  if (best->in(0) == not_null_block->head()) {
+    // Set it to control edge of null check.
+    best->set_req(0, proj->in(0)->in(0));
+  }
 
   // Check for flag-killing projections that also need to be hoisted
   // Should be DU safe because no edge updates.
@@ -437,6 +448,18 @@
 
   latency_from_uses(nul_chk);
   latency_from_uses(best);
+
+  // insert anti-dependences to defs in this block
+  if (! best->needs_anti_dependence_check()) {
+    for (uint k = 1; k < block->number_of_nodes(); k++) {
+      Node *n = block->get_node(k);
+      if (n->needs_anti_dependence_check() &&
+          n->in(LoadNode::Memory) == best->in(StoreNode::Memory)) {
+        // Found anti-dependent load
+        insert_anti_dependences(block, n);
+      }
+    }
+  }
 }
 
 
--- a/src/share/vm/opto/library_call.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/library_call.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -254,6 +254,9 @@
   bool inline_native_currentThread();
 
   bool inline_native_time_funcs(address method, const char* funcName);
+#ifdef TRACE_HAVE_INTRINSICS
+  bool inline_native_classID();
+#endif
   bool inline_native_isInterrupted();
   bool inline_native_Class_query(vmIntrinsics::ID id);
   bool inline_native_subtype_check();
@@ -708,6 +711,7 @@
 
 #ifdef TRACE_HAVE_INTRINSICS
   case vmIntrinsics::_counterTime:              return inline_native_time_funcs(CAST_FROM_FN_PTR(address, TRACE_TIME_METHOD), "counterTime");
+  case vmIntrinsics::_getClassId:               return inline_native_classID();
 #endif
   case vmIntrinsics::_currentTimeMillis:        return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeMillis), "currentTimeMillis");
   case vmIntrinsics::_nanoTime:                 return inline_native_time_funcs(CAST_FROM_FN_PTR(address, os::javaTimeNanos), "nanoTime");
@@ -2242,8 +2246,8 @@
 
 #ifndef PRODUCT
     if (C->print_intrinsics() || C->print_inlining()) {
-      tty->print("  from base type: ");  adr_type->dump();
-      tty->print("  sharpened value: ");  tjp->dump();
+      tty->print("  from base type:  ");  adr_type->dump(); tty->cr();
+      tty->print("  sharpened value: ");  tjp->dump();      tty->cr();
     }
 #endif
     // Sharpen the value type.
@@ -2308,26 +2312,30 @@
   adr = make_unsafe_address(base, offset);
   if (_gvn.type(base)->isa_ptr() != TypePtr::NULL_PTR) {
     heap_base_oop = base;
-  }
+  } else if (type == T_OBJECT) {
+    return false; // off-heap oop accesses are not supported
+  }
+
+  // Can base be NULL? Otherwise, always on-heap access.
+  bool can_access_non_heap = TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop));
+
   val = is_store ? argument(4) : NULL;
 
   const TypePtr *adr_type = _gvn.type(adr)->isa_ptr();
 
-  // Try to categorize the address.  If it comes up as TypeJavaPtr::BOTTOM,
-  // there was not enough information to nail it down.
+  // Try to categorize the address.
   Compile::AliasType* alias_type = C->alias_type(adr_type);
   assert(alias_type->index() != Compile::AliasIdxBot, "no bare pointers here");
 
-  // Only field, array element or unknown locations are supported.
-  if (alias_type->adr_type() != TypeRawPtr::BOTTOM &&
-      alias_type->adr_type() != TypeOopPtr::BOTTOM &&
-      alias_type->basic_type() == T_ILLEGAL) {
-    return false;
+  if (alias_type->adr_type() == TypeInstPtr::KLASS ||
+      alias_type->adr_type() == TypeAryPtr::RANGE) {
+    return false; // not supported
   }
 
   bool mismatched = false;
   BasicType bt = alias_type->basic_type();
   if (bt != T_ILLEGAL) {
+    assert(alias_type->adr_type()->is_oopptr(), "should be on-heap access");
     if (bt == T_BYTE && adr_type->isa_aryptr()) {
       // Alias type doesn't differentiate between byte[] and boolean[]).
       // Use address type to get the element type.
@@ -2342,10 +2350,12 @@
       return false;
     }
     mismatched = (bt != type);
-  } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) {
+  } else if (alias_type->adr_type()->isa_oopptr()) {
     mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched
   }
 
+  assert(!mismatched || alias_type->adr_type()->is_oopptr(), "off-heap access can't be mismatched");
+
   // First guess at the value type.
   const Type *value_type = Type::get_const_basic_type(type);
 
@@ -2357,7 +2367,7 @@
   bool need_mem_bar;
   switch (kind) {
       case Relaxed:
-          need_mem_bar = (alias_type->adr_type() == TypeOopPtr::BOTTOM);
+          need_mem_bar = mismatched || can_access_non_heap;
           break;
       case Opaque:
           // Opaque uses CPUOrder membars for protection against code movement.
@@ -2508,34 +2518,10 @@
       break;
     }
 
-    if (type != T_OBJECT) {
-      (void) store_to_memory(control(), adr, val, type, adr_type, mo, requires_atomic_access, unaligned, mismatched);
+    if (type == T_OBJECT) {
+      store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
     } else {
-      // Possibly an oop being stored to Java heap or native memory
-      if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
-        // oop to Java heap.
-        (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
-      } else {
-        // We can't tell at compile time if we are storing in the Java heap or outside
-        // of it. So we need to emit code to conditionally do the proper type of
-        // store.
-
-        IdealKit ideal(this);
-#define __ ideal.
-        // QQQ who knows what probability is here??
-        __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
-          // Sync IdealKit and graphKit.
-          sync_kit(ideal);
-          Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type, mo, mismatched);
-          // Update IdealKit memory.
-          __ sync_kit(this);
-        } __ else_(); {
-          __ store(__ ctrl(), adr, val, type, alias_type->index(), mo, requires_atomic_access, mismatched);
-        } __ end_if();
-        // Final sync IdealKit and GraphKit.
-        final_sync(ideal);
-#undef __
-      }
+      store_to_memory(control(), adr, val, type, adr_type, mo, requires_atomic_access, unaligned, mismatched);
     }
   }
 
@@ -3150,6 +3136,43 @@
   return true;
 }
 
+#ifdef TRACE_HAVE_INTRINSICS
+
+/*
+* oop -> myklass
+* myklass->trace_id |= USED
+* return myklass->trace_id & ~0x3
+*/
+bool LibraryCallKit::inline_native_classID() {
+  Node* cls = null_check(argument(0), T_OBJECT);
+  Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
+  kls = null_check(kls, T_OBJECT);
+
+  ByteSize offset = TRACE_KLASS_TRACE_ID_OFFSET;
+  Node* insp = basic_plus_adr(kls, in_bytes(offset));
+  Node* tvalue = make_load(NULL, insp, TypeLong::LONG, T_LONG, MemNode::unordered);
+
+  Node* clsused = longcon(0x01l); // set the class bit
+  Node* orl = _gvn.transform(new OrLNode(tvalue, clsused));
+  const TypePtr *adr_type = _gvn.type(insp)->isa_ptr();
+  store_to_memory(control(), insp, orl, T_LONG, adr_type, MemNode::unordered);
+
+#ifdef TRACE_ID_META_BITS
+  Node* mbits = longcon(~TRACE_ID_META_BITS);
+  tvalue = _gvn.transform(new AndLNode(tvalue, mbits));
+#endif
+#ifdef TRACE_ID_CLASS_SHIFT
+  Node* cbits = intcon(TRACE_ID_CLASS_SHIFT);
+  tvalue = _gvn.transform(new URShiftLNode(tvalue, cbits));
+#endif
+
+  set_result(tvalue);
+  return true;
+
+}
+
+#endif
+
 //------------------------inline_native_currentThread------------------
 bool LibraryCallKit::inline_native_currentThread() {
   Node* junk = NULL;
--- a/src/share/vm/opto/macro.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/macro.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -491,7 +491,7 @@
   for (DUIterator_Fast kmax, k = region->fast_outs(kmax); k < kmax; k++) {
     Node* phi = region->fast_out(k);
     if (phi->is_Phi() && phi != mem &&
-        phi->as_Phi()->is_same_inst_field(phi_type, instance_id, alias_idx, offset)) {
+        phi->as_Phi()->is_same_inst_field(phi_type, (int)mem->_idx, instance_id, alias_idx, offset)) {
       return phi;
     }
   }
@@ -510,7 +510,7 @@
   GrowableArray <Node *> values(length, length, NULL, false);
 
   // create a new Phi for the value
-  PhiNode *phi = new PhiNode(mem->in(0), phi_type, NULL, instance_id, alias_idx, offset);
+  PhiNode *phi = new PhiNode(mem->in(0), phi_type, NULL, mem->_idx, instance_id, alias_idx, offset);
   transform_later(phi);
   value_phis->push(phi, mem->_idx);
 
--- a/src/share/vm/opto/memnode.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/memnode.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1112,7 +1112,7 @@
     for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
       Node* phi = region->fast_out(i);
       if (phi->is_Phi() && phi != mem &&
-          phi->as_Phi()->is_same_inst_field(this_type, this_iid, this_index, this_offset)) {
+          phi->as_Phi()->is_same_inst_field(this_type, (int)mem->_idx, this_iid, this_index, this_offset)) {
         return phi;
       }
     }
@@ -1395,7 +1395,7 @@
     this_iid = base->_idx;
   }
   PhaseIterGVN* igvn = phase->is_IterGVN();
-  Node* phi = new PhiNode(region, this_type, NULL, this_iid, this_index, this_offset);
+  Node* phi = new PhiNode(region, this_type, NULL, mem->_idx, this_iid, this_index, this_offset);
   for (uint i = 1; i < region->req(); i++) {
     Node* x;
     Node* the_clone = NULL;
--- a/src/share/vm/opto/phaseX.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/phaseX.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -491,6 +491,8 @@
   uint current_idx = 0; // The current new node ID. Incremented after every assignment.
   for (uint i = 0; i < _useful.size(); i++) {
     Node* n = _useful.at(i);
+    // Sanity check that fails if we ever decide to execute this phase after EA
+    assert(!n->is_Phi() || n->as_Phi()->inst_mem_id() == -1, "should not be linked to data Phi");
     const Type* type = gvn->type_or_null(n);
     new_type_array.map(current_idx, type);
 
@@ -1448,6 +1450,18 @@
     i -= num_edges;    // we deleted 1 or more copies of this edge
   }
 
+  // Search for instance field data PhiNodes in the same region pointing to the old
+  // memory PhiNode and update their instance memory ids to point to the new node.
+  if (old->is_Phi() && old->as_Phi()->type()->has_memory() && old->in(0) != NULL) {
+    Node* region = old->in(0);
+    for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
+      PhiNode* phi = region->fast_out(i)->isa_Phi();
+      if (phi != NULL && phi->inst_mem_id() == (int)old->_idx) {
+        phi->set_inst_mem_id((int)nn->_idx);
+      }
+    }
+  }
+
   // Smash all inputs to 'old', isolating him completely
   Node *temp = new Node(1);
   temp->init_req(0,nn);     // Add a use to nn to prevent him from dying
--- a/src/share/vm/opto/type.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/type.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1015,6 +1015,13 @@
     st->print(" [narrowklass]");
   }
 }
+
+//-----------------------------------------------------------------------------
+const char* Type::str(const Type* t) {
+  stringStream ss;
+  t->dump_on(&ss);
+  return ss.as_string();
+}
 #endif
 
 //------------------------------singleton--------------------------------------
--- a/src/share/vm/opto/type.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/opto/type.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -210,11 +210,11 @@
   static int cmp( const Type *const t1, const Type *const t2 );
   // Test for higher or equal in lattice
   // Variant that drops the speculative part of the types
-  int higher_equal(const Type *t) const {
+  bool higher_equal(const Type *t) const {
     return !cmp(meet(t),t->remove_speculative());
   }
   // Variant that keeps the speculative part of the types
-  int higher_equal_speculative(const Type *t) const {
+  bool higher_equal_speculative(const Type *t) const {
     return !cmp(meet_speculative(t),t);
   }
 
@@ -359,6 +359,8 @@
   }
   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
   static  void dump_stats();
+
+  static const char* str(const Type* t);
 #endif
   void typerr(const Type *t) const; // Mixing types error
 
@@ -963,7 +965,7 @@
 
   // If not InstanceTop or InstanceBot, indicates that this is
   // a particular instance of this type which is distinct.
-  // This is the the node index of the allocation node creating this instance.
+  // This is the node index of the allocation node creating this instance.
   int           _instance_id;
 
   static const TypeOopPtr* make_from_klass_common(ciKlass* klass, bool klass_change, bool try_for_exact);
--- a/src/share/vm/prims/jvm.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/prims/jvm.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3352,6 +3352,35 @@
 JVM_END
 
 
+// java.lang.ref.Reference ///////////////////////////////////////////////////////////////
+
+
+JVM_ENTRY(jobject, JVM_GetAndClearReferencePendingList(JNIEnv* env))
+  JVMWrapper("JVM_GetAndClearReferencePendingList");
+
+  MonitorLockerEx ml(Heap_lock);
+  oop ref = Universe::reference_pending_list();
+  if (ref != NULL) {
+    Universe::set_reference_pending_list(NULL);
+  }
+  return JNIHandles::make_local(env, ref);
+JVM_END
+
+JVM_ENTRY(jboolean, JVM_HasReferencePendingList(JNIEnv* env))
+  JVMWrapper("JVM_HasReferencePendingList");
+  MonitorLockerEx ml(Heap_lock);
+  return Universe::has_reference_pending_list();
+JVM_END
+
+JVM_ENTRY(void, JVM_WaitForReferencePendingList(JNIEnv* env))
+  JVMWrapper("JVM_WaitForReferencePendingList");
+  MonitorLockerEx ml(Heap_lock);
+  while (!Universe::has_reference_pending_list()) {
+    ml.wait();
+  }
+JVM_END
+
+
 // ObjectInputStream ///////////////////////////////////////////////////////////////
 
 bool force_verify_field_access(Klass* current_class, Klass* field_class, AccessFlags access, bool classloader_only) {
--- a/src/share/vm/prims/jvm.h	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/prims/jvm.h	Tue Sep 06 22:52:35 2016 +0200
@@ -297,6 +297,18 @@
 JVM_GetSystemPackages(JNIEnv *env);
 
 /*
+ * java.lang.ref.Reference
+ */
+JNIEXPORT jobject JNICALL
+JVM_GetAndClearReferencePendingList(JNIEnv *env);
+
+JNIEXPORT jboolean JNICALL
+JVM_HasReferencePendingList(JNIEnv *env);
+
+JNIEXPORT void JNICALL
+JVM_WaitForReferencePendingList(JNIEnv *env);
+
+/*
  * java.io.ObjectInputStream
  */
 JNIEXPORT jobject JNICALL
--- a/src/share/vm/prims/jvmtiTagMap.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/prims/jvmtiTagMap.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -3119,6 +3119,11 @@
             }
           }
 
+          // Follow oops from compiled nmethod
+          if (jvf->cb() != NULL && jvf->cb()->is_nmethod()) {
+            blk->set_context(thread_tag, tid, depth, method);
+            jvf->cb()->as_nmethod()->oops_do(blk);
+          }
         } else {
           blk->set_context(thread_tag, tid, depth, method);
           if (is_top_frame) {
--- a/src/share/vm/prims/unsafe.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/prims/unsafe.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -324,6 +324,10 @@
 
   volatile oop v;
 
+  if (support_IRIW_for_not_multiple_copy_atomic_cpu) {
+    OrderAccess::fence();
+  }
+
   if (UseCompressedOops) {
     volatile narrowOop n = *(volatile narrowOop*) addr;
     (void)const_cast<oop&>(v = oopDesc::decode_heap_oop(n));
@@ -1047,7 +1051,7 @@
 
   if (event.should_commit()) {
     oop obj = thread->current_park_blocker();
-    event.set_klass((obj != NULL) ? obj->klass() : NULL);
+    event.set_parkedClass((obj != NULL) ? obj->klass() : NULL);
     event.set_timeout(time);
     event.set_address((obj != NULL) ? (TYPE_ADDRESS) cast_from_oop<uintptr_t>(obj) : 0);
     event.commit();
--- a/src/share/vm/runtime/arguments.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/arguments.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -163,26 +163,47 @@
 
 bool needs_module_property_warning = false;
 
-#define MODULE_PROPERTY_PREFIX "jdk.module"
-#define MODULE_PROPERTY_PREFIX_LEN 10
-#define MODULE_MAIN_PROPERTY "jdk.module.main"
-#define MODULE_MAIN_PROPERTY_LEN 15
-
-// Return TRUE if option matches property, or property=, or property..
-static bool matches_property_prefix(const char* option, const char* property, size_t len) {
-  return (strncmp(option, property, len) == 0) &&
-          (option[len] == '=' || option[len] == '.' || option[len] == '\0');
+#define MODULE_PROPERTY_PREFIX "jdk.module."
+#define MODULE_PROPERTY_PREFIX_LEN 11
+#define ADDEXPORTS "addexports"
+#define ADDEXPORTS_LEN 10
+#define ADDREADS "addreads"
+#define ADDREADS_LEN 8
+#define PATCH "patch"
+#define PATCH_LEN 5
+#define ADDMODS "addmods"
+#define ADDMODS_LEN 7
+#define LIMITMODS "limitmods"
+#define LIMITMODS_LEN 9
+#define PATH "path"
+#define PATH_LEN 4
+#define UPGRADE_PATH "upgrade.path"
+#define UPGRADE_PATH_LEN 12
+
+// Return TRUE if option matches 'property', or 'property=', or 'property.'.
+static bool matches_property_suffix(const char* option, const char* property, size_t len) {
+  return ((strncmp(option, property, len) == 0) &&
+          (option[len] == '=' || option[len] == '.' || option[len] == '\0'));
 }
 
-// Return true if the property is either "jdk.module" or starts with "jdk.module.",
-// but does not start with "jdk.module.main".
-// Return false if jdk.module.main because jdk.module.main and jdk.module.main.class
-// are valid non-internal system properties.
-// "property" should be passed without the leading "-D".
+// Return true if property starts with "jdk.module." and its ensuing chars match
+// any of the reserved module properties.
+// property should be passed without the leading "-D".
 bool Arguments::is_internal_module_property(const char* property) {
   assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D");
-  return (matches_property_prefix(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) &&
-          !matches_property_prefix(property, MODULE_MAIN_PROPERTY, MODULE_MAIN_PROPERTY_LEN));
+  if  (strncmp(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) == 0) {
+    const char* property_suffix = property + MODULE_PROPERTY_PREFIX_LEN;
+    if (matches_property_suffix(property_suffix, ADDEXPORTS, ADDEXPORTS_LEN) ||
+        matches_property_suffix(property_suffix, ADDREADS, ADDREADS_LEN) ||
+        matches_property_suffix(property_suffix, PATCH, PATCH_LEN) ||
+        matches_property_suffix(property_suffix, ADDMODS, ADDMODS_LEN) ||
+        matches_property_suffix(property_suffix, LIMITMODS, LIMITMODS_LEN) ||
+        matches_property_suffix(property_suffix, PATH, PATH_LEN) ||
+        matches_property_suffix(property_suffix, UPGRADE_PATH, UPGRADE_PATH_LEN)) {
+      return true;
+    }
+  }
+  return false;
 }
 
 // Process java launcher properties.
@@ -4287,8 +4308,8 @@
   }
 
   if (needs_module_property_warning) {
-    warning("Ignoring system property options whose names start with '-Djdk.module'."
-            "  They are reserved for internal use.");
+    warning("Ignoring system property options whose names match the '-Djdk.module.*'."
+            " names that are reserved for internal use.");
   }
 
 #if defined(_ALLBSD_SOURCE) || defined(AIX)  // UseLargePages is not yet supported on BSD and AIX.
--- a/src/share/vm/runtime/atomic.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/atomic.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -76,6 +76,7 @@
 
   // Atomically add to a location. Returns updated value. add*() provide:
   // <fence> add-value-to-dest <membar StoreLoad|StoreStore>
+  inline static jshort   add    (jshort   add_value, volatile jshort*   dest);
   inline static jint     add    (jint     add_value, volatile jint*     dest);
   inline static size_t   add    (size_t   add_value, volatile size_t*   dest);
   inline static intptr_t add_ptr(intptr_t add_value, volatile intptr_t* dest);
@@ -150,26 +151,39 @@
  * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
  * implementation to be used instead.
  */
-inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand, cmpxchg_memory_order order)
-{
-  assert(sizeof(jbyte) == 1, "assumption.");
-  uintptr_t dest_addr = (uintptr_t)dest;
-  uintptr_t offset = dest_addr % sizeof(jint);
-  volatile jint* dest_int = (volatile jint*)(dest_addr - offset);
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest,
+                             jbyte compare_value, cmpxchg_memory_order order) {
+  STATIC_ASSERT(sizeof(jbyte) == 1);
+  volatile jint* dest_int =
+      static_cast<volatile jint*>(align_ptr_down(dest, sizeof(jint)));
+  size_t offset = pointer_delta(dest, dest_int, 1);
   jint cur = *dest_int;
-  jbyte* cur_as_bytes = (jbyte*)(&cur);
-  jint new_val = cur;
-  jbyte* new_val_as_bytes = (jbyte*)(&new_val);
-  new_val_as_bytes[offset] = exchange_value;
-  while (cur_as_bytes[offset] == comparand) {
-    jint res = cmpxchg(new_val, dest_int, cur, order);
-    if (res == cur) break;
+  jbyte* cur_as_bytes = reinterpret_cast<jbyte*>(&cur);
+
+  // current value may not be what we are looking for, so force it
+  // to that value so the initial cmpxchg will fail if it is different
+  cur_as_bytes[offset] = compare_value;
+
+  // always execute a real cmpxchg so that we get the required memory
+  // barriers even on initial failure
+  do {
+    // value to swap in matches current value ...
+    jint new_value = cur;
+    // ... except for the one jbyte we want to update
+    reinterpret_cast<jbyte*>(&new_value)[offset] = exchange_value;
+
+    jint res = cmpxchg(new_value, dest_int, cur, order);
+    if (res == cur) break; // success
+
+    // at least one jbyte in the jint changed value, so update
+    // our view of the current jint
     cur = res;
-    new_val = cur;
-    new_val_as_bytes[offset] = exchange_value;
-  }
+    // if our jbyte is still as cur we loop and try again
+  } while (cur_as_bytes[offset] == compare_value);
+
   return cur_as_bytes[offset];
 }
+
 #endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
 
 inline unsigned Atomic::xchg(unsigned int exchange_value, volatile unsigned int* dest) {
@@ -195,10 +209,11 @@
   return old;
 }
 
-inline void Atomic::inc(volatile short* dest) {
-  // Most platforms do not support atomic increment on a 2-byte value. However,
+inline jshort Atomic::add(jshort add_value, volatile jshort* dest) {
+  // Most platforms do not support atomic add on a 2-byte value. However,
   // if the value occupies the most significant 16 bits of an aligned 32-bit
-  // word, then we can do this with an atomic add of 0x10000 to the 32-bit word.
+  // word, then we can do this with an atomic add of (add_value << 16)
+  // to the 32-bit word.
   //
   // The least significant parts of this 32-bit word will never be affected, even
   // in case of overflow/underflow.
@@ -206,21 +221,20 @@
   // Use the ATOMIC_SHORT_PAIR macro (see macros.hpp) to get the desired alignment.
 #ifdef VM_LITTLE_ENDIAN
   assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-  (void)Atomic::add(0x10000, (volatile int*)(dest-1));
+  jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest-1));
 #else
   assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-  (void)Atomic::add(0x10000, (volatile int*)(dest));
+  jint new_value = Atomic::add(add_value << 16, (volatile jint*)(dest));
 #endif
+  return (jshort)(new_value >> 16); // preserves sign
 }
 
-inline void Atomic::dec(volatile short* dest) {
-#ifdef VM_LITTLE_ENDIAN
-  assert((intx(dest) & 0x03) == 0x02, "wrong alignment");
-  (void)Atomic::add(-0x10000, (volatile int*)(dest-1));
-#else
-  assert((intx(dest) & 0x03) == 0x00, "wrong alignment");
-  (void)Atomic::add(-0x10000, (volatile int*)(dest));
-#endif
+inline void Atomic::inc(volatile jshort* dest) {
+  (void)add(1, dest);
+}
+
+inline void Atomic::dec(volatile jshort* dest) {
+  (void)add(-1, dest);
 }
 
 #endif // SHARE_VM_RUNTIME_ATOMIC_HPP
--- a/src/share/vm/runtime/globals.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/globals.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -975,8 +975,8 @@
 static void trace_flag_changed(const char* name, const T old_value, const T new_value, const Flag::Flags origin) {
   E e;
   e.set_name(name);
-  e.set_old_value(old_value);
-  e.set_new_value(new_value);
+  e.set_oldValue(old_value);
+  e.set_newValue(new_value);
   e.set_origin(origin);
   e.commit();
 }
--- a/src/share/vm/runtime/globals.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/globals.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -2242,7 +2242,7 @@
           "in a comma separated string. Sub-systems are: "                  \
           "threads, heap, symbol_table, string_table, codecache, "          \
           "dictionary, classloader_data_graph, metaspace, jni_handles, "    \
-          "c-heap, codecache_oops")                                         \
+          "codecache_oops")                                                 \
                                                                             \
   diagnostic(bool, GCParallelVerificationEnabled, true,                     \
           "Enable parallel memory system verification")                     \
@@ -3008,16 +3008,6 @@
   notproduct(intx, ZombieALotInterval,     5,                               \
           "Number of exits until ZombieALot kicks in")                      \
                                                                             \
-  diagnostic(intx, MallocVerifyInterval,     0,                             \
-          "If non-zero, verify C heap after every N calls to "              \
-          "malloc/realloc/free")                                            \
-          range(0, max_intx)                                                \
-                                                                            \
-  diagnostic(intx, MallocVerifyStart,     0,                                \
-          "If non-zero, start verifying C heap after Nth call to "          \
-          "malloc/realloc/free")                                            \
-          range(0, max_intx)                                                \
-                                                                            \
   diagnostic(uintx, MallocMaxTestWords,     0,                              \
           "If non-zero, maximum number of words that malloc/realloc can "   \
           "allocate (for testing only)")                                    \
@@ -3027,9 +3017,6 @@
           "Number of receiver types to record in call/cast profile")        \
           range(0, 8)                                                       \
                                                                             \
-  experimental(intx, MethodProfileWidth, 0,                                 \
-          "Number of methods to record in call profile")                    \
-                                                                            \
   develop(intx, BciProfileWidth,      2,                                    \
           "Number of return bci's to record in ret profile")                \
                                                                             \
--- a/src/share/vm/runtime/objectMonitor.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/objectMonitor.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -390,7 +390,7 @@
   }
 
   if (event.should_commit()) {
-    event.set_klass(((oop)this->object())->klass());
+    event.set_monitorClass(((oop)this->object())->klass());
     event.set_previousOwner((TYPE_THREAD)_previous_owner_tid);
     event.set_address((TYPE_ADDRESS)(uintptr_t)(this->object_addr()));
     event.commit();
@@ -1381,7 +1381,7 @@
                                             jlong timeout,
                                             bool timedout) {
   assert(event != NULL, "invariant");
-  event->set_klass(((oop)this->object())->klass());
+  event->set_monitorClass(((oop)this->object())->klass());
   event->set_timeout(timeout);
   event->set_address((TYPE_ADDRESS)this->object_addr());
   event->set_notifier(notifier_tid);
--- a/src/share/vm/runtime/os.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/os.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -596,8 +596,6 @@
   }
 #endif
 
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
-
   // For the test flag -XX:MallocMaxTestWords
   if (has_reached_max_malloc_test_peak(size)) {
     return NULL;
@@ -658,7 +656,6 @@
   // NMT support
   void* membase = MemTracker::malloc_base(memblock);
   verify_memory(membase);
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
   if (size == 0) {
     return NULL;
   }
@@ -695,7 +692,6 @@
   }
   void* membase = MemTracker::record_free(memblock);
   verify_memory(membase);
-  NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 
   GuardedMemory guarded(membase);
   size_t size = guarded.get_user_size();
--- a/src/share/vm/runtime/os.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/os.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -709,7 +709,6 @@
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
 
   static void  free    (void *memblock);
-  static bool  check_heap(bool force = false);      // verify C heap integrity
   static char* strdup(const char *, MEMFLAGS flags = mtInternal);  // Like strdup
   // Like strdup, but exit VM when strdup() returns NULL
   static char* strdup_check_oom(const char*, MEMFLAGS flags = mtInternal);
--- a/src/share/vm/runtime/reflection.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/reflection.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -446,7 +446,7 @@
     (accessor_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION &&
     accessee_ik->major_version() < Verifier::STRICTER_ACCESS_CTRL_CHECK_VERSION)) {
     return classloader_only &&
-      Verifier::relax_verify_for(accessor_ik->class_loader()) &&
+      Verifier::relax_access_for(accessor_ik->class_loader()) &&
       accessor_ik->protection_domain() == accessee_ik->protection_domain() &&
       accessor_ik->class_loader() == accessee_ik->class_loader();
   }
--- a/src/share/vm/runtime/safepoint.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/safepoint.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -173,7 +173,7 @@
   //     block itself when it attempts transitions to a new state.
   //
   {
-    EventSafepointStateSync sync_event;
+    EventSafepointStateSynchronization sync_event;
     int initial_running = 0;
 
     _state            = _synchronizing;
--- a/src/share/vm/runtime/sweeper.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/sweeper.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -485,7 +485,7 @@
   if (event.should_commit()) {
     event.set_starttime(sweep_start_counter);
     event.set_endtime(sweep_end_counter);
-    event.set_sweepIndex(_traversals);
+    event.set_sweepId(_traversals);
     event.set_sweptCount(swept_count);
     event.set_flushedCount(flushed_count);
     event.set_zombifiedCount(zombified_count);
--- a/src/share/vm/runtime/synchronizer.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/synchronizer.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1819,7 +1819,7 @@
                                        const ObjectSynchronizer::InflateCause cause) {
 #if INCLUDE_TRACE
   assert(event.should_commit(), "check outside");
-  event.set_klass(obj->klass());
+  event.set_monitorClass(obj->klass());
   event.set_address((TYPE_ADDRESS)(uintptr_t)(void*)obj);
   event.set_cause((u1)cause);
   event.commit();
--- a/src/share/vm/runtime/thread.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/thread.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -35,7 +35,6 @@
 #include "compiler/compileTask.hpp"
 #include "gc/shared/gcId.hpp"
 #include "gc/shared/gcLocker.inline.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "gc/shared/workgroup.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/linkResolver.hpp"
@@ -3718,14 +3717,6 @@
   Management::record_vm_init_completed();
 #endif // INCLUDE_MANAGEMENT
 
-  // Note that we do not use CHECK_0 here since we are inside an EXCEPTION_MARK and
-  // set_init_completed has just been called, causing exceptions not to be shortcut
-  // anymore. We call vm_exit_during_initialization directly instead.
-
-  // Initialize reference pending list locker
-  bool needs_locker_thread = Universe::heap()->needs_reference_pending_list_locker_thread();
-  ReferencePendingListLocker::initialize(needs_locker_thread, CHECK_JNI_ERR);
-
   // Signal Dispatcher needs to be started before VMInit event is posted
   os::signal_init();
 
--- a/src/share/vm/runtime/vmStructs.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -54,7 +54,6 @@
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/generation.hpp"
 #include "gc/shared/generationSpec.hpp"
-#include "gc/shared/referencePendingListLocker.hpp"
 #include "gc/shared/space.hpp"
 #include "interpreter/bytecodeInterpreter.hpp"
 #include "interpreter/bytecodes.hpp"
@@ -242,7 +241,7 @@
   nonstatic_field(ConstantPool,                _reference_map,                                Array<u2>*)                            \
   nonstatic_field(ConstantPoolCache,           _length,                                       int)                                   \
   nonstatic_field(ConstantPoolCache,           _constant_pool,                                ConstantPool*)                         \
-  nonstatic_field(InstanceKlass,               _array_klasses,                                Klass*)                                \
+  volatile_nonstatic_field(InstanceKlass,      _array_klasses,                                Klass*)                                \
   nonstatic_field(InstanceKlass,               _methods,                                      Array<Method*>*)                       \
   nonstatic_field(InstanceKlass,               _default_methods,                              Array<Method*>*)                       \
   nonstatic_field(InstanceKlass,               _local_interfaces,                             Array<Klass*>*)                        \
@@ -271,7 +270,7 @@
   nonstatic_field(InstanceKlass,               _osr_nmethods_head,                            nmethod*)                              \
   JVMTI_ONLY(nonstatic_field(InstanceKlass,    _breakpoints,                                  BreakpointInfo*))                      \
   nonstatic_field(InstanceKlass,               _generic_signature_index,                      u2)                                    \
-  nonstatic_field(InstanceKlass,               _methods_jmethod_ids,                          jmethodID*)                            \
+  volatile_nonstatic_field(InstanceKlass,      _methods_jmethod_ids,                          jmethodID*)                            \
   volatile_nonstatic_field(InstanceKlass,      _idnum_allocated_count,                        u2)                                    \
   nonstatic_field(InstanceKlass,               _annotations,                                  Annotations*)                          \
   nonstatic_field(InstanceKlass,               _method_ordering,                              Array<int>*)                           \
@@ -1637,7 +1636,6 @@
            declare_type(JavaThread, Thread)                               \
            declare_type(JvmtiAgentThread, JavaThread)                     \
            declare_type(ServiceThread, JavaThread)                        \
-           declare_type(ReferencePendingListLockerThread, JavaThread)     \
   declare_type(CompilerThread, JavaThread)                                \
   declare_type(CodeCacheSweeperThread, JavaThread)                        \
   declare_toplevel_type(OSThread)                                         \
@@ -2628,6 +2626,11 @@
   declare_constant(Deoptimization::Reason_rtm_state_change)               \
   declare_constant(Deoptimization::Reason_unstable_if)                    \
   declare_constant(Deoptimization::Reason_unstable_fused_if)              \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_aliasing)))                       \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_transfer_to_interpreter)))        \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_not_compiled_exception_handler))) \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_unresolved)))                     \
+  NOT_ZERO(JVMCI_ONLY(declare_constant(Deoptimization::Reason_jsr_mismatch)))                   \
   declare_constant(Deoptimization::Reason_tenured)                        \
   declare_constant(Deoptimization::Reason_LIMIT)                          \
   declare_constant(Deoptimization::Reason_RECORDED_LIMIT)                 \
@@ -2752,7 +2755,13 @@
   declare_constant(ConcreteRegisterImpl::number_of_registers)             \
   declare_preprocessor_constant("REG_COUNT", REG_COUNT)                \
   declare_c2_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT) \
-  declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT)
+  declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT) \
+                                                                          \
+  /****************/                                                      \
+  /* JVMCI */                                                             \
+  /****************/                                                      \
+                                                                          \
+  declare_preprocessor_constant("INCLUDE_JVMCI", INCLUDE_JVMCI)
 
 
 //--------------------------------------------------------------------------------
--- a/src/share/vm/runtime/vmThread.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/runtime/vmThread.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -279,7 +279,6 @@
     HandleMark hm(VMThread::vm_thread());
     // Among other things, this ensures that Eden top is correct.
     Universe::heap()->prepare_for_verify();
-    os::check_heap();
     // Silent verification so as not to pollute normal output,
     // unless we really asked for it.
     Universe::verify();
--- a/src/share/vm/trace/traceDataTypes.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/trace/traceDataTypes.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -32,7 +32,6 @@
 enum {
   CONTENT_TYPE_NONE             = 0,
   CONTENT_TYPE_CLASS            = 20,
-  CONTENT_TYPE_UTF8             = 21,
   CONTENT_TYPE_THREAD           = 22,
   CONTENT_TYPE_STACKTRACE       = 23,
   CONTENT_TYPE_BYTES            = 24,
--- a/src/share/vm/trace/traceMacros.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/trace/traceMacros.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -30,7 +30,6 @@
 #define EVENT_THREAD_EXIT(thread)
 #define EVENT_THREAD_DESTRUCT(thread)
 #define TRACE_KLASS_CREATION(k, p, t)
-#define TRACE_KLASS_DEFINITION(k, t)
 
 #define TRACE_INIT_KLASS_ID(k)
 #define TRACE_REMOVE_KLASS_ID(k)
--- a/src/share/vm/trace/traceevents.xml	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/trace/traceevents.xml	Tue Sep 06 22:52:35 2016 +0200
@@ -76,111 +76,112 @@
 
   <event id="ThreadPark" path="java/thread_park" label="Java Thread Park"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Class Parked On"/>
+    <value type="CLASS" field="parkedClass" label="Class Parked On"/>
     <value type="MILLIS" field="timeout" label="Park Timeout"/>
-    <value type="ADDRESS" field="address" label="Address of Object Parked" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Address of Object Parked" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorEnter" path="java/monitor_enter" label="Java Monitor Blocked"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class"/>
     <value type="THREAD" field="previousOwner" label="Previous Monitor Owner"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorWait" path="java/monitor_wait" label="Java Monitor Wait" description="Waiting on a Java monitor"
           has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class" description="Class of object waited on"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class" description="Class of object waited on"/>
     <value type="THREAD" field="notifier" label="Notifier Thread" description="Notifying Thread"/>
     <value type="MILLIS" field="timeout" label="Timeout" description="Maximum wait time"/>
     <value type="BOOLEAN" field="timedOut" label="Timed Out" description="Wait has been timed out"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" description="Address of object waited on" relation="JAVA_MONITOR_ADDRESS"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" description="Address of object waited on" relation="JavaMonitorAddress"/>
   </event>
 
   <event id="JavaMonitorInflate" path="java/monitor_inflate" label="Java Monitor Inflated"
          has_thread="true" has_stacktrace="true" is_instant="false">
-    <value type="CLASS" field="klass" label="Monitor Class"/>
-    <value type="ADDRESS" field="address" label="Monitor Address" relation="JAVA_MONITOR_ADDRESS"/>
-    <value type="INFLATECAUSE" field="cause" label="Cause" description="Cause of inflation"/>
+    <value type="CLASS" field="monitorClass" label="Monitor Class"/>
+    <value type="ADDRESS" field="address" label="Monitor Address" relation="JavaMonitorAddress"/>
+    <value type="INFLATECAUSE" field="cause" label="Monitor Inflation Cause" description="Cause of inflation"/>
   </event>
 
-  <event id="ReservedStackActivation" path="java/reserved_stack_activation" label="Reserved Stack Activation" description="Activation of Reserved Stack Area caused by stack overflow with ReservedStackAccess annotated method in call stack"
-          has_thread="true" has_stacktrace="true" is_instant="true">
+  <event id="ReservedStackActivation" path="vm/runtime/reserved_stack_activation" label="Reserved Stack Activation"
+         description="Activation of Reserved Stack Area caused by stack overflow with ReservedStackAccess annotated method in call stack"
+         has_thread="true" has_stacktrace="true" is_instant="true">
       <value type="METHOD" field="method" label="Java Method"/>
   </event>
 
   <event id="ClassLoad" path="vm/class/load" label="Class Load"
-          has_thread="true" has_stacktrace="true" is_instant="false">
+         has_thread="true" has_stacktrace="true" is_instant="false">
     <value type="CLASS" field="loadedClass" label="Loaded Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
     <value type="CLASS" field="initiatingClassLoader" label="Initiating Class Loader"/>
   </event>
 
   <event id="ClassDefine" path="vm/class/define" label="Class Define"
-          has_thread="true" has_stacktrace="true" is_instant="true">
+         has_thread="true" has_stacktrace="true" is_instant="true">
     <value type="CLASS" field="definedClass" label="Defined Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="ClassUnload" path="vm/class/unload" label="Class Unload"
-      has_thread="true" is_instant="true">
+         has_thread="true" is_instant="true">
     <value type="CLASS" field="unloadedClass" label="Unloaded Class"/>
     <value type="CLASS" field="definingClassLoader" label="Defining Class Loader"/>
   </event>
 
   <event id="IntFlagChanged" path="vm/flag/int_changed" label="Int Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="INTEGER" field="old_value" label="Old Value" />
-    <value type="INTEGER" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="INTEGER" field="oldValue" label="Old Value" />
+    <value type="INTEGER" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="UnsignedIntFlagChanged" path="vm/flag/uint_changed" label="Unsigned Int Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="UINT" field="old_value" label="Old Value" />
-    <value type="UINT" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="UINT" field="oldValue" label="Old Value" />
+    <value type="UINT" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="LongFlagChanged" path="vm/flag/long_changed" label="Long Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="LONG" field="old_value" label="Old Value" />
-    <value type="LONG" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="LONG" field="oldValue" label="Old Value" />
+    <value type="LONG" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="UnsignedLongFlagChanged" path="vm/flag/ulong_changed" label="Unsigned Long Flag Changed"
-        is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="ULONG" field="old_value" label="Old Value" />
-    <value type="ULONG" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="ULONG" field="oldValue" label="Old Value" />
+    <value type="ULONG" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="DoubleFlagChanged" path="vm/flag/double_changed" label="Double Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="DOUBLE" field="old_value" label="Old Value" />
-    <value type="DOUBLE" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="DOUBLE" field="oldValue" label="Old Value" />
+    <value type="DOUBLE" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="BooleanFlagChanged" path="vm/flag/boolean_changed" label="Boolean Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="BOOLEAN" field="old_value" label="Old Value" />
-    <value type="BOOLEAN" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="BOOLEAN" field="oldValue" label="Old Value" />
+    <value type="BOOLEAN" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
   <event id="StringFlagChanged" path="vm/flag/string_changed" label="String Flag Changed"
-       is_instant="true">
-    <value type="UTF8" field="name" label="Name" />
-    <value type="UTF8" field="old_value" label="Old Value" />
-    <value type="UTF8" field="new_value" label="New Value" />
+         is_instant="true">
+    <value type="STRING" field="name" label="Name" />
+    <value type="STRING" field="oldValue" label="Old Value" />
+    <value type="STRING" field="newValue" label="New Value" />
     <value type="FLAGVALUEORIGIN" field="origin" label="Origin" />
   </event>
 
@@ -200,7 +201,7 @@
   </struct>
 
   <event id="GCHeapSummary" path="vm/gc/heap/summary" label="Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <structvalue type="VirtualSpace" field="heapSpace" label="Heap Space"/>
     <value type="BYTES64" field="heapUsed" label="Heap Used" description="Bytes allocated by objects in the heap"/>
@@ -213,7 +214,7 @@
   </struct>
 
   <event id="MetaspaceSummary" path="vm/gc/heap/metaspace_summary" label="Metaspace Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <value type="BYTES64" field="gcThreshold" label="GC Threshold" />
     <structvalue type="MetaspaceSizes" field="metaspace" label="Total"/>
@@ -244,7 +245,7 @@
   </event>
 
   <event id="MetaspaceChunkFreeListSummary" path="vm/gc/metaspace/chunk_free_list_summary" label="Metaspace Chunk Free List Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
     <value type="METADATATYPE" field="metadataType" label="Metadata Type" />
     <value type="ULONG" field="specializedChunks" label="Specialized Chunks" />
@@ -258,7 +259,7 @@
   </event>
 
   <event id="PSHeapSummary" path="vm/gc/heap/ps_summary" label="Parallel Scavenge Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
 
     <structvalue type="VirtualSpace" field="oldSpace" label="Old Space"/>
@@ -271,7 +272,7 @@
   </event>
 
   <event id="G1HeapSummary" path="vm/gc/heap/g1_summary" label="G1 Heap Summary" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="GCWHEN" field="when" label="When" />
 
     <value type="BYTES64" field="edenUsedSize" label="Eden Used Size" />
@@ -280,53 +281,53 @@
     <value type="UINT" field="numberOfRegions" label="Number of Regions" />
   </event>
 
-  <event id="GCGarbageCollection" path="vm/gc/collector/garbage_collection" label="Garbage Collection"
+  <event id="GarbageCollection" path="vm/gc/collector/garbage_collection" label="Garbage Collection"
          description="Garbage collection performed by the JVM">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="GCNAME" field="name" label="Name" description="The name of the Garbage Collector" />
     <value type="GCCAUSE" field="cause" label="Cause" description="The reason for triggering this Garbage Collection" />
     <value type="TICKSPAN" field="sumOfPauses" label="Sum of Pauses" description="Sum of all the times in which Java execution was paused during the garbage collection" />
     <value type="TICKSPAN" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
   </event>
 
-  <event id="GCParallelOld" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
+  <event id="ParallelOldGarbageCollection" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
          description="Extra information specific to Parallel Old Garbage Collections">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="ADDRESS" field="densePrefix" label="Dense Prefix" description="The address of the dense prefix, used when compacting" />
   </event>
 
-  <event id="GCYoungGarbageCollection" path="vm/gc/collector/young_garbage_collection" label="Young Garbage Collection"
+  <event id="YoungGarbageCollection" path="vm/gc/collector/young_garbage_collection" label="Young Garbage Collection"
          description="Extra information specific to Young Garbage Collections">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
     <value type="UINT" field="tenuringThreshold" label="Tenuring Threshold" />
   </event>
 
-  <event id="GCOldGarbageCollection" path="vm/gc/collector/old_garbage_collection" label="Old Garbage Collection"
+  <event id="OldGarbageCollection" path="vm/gc/collector/old_garbage_collection" label="Old Garbage Collection"
          description="Extra information specific to Old Garbage Collections">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
   </event>
 
-  <event id="GCG1GarbageCollection" path="vm/gc/collector/g1_garbage_collection" label="G1 Garbage Collection"
+  <event id="G1GarbageCollection" path="vm/gc/collector/g1_garbage_collection" label="G1 Garbage Collection"
          description="Extra information specific to G1 Garbage Collections">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="G1YCTYPE" field="type" label="Type" />
   </event>
 
-  <event id="GCG1MMU" path="vm/gc/detailed/g1_mmu_info" label="G1 MMU Information" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="DOUBLE" field="timeSlice" label="Time slice used to calculate MMU"/>
-    <value type="DOUBLE" field="gcTime" label="Time spent on GC during last time slice"/>
-    <value type="DOUBLE" field="maxGcTime" label="Max time allowed to be spent on GC during last time slice"/>
+  <event id="G1MMU" path="vm/gc/detailed/g1_mmu_info" label="G1 MMU Information" is_instant="true">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="DOUBLE" field="timeSlice" label="Time Slice" description="Time slice used to calculate MMU"/>
+    <value type="DOUBLE" field="gcTime" label="GC Time" description="Time spent on GC during last time slice"/>
+    <value type="DOUBLE" field="maxGcTime" label="Max GC Time" description="Max time allowed to be spent on GC during last time slice"/>
   </event>
 
-  <event id="EvacuationInfo" path="vm/gc/detailed/evacuation_info" label="Evacuation Information" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <event id="EvacuationInformation" path="vm/gc/detailed/evacuation_info" label="Evacuation Information" is_instant="true">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="UINT" field="cSetRegions" label="Collection Set Regions"/>
     <value type="BYTES64" field="cSetUsedBefore" label="Collection Set Before" description="Memory usage before GC in the collection set regions"/>
     <value type="BYTES64" field="cSetUsedAfter" label="Collection Set After" description="Memory usage after GC in the collection set regions"/>
     <value type="UINT" field="allocationRegions" label="Allocation Regions" description="Regions chosen as allocation regions during evacuation (includes survivors and old space regions)"/>
-    <value type="BYTES64" field="allocRegionsUsedBefore" label="Alloc Regions Before" description="Memory usage before GC in allocation regions"/>
-    <value type="BYTES64" field="allocRegionsUsedAfter" label="Alloc Regions After" description="Memory usage after GC in allocation regions"/>
+    <value type="BYTES64" field="allocationRegionsUsedBefore" label="Allocation Regions Before" description="Memory usage before GC in allocation regions"/>
+    <value type="BYTES64" field="allocationRegionsUsedAfter" label="Allocation Regions After" description="Memory usage after GC in allocation regions"/>
     <value type="BYTES64" field="bytesCopied" label="Bytes Copied"/>
     <value type="UINT" field="regionsFreed" label="Regions Freed"/>
   </event>
@@ -334,7 +335,7 @@
   <event id="GCReferenceStatistics" path="vm/gc/reference/statistics"
          label="GC Reference Statistics" is_instant="true"
          description="Total count of processed references during GC">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="REFERENCETYPE" field="type" label="Type" />
     <value type="ULONG" field="count" label="Total Count" />
   </event>
@@ -347,14 +348,14 @@
   </struct>
 
   <event id="ObjectCountAfterGC" path="vm/gc/detailed/object_count_after_gc" is_instant="true" label="Object Count after GC">
-    <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
-    <value type="CLASS" field="class" label="Class" />
+    <value type="UINT" field="gcId"  label="GC Identifier" relation="GcId" />
+    <value type="CLASS" field="objectClass" label="Object Class" />
     <value type="LONG" field="count" label="Count" />
     <value type="BYTES64" field="totalSize" label="Total Size" />
   </event>
 
-  <struct id="G1EvacStats">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <struct id="G1EvacuationStatistics">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="BYTES64" field="allocated" label="Allocated" description="Total memory allocated by PLABs"/>
     <value type="BYTES64" field="wasted" label="Wasted" description="Total memory wasted within PLABs due to alignment or refill"/>
     <value type="BYTES64" field="used" label="Used" description="Total memory occupied by objects within PLABs"/>
@@ -366,48 +367,48 @@
     <value type="BYTES64" field="failureWaste" label="Wasted (failure)" description="Total memory left unused in regions where evacuation failed"/>
   </struct>
 
-  <event id="GCG1EvacuationYoungStatistics" path="vm/gc/detailed/g1_evac_young_stats" label="G1 Evacuation Statistics for Young" is_instant="true"
-         description="Memory related evacuation statistics during GC for the young generation">
-    <structvalue type="G1EvacStats" field="stats" label="Evacuation statistics"/>
+  <event id="G1EvacuationYoungStatistics" path="vm/gc/detailed/g1_evac_young_stats" label="G1 Evacuation Statistics for Young"
+         is_instant="true" description="Memory related evacuation statistics during GC for the young generation">
+    <structvalue type="G1EvacuationStatistics" field="statistics" label="Evacuation Statistics"/>
   </event>
 
-  <event id="GCG1EvacuationOldStatistics" path="vm/gc/detailed/g1_evac_old_stats" label="G1 Evacuation Memory Statistics for Old" is_instant="true"
-         description="Memory related evacuation statistics during GC for the old generation">
-    <structvalue type="G1EvacStats" field="stats" label="Evacuation statistics"/>
+  <event id="G1EvacuationOldStatistics" path="vm/gc/detailed/g1_evac_old_stats" label="G1 Evacuation Memory Statistics for Old"
+         is_instant="true" description="Memory related evacuation statistics during GC for the old generation">
+    <structvalue type="G1EvacuationStatistics" field="statistics" label="Evacuation Statistics"/>
   </event>
 
-  <event id="GCG1BasicIHOP" path="vm/gc/detailed/g1_basic_ihop_status" label="G1 Basic IHOP statistics" is_instant="true"
-         description="Basic statistics related to current IHOP calculation">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+  <event id="G1BasicIHOP" path="vm/gc/detailed/g1_basic_ihop_status" label="G1 Basic IHOP statistics"
+         is_instant="true" description="Basic statistics related to current IHOP calculation">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
     <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of old gen"/>
-    <value type="BYTES64" field="targetOccupancy" label="Target occupancy" description="Target old gen occupancy to reach at the start of mixed GC in bytes"/>
-    <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
-    <value type="BYTES64" field="lastAllocationSize" label="Last mutator allocation size" description="Mutator allocation during mutator operation since last GC in bytes"/>
-    <value type="DOUBLE" field="lastAllocationDuration" label="Last mutator operation duration" description="Time the mutator ran since last GC in seconds"/>
-    <value type="DOUBLE" field="lastAllocationRate" label="Last mutator allocation rate" description="Allocation rate of the mutator since last GC in bytes/second"/>
-    <value type="DOUBLE" field="lastMarkingLength" label="Last mutator time from initial mark to first mixed GC" description="Last time from the end of the last initial mark to the first mixed GC in seconds"/>
+    <value type="BYTES64" field="targetOccupancy" label="Target Occupancy" description="Target old gen occupancy to reach at the start of mixed GC in bytes"/>
+    <value type="BYTES64" field="currentOccupancy" label="Current Occupancy" description="Current old generation occupancy in bytes"/>
+    <value type="BYTES64" field="lastAllocationSize" label="Last Mutator Allocation" description="Mutator allocation during mutator operation since last GC in bytes"/>
+    <value type="DOUBLE" field="lastAllocationDuration" label="Last Mutator Operation" description="Time the mutator ran since last GC in seconds"/>
+    <value type="DOUBLE" field="lastAllocationRate" label="Last Mutator Allocation Rate" description="Allocation rate of the mutator since last GC in bytes/second"/>
+    <value type="DOUBLE" field="lastMarkingLength" label="Last Marking Length" description="Last time from the end of the last initial mark to the first mixed GC in seconds"/>
   </event>
 
-  <event id="GCG1AdaptiveIHOP" path="vm/gc/detailed/g1_adaptive_ihop_status" label="G1 Adaptive IHOP statistics" is_instant="true"
-         description="Statistics related to current adaptive IHOP calculation">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="BYTES64" field="threshold" label="Current IHOP threshold" description="Current IHOP threshold in bytes"/>
-    <value type="PERCENTAGE" field="thresholdPercentage" label="Current IHOP threshold in percent" description="Current IHOP threshold in percent of the internal target occupancy"/>
-    <value type="BYTES64" field="internalTargetOccupancy" label="Target occupancy" description="Internal target old gen occupancy to reach at the start of mixed GC in bytes"/>
-    <value type="BYTES64" field="currentOccupancy" label="Current occupancy" description="Current old gen occupancy in bytes"/>
-    <value type="BYTES64" field="additionalBufferSize" label="Additional buffer size" description="Additional buffer size in bytes"/>
-    <value type="DOUBLE" field="predictedAllocationRate" label="Predicted mutator allocation rate" description="Current predicted allocation rate for the mutator in bytes/second"/>
-    <value type="DOUBLE" field="predictedMarkingLength" label="Predicted time from initial mark to first mixed GC" description="Current predicted time from the end of the last initial mark to the first mixed GC in seconds"/>
-    <value type="BOOLEAN" field="predictionActive" label="Prediction active" description="Indicates whether the adaptive IHOP prediction is active"/>
+  <event id="G1AdaptiveIHOP" path="vm/gc/detailed/g1_adaptive_ihop_status" label="G1 Adaptive IHOP statistics"
+         is_instant="true" description="Statistics related to current adaptive IHOP calculation">
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="BYTES64" field="threshold" label="Threshold" description="Current IHOP threshold in bytes"/>
+    <value type="PERCENTAGE" field="thresholdPercentage" label="Threshold Percentage" description="Current IHOP threshold in percent of the internal target occupancy"/>
+    <value type="BYTES64" field="internalTargetOccupancy" label="Target Occupancy" description="Internal target old generation occupancy to reach at the start of mixed GC in bytes"/>
+    <value type="BYTES64" field="currentOccupancy" label="Current Occupancy" description="Current old generation occupancy in bytes"/>
+    <value type="BYTES64" field="additionalBufferSize" label="Additional Buffer" description="Additional buffer size in bytes"/>
+    <value type="DOUBLE" field="predictedAllocationRate" label="Predicted Allocation Rate" description="Current predicted allocation rate for the mutator in bytes/second"/>
+    <value type="DOUBLE" field="predictedMarkingLength" label="Predicted Marking Length" description="Current predicted time from the end of the last initial mark to the first mixed GC in seconds"/>
+    <value type="BOOLEAN" field="predictionActive" label="Prediction Active" description="Indicates whether the adaptive IHOP prediction is active"/>
   </event>
 
   <!-- Promotion events, Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. -->
   <event id="PromoteObjectInNewPLAB" path="vm/gc/detailed/object_promotion_in_new_PLAB" label="Promotion in new PLAB"
-      description="Object survived scavenge and was copied to a new Promotion Local Allocation Buffer (PLAB). Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
+         description="Object survived scavenge and was copied to a new Promotion Local Allocation Buffer (PLAB). Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
          has_thread="true" has_stacktrace="false" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
-    <value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId" description="Identifier signifying GC during which the object was promoted"/>
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of promoted object"/>
     <value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
     <value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
     <value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
@@ -415,10 +416,10 @@
   </event>
   
   <event id="PromoteObjectOutsidePLAB" path="vm/gc/detailed/object_promotion_outside_PLAB" label="Promotion outside PLAB"
-      description="Object survived scavenge and was copied directly to the heap. Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
+         description="Object survived scavenge and was copied directly to the heap. Supported GCs are Parallel Scavange, G1 and CMS with Parallel New. Due to promotion being done in parallel an object might be reported multiple times as the GC threads race to copy all objects." 
          has_thread="true" has_stacktrace="false" is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID" description="ID of GC during which the object was promoted"/>
-    <value type="CLASS" field="class" label="Class" description="Class of promoted object"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId" description="Identifier signifying GC during which the object was promoted"/>
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of promoted object"/>
     <value type="BYTES64" field="objectSize" label="Object Size" description="Size of promoted object"/>
     <value type="UINT" field="tenuringAge" label="Object Tenuring Age" description="Tenuring age of a surviving object before being copied. The tenuring age of an object is a value between 0-15 and is incremented each scavange the object survives. Newly allocated objects have tenuring age 0."/>
     <value type="BOOLEAN" field="tenured" label="Tenured" description="True if object was promoted to Old space, otherwise the object was aged and copied to a Survivor space"/>
@@ -426,81 +427,76 @@
 
   <event id="PromotionFailed" path="vm/gc/detailed/promotion_failed" label="Promotion Failed" is_instant="true"
          description="Promotion of an object failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <structvalue type="CopyFailed" field="data" label="Data"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <structvalue type="CopyFailed" field="promotionFailed" label="Promotion Failed Data"/>
     <value type="THREAD" field="thread" label="Running thread"/>
   </event>
 
   <event id="EvacuationFailed" path="vm/gc/detailed/evacuation_failed" label="Evacuation Failed" is_instant="true"
          description="Evacuation of an object failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <structvalue type="CopyFailed" field="data" label="Data"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <structvalue type="CopyFailed" field="evacuationFailed" label="Evacuation Failed Data"/>
   </event>
 
   <event id="ConcurrentModeFailure" path="vm/gc/detailed/concurrent_mode_failure" label="Concurrent Mode Failure"
          is_instant="true" description="Concurrent Mode failed">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
   </event>
 
   <event id="GCPhasePause" path="vm/gc/phases/pause" label="GC Phase Pause" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel1" path="vm/gc/phases/pause_level_1" label="GC Phase Pause Level 1" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel2" path="vm/gc/phases/pause_level_2" label="GC Phase Pause Level 2" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhasePauseLevel3" path="vm/gc/phases/pause_level_3" label="GC Phase Pause Level 3" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="GCPhaseConcurrent" path="vm/gc/phases/concurrent" label="GC Phase Concurrent" has_thread="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
-    <value type="UTF8" field="name" label="Name" />
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
+    <value type="STRING" field="name" label="Name" />
   </event>
 
   <event id="AllocationRequiringGC" path="vm/gc/detailed/allocation_requiring_gc" label="Allocation Requiring GC"
          has_thread="true" has_stacktrace="true"  is_instant="true">
-    <value type="UINT" field="gcId"  label="Pending GC ID" relation="GC_ID" />
+    <value type="UINT" field="gcId"  label="Pending GC Identifier" relation="GcId" />
     <value type="BYTES64" field="size" label="Allocation Size" />
   </event>
 
   <event id="TenuringDistribution" path="vm/gc/detailed/tenuring_distribution" label="Tenuring Distribution"
          is_instant="true">
-    <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
+    <value type="UINT" field="gcId" label="GC Identifier" relation="GcId"/>
     <value type="UINT" field="age" label="Age" />
     <value type="BYTES64" field="size" label="Size" />
   </event>
 
   <event id="G1HeapRegionTypeChange" path="vm/gc/detailed/g1_heap_region_type_change" label="G1 Heap Region Type Change"
-         description="Information about a G1 heap region type change." is_instant="true">
+         description="Information about a G1 heap region type change" is_instant="true">
     <value type="UINT" field="index" label="Index" />
-    <value type="G1HEAPREGIONTYPE" field="from" label="From Type" />
-    <value type="G1HEAPREGIONTYPE" field="to" label="To Type" />
+    <value type="G1HEAPREGIONTYPE" field="from" label="From" />
+    <value type="G1HEAPREGIONTYPE" field="to" label="To" />
     <value type="ADDRESS" field="start" label="Start" />
     <value type="BYTES64" field="used" label="Used" />
-    <value type="UINT" field="allocContext" label="Allocation Context" />
-  </event>
-
-  <event id="VMError" path="vm/runtime/vm_error" label="VM Error"
-         description="VM shutdown due to an error" has_stacktrace="true" has_thread="true">
-    <value type="BOOLEAN" field="out_of_java_memory" label="Java Out Of Memory"/>
+    <value type="UINT" field="allocationContext" label="Allocation Context" />
   </event>
 
   <!-- Compiler events -->
 
   <event id="Compilation" path="vm/compiler/compilation" label="Compilation"
-       has_thread="true" is_requestable="false" is_constant="false">
+         has_thread="true" is_requestable="false" is_constant="false">
     <value type="METHOD" field="method" label="Java Method"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="USHORT" field="compileLevel" label="Compilation Level"/>
     <value type="BOOLEAN" field="succeded" label="Succeeded"/>
     <value type="BOOLEAN" field="isOsr" label="On Stack Replacement"/>
@@ -509,39 +505,39 @@
   </event>
 
   <event id="CompilerPhase" path="vm/compiler/phase" label="Compiler Phase"
-          has_thread="true" is_requestable="false" is_constant="false">
+         has_thread="true" is_requestable="false" is_constant="false">
     <value type="COMPILERPHASETYPE" field="phase" label="Compile Phase"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="USHORT" field="phaseLevel" label="Phase Level"/>
   </event>
 
-  <event id="CompilerFailure" path="vm/compiler/failure" label="Compilation Failure"
-          has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
-    <value type="UTF8" field="failure" label="Message"/>
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+  <event id="CompilationFailure" path="vm/compiler/failure" label="Compilation Failure"
+         has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
+    <value type="STRING" field="failureMessage" label="Failure Message"/>
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
   </event>
 
-  <struct id="CiMethod">
-    <value type="UTF8" field="class" label="Class name"/>
-    <value type="UTF8" field="name" label="Method name"/>
-    <value type="UTF8" field="signature" label="Method signature"/>
+  <struct id="CalleeMethod">
+    <value type="STRING" field="type" label="Class"/>
+    <value type="STRING" field="name" label="Method Name"/>
+    <value type="STRING" field="descriptor" label="Method Descriptor"/>
   </struct>
 
   <event id="CompilerInlining" path="vm/compiler/optimization/inlining" label="Method Inlining"
-       has_thread="true" is_instant="true">
-    <value type="UINT" field="compileID" label="Compilation ID" relation="COMP_ID"/>
+         has_thread="true" is_instant="true">
+    <value type="UINT" field="compileId" label="Compilation Identifier" relation="CompileId"/>
     <value type="METHOD" field="caller" label="Caller Method"/>
-    <structvalue type="CiMethod" field="callee" label="Callee Method"/>
+    <structvalue type="CalleeMethod" field="callee" label="Callee Method"/>
     <value type="BOOLEAN" field="succeeded" label="Succeeded"/>
-    <value type="UTF8" field="message" label="Message"/>
+    <value type="STRING" field="message" label="Message"/>
     <value type="INTEGER" field="bci" label="Byte Code Index"/>
   </event>
 
   <!-- Code sweeper events -->
 
   <event id="SweepCodeCache" path="vm/code_sweeper/sweep" label="Sweep Code Cache"
-     has_thread="true" is_requestable="false" is_constant="false">
-    <value type="INTEGER" field="sweepIndex" label="Sweep Index" relation="SWEEP_ID"/>
+         has_thread="true" is_requestable="false" is_constant="false">
+    <value type="INTEGER" field="sweepId" label="Sweep Identifier" relation="SweepId"/>
     <value type="UINT" field="sweptCount" label="Methods Swept"/>
     <value type="UINT" field="flushedCount" label="Methods Flushed"/>
     <value type="UINT" field="zombifiedCount" label="Methods Zombified"/>
@@ -550,7 +546,7 @@
   <!-- Code cache events -->
 
   <event id="CodeCacheFull" path="vm/code_cache/full" label="Code Cache Full"
-       has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
+         has_thread="true" is_requestable="false" is_constant="false" is_instant="true">
     <value type="CODEBLOBTYPE" field="codeBlobType" label="Code Heap"/>
     <value type="ADDRESS" field="startAddress" label="Start Address"/>
     <value type="ADDRESS" field="commitedTopAddress" label="Commited Top"/>
@@ -564,14 +560,14 @@
 
   <event id="SafepointBegin" path="vm/runtime/safepoint/begin" label="Safepoint Begin"
          description="Safepointing begin" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="totalThreadCount" label="Total Threads" description="The total number of threads at the start of safe point"/>
     <value type="INTEGER" field="jniCriticalThreadCount" label="JNI Critical Threads" description="The number of threads in JNI critical sections"/>
   </event>
 
-  <event id="SafepointStateSync" path="vm/runtime/safepoint/statesync" label="Safepoint State Sync"
+  <event id="SafepointStateSynchronization" path="vm/runtime/safepoint/statesync" label="Safepoint State Synchronization"
          description="Synchronize run state of threads" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="initialThreadCount" label="Initial Threads" description="The number of threads running at the beginning of state check"/>
     <value type="INTEGER" field="runningThreadCount" label="Running Threads" description="The number of threads still running"/>
     <value type="INTEGER" field="iterations" label="Iterations" description="Number of state check iterations"/>
@@ -579,46 +575,46 @@
 
   <event id="SafepointWaitBlocked" path="vm/runtime/safepoint/waitblocked" label="Safepoint Wait Blocked"
          description="Safepointing begin waiting on running threads to block" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
     <value type="INTEGER" field="runningThreadCount" label="Running Threads" description="The number running of threads wait for safe point"/>
   </event>
 
   <event id="SafepointCleanup" path="vm/runtime/safepoint/cleanup" label="Safepoint Cleanup"
          description="Safepointing begin running cleanup tasks" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
   </event>
 
   <event id="SafepointCleanupTask" path="vm/runtime/safepoint/cleanuptask" label="Safepoint Cleanup Task"
          description="Safepointing begin running cleanup tasks" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
-    <value type="UTF8" field="name" label="Task Name" description="The task name"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
+    <value type="STRING" field="name" label="Task Name" description="The task name"/>
   </event>
 
   <event id="SafepointEnd" path="vm/runtime/safepoint/end" label="Safepoint End"
          description="Safepointing end" has_thread="true">
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" relation="SAFEPOINT_ID"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" relation="SafepointId"/>
   </event>
 
   <event id="ExecuteVMOperation" path="vm/runtime/execute_vm_operation" label="VM Operation"
-      description="Execution of a VM Operation" has_thread="true">
+         description="Execution of a VM Operation" has_thread="true">
     <value type="VMOPERATIONTYPE" field="operation" label="Operation" />
-    <value type="BOOLEAN" field="safepoint" label="At Safepoint" description="If the operation occured at a safepoint."/>
-    <value type="BOOLEAN" field="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete."/>
-    <value type="THREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown."/>
-    <value type="INTEGER" field="safepointId" label="Safepoint ID" description="The safepoint (if any) under which this operation was completed." relation="SAFEPOINT_ID"/>
+    <value type="BOOLEAN" field="safepoint" label="At Safepoint" description="If the operation occured at a safepoint"/>
+    <value type="BOOLEAN" field="blocking" label="Caller Blocked" description="If the calling thread was blocked until the operation was complete"/>
+    <value type="THREAD" field="caller" label="Caller" transition="FROM" description="Thread requesting operation. If non-blocking, will be set to 0 indicating thread is unknown"/>
+    <value type="INTEGER" field="safepointId" label="Safepoint Identifier" description="The safepoint (if any) under which this operation was completed" relation="SafepointId"/>
   </event>
 
   <!-- Allocation events -->
-  <event id="AllocObjectInNewTLAB" path="java/object_alloc_in_new_TLAB" label="Allocation in new TLAB"
-      description="Allocation in new Thread Local Allocation Buffer" has_thread="true" has_stacktrace="true" is_instant="true">
-    <value type="CLASS" field="class" label="Class" description="Class of allocated object"/>
+  <event id="ObjectAllocationInNewTLAB" path="java/object_alloc_in_new_TLAB" label="Allocation in new TLAB"
+         description="Allocation in new Thread Local Allocation Buffer" has_thread="true" has_stacktrace="true" is_instant="true">
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of allocated object"/>
     <value type="BYTES64" field="allocationSize" label="Allocation Size"/>
     <value type="BYTES64" field="tlabSize" label="TLAB Size"/>
   </event>
 
-  <event id="AllocObjectOutsideTLAB" path="java/object_alloc_outside_TLAB" label="Allocation outside TLAB"
-      description="Allocation outside Thread Local Allocation Buffers" has_thread="true" has_stacktrace="true" is_instant="true">
-    <value type="CLASS" field="class" label="Class" description="Class of allocated object"/>
+  <event id="ObjectAllocationOutsideTLAB" path="java/object_alloc_outside_TLAB" label="Allocation outside TLAB"
+         description="Allocation outside Thread Local Allocation Buffers" has_thread="true" has_stacktrace="true" is_instant="true">
+    <value type="CLASS" field="objectClass" label="Object Class" description="Class of allocated object"/>
     <value type="BYTES64" field="allocationSize" label="Allocation Size"/>
   </event>
 </events>
--- a/src/share/vm/trace/tracerelationdecls.xml	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/trace/tracerelationdecls.xml	Tue Sep 06 22:52:35 2016 +0200
@@ -27,9 +27,9 @@
 <!DOCTYPE relation_decls SYSTEM "trace.dtd">
 
 <relation_decls>
-  <relation_decl id="GC_ID" uri="vm/gc/id"/>
-  <relation_decl id="COMP_ID" uri="vm/compiler/id"/>
-  <relation_decl id="SWEEP_ID" uri="vm/code_sweeper/id"/>
-  <relation_decl id="JAVA_MONITOR_ADDRESS" uri="java/monitor/address"/>
-  <relation_decl id="SAFEPOINT_ID" uri="vm/runtime/safepoint/id"/>
+  <relation_decl id="GcId" uri="vm/gc/id"/>
+  <relation_decl id="CompileId" uri="vm/compiler/id"/>
+  <relation_decl id="SweepId" uri="vm/code_sweeper/id"/>
+  <relation_decl id="JavaMonitorAddress" uri="java/monitor/address"/>
+  <relation_decl id="SafepointId" uri="vm/runtime/safepoint/id"/>
 </relation_decls>
--- a/src/share/vm/trace/tracetypes.xml	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/trace/tracetypes.xml	Tue Sep 06 22:52:35 2016 +0200
@@ -43,7 +43,7 @@
 Example: (GcMode)
 
 <content_type id="GCMode" hr_name="GC mode" type="U1" jvm_type="GCMODE">
-  <value type="UTF8" field="desc" description="Description"/>
+  <value type="STRING" field="desc" description="Description"/>
 </content_type>
 
 This creates a content type CONTENT_TYPE_GCMODE
@@ -61,131 +61,131 @@
   <content_types>
     <content_type id="Thread" hr_name="Thread"
                   type="U8" builtin_type="THREAD">
-      <value type="UTF8" field="osName" label="OS Thread Name"/>
-      <value type="LONG" field="osThreadID" label="OS Thread ID"/>
-      <value type="UTF8" field="javaName" label="Java Lang Thread Name"/>
-      <value type="LONG" field="javaThreadID" label="Java Lang Thread ID"/>
+      <value type="STRING" field="osName" label="OS Thread Name"/>
+      <value type="LONG" field="osThreadId" label="OS Thread Id"/>
+      <value type="STRING" field="javaName" label="Java Thread Name"/>
+      <value type="LONG" field="javaThreadId" label="Java Thread Id"/>
       <value type="THREADGROUP" field="group" label="Java Thread Group"/>
     </content_type>
 
     <content_type id="ThreadGroup" hr_name="Thread group"
                   type="U8" jvm_type="THREADGROUP">
       <value type="THREADGROUP" field="parent" label="Parent"/>
-      <value type="UTF8" field="name" label="Name"/>
+      <value type="STRING" field="name" label="Name"/>
     </content_type>
 
     <content_type id="Class" hr_name="Java class"
                   type="U8" builtin_type="CLASS">
-      <value type="CLASS" field="loaderClass" label="ClassLoader"/>
+      <value type="CLASS" field="classLoaderType" label="Class Loader"/>
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="PACKAGE" field="package" label="Package"/>
-      <value type="SHORT" field="modifiers" label="Access modifiers"/>
+      <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
     </content_type>
 
     <content_type id="Method" hr_name="Java method"
                   type="U8" jvm_type="METHOD">
-      <value type="CLASS" field="class" label="Class"/>
+      <value type="CLASS" field="type" label="Type"/>
       <value type="SYMBOL" field="name" label="Name"/>
-      <value type="SYMBOL" field="signature" label="Signature"/>
-      <value type="SHORT" field="modifiers" label="Access modifiers"/>
+      <value type="SYMBOL" field="descriptor" label="Descriptor"/>
+      <value type="INTEGER" field="modifiers" label="Access Modifiers"/>
       <value type="BOOLEAN" field="hidden" label="Hidden"/>
     </content_type>
 
-    <content_type id="UTFConstant" hr_name="UTF constant"
+    <content_type id="Symbol" hr_name="Symbol"
                   type="U8" jvm_type="SYMBOL">
-      <value type="UTF8" field="utf8" label="UTF8 data"/>
+      <value type="STRING" field="string" label="String"/>
     </content_type>
 
     <content_type id="ThreadState" hr_name="Java Thread State"
                   type="U8" jvm_type="THREADSTATE">
-      <value type="UTF8" field="name" label="Name"/>
+      <value type="STRING" field="name" label="Name"/>
     </content_type>
 
     <content_type id="GCName" hr_name="GC Name"
                   type="U8" jvm_type="GCNAME">
-      <value type="UTF8" field="name" label="name" />
+      <value type="STRING" field="name" label="Name" />
     </content_type>
 
     <content_type id="GCCause" hr_name="GC Cause"
                   type="U8" jvm_type="GCCAUSE">
-      <value type="UTF8" field="cause" label="cause" />
+      <value type="STRING" field="cause" label="Cause" />
     </content_type>
 
     <content_type id="GCWhen" hr_name="GC When"
                   type="U8" jvm_type="GCWHEN">
-      <value type="UTF8" field="when" label="when" />
+      <value type="STRING" field="when" label="When" />
     </content_type>
 
     <content_type id="G1HeapRegionType" hr_name="G1 Heap Region Type"
                   type="U8" jvm_type="G1HEAPREGIONTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
     
     <content_type id="G1YCType" hr_name="G1 YC Type"
                   type="U8" jvm_type="G1YCTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="GCThresholdUpdater" hr_name="GC Treshold Updater"
                   type="U8" jvm_type="GCTHRESHOLDUPDATER">
-      <value type="UTF8" field="updater" label="updater" />
+      <value type="STRING" field="updater" label="Updater" />
     </content_type>
 
     <content_type id="ReferenceType" hr_name="Reference Type"
                   type="U8" jvm_type="REFERENCETYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="MetadataType" hr_name="Metadata Type"
                   type="U8" jvm_type="METADATATYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="MetaspaceObjectType" hr_name="Metaspace Object Type"
                   type="U8" jvm_type="METASPACEOBJTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
-    <content_type id="NARROW_OOP_MODE" hr_name="Narrow Oop Mode"
+    <content_type id="NarrowOopMode" hr_name="Narrow oop Mode"
                   type="U8" jvm_type="NARROWOOPMODE">
-      <value type="UTF8" field="mode" label="mode" />
+      <value type="STRING" field="mode" label="Mode" />
     </content_type>
 
     <content_type id="VMOperationType" hr_name="VM Operation Type"
                   type="U8" jvm_type="VMOPERATIONTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="CompilerPhaseType" hr_name="Compiler Phase Type"
                   type="U8" jvm_type="COMPILERPHASETYPE">
-      <value type="UTF8" field="phase" label="phase" />
+      <value type="STRING" field="phase" label="Phase" />
     </content_type>
 
     <content_type id="FlagValueOrigin" hr_name="Flag Value Origin"
                   type="U8" jvm_type="FLAGVALUEORIGIN">
-      <value type="UTF8" field="origin" label="origin" />
+      <value type="STRING" field="origin" label="Origin" />
     </content_type>
 
     <content_type id="CodeBlobType" hr_name="Code Blob Type"
                   type="U8" jvm_type="CODEBLOBTYPE">
-      <value type="UTF8" field="type" label="type" />
+      <value type="STRING" field="type" label="Type" />
     </content_type>
 
     <content_type id="InflateCause" hr_name="Inflation Cause"
                   type="U8" jvm_type="INFLATECAUSE">
-      <value type="UTF8" field="cause" label="cause" />
+      <value type="STRING" field="cause" label="Cause" />
     </content_type>
 
     <content_type id="Module" hr_name="Module"
-              type="U8" jvm_type="MODULE">
+                  type="U8" jvm_type="MODULE">
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="SYMBOL" field="version" label="Version"/>
       <value type="SYMBOL" field="location" label="Location"/>
-      <value type="CLASS" field="classLoader" label="ClassLoader"/>
+      <value type="CLASS" field="classLoader" label="Class Loader"/>
     </content_type>
 
     <content_type id="Package" hr_name="Package"
-              type="U8" jvm_type="PACKAGE">
+                  type="U8" jvm_type="PACKAGE">
       <value type="SYMBOL" field="name" label="Name"/>
       <value type="MODULE" field="module" label="Module"/>
       <value type="BOOLEAN" field="exported" label="Exported"/>
@@ -288,8 +288,9 @@
     <primary_type symbol="PERCENTAGE" datatype="FLOAT" contenttype="PERCENTAGE"
                   type="float" sizeop="sizeof(float)"/>
 
-    <!-- UTF8-encoded string, max length Integer.MAX_VALUE -->
-    <primary_type symbol="UTF8" datatype="UTF8" contenttype="NONE"
+    <!-- STRING is a virtual type - depending on encoding
+         it will have polymorphic content -->
+    <primary_type symbol="STRING" datatype="STRING" contenttype="NONE"
                   type="const char*" sizeop="sizeof_utf(%)"/>
 
     <!-- Symbol* constant. Note that this may currently ONLY be used by
@@ -306,7 +307,7 @@
                   type="const ModuleEntry*" sizeop="sizeof(u8)"/>
 
     <primary_type symbol="PACKAGE" datatype="U8" contenttype="PACKAGE"
-              type="const PackageEntry*" sizeop="sizeof(u8)"/>
+                  type="const PackageEntry*" sizeop="sizeof(u8)"/>
 
     <!-- A Method *. The method is marked as "used" and will eventually be
          written into the recording constant pool. -->
@@ -325,8 +326,7 @@
     <!-- Threadgroup THIS TYPE MAY NOT BE USED IN NORMAL EVENTS (ATM). Only
           for thread constant pool // KK TODO: u8 should be ObjectP -->
     <primary_type symbol="THREADGROUP" datatype="U8" contenttype="THREADGROUP"
-                  type="u8"
-                  sizeop="sizeof(u8)"/>
+                  type="u8" sizeop="sizeof(u8)"/>
 
     <!-- FRAMETYPE enum -->
     <primary_type symbol="FRAMETYPE" datatype="U8" contenttype="FRAMETYPE"
@@ -361,39 +361,39 @@
                   type="u8" sizeop="sizeof(u8)" />
 
     <!-- REFERENCETYPE -->
-    <primary_type symbol="REFERENCETYPE" datatype="U8"
-                  contenttype="REFERENCETYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="REFERENCETYPE" datatype="U8" contenttype="REFERENCETYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATATYPE -->
-    <primary_type symbol="METADATATYPE" datatype="U8"
-                  contenttype="METADATATYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="METADATATYPE" datatype="U8" contenttype="METADATATYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- METADATAOBJTYPE -->
-    <primary_type symbol="METASPACEOBJTYPE" datatype="U8"
-                  contenttype="METASPACEOBJTYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="METASPACEOBJTYPE" datatype="U8" contenttype="METASPACEOBJTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- NARROWOOPMODE -->
-    <primary_type symbol="NARROWOOPMODE" datatype="U8"
-                  contenttype="NARROWOOPMODE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="NARROWOOPMODE" datatype="U8" contenttype="NARROWOOPMODE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- COMPILERPHASETYPE -->
-    <primary_type symbol="COMPILERPHASETYPE" datatype="U8"
-                  contenttype="COMPILERPHASETYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="COMPILERPHASETYPE" datatype="U8" contenttype="COMPILERPHASETYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- VMOPERATIONTYPE -->
     <primary_type symbol="VMOPERATIONTYPE" datatype="U8" contenttype="VMOPERATIONTYPE"
                   type="u8" sizeop="sizeof(u8)" />
                   
     <!-- FLAGVALUEORIGIN -->
-    <primary_type symbol="FLAGVALUEORIGIN" datatype="U8"
-                  contenttype="FLAGVALUEORIGIN" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="FLAGVALUEORIGIN" datatype="U8" contenttype="FLAGVALUEORIGIN"
+                  type="u8" sizeop="sizeof(u8)" />
                   
     <!-- CODEBLOBTYPE -->
-    <primary_type symbol="CODEBLOBTYPE" datatype="U8"
-                  contenttype="CODEBLOBTYPE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="CODEBLOBTYPE" datatype="U8" contenttype="CODEBLOBTYPE"
+                  type="u8" sizeop="sizeof(u8)" />
 
     <!-- INFLATECAUSE -->
-    <primary_type symbol="INFLATECAUSE" datatype="U8"
-                  contenttype="INFLATECAUSE" type="u8" sizeop="sizeof(u8)" />
+    <primary_type symbol="INFLATECAUSE" datatype="U8" contenttype="INFLATECAUSE"
+                  type="u8" sizeop="sizeof(u8)" />
   </primary_types>
 </types>
--- a/src/share/vm/utilities/globalDefinitions.hpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Tue Sep 06 22:52:35 2016 +0200
@@ -327,11 +327,12 @@
 // and then additions like
 //       ... top() + size ...
 // are safe because we know that top() is at least size below end().
-inline size_t pointer_delta(const void* left,
-                            const void* right,
+inline size_t pointer_delta(const volatile void* left,
+                            const volatile void* right,
                             size_t element_size) {
   return (((uintptr_t) left) - ((uintptr_t) right)) / element_size;
 }
+
 // A version specialized for HeapWord*'s.
 inline size_t pointer_delta(const HeapWord* left, const HeapWord* right) {
   return pointer_delta(left, right, sizeof(HeapWord));
@@ -516,6 +517,10 @@
   return (void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
 }
 
+inline volatile void* align_ptr_down(volatile void* ptr, size_t alignment) {
+  return (volatile void*)align_size_down((intptr_t)ptr, (intptr_t)alignment);
+}
+
 // Align metaspace objects by rounding up to natural word boundary
 
 inline intptr_t align_metadata_size(intptr_t size) {
--- a/src/share/vm/utilities/internalVMTests.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/utilities/internalVMTests.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -56,12 +56,10 @@
   run_unit_test(CollectedHeap_test);
   run_unit_test(QuickSort_test);
   run_unit_test(GuardedMemory_test);
-  run_unit_test(AltHashing_test);
   run_unit_test(TestNewSize_test);
   run_unit_test(TestOldSize_test);
   run_unit_test(TestKlass_test);
   run_unit_test(TestBitMap_test);
-  run_unit_test(TestAsUtf8);
   run_unit_test(TestResourcehash_test);
   run_unit_test(ObjectMonitor_test);
   run_unit_test(Test_linked_list);
@@ -89,16 +87,12 @@
   run_unit_test(VMStructs_test);
 #endif
 #if INCLUDE_ALL_GCS
-  run_unit_test(TestOldFreeSpaceCalculation_test);
   run_unit_test(TestG1BiasedArray_test);
   run_unit_test(TestBufferingOopClosure_test);
-  run_unit_test(TestCodeCacheRemSet_test);
   if (UseG1GC) {
     run_unit_test(FreeRegionList_test);
     run_unit_test(IHOP_test);
   }
-  run_unit_test(test_memset_with_concurrent_readers);
-  run_unit_test(TestPredictions_test);
   run_unit_test(WorkerDataArray_test);
   run_unit_test(ParallelCompact_test);
 #endif
--- a/src/share/vm/utilities/utf8.cpp	Tue Sep 06 16:29:32 2016 -0400
+++ b/src/share/vm/utilities/utf8.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -547,30 +547,3 @@
 template int UNICODE::quoted_ascii_length<jchar>(jchar* base, int length);
 template void UNICODE::as_quoted_ascii<jbyte>(const jbyte* base, int length, char* buf, int buflen);
 template void UNICODE::as_quoted_ascii<jchar>(const jchar* base, int length, char* buf, int buflen);
-
-
-#ifndef PRODUCT
-void TestAsUtf8() {
-  char res[60];
-  jchar str[20];
-
-  for (int i = 0; i < 20; i++) {
-    str[i] = 0x0800; // char that is 2B in UTF-16 but 3B in UTF-8
-  }
-  str[19] = (jchar)'\0';
-
-  // The resulting string in UTF-8 is 3*19 bytes long, but should be truncated
-  UNICODE::as_utf8(str, 19, res, 10);
-  assert(strlen(res) == 9, "string should be truncated here");
-
-  UNICODE::as_utf8(str, 19, res, 18);
-  assert(strlen(res) == 15, "string should be truncated here");
-
-  UNICODE::as_utf8(str, 19, res, 20);
-  assert(strlen(res) == 18, "string should be truncated here");
-
-  // Test with an "unbounded" buffer
-  UNICODE::as_utf8(str, 19, res, INT_MAX);
-  assert(strlen(res) == 3*19, "string should end here");
-}
-#endif
--- a/test/TEST.groups	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/TEST.groups	Tue Sep 06 22:52:35 2016 +0200
@@ -168,7 +168,6 @@
   runtime/InternalApi/ThreadCpuTimesDeadlock.java \
   runtime/NMT/JcmdSummaryDiff.java \
   runtime/RedefineTests/RedefineAnnotations.java \
-  serviceability/sa/jmap-hashcode/Test8028623.java \
   serviceability/threads/TestFalseDeadLock.java \
   compiler/codecache/jmx \
   compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java \
@@ -407,6 +406,11 @@
   runtime/SelectionResolution \
  -:hotspot_fast_runtime
 
+hotspot_runtime_minimalvm = \
+  runtime/MinimalVM \
+  runtime/ErrorHandling \
+  runtime/logging
+  
 #All tests that depends on nashorn extension.
 #
 needs_nashorn = \
--- a/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/intrinsics/unsafe/TestUnsafeMismatchedArrayFieldAccess.java	Tue Sep 06 22:52:35 2016 +0200
@@ -36,11 +36,11 @@
 package compiler.intrinsics.unsafe;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 public class TestUnsafeMismatchedArrayFieldAccess {
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     static {
         try {
--- a/test/compiler/jsr292/NullConstantReceiver.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jsr292/NullConstantReceiver.java	Tue Sep 06 22:52:35 2016 +0200
@@ -23,9 +23,10 @@
 
 /**
  * @test
- * @bug 8059556
+ * @bug 8059556 8158639
  *
  * @run main/othervm -Xbatch compiler.jsr292.NullConstantReceiver
+ * @run main/othervm -Xbatch -XX:CompileCommand=exclude,*::run compiler.jsr292.NullConstantReceiver
  */
 
 package compiler.jsr292;
--- a/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/CompileCodeTestCase.java	Tue Sep 06 22:52:35 2016 +0200
@@ -107,6 +107,12 @@
     }
 
     public NMethod compile(int level) {
+        String directive = "[{ match: \"" + executable.getDeclaringClass().getName().replace('.', '/')
+                + "." + (executable instanceof Constructor ? "<init>" : executable.getName())
+                + "\", " + "BackgroundCompilation: false }]";
+        if (WB.addCompilerDirective(directive) != 1) {
+            throw new Error("Failed to add compiler directive: " + directive);
+        }
         boolean enqueued = WB.enqueueMethodForCompilation(executable,
                 level, bci);
         if (!enqueued) {
--- a/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -34,8 +34,9 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *
- * @ignore 8139700
- * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox
+ * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @build sun.hotspot.WhiteBox
+ *        compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
--- a/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -45,7 +45,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject;
@@ -114,7 +114,7 @@
         abstract HotSpotResolvedJavaMethod getResolvedJavaMethod();
     }
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
     private static final Field METASPACE_METHOD_FIELD;
     private static final Class<?> TEST_CLASS = GetResolvedJavaMethodTest.class;
--- a/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -53,7 +53,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@@ -154,7 +154,7 @@
         abstract HotSpotResolvedObjectType getResolvedJavaType();
     }
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
     private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
     /* a compressed parameter for tested method is set to false because
--- a/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8136421
- * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
- * @library / /test/lib
- * @library ../common/patches
- * @modules java.base/jdk.internal.misc
- * @modules jdk.vm.ci/jdk.vm.ci.hotspot
- * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
- * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
- *                   compiler.jvmci.compilerToVM.InitializeConfigurationTest
- */
-
-package compiler.jvmci.compilerToVM;
-
-import jdk.test.lib.Asserts;
-import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
-import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
-import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
-
-public class InitializeConfigurationTest {
-    public static void main(String args[]) {
-        new InitializeConfigurationTest().runTest();
-    }
-
-    private void runTest() {
-        TestHotSpotVMConfig config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
-        Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address");
-        Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address");
-    }
-
-    private static class TestHotSpotVMConfig extends HotSpotVMConfigAccess {
-
-        private TestHotSpotVMConfig(HotSpotVMConfigStore store) {
-            super(store);
-        }
-
-        final long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class);
-        final long stubRoutineJintArrayCopy = getFieldValue("StubRoutines::_jint_arraycopy", Long.class);
-    }
-}
--- a/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -35,8 +35,10 @@
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *
- * @ignore 8139700
- * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox
+ * @ignore 8163894
+ * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
+ * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jvmci/compilerToVM/ReadConfigurationTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8136421
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
+ * @library / /test/lib
+ * @library ../common/patches
+ * @modules java.base/jdk.internal.misc
+ * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @build compiler.jvmci.compilerToVM.ReadConfigurationTest
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *                   compiler.jvmci.compilerToVM.ReadConfigurationTest
+ */
+
+package compiler.jvmci.compilerToVM;
+
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime;
+import jdk.vm.ci.hotspot.HotSpotVMConfigAccess;
+import jdk.vm.ci.hotspot.HotSpotVMConfigStore;
+import jdk.vm.ci.hotspot.VMIntrinsicMethod;
+
+public class ReadConfigurationTest {
+    public static void main(String args[]) {
+        new ReadConfigurationTest().runTest();
+    }
+
+    private void runTest() {
+        TestHotSpotVMConfig config = new TestHotSpotVMConfig(HotSpotJVMCIRuntime.runtime().getConfigStore());
+        Asserts.assertNE(config.codeCacheHighBound, 0L, "Got null address");
+        Asserts.assertNE(config.stubRoutineJintArrayCopy, 0L, "Got null address");
+
+        for (VMIntrinsicMethod m : config.getStore().getIntrinsics()) {
+            Asserts.assertNotNull(m);
+            Asserts.assertNotNull(m.declaringClass);
+            Asserts.assertFalse(m.declaringClass.contains("."),
+                "declaringClass should be in class file format: " + m.declaringClass);
+            Asserts.assertNotNull(m.name);
+            Asserts.assertNotNull(m.descriptor);
+            Asserts.assertTrue(m.id > 0);
+        }
+    }
+
+    private static class TestHotSpotVMConfig extends HotSpotVMConfigAccess {
+
+        private TestHotSpotVMConfig(HotSpotVMConfigStore store) {
+            super(store);
+        }
+
+        final long codeCacheHighBound = getFieldValue("CodeCache::_high_bound", Long.class);
+        final long stubRoutineJintArrayCopy = getFieldValue("StubRoutines::_jint_arraycopy", Long.class);
+    }
+}
--- a/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -53,7 +53,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.test.lib.Asserts;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.meta.ConstantPool;
@@ -69,7 +69,7 @@
  */
 public class ResolveFieldInPoolTest {
 
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public static void main(String[] args) throws Exception {
         Map<ConstantTypes, Validator> typeTests = new HashMap<>();
--- a/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -52,6 +52,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.vm.ci.hotspot.CompilerToVMHelper;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
@@ -60,7 +61,7 @@
 import java.util.Set;
 
 public class ResolveMethodTest {
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public static void main(String args[]) {
         ResolveMethodTest test = new ResolveMethodTest();
--- a/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/MaxOopMapStackOffsetTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/NativeCallTest.java	Tue Sep 06 22:52:35 2016 +0200
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /test/lib /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
--- a/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Tue Sep 06 22:52:35 2016 +0200
@@ -33,19 +33,16 @@
 
 package jdk.vm.ci.runtime.test;
 
-import jdk.vm.ci.meta.ConstantPool;
-import jdk.vm.ci.meta.ExceptionHandler;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-import jdk.vm.ci.meta.ResolvedJavaType;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.lang.annotation.Annotation;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.lang.invoke.MethodHandle;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Member;
 import java.lang.reflect.Method;
@@ -57,10 +54,13 @@
 import java.util.Map;
 import java.util.Set;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
+import org.junit.Test;
+
+import jdk.vm.ci.meta.ConstantPool;
+import jdk.vm.ci.meta.ExceptionHandler;
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+import jdk.vm.ci.meta.ResolvedJavaType;
 
 /**
  * Tests for {@link ResolvedJavaMethod}.
@@ -407,20 +407,6 @@
         }
     }
 
-    @Test
-    public void isSignaturePolymorphicTest() {
-        ResolvedJavaType methodHandleType = metaAccess.lookupJavaType(MethodHandle.class);
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "invokeExact", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "invoke", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "invokeBasic", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "linkToVirtual", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "linkToStatic", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "linkToSpecial", metaAccess));
-        assertTrue(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "linkToInterface", metaAccess));
-        assertFalse(ResolvedJavaMethod.isSignaturePolymorphic(methodHandleType, "type", metaAccess));
-        assertFalse(ResolvedJavaMethod.isSignaturePolymorphic(metaAccess.lookupJavaType(Object.class), "toString", metaAccess));
-    }
-
     /**
      * All public non-final methods should be available in the vtable.
      */
--- a/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/loopopts/superword/TestVectorizationWithInvariant.java	Tue Sep 06 22:52:35 2016 +0200
@@ -34,7 +34,7 @@
 package compiler.loopopts.superword;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 public class TestVectorizationWithInvariant {
 
@@ -43,7 +43,7 @@
     private static final long CHAR_ARRAY_OFFSET;
 
     static {
-        unsafe = Utils.getUnsafe();
+        unsafe = UnsafeHelper.getUnsafe();
         BYTE_ARRAY_OFFSET = unsafe.arrayBaseOffset(byte[].class);
         CHAR_ARRAY_OFFSET = unsafe.arrayBaseOffset(char[].class);
     }
--- a/test/compiler/profiling/spectrapredefineclass/Launcher.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/profiling/spectrapredefineclass/Launcher.java	Tue Sep 06 22:52:35 2016 +0200
@@ -40,7 +40,7 @@
 package compiler.profiling.spectrapredefineclass;
 
 import jdk.test.lib.JDKToolLauncher;
-import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
 
 import java.io.File;
 import java.io.IOException;
--- a/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Tue Sep 06 22:52:35 2016 +0200
@@ -43,7 +43,7 @@
 package compiler.profiling.spectrapredefineclass_classloaders;
 
 import jdk.test.lib.JDKToolLauncher;
-import jdk.test.lib.OutputAnalyzer;
+import jdk.test.lib.process.OutputAnalyzer;
 
 import java.io.File;
 import java.io.IOException;
--- a/test/compiler/rtm/locking/TestRTMAbortRatio.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/rtm/locking/TestRTMAbortRatio.java	Tue Sep 06 22:52:35 2016 +0200
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -125,7 +125,7 @@
     public static class Test implements CompilableTest {
         private static final int TOTAL_ITERATIONS = 10000;
         private static final int WARMUP_ITERATIONS = 1000;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
--- a/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Tue Sep 06 22:52:35 2016 +0200
@@ -51,7 +51,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -158,7 +158,7 @@
         private static int field = 0;
         private static final int ITERATIONS = 10000;
         private static final int RANGE_CHECK_AT = ITERATIONS / 2;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
         @Override
--- a/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Tue Sep 06 22:52:35 2016 +0200
@@ -48,7 +48,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -133,7 +133,7 @@
     }
 
     public static class Test implements CompilableTest {
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
         @Override
--- a/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Tue Sep 06 22:52:35 2016 +0200
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -142,7 +142,7 @@
         @SuppressWarnings("UnsuedDeclaration")
         private static int field = 0;
         private static final int TOTAL_ITERATIONS = 10000;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
 
 
--- a/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Tue Sep 06 22:52:35 2016 +0200
@@ -49,7 +49,7 @@
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.test.lib.cli.CommandLineOptionTest;
 import jdk.test.lib.cli.predicate.AndPredicate;
 
@@ -113,7 +113,7 @@
 
     public static class Test implements CompilableTest {
         private static final long TOTAL_ITERATIONS = 10000L;
-        private static final Unsafe UNSAFE = Utils.getUnsafe();
+        private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
         private final Object monitor = new Object();
         // Following field have to be static in order to avoid escape analysis.
         @SuppressWarnings("UnsuedDeclaration")
--- a/test/compiler/testlibrary/rtm/XAbortProvoker.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/testlibrary/rtm/XAbortProvoker.java	Tue Sep 06 22:52:35 2016 +0200
@@ -25,7 +25,7 @@
 package compiler.testlibrary.rtm;
 
 import jdk.internal.misc.Unsafe;
-import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 /**
  * Current RTM locking implementation force transaction abort
@@ -35,7 +35,7 @@
     // Following field have to be static in order to avoid escape analysis.
     @SuppressWarnings("UnsuedDeclaration")
     private static int field = 0;
-    private static final Unsafe UNSAFE = Utils.getUnsafe();
+    private static final Unsafe UNSAFE = UnsafeHelper.getUnsafe();
 
     public XAbortProvoker() {
         this(new Object());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/unsafe/MixedUnsafeStoreObject.java	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8155635
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation compiler.unsafe.MixedUnsafeStoreObject
+ * @run main/othervm -Xbatch compiler.unsafe.MixedUnsafeStoreObject
+ */
+
+package compiler.unsafe;
+
+import jdk.internal.misc.Unsafe;
+
+public class MixedUnsafeStoreObject {
+    static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    static final long F_OFFSET;
+
+    static {
+        try {
+            F_OFFSET = UNSAFE.objectFieldOffset(T.class.getDeclaredField("f"));
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+
+    static class T {
+        Object f;
+    }
+
+    public static void testFieldInstanceObject(Object t) {
+        for (int c = 0; c < 20000; c++) { // trigger OSR compilation
+            // java/lang/Object+12 *
+            // _base = InstPtr, _ptr = BotPTR, _field = NULL, mismatched = true
+            UNSAFE.putObject(t, F_OFFSET, "foo");
+        }
+    }
+
+    public static void testFieldInstanceT(T t) {
+        for (int c = 0; c < 20000; c++) { // trigger OSR compilation
+            // ...$T+12 *
+            // _base = InstPtr, _ptr = BotPTR, _field = T.f, mismatched = false
+            UNSAFE.putObject(t, F_OFFSET, "foo");
+        }
+    }
+    public static void main(String[] args) {
+        testFieldInstanceObject(new T());
+        testFieldInstanceT(new T());
+    }
+}
+
--- a/test/compiler/unsafe/OpaqueAccesses.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/unsafe/OpaqueAccesses.java	Tue Sep 06 22:52:35 2016 +0200
@@ -30,6 +30,22 @@
  *
  * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
  *                                 -XX:-TieredCompilation -Xbatch
+ *                                 -XX:+UseCompressedOops -XX:+UseCompressedClassPointers
+ *                                 -XX:CompileCommand=dontinline,compiler.unsafe.OpaqueAccesses::test*
+ *                                 compiler.unsafe.OpaqueAccesses
+ * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                                 -XX:-TieredCompilation -Xbatch
+ *                                 -XX:+UseCompressedOops -XX:-UseCompressedClassPointers
+ *                                 -XX:CompileCommand=dontinline,compiler.unsafe.OpaqueAccesses::test*
+ *                                 compiler.unsafe.OpaqueAccesses
+ * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                                 -XX:-TieredCompilation -Xbatch
+ *                                 -XX:-UseCompressedOops -XX:+UseCompressedClassPointers
+ *                                 -XX:CompileCommand=dontinline,compiler.unsafe.OpaqueAccesses::test*
+ *                                 compiler.unsafe.OpaqueAccesses
+ * @run main/bootclasspath/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                                 -XX:-TieredCompilation -Xbatch
+ *                                 -XX:-UseCompressedOops -XX:-UseCompressedClassPointers
  *                                 -XX:CompileCommand=dontinline,compiler.unsafe.OpaqueAccesses::test*
  *                                 compiler.unsafe.OpaqueAccesses
  */
@@ -61,6 +77,7 @@
     }
 
     private Object f = new Object();
+    private long l1, l2;
 
     static Object testFixedOffsetField(Object o) {
         return UNSAFE.getObject(o, F_OFFSET);
@@ -74,6 +91,22 @@
         return UNSAFE.getInt(o, 4);
     }
 
+    static int testFixedOffsetHeader8(Object o) {
+        return UNSAFE.getInt(o, 8);
+    }
+
+    static int testFixedOffsetHeader12(Object o) {
+        return UNSAFE.getInt(o, 12);
+    }
+
+    static int testFixedOffsetHeader16(Object o) {
+        return UNSAFE.getInt(o, 16);
+    }
+
+    static int testFixedOffsetHeader17(Object o) {
+        return UNSAFE.getIntUnaligned(o, 17);
+    }
+
     static Object testFixedBase(long off) {
         return UNSAFE.getObject(INSTANCE, off);
     }
@@ -90,6 +123,22 @@
         return UNSAFE.getInt(arr, 4);
     }
 
+    static int testFixedOffsetHeaderArray8(Object[] arr) {
+        return UNSAFE.getInt(arr, 8);
+    }
+
+    static int testFixedOffsetHeaderArray12(Object[] arr) {
+        return UNSAFE.getInt(arr, 12);
+    }
+
+    static int testFixedOffsetHeaderArray16(Object[] arr) {
+        return UNSAFE.getInt(arr, 16);
+    }
+
+    static int testFixedOffsetHeaderArray17(Object[] arr) {
+        return UNSAFE.getIntUnaligned(arr, 17);
+    }
+
     static Object testFixedOffsetArray(Object[] arr) {
         return UNSAFE.getObject(arr, E_OFFSET);
     }
@@ -118,6 +167,10 @@
             testFixedOffsetField(INSTANCE);
             testFixedOffsetHeader0(INSTANCE);
             testFixedOffsetHeader4(INSTANCE);
+            testFixedOffsetHeader8(INSTANCE);
+            testFixedOffsetHeader12(INSTANCE);
+            testFixedOffsetHeader16(INSTANCE);
+            testFixedOffsetHeader17(INSTANCE);
             testFixedBase(F_OFFSET);
             testOpaque(INSTANCE, F_OFFSET);
             testMixedAccess();
@@ -125,6 +178,10 @@
             // Array
             testFixedOffsetHeaderArray0(ARRAY);
             testFixedOffsetHeaderArray4(ARRAY);
+            testFixedOffsetHeaderArray8(ARRAY);
+            testFixedOffsetHeaderArray12(ARRAY);
+            testFixedOffsetHeaderArray16(ARRAY);
+            testFixedOffsetHeaderArray17(ARRAY);
             testFixedOffsetArray(ARRAY);
             testFixedBaseArray(E_OFFSET);
             testOpaqueArray(ARRAY, E_OFFSET);
--- a/test/compiler/unsafe/UnsafeRaw.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/compiler/unsafe/UnsafeRaw.java	Tue Sep 06 22:52:35 2016 +0200
@@ -35,6 +35,7 @@
 
 import jdk.internal.misc.Unsafe;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 
 import java.util.Random;
 
@@ -81,7 +82,7 @@
   }
 
   public static void main(String[] args) throws Exception {
-    Unsafe unsafe = Utils.getUnsafe();
+    Unsafe unsafe = UnsafeHelper.getUnsafe();
     final int array_size = 128;
     final int element_size = 4;
     final int magic = 0x12345678;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/TestAgeOutput.java	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestAgeOutput
+ * @bug 8164936
+ * @summary Check that collectors using age table based aging print an age table even for the first garbage collection
+ * @key gc
+ * @requires vm.gc=="null"
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -XX:+UseSerialGC TestAgeOutput UseSerialGC
+ * @run main/othervm -XX:+UseConcMarkSweepGC TestAgeOutput UseConcMarkSweepGC
+ * @run main/othervm -XX:+UseG1GC TestAgeOutput UseG1GC
+ */
+
+import sun.hotspot.WhiteBox;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+import static jdk.test.lib.Asserts.*;
+
+public class TestAgeOutput {
+
+    public static void checkPattern(String pattern, String what) throws Exception {
+        Pattern r = Pattern.compile(pattern);
+        Matcher m = r.matcher(what);
+
+        if (!m.find()) {
+            throw new RuntimeException("Could not find pattern " + pattern + " in output");
+        }
+    }
+
+    public static void runTest(String gcArg) throws Exception {
+        final String[] arguments = {
+            "-Xbootclasspath/a:.",
+            "-XX:+UnlockExperimentalVMOptions",
+            "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:+WhiteBoxAPI",
+            "-XX:+" + gcArg,
+            "-Xmx10M",
+            "-Xlog:gc+age=trace",
+            GCTest.class.getName()
+            };
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(arguments);
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+        output.shouldHaveExitValue(0);
+
+        System.out.println(output.getStdout());
+
+        String stdout = output.getStdout();
+
+        checkPattern(".*GC\\(0\\) .*Desired survivor size.*", stdout);
+        checkPattern(".*GC\\(0\\) .*Age table with threshold.*", stdout);
+        checkPattern(".*GC\\(0\\) .*- age   1:.*", stdout);
+    }
+
+    public static void main(String[] args) throws Exception {
+        runTest(args[0]);
+    }
+
+    static class GCTest {
+        private static final WhiteBox WB = WhiteBox.getWhiteBox();
+
+        public static Object holder;
+
+        public static void main(String [] args) {
+            holder = new byte[100];
+            WB.youngGC();
+            System.out.println(holder);
+        }
+    }
+}
+
--- a/test/gc/TestCardTablePageCommits.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestCardTablePageCommits.java	Tue Sep 06 22:52:35 2016 +0200
@@ -34,7 +34,6 @@
  * @requires vm.gc.Parallel
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  * @run driver TestCardTablePageCommits
  */
 public class TestCardTablePageCommits {
--- a/test/gc/TestObjectAlignment.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestObjectAlignment.java	Tue Sep 06 22:52:35 2016 +0200
@@ -28,7 +28,6 @@
  * @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32
--- a/test/gc/TestSmallHeap.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestSmallHeap.java	Tue Sep 06 22:52:35 2016 +0200
@@ -28,7 +28,6 @@
  * @summary Verify that starting the VM with a small heap works
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- * @modules java.management/sun.management
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestSmallHeap
--- a/test/gc/TestSoftReferencesBehaviorOnOOME.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestSoftReferencesBehaviorOnOOME.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k
--- a/test/gc/TestVerifyDuringStartup.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestVerifyDuringStartup.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
  * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  */
 
 import jdk.test.lib.JDKToolFinder;
--- a/test/gc/TestVerifySilently.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestVerifySilently.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
  * @summary Test silent verification.
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  */
 
 import jdk.test.lib.process.ProcessTools;
--- a/test/gc/TestVerifySubSet.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/TestVerifySubSet.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,7 +27,6 @@
  * @summary Test VerifySubSet option
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  */
 
 import jdk.test.lib.process.ProcessTools;
--- a/test/gc/arguments/TestAlignmentToUseLargePages.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/arguments/TestAlignmentToUseLargePages.java	Tue Sep 06 22:52:35 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,16 +29,16 @@
  * @key gc
  * @key regression
  * @requires vm.gc=="null"
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms7M -Xmx9M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
  */
 
 public class TestAlignmentToUseLargePages {
--- a/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/arguments/TestMaxMinHeapFreeRatioFlags.java	Tue Sep 06 22:52:35 2016 +0200
@@ -37,6 +37,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import jdk.internal.misc.Unsafe;
 
 public class TestMaxMinHeapFreeRatioFlags {
@@ -133,7 +134,7 @@
      */
     public static class RatioVerifier {
 
-        private static final Unsafe unsafe = Utils.getUnsafe();
+        private static final Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Size of byte array that will be allocated
         public static final int CHUNK_SIZE = 1024;
--- a/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Tue Sep 06 22:52:35 2016 +0200
@@ -46,6 +46,7 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.Utils;
+import jdk.test.lib.unsafe.UnsafeHelper;
 import sun.hotspot.WhiteBox;
 
 /* In order to test that TargetSurvivorRatio affects survivor space occupancy
@@ -248,7 +249,7 @@
     public static class TargetSurvivorRatioVerifier {
 
         static final WhiteBox wb = WhiteBox.getWhiteBox();
-        static final Unsafe unsafe = Utils.getUnsafe();
+        static final Unsafe unsafe = UnsafeHelper.getUnsafe();
 
         // Desired size of memory allocated at once
         public static final int CHUNK_SIZE = 1024;
--- a/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/arguments/TestVerifyBeforeAndAfterGCFlags.java	Tue Sep 06 22:52:35 2016 +0200
@@ -43,12 +43,12 @@
 
 public class TestVerifyBeforeAndAfterGCFlags {
 
-    // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ]
+    // VerifyBeforeGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ]
     public static final String VERIFY_BEFORE_GC_PATTERN = "Verifying Before GC";
     // VerifyBeforeGC: VerifyBeforeGC: VerifyBeforeGC:
     public static final String VERIFY_BEFORE_GC_CORRUPTED_PATTERN = "VerifyBeforeGC:(?!\\[Verifying[^]]+\\])";
 
-    // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand C-heap code cache ]
+    // VerifyAfterGC:[Verifying threads heap tenured eden syms strs zone dict metaspace chunks hand code cache ]
     public static final String VERIFY_AFTER_GC_PATTERN = "Verifying After GC";
     // VerifyAfterGC: VerifyAfterGC: VerifyAfterGC:
     public static final String VERIFY_AFTER_GC_CORRUPTED_PATTERN = "VerifyAfterGC:(?!\\[Verifying[^]]+\\])";
--- a/test/gc/cms/TestBubbleUpRef.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/cms/TestBubbleUpRef.java	Tue Sep 06 22:52:35 2016 +0200
@@ -35,7 +35,7 @@
  *          stays nearly full.
  * @run main/othervm
  *  -XX:+UseConcMarkSweepGC -XX:-CMSYield -XX:-CMSPrecleanRefLists1
- *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx8m TestBubbleUpRef 16000 50 10000
+ *  -XX:CMSInitiatingOccupancyFraction=0 -Xmx80m TestBubbleUpRef 16000 50 10000
  */
 
 /**
@@ -53,7 +53,7 @@
  * Do it again.
  *
  * Use the following VM options
- *     -Xmx8m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
+ *     -Xmx80m -XX:-CMSYield [-XX:+UseConcMarkSweepGC] -XX:-CMSPrecleanRefLists1
  *      -XX:CMSInitiatingOccupancyFraction=0
  *
  * Use parameter:
--- a/test/gc/g1/TestEagerReclaimHumongousRegions.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestEagerReclaimHumongousRegions.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,6 +27,7 @@
  * @summary Test to make sure that eager reclaim of humongous objects work. We simply try to fill
  * up the heap with humongous objects that should be eagerly reclaimable to avoid Full GC.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,6 +27,7 @@
  * @summary Test to make sure that eager reclaim of humongous objects correctly clears
  * mark bitmaps at reclaim.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java	Tue Sep 06 22:52:35 2016 +0200
@@ -30,6 +30,7 @@
  * referencing that we know is in the old gen. After changing this reference, the object
  * should still be eagerly reclaimable to avoid Full GC.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,6 +27,7 @@
  * @summary Ensure that the output for a G1TraceEagerReclaimHumongousObjects
  * includes the expected necessary messages.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestGCLogMessages.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestGCLogMessages.java	Tue Sep 06 22:52:35 2016 +0200
@@ -27,6 +27,7 @@
  * @summary Ensure the output for a minor GC with G1
  * includes the expected necessary messages.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestHumongousAllocInitialMark.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestHumongousAllocInitialMark.java	Tue Sep 06 22:52:35 2016 +0200
@@ -25,6 +25,7 @@
  * @test TestHumongousAllocInitialMark
  * @bug 7168848
  * @summary G1: humongous object allocations should initiate marking cycles when necessary
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestHumongousAllocNearlyFullRegion.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestHumongousAllocNearlyFullRegion.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @bug 8143587
  * @summary G1: humongous object allocations should work even when there is
  *              not enough space in the heapRegion to fit a filler object.
+ * @requires vm.gc.G1
  * @modules java.base/jdk.internal.misc
  * @library /test/lib
  * @run driver TestHumongousAllocNearlyFullRegion
--- a/test/gc/g1/TestHumongousCodeCacheRoots.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestHumongousCodeCacheRoots.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @key regression
  * @key gc
  * @bug 8027756
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @key gc
  * @bug 8014240
  * @summary Test output of G1PrintRegionRememberedSetInfo
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationAgeThreshold.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationAgeThreshold.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication age threshold
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationFullGC.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationFullGC.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication during full GC
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationInterned.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationInterned.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication of interned strings
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationPrintOptions.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationPrintOptions.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication print options
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationTableRehash.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationTableRehash.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication table rehash
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationTableResize.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationTableResize.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication table resize
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringDeduplicationYoungGC.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringDeduplicationYoungGC.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @summary Test string deduplication during young GC
  * @bug 8029075
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/g1/TestStringSymbolTableStats.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/g1/TestStringSymbolTableStats.java	Tue Sep 06 22:52:35 2016 +0200
@@ -26,6 +26,7 @@
  * @bug 8027476 8027455
  * @summary Ensure that the G1TraceStringSymbolTableScrubbing prints the expected message.
  * @key gc
+ * @requires vm.gc.G1
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/gc/serial/HeapChangeLogging.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/serial/HeapChangeLogging.java	Tue Sep 06 22:52:35 2016 +0200
@@ -24,9 +24,9 @@
 /*
  * @test HeapChangeLogging.java
  * @bug 8027440
+ * @requires vm.gc.Serial
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
- *          java.management
  * @summary Allocate to get a promotion failure and verify that that heap change logging is present.
  * @run main HeapChangeLogging
  */
--- a/test/gc/testlibrary/Helpers.java	Tue Sep 06 16:29:32 2016 -0400
+++ b/test/gc/testlibrary/Helpers.java	Tue Sep 06 22:52:35 2016 +0200
@@ -32,7 +32,6 @@
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 
 public class Helpers {
 
@@ -124,20 +123,13 @@
      */
     public static String generate(String className, String superClass, String constructor, long fieldCount) {
 
-        StringBuilder builder = new StringBuilder();
-        builder.append(String.format("public class %s%s {\n", className, superClass == null ? ""
-                : " extends " + superClass));
-
-        if (constructor != null) {
-            builder.append(constructor);
-        }
-
-        for (int i = 0; i < fieldCount; ++i) {
-            builder.append(String.format("long f%d;\n", i));
-        }
-
-        builder.append("}\n");
-        return builder.toString();
+        return new StringBuilder()
+                .append(String.format("public class %s%s {\n", className, superClass == null ? ""
+                        : " extends " + superClass))
+                .append(constructor == null ? "" : constructor)
+                .append(fieldsGenerator(fieldCount))
+                .append("}\n")
+                .toString();
     }
 
     /**
@@ -212,50 +204,9 @@
                                                   Path workDir, String prefix)
             throws IOException, ClassNotFoundException {
 
-        if (instanceSize % SIZE_OF_LONG != 0L) {
-            throw new Error(String.format("Test bug: only sizes aligned by 8 bytes are supported and %d was specified",
-                    instanceSize));
-        }
+        generateByTemplateAndCompile(className, null, "public class ${ClassName} extends ${BaseClass} {\n${Fields}}\n",
+                "", instanceSize, workDir, prefix);
 
-        long instanceSizeWithoutObjectHeader = instanceSize - WhiteBox.getWhiteBox().getObjectSize(new Object());
-
-        int generatedClassesCount;
-        int fieldsInLastClassCount;
-
-        int sizeOfLastFile = (int) (instanceSizeWithoutObjectHeader
-                % (MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS * SIZE_OF_LONG));
-
-        if (sizeOfLastFile != 0) {
-            generatedClassesCount = (int) instanceSizeWithoutObjectHeader
-                    / (MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS * SIZE_OF_LONG) + 1;
-            fieldsInLastClassCount = sizeOfLastFile / SIZE_OF_LONG;
-        } else {
-            generatedClassesCount = (int) instanceSizeWithoutObjectHeader
-                    / (MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS * SIZE_OF_LONG);
-            fieldsInLastClassCount = MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS;
-        }
-
-        for (int i = 0; i < generatedClassesCount; i++) {
-            // for the last generated class we use specified class name
-            String clsName = (i == generatedClassesCount - 1) ? className : prefix + i;
-
-            // If we already have a file with the same name we do not create it again
-            if (Files.notExists(Paths.get(clsName + ".java"))) {
-                Helpers.compileClass(clsName, workDir,
-                        Helpers.generate(
-                                clsName,
-                                // for first generated class we don't have 'extends'
-                                (i == 0 ? null : prefix + (i - 1)),
-                                null,
-                                // for the last generated class we use different field count
-                                (i == generatedClassesCount - 1) ? fieldsInLastClassCount
-                                        : MAXIMUM_AMOUNT_OF_FIELDS_IN_CLASS));
-            } else {
-                System.out.println("Class " + clsName +
-                        ".java already exists, skipping class' generation and compilation");
-            }
-
-        }
         return classLoader.loadClass(className);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/native/classfile/test_AltHashing.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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/altHashing.hpp"
+#include "unittest.hpp"
+
+// Internal test for alternate hashing.  Translated from JDK version
+// test/sun/misc/Hashing.java
+static const jbyte ONE_BYTE[] = {(jbyte) 0x80};
+static const jbyte TWO_BYTE[] = {(jbyte) 0x80, (jbyte) 0x81};
+static const jchar ONE_CHAR[] = {(jchar) 0x8180};
+static const jbyte THREE_BYTE[] = {(jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82};
+static const jbyte FOUR_BYTE[] = {(jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83};
+static const jchar TWO_CHAR[] = {(jchar) 0x8180, (jchar) 0x8382};
+static const jint ONE_INT[] = {(jint) 0x83828180};
+static const jbyte SIX_BYTE[] = {(jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85};
+static const jchar THREE_CHAR[] = {(jchar) 0x8180, (jchar) 0x8382, (jchar) 0x8584};
+static const jbyte EIGHT_BYTE[] = {
+  (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82,
+  (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85,
+  (jbyte) 0x86, (jbyte) 0x87
+};
+static const jchar FOUR_CHAR[] = {
+  (jchar) 0x8180, (jchar) 0x8382,
+  (jchar) 0x8584, (jchar) 0x8786
+};
+
+static const jint TWO_INT[] = {(jint) 0x83828180, (jint) 0x87868584};
+static const juint MURMUR3_32_X86_CHECK_VALUE = 0xB0F57EE3;
+
+class AltHashingTest : public ::testing::Test {
+ public:
+
+  static juint murmur3_32(const int* data, int len) {
+    return AltHashing::murmur3_32(data, len);
+  }
+};
+
+TEST_F(AltHashingTest, murmur3_32_byte_array_test) {
+  jbyte vector[256];
+  jbyte hashes[4 * 256];
+
+  for (int i = 0; i < 256; i++) {
+    vector[i] = (jbyte) i;
+  }
+
+  // Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255}
+  for (int i = 0; i < 256; i++) {
+    juint hash = AltHashing::murmur3_32(256 - i, vector, i);
+    hashes[i * 4] = (jbyte) hash;
+    hashes[i * 4 + 1] = (jbyte) (hash >> 8);
+    hashes[i * 4 + 2] = (jbyte) (hash >> 16);
+    hashes[i * 4 + 3] = (jbyte) (hash >> 24);
+  }
+
+  // hash to get const result.
+  juint final_hash = AltHashing::murmur3_32(0, hashes, 4 * 256);
+
+  ASSERT_EQ(MURMUR3_32_X86_CHECK_VALUE, final_hash)
+          << "Calculated hash result not as expected.";
+}
+
+TEST_F(AltHashingTest, equivalent_hashes_test) {
+  juint jbytes, jchars, ints;
+
+  jbytes = AltHashing::murmur3_32(0, TWO_BYTE, 2);
+  jchars = AltHashing::murmur3_32(0, ONE_CHAR, 1);
+  ASSERT_EQ(jbytes, jchars) << "Hashes did not match.";
+
+  jbytes = AltHashing::murmur3_32(0, FOUR_BYTE, 4);
+  jchars = AltHashing::murmur3_32(0, TWO_CHAR, 2);
+  ints = AltHashingTest::murmur3_32(ONE_INT, 1);
+
+  ASSERT_EQ(jbytes, jchars) << "Hashes did not match.";
+  ASSERT_EQ(jbytes, ints) << "Hashes did not match.";
+
+  jbytes = AltHashing::murmur3_32(0, SIX_BYTE, 6);
+  jchars = AltHashing::murmur3_32(0, THREE_CHAR, 3);
+  ASSERT_EQ(jbytes, jchars) << "Hashes did not match.";
+
+  jbytes = AltHashing::murmur3_32(0, EIGHT_BYTE, 8);
+  jchars = AltHashing::murmur3_32(0, FOUR_CHAR, 4);
+  ints = AltHashingTest::murmur3_32(TWO_INT, 2);
+
+  ASSERT_EQ(jbytes, jchars) << "Hashes did not match.";
+  ASSERT_EQ(jbytes, ints) << "Hashes did not match.";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/native/gc/g1/test_g1CodeCacheRemSet.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "gc/g1/g1CodeRootSetTable.hpp"
+#include "gc/g1/g1CodeCacheRemSet.hpp"
+#include "unittest.hpp"
+
+class G1CodeRootSetTest : public ::testing::Test {
+ public:
+
+  size_t threshold() {
+    return G1CodeRootSet::Threshold;
+  }
+
+  G1CodeRootSetTable* purge_list() {
+    return G1CodeRootSetTable::_purge_list;
+  }
+};
+
+TEST_VM_F(G1CodeRootSetTest, g1_code_cache_rem_set) {
+  G1CodeRootSet root_set;
+
+  ASSERT_TRUE(root_set.is_empty()) << "Code root set must be initially empty "
+          "but is not.";
+
+  ASSERT_EQ(G1CodeRootSet::static_mem_size(), sizeof (void*)) <<
+          "The code root set's static memory usage is incorrect, "
+          << G1CodeRootSet::static_mem_size() << " bytes";
+
+  root_set.add((nmethod*) 1);
+  ASSERT_EQ(root_set.length(), (size_t) 1) << "Added exactly one element, but"
+          " set contains " << root_set.length() << " elements";
+
+  const size_t num_to_add = (size_t) threshold() + 1;
+
+  for (size_t i = 1; i <= num_to_add; i++) {
+    root_set.add((nmethod*) 1);
+  }
+  ASSERT_EQ(root_set.length(), (size_t) 1)
+          << "Duplicate detection should not have increased the set size but "
+          << "is " << root_set.length();
+
+  for (size_t i = 2; i <= num_to_add; i++) {
+    root_set.add((nmethod*) (uintptr_t) (i));
+  }
+
+  ASSERT_EQ(root_set.length(), num_to_add)
+          << "After adding in total " << num_to_add << " distinct code roots, "
+          "they need to be in the set, but there are only " << root_set.length();
+
+  ASSERT_NE(purge_list(), (G1CodeRootSetTable*) NULL)
+          << "should have grown to large hashtable";
+
+  size_t num_popped = 0;
+  for (size_t i = 1; i <= num_to_add; i++) {
+    bool removed = root_set.remove((nmethod*) i);
+    if (removed) {
+      num_popped += 1;
+    } else {
+      break;
+    }
+  }
+  ASSERT_EQ(num_popped, num_to_add)
+          << "Managed to pop " << num_popped << " code roots, but only "
+          << num_to_add << " were added";
+  ASSERT_NE(purge_list(), (G1CodeRootSetTable*) NULL)
+          << "should have grown to large hashtable";
+
+  G1CodeRootSet::purge();
+
+  ASSERT_EQ(purge_list(), (G1CodeRootSetTable*) NULL)
+          << "should have purged old small tables";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/native/gc/g1/test_g1Predictions.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "gc/g1/g1Predictions.hpp"
+#include "unittest.hpp"
+
+static const double epsilon = 1e-6;
+
+// Some basic formula tests with confidence = 0.0
+TEST_VM(G1Predictions, basic_predictions) {
+  G1Predictions predictor(0.0);
+  TruncatedSeq s;
+
+  double p0 = predictor.get_new_prediction(&s);
+  ASSERT_LT(p0, epsilon) << "Initial prediction of empty sequence must be 0.0";
+
+  s.add(5.0);
+  double p1 = predictor.get_new_prediction(&s);
+  ASSERT_NEAR(p1, 5.0, epsilon);
+
+  for (int i = 0; i < 40; i++) {
+    s.add(5.0);
+  }
+  double p2 = predictor.get_new_prediction(&s);
+  ASSERT_NEAR(p2, 5.0, epsilon);
+}
+
+// The following tests checks that the initial predictions are based on
+// the average of the sequence and not on the stddev (which is 0).
+TEST_VM(G1Predictions, average_not_stdev_predictions) {
+  G1Predictions predictor(0.5);
+  TruncatedSeq s;
+
+  s.add(1.0);
+  double p1 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p1, s.davg()) << "First prediction must be greater than average";
+
+  s.add(1.0);
+  double p2 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p1, p2) << "First prediction must be greater than second";
+
+  s.add(1.0);
+  double p3 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p2, p3) << "Second prediction must be greater than third";
+
+  s.add(1.0);
+  s.add(1.0); // Five elements are now in the sequence.
+  double p4 = predictor.get_new_prediction(&s);
+  ASSERT_LT(p4, p3) << "Fourth prediction must be smaller than third";
+  ASSERT_NEAR(p4, 1.0, epsilon);
+}
+
+// The following tests checks that initially prediction based on
+// the average is used, that gets overridden by the stddev prediction at
+// the end.
+TEST_VM(G1Predictions, average_stdev_predictions) {
+  G1Predictions predictor(0.5);
+  TruncatedSeq s;
+
+  s.add(0.5);
+  double p1 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p1, s.davg()) << "First prediction must be greater than average";
+
+  s.add(0.2);
+  double p2 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p1, p2) << "First prediction must be greater than second";
+
+  s.add(0.5);
+  double p3 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p2, p3) << "Second prediction must be greater than third";
+
+  s.add(0.2);
+  s.add(2.0);
+  double p4 = predictor.get_new_prediction(&s);
+  ASSERT_GT(p4, p3) << "Fourth prediction must be greater than third";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/native/gc/parallel/test_psAdaptiveSizePolicy.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 "utilities/macros.hpp"
+#include "gc/parallel/psAdaptiveSizePolicy.hpp"
+#include "unittest.hpp"
+
+#if INCLUDE_ALL_GCS
+
+  TEST_VM(gc, oldFreeSpaceCalculation) {
+
+    struct TestCase {
+        size_t live;
+        uintx ratio;
+        size_t expectedResult;
+    };
+
+    TestCase test_cases[] = {
+                                {100, 20, 25},
+                                {100, 50, 100},
+                                {100, 60, 150},
+                                {100, 75, 300},
+                                {400, 20, 100},
+                                {400, 50, 400},
+                                {400, 60, 600},
+                                {400, 75, 1200},
+                            };
+
+    size_t array_len = sizeof(test_cases) / sizeof(TestCase);
+    for (size_t i = 0; i < array_len; ++i) {
+      ASSERT_EQ(PSAdaptiveSizePolicy::calculate_free_based_on_live(
+          test_cases[i].live, test_cases[i].ratio),
+          test_cases[i].expectedResult)
+          << " Calculation of free memory failed"
+          << " - Test case " << i << ": live = " << test_cases[i].live
+          << "; ratio = " << test_cases[i].ratio;
+    }
+  }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/native/gc/shared/test_memset_with_concurrent_readers.cpp	Tue Sep 06 22:52:35 2016 +0200
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 <string.h>
+#include "utilities/globalDefinitions.hpp"
+#include <sstream>
+#include "gc/shared/memset_with_concurrent_readers.hpp"
+#include "unittest.hpp"
+
+#if INCLUDE_ALL_GCS
+
+static unsigned line_byte(const char* line, size_t i) {
+  return unsigned(line[i]) & 0xFF;
+}
+
+TEST(gc, memset_with_concurrent_readers) {
+  const size_t chunk_size = 8 * BytesPerWord;
+  const unsigned chunk_count = 4;
+  const size_t block_size = (chunk_count + 4) * chunk_size;
+  char block[block_size];
+  char clear_block[block_size];
+  char set_block[block_size];
+
+  // block format:
+  // 0: unused leading chunk
+  // 1: chunk written from start index to end of chunk
+  // ... nchunks full