changeset 34236:4558141028a9

Merge
author jwilhelm
date Fri, 27 Nov 2015 18:35:43 +0100
parents 035e020c8c0d 4cc9d7af1b01
children e93b85bf4cc2
files hotspot/src/share/vm/ci/ciMethod.cpp hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp hotspot/src/share/vm/jvmci/jvmciEnv.cpp hotspot/src/share/vm/jvmci/jvmciEnv.hpp hotspot/src/share/vm/prims/methodHandles.cpp hotspot/src/share/vm/runtime/globals.hpp
diffstat 34 files changed, 813 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/hotspot/make/linux/makefiles/zeroshark.make	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/make/linux/makefiles/zeroshark.make	Fri Nov 27 18:35:43 2015 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
 # Copyright 2007, 2008 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
@@ -25,8 +25,16 @@
 
 # Setup common to Zero (non-Shark) and Shark versions of VM
 
-# override this from the main file because some version of llvm do not like -Wundef
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wunused-function -Wunused-value
+# Some versions of llvm do not like -Wundef
+ifeq ($(USE_CLANG), true)
+  WARNING_FLAGS += -Wno-undef
+endif
+# Suppress some warning flags that are normally turned on for hotspot,
+# because some of the zero code has not been updated accordingly.
+WARNING_FLAGS += -Wno-return-type \
+  -Wno-format-nonliteral -Wno-format-security \
+  -Wno-maybe-uninitialized
+ 
 
 # The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
 OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
@@ -42,5 +50,3 @@
 ifeq ($(ARCH_DATA_MODEL), 64)
   CFLAGS += -D_LP64=1
 endif
-
-OPT_CFLAGS/compactingPermGenGen.o = -O1
--- a/hotspot/make/share/makefiles/mapfile-vers	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/make/share/makefiles/mapfile-vers	Fri Nov 27 18:35:43 2015 +0100
@@ -31,7 +31,6 @@
                 JVM_CurrentTimeMillis;
                 JVM_DefineClass;
                 JVM_DefineClassWithSource;
-                JVM_DefineClassWithSourceCond;
                 JVM_DesiredAssertionStatus;
                 JVM_DoPrivileged;
                 JVM_DumpAllStacks;
--- a/hotspot/make/test/JtregNative.gmk	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/make/test/JtregNative.gmk	Fri Nov 27 18:35:43 2015 +0100
@@ -48,6 +48,16 @@
     $(HOTSPOT_TOPDIR)/test/runtime/SameObject \
     #
 
+# Add conditional directories here when needed.
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
+BUILD_HOTSPOT_JTREG_NATIVE_SRC += \
+    $(HOTSPOT_TOPDIR)/test/runtime/libadimalloc.solaris.sparc
+endif
+
+ifeq ($(TOOLCHAIN_TYPE), solstudio)
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LDFLAGS_liboverflow := -lc
+endif
+
 BUILD_HOTSPOT_JTREG_OUTPUT_DIR := $(BUILD_OUTPUT)/support/test/hotspot/jtreg/native
 
 BUILD_HOTSPOT_JTREG_IMAGE_DIR := $(TEST_IMAGE_DIR)/hotspot/jtreg
--- a/hotspot/src/os/posix/vm/os_posix.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/os/posix/vm/os_posix.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -837,6 +837,21 @@
 #if defined(IA64) && !defined(AIX)
     { SIGSEGV, SEGV_PSTKOVF, "SEGV_PSTKOVF", "Paragraph stack overflow" },
 #endif
+#if defined(__sparc) && defined(SOLARIS)
+// define Solaris Sparc M7 ADI SEGV signals
+#if !defined(SEGV_ACCADI)
+#define SEGV_ACCADI 3
+#endif
+    { SIGSEGV, SEGV_ACCADI,  "SEGV_ACCADI",  "ADI not enabled for mapped object." },
+#if !defined(SEGV_ACCDERR)
+#define SEGV_ACCDERR 4
+#endif
+    { SIGSEGV, SEGV_ACCDERR, "SEGV_ACCDERR", "ADI disrupting exception." },
+#if !defined(SEGV_ACCPERR)
+#define SEGV_ACCPERR 5
+#endif
+    { SIGSEGV, SEGV_ACCPERR, "SEGV_ACCPERR", "ADI precise exception." },
+#endif // defined(__sparc) && defined(SOLARIS)
     { SIGBUS,  BUS_ADRALN,   "BUS_ADRALN",   "Invalid address alignment." },
     { SIGBUS,  BUS_ADRERR,   "BUS_ADRERR",   "Nonexistent physical address." },
     { SIGBUS,  BUS_OBJERR,   "BUS_OBJERR",   "Object-specific hardware error." },
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -704,13 +704,14 @@
                                InstanceKlass*  holder,
                                Symbol*       name,
                                Symbol*       sig,
