changeset 5933:3b1d2b70f86e

Merge from main OpenJDK repository
author Greg Lewis <glewis@eyesbeyond.com>
date Sat, 20 Aug 2016 11:56:24 -0700
parents ab7efd71a2f1 1fc8b9f201f8
children 368df6a4b403
files .hgtags make/defs.make
diffstat 8 files changed, 86 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Sun May 01 16:42:53 2016 -0700
+++ b/.hgtags	Sat Aug 20 11:56:24 2016 -0700
@@ -839,3 +839,5 @@
 b3c5ff648bcad305163b323ad15dde1b6234d501 jdk7u95-b00
 631da593499ee184ea8efb2bc5491e0d99ac636d jdk7u99-b00
 6e42747134be8a4a366d337da1fc84a847ad8381 jdk7u101-b00
+14d0f4da4a74897fc3274f8f549f41544bb4625a jdk7u111-b00
+9efa3fae3c278a7f48badec775d7f9b2d5320b6d jdk7u111-b01
--- a/make/defs.make	Sun May 01 16:42:53 2016 -0700
+++ b/make/defs.make	Sat Aug 20 11:56:24 2016 -0700
@@ -101,6 +101,18 @@
 # hotspot version definitions
 include $(GAMMADIR)/make/hotspot_version
 
+# When config parameter JDK_UPDATE_VERSION is defined,
+# Hotspot minor version should be set to that
+ifneq ($(JDK_UPDATE_VERSION),)
+  HS_MINOR_VER=$(JDK_UPDATE_VERSION)
+endif
+
+# When config parameter JDK_BUILD_NUMBER is defined,
+# Hotspot build number should be set to that
+ifneq ($(JDK_BUILD_NUMBER),)
+  HS_BUILD_NUMBER=$(subst b,,$(JDK_BUILD_NUMBER))
+endif
+
 # Java versions needed
 ifeq ($(PREVIOUS_JDK_VERSION),)
   PREVIOUS_JDK_VERSION=$(JDK_PREVIOUS_VERSION)
--- a/make/hotspot_version	Sun May 01 16:42:53 2016 -0700
+++ b/make/hotspot_version	Sat Aug 20 11:56:24 2016 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=24
 HS_MINOR_VER=95
-HS_BUILD_NUMBER=01
+HS_BUILD_NUMBER=00
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/make/linux/makefiles/gcc.make	Sun May 01 16:42:53 2016 -0700
+++ b/make/linux/makefiles/gcc.make	Sat Aug 20 11:56:24 2016 -0700
@@ -80,6 +80,7 @@
 CFLAGS += $(LIBFFI_CFLAGS)
 CFLAGS += $(LLVM_CFLAGS)
 endif
+CFLAGS += -std=gnu++98
 CFLAGS += $(VM_PICFLAG)
 CFLAGS += -fno-rtti
 CFLAGS += -fno-exceptions
@@ -90,6 +91,12 @@
 ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
 CFLAGS += -fvisibility=hidden
 endif
+# GCC 6 has more aggressive dead-store elimination which causes the VM to crash
+# It also optimises away null pointer checks which are still needed.
+# We turn both of these optimisations off.
+ifneq "$(shell expr \( $(CC_VER_MAJOR) \>= 6 \))" "0"
+CFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
+endif
 
 ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
 ARCHFLAG/i486    = -m32 -march=i586
--- a/src/share/vm/classfile/systemDictionary.cpp	Sun May 01 16:42:53 2016 -0700
+++ b/src/share/vm/classfile/systemDictionary.cpp	Sat Aug 20 11:56:24 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -1185,8 +1185,13 @@
 
     if (ik->super() != NULL) {
       Symbol*  cn = ik->super()->klass_part()->name();
-      resolve_super_or_fail(class_name, cn,
-                            class_loader, Handle(), true, CHECK_(nh));
+      klassOop s = resolve_super_or_fail(class_name, cn,
+                                         class_loader, Handle(), true, CHECK_(nh));
+      if (s->klass_part() != ik->super()->klass_part()) {
+        // The dynamically resolved super class is not the same as the one we used during dump time,
+        // so we cannot use ik.
+        return nh;
+      }
     }
 
     objArrayHandle interfaces (THREAD, ik->local_interfaces());
@@ -1199,7 +1204,12 @@
       // reinitialized yet (they will be once the interface classes
       // are loaded)
       Symbol*  name  = k->klass_part()->name();
-      resolve_super_or_fail(class_name, name, class_loader, Handle(), false, CHECK_(nh));
+      klassOop i = resolve_super_or_fail(class_name, name, class_loader, Handle(), false, CHECK_(nh));
+      if (k->klass_part() != i->klass_part()) {
+        // The dynamically resolved interface class is not the same as the one we used during dump time,
+        // so we cannot use i.
+        return nh;
+      }
     }
 
     // Adjust methods to recover missing data.  They need addresses for
--- a/src/share/vm/classfile/verifier.cpp	Sun May 01 16:42:53 2016 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Sat Aug 20 11:56:24 2016 -0700
@@ -2287,9 +2287,17 @@
       case Bytecodes::_ifnonnull:
         target = bcs.dest();
         if (visited_branches->contains(bci)) {
-          if (bci_stack->is_empty()) return true;
-          // Pop a bytecode starting offset and scan from there.
-          bcs.set_start(bci_stack->pop());
+          if (bci_stack->is_empty()) {
+            if (handler_stack->is_empty()) {
+              return true;
+            } else {
+              // Parse the catch handlers for try blocks containing athrow.
+              bcs.set_start(handler_stack->pop());
+            }
+          } else {
+            // Pop a bytecode starting offset and scan from there.
+            bcs.set_start(bci_stack->pop());
+          }
         } else {
           if (target > bci) { // forward branch
             if (target >= code_length) return false;
@@ -2312,9 +2320,17 @@
       case Bytecodes::_goto_w:
         target = (opcode == Bytecodes::_goto ? bcs.dest() : bcs.dest_w());
         if (visited_branches->contains(bci)) {
-          if (bci_stack->is_empty()) return true;
-          // Been here before, pop new starting offset from stack.
-          bcs.set_start(bci_stack->pop());
+          if (bci_stack->is_empty()) {
+            if (handler_stack->is_empty()) {
+              return true;
+            } else {
+              // Parse the catch handlers for try blocks containing athrow.
+              bcs.set_start(handler_stack->pop());
+            }
+          } else {
+            // Been here before, pop new starting offset from stack.
+            bcs.set_start(bci_stack->pop());
+          }
         } else {
           if (target >= code_length) return false;
           // Continue scanning from the target onward.
--- a/src/share/vm/interpreter/bytecodeStream.cpp	Sun May 01 16:42:53 2016 -0700
+++ b/src/share/vm/interpreter/bytecodeStream.cpp	Sat Aug 20 11:56:24 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -31,12 +31,12 @@
   // set next bytecode position
   address bcp = RawBytecodeStream::bcp();
   address end = method()->code_base() + end_bci();
-  int l = Bytecodes::raw_special_length_at(bcp, end);
-  if (l <= 0 || (_bci + l) > _end_bci) {
+  int len = Bytecodes::raw_special_length_at(bcp, end);
+  // Very large tableswitch or lookupswitch size can cause _next_bci to overflow.
+  if (len <= 0 || (_bci > _end_bci - len) || (_bci - len >= _next_bci)) {
     code = Bytecodes::_illegal;
   } else {
-    _next_bci += l;
-    assert(_bci < _next_bci, "length must be > 0");
+    _next_bci += len;
     // set attributes
     _is_wide = false;
     // check for special (uncommon) cases
--- a/src/share/vm/interpreter/bytecodeStream.hpp	Sun May 01 16:42:53 2016 -0700
+++ b/src/share/vm/interpreter/bytecodeStream.hpp	Sat Aug 20 11:56:24 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, 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
@@ -148,12 +148,15 @@
     code        = Bytecodes::code_or_bp_at(bcp);
 
     // set next bytecode position
-    int l = Bytecodes::length_for(code);
-    if (l > 0 && (_bci + l) <= _end_bci) {
+    int len = Bytecodes::length_for(code);
+    if (len > 0 && (_bci <= _end_bci - len)) {
       assert(code != Bytecodes::_wide && code != Bytecodes::_tableswitch
              && code != Bytecodes::_lookupswitch, "can't be special bytecode");
       _is_wide = false;
-      _next_bci += l;
+      _next_bci += len;
+      if (_next_bci <= _bci) { // Check for integer overflow
+        code = Bytecodes::_illegal;
+      }
       _raw_code = code;
       return code;
     } else {
@@ -202,19 +205,23 @@
       // note that we cannot advance before having the
       // tty bytecode otherwise the stepping is wrong!
       // (carefull: length_for(...) must be used first!)
-      int l = Bytecodes::length_for(code);
-      if (l == 0) l = Bytecodes::length_at(_method(), bcp);
-      _next_bci  += l;
-      assert(_bci < _next_bci, "length must be > 0");
-      // set attributes
-      _is_wide      = false;
-      // check for special (uncommon) cases
-      if (code == Bytecodes::_wide) {
-        raw_code = (Bytecodes::Code)bcp[1];
-        code = raw_code;  // wide BCs are always Java-normal
-        _is_wide = true;
+      int len = Bytecodes::length_for(code);
+      if (len == 0) len = Bytecodes::length_at(_method(), bcp);
+      if (len <= 0 || (_bci > _end_bci - len) || (_bci - len >= _next_bci)) {
+        raw_code = code = Bytecodes::_illegal;
+      } else {
+        _next_bci  += len;
+        assert(_bci < _next_bci, "length must be > 0");
+        // set attributes
+        _is_wide      = false;
+        // check for special (uncommon) cases
+        if (code == Bytecodes::_wide) {
+          raw_code = (Bytecodes::Code)bcp[1];
+          code = raw_code;  // wide BCs are always Java-normal
+          _is_wide = true;
+        }
+        assert(Bytecodes::is_java_code(code), "sanity check");
       }
-      assert(Bytecodes::is_java_code(code), "sanity check");
     }
     _raw_code = raw_code;
     _code = code;