Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/instanceKlass.cpp @ 7459:cc6a617fffd2
8005494: SIGSEGV in Rewriter::relocate_and_link() when testing Weblogic with CompressedOops and KlassPtrs
Summary: Relocate functions with jsr's when rewriting so not repeated after reading shared archive
Reviewed-by: twisti, jrose
author | coleenp |
---|---|
date | Wed, 02 Jan 2013 20:28:09 -0500 |
parents | 35431a769282 |
children | 37a3e8b7a1e9 |
comparison
equal
deleted
inserted
replaced
7458:4daebd4cc1dd | 7459:cc6a617fffd2 |
---|---|
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" |
600 // also sets rewritten | 601 // also sets rewritten |
601 this_oop->rewrite_class(CHECK_false); | 602 this_oop->rewrite_class(CHECK_false); |
602 } | 603 } |
603 | 604 |
604 // relocate jsrs and link methods after they are all rewritten | 605 // relocate jsrs and link methods after they are all rewritten |
605 this_oop->relocate_and_link_methods(CHECK_false); | 606 this_oop->link_methods(CHECK_false); |
606 | 607 |
607 // Initialize the vtable and interface table after | 608 // Initialize the vtable and interface table after |
608 // methods have been rewritten since rewrite may | 609 // methods have been rewritten since rewrite may |
609 // fabricate new Method*s. | 610 // fabricate new Method*s. |
610 // also does loader constraint checking | 611 // also does loader constraint checking |
648 } | 649 } |
649 | 650 |
650 // Now relocate and link method entry points after class is rewritten. | 651 // 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 | 652 // This is outside is_rewritten flag. In case of an exception, it can be |
652 // executed more than once. | 653 // executed more than once. |
653 void InstanceKlass::relocate_and_link_methods(TRAPS) { | 654 void InstanceKlass::link_methods(TRAPS) { |
654 assert(is_loaded(), "must be loaded"); | 655 int len = methods()->length(); |
655 instanceKlassHandle this_oop(THREAD, this); | 656 for (int i = len-1; i >= 0; i--) { |
656 Rewriter::relocate_and_link(this_oop, CHECK); | 657 methodHandle m(THREAD, methods()->at(i)); |
658 | |
659 // Set up method entry points for compiler and interpreter . | |
660 m->link_method(m, CHECK); | |
661 | |
662 // This is for JVMTI and unrelated to relocator but the last thing we do | |
663 #ifdef ASSERT | |
664 if (StressMethodComparator) { | |
665 ResourceMark rm(THREAD); | |
666 static int nmc = 0; | |
667 for (int j = i; j >= 0 && j >= i-4; j--) { | |
668 if ((++nmc % 1000) == 0) tty->print_cr("Have run MethodComparator %d times...", nmc); | |
669 bool z = MethodComparator::methods_EMCP(m(), | |
670 methods()->at(j)); | |
671 if (j == i && !z) { | |
672 tty->print("MethodComparator FAIL: "); m->print(); m->print_codes(); | |
673 assert(z, "method must compare equal to itself"); | |
674 } | |
675 } | |
676 } | |
677 #endif //ASSERT | |
678 } | |
657 } | 679 } |
658 | 680 |
659 | 681 |
660 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { | 682 void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) { |
661 // Make sure klass is linked (verified) before initialization | 683 // Make sure klass is linked (verified) before initialization |