Mercurial > hg > truffle
comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 6948:e522a00b91aa
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 12 Nov 2012 23:14:12 +0100 |
parents | 957c266d8bc5 64672b22ef05 |
children | 2cb439954abf |
comparison
equal
deleted
inserted
replaced
6711:ae13cc658b80 | 6948:e522a00b91aa |
---|---|
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; |
220 for (int index = 0; index < nof_dims; index++) { | 209 for (int index = 0; index < nof_dims; index++) { |
221 // offset from first_size_address is addressed as local[index] | 210 // offset from first_size_address is addressed as local[index] |
222 int n = Interpreter::local_offset_in_bytes(index)/jintSize; | 211 int n = Interpreter::local_offset_in_bytes(index)/jintSize; |
223 dims[index] = first_size_address[n]; | 212 dims[index] = first_size_address[n]; |
224 } | 213 } |
225 oop obj = arrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK); | 214 oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK); |
226 thread->set_vm_result(obj); | 215 thread->set_vm_result(obj); |
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 |
546 | 535 |
547 // We also need to delay resolving getstatic instructions until the | 536 // We also need to delay resolving getstatic instructions until the |
548 // class is intitialized. This is required so that access to the static | 537 // class is intitialized. This is required so that access to the static |
549 // field will call the initialization function every time until the class | 538 // field will call the initialization function every time until the class |
550 // is completely initialized ala. in 2.17.5 in JVM Specification. | 539 // is completely initialized ala. in 2.17.5 in JVM Specification. |
551 instanceKlass *klass = instanceKlass::cast(info.klass()->as_klassOop()); | 540 InstanceKlass *klass = InstanceKlass::cast(info.klass()()); |
552 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && | 541 bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) && |
553 !klass->is_initialized()); | 542 !klass->is_initialized()); |
554 Bytecodes::Code get_code = (Bytecodes::Code)0; | 543 Bytecodes::Code get_code = (Bytecodes::Code)0; |
555 | 544 |
556 if (!uninitialized_static) { | 545 if (!uninitialized_static) { |
566 info.klass(), | 555 info.klass(), |
567 info.field_index(), | 556 info.field_index(), |
568 info.field_offset(), | 557 info.field_offset(), |
569 state, | 558 state, |
570 info.access_flags().is_final(), | 559 info.access_flags().is_final(), |
571 info.access_flags().is_volatile() | 560 info.access_flags().is_volatile(), |
561 pool->pool_holder() | |
572 ); | 562 ); |
573 IRT_END | 563 IRT_END |
574 | 564 |
575 | 565 |
576 //------------------------------------------------------------------------------------------------------------------------ | 566 //------------------------------------------------------------------------------------------------------------------------ |
656 | 646 |
657 | 647 |
658 //------------------------------------------------------------------------------------------------------------------------ | 648 //------------------------------------------------------------------------------------------------------------------------ |
659 // Invokes | 649 // Invokes |
660 | 650 |
661 IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp)) | 651 IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, Method* method, address bcp)) |
662 return method->orig_bytecode_at(method->bci_from(bcp)); | 652 return method->orig_bytecode_at(method->bci_from(bcp)); |
663 IRT_END | 653 IRT_END |
664 | 654 |
665 IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp, Bytecodes::Code new_code)) | 655 IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code)) |
666 method->set_orig_bytecode_at(method->bci_from(bcp), new_code); | 656 method->set_orig_bytecode_at(method->bci_from(bcp), new_code); |
667 IRT_END | 657 IRT_END |
668 | 658 |
669 IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, methodOopDesc* method, address bcp)) | 659 IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, Method* method, address bcp)) |
670 JvmtiExport::post_raw_breakpoint(thread, method, bcp); | 660 JvmtiExport::post_raw_breakpoint(thread, method, bcp); |
671 IRT_END | 661 IRT_END |
672 | 662 |
673 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) { | 663 IRT_ENTRY(void, InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode)) { |
674 // extract receiver from the outgoing argument list if necessary | 664 // extract receiver from the outgoing argument list if necessary |
681 receiver = Handle(thread, | 671 receiver = Handle(thread, |
682 thread->last_frame().interpreter_callee_receiver(signature)); | 672 thread->last_frame().interpreter_callee_receiver(signature)); |
683 assert(Universe::heap()->is_in_reserved_or_null(receiver()), | 673 assert(Universe::heap()->is_in_reserved_or_null(receiver()), |
684 "sanity check"); | 674 "sanity check"); |
685 assert(receiver.is_null() || | 675 assert(receiver.is_null() || |
686 Universe::heap()->is_in_reserved(receiver->klass()), | 676 !Universe::heap()->is_in_reserved(receiver->klass()), |
687 "sanity check"); | 677 "sanity check"); |
688 } | 678 } |
689 | 679 |
690 // resolve method | 680 // resolve method |
691 CallInfo info; | 681 CallInfo info; |
755 JvmtiHideSingleStepping jhss(thread); | 745 JvmtiHideSingleStepping jhss(thread); |
756 LinkResolver::resolve_invoke(info, Handle(), pool, | 746 LinkResolver::resolve_invoke(info, Handle(), pool, |
757 get_index_u2_cpcache(thread, bytecode), bytecode, CHECK); | 747 get_index_u2_cpcache(thread, bytecode), bytecode, CHECK); |
758 } // end JvmtiHideSingleStepping | 748 } // end JvmtiHideSingleStepping |
759 | 749 |
760 cache_entry(thread)->set_method_handle( | 750 cache_entry(thread)->set_method_handle(pool, info); |
761 info.resolved_method(), | |
762 info.resolved_appendix()); | |
763 } | 751 } |
764 IRT_END | 752 IRT_END |
765 | 753 |
766 | 754 |
767 // First time execution: Resolve symbols, create a permanent CallSite object. | 755 // First time execution: Resolve symbols, create a permanent CallSite object. |
774 | 762 |
775 // resolve method | 763 // resolve method |
776 CallInfo info; | 764 CallInfo info; |
777 constantPoolHandle pool(thread, method(thread)->constants()); | 765 constantPoolHandle pool(thread, method(thread)->constants()); |
778 int index = get_index_u4(thread, bytecode); | 766 int index = get_index_u4(thread, bytecode); |
779 | |
780 { | 767 { |
781 JvmtiHideSingleStepping jhss(thread); | 768 JvmtiHideSingleStepping jhss(thread); |
782 LinkResolver::resolve_invoke(info, Handle(), pool, | 769 LinkResolver::resolve_invoke(info, Handle(), pool, |
783 index, bytecode, CHECK); | 770 index, bytecode, CHECK); |
784 } // end JvmtiHideSingleStepping | 771 } // end JvmtiHideSingleStepping |
785 | 772 |
786 pool->cache()->secondary_entry_at(index)->set_dynamic_call( | 773 ConstantPoolCacheEntry* cp_cache_entry = pool->invokedynamic_cp_cache_entry_at(index); |
787 info.resolved_method(), | 774 cp_cache_entry->set_dynamic_call(pool, info); |
788 info.resolved_appendix()); | |
789 } | 775 } |
790 IRT_END | 776 IRT_END |
791 | 777 |
792 | 778 |
793 //------------------------------------------------------------------------------------------------------------------------ | 779 //------------------------------------------------------------------------------------------------------------------------ |
802 // frequency_counter_overflow_inner ends with a safepoint check, | 788 // frequency_counter_overflow_inner ends with a safepoint check, |
803 // nm could have been unloaded so look it up again. It's unsafe | 789 // nm could have been unloaded so look it up again. It's unsafe |
804 // to examine nm directly since it might have been freed and used | 790 // to examine nm directly since it might have been freed and used |
805 // for something else. | 791 // for something else. |
806 frame fr = thread->last_frame(); | 792 frame fr = thread->last_frame(); |
807 methodOop method = fr.interpreter_frame_method(); | 793 Method* method = fr.interpreter_frame_method(); |
808 int bci = method->bci_from(fr.interpreter_frame_bcp()); | 794 int bci = method->bci_from(fr.interpreter_frame_bcp()); |
809 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); | 795 nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false); |
810 } | 796 } |
811 #ifndef PRODUCT | 797 #ifndef PRODUCT |
812 if (TraceOnStackReplacement) { | 798 if (TraceOnStackReplacement) { |
856 } | 842 } |
857 } | 843 } |
858 return osr_nm; | 844 return osr_nm; |
859 IRT_END | 845 IRT_END |
860 | 846 |
861 IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(methodOopDesc* method, address cur_bcp)) | 847 IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp)) |
862 assert(ProfileInterpreter, "must be profiling interpreter"); | 848 assert(ProfileInterpreter, "must be profiling interpreter"); |
863 int bci = method->bci_from(cur_bcp); | 849 int bci = method->bci_from(cur_bcp); |
864 methodDataOop mdo = method->method_data(); | 850 MethodData* mdo = method->method_data(); |
865 if (mdo == NULL) return 0; | 851 if (mdo == NULL) return 0; |
866 return mdo->bci_to_di(bci); | 852 return mdo->bci_to_di(bci); |
867 IRT_END | 853 IRT_END |
868 | 854 |
869 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread)) | 855 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread)) |
873 | 859 |
874 assert(ProfileInterpreter, "must be profiling interpreter"); | 860 assert(ProfileInterpreter, "must be profiling interpreter"); |
875 frame fr = thread->last_frame(); | 861 frame fr = thread->last_frame(); |
876 assert(fr.is_interpreted_frame(), "must come from interpreter"); | 862 assert(fr.is_interpreted_frame(), "must come from interpreter"); |
877 methodHandle method(thread, fr.interpreter_frame_method()); | 863 methodHandle method(thread, fr.interpreter_frame_method()); |
878 methodOopDesc::build_interpreter_method_data(method, THREAD); | 864 Method::build_interpreter_method_data(method, THREAD); |
879 if (HAS_PENDING_EXCEPTION) { | 865 if (HAS_PENDING_EXCEPTION) { |
880 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); | 866 assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); |
881 CLEAR_PENDING_EXCEPTION; | 867 CLEAR_PENDING_EXCEPTION; |
882 // and fall through... | 868 // and fall through... |
883 } | 869 } |
884 IRT_END | 870 IRT_END |
885 | 871 |
886 | 872 |
887 #ifdef ASSERT | 873 #ifdef ASSERT |
888 IRT_LEAF(void, InterpreterRuntime::verify_mdp(methodOopDesc* method, address bcp, address mdp)) | 874 IRT_LEAF(void, InterpreterRuntime::verify_mdp(Method* method, address bcp, address mdp)) |
889 assert(ProfileInterpreter, "must be profiling interpreter"); | 875 assert(ProfileInterpreter, "must be profiling interpreter"); |
890 | 876 |
891 methodDataOop mdo = method->method_data(); | 877 MethodData* mdo = method->method_data(); |
892 assert(mdo != NULL, "must not be null"); | 878 assert(mdo != NULL, "must not be null"); |
893 | 879 |
894 int bci = method->bci_from(bcp); | 880 int bci = method->bci_from(bcp); |
895 | 881 |
896 address mdp2 = mdo->bci_to_dp(bci); | 882 address mdp2 = mdo->bci_to_dp(bci); |
919 assert(ProfileInterpreter, "must be profiling interpreter"); | 905 assert(ProfileInterpreter, "must be profiling interpreter"); |
920 ResourceMark rm(thread); | 906 ResourceMark rm(thread); |
921 HandleMark hm(thread); | 907 HandleMark hm(thread); |
922 frame fr = thread->last_frame(); | 908 frame fr = thread->last_frame(); |
923 assert(fr.is_interpreted_frame(), "must come from interpreter"); | 909 assert(fr.is_interpreted_frame(), "must come from interpreter"); |
924 methodDataHandle h_mdo(thread, fr.interpreter_frame_method()->method_data()); | 910 MethodData* h_mdo = fr.interpreter_frame_method()->method_data(); |
925 | 911 |
926 // Grab a lock to ensure atomic access to setting the return bci and | 912 // Grab a lock to ensure atomic access to setting the return bci and |
927 // the displacement. This can block and GC, invalidating all naked oops. | 913 // the displacement. This can block and GC, invalidating all naked oops. |
928 MutexLocker ml(RetData_lock); | 914 MutexLocker ml(RetData_lock); |
929 | 915 |
955 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj, | 941 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj, |
956 ConstantPoolCacheEntry *cp_entry)) | 942 ConstantPoolCacheEntry *cp_entry)) |
957 | 943 |
958 // check the access_flags for the field in the klass | 944 // check the access_flags for the field in the klass |
959 | 945 |
960 instanceKlass* ik = instanceKlass::cast(java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror())); | 946 InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass()); |
961 int index = cp_entry->field_index(); | 947 int index = cp_entry->field_index(); |
962 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return; | 948 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return; |
963 | 949 |
964 switch(cp_entry->flag_state()) { | 950 switch(cp_entry->flag_state()) { |
965 case btos: // fall through | 951 case btos: // fall through |
978 Handle h_obj; | 964 Handle h_obj; |
979 if (!is_static) { | 965 if (!is_static) { |
980 // non-static field accessors have an object, but we need a handle | 966 // non-static field accessors have an object, but we need a handle |
981 h_obj = Handle(thread, obj); | 967 h_obj = Handle(thread, obj); |
982 } | 968 } |
983 instanceKlassHandle h_cp_entry_f1(thread, java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror())); | 969 instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass()); |
984 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static); | 970 jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static); |
985 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid); | 971 JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid); |
986 IRT_END | 972 IRT_END |
987 | 973 |
988 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, | 974 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread, |
989 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) | 975 oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value)) |
990 | 976 |
991 klassOop k = java_lang_Class::as_klassOop(cp_entry->f1_as_klass_mirror()); | 977 Klass* k = (Klass*)cp_entry->f1_as_klass(); |
992 | 978 |
993 // check the access_flags for the field in the klass | 979 // check the access_flags for the field in the klass |
994 instanceKlass* ik = instanceKlass::cast(k); | 980 InstanceKlass* ik = InstanceKlass::cast(k); |
995 int index = cp_entry->field_index(); | 981 int index = cp_entry->field_index(); |
996 // bail out if field modifications are not watched | 982 // bail out if field modifications are not watched |
997 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return; | 983 if ((ik->field_access_flags(index) & JVM_ACC_FIELD_MODIFICATION_WATCHED) == 0) return; |
998 | 984 |
999 char sig_type = '\0'; | 985 char sig_type = '\0'; |
1195 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL; | 1181 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL; |
1196 GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL; | 1182 GrowableArray<address>* SignatureHandlerLibrary::_handlers = NULL; |
1197 address SignatureHandlerLibrary::_buffer = NULL; | 1183 address SignatureHandlerLibrary::_buffer = NULL; |
1198 | 1184 |
1199 | 1185 |
1200 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, methodOopDesc* method)) | 1186 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Method* method)) |
1201 methodHandle m(thread, method); | 1187 methodHandle m(thread, method); |
1202 assert(m->is_native(), "sanity check"); | 1188 assert(m->is_native(), "sanity check"); |
1203 // lookup native function entry point if it doesn't exist | 1189 // lookup native function entry point if it doesn't exist |
1204 bool in_base_library; | 1190 bool in_base_library; |
1205 if (!m->has_native_function()) { | 1191 if (!m->has_native_function()) { |