comparison src/share/vm/interpreter/interpreterRuntime.cpp @ 1602:136b78722a08

6939203: JSR 292 needs method handle constants Summary: Add new CP types CONSTANT_MethodHandle, CONSTANT_MethodType; extend 'ldc' bytecode. Reviewed-by: twisti, never
author jrose
date Wed, 09 Jun 2010 18:50:45 -0700
parents e9ff18c4ace7
children d93949c5bdcc
comparison
equal deleted inserted replaced
1585:49fac4acd688 1602:136b78722a08
81 oop s_oop = pool->string_at(index, CHECK); 81 oop s_oop = pool->string_at(index, CHECK);
82 thread->set_vm_result(s_oop); 82 thread->set_vm_result(s_oop);
83 } 83 }
84 IRT_END 84 IRT_END
85 85
86 IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
87 assert(bytecode == Bytecodes::_fast_aldc ||
88 bytecode == Bytecodes::_fast_aldc_w, "wrong bc");
89 ResourceMark rm(thread);
90 methodHandle m (thread, method(thread));
91 Bytecode_loadconstant* ldc = Bytecode_loadconstant_at(m, bci(thread));
92 oop result = ldc->resolve_constant(THREAD);
93 DEBUG_ONLY(ConstantPoolCacheEntry* cpce = m->constants()->cache()->entry_at(ldc->cache_index()));
94 assert(result == cpce->f1(), "expected result for assembly code");
95 }
96 IRT_END
97
86 98
87 //------------------------------------------------------------------------------------------------------------------------ 99 //------------------------------------------------------------------------------------------------------------------------
88 // Allocation 100 // Allocation
89 101
90 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, constantPoolOopDesc* pool, int index)) 102 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, constantPoolOopDesc* pool, int index))
326 methodHandle h_method (thread, method(thread)); 338 methodHandle h_method (thread, method(thread));
327 constantPoolHandle h_constants(thread, h_method->constants()); 339 constantPoolHandle h_constants(thread, h_method->constants());
328 typeArrayHandle h_extable (thread, h_method->exception_table()); 340 typeArrayHandle h_extable (thread, h_method->exception_table());
329 bool should_repeat; 341 bool should_repeat;
330 int handler_bci; 342 int handler_bci;
331 int current_bci = bcp(thread) - h_method->code_base(); 343 int current_bci = bci(thread);
332 344
333 // Need to do this check first since when _do_not_unlock_if_synchronized 345 // Need to do this check first since when _do_not_unlock_if_synchronized
334 // is set, we don't want to trigger any classloading which may make calls 346 // is set, we don't want to trigger any classloading which may make calls
335 // into java, or surprisingly find a matching exception handler for bci 0 347 // into java, or surprisingly find a matching exception handler for bci 0
336 // since at this moment the method hasn't been "officially" entered yet. 348 // since at this moment the method hasn't been "officially" entered yet.
613 // extract receiver from the outgoing argument list if necessary 625 // extract receiver from the outgoing argument list if necessary
614 Handle receiver(thread, NULL); 626 Handle receiver(thread, NULL);
615 if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) { 627 if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) {
616 ResourceMark rm(thread); 628 ResourceMark rm(thread);
617 methodHandle m (thread, method(thread)); 629 methodHandle m (thread, method(thread));
618 int bci = m->bci_from(bcp(thread)); 630 Bytecode_invoke* call = Bytecode_invoke_at(m, bci(thread));
619 Bytecode_invoke* call = Bytecode_invoke_at(m, bci);
620 symbolHandle signature (thread, call->signature()); 631 symbolHandle signature (thread, call->signature());
621 receiver = Handle(thread, 632 receiver = Handle(thread,
622 thread->last_frame().interpreter_callee_receiver(signature)); 633 thread->last_frame().interpreter_callee_receiver(signature));
623 assert(Universe::heap()->is_in_reserved_or_null(receiver()), 634 assert(Universe::heap()->is_in_reserved_or_null(receiver()),
624 "sanity check"); 635 "sanity check");