/hg/icedtea8-forest/hotspot: 24 new changesets

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Tue May 9 02:56:43 UTC 2017


changeset 0bd3170be8c7 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=0bd3170be8c7
author: martin
date: Sun May 07 01:20:27 2017 +0100

	8043780, PR3368: Use open(O_CLOEXEC) instead of fcntl(FD_CLOEXEC)
	Summary: Use open(O_CLOEXEC) where available; fall back to FD_CLOEXEC when necessary
	Reviewed-by: rasbold, dholmes


changeset f998c8dc320e in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=f998c8dc320e
author: andrew
date: Tue May 09 03:09:57 2017 +0100

	Added tag icedtea-3.4.0pre01 for changeset 0bd3170be8c7


changeset e4f6e58f3974 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=e4f6e58f3974
author: asaha
date: Mon Dec 12 12:52:22 2016 -0800

	Added tag jdk8u121-b13 for changeset 90f94521c351


changeset 692bc6b674dc in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=692bc6b674dc
author: asaha
date: Tue Oct 11 12:05:24 2016 -0700

	Added tag jdk8u131-b00 for changeset c0a1ba0df20f


changeset 5ee58c7d3938 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=5ee58c7d3938
author: asaha
date: Tue Dec 13 10:07:12 2016 -0800

	Merge


changeset 0b85ccd62409 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=0b85ccd62409
author: coleenp
date: Tue Dec 13 14:37:04 2016 -0500

	8168699: Validate special case invocations
	Reviewed-by: kevinw, vlivanov


changeset ef90c721a4e5 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=ef90c721a4e5
author: asaha
date: Wed Dec 21 13:45:22 2016 -0800

	Added tag jdk8u131-b01 for changeset 0b85ccd62409


changeset 0ca47d0811b0 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=0ca47d0811b0
author: asaha
date: Mon Jan 09 12:45:10 2017 -0800

	Added tag jdk8u131-b02 for changeset ef90c721a4e5


changeset dab1d5971652 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=dab1d5971652
author: asaha
date: Wed Jan 18 22:55:07 2017 -0800

	Added tag jdk8u131-b03 for changeset 0ca47d0811b0


changeset c965fc1aa840 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=c965fc1aa840
author: asaha
date: Mon Jan 23 14:34:23 2017 -0800

	Added tag jdk8u131-b04 for changeset dab1d5971652


changeset 12b06fba6e5b in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=12b06fba6e5b
author: asaha
date: Mon Jan 30 13:14:05 2017 -0800

	Added tag jdk8u131-b05 for changeset c965fc1aa840


changeset e21dd2c95cf0 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=e21dd2c95cf0
author: shshahma
date: Thu Sep 22 02:04:40 2016 -0700

	6515172: Runtime.availableProcessors() ignores Linux taskset command
	Summary: extract processor count from sched_getaffinity mask
	Reviewed-by: dholmes, gthornbr


changeset ca765f57fe3c in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=ca765f57fe3c
author: tschatzl
date: Thu Dec 15 19:48:32 2016 -0500

	8147910: Cache initial active_processor_count
	Summary: Introduce and initialize active_processor_count variable in VM.
	Reviewed-by: dholmes, jprovino


changeset ab892d05b029 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=ab892d05b029
author: tschatzl
date: Thu Dec 15 20:00:01 2016 -0500

	8161993: G1 crashes if active_processor_count changes during startup
	Summary: Use the initial active processor count for memory initialization instead of the current active one.
	Reviewed-by: dholmes, mgerdin


changeset 75021e6fe108 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=75021e6fe108
author: dholmes
date: Tue Dec 20 16:06:10 2016 -0500

	8170307: Stack size option -Xss is ignored
	Reviewed-by: dcubed, sspitsyn, gtriantafill


