8023872: Verification error in generated lambda classes
authoracorn
Fri, 30 Aug 2013 15:15:56 -0400
changeset 19704 475be20c57de
parent 19697 d55ba95422d7
child 19705 dff6ed7dbae2
8023872: Verification error in generated lambda classes Summary: skip verification for generated lambda classes Reviewed-by: kamg, dholmes
hotspot/src/share/vm/classfile/verifier.cpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Fri Aug 30 07:04:42 2013 -0700
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Fri Aug 30 15:15:56 2013 -0400
@@ -188,6 +188,10 @@
 bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) {
   Symbol* name = klass->name();
   Klass* refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass();
+  Klass* lambda_magic_klass = SystemDictionary::lambda_MagicLambdaImpl_klass();
+
+  bool is_reflect = refl_magic_klass != NULL && klass->is_subtype_of(refl_magic_klass);
+  bool is_lambda = lambda_magic_klass != NULL && klass->is_subtype_of(lambda_magic_klass);
 
   return (should_verify_for(klass->class_loader(), should_verify_class) &&
     // return if the class is a bootstrapping class
@@ -210,9 +214,9 @@
     // sun/reflect/SerializationConstructorAccessor.
     // NOTE: this is called too early in the bootstrapping process to be
     // guarded by Universe::is_gte_jdk14x_version()/UseNewReflection.
-    (refl_magic_klass == NULL ||
-     !klass->is_subtype_of(refl_magic_klass) ||
-     VerifyReflectionBytecodes)
+    // Also for lambda generated code, gte jdk8
+    (!is_reflect || VerifyReflectionBytecodes) &&
+    (!is_lambda || VerifyLambdaBytecodes)
   );
 }
 
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Aug 30 07:04:42 2013 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Fri Aug 30 15:15:56 2013 -0400
@@ -3514,6 +3514,8 @@
           "Temporary flag for transition to AbstractMethodError wrapped "   \
           "in InvocationTargetException. See 6531596")                      \
                                                                             \
+  develop(bool, VerifyLambdaBytecodes, false,                               \
+          "Force verification of jdk 8 lambda metafactory bytecodes.")      \
                                                                             \
   develop(intx, FastSuperclassLimit, 8,                                     \
           "Depth of hardwired instanceof accelerator array")                \