equal
deleted
inserted
replaced
684 bool InstanceKlass::verify_code(TRAPS) { |
684 bool InstanceKlass::verify_code(TRAPS) { |
685 // 1) Verify the bytecodes |
685 // 1) Verify the bytecodes |
686 return Verifier::verify(this, should_verify_class(), THREAD); |
686 return Verifier::verify(this, should_verify_class(), THREAD); |
687 } |
687 } |
688 |
688 |
689 |
|
690 // Used exclusively by the shared spaces dump mechanism to prevent |
|
691 // classes mapped into the shared regions in new VMs from appearing linked. |
|
692 |
|
693 void InstanceKlass::unlink_class() { |
|
694 assert(is_linked(), "must be linked"); |
|
695 _init_state = loaded; |
|
696 } |
|
697 |
|
698 void InstanceKlass::link_class(TRAPS) { |
689 void InstanceKlass::link_class(TRAPS) { |
699 assert(is_loaded(), "must be loaded"); |
690 assert(is_loaded(), "must be loaded"); |
700 if (!is_linked()) { |
691 if (!is_linked()) { |
701 link_class_impl(CHECK); |
692 link_class_impl(CHECK); |
702 } |
693 } |
2298 // is_linked() is true. |
2289 // is_linked() is true. |
2299 // If there's a linking error, there is nothing else to remove. |
2290 // If there's a linking error, there is nothing else to remove. |
2300 return; |
2291 return; |
2301 } |
2292 } |
2302 |
2293 |
2303 // Unlink the class |
2294 // Reset to the 'allocated' state to prevent any premature accessing to |
2304 if (is_linked()) { |
2295 // a shared class at runtime while the class is still being loaded and |
2305 unlink_class(); |
2296 // restored. A class' init_state is set to 'loaded' at runtime when it's |
2306 } |
2297 // being added to class hierarchy (see SystemDictionary:::add_to_hierarchy()). |
|
2298 _init_state = allocated; |
|
2299 |
2307 { |
2300 { |
2308 MutexLocker ml(Compile_lock); |
2301 MutexLocker ml(Compile_lock); |
2309 init_implementor(); |
2302 init_implementor(); |
2310 } |
2303 } |
2311 |
2304 |
2348 array_klasses()->remove_java_mirror(); |
2341 array_klasses()->remove_java_mirror(); |
2349 } |
2342 } |
2350 } |
2343 } |
2351 |
2344 |
2352 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { |
2345 void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { |
|
2346 // SystemDictionary::add_to_hierarchy() sets the init_state to loaded |
|
2347 // before the InstanceKlass is added to the SystemDictionary. Make |
|
2348 // sure the current state is <loaded. |
|
2349 assert(!is_loaded(), "invalid init state"); |
2353 set_package(loader_data, CHECK); |
2350 set_package(loader_data, CHECK); |
2354 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK); |
2351 Klass::restore_unshareable_info(loader_data, protection_domain, CHECK); |
2355 |
2352 |
2356 Array<Method*>* methods = this->methods(); |
2353 Array<Method*>* methods = this->methods(); |
2357 int num_methods = methods->length(); |
2354 int num_methods = methods->length(); |