340 } 341 342 // Method that knows how to preserve outgoing arguments at call. This method must be 343 // called with a frame corresponding to a Java invoke 344 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { 345 if (method() != NULL && !method()->is_native()) { 346 address pc = fr.pc(); 347 SimpleScopeDesc ssd(this, pc); 348 Bytecode_invoke call(ssd.method(), ssd.bci()); 349 bool has_receiver = call.has_receiver(); 350 bool has_appendix = call.has_appendix(); 351 Symbol* signature = call.signature(); 352 353 // The method attached by JIT-compilers should be used, if present. 354 // Bytecode can be inaccurate in such case. 355 Method* callee = attached_method_before_pc(pc); 356 if (callee != NULL) { 357 has_receiver = !(callee->access_flags().is_static()); 358 has_appendix = false; 359 signature = callee->signature(); 360 } 361 362 // If value types are passed as fields, use the extended signature 363 // which contains the types of all (oop) fields of the value type. 364 if (ValueTypePassFieldsAsArgs && callee != NULL) { 365 // Get the extended signature from the callee's adapter through the attached method 366 Symbol* sig_ext = callee->adapter()->get_sig_extended(); 367 #ifdef ASSERT 368 // Check if receiver or one of the arguments is a value type 369 bool has_value_receiver = has_receiver && callee->method_holder()->is_value(); 370 bool has_value_argument = has_value_receiver; 371 for (SignatureStream ss(signature); !has_value_argument && !ss.at_return_type(); ss.next()) { 372 if (ss.type() == T_VALUETYPE) { 373 has_value_argument = true; 374 break; 375 } 376 } 377 assert(has_value_argument == (sig_ext != NULL), "Signature is inconsistent"); 378 #endif 379 if (sig_ext != NULL) { 380 signature = sig_ext; 381 has_receiver = false; // The extended signature contains the receiver type 382 } 383 } 384 385 fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f); 386 } 387 } 388 389 Method* CompiledMethod::attached_method(address call_instr) { 390 assert(code_contains(call_instr), "not part of the nmethod"); 391 RelocIterator iter(this, call_instr, call_instr + 1); 392 while (iter.next()) { 393 if (iter.addr() == call_instr) { 394 switch(iter.type()) { 395 case relocInfo::static_call_type: return iter.static_call_reloc()->method_value(); 396 case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value(); 397 case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value(); 398 default: break; 399 } 400 } | 340 } 341 342 // Method that knows how to preserve outgoing arguments at call. This method must be 343 // called with a frame corresponding to a Java invoke 344 void CompiledMethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) { 345 if (method() != NULL && !method()->is_native()) { 346 address pc = fr.pc(); 347 SimpleScopeDesc ssd(this, pc); 348 Bytecode_invoke call(ssd.method(), ssd.bci()); 349 bool has_receiver = call.has_receiver(); 350 bool has_appendix = call.has_appendix(); 351 Symbol* signature = call.signature(); 352 353 // The method attached by JIT-compilers should be used, if present. 354 // Bytecode can be inaccurate in such case. 355 Method* callee = attached_method_before_pc(pc); 356 if (callee != NULL) { 357 has_receiver = !(callee->access_flags().is_static()); 358 has_appendix = false; 359 signature = callee->signature(); 360 361 // If value types are passed as fields, use the extended signature 362 // which contains the types of all (oop) fields of the value type. 363 if (callee->has_scalarized_args()) { 364 const GrowableArray<SigEntry>* sig = callee->adapter()->get_sig_cc(); 365 signature = SigEntry::create_symbol(sig); 366 has_receiver = false; // The extended signature contains the receiver type 367 } 368 } 369 370 fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f); 371 } 372 } 373 374 Method* CompiledMethod::attached_method(address call_instr) { 375 assert(code_contains(call_instr), "not part of the nmethod"); 376 RelocIterator iter(this, call_instr, call_instr + 1); 377 while (iter.next()) { 378 if (iter.addr() == call_instr) { 379 switch(iter.type()) { 380 case relocInfo::static_call_type: return iter.static_call_reloc()->method_value(); 381 case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value(); 382 case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value(); 383 default: break; 384 } 385 } |