50 #include "services/threadService.hpp" 51 #include "utilities/bytes.hpp" 52 #include "logging/log.hpp" 53 54 #define NOFAILOVER_MAJOR_VERSION 51 55 #define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51 56 #define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 57 58 // Access to external entry for VerifyClassCodes - old byte code verifier 59 60 extern "C" { 61 typedef jboolean (*verify_byte_codes_fn_t)(JNIEnv *, jclass, char *, jint); 62 typedef jboolean (*verify_byte_codes_fn_new_t)(JNIEnv *, jclass, char *, jint, jint); 63 } 64 65 static void* volatile _verify_byte_codes_fn = NULL; 66 67 static volatile jint _is_new_verify_byte_codes_fn = (jint) true; 68 69 static void* verify_byte_codes_fn() { 70 if (_verify_byte_codes_fn == NULL) { 71 void *lib_handle = os::native_java_library(); 72 void *func = os::dll_lookup(lib_handle, "VerifyClassCodesForMajorVersion"); 73 OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func); 74 if (func == NULL) { 75 OrderAccess::release_store(&_is_new_verify_byte_codes_fn, false); 76 func = os::dll_lookup(lib_handle, "VerifyClassCodes"); 77 OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func); 78 } 79 } 80 return (void*)_verify_byte_codes_fn; 81 } 82 83 84 // Methods in Verifier 85 86 bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) { 87 return (class_loader == NULL || !should_verify_class) ? 88 BytecodeVerificationLocal : BytecodeVerificationRemote; 89 } 90 91 bool Verifier::relax_verify_for(oop loader) { 92 bool trusted = java_lang_ClassLoader::is_trusted_loader(loader); 93 bool need_verify = 94 // verifyAll 95 (BytecodeVerificationLocal && BytecodeVerificationRemote) || | 50 #include "services/threadService.hpp" 51 #include "utilities/bytes.hpp" 52 #include "logging/log.hpp" 53 54 #define NOFAILOVER_MAJOR_VERSION 51 55 #define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51 56 #define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52 57 58 // Access to external entry for VerifyClassCodes - old byte code verifier 59 60 extern "C" { 61 typedef jboolean (*verify_byte_codes_fn_t)(JNIEnv *, jclass, char *, jint); 62 typedef jboolean (*verify_byte_codes_fn_new_t)(JNIEnv *, jclass, char *, jint, jint); 63 } 64 65 static void* volatile _verify_byte_codes_fn = NULL; 66 67 static volatile jint _is_new_verify_byte_codes_fn = (jint) true; 68 69 static void* verify_byte_codes_fn() { 70 if (OrderAccess::load_ptr_acquire(&_verify_byte_codes_fn) == NULL) { 71 void *lib_handle = os::native_java_library(); 72 void *func = os::dll_lookup(lib_handle, "VerifyClassCodesForMajorVersion"); 73 OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func); 74 if (func == NULL) { 75 _is_new_verify_byte_codes_fn = false; 76 func = os::dll_lookup(lib_handle, "VerifyClassCodes"); 77 OrderAccess::release_store_ptr(&_verify_byte_codes_fn, func); 78 } 79 } 80 return (void*)_verify_byte_codes_fn; 81 } 82 83 84 // Methods in Verifier 85 86 bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) { 87 return (class_loader == NULL || !should_verify_class) ? 88 BytecodeVerificationLocal : BytecodeVerificationRemote; 89 } 90 91 bool Verifier::relax_verify_for(oop loader) { 92 bool trusted = java_lang_ClassLoader::is_trusted_loader(loader); 93 bool need_verify = 94 // verifyAll 95 (BytecodeVerificationLocal && BytecodeVerificationRemote) || |