changeset 6e4cfbc7534f in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=6e4cfbc7534f
author: dholmes
date: Thu Jan 05 18:55:20 2017 -0500

	8170888: [linux] Experimental support for cgroup memory limits in container (ie Docker) environments
	Summary: Set apparent physical memory to cgroup memory limit when UseCGroupMemoryLimitForHeap is true
	Reviewed-by: acorn, gtriantafill
	Contributed-by: Christine Flood <chf at redhat.com>


changeset 46ba0d78c1fc in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=46ba0d78c1fc
author: asaha
date: Mon Feb 06 12:16:31 2017 -0800

	Added tag jdk8u131-b06 for changeset 6e4cfbc7534f


changeset 5b3cb4fbdbc7 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=5b3cb4fbdbc7
author: roland
date: Mon Jul 25 14:31:42 2016 -0700

	8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
	Summary: don't convert loop with safepoint on the backedge to Counted loop
	Reviewed-by: kvn


changeset db221c0a423e in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=db221c0a423e
author: asaha
date: Mon Feb 13 11:58:54 2017 -0800

	Added tag jdk8u131-b07 for changeset 5b3cb4fbdbc7


changeset 59ad72c0e133 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=59ad72c0e133
author: asaha
date: Tue Feb 21 10:18:56 2017 -0800

	Added tag jdk8u131-b08 for changeset db221c0a423e


changeset 56e71d160839 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=56e71d160839
author: msolovie
date: Fri Dec 09 19:40:47 2016 +0300

	8150490: Update OS detection code to recognize Windows Server 2016
	Reviewed-by: mgronlun, alanb, dholmes


changeset 1da23ae49386 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=1da23ae49386
author: asaha
date: Mon Feb 27 11:16:11 2017 -0800

	Added tag jdk8u131-b09 for changeset 56e71d160839


changeset 829ea9b92cda in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=829ea9b92cda
author: asaha
date: Mon Mar 06 11:12:11 2017 -0800

	Added tag jdk8u131-b10 for changeset 1da23ae49386


changeset a666b7151a84 in /hg/icedtea8-forest/hotspot
details: http://icedtea.classpath.org/hg/icedtea8-forest/hotspot?cmd=changeset;node=a666b7151a84
author: andrew
date: Tue May 09 04:03:39 2017 +0100

	Merge jdk8u131-b11


diffstat:

 .hgtags                                                      |   13 +
 src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp                   |    7 +-
 src/cpu/x86/vm/c1_LIRGenerator_x86.cpp                       |    7 +-
 src/os/linux/vm/os_linux.cpp                                 |  120 ++++++----
 src/os/windows/vm/os_windows.cpp                             |    5 +-
 src/share/vm/c1/c1_CodeStubs.hpp                             |    4 +-
 src/share/vm/c1/c1_GraphBuilder.cpp                          |   14 +
 src/share/vm/c1/c1_Instruction.hpp                           |   11 +
 src/share/vm/ci/ciInstanceKlass.cpp                          |   12 +-
 src/share/vm/ci/ciInstanceKlass.hpp                          |    4 +-
 src/share/vm/ci/ciMethod.cpp                                 |    9 +-
 src/share/vm/ci/ciMethod.hpp                                 |    3 +-
 src/share/vm/interpreter/interpreterRuntime.cpp              |   14 +-
 src/share/vm/interpreter/linkResolver.cpp                    |   51 +++-
 src/share/vm/interpreter/linkResolver.hpp                    |    8 +-
 src/share/vm/oops/cpCache.cpp                                |   18 +-
 src/share/vm/oops/cpCache.hpp                                |    6 +-
 src/share/vm/opto/doCall.cpp                                 |   26 ++-
 src/share/vm/opto/loopnode.cpp                               |   10 +-
 src/share/vm/prims/methodHandles.cpp                         |    6 +-
 src/share/vm/runtime/javaCalls.cpp                           |    4 +-
 test/compiler/loopopts/TestCountedLoopSafepointBackedge.java |   52 ++++
 22 files changed, 308 insertions(+), 96 deletions(-)

diffs (truncated from 861 to 500 lines):

