Mercurial > hg > graal-compiler
comparison src/share/vm/oops/instanceKlass.cpp @ 7465:37a3e8b7a1e9
Merge
author | zgu |
---|---|
date | Tue, 08 Jan 2013 11:39:53 -0800 |
parents | ecd24264898b cc6a617fffd2 |
children | 989155e2d07a ed6154d7d259 |
comparison
equal
deleted
inserted
replaced
7464:ecd24264898b | 7465:37a3e8b7a1e9 |
---|---|
45 #include "oops/method.hpp" | 45 #include "oops/method.hpp" |
46 #include "oops/oop.inline.hpp" | 46 #include "oops/oop.inline.hpp" |
47 #include "oops/symbol.hpp" | 47 #include "oops/symbol.hpp" |
48 #include "prims/jvmtiExport.hpp" | 48 #include "prims/jvmtiExport.hpp" |
49 #include "prims/jvmtiRedefineClassesTrace.hpp" | 49 #include "prims/jvmtiRedefineClassesTrace.hpp" |
50 #include "prims/methodComparator.hpp" | |
50 #include "runtime/fieldDescriptor.hpp" | 51 #include "runtime/fieldDescriptor.hpp" |
51 #include "runtime/handles.inline.hpp" | 52 #include "runtime/handles.inline.hpp" |
52 #include "runtime/javaCalls.hpp" | 53 #include "runtime/javaCalls.hpp" |
53 #include "runtime/mutexLocker.hpp" | 54 #include "runtime/mutexLocker.hpp" |
54 #include "runtime/thread.inline.hpp" | 55 #include "runtime/thread.inline.hpp" |
362 // Null out Java heap objects, although these won't be walked to keep | 363 // Null out Java heap objects, although these won't be walked to keep |
363 // alive once this InstanceKlass is deallocated. | 364 // alive once this InstanceKlass is deallocated. |
364 set_protection_domain(NULL); | 365 set_protection_domain(NULL); |
365 set_signers(NULL); | 366 set_signers(NULL); |
366 set_init_lock(NULL); | 367 set_init_lock(NULL); |
368 | |
369 // We should deallocate the Annotations instance | |
370 MetadataFactory::free_metadata(loader_data, annotations()); | |
367 set_annotations(NULL); | 371 set_annotations(NULL); |
368 } | 372 } |
369 | 373 |
370 volatile oop InstanceKlass::init_lock() const { | 374 volatile oop InstanceKlass::init_lock() const { |
371 volatile oop lock = _init_lock; // read once | 375 volatile oop lock = _init_lock; // read once |
600 // also sets rewritten | 604 // also sets rewritten |
601 this_oop->rewrite_class(CHECK_false); | 605 this_oop->rewrite_class(CHECK_false); |
602 } | 606 } |
603 | 607 |
604 // relocate jsrs and link methods after they are all rewritten | 608 // relocate jsrs and link methods after they are all rewritten |
605 this_oop->relocate_and_link_methods(CHECK_false); | 609 this_oop->link_methods(CHECK_false); |
606 | 610 |
607 // Initialize the vtable and interface table after | 611 // Initialize the vtable and interface table after |
608 // methods have been rewritten since rewrite may | 612 // methods have been rewritten since rewrite may |
609 // fabricate new Method*s. | 613 // fabricate new Method*s. |
610 // also does loader constraint checking | 614 // also does loader constraint checking |
648 } | 652 } |
649 | 653 |
650 // Now relocate and link method entry points after class is rewritten. | 654 // Now relocate and link method entry points after class is rewritten. |
651 // This is outside is_rewritten flag. In case of an exception, it can be | 655 // This is outside is_rewritten flag. In case of an exception, it can be |
652 // executed more than once. | 656 // executed more than once. |
653 void InstanceKlass::relocate_and_link_methods(TRAPS) { | 657 void InstanceKlass::link_methods(TRAPS) { |
654 assert(is_loaded(), "must be loaded"); | 658 int len = methods()->length(); |
655 instanceKlassHandle this_oop(THREAD, this); | 659 for (int i = len-1; i >= 0; i--) { |
656 Rewriter::relocate_and_link(this_oop, CHECK); | 660 methodHandle m(THREAD, methods()->at(i)); |
661 | |
662 // Set up method entry points for compiler and interpreter . | |
663 m->link_method(m, CHECK); | |
664 | |
665 // This is for JVMTI and unrelated to relocator but the last thing we do | |
666 #ifdef ASSERT | |
667 if (StressMethodComparator) { | |
668 ResourceMark rm(THREAD); | |
669 static int nmc = 0; | |
670 for (int j = i; j >= 0 && j >= i-4; j--) { | |
671 if ((++nmc % 1000) == 0) tty->print_cr("Have run MethodComparator %d times...", nmc); | |
672 bool z = MethodComparator::methods_EMCP(m(), | |
673 methods()->at(j)); | |
674 if (j == i && !z) { | |
675 tty->print("MethodComparator FAIL: "); m->print(); m->print_codes(); | |
676 assert(z, "method must compare equal to itself"); | |
677 } | |
678 } | |
679 } | |
680 #endif //ASSERT | |
681 } | |
657 } | 682 } |
658 | 683 |
659 | 684 |
660 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { | 685 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { |
661 // Make sure klass is linked (verified) before initialization | 686 // Make sure klass is linked (verified) before initialization |