comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 1d7922586cf6
children 4bfe8b33cf66
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
31 #include "interpreter/interpreterRuntime.hpp" 31 #include "interpreter/interpreterRuntime.hpp"
32 #include "interpreter/linkResolver.hpp" 32 #include "interpreter/linkResolver.hpp"
33 #include "interpreter/templateTable.hpp" 33 #include "interpreter/templateTable.hpp"
34 #include "memory/oopFactory.hpp" 34 #include "memory/oopFactory.hpp"
35 #include "memory/universe.inline.hpp" 35 #include "memory/universe.inline.hpp"
36 #include "oops/constantPoolOop.hpp" 36 #include "oops/constantPool.hpp"
37 #include "oops/cpCacheOop.hpp"
38 #include "oops/instanceKlass.hpp" 37 #include "oops/instanceKlass.hpp"
39 #include "oops/methodDataOop.hpp" 38 #include "oops/methodData.hpp"
40 #include "oops/objArrayKlass.hpp" 39 #include "oops/objArrayKlass.hpp"
41 #include "oops/oop.inline.hpp" 40 #include "oops/oop.inline.hpp"
42 #include "oops/symbol.hpp" 41 #include "oops/symbol.hpp"
43 #include "prims/jvmtiExport.hpp" 42 #include "prims/jvmtiExport.hpp"
44 #include "prims/nativeLookup.hpp" 43 #include "prims/nativeLookup.hpp"
96 void InterpreterRuntime::set_bcp_and_mdp(address bcp, JavaThread *thread) { 95 void InterpreterRuntime::set_bcp_and_mdp(address bcp, JavaThread *thread) {
97 last_frame(thread).interpreter_frame_set_bcp(bcp); 96 last_frame(thread).interpreter_frame_set_bcp(bcp);
98 if (ProfileInterpreter) { 97 if (ProfileInterpreter) {
99 // ProfileTraps uses MDOs independently of ProfileInterpreter. 98 // ProfileTraps uses MDOs independently of ProfileInterpreter.
100 // That is why we must check both ProfileInterpreter and mdo != NULL. 99 // That is why we must check both ProfileInterpreter and mdo != NULL.
101 methodDataOop mdo = last_frame(thread).interpreter_frame_method()->method_data(); 100 MethodData* mdo = last_frame(thread).interpreter_frame_method()->method_data();
102 if (mdo != NULL) { 101 if (mdo != NULL) {
103 NEEDS_CLEANUP; 102 NEEDS_CLEANUP;
104 last_frame(thread).interpreter_frame_set_mdp(mdo->bci_to_dp(last_frame(thread).interpreter_frame_bci())); 103 last_frame(thread).interpreter_frame_set_mdp(mdo->bci_to_dp(last_frame(thread).interpreter_frame_bci()));
105 } 104 }
106 } 105 }
110 // Constants 109 // Constants
111 110
112 111
113 IRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* thread, bool wide)) 112 IRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* thread, bool wide))
114 // access constant pool 113 // access constant pool
115 constantPoolOop pool = method(thread)->constants(); 114 ConstantPool* pool = method(thread)->constants();
116 int index = wide ? get_index_u2(thread, Bytecodes::_ldc_w) : get_index_u1(thread, Bytecodes::_ldc); 115 int index = wide ? get_index_u2(thread, Bytecodes::_ldc_w) : get_index_u1(thread, Bytecodes::_ldc);
117 constantTag tag = pool->tag_at(index); 116 constantTag tag = pool->tag_at(index);
118 117
119 if (tag.is_unresolved_klass() || tag.is_klass()) { 118 assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
120 klassOop klass = pool->klass_at(index, CHECK); 119 Klass* klass = pool->klass_at(index, CHECK);
121 oop java_class = klass->java_mirror(); 120 oop java_class = klass->java_mirror();
122 thread->set_vm_result(java_class); 121 thread->set_vm_result(java_class);
123 } else {
124 #ifdef ASSERT
125 // If we entered this runtime routine, we believed the tag contained
126 // an unresolved string, an unresolved class or a resolved class.
127 // However, another thread could have resolved the unresolved string
128 // or class by the time we go there.
129 assert(tag.is_unresolved_string()|| tag.is_string(), "expected string");
130 #endif
131 oop s_oop = pool->string_at(index, CHECK);
132 thread->set_vm_result(s_oop);
133 }
134 IRT_END 122 IRT_END
135 123
136 IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) { 124 IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
137 assert(bytecode == Bytecodes::_fast_aldc || 125 assert(bytecode == Bytecodes::_fast_aldc ||
138 bytecode == Bytecodes::_fast_aldc_w, "wrong bc"); 126 bytecode == Bytecodes::_fast_aldc_w, "wrong bc");
142 oop result = ldc.resolve_constant(CHECK); 130 oop result = ldc.resolve_constant(CHECK);
143 #ifdef ASSERT 131 #ifdef ASSERT
144 { 132 {
145 // The bytecode wrappers aren't GC-safe so construct a new one 133 // The bytecode wrappers aren't GC-safe so construct a new one
146 Bytecode_loadconstant ldc2(m, bci(thread)); 134 Bytecode_loadconstant ldc2(m, bci(thread));
147 ConstantPoolCacheEntry* cpce = m->constants()->cache()->entry_at(ldc2.cache_index()); 135 oop coop = m->constants()->resolved_references()->obj_at(ldc2.cache_index());
148 assert(result == cpce->f1_as_instance(), "expected result for assembly code"); 136 assert(result == coop, "expected result for assembly code");
149 } 137 }
150 #endif 138 #endif
139 thread->set_vm_result(result);
151 } 140 }
152 IRT_END 141 IRT_END
153 142
154 143
155 //------------------------------------------------------------------------------------------------------------------------ 144 //------------------------------------------------------------------------------------------------------------------------
156 // Allocation 145 // Allocation
157 146
158 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, constantPoolOopDesc* pool, int index)) 147 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
159 klassOop k_oop = pool->klass_at(index, CHECK); 148 Klass* k_oop = pool->klass_at(index, CHECK);
160 instanceKlassHandle klass (THREAD, k_oop); 149 instanceKlassHandle klass (THREAD, k_oop);
161 150
162 // Make sure we are not instantiating an abstract klass 151 // Make sure we are not instantiating an abstract klass
163 klass->check_valid_for_instantiation(true, CHECK); 152 klass->check_valid_for_instantiation(true, CHECK);
164 153
188 oop obj = oopFactory::new_typeArray(type, size, CHECK); 177 oop obj = oopFactory::new_typeArray(type, size, CHECK);
189 thread->set_vm_result(obj); 178 thread->set_vm_result(obj);
190 IRT_END 179 IRT_END
191 180
192 181
193 IRT_ENTRY(void, InterpreterRuntime::anewarray(JavaThread* thread, constantPoolOopDesc* pool, int index, jint size)) 182 IRT_ENTRY(void, InterpreterRuntime::anewarray(JavaThread* thread, ConstantPool* pool, int index, jint size))
194 // Note: no oopHandle for pool & klass needed since they are not used 183 // Note: no oopHandle for pool & klass needed since they are not used
195 // anymore after new_objArray() and no GC can happen before. 184 // anymore after new_objArray() and no GC can happen before.
196 // (This may have to change if this code changes!) 185 // (This may have to change if this code changes!)
197 klassOop klass = pool->klass_at(index, CHECK); 186 Klass* klass = pool->klass_at(index, CHECK);
198 objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK); 187 objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
199 thread->set_vm_result(obj); 188 thread->set_vm_result(obj);
200 IRT_END 189 IRT_END
201 190
202 191
203 IRT_ENTRY(void, InterpreterRuntime::multianewarray(JavaThread* thread, jint* first_size_address)) 192 IRT_ENTRY(void, InterpreterRuntime::multianewarray(JavaThread* thread, jint* first_size_address))
204 // We may want to pass in more arguments - could make this slightly faster 193 // We may want to pass in more arguments - could make this slightly faster
205 constantPoolOop constants = method(thread)->constants(); 194 ConstantPool* constants = method(thread)->constants();
206 int i = get_index_u2(thread, Bytecodes::_multianewarray); 195 int i = get_index_u2(thread, Bytecodes::_multianewarray);
207 klassOop klass = constants->klass_at(i, CHECK); 196 Klass* klass = constants->klass_at(i, CHECK);
208 int nof_dims = number_of_dimensions(thread); 197 int nof_dims = number_of_dimensions(thread);
209 assert(oop(klass)->is_klass(), "not a class"); 198 assert(klass->is_klass(), "not a class");
210 assert(nof_dims >= 1, "multianewarray rank must be nonzero"); 199 assert(nof_dims >= 1, "multianewarray rank must be nonzero");
211 200
212 // We must create an array of jints to pass to multi_allocate. 201 // We must create an array of jints to pass to multi_allocate.
213 ResourceMark rm(thread); 202 ResourceMark rm(thread);
214 const int small_dims = 10; 203 const int small_dims = 10;
227 IRT_END 216 IRT_END
228 217
229 218
230 IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj)) 219 IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
231 assert(obj->is_oop(), "must be a valid oop"); 220 assert(obj->is_oop(), "must be a valid oop");
232 assert(obj->klass()->klass_part()->has_finalizer(), "shouldn't be here otherwise"); 221 assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
233 instanceKlass::register_finalizer(instanceOop(obj), CHECK); 222 InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
234 IRT_END 223 IRT_END
235 224
236 225
237 // Quicken instance-of and check-cast bytecodes 226 // Quicken instance-of and check-cast bytecodes
238 IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread)) 227 IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
239 // Force resolving; quicken the bytecode 228 // Force resolving; quicken the bytecode
240 int which = get_index_u2(thread, Bytecodes::_checkcast); 229 int which = get_index_u2(thread, Bytecodes::_checkcast);
241 constantPoolOop cpool = method(thread)->constants(); 230 ConstantPool* cpool = method(thread)->constants();
242 // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded 231 // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
243 // program we might have seen an unquick'd bytecode in the interpreter but have another 232 // program we might have seen an unquick'd bytecode in the interpreter but have another
244 // thread quicken the bytecode before we get here. 233 // thread quicken the bytecode before we get here.
245 // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" ); 234 // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
246 klassOop klass = cpool->klass_at(which, CHECK); 235 Klass* klass = cpool->klass_at(which, CHECK);
247 thread->set_vm_result(klass); 236 thread->set_vm_result_2(klass);
248 IRT_END 237 IRT_END
249 238
250 239
251 //------------------------------------------------------------------------------------------------------------------------ 240 //------------------------------------------------------------------------------------------------------------------------
252 // Exceptions 241 // Exceptions
256 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) { 245 void InterpreterRuntime::note_trap(JavaThread* thread, int reason, TRAPS) {
257 assert(ProfileTraps, "call me only if profiling"); 246 assert(ProfileTraps, "call me only if profiling");
258 methodHandle trap_method(thread, method(thread)); 247 methodHandle trap_method(thread, method(thread));
259 248
260 if (trap_method.not_null()) { 249 if (trap_method.not_null()) {
261 methodDataHandle trap_mdo(thread, trap_method->method_data()); 250 MethodData* trap_mdo = trap_method->method_data();
262 if (trap_mdo.is_null()) { 251 if (trap_mdo == NULL) {
263 methodOopDesc::build_interpreter_method_data(trap_method, THREAD); 252 Method::build_interpreter_method_data(trap_method, THREAD);
264 if (HAS_PENDING_EXCEPTION) { 253 if (HAS_PENDING_EXCEPTION) {
265 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); 254 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
266 CLEAR_PENDING_EXCEPTION; 255 CLEAR_PENDING_EXCEPTION;
267 } 256 }
268 trap_mdo = methodDataHandle(thread, trap_method->method_data()); 257 trap_mdo = trap_method->method_data();
269 // and fall through... 258 // and fall through...
270 } 259 }
271 if (trap_mdo.not_null()) { 260 if (trap_mdo != NULL) {
272 // Update per-method count of trap events. The interpreter 261 // Update per-method count of trap events. The interpreter
273 // is updating the MDO to simulate the effect of compiler traps. 262 // is updating the MDO to simulate the effect of compiler traps.
274 int trap_bci = trap_method->bci_from(bcp(thread)); 263 int trap_bci = trap_method->bci_from(bcp(thread));
275 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason); 264 Deoptimization::update_method_data_from_interpreter(trap_mdo, trap_bci, reason);
276 } 265 }
277 } 266 }
278 } 267 }
279 268
280 static Handle get_preinitialized_exception(klassOop k, TRAPS) { 269 static Handle get_preinitialized_exception(Klass* k, TRAPS) {
281 // get klass 270 // get klass
282 instanceKlass* klass = instanceKlass::cast(k); 271 InstanceKlass* klass = InstanceKlass::cast(k);
283 assert(klass->is_initialized(), 272 assert(klass->is_initialized(),
284 "this klass should have been initialized during VM initialization"); 273 "this klass should have been initialized during VM initialization");
285 // create instance - do not call constructor since we may have no 274 // create instance - do not call constructor since we may have no
286 // (java) stack space left (should assert constructor is empty) 275 // (java) stack space left (should assert constructor is empty)
287 Handle exception; 276 Handle exception;
415 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", h_exception->print_value_string(), (address)h_exception()); 404 tty->print_cr("Exception <%s> (" INTPTR_FORMAT ")", h_exception->print_value_string(), (address)h_exception());
416 tty->print_cr(" thrown in interpreter method <%s>", h_method->print_value_string()); 405 tty->print_cr(" thrown in interpreter method <%s>", h_method->print_value_string());
417 tty->print_cr(" at bci %d for thread " INTPTR_FORMAT, current_bci, thread); 406 tty->print_cr(" at bci %d for thread " INTPTR_FORMAT, current_bci, thread);
418 } 407 }
419 // Don't go paging in something which won't be used. 408 // Don't go paging in something which won't be used.
420 // else if (h_extable->length() == 0) { 409 // else if (extable->length() == 0) {
421 // // disabled for now - interpreter is not using shortcut yet 410 // // disabled for now - interpreter is not using shortcut yet
422 // // (shortcut is not to call runtime if we have no exception handlers) 411 // // (shortcut is not to call runtime if we have no exception handlers)
423 // // warning("performance bug: should not call runtime if method has no exception handlers"); 412 // // warning("performance bug: should not call runtime if method has no exception handlers");
424 // } 413 // }
425 // for AbortVMOnException flag 414 // for AbortVMOnException flag
532 521
533 // We also need to delay resolving getstatic instructions until the 522 // We also need to delay resolving getstatic instructions until the
534 // class is intitialized. This is required so that access to the static 523 // class is intitialized. This is required so that access to the static
535 // field will call the initialization function every time until the class 524 // field will call the initialization function every time until the class
536 // is completely initialized ala. in 2.17.5 in JVM Specification. 525 // is completely initialized ala. in 2.17.5 in JVM Specification.
537 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); 526 InstanceKlass *klass = InstanceKlass::cast(info.klass()());
538 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && 527 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
539 !klass->is_initialized()); 528 !klass->is_initialized());
540 Bytecodes::Code get_code = (Bytecodes::Code)0; 529 Bytecodes::Code get_code = (Bytecodes::Code)0;
541 530
542 if (!uninitialized_static) { 531 if (!uninitialized_static) {
552 info.klass(), 541 info.klass(),
553 info.field_index(), 542 info.field_index(),
554 info.field_offset(), 543 info.field_offset(),
555 state, 544 state,
556 info.access_flags().is_final(), 545 info.access_flags().is_final(),
557 info.access_flags().is_volatile() 546 info.access_flags().is_volatile(),
547 pool->pool_holder()
558 ); 548 );
559 IRT_END 549 IRT_END
560 550
561 551
562 //------------------------------------------------------------------------------------------------------------------------ 552 //------------------------------------------------------------------------------------------------------------------------
642 632
643 633
644 //------------------------------------------------------------------------------------------------------------------------ 634 //------------------------------------------------------------------------------------------------------------------------
645 // Invokes 635 // Invokes
646 636
647 IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp)) 637 IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, Method* method, address bcp))
648 return method->orig_bytecode_at(method->bci_from(bcp)); 638 return method->orig_bytecode_at(method->bci_from(bcp));
649 IRT_END 639 IRT_END
650 640
651 IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp, Bytecodes::Code new_code)) 641 IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code))
652 method->set_orig_bytecode_at(method->bci_from(bcp), new_code); 642 method->set_orig_bytecode_at(method->bci_from(bcp), new_code);
653 IRT_END 643 IRT_END
654 644
655 IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, methodOopDesc* method, address bcp)) 645 IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, Method* method, address bcp))
656 JvmtiExport::post_raw_breakpoint(thread, method, bcp); 646 JvmtiExport::post_raw_breakpoint(thread, method, bcp);
657 IRT_END 647 IRT_END
658 648
659 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) { 649 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) {
660 // extract receiver from the outgoing argument list if necessary 650 // extract receiver from the outgoing argument list if necessary
667 receiver = Handle(thread, 657 receiver = Handle(thread,
668 thread->last_frame().interpreter_callee_receiver(signature)); 658 thread->last_frame().interpreter_callee_receiver(signature));
669 assert(Universe::heap()->is_in_reserved_or_null(receiver()), 659 assert(Universe::heap()->is_in_reserved_or_null(receiver()),
670 "sanity check"); 660 "sanity check");
671 assert(receiver.is_null() || 661 assert(receiver.is_null() ||
672 Universe::heap()->is_in_reserved(receiver->klass()), 662 !Universe::heap()->is_in_reserved(receiver->klass()),
673 "sanity check"); 663 "sanity check");
674 } 664 }
675 665
676 // resolve method 666 // resolve method
677 CallInfo info; 667 CallInfo info;
743 get_index_u2_cpcache(thread, bytecode), bytecode, CHECK); 733 get_index_u2_cpcache(thread, bytecode), bytecode, CHECK);
744 } // end JvmtiHideSingleStepping 734 } // end JvmtiHideSingleStepping
745 735
746 cache_entry(thread)->set_method_handle( 736 cache_entry(thread)->set_method_handle(
747 info.resolved_method(), 737 info.resolved_method(),
748 info.resolved_appendix()); 738 info.resolved_appendix(),
739 pool->resolved_references());
749 } 740 }
750 IRT_END 741 IRT_END
751 742
752 743
753 // First time execution: Resolve symbols, create a permanent CallSite object. 744 // First time execution: Resolve symbols, create a permanent CallSite object.
760 751
761 // resolve method 752 // resolve method
762 CallInfo info; 753 CallInfo info;
763 constantPoolHandle pool(thread, method(thread)->constants()); 754 constantPoolHandle pool(thread, method(thread)->constants());
764 int index = get_index_u4(thread, bytecode); 755 int index = get_index_u4(thread, bytecode);
765
766 { 756 {
767 JvmtiHideSingleStepping jhss(thread); 757 JvmtiHideSingleStepping jhss(thread);
768 LinkResolver::resolve_invoke(info, Handle(), pool, 758 LinkResolver::resolve_invoke(info, Handle(), pool,
769 index, bytecode, CHECK); 759 index, bytecode, CHECK);
770 } // end JvmtiHideSingleStepping 760 } // end JvmtiHideSingleStepping
771 761
772 pool->cache()->secondary_entry_at(index)->set_dynamic_call( 762 ConstantPoolCacheEntry* cp_cache_entry = pool->invokedynamic_cp_cache_entry_at(index);
763 cp_cache_entry->set_dynamic_call(
773 info.resolved_method(), 764 info.resolved_method(),
774 info.resolved_appendix()); 765 info.resolved_appendix(),
766 pool->resolved_references());
775 } 767 }
776 IRT_END 768 IRT_END
777 769
778 770
779 //------------------------------------------------------------------------------------------------------------------------ 771 //------------------------------------------------------------------------------------------------------------------------
788 // frequency_counter_overflow_inner ends with a safepoint check, 780 // frequency_counter_overflow_inner ends with a safepoint check,
789 // nm could have been unloaded so look it up again. It's unsafe 781 // nm could have been unloaded so look it up again. It's unsafe
790 // to examine nm directly since it might have been freed and used 782 // to examine nm directly since it might have been freed and used
791 // for something else. 783 // for something else.
792 frame fr = thread->last_frame(); 784 frame fr = thread->last_frame();
793 methodOop method = fr.interpreter_frame_method(); 785 Method* method = fr.interpreter_frame_method();
794 int bci = method->bci_from(fr.interpreter_frame_bcp()); 786 int bci = method->bci_from(fr.interpreter_frame_bcp());
795 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); 787 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
796 } 788 }
797 #ifndef PRODUCT 789 #ifndef PRODUCT
798 if (TraceOnStackReplacement) { 790 if (TraceOnStackReplacement) {
842 } 834 }
843 } 835 }
844 return osr_nm; 836 return osr_nm;
845 IRT_END 837 IRT_END
846 838
847 IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(methodOopDesc* method, address cur_bcp)) 839 IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp))
848 assert(ProfileInterpreter, "must be profiling interpreter"); 840 assert(ProfileInterpreter, "must be profiling interpreter");
849 int bci = method->bci_from(cur_bcp); 841 int bci = method->bci_from(cur_bcp);
850 methodDataOop mdo = method->method_data(); 842 MethodData* mdo = method->method_data();
851 if (mdo == NULL) return 0; 843 if (mdo == NULL) return 0;
852 return mdo->bci_to_di(bci); 844 return mdo->bci_to_di(bci);
853 IRT_END 845 IRT_END
854 846
855 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread)) 847 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
859 851
860 assert(ProfileInterpreter, "must be profiling interpreter"); 852 assert(ProfileInterpreter, "must be profiling interpreter");
861 frame fr = thread->last_frame(); 853 frame fr = thread->last_frame();
862 assert(fr.is_interpreted_frame(), "must come from interpreter"); 854 assert(fr.is_interpreted_frame(), "must come from interpreter");
863 methodHandle method(thread, fr.interpreter_frame_method()); 855 methodHandle method(thread, fr.interpreter_frame_method());
864 methodOopDesc::build_interpreter_method_data(method, THREAD); 856 Method::build_interpreter_method_data(method, THREAD);
865 if (HAS_PENDING_EXCEPTION) { 857 if (HAS_PENDING_EXCEPTION) {
866 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); 858 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
867 CLEAR_PENDING_EXCEPTION; 859 CLEAR_PENDING_EXCEPTION;
868 // and fall through... 860 // and fall through...
869 } 861 }
870 IRT_END 862 IRT_END
871 863
872 864
873 #ifdef ASSERT 865 #ifdef ASSERT
874 IRT_LEAF(void, InterpreterRuntime::verify_mdp(methodOopDesc* method, address bcp, address mdp)) 866 IRT_LEAF(void, InterpreterRuntime::verify_mdp(Method* method, address bcp, address mdp))
875 assert(ProfileInterpreter, "must be profiling interpreter"); 867 assert(ProfileInterpreter, "must be profiling interpreter");
876 868
877 methodDataOop mdo = method->method_data(); 869 MethodData* mdo = method->method_data();
878 assert(mdo != NULL, "must not be null"); 870 assert(mdo != NULL, "must not be null");
879 871
880 int bci = method->bci_from(bcp); 872 int bci = method->bci_from(bcp);
881 873
882 address mdp2 = mdo->bci_to_dp(bci); 874 address mdp2 = mdo->bci_to_dp(bci);
905 assert(ProfileInterpreter, "must be profiling interpreter"); 897 assert(ProfileInterpreter, "must be profiling interpreter");
906 ResourceMark rm(thread); 898 ResourceMark rm(thread);
907 HandleMark hm(thread); 899 HandleMark hm(thread);
908 frame fr = thread->last_frame(); 900 frame fr = thread->last_frame();
909 assert(fr.is_interpreted_frame(), "must come from interpreter"); 901 assert(fr.is_interpreted_frame(), "must come from interpreter");
910 methodDataHandle h_mdo(thread, fr.interpreter_frame_method()->method_data()); 902 MethodData* h_mdo = fr.interpreter_frame_method()->method_data();
911 903
912 // Grab a lock to ensure atomic access to setting the return bci and 904 // Grab a lock to ensure atomic access to setting the return bci and
913 // the displacement. This can block and GC, invalidating all naked oops. 905 // the displacement. This can block and GC, invalidating all naked oops.
914 MutexLocker ml(RetData_lock); 906 MutexLocker ml(RetData_lock);
915 907
941 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj, 933 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
942 ConstantPoolCacheEntry *cp_entry)) 934 ConstantPoolCacheEntry *cp_entry))
943 935
944 // check the access_flags for the field in the klass 936 // check the access_flags for the field in the klass
945 937
946 instanceKlass* ik = instanceKlass::cast(java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror())); 938 InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
947 int index = cp_entry->field_index(); 939 int index = cp_entry->field_index();
948 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return; 940 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
949 941
950 switch(cp_entry->flag_state()) { 942 switch(cp_entry->flag_state()) {
951 case btos: // fall through 943 case btos: // fall through
964 Handle h_obj; 956 Handle h_obj;
965 if (!is_static) { 957 if (!is_static) {
966 // non-static field accessors have an object, but we need a handle 958 // non-static field accessors have an object, but we need a handle
967 h_obj = Handle(thread, obj); 959 h_obj = Handle(thread, obj);
968 } 960 }
969 instanceKlassHandle h_cp_entry_f1(thread, java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror())); 961 instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass());
970 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static); 962 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static);
971 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid); 963 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid);
972 IRT_END 964 IRT_END
973 965
974 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, 966 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
975 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) 967 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
976 968
977 klassOop k = java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror()); 969 Klass* k = (Klass*)cp_entry->f1_as_klass();
978 970
979 // check the access_flags for the field in the klass 971 // check the access_flags for the field in the klass
980 instanceKlass* ik = instanceKlass::cast(k); 972 InstanceKlass* ik = InstanceKlass::cast(k);
981 int index = cp_entry->field_index(); 973 int index = cp_entry->field_index();
982 // bail out if field modifications are not watched 974 // bail out if field modifications are not watched
983 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return; 975 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return;
984 976
985 char sig_type = '\0'; 977 char sig_type = '\0';
1181 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL; 1173 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
1182 GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL; 1174 GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL;
1183 address SignatureHandlerLibrary::_buffer = NULL; 1175 address SignatureHandlerLibrary::_buffer = NULL;
1184 1176
1185 1177
1186 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, methodOopDesc* method)) 1178 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Method* method))
1187 methodHandle m(thread, method); 1179 methodHandle m(thread, method);
1188 assert(m->is_native(), "sanity check"); 1180 assert(m->is_native(), "sanity check");
1189 // lookup native function entry point if it doesn't exist 1181 // lookup native function entry point if it doesn't exist
1190 bool in_base_library; 1182 bool in_base_library;
1191 if (!m->has_native_function()) { 1183 if (!m->has_native_function()) {