-                               Bytecodes::Code bc) {
+                               Bytecodes::Code bc,
+                               constantTag    tag) {
   EXCEPTION_CONTEXT;
   KlassHandle h_accessor(THREAD, accessor);
   KlassHandle h_holder(THREAD, holder);
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
-  LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
+  LinkInfo link_info(h_holder, name, sig, h_accessor, LinkInfo::needs_access_check, tag);
   switch (bc) {
   case Bytecodes::_invokestatic:
     dest_method =
@@ -796,7 +797,9 @@
 
     if (holder_is_accessible) {  // Our declared holder is loaded.
       InstanceKlass* lookup = declared_holder->get_instanceKlass();
-      Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc);
+      constantTag tag = cpool->tag_ref_at(index);
+      assert(accessor->get_instanceKlass() == cpool->pool_holder(), "not the pool holder?");
+      Method* m = lookup_method(accessor->get_instanceKlass(), lookup, name_sym, sig_sym, bc, tag);
       if (m != NULL &&
           (bc == Bytecodes::_invokestatic
            ?  m->method_holder()->is_not_initialized()
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -158,7 +158,8 @@
                            InstanceKlass*  holder,
                            Symbol*         name,
                            Symbol*         sig,
-                           Bytecodes::Code bc);
+                           Bytecodes::Code bc,
+                           constantTag     tag);
 
   // Get a ciObject from the object factory.  Ensures uniqueness
   // of ciObjects.
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -786,7 +786,8 @@
    Symbol* h_name      = name()->get_symbol();
    Symbol* h_signature = signature()->get_symbol();
 
-   LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass, check_access);
+   LinkInfo link_info(h_resolved, h_name, h_signature, caller_klass,
+                      check_access ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
    methodHandle m;
    // Only do exact lookup if receiver klass has been linked.  Otherwise,
    // the vtable has not been setup, and the LinkResolver will fail.
--- a/hotspot/src/share/vm/gc/g1/g1AllocRegion.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1AllocRegion.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/g1AllocRegion.inline.hpp"
+#include "gc/g1/g1EvacStats.inline.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 
--- a/hotspot/src/share/vm/gc/g1/g1Allocator.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1Allocator.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "gc/g1/g1Allocator.inline.hpp"
 #include "gc/g1/g1AllocRegion.inline.hpp"
+#include "gc/g1/g1EvacStats.inline.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1CollectorPolicy.hpp"
 #include "gc/g1/g1MarkSweep.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -37,6 +37,7 @@
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1ErgoVerbose.hpp"
 #include "gc/g1/g1EvacFailure.hpp"
+#include "gc/g1/g1EvacStats.inline.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1Log.hpp"
 #include "gc/g1/g1MarkSweep.hpp"
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "memory/allocation.inline.hpp"
 #include "gc/g1/g1EvacStats.hpp"
 #include "gc/shared/gcId.hpp"
 #include "trace/tracing.hpp"
@@ -114,3 +115,4 @@
   reset();
 }
 
+G1EvacStats::~G1EvacStats() { }
--- a/hotspot/src/share/vm/gc/g1/g1EvacStats.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -22,11 +22,10 @@
  *
  */
 
-#ifndef SHARE_VM_gc_G1_G1EVACSTATS_HPP
-#define SHARE_VM_gc_G1_G1EVACSTATS_HPP
+#ifndef SHARE_VM_GC_G1_G1EVACSTATS_HPP
+#define SHARE_VM_GC_G1_G1EVACSTATS_HPP
 
 #include "gc/shared/plab.hpp"
-#include "runtime/atomic.hpp"
 
 // Records various memory allocation statistics gathered during evacuation.
 class G1EvacStats : public PLABStats {
@@ -75,19 +74,11 @@
   // Amount of space in heapwords wasted (unused) in the failing regions when an evacuation failure happens.
   size_t failure_waste() const { return _failure_waste; }
 
-  void add_direct_allocated(size_t value) {
-    Atomic::add_ptr(value, &_direct_allocated);
-  }
+  inline void add_direct_allocated(size_t value);
+  inline void add_region_end_waste(size_t value);
+  inline void add_failure_used_and_waste(size_t used, size_t waste);
 
-  void add_region_end_waste(size_t value) {
-    Atomic::add_ptr(value, &_region_end_waste);
-    Atomic::add_ptr(1, &_regions_filled);
-  }
-
-  void add_failure_used_and_waste(size_t used, size_t waste) {
-    Atomic::add_ptr(used, &_failure_used);
-    Atomic::add_ptr(waste, &_failure_waste);
-  }
+  ~G1EvacStats();
 };
 
-#endif // SHARE_VM_gc_G1_G1EVACSTATS_HPP
+#endif // SHARE_VM_GC_G1_G1EVACSTATS_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1EvacStats.inline.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_G1_G1EVACSTATS_INLINE_HPP
+#define SHARE_VM_GC_G1_G1EVACSTATS_INLINE_HPP
+
+#include "gc/g1/g1EvacStats.hpp"
+#include "runtime/atomic.inline.hpp"
+
+inline void G1EvacStats::add_direct_allocated(size_t value) {
+  Atomic::add_ptr(value, &_direct_allocated);
+}
+
+inline void G1EvacStats::add_region_end_waste(size_t value) {
+  Atomic::add_ptr(value, &_region_end_waste);
+  Atomic::add_ptr(1, &_regions_filled);
+}
+
+inline void G1EvacStats::add_failure_used_and_waste(size_t used, size_t waste) {
+  Atomic::add_ptr(used, &_failure_used);
+  Atomic::add_ptr(waste, &_failure_waste);
+}
+
+#endif // SHARE_VM_GC_G1_G1EVACSTATS_INLINE_HPP
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -245,6 +245,7 @@
   // Get name, signature, and static klass
   _name          = pool->name_ref_at(index);
   _signature     = pool->signature_ref_at(index);
+  _tag           = pool->tag_ref_at(index);
   _current_klass = KlassHandle(THREAD, pool->pool_holder());
 
   // Coming from the constant pool always checks access
@@ -681,6 +682,15 @@
     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
 
+  // check tag at call is method
+  if (!link_info.tag().is_invalid() && !link_info.tag().is_method()) {
+    ResourceMark rm(THREAD);
+    char buf[200];
+    jio_snprintf(buf, sizeof(buf), "Resolving to non regular method %s", link_info.method_string());
+    THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+  }
+
+
   // 2. lookup method in resolved klass and its super klasses
   methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL);
 
