changeset 8547:11098f828fb8 arch64-jdk8u60-b24

Merge
author adinn
date Mon, 20 Jul 2015 15:22:38 +0100
parents 1ad2c1aa7aac (current diff) 6b4ea38c01bd (diff)
children 157a24cf87d5
files .hgtags THIRD_PARTY_README make/hotspot_version src/share/vm/c1/c1_LIRGenerator.cpp src/share/vm/ci/ciMethod.cpp src/share/vm/ci/ciMethod.hpp src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/systemDictionary.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp src/share/vm/oops/method.cpp src/share/vm/oops/method.hpp src/share/vm/opto/compile.cpp src/share/vm/opto/library_call.cpp src/share/vm/runtime/deoptimization.cpp test/testlibrary/com/oracle/java/testlibrary/Platform.java
diffstat 28 files changed, 263 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Jul 02 12:42:24 2015 +0100
+++ b/.hgtags	Mon Jul 20 15:22:38 2015 +0100
@@ -573,6 +573,7 @@
 4206e725d584be942c25ff46ff23d8e299ca4a4c jdk8u31-b13
 b517d3a9aebf0fee64808f9a7c0ef8e0b82d5ed3 jdk8u31-b31
 15d8108258cb60a58bdd03b9ff8e77dd6727a804 jdk8u31-b32
+26b1dc6891c4fae03575a9090f7d04bd631d9164 jdk8u31-b33
 1b3abbeee961dee49780c0e4af5337feb918c555 jdk8u40-b10
 f10fe402dfb1543723b4b117a7cba3ea3d4159f1 hs25.40-b15
 99372b2fee0eb8b3452f47230e84aa6e97003184 jdk8u40-b11
@@ -602,6 +603,8 @@
 719def58024b06fea3028879bbb8ebbf69a4e566 jdk8u40-b25
 f39b6944ad447269b81e06ca5da9edff9e9e67c8 jdk8u40-b26
 6824e2475e0432e27f9cc51838bc34ea5fbf5113 jdk8u40-b27
+8220f68a195f6eeed2f5fb6e8a303726b512e899 jdk8u40-b31
+850a290eb1088a61178d1910c500e170ef4f4386 jdk8u40-b32
 b95f13f05f553309cd74d6ccf8fcedb259c6716c jdk8u45-b00
 41c3c456e326185053f0654be838f4b0bfb38078 jdk8u45-b01
 626fd8c2eec63e2a2dff3839bfe12c0431bf00a4 jdk8u45-b02
@@ -617,6 +620,26 @@
 dc29108bcbcbfcd49eaa9135368306dc85db73a6 jdk8u45-b12
 efbf340fc7f56e49735111c23cef030413146409 jdk8u45-b13
 5321d26956b283b7cb73b04b91db41c7c9fe9158 jdk8u45-b14
+a5ba7c9a0b916ea088aaac5d40e17b4675c2b026 jdk8u45-b15
+894b92a02c533bcd1203c4beb5b6ec067b63466e jdk8u45-b31
+1428b6aa09c4e17202b801530c3c4993c7ce8e5b jdk8u45-b32
+b22b01407a8140041545afe1f2d6335db4d94ba5 jdk8u51-b00
+c1de2652a48c1d4a0c96707acc73db3cd317df2a jdk8u51-b01
+8f03c2f5fc170da5fca2cf65734941efb619feca jdk8u51-b02
+cf295659243009ded76b6c14307c177a02f9fe82 jdk8u51-b03
+0b3f449553884d88f6c9d7ab067fa858f18cc3f1 jdk8u51-b04
+6ce994385353023e6b3f9c5ef331f390b324a355 jdk8u51-b05
+3816de51b5e7d6050584057fae5f2262dae53d7e jdk8u51-b06
+5c017acbaf015fb8ecca6f00870965f3deb4e1ac jdk8u51-b07
+631d4029d851b59613e6748e17447001a682276e jdk8u51-b08
+ce81c4487dd1e9f89d4570a8cd25e349f6bae00d jdk8u51-b09
+928e1994ad43272f808ca22b9cc1b08a7ce2824f jdk8u51-b10
+1a122beb9dc6881850ef1d1250f40a83709b8b72 jdk8u51-b11
+05c80f1060f0c0d5720de9eadd09162af1168eab jdk8u51-b12
+07e103f3f43886a3b47945e5295eb5accad505de jdk8u51-b13
+a4eea4bee2d4fdb05f1a8358d70ec6adb1135526 jdk8u51-b14
+9a70cba6a3c3e44486f9c199d03a16b2b09d0a13 jdk8u51-b15
+3639e38bd73f5efa8ce092f0a745bb0c90759575 jdk8u51-b16
 d9349fa8822336e0244da0a8448f3e6b2d62741d jdk8u60-b00
 d9349fa8822336e0244da0a8448f3e6b2d62741d hs25.60-b00
 ebf89088c08ab0508b9002b48dd3d68a340259af hs25.60-b01
