# HG changeset patch # User asaha # Date 1434726377 25200 # Node ID 20bad8c6c7b406c3603b4e22b15cd990840a9d62 # Parent 37eb076f5b7a7a3f864f3a9e8f1c8611b2627a30# Parent 48603bfe84387ee7d60f3df5e5be172657d86aad Merge diff -r 48603bfe8438 -r 20bad8c6c7b4 .hgtags --- a/.hgtags Fri Jun 19 07:37:36 2015 -0700 +++ b/.hgtags Fri Jun 19 08:06:17 2015 -0700 @@ -649,3 +649,20 @@ 3cb364e46590add7cb42ec8b6565a3c62adf824d jdk8u45-b35 48b09bb741171b0069000ac1cf5407ef2357d3d1 jdk8u45-b36 3c2ea5da6afd55a524e25dc56747940324befda2 jdk8u45-b37 +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 diff -r 48603bfe8438 -r 20bad8c6c7b4 make/hotspot_version --- a/make/hotspot_version Fri Jun 19 07:37:36 2015 -0700 +++ b/make/hotspot_version Fri Jun 19 08:06:17 2015 -0700 @@ -34,7 +34,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2015 HS_MAJOR_VER=25 -HS_MINOR_VER=45 +HS_MINOR_VER=51 HS_BUILD_NUMBER=03 JDK_MAJOR_VER=1 diff -r 48603bfe8438 -r 20bad8c6c7b4 src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp Fri Jun 19 07:37:36 2015 -0700 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Fri Jun 19 08:06:17 2015 -0700 @@ -2204,7 +2204,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()); diff -r 48603bfe8438 -r 20bad8c6c7b4 src/share/vm/classfile/systemDictionary.cpp --- a/src/share/vm/classfile/systemDictionary.cpp Fri Jun 19 07:37:36 2015 -0700 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Jun 19 08:06:17 2015 -0700 @@ -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); diff -r 48603bfe8438 -r 20bad8c6c7b4 src/share/vm/prims/jvmtiClassFileReconstituter.hpp --- a/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Fri Jun 19 07:37:36 2015 -0700 +++ b/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Fri Jun 19 08:06:17 2015 -0700 @@ -68,11 +68,11 @@ ~JvmtiConstantPoolReconstituter() { if (_symmap != NULL) { - os::free(_symmap, mtClass); + delete _symmap; _symmap = NULL; } if (_classmap != NULL) { - os::free(_classmap, mtClass); + delete _classmap; _classmap = NULL; } }