@@ -740,6 +750,14 @@
     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   }
 
+  // check tag at call is an interface method
+  if (!link_info.tag().is_invalid() && !link_info.tag().is_interface_method()) {
+    ResourceMark rm(THREAD);
+    char buf[200];
+    jio_snprintf(buf, sizeof(buf), "Resolving to non interface method %s", link_info.method_string());
+    THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+  }
+
   // lookup method in this interface or its super, java.lang.Object
   // JDK8: also look for static methods
   methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL);
@@ -917,7 +935,8 @@
     resolved_klass->initialize(CHECK);
     // Use updated LinkInfo (to reresolve with resolved_klass as method_holder?)
     LinkInfo new_info(resolved_klass, link_info.name(), link_info.signature(),
-                      link_info.current_klass(), link_info.check_access());
+                      link_info.current_klass(),
+                      link_info.check_access() ? LinkInfo::needs_access_check : LinkInfo::skip_access_check);
     resolved_method = linktime_resolve_static_method(new_info, CHECK);
   }
 
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -135,20 +135,35 @@
   KlassHandle _resolved_klass;  // class that the constant pool entry points to
   KlassHandle _current_klass;   // class that owns the constant pool
   bool        _check_access;
+  constantTag _tag;
  public:
+  enum AccessCheck {
+     needs_access_check,
+     skip_access_check
+  };
+
   LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
+
   // Condensed information from other call sites within the vm.
-  LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature,
-           KlassHandle current_klass, bool check_access = true) :
+  LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature, KlassHandle current_klass,
+           AccessCheck check_access = needs_access_check,
+           constantTag tag = JVM_CONSTANT_Invalid) :
     _resolved_klass(resolved_klass),
     _name(name), _signature(signature), _current_klass(current_klass),
-    _check_access(check_access) {}
+    _check_access(check_access == needs_access_check && current_klass.not_null()), _tag(tag) {}
+
+  // Case where we just find the method and don't check access against the current class
+  LinkInfo(KlassHandle resolved_klass, Symbol*name, Symbol* signature) :
+    _resolved_klass(resolved_klass),
+    _name(name), _signature(signature), _current_klass(NULL),
+    _check_access(false), _tag(JVM_CONSTANT_Invalid) {}
 
   // accessors
   Symbol* name() const               { return _name; }
   Symbol* signature() const          { return _signature; }
   KlassHandle resolved_klass() const { return _resolved_klass; }
   KlassHandle current_klass() const  { return _current_klass; }
+  constantTag tag() const            { return _tag; }
   bool check_access() const          { return _check_access; }
   char* method_string() const;
 
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -574,7 +574,7 @@
 
     if (holder_klass->is_interface()) {
       // do link-time resolution to check all access rules.
-      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true);
+      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass);
       methodHandle resolved_method = LinkResolver::linktime_resolve_interface_method_or_null(link_info);
       if (resolved_method.is_null() || resolved_method->is_private()) {
         return NULL;
@@ -586,7 +586,7 @@
       return JNIHandles::make_local(THREAD, result);
     } else {
       // do link-time resolution to check all access rules.
-      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass, true);
+      LinkInfo link_info(holder_klass, method_name, method_signature, caller_klass);
       methodHandle resolved_method = LinkResolver::linktime_resolve_virtual_method_or_null(link_info);
       if (resolved_method.is_null()) {
         return NULL;
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -282,11 +282,12 @@
                                instanceKlassHandle h_holder,
                                Symbol*       name,
                                Symbol*       sig,
-                               Bytecodes::Code bc) {
+                               Bytecodes::Code bc,
+                               constantTag   tag) {
   JVMCI_EXCEPTION_CONTEXT;
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
-  LinkInfo link_info(h_holder, name, sig, h_accessor, /*check_access*/true);
+  LinkInfo link_info(h_holder, name, sig, h_accessor, LinkInfo::needs_access_check, tag);
   switch (bc) {
   case Bytecodes::_invokestatic:
     dest_method =
@@ -359,7 +360,8 @@
 
   if (holder_is_accessible) { // Our declared holder is loaded.
     instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder);
-    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
+    constantTag tag = cpool->tag_ref_at(index);
+    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc, tag);
     if (!m.is_null() &&
         (bc == Bytecodes::_invokestatic
          ?  InstanceKlass::cast(m->method_holder())->is_not_initialized()
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -125,7 +125,8 @@
                            instanceKlassHandle  holder,
                            Symbol*         name,
                            Symbol*         sig,
-                           Bytecodes::Code bc);
+                           Bytecodes::Code bc,
+                           constantTag     tag);
 
   private:
 
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -409,6 +409,19 @@
   return extract_high_short_from_int(ref_index);
 }
 