@@ -660,3 +683,9 @@
 e01a710549a962cee94728271248a7d89fb56c49 hs25.60-b20
 3b6c97747ccc61d189bca64b4afa3ffc13680810 jdk8u60-b20
 4b6687a4f2fe84211b8b3b5afb34b5186afbddf6 hs25.60-b21
+e0d75c284bd1c09fd7d9ef09627d8a99b88d468d jdk8u60-b21
+ff8fdeb2fb6d6f3348597339c53412f8f6202c3f hs25.60-b22
+878cb0df27c22c6b1e9f4add1eb3da3edc8ab51d jdk8u60-b22
+0e4094950cd312c8f95c7f37336606323fe049fe jdk8u60-b23
+d89ceecf1bad55e1aee2932b8895d60fc64c15db hs25.60-b23
+fb157d537278cda4150740e27bb57cd8694e15bf jdk8u60-b24
--- a/THIRD_PARTY_README	Thu Jul 02 12:42:24 2015 +0100
+++ b/THIRD_PARTY_README	Mon Jul 20 15:22:38 2015 +0100
@@ -1140,37 +1140,6 @@
 
 --------------------------------------------------------------------------------
 
-%% This notice is provided with respect to JSON, which may be included 
-with JRE 8 & JDK 8.
-
---- begin of LICENSE ---
-
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
---- end of LICENSE ---
-
--------------------------------------------------------------------------------
-
 %% This notice is provided with respect to Kerberos functionality, which 
 which may be included with JRE 8, JDK 8, and OpenJDK 8.
 
@@ -1250,7 +1219,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libpng 1.6.16, which may be
+%% This notice is provided with respect to libpng 1.6.16, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -1370,7 +1339,7 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to libungif 4.1.3, which may be 
+%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
@@ -1399,13 +1368,13 @@
 
 -------------------------------------------------------------------------------
 
-%% This notice is provided with respect to Little CMS 2.5, which may be 
+%% This notice is provided with respect to Little CMS 2.7, which may be 
 included with JRE 8, JDK 8, and OpenJDK 8.
 
 --- begin of LICENSE ---
 
 Little CMS
-Copyright (c) 1998-2011 Marti Maria Saguer
+Copyright (c) 1998-2015 Marti Maria Saguer
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
--- a/make/hotspot_version	Thu Jul 02 12:42:24 2015 +0100
+++ b/make/hotspot_version	Mon Jul 20 15:22:38 2015 +0100
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=60
-HS_BUILD_NUMBER=21
+HS_BUILD_NUMBER=23
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -10,7 +10,7 @@
  * 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 hat
+ * 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
--- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -189,7 +189,7 @@
     return CPUVisitor::visit(nodeh, state);
   }
 