diff -r baf64c88538f -r a666b7151a84 .hgtags
--- a/.hgtags	Thu Sep 22 02:04:40 2016 -0700
+++ b/.hgtags	Tue May 09 04:03:39 2017 +0100
@@ -984,3 +984,16 @@
 b132b08b28bf23a26329928cf6b4ffda5857f4d3 jdk8u121-b12
 2a767107aa8c8142d96eb95142b1ac82cf646568 icedtea-3.3.0pre02
 6efaf77e82a17344499a277f1909bd3825b1b5ac icedtea-3.3.0
+0bd3170be8c729dfaa88e7aa97449b2f36c650a9 icedtea-3.4.0pre01
+90f94521c3515e5f27af0ab9b31d036e88bb322a jdk8u121-b13
+c0a1ba0df20fda10ddb8599e888eb56ad98b3874 jdk8u131-b00
+0b85ccd6240991e1a501602ff5addec6b88ae0af jdk8u131-b01
+ef90c721a4e59b01ca36f25619010a1afe9ed4d5 jdk8u131-b02
+0ca47d0811b01ecf8651b6045a1e33a4a9bed0ee jdk8u131-b03
+dab1d597165207e14b6886b1823c1e990bc776a3 jdk8u131-b04
+c965fc1aa840a0903709ad69aa0e2100330ccd84 jdk8u131-b05
+6e4cfbc7534f83902692132efb61683528c04a59 jdk8u131-b06
+5b3cb4fbdbc7bdeb7c78a8703c3084ce068f6691 jdk8u131-b07
+db221c0a423e776bec5c3198d11d3f26827bd786 jdk8u131-b08
+56e71d16083904ceddfdd1d66312582a42781646 jdk8u131-b09
+1da23ae49386608550596502d90a381ee6c1dfaa jdk8u131-b10
diff -r baf64c88538f -r a666b7151a84 src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp
--- a/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1023,11 +1023,16 @@
   obj.load_item();
   LIR_Opr out_reg = rlock_result(x);
   CodeStub* stub;
-  CodeEmitInfo* info_for_exception = state_for(x);
+  CodeEmitInfo* info_for_exception =
+      (x->needs_exception_state() ? state_for(x) :
+                                    state_for(x, x->state_before(), true /*ignore_xhandler*/));
 
   if (x->is_incompatible_class_change_check()) {
     assert(patching_info == NULL, "can't patch this");
     stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
+  } else if (x->is_invokespecial_receiver_check()) {
+    assert(patching_info == NULL, "can't patch this");
+    stub = new DeoptimizeStub(info_for_exception);
   } else {
     stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
   }
diff -r baf64c88538f -r a666b7151a84 src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
--- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1228,12 +1228,17 @@
   obj.load_item();
 
   // info for exceptions
-  CodeEmitInfo* info_for_exception = state_for(x);
+  CodeEmitInfo* info_for_exception =
+      (x->needs_exception_state() ? state_for(x) :
+                                    state_for(x, x->state_before(), true /*ignore_xhandler*/));
 
   CodeStub* stub;
   if (x->is_incompatible_class_change_check()) {
     assert(patching_info == NULL, "can't patch this");
     stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
+  } else if (x->is_invokespecial_receiver_check()) {
+    assert(patching_info == NULL, "can't patch this");
+    stub = new DeoptimizeStub(info_for_exception);
   } else {
     stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
   }
diff -r baf64c88538f -r a666b7151a84 src/os/linux/vm/os_linux.cpp
--- a/src/os/linux/vm/os_linux.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/os/linux/vm/os_linux.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1075,29 +1075,30 @@
 
 // Locate initial thread stack. This special handling of initial thread stack
 // is needed because pthread_getattr_np() on most (all?) Linux distros returns
-// bogus value for initial thread.
+// bogus value for the primordial process thread. While the launcher has created
+// the VM in a new thread since JDK 6, we still have to allow for the use of the
+// JNI invocation API from a primordial thread.
 void os::Linux::capture_initial_stack(size_t max_size) {
-  // stack size is the easy part, get it from RLIMIT_STACK
-  size_t stack_size;
+
+  // max_size is either 0 (which means accept OS default for thread stacks) or
+  // a user-specified value known to be at least the minimum needed. If we
+  // are actually on the primordial thread we can make it appear that we have a
+  // smaller max_size stack by inserting the guard pages at that location. But we
+  // cannot do anything to emulate a larger stack than what has been provided by
+  // the OS or threading library. In fact if we try to use a stack greater than
+  // what is set by rlimit then we will crash the hosting process.
+
+  // Maximum stack size is the easy part, get it from RLIMIT_STACK.
+  // If this is "unlimited" then it will be a huge value.
   struct rlimit rlim;
   getrlimit(RLIMIT_STACK, &rlim);
-  stack_size = rlim.rlim_cur;
+  size_t stack_size = rlim.rlim_cur;
 
   // 6308388: a bug in ld.so will relocate its own .data section to the
   //   lower end of primordial stack; reduce ulimit -s value a little bit
   //   so we won't install guard page on ld.so's data section.
   stack_size -= 2 * page_size();
 
-  // 4441425: avoid crash with "unlimited" stack size on SuSE 7.1 or Redhat
-  //   7.1, in both cases we will get 2G in return value.
-  // 4466587: glibc 2.2.x compiled w/o "--enable-kernel=2.4.0" (RH 7.0,
-  //   SuSE 7.2, Debian) can not handle alternate signal stack correctly
-  //   for initial thread if its stack size exceeds 6M. Cap it at 2M,
-  //   in case other parts in glibc still assumes 2M max stack size.
-  // FIXME: alt signal stack is gone, maybe we can relax this constraint?
-  // Problem still exists RH7.2 (IA64 anyway) but 2MB is a little small
-  if (stack_size > 2 * K * K IA64_ONLY(*2))
-      stack_size = 2 * K * K IA64_ONLY(*2);
   // Try to figure out where the stack base (top) is. This is harder.
   //
   // When an application is started, glibc saves the initial stack pointer in
@@ -1257,14 +1258,18 @@
   // stack_top could be partially down the page so align it
   stack_top = align_size_up(stack_top, page_size());
 
-  if (max_size && stack_size > max_size) {
-     _initial_thread_stack_size = max_size;
+  // Allowed stack value is minimum of max_size and what we derived from rlimit
+  if (max_size > 0) {
+    _initial_thread_stack_size = MIN2(max_size, stack_size);
   } else {
-     _initial_thread_stack_size = stack_size;
+    // Accept the rlimit max, but if stack is unlimited then it will be huge, so
+    // clamp it at 8MB as we do on Solaris
+    _initial_thread_stack_size = MIN2(stack_size, 8*M);
   }
 
   _initial_thread_stack_size = align_size_down(_initial_thread_stack_size, page_size());
   _initial_thread_stack_bottom = (address)stack_top - _initial_thread_stack_size;
+  assert(_initial_thread_stack_bottom < (address)stack_top, "overflow!");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -5282,38 +5287,16 @@
     errno = ENAMETOOLONG;
     return -1;
   }
-  int fd;
   int o_delete = (oflag & O_DELETE);
   oflag = oflag & ~O_DELETE;
 
-  fd = ::open64(path, oflag, mode);
-  if (fd == -1) return -1;
-
-  //If the open succeeded, the file might still be a directory
-  {
-    struct stat64 buf64;
-    int ret = ::fstat64(fd, &buf64);
-    int st_mode = buf64.st_mode;
-
-    if (ret != -1) {
-      if ((st_mode & S_IFMT) == S_IFDIR) {
-        errno = EISDIR;
-        ::close(fd);
-        return -1;
-      }
-    } else {
-      ::close(fd);
-      return -1;
-    }
-  }
-
-    /*
-     * All file descriptors that are opened in the JVM and not
-     * specifically destined for a subprocess should have the
-     * close-on-exec flag set.  If we don't set it, then careless 3rd
-     * party native code might fork and exec without closing all
-     * appropriate file descriptors (e.g. as we do in closeDescriptors in
-     * UNIXProcess.c), and this in turn might:
+
+    /* All file descriptors that are opened in the Java process and not
+     * specifically destined for a subprocess should have the close-on-exec
+     * flag set.  If we don't set it, then careless 3rd party native code
+     * might fork and exec without closing all appropriate file descriptors
+     * (e.g. as we do in closeDescriptors in UNIXProcess.c), and this in
+     * turn might:
      *
      * - cause end-of-file to fail to be detected on some file
      *   descriptors, resulting in mysterious hangs, or
@@ -5329,12 +5312,49 @@
      * 4843136: (process) pipe file descriptor from Runtime.exec not being closed
      * 6339493: (process) Runtime.exec does not close all file descriptors on Solaris 9
      */
+  // Modern Linux kernels (after 2.6.23 2007) support O_CLOEXEC with open().
+  // O_CLOEXEC is preferable to using FD_CLOEXEC on an open file descriptor
+  // because it saves a system call and removes a small window where the flag
+  // is unset.  On ancient Linux kernels the O_CLOEXEC flag will be ignored
+  // and we fall back to using FD_CLOEXEC (see below).
+#ifdef O_CLOEXEC
+  oflag |= O_CLOEXEC;
+#endif
+
+  int fd = ::open64(path, oflag, mode);
+  if (fd == -1) return -1;
+
+  //If the open succeeded, the file might still be a directory
+  {
+    struct stat64 buf64;
+    int ret = ::fstat64(fd, &buf64);
+    int st_mode = buf64.st_mode;
+
+    if (ret != -1) {
+      if ((st_mode & S_IFMT) == S_IFDIR) {
+        errno = EISDIR;
+        ::close(fd);
+        return -1;
+      }
+    } else {
+      ::close(fd);
+      return -1;
+    }
+  }
+
 #ifdef FD_CLOEXEC
-    {
-        int flags = ::fcntl(fd, F_GETFD);
-        if (flags != -1)
-            ::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
+  // Validate that the use of the O_CLOEXEC flag on open above worked.
+  // With recent kernels, we will perform this check exactly once.
+  static sig_atomic_t O_CLOEXEC_is_known_to_work = 0;
+  if (!O_CLOEXEC_is_known_to_work) {
+    int flags = ::fcntl(fd, F_GETFD);
+    if (flags != -1) {
+      if ((flags & FD_CLOEXEC) != 0)
+        O_CLOEXEC_is_known_to_work = 1;
+      else
+	::fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
     }
+  }
 #endif
 
   if (o_delete != 0) {
diff -r baf64c88538f -r a666b7151a84 src/os/windows/vm/os_windows.cpp
--- a/src/os/windows/vm/os_windows.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/os/windows/vm/os_windows.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -1747,8 +1747,7 @@
     if (is_workstation) {
       st->print("10");
     } else {
-      // The server version name of Windows 10 is not known at this time
-      st->print("%d.%d", major_version, minor_version);
+      st->print("Server 2016");
     }
     break;
 
diff -r baf64c88538f -r a666b7151a84 src/share/vm/c1/c1_CodeStubs.hpp
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,6 +57,7 @@
   virtual bool is_exception_throw_stub() const   { return false; }
   virtual bool is_range_check_stub() const       { return false; }
   virtual bool is_divbyzero_stub() const         { return false; }
+  virtual bool is_simple_exception_stub() const  { return false; }
 #ifndef PRODUCT
   virtual void print_name(outputStream* out) const = 0;
 #endif
@@ -484,6 +485,7 @@
   virtual void emit_code(LIR_Assembler* e);
   virtual CodeEmitInfo* info() const             { return _info; }
   virtual bool is_exception_throw_stub() const   { return true; }
+  virtual bool is_simple_exception_stub() const  { return true; }
   virtual void visit(LIR_OpVisitState* visitor) {
     if (_obj->is_valid()) visitor->do_input(_obj);
     visitor->do_slow_case(_info);
diff -r baf64c88538f -r a666b7151a84 src/share/vm/c1/c1_GraphBuilder.cpp
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1823,6 +1823,20 @@
                 log->identify(target),
                 Bytecodes::name(code));
 
+  // invoke-special-super
+  if (bc_raw == Bytecodes::_invokespecial && !target->is_object_initializer()) {
+    ciInstanceKlass* sender_klass =
+          calling_klass->is_anonymous() ? calling_klass->host_klass() :
+                                          calling_klass;
+    if (sender_klass->is_interface()) {
+      int index = state()->stack_size() - (target->arg_size_no_receiver() + 1);
+      Value receiver = state()->stack_at(index);
+      CheckCast* c = new CheckCast(sender_klass, receiver, copy_state_before());
+      c->set_invokespecial_receiver_check();
+      state()->stack_at_put(index, append_split(c));
+    }
+  }
+
   // Some methods are obviously bindable without any type checks so
   // convert them directly to an invokespecial or invokestatic.
   if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
diff -r baf64c88538f -r a666b7151a84 src/share/vm/c1/c1_Instruction.hpp
--- a/src/share/vm/c1/c1_Instruction.hpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/c1/c1_Instruction.hpp	Tue May 09 04:03:39 2017 +0100
@@ -381,6 +381,7 @@
     UnorderedIsTrueFlag,
     NeedsPatchingFlag,
     ThrowIncompatibleClassChangeErrorFlag,
+    InvokeSpecialReceiverCheckFlag,
     ProfileMDOFlag,
     IsLinkedInBlockFlag,
     NeedsRangeCheckFlag,
@@ -1456,6 +1457,16 @@
   bool is_incompatible_class_change_check() const {
     return check_flag(ThrowIncompatibleClassChangeErrorFlag);
   }
+  void set_invokespecial_receiver_check() {
+    set_flag(InvokeSpecialReceiverCheckFlag, true);
+  }
+  bool is_invokespecial_receiver_check() const {
+    return check_flag(InvokeSpecialReceiverCheckFlag);
+  }
+
+  virtual bool needs_exception_state() const {
+    return !is_invokespecial_receiver_check();
+  }
 
   ciType* declared_type() const;
 };
diff -r baf64c88538f -r a666b7151a84 src/share/vm/ci/ciInstanceKlass.cpp
--- a/src/share/vm/ci/ciInstanceKlass.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/ci/ciInstanceKlass.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -593,6 +593,16 @@
   return impl;
 }
 
+ciInstanceKlass* ciInstanceKlass::host_klass() {
+  assert(is_loaded(), "must be loaded");
+  if (is_anonymous()) {
+    VM_ENTRY_MARK
+    Klass* host_klass = get_instanceKlass()->host_klass();
+    return CURRENT_ENV->get_instance_klass(host_klass);
+  }
+  return NULL;
+}
+
 // Utility class for printing of the contents of the static fields for
 // use by compilation replay.  It only prints out the information that
 // could be consumed by the compiler, so for primitive types it prints
diff -r baf64c88538f -r a666b7151a84 src/share/vm/ci/ciInstanceKlass.hpp
--- a/src/share/vm/ci/ciInstanceKlass.hpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/ci/ciInstanceKlass.hpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -253,6 +253,8 @@
     return NULL;
   }
 
+  ciInstanceKlass* host_klass();
+
   // Dump the current state of this klass for compilation replay.
   virtual void dump_replay_data(outputStream* out);
 };
diff -r baf64c88538f -r a666b7151a84 src/share/vm/ci/ciMethod.cpp
--- a/src/share/vm/ci/ciMethod.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/ci/ciMethod.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -948,6 +948,13 @@
 }
 
 // ------------------------------------------------------------------
+// ciMethod::is_object_initializer
+//
+bool ciMethod::is_object_initializer() const {
+   return name() == ciSymbol::object_initializer_name();
+}
+
+// ------------------------------------------------------------------
 // ciMethod::has_member_arg
 //
 // Return true if the method is a linker intrinsic like _linkToVirtual.
diff -r baf64c88538f -r a666b7151a84 src/share/vm/ci/ciMethod.hpp
--- a/src/share/vm/ci/ciMethod.hpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/ci/ciMethod.hpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -316,6 +316,7 @@
   bool can_be_statically_bound() const           { return _can_be_statically_bound; }
   bool is_boxing_method() const;
   bool is_unboxing_method() const;
+  bool is_object_initializer() const;
 
   // Replay data methods
   void dump_name_as_ascii(outputStream* st);
diff -r baf64c88538f -r a666b7151a84 src/share/vm/interpreter/interpreterRuntime.cpp
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Tue May 09 04:03:39 2017 +0100
@@ -695,7 +695,8 @@
 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) {
   // extract receiver from the outgoing argument list if necessary
   Handle receiver(thread, NULL);
-  if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) {
+  if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface ||
+      bytecode == Bytecodes::_invokespecial) {
     ResourceMark rm(thread);
     methodHandle m (thread, method(thread));
     Bytecode_invoke call(m, bci(thread));
@@ -761,16 +762,25 @@
       int index = info.resolved_method()->itable_index();
       assert(info.itable_index() == index, "");
     }
+  } else if (bytecode == Bytecodes::_invokespecial) {
+    assert(info.call_kind() == CallInfo::direct_call, "must be direct call");
   } else {
     assert(info.call_kind() == CallInfo::direct_call ||
            info.call_kind() == CallInfo::vtable_call, "");
   }
 #endif
+  // Get sender or sender's host_klass, and only set cpCache entry to resolved if
+  // it is not an interface.  The receiver for invokespecial calls within interface
+  // methods must be checked for every call.
+  InstanceKlass* sender = pool->pool_holder();
+  sender = sender->is_anonymous() ? InstanceKlass::cast(sender->host_klass()) : sender;
+
   switch (info.call_kind()) {
   case CallInfo::direct_call:
     cache_entry(thread)->set_direct_call(
       bytecode,
-      info.resolved_method());
+      info.resolved_method(),
+      sender->is_interface());
     break;
   case CallInfo::vtable_call:
     cache_entry(thread)->set_vtable_call(
diff -r baf64c88538f -r a666b7151a84 src/share/vm/interpreter/linkResolver.cpp
--- a/src/share/vm/interpreter/linkResolver.cpp	Thu Sep 22 02:04:40 2016 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Tue May 09 04:03:39 2017 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -913,11 +913,11 @@
 }
 
 
-void LinkResolver::resolve_special_call(CallInfo& result, KlassHandle resolved_klass, Symbol* method_name,
+void LinkResolver::resolve_special_call(CallInfo& result, Handle recv, KlassHandle resolved_klass, Symbol* method_name,
                                         Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS) {
   methodHandle resolved_method;
   linktime_resolve_special_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
-  runtime_resolve_special_method(result, resolved_method, resolved_klass, current_klass, check_access, CHECK);
+  runtime_resolve_special_method(result, resolved_method, resolved_klass, current_klass, recv, check_access, CHECK);
 }
 
 // throws linktime exceptions
@@ -1016,7 +1016,7 @@
 
 // throws runtime exceptions
 void LinkResolver::runtime_resolve_special_method(CallInfo& result, methodHandle resolved_method, KlassHandle resolved_klass,
-                                                  KlassHandle current_klass, bool check_access, TRAPS) {
+                                                  KlassHandle current_klass, Handle recv, bool check_access, TRAPS) {
 
   // resolved method is selected method unless we have an old-style lookup
   // for a superclass method
@@ -1024,21 +1024,19 @@
   // no checks for shadowing
   methodHandle sel_method(THREAD, resolved_method());
 
+  if (check_access &&
+      // check if the method is not <init>
+      resolved_method->name() != vmSymbols::object_initializer_name()) {
+


More information about the distro-pkg-dev mailing list