+constantTag ConstantPool::impl_tag_ref_at(int which, bool uncached) {
+  int pool_index = which;
+  if (!uncached && cache() != NULL) {
+    if (ConstantPool::is_invokedynamic_index(which)) {
+      // Invokedynamic index is index into resolved_references
+      pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
+    } else {
+      // change byte-ordering and go via cache
+      pool_index = remap_instruction_operand_from_cache(which);
+    }
+  }
+  return tag_at(pool_index);
+}
 
 int ConstantPool::impl_klass_ref_index_at(int which, bool uncached) {
   guarantee(!ConstantPool::is_invokedynamic_index(which),
@@ -664,6 +677,7 @@
       int callee_index             = this_cp->method_handle_klass_index_at(index);
       Symbol*  name =      this_cp->method_handle_name_ref_at(index);
       Symbol*  signature = this_cp->method_handle_signature_ref_at(index);
+      constantTag m_tag  = this_cp->tag_at(this_cp->method_handle_index_at(index));
       if (PrintMiscellaneous)
         tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
                       ref_kind, index, this_cp->method_handle_index_at(index),
@@ -672,6 +686,15 @@
       { Klass* k = klass_at_impl(this_cp, callee_index, true, CHECK_NULL);
         callee = KlassHandle(THREAD, k);
       }
+      if ((callee->is_interface() && m_tag.is_method()) ||
+          (!callee->is_interface() && m_tag.is_interface_method())) {
+        ResourceMark rm(THREAD);
+        char buf[200];
+        jio_snprintf(buf, sizeof(buf), "Inconsistent constant data for %s.%s%s at index %d",
+          callee->name()->as_C_string(), name->as_C_string(), signature->as_C_string(), index);
+        THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+      }
+
       KlassHandle klass(THREAD, this_cp->pool_holder());
       Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind,
                                                                    callee, name, signature,
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -664,6 +664,8 @@
 
   int remap_instruction_operand_from_cache(int operand);  // operand must be biased by CPCACHE_INDEX_TAG
 
+  constantTag tag_ref_at(int cp_cache_index)      { return impl_tag_ref_at(cp_cache_index, false); }
+
   // Lookup for entries consisting of (name_index, signature_index)
   int name_ref_index_at(int which_nt);            // ==  low-order jshort of name_and_type_at(which_nt)
   int signature_ref_index_at(int which_nt);       // == high-order jshort of name_and_type_at(which_nt)
@@ -784,6 +786,7 @@
   Symbol* impl_signature_ref_at(int which, bool uncached);
   int       impl_klass_ref_index_at(int which, bool uncached);
   int       impl_name_and_type_ref_index_at(int which, bool uncached);
+  constantTag impl_tag_ref_at(int which, bool uncached);
 
   // Used while constructing constant pool (only by ClassFileParser)
   jint klass_index_at(int which) {
--- a/hotspot/src/share/vm/prims/jvm.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -861,11 +861,10 @@
 }
 
 // common code for JVM_DefineClass() and JVM_DefineClassWithSource()
-// and JVM_DefineClassWithSourceCond()
 static jclass jvm_define_class_common(JNIEnv *env, const char *name,
                                       jobject loader, const jbyte *buf,
                                       jsize len, jobject pd, const char *source,
-                                      jboolean verify, TRAPS) {
+                                      TRAPS) {
   if (source == NULL)  source = "__JVM_DefineClass__";
 
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
@@ -906,8 +905,7 @@
   Handle protection_domain (THREAD, JNIHandles::resolve(pd));
   Klass* k = SystemDictionary::resolve_from_stream(class_name, class_loader,
                                                      protection_domain, &st,
-                                                     verify != 0,
-                                                     CHECK_NULL);
+                                                     true, CHECK_NULL);
 
   if (TraceClassResolution && k != NULL) {
     trace_class_resolution(k);
@@ -920,23 +918,14 @@
 JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
   JVMWrapper2("JVM_DefineClass %s", name);
 
-  return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, true, THREAD);
+  return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, THREAD);
 JVM_END
 
 
 JVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
   JVMWrapper2("JVM_DefineClassWithSource %s", name);
 
-  return jvm_define_class_common(env, name, loader, buf, len, pd, source, true, THREAD);
-JVM_END
-
-JVM_ENTRY(jclass, JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
-                                                jobject loader, const jbyte *buf,
-                                                jsize len, jobject pd,
-                                                const char *source, jboolean verify))
-  JVMWrapper2("JVM_DefineClassWithSourceCond %s", name);
-
-  return jvm_define_class_common(env, name, loader, buf, len, pd, source, verify, THREAD);
+  return jvm_define_class_common(env, name, loader, buf, len, pd, source, THREAD);
 JVM_END
 
 JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name))