-  PICL(bool is_fujitsu) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
+  PICL(bool is_fujitsu, bool is_sun4v) : _L1_data_cache_line_size(0), _L2_data_cache_line_size(0), _dl_handle(NULL) {
     if (!open_library()) {
       return;
     }
@@ -201,7 +201,7 @@
         if (is_fujitsu) {
           cpu_class = "core";
         }
-        CPUVisitor cpu_visitor(this, os::processor_count());
+        CPUVisitor cpu_visitor(this, (is_sun4v && !is_fujitsu) ? 1 : os::processor_count());
         _picl_walk_tree_by_class(rooth, cpu_class, &cpu_visitor, PICL_visit_cpu_helper);
         if (cpu_visitor.l1_visitor()->is_assigned()) { // Is there a value?
           _L1_data_cache_line_size = cpu_visitor.l1_visitor()->value();
@@ -494,7 +494,7 @@
   }
 
   // Figure out cache line sizes using PICL
-  PICL picl((features & sparc64_family_m) != 0);
+  PICL picl((features & sparc64_family_m) != 0, (features & sun4v_m) != 0);
   _L2_data_cache_line_size = picl.L2_data_cache_line_size();
 
   return features;
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -2220,7 +2220,15 @@
   if (log2_scale != 0) {
     // temporary fix (platform dependent code without shift on Intel would be better)
     // TODO: ARM also allows embedded shift in the address
-    __ shift_left(index_op, log2_scale, index_op);
+    LIR_Opr tmp = new_pointer_register();
+    if (TwoOperandLIRForm) {
+      __ move(index_op, tmp);
+      index_op = tmp;
+    }
+    __ shift_left(index_op, log2_scale, tmp);
+    if (!TwoOperandLIRForm) {
+      index_op = tmp;
+    }
   }
 
   LIR_Address* addr = new LIR_Address(base_op, index_op, x->basic_type());
--- a/src/share/vm/ci/ciMethod.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/ci/ciMethod.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -70,8 +70,7 @@
 // Loaded method.
 ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
   ciMetadata(h_m()),
-  _holder(holder),
-  _has_injected_profile(false)
+  _holder(holder)
 {
   assert(h_m() != NULL, "no null method");
 
@@ -168,8 +167,7 @@
   _liveness(               NULL),
   _can_be_statically_bound(false),
   _method_blocks(          NULL),
-  _method_data(            NULL),
-  _has_injected_profile(   false)
+  _method_data(            NULL)
 #if defined(COMPILER2) || defined(SHARK)
   ,
   _flow(                   NULL),
--- a/src/share/vm/ci/ciMethod.hpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/ci/ciMethod.hpp	Mon Jul 20 15:22:38 2015 +0100
@@ -78,7 +78,6 @@
   bool _is_c1_compilable;
   bool _is_c2_compilable;
   bool _can_be_statically_bound;
-  bool _has_injected_profile;
 
   // Lazy fields, filled in on demand
   address              _code;
@@ -173,9 +172,9 @@
   // Code size for inlining decisions.
   int code_size_for_inlining();
 
-  bool caller_sensitive() { return get_Method()->caller_sensitive(); }
-  bool force_inline()     { return get_Method()->force_inline();     }
-  bool dont_inline()      { return get_Method()->dont_inline();      }
+  bool caller_sensitive()   const { return get_Method()->caller_sensitive();   }
+  bool force_inline()       const { return get_Method()->force_inline();       }
+  bool dont_inline()        const { return get_Method()->dont_inline();        }
 
   int comp_level();
   int highest_osr_comp_level();
@@ -283,9 +282,6 @@
   int instructions_size();
   int scale_count(int count, float prof_factor = 1.);  // make MDO count commensurate with IIC
 
-  bool has_injected_profile() const { return _has_injected_profile;     }
-  void set_injected_profile(bool x) {        _has_injected_profile = x; }
-
   // Stack walking support
   bool is_ignored_by_security_stack_walk() const;
 
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/classfile/classFileParser.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -1783,6 +1783,10 @@
     if (_location != _in_method)  break;  // only allow for methods
     if (!privileged)              break;  // only allow in privileged code
     return _method_DontInline;
+  case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_InjectedProfile_signature):
+    if (_location != _in_method)  break;  // only allow for methods
+    if (!privileged)              break;  // only allow in privileged code
+    return _method_InjectedProfile;
   case vmSymbols::VM_SYMBOL_ENUM_NAME(java_lang_invoke_LambdaForm_Compiled_signature):
     if (_location != _in_method)  break;  // only allow for methods
     if (!privileged)              break;  // only allow in privileged code
@@ -1824,6 +1828,8 @@
     m->set_force_inline(true);
   if (has_annotation(_method_DontInline))
     m->set_dont_inline(true);
+  if (has_annotation(_method_InjectedProfile))
+    m->set_has_injected_profile(true);
   if (has_annotation(_method_LambdaForm_Compiled) && m->intrinsic_id() == vmIntrinsics::_none)
     m->set_intrinsic_id(vmIntrinsics::_compiledLambdaForm);
   if (has_annotation(_method_LambdaForm_Hidden))
--- a/src/share/vm/classfile/classFileParser.hpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/classfile/classFileParser.hpp	Mon Jul 20 15:22:38 2015 +0100
@@ -126,6 +126,7 @@
       _method_CallerSensitive,
       _method_ForceInline,
       _method_DontInline,
+      _method_InjectedProfile,
       _method_LambdaForm_Compiled,
       _method_LambdaForm_Hidden,
       _sun_misc_Contended,
--- a/src/share/vm/classfile/systemDictionary.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/classfile/systemDictionary.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -2349,9 +2349,6 @@
   assert(!THREAD->is_Compiler_thread(), "");
   Handle method_type =
     SystemDictionary::find_method_handle_type(signature, accessing_klass, CHECK_(empty));
-  if (false) {  // FIXME: Decide if the Java upcall should resolve signatures.
-    method_type = java_lang_String::create_from_symbol(signature, CHECK_(empty));
-  }
 
   KlassHandle  mh_klass = SystemDictionary::MethodHandle_klass();
   int ref_kind = JVM_REF_invokeVirtual;
@@ -2383,6 +2380,24 @@
   return unpack_method_and_appendix(mname, accessing_klass, appendix_box, appendix_result, THREAD);
 }
 
+// Decide if we can globally cache a lookup of this class, to be returned to any client that asks.
+// We must ensure that all class loaders everywhere will reach this class, for any client.
+// This is a safe bet for public classes in java.lang, such as Object and String.
+// We also include public classes in java.lang.invoke, because they appear frequently in system-level method types.
+// Out of an abundance of caution, we do not include any other classes, not even for packages like java.util.
+static bool is_always_visible_class(oop mirror) {
+  Klass* klass = java_lang_Class::as_Klass(mirror);
+  if (klass->oop_is_objArray()) {
+    klass = ObjArrayKlass::cast(klass)->bottom_klass(); // check element type
+  }
+  if (klass->oop_is_typeArray()) {
+    return true; // primitive array
+  }
+  assert(klass->oop_is_instance(), klass->external_name());
+  return klass->is_public() &&
+         (InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::Object_klass()) ||       // java.lang
+          InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::MethodHandle_klass()));  // java.lang.invoke
+}
 
 // Ask Java code to find or construct a java.lang.invoke.MethodType for the given
 // signature, as interpreted relative to the given class loader.
@@ -2405,32 +2420,33 @@
   }
 
   Handle class_loader, protection_domain;
-  bool is_on_bcp = true;  // keep this true as long as we can materialize from the boot classloader
+  if (accessing_klass.not_null()) {
+    class_loader      = Handle(THREAD, InstanceKlass::cast(accessing_klass())->class_loader());
+    protection_domain = Handle(THREAD, InstanceKlass::cast(accessing_klass())->protection_domain());
+  }
+  bool can_be_cached = true;
   int npts = ArgumentCount(signature).size();
   objArrayHandle pts = oopFactory::new_objArray(SystemDictionary::Class_klass(), npts, CHECK_(empty));
   int arg = 0;
-  Handle rt;                            // the return type from the signature
+  Handle rt; // the return type from the signature
   ResourceMark rm(THREAD);
   for (SignatureStream ss(signature); !ss.is_done(); ss.next()) {
     oop mirror = NULL;
-    if (is_on_bcp) {
-      // Note:  class_loader & protection_domain are both null at this point.
-      mirror = ss.as_java_mirror(class_loader, protection_domain,
+    if (can_be_cached) {
+      // Use neutral class loader to lookup candidate classes to be placed in the cache.
+      mirror = ss.as_java_mirror(Handle(), Handle(),
                                  SignatureStream::ReturnNull, CHECK_(empty));
-      if (mirror == NULL) {
-        // fall back from BCP to accessing_klass
-        if (accessing_klass.not_null()) {
-          class_loader      = Handle(THREAD, InstanceKlass::cast(accessing_klass())->class_loader());
-          protection_domain = Handle(THREAD, InstanceKlass::cast(accessing_klass())->protection_domain());
-        }
-        is_on_bcp = false;
+      if (mirror == NULL || (ss.is_object() && !is_always_visible_class(mirror))) {
+        // Fall back to accessing_klass context.
+        can_be_cached = false;
       }
     }
-    if (!is_on_bcp) {
+    if (!can_be_cached) {
       // Resolve, throwing a real error if it doesn't work.
       mirror = ss.as_java_mirror(class_loader, protection_domain,
                                  SignatureStream::NCDFError, CHECK_(empty));
     }
+    assert(!oopDesc::is_null(mirror), ss.as_symbol(THREAD)->as_C_string());
     if (ss.at_return_type())
       rt = Handle(THREAD, mirror);
     else
@@ -2462,7 +2478,7 @@
                          &args, CHECK_(empty));
   Handle method_type(THREAD, (oop) result.get_jobject());
 
-  if (is_on_bcp) {
+  if (can_be_cached) {
     // We can cache this MethodType inside the JVM.
     MutexLocker ml(SystemDictionary_lock, THREAD);
     spe = invoke_method_table()->find_entry(index, hash, signature, null_iid);
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/classfile/vmSymbols.hpp	Mon Jul 20 15:22:38 2015 +0100
@@ -278,6 +278,7 @@
   template(java_lang_invoke_LambdaForm,               "java/lang/invoke/LambdaForm")              \
   template(java_lang_invoke_ForceInline_signature,    "Ljava/lang/invoke/ForceInline;")           \
   template(java_lang_invoke_DontInline_signature,     "Ljava/lang/invoke/DontInline;")            \
+  template(java_lang_invoke_InjectedProfile_signature, "Ljava/lang/invoke/InjectedProfile;")      \
   template(java_lang_invoke_Stable_signature,         "Ljava/lang/invoke/Stable;")                \
   template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
   template(java_lang_invoke_LambdaForm_Hidden_signature, "Ljava/lang/invoke/LambdaForm$Hidden;")  \
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -3339,9 +3339,11 @@
   // Not unloading classes this cycle
   assert(!should_unload_classes(), "Inconsitency!");
 
+  // If we are not unloading classes then add SO_AllCodeCache to root
+  // scanning options.
+  add_root_scanning_option(rso);
+
   if ((!verifying() || unloaded_classes_last_cycle()) && should_verify) {
-    // Include symbols, strings and code cache elements to prevent their resurrection.
-    add_root_scanning_option(rso);
     set_verifying(true);
   } else if (verifying() && !should_verify) {
     // We were verifying, but some verification flags got disabled.
--- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
--- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Mon Jul 20 15:22:38 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
--- a/src/share/vm/oops/method.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/oops/method.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -92,6 +92,7 @@
   set_force_inline(false);
   set_hidden(false);
   set_dont_inline(false);
+  set_has_injected_profile(false);
   set_method_data(NULL);
   clear_method_counters();
   set_vtable_index(Method::garbage_vtable_index);
--- a/src/share/vm/oops/method.hpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/oops/method.hpp	Mon Jul 20 15:22:38 2015 +0100
@@ -109,12 +109,13 @@
 #endif
   u2                _method_size;                // size of this object
   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
-  u1                _jfr_towrite      : 1,       // Flags
-                    _caller_sensitive : 1,
-                    _force_inline     : 1,
-                    _hidden           : 1,
-                    _dont_inline      : 1,
-                                      : 3;
+  u1                _jfr_towrite          : 1,   // Flags
+                    _caller_sensitive     : 1,
+                    _force_inline         : 1,
+                    _hidden               : 1,
+                    _dont_inline          : 1,
+                    _has_injected_profile : 1,
+                                          : 2;
 
 #ifndef PRODUCT
   int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
@@ -786,16 +787,19 @@
   void init_intrinsic_id();     // updates from _none if a match
   static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
 
-  bool     jfr_towrite()            { return _jfr_towrite;          }
-  void set_jfr_towrite(bool x)      {        _jfr_towrite = x;      }
-  bool     caller_sensitive()       { return _caller_sensitive;     }
-  void set_caller_sensitive(bool x) {        _caller_sensitive = x; }
-  bool     force_inline()           { return _force_inline;         }
-  void set_force_inline(bool x)     {        _force_inline = x;     }
-  bool     dont_inline()            { return _dont_inline;          }
-  void set_dont_inline(bool x)      {        _dont_inline = x;      }
-  bool  is_hidden()                 { return _hidden;               }
-  void set_hidden(bool x)           {        _hidden = x;           }
+  bool     jfr_towrite()                { return _jfr_towrite;              }
+  void set_jfr_towrite(bool x)          {        _jfr_towrite = x;          }
+  bool     caller_sensitive()           { return _caller_sensitive;         }
+  void set_caller_sensitive(bool x)     {        _caller_sensitive = x;     }
+  bool     force_inline()               { return _force_inline;             }
+  void set_force_inline(bool x)         {        _force_inline = x;         }
+  bool     dont_inline()                { return _dont_inline;              }
+  void set_dont_inline(bool x)          {        _dont_inline = x;          }
+  bool  is_hidden()                     { return _hidden;                   }
+  void set_hidden(bool x)               {        _hidden = x;               }
+  bool     has_injected_profile()       { return _has_injected_profile;     }
+  void set_has_injected_profile(bool x) {        _has_injected_profile = x; }
+
   ConstMethod::MethodType method_type() const {
       return _constMethod->method_type();
   }
--- a/src/share/vm/opto/compile.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/opto/compile.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -3337,9 +3337,6 @@
 bool Compile::too_many_traps(ciMethod* method,
                              int bci,
                              Deoptimization::DeoptReason reason) {
-  if (method->has_injected_profile()) {
-    return false;
-  }
   ciMethodData* md = method->method_data();
   if (md->is_empty()) {
     // Assume the trap has not occurred, or that it occurred only
@@ -3389,9 +3386,6 @@
 bool Compile::too_many_recompiles(ciMethod* method,
                                   int bci,
                                   Deoptimization::DeoptReason reason) {
-  if (method->has_injected_profile()) {
-    return false;
-  }
   ciMethodData* md = method->method_data();
   if (md->is_empty()) {
     // Assume the trap has not occurred, or that it occurred only
--- a/src/share/vm/opto/library_call.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/opto/library_call.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -6565,8 +6565,6 @@
     jint false_cnt = aobj->element_value(0).as_int();
     jint  true_cnt = aobj->element_value(1).as_int();
 
-    method()->set_injected_profile(true);
-
     if (C->log() != NULL) {
       C->log()->elem("observe source='profileBoolean' false='%d' true='%d'",
                      false_cnt, true_cnt);
--- a/src/share/vm/runtime/deoptimization.cpp	Thu Jul 02 12:42:24 2015 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Mon Jul 20 15:22:38 2015 +0100
@@ -1483,7 +1483,10 @@
     //
     // The other actions cause immediate removal of the present code.
 
-    bool update_trap_state = true;
+    // Traps caused by injected profile shouldn't pollute trap counts.
+    bool injected_profile_trap = trap_method->has_injected_profile() &&
+                                 (reason == Reason_intrinsic || reason == Reason_unreached);
+    bool update_trap_state = !injected_profile_trap;
     bool make_not_entrant = false;
     bool make_not_compilable = false;
     bool reprofile = false;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jsr292/PollutedTrapCounts.java	Mon Jul 20 15:22:38 2015 +0100
@@ -0,0 +1,109 @@
+/*
+ * 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 8074551
+ * @library /testlibrary
+ * @run main PollutedTrapCounts
+ */
+import java.lang.invoke.*;
+import com.oracle.java.testlibrary.*;
+
+public class PollutedTrapCounts {
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+                "-XX:+IgnoreUnrecognizedVMOptions",
+                "-XX:-TieredCompilation", "-Xbatch",
+                "-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
+                "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
+                    "PollutedTrapCounts$Test");
+
+        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+
+        analyzer.shouldHaveExitValue(0);
+
+        analyzer.shouldNotContain("not compilable (disabled)");
+    }
+
+    static class Test {
+        public static final MethodHandle test1;
+        public static final MethodHandle test2;
+        public static final MethodHandle empty;
+
+        static {
+            try {
+                Class<?> THIS_CLASS = Test.class;
+                MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+                test1 = LOOKUP.findStatic(THIS_CLASS, "test1", MethodType.methodType(boolean.class, boolean.class));
+                test2 = LOOKUP.findStatic(THIS_CLASS, "test2", MethodType.methodType(boolean.class, boolean.class));
+                empty = LOOKUP.findStatic(THIS_CLASS, "empty", MethodType.methodType(void.class, boolean.class));
+            } catch(Throwable e) {
+                throw new Error(e);
+            }
+        }
+
+        static boolean test1(boolean b) {
+            return b;
+        }
+        static boolean test2(boolean b) {
+            return true;
+        }
+        static void    empty(boolean b) {}
+
+        static void test(boolean freqValue, boolean removeInlineBlocker) throws Throwable {
+            MethodHandle innerGWT = MethodHandles.guardWithTest(test1, empty, empty);
+            MethodHandle outerGWT = MethodHandles.guardWithTest(test2, innerGWT, innerGWT);
+
+            // Trigger compilation
+            for (int i = 0; i < 20_000; i++) {
+                outerGWT.invokeExact(freqValue);
+            }
+
+            // Trigger deopt & nmethod invalidation
+            outerGWT.invokeExact(!freqValue);
+
+            // Force inline blocker removal on rare-taken path
+            if (removeInlineBlocker) {
+                for (int i = 0; i < 100; i++) {
+                    outerGWT.invokeExact(!freqValue);
+                }
+            }
+
+            // Trigger recompilation
+            for (int i = 0; i < 20_000; i++) {
+                outerGWT.invokeExact(freqValue);
+            }
+        }
+
+        public static void main(String[] args) throws Throwable {
+            boolean freqValue = true;
+            boolean removeInlineBlocker = false;
+            for (int i = 0; i < 20; i++) {
+                test(freqValue, removeInlineBlocker);
+                freqValue = !freqValue;
+                removeInlineBlocker = !removeInlineBlocker;
+            }
+        }
+    }
+}
--- a/test/gc/g1/TestGCLogMessages.java	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/gc/g1/TestGCLogMessages.java	Mon Jul 20 15:22:38 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
--- a/test/runtime/InitialThreadOverflow/testme.sh	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/runtime/InitialThreadOverflow/testme.sh	Mon Jul 20 15:22:38 2015 +0100
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
--- a/test/serviceability/jvmti/GetObjectSizeOverflow.java	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/serviceability/jvmti/GetObjectSizeOverflow.java	Mon Jul 20 15:22:38 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
--- a/test/testlibrary/ctw/Makefile	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/testlibrary/ctw/Makefile	Mon Jul 20 15:22:38 2015 +0100
@@ -8,7 +8,7 @@
 #
 # 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
+# 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).
 #
--- a/test/testlibrary/ctw/README	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/testlibrary/ctw/README	Mon Jul 20 15:22:38 2015 +0100
@@ -1,26 +1,26 @@
-#
-# Copyright (c) 2013, 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.
-#
-#
+
+Copyright (c) 2013, 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.
+
+
 
 DESCRIPTION
 
--- a/test/testlibrary/whitebox/Makefile	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/testlibrary/whitebox/Makefile	Mon Jul 20 15:22:38 2015 +0100
@@ -8,7 +8,7 @@
 #
 # 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
+# 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).
 #
--- a/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Thu Jul 02 12:42:24 2015 +0100
+++ b/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Mon Jul 20 15:22:38 2015 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -43,7 +43,7 @@
  */
 public class TestMutuallyExclusivePlatformPredicates {
     private static enum MethodGroup {
-        ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64"),
+        ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64", "isAArch64"),
         BITNESS("is32bit", "is64bit"),
         OS("isAix", "isLinux", "isSolaris", "isWindows", "isOSX"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal"),