Mercurial > hg > truffle
comparison src/share/vm/classfile/verifier.cpp @ 973:ad6585fd4087
6830542: Performance: JVM_DefineClass already verified.
Reviewed-by: kamg, phh
author | acorn |
---|---|
date | Fri, 04 Sep 2009 12:53:02 -0400 |
parents | bd02caa94611 |
children | 389049f3f393 |
comparison
equal
deleted
inserted
replaced
967:6918603297f7 | 973:ad6585fd4087 |
---|---|
51 } | 51 } |
52 | 52 |
53 | 53 |
54 // Methods in Verifier | 54 // Methods in Verifier |
55 | 55 |
56 bool Verifier::should_verify_for(oop class_loader) { | 56 bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) { |
57 return class_loader == NULL ? | 57 return (class_loader == NULL || !should_verify_class) ? |
58 BytecodeVerificationLocal : BytecodeVerificationRemote; | 58 BytecodeVerificationLocal : BytecodeVerificationRemote; |
59 } | 59 } |
60 | 60 |
61 bool Verifier::relax_verify_for(oop loader) { | 61 bool Verifier::relax_verify_for(oop loader) { |
62 bool trusted = java_lang_ClassLoader::is_trusted_loader(loader); | 62 bool trusted = java_lang_ClassLoader::is_trusted_loader(loader); |
66 // verifyRemote | 66 // verifyRemote |
67 (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted); | 67 (!BytecodeVerificationLocal && BytecodeVerificationRemote && !trusted); |
68 return !need_verify; | 68 return !need_verify; |
69 } | 69 } |
70 | 70 |
71 bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, TRAPS) { | 71 bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool should_verify_class, TRAPS) { |
72 ResourceMark rm(THREAD); | 72 ResourceMark rm(THREAD); |
73 HandleMark hm; | 73 HandleMark hm; |
74 | 74 |
75 symbolHandle exception_name; | 75 symbolHandle exception_name; |
76 const size_t message_buffer_len = klass->name()->utf8_length() + 1024; | 76 const size_t message_buffer_len = klass->name()->utf8_length() + 1024; |
79 const char* klassName = klass->external_name(); | 79 const char* klassName = klass->external_name(); |
80 | 80 |
81 // If the class should be verified, first see if we can use the split | 81 // If the class should be verified, first see if we can use the split |
82 // verifier. If not, or if verification fails and FailOverToOldVerifier | 82 // verifier. If not, or if verification fails and FailOverToOldVerifier |
83 // is set, then call the inference verifier. | 83 // is set, then call the inference verifier. |
84 if (is_eligible_for_verification(klass)) { | 84 if (is_eligible_for_verification(klass, should_verify_class)) { |
85 if (TraceClassInitialization) { | 85 if (TraceClassInitialization) { |
86 tty->print_cr("Start class verification for: %s", klassName); | 86 tty->print_cr("Start class verification for: %s", klassName); |
87 } | 87 } |
88 if (UseSplitVerifier && | 88 if (UseSplitVerifier && |
89 klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) { | 89 klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) { |
139 message_buffer[message_buffer_len - 1] = '\0'; // just to be sure | 139 message_buffer[message_buffer_len - 1] = '\0'; // just to be sure |
140 THROW_MSG_(exception_name, message_buffer, false); | 140 THROW_MSG_(exception_name, message_buffer, false); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 bool Verifier::is_eligible_for_verification(instanceKlassHandle klass) { | 144 bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) { |
145 symbolOop name = klass->name(); | 145 symbolOop name = klass->name(); |
146 klassOop refl_magic_klass = SystemDictionary::reflect_magic_klass(); | 146 klassOop refl_magic_klass = SystemDictionary::reflect_magic_klass(); |
147 | 147 |
148 return (should_verify_for(klass->class_loader()) && | 148 return (should_verify_for(klass->class_loader(), should_verify_class) && |
149 // return if the class is a bootstrapping class | 149 // return if the class is a bootstrapping class |
150 // or defineClass specified not to verify by default (flags override passed arg) | |
150 // We need to skip the following four for bootstraping | 151 // We need to skip the following four for bootstraping |
151 name != vmSymbols::java_lang_Object() && | 152 name != vmSymbols::java_lang_Object() && |
152 name != vmSymbols::java_lang_Class() && | 153 name != vmSymbols::java_lang_Class() && |
153 name != vmSymbols::java_lang_String() && | 154 name != vmSymbols::java_lang_String() && |
154 name != vmSymbols::java_lang_Throwable() && | 155 name != vmSymbols::java_lang_Throwable() && |