--- a/hotspot/src/share/vm/prims/jvm.h	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/prims/jvm.h	Fri Nov 27 18:35:43 2015 +0100
@@ -378,17 +378,6 @@
                           const jbyte *buf, jsize len, jobject pd,
                           const char *source);
 
-/* Define a class with a source with conditional verification (added HSX 14)
- * -Xverify:all will verify anyway, -Xverify:none will not verify,
- * -Xverify:remote (default) will obey this conditional
- * i.e. true = should_verify_class
- */
-JNIEXPORT jclass JNICALL
-JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
-                              jobject loader, const jbyte *buf,
-                              jsize len, jobject pd, const char *source,
-                              jboolean verify);
-
 /*
  * Reflection support functions
  */
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -680,7 +680,7 @@
   case IS_METHOD:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller, caller.not_null());
+      LinkInfo link_info(defc, name, type, caller);
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (ref_kind == JVM_REF_invokeStatic) {
@@ -717,7 +717,7 @@
   case IS_CONSTRUCTOR:
     {
       CallInfo result;
-      LinkInfo link_info(defc, name, type, caller, caller.not_null());
+      LinkInfo link_info(defc, name, type, caller);
       {
         assert(!HAS_PENDING_EXCEPTION, "");
         if (name == vmSymbols::object_initializer_name()) {
@@ -738,7 +738,7 @@
       fieldDescriptor result; // find_field initializes fd if found
       {
         assert(!HAS_PENDING_EXCEPTION, "");
-        LinkInfo link_info(defc, name, type, caller, /*check_access*/false);
+        LinkInfo link_info(defc, name, type, caller, LinkInfo::skip_access_check);
         LinkResolver::resolve_field(result, link_info, Bytecodes::_nop, false, THREAD);
         if (HAS_PENDING_EXCEPTION) {
           return empty;
--- a/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagRangeList.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -279,7 +279,7 @@
 // Generate func argument to pass into emit_range_xxx functions
 #define EMIT_RANGE_CHECK(a, b)                               , a, b
 
-#define INITIAL_RANGES_SIZE 204
+#define INITIAL_RANGES_SIZE 205
 GrowableArray<CommandLineFlagRange*>* CommandLineFlagRangeList::_ranges = NULL;
 
 // Check the ranges of all flags that have them
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Nov 27 18:35:43 2015 +0100
@@ -1031,9 +1031,10 @@
   product(bool, CreateCoredumpOnCrash, true,                                \
           "Create core/mini dump on VM fatal error")                        \
                                                                             \
-  product(uintx, ErrorLogTimeout, 2 * 60,                                   \
+  product(uint64_t, ErrorLogTimeout, 2 * 60,                                \
           "Timeout, in seconds, to limit the time spent on writing an "     \
           "error log in case of a crash.")                                  \
+          range(0, (uint64_t)max_jlong/1000)                                \
                                                                             \
   product_pd(bool, UseOSErrorReporting,                                     \
           "Let VM fatal error propagate to the OS (ie. WER on Windows)")    \
--- a/hotspot/src/share/vm/runtime/java.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/java.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -49,6 +49,7 @@
 #include "runtime/arguments.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/compilationPolicy.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.hpp"
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -183,7 +183,7 @@
   CallInfo callinfo;
   Handle receiver = args->receiver();
   KlassHandle recvrKlass(THREAD, receiver.is_null() ? (Klass*)NULL : receiver->klass());
-  LinkInfo link_info(spec_klass, name, signature, KlassHandle(), /*check_access*/false);
+  LinkInfo link_info(spec_klass, name, signature);
   LinkResolver::resolve_virtual_call(
           callinfo, receiver, recvrKlass, link_info, true, CHECK);
   methodHandle method = callinfo.selected_method();
@@ -220,7 +220,7 @@
 
 void JavaCalls::call_special(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
   CallInfo callinfo;
-  LinkInfo link_info(klass, name, signature, KlassHandle(), /*check_access*/false);
+  LinkInfo link_info(klass, name, signature);
   LinkResolver::resolve_special_call(callinfo, link_info, CHECK);
   methodHandle method = callinfo.selected_method();
   assert(method.not_null(), "should have thrown exception");
@@ -255,7 +255,7 @@
 
 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
   CallInfo callinfo;
-  LinkInfo link_info(klass, name, signature, KlassHandle(), /*check_access*/false);
+  LinkInfo link_info(klass, name, signature);
   LinkResolver::resolve_static_call(callinfo, link_info, true, CHECK);
   methodHandle method = callinfo.selected_method();
   assert(method.not_null(), "should have thrown exception");
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -830,7 +830,7 @@
   Symbol*  signature  = method->signature();
   Symbol*  name       = method->name();
   LinkResolver::resolve_interface_call(info, receiver, recv_klass,
-                                       LinkInfo(klass, name, signature, KlassHandle(), false),
+                                       LinkInfo(klass, name, signature),
                                        true,
                                        CHECK_(methodHandle()));
   return info.selected_method();
--- a/hotspot/src/share/vm/runtime/thread.cpp	Thu Nov 26 19:16:37 2015 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Fri Nov 27 18:35:43 2015 +0100
@@ -1299,7 +1299,7 @@
         if (!ShowMessageBoxOnError
             && (OnError == NULL || OnError[0] == '\0')
             && Arguments::abort_hook() == NULL) {
-          os::sleep(this, ErrorLogTimeout * 60 * 1000, false);
+          os::sleep(this, (jlong)ErrorLogTimeout * 1000, false); // in seconds
           fdStream err(defaultStream::output_fd());
           err.print_raw_cr("# [ timer expired, abort... ]");
           // skip atexit/vm_exit/vm_abort hooks
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/8087223/BadMethodHandles.java	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,250 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * $bug 8087223
+ * @summary Adding constantTag to keep method call consistent with it.
+ * @compile -XDignore.symbol.file BadMethodHandles.java
+ * @run main/othervm BadMethodHandles
+ */
+
+import jdk.internal.org.objectweb.asm.*;
+import java.io.FileOutputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
+
+public class BadMethodHandles {
+
+    static byte[] dumpBadInterfaceMethodref() {
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(52, ACC_PUBLIC | ACC_SUPER, "BadInterfaceMethodref", null, "java/lang/Object", null);
+        Handle handle1 =
+            new Handle(Opcodes.H_INVOKEINTERFACE, "BadInterfaceMethodref", "m", "()V");
+        Handle handle2 =
+            new Handle(Opcodes.H_INVOKEINTERFACE, "BadInterfaceMethodref", "staticM", "()V");
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "m", "()V", null, null);
+            mv.visitCode();
+            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+            mv.visitLdcInsn("hello from m");
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(3, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "staticM", "()V", null, null);
+            mv.visitCode();
+            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+            mv.visitLdcInsn("hello from staticM");
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(3, 1);
+            mv.visitEnd();
+        }
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runm", "()V", null, null);
+            mv.visitCode();
+            // REF_invokeStatic
+            mv.visitLdcInsn(handle1);
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runStaticM", "()V", null, null);
+            mv.visitCode();
+            // REF_invokeStatic
+            mv.visitLdcInsn(handle2);
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    static byte[] dumpIBad() {
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(52, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "IBad", null, "java/lang/Object", null);
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "m", "()V", null, null);
+            mv.visitCode();
+            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+            mv.visitLdcInsn("hello from m");
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(3, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "staticM", "()V", null, null);
+            mv.visitCode();
+            mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
+            mv.visitLdcInsn("hello from staticM");
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false/*intf*/);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(3, 1);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    static byte[] dumpBadMethodref() {
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(52, ACC_PUBLIC | ACC_SUPER,  "BadMethodref", null, "java/lang/Object", new String[]{"IBad"});
+        Handle handle1 =
+            new Handle(Opcodes.H_INVOKEINTERFACE, "BadMethodref", "m", "()V");
+        Handle handle2 =
+            new Handle(Opcodes.H_INVOKEINTERFACE, "BadMethodref", "staticM", "()V");
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runm", "()V", null, null);
+            mv.visitCode();
+            // REF_invokeStatic
+            mv.visitLdcInsn(handle1);
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "runStaticM", "()V", null, null);
+            mv.visitCode();
+            // REF_invokeStatic
+            mv.visitLdcInsn(handle2);
+            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invoke", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+    static class CL extends ClassLoader {
+        @Override
+        protected Class<?> findClass(String name) throws ClassNotFoundException {
+            byte[] classBytes = null;
+            switch (name) {
+            case "BadInterfaceMethodref": classBytes = dumpBadInterfaceMethodref(); break;
+            case "BadMethodref"         : classBytes = dumpBadMethodref(); break;
+            case "IBad"                 : classBytes = dumpIBad(); break;
+            default                     : throw new ClassNotFoundException(name);
+            }
+            return defineClass(name, classBytes, 0, classBytes.length);
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        try (FileOutputStream fos = new FileOutputStream("BadInterfaceMethodref.class")) {
+          fos.write(dumpBadInterfaceMethodref());
+        }
+        try (FileOutputStream fos = new FileOutputStream("IBad.class")) {
+          fos.write(dumpIBad());
+        }
+        try (FileOutputStream fos = new FileOutputStream("BadMethodref.class")) {
+          fos.write(dumpBadMethodref());
+        }
+
+        Class<?> cls = (new CL()).loadClass("BadInterfaceMethodref");
+        String[] methods = {"runm", "runStaticM"};
+        System.out.println("Test BadInterfaceMethodref:");
+        int success = 0;
+        for (String name : methods) {
+            try {
+                System.out.printf("invoke %s: \n", name);
+                cls.getMethod(name).invoke(cls.newInstance());
+                System.out.println("FAILED (no exception)"); // ICCE should be thrown
+            } catch (Throwable e) {
+                if (e instanceof InvocationTargetException && e.getCause() != null &&
+                    e.getCause() instanceof IncompatibleClassChangeError) {
+                    System.out.println("PASSED");
+                    success++;
+                    continue;
+                } else {
+                    System.out.println("FAILED with exception");
+                    throw e;
+                }
+            }
+        }
+        if (success != methods.length) {
+           throw new Exception("BadInterfaceMethodRef Failed to catch IncompatibleClassChangeError");
+        }
+        System.out.println("Test BadMethodref:");
+        cls = (new CL()).loadClass("BadMethodref");
+        success = 0;
+        for (String name : methods) {
+            try {
+                System.out.printf("invoke %s: \n", name);
+                cls.getMethod(name).invoke(cls.newInstance());
+                System.out.println("FAILED (no exception)"); // ICCE should be thrown
+            } catch (Throwable e) {
+                if (e instanceof InvocationTargetException && e.getCause() != null &&
+                    e.getCause() instanceof IncompatibleClassChangeError) {
+                    System.out.println("PASSED");
+                    success++;
+                    continue;
+                } else {
+                    System.out.println("FAILED with exception");
+                    throw e;
+                }
+            }
+         }
+         if (success != methods.length) {
+            throw new Exception("BadMethodRef Failed to catch IncompatibleClassChangeError");
+         }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/8087223/IntfMethod.java	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * $bug 8087223
+ * @summary Adding constantTag to keep method call consistent with it.
+ * @compile -XDignore.symbol.file IntfMethod.java
+ * @run main/othervm IntfMethod
+ * @run main/othervm -Xint IntfMethod
+ * @run main/othervm -Xcomp IntfMethod
+ */
+
+
+import jdk.internal.org.objectweb.asm.*;
+import java.io.FileOutputStream;
+import java.lang.reflect.InvocationTargetException;
+import static jdk.internal.org.objectweb.asm.Opcodes.*;
+
+public class IntfMethod {
+    static byte[] dumpC() {
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(52, ACC_PUBLIC | ACC_SUPER, "C", null, "java/lang/Object", new String[]{"I"});
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialIntf", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "I", "f1", "()V", /*itf=*/false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticIntf", "()V", null, null);
+            mv.visitCode();
+            mv.visitMethodInsn(INVOKESTATIC, "I", "f2", "()V", /*itf=*/false);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testSpecialClass", "()V", null, null);
+            mv.visitCode();
+            mv.visitVarInsn(ALOAD, 0);
+            mv.visitMethodInsn(INVOKESPECIAL, "C", "f1", "()V", /*itf=*/true);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
+            mv.visitCode();
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(0, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "testStaticClass", "()V", null, null);
+            mv.visitCode();
+            mv.visitMethodInsn(INVOKESTATIC, "C", "f2", "()V", /*itf=*/true);
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(1, 1);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    static byte[] dumpI() {
+        ClassWriter cw = new ClassWriter(0);
+        cw.visit(52, ACC_PUBLIC | ACC_ABSTRACT | ACC_INTERFACE, "I", null, "java/lang/Object", null);
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "f1", "()V", null, null);
+            mv.visitCode();
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(0, 1);
+            mv.visitEnd();
+        }
+        {
+            MethodVisitor mv = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "f2", "()V", null, null);
+            mv.visitCode();
+            mv.visitInsn(RETURN);
+            mv.visitMaxs(0, 1);
+            mv.visitEnd();
+        }
+        cw.visitEnd();
+        return cw.toByteArray();
+    }
+
+    static class CL extends ClassLoader {
+        @Override
+        protected Class<?> findClass(String name) throws ClassNotFoundException {
+            byte[] classFile;
+            switch (name) {
+                case "I": classFile = dumpI(); break;
+                case "C": classFile = dumpC(); break;
+                default:
+                    throw new ClassNotFoundException(name);
+            }
+            return defineClass(name, classFile, 0, classFile.length);
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+        Class<?> cls = (new CL()).loadClass("C");
+        try (FileOutputStream fos = new FileOutputStream("I.class")) { fos.write(dumpI()); }
+        try (FileOutputStream fos = new FileOutputStream("C.class")) { fos.write(dumpC()); }
+
+        int success = 0;
+        for (String name : new String[] { "testSpecialIntf", "testStaticIntf", "testSpecialClass", "testStaticClass"}) {
+            System.out.printf("%s: ", name);
+            try {
+                cls.getMethod(name).invoke(cls.newInstance());
+                System.out.println("FAILED");
+            } catch (Throwable e) {
+                if (e instanceof InvocationTargetException &&
+                    e.getCause() != null && e.getCause() instanceof IncompatibleClassChangeError) {
+                    System.out.println("PASSED");
+                    success++;
+                    continue;
+                }
+            }
+        }
+        if (success != 4) throw new Exception("Failed to catch ICCE");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/SEGVOverflow.java	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+public class SEGVOverflow {
+
+    static {
+        System.loadLibrary("overflow");
+    }
+
+    native static String nativesegv();
+
+    public static void main(String[] args) {
+        String str = nativesegv();
+        if (str == null) {
+            System.out.println("FAILED: malloc returned null");
+        } else {
+            System.out.println(str);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test Testlibadimalloc.java
+ * @bug 8141445
+ * @summary make sure the Solaris Sparc M7 libadimalloc.so library generates SIGSEGV's on buffer overflow
+ * @requires (os.family == "solaris" & os.arch == "sparcv9")
+ * @library /testlibrary
+ * @build jdk.test.lib.*
+ * @compile SEGVOverflow.java
+ * @run driver Testlibadimalloc
+ */
+
+import java.io.*;
+import java.nio.file.*;
+import java.util.*;
+import jdk.test.lib.ProcessTools;
+
+public class Testlibadimalloc {
+
+    // Expected return value when java program cores
+    static final int EXPECTED_RET_VAL = 6;
+
+    public static void main(String[] args) throws Throwable {
+
+        // See if the libadimalloc.so library exists
+        Path path = Paths.get("/usr/lib/64/libadimalloc.so");
+
+        // If the libadimalloc.so file does not exist, pass the test
+        if (!(Files.isRegularFile(path) || Files.isSymbolicLink(path))) {
+            System.out.println("Test skipped; libadimalloc.so does not exist");
+            return;
+        }
+
+        // Get the JDK, library and class path properties
+        String libpath = System.getProperty("java.library.path");
+
+        // Create a new java process for the SEGVOverflow Java/JNI test
+        ProcessBuilder builder = ProcessTools.createJavaProcessBuilder(
+            "-Djava.library.path=" + libpath + ":.", "SEGVOverflow");
+
+        // Add the LD_PRELOAD_64 value to the environment
+        Map<String, String> env = builder.environment();
+        env.put("LD_PRELOAD_64", "libadimalloc.so");
+
+        // Start the process, get the pid and then wait for the test to finish
+        Process process = builder.start();
+        long pid = process.getPid();
+        int retval = process.waitFor();
+
+        // make sure the SEGVOverflow test crashed
+        boolean found = false;
+        if (retval == EXPECTED_RET_VAL) {
+            String filename = "hs_err_pid" + pid + ".log";
+            Path filepath = Paths.get(filename);
+            // check to see if hs_err_file exists
+            if (Files.isRegularFile(filepath)) {
+                // see if the crash was due to a SEGV_ACCPERR signal
+                File hs_err_file = new File(filename);
+                Scanner scanner = new Scanner(hs_err_file);
+                while (!found && scanner.hasNextLine()) {
+                    String nextline = scanner.nextLine();
+                    if (nextline.contains("SEGV_ACCPERR")) {
+                         found = true;
+                    }
+                }
+            } else {
+                System.out.println("Test failed; hs_err_file does not exist: "
+                                   + filepath);
+            }
+        } else {
+            System.out.println("Test failed; java test program did not " +
+                               "return expected error: expected = " +
+                               EXPECTED_RET_VAL + ", retval = " + retval);
+        }
+        // If SEGV_ACCPERR was not found in the hs_err file fail the test
+        if (!found) {
+            System.out.println("FAIL: SEGV_ACCPERR not found");
+            throw new RuntimeException("FAIL: SEGV_ACCPERR not found");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/liboverflow.c	Fri Nov 27 18:35:43 2015 +0100
@@ -0,0 +1,72 @@
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jstring JNICALL Java_SEGVOverflow_nativesegv(JNIEnv *env, jobject obj) {
+  char *buffer1;
+  char *buffer2;
+  char *buffer3;
+  char ch;
+
+  jstring ret = NULL;
+
+  // sleep for a bit to let the libadimalloc library initialize
+  sleep(5);
+
+  // allocate three buffers
+  buffer1 = (char *)malloc(64);
+  buffer2 = (char *)malloc(64);
+  buffer3 = (char *)malloc(64);
+  if ((buffer1 == NULL) || (buffer2 == NULL) || (buffer3 == NULL)) {
+    // this return will result in a test failure
+    return ret;
+  }
+
+  // Read past the end of each buffer multiple times to increase the probability
+  // that an ADI version mismatch occurs so an ADI fault is triggered.
+  ch = buffer1[70];
+  ch = buffer2[70];
+  ch = buffer3[70];
+  ch = buffer1[140];
+  ch = buffer2[140];
+  ch = buffer3[140];
+
+  // create a failed test return value because this test should have cored
+  buffer1 = "TEST FAILED, a read past the end of a buffer succeeded.";
+  ret = (*env)->NewStringUTF(env, buffer1);
+
+  return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif