3382 3383 MacroAssembler _masm(&cbuf); 3384 address entry_point = (address)$meth$$method; 3385 3386 if (!_method) { 3387 // A call to a runtime wrapper, e.g. new, new_typeArray_Java, uncommon_trap. 3388 emit_call_with_trampoline_stub(_masm, entry_point, relocInfo::runtime_call_type); 3389 } else { 3390 // Remember the offset not the address. 3391 const int start_offset = __ offset(); 3392 // The trampoline stub. 3393 if (!Compile::current()->in_scratch_emit_size()) { 3394 // No entry point given, use the current pc. 3395 // Make sure branch fits into 3396 if (entry_point == 0) entry_point = __ pc(); 3397 3398 // Put the entry point as a constant into the constant pool. 3399 const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none); 3400 const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); 3401 3402 // Emit the trampoline stub which will be related to the branch-and-link below. 3403 CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); 3404 if (ciEnv::current()->failing()) { return; } // Code cache may be full. 3405 __ relocate(_optimized_virtual ? 3406 relocInfo::opt_virtual_call_type : relocInfo::static_call_type); 3407 } 3408 3409 // The real call. 3410 // Note: At this point we do not have the address of the trampoline 3411 // stub, and the entry point might be too far away for bl, so __ pc() 3412 // serves as dummy and the bl will be patched later. 3413 cbuf.set_insts_mark(); 3414 __ bl(__ pc()); // Emits a relocation. 3415 3416 // The stub for call to interpreter. 3417 address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); 3418 if (stub == NULL) { 3419 ciEnv::current()->record_failure("CodeCache is full"); 3420 return; 3421 } 3422 } 3423 %} 3424 3425 // Emit a method handle call. 3426 // 3430 // to cope with the extended frame. We restore the original frame by 3431 // loading the callers sp and adding the calculated framesize. 3432 enc_class enc_java_handle_call(method meth) %{ 3433 // TODO: PPC port $archOpcode(ppc64Opcode_compound); 3434 3435 MacroAssembler _masm(&cbuf); 3436 address entry_point = (address)$meth$$method; 3437 3438 // Remember the offset not the address. 3439 const int start_offset = __ offset(); 3440 // The trampoline stub. 3441 if (!ra_->C->in_scratch_emit_size()) { 3442 // No entry point given, use the current pc. 3443 // Make sure branch fits into 3444 if (entry_point == 0) entry_point = __ pc(); 3445 3446 // Put the entry point as a constant into the constant pool. 3447 const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none); 3448 const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); 3449 3450 // Emit the trampoline stub which will be related to the branch-and-link below. 3451 CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); 3452 if (ra_->C->env()->failing()) { return; } // Code cache may be full. 3453 assert(_optimized_virtual, "methodHandle call should be a virtual call"); 3454 __ relocate(relocInfo::opt_virtual_call_type); 3455 } 3456 3457 // The real call. 3458 // Note: At this point we do not have the address of the trampoline 3459 // stub, and the entry point might be too far away for bl, so __ pc() 3460 // serves as dummy and the bl will be patched later. 3461 cbuf.set_insts_mark(); 3462 __ bl(__ pc()); // Emits a relocation. 3463 3464 assert(_method, "execute next statement conditionally"); 3465 // The stub for call to interpreter. 3466 address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); 3467 if (stub == NULL) { 3468 ciEnv::current()->record_failure("CodeCache is full"); 3469 return; 3502 // Create a call trampoline stub for the given method. 3503 const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method; 3504 const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none); 3505 const int entry_point_const_toc_offset = __ offset_to_method_toc(entry_point_const); 3506 CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset()); 3507 if (ra_->C->env()->failing()) { return; } // Code cache may be full. 3508 3509 // Build relocation at call site with ic position as data. 3510 assert((_load_ic_hi_node != NULL && _load_ic_node == NULL) || 3511 (_load_ic_hi_node == NULL && _load_ic_node != NULL), 3512 "must have one, but can't have both"); 3513 assert((_load_ic_hi_node != NULL && _load_ic_hi_node->_cbuf_insts_offset != -1) || 3514 (_load_ic_node != NULL && _load_ic_node->_cbuf_insts_offset != -1), 3515 "must contain instruction offset"); 3516 const int virtual_call_oop_addr_offset = _load_ic_hi_node != NULL 3517 ? _load_ic_hi_node->_cbuf_insts_offset 3518 : _load_ic_node->_cbuf_insts_offset; 3519 const address virtual_call_oop_addr = __ addr_at(virtual_call_oop_addr_offset); 3520 assert(MacroAssembler::is_load_const_from_method_toc_at(virtual_call_oop_addr), 3521 "should be load from TOC"); 3522 3523 __ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr)); 3524 } 3525 3526 // At this point I do not have the address of the trampoline stub, 3527 // and the entry point might be too far away for bl. Pc() serves 3528 // as dummy and bl will be patched later. 3529 __ bl((address) __ pc()); 3530 %} 3531 3532 // postalloc expand emitter for virtual calls. 3533 enc_class postalloc_expand_java_dynamic_call_sched(method meth, iRegLdst toc) %{ 3534 3535 // Create the nodes for loading the IC from the TOC. 3536 loadConLNodesTuple loadConLNodes_IC = 3537 loadConLNodesTuple_create(ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()), 3538 OptoReg::Name(R19_H_num), OptoReg::Name(R19_num)); 3539 3540 // Create the call node. 3541 CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode(); 3542 call->_method_handle_invoke = _method_handle_invoke; 3543 call->_vtable_index = _vtable_index; | 3382 3383 MacroAssembler _masm(&cbuf); 3384 address entry_point = (address)$meth$$method; 3385 3386 if (!_method) { 3387 // A call to a runtime wrapper, e.g. new, new_typeArray_Java, uncommon_trap. 3388 emit_call_with_trampoline_stub(_masm, entry_point, relocInfo::runtime_call_type); 3389 } else { 3390 // Remember the offset not the address. 3391 const int start_offset = __ offset(); 3392 // The trampoline stub. 3393 if (!Compile::current()->in_scratch_emit_size()) { 3394 // No entry point given, use the current pc. 3395 // Make sure branch fits into 3396 if (entry_point == 0) entry_point = __ pc(); 3397 3398 // Put the entry point as a constant into the constant pool. 3399 const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none); 3400 const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); 3401 3402 3403 // Emit the trampoline stub which will be related to the branch-and-link below. 3404 CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); 3405 if (ciEnv::current()->failing()) { return; } // Code cache may be full. 3406 int method_index = resolved_method_index(cbuf); 3407 __ relocate(_optimized_virtual ? opt_virtual_call_Relocate::spec(method_index) 3408 : static_call_Relocate::spec(method_index)); 3409 } 3410 3411 // The real call. 3412 // Note: At this point we do not have the address of the trampoline 3413 // stub, and the entry point might be too far away for bl, so __ pc() 3414 // serves as dummy and the bl will be patched later. 3415 cbuf.set_insts_mark(); 3416 __ bl(__ pc()); // Emits a relocation. 3417 3418 // The stub for call to interpreter. 3419 address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); 3420 if (stub == NULL) { 3421 ciEnv::current()->record_failure("CodeCache is full"); 3422 return; 3423 } 3424 } 3425 %} 3426 3427 // Emit a method handle call. 3428 // 3432 // to cope with the extended frame. We restore the original frame by 3433 // loading the callers sp and adding the calculated framesize. 3434 enc_class enc_java_handle_call(method meth) %{ 3435 // TODO: PPC port $archOpcode(ppc64Opcode_compound); 3436 3437 MacroAssembler _masm(&cbuf); 3438 address entry_point = (address)$meth$$method; 3439 3440 // Remember the offset not the address. 3441 const int start_offset = __ offset(); 3442 // The trampoline stub. 3443 if (!ra_->C->in_scratch_emit_size()) { 3444 // No entry point given, use the current pc. 3445 // Make sure branch fits into 3446 if (entry_point == 0) entry_point = __ pc(); 3447 3448 // Put the entry point as a constant into the constant pool. 3449 const address entry_point_toc_addr = __ address_constant(entry_point, RelocationHolder::none); 3450 const int entry_point_toc_offset = __ offset_to_method_toc(entry_point_toc_addr); 3451 3452 assert(!_override_symbolic_info, "resolved method overriding not supported"); 3453 3454 // Emit the trampoline stub which will be related to the branch-and-link below. 3455 CallStubImpl::emit_trampoline_stub(_masm, entry_point_toc_offset, start_offset); 3456 if (ra_->C->env()->failing()) { return; } // Code cache may be full. 3457 assert(_optimized_virtual, "methodHandle call should be a virtual call"); 3458 __ relocate(relocInfo::opt_virtual_call_type); 3459 } 3460 3461 // The real call. 3462 // Note: At this point we do not have the address of the trampoline 3463 // stub, and the entry point might be too far away for bl, so __ pc() 3464 // serves as dummy and the bl will be patched later. 3465 cbuf.set_insts_mark(); 3466 __ bl(__ pc()); // Emits a relocation. 3467 3468 assert(_method, "execute next statement conditionally"); 3469 // The stub for call to interpreter. 3470 address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); 3471 if (stub == NULL) { 3472 ciEnv::current()->record_failure("CodeCache is full"); 3473 return; 3506 // Create a call trampoline stub for the given method. 3507 const address entry_point = !($meth$$method) ? 0 : (address)$meth$$method; 3508 const address entry_point_const = __ address_constant(entry_point, RelocationHolder::none); 3509 const int entry_point_const_toc_offset = __ offset_to_method_toc(entry_point_const); 3510 CallStubImpl::emit_trampoline_stub(_masm, entry_point_const_toc_offset, __ offset()); 3511 if (ra_->C->env()->failing()) { return; } // Code cache may be full. 3512 3513 // Build relocation at call site with ic position as data. 3514 assert((_load_ic_hi_node != NULL && _load_ic_node == NULL) || 3515 (_load_ic_hi_node == NULL && _load_ic_node != NULL), 3516 "must have one, but can't have both"); 3517 assert((_load_ic_hi_node != NULL && _load_ic_hi_node->_cbuf_insts_offset != -1) || 3518 (_load_ic_node != NULL && _load_ic_node->_cbuf_insts_offset != -1), 3519 "must contain instruction offset"); 3520 const int virtual_call_oop_addr_offset = _load_ic_hi_node != NULL 3521 ? _load_ic_hi_node->_cbuf_insts_offset 3522 : _load_ic_node->_cbuf_insts_offset; 3523 const address virtual_call_oop_addr = __ addr_at(virtual_call_oop_addr_offset); 3524 assert(MacroAssembler::is_load_const_from_method_toc_at(virtual_call_oop_addr), 3525 "should be load from TOC"); 3526 int method_index = resolved_method_index(cbuf); 3527 __ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr, method_index)); 3528 } 3529 3530 // At this point I do not have the address of the trampoline stub, 3531 // and the entry point might be too far away for bl. Pc() serves 3532 // as dummy and bl will be patched later. 3533 __ bl((address) __ pc()); 3534 %} 3535 3536 // postalloc expand emitter for virtual calls. 3537 enc_class postalloc_expand_java_dynamic_call_sched(method meth, iRegLdst toc) %{ 3538 3539 // Create the nodes for loading the IC from the TOC. 3540 loadConLNodesTuple loadConLNodes_IC = 3541 loadConLNodesTuple_create(ra_, n_toc, new immLOper((jlong)Universe::non_oop_word()), 3542 OptoReg::Name(R19_H_num), OptoReg::Name(R19_num)); 3543 3544 // Create the call node. 3545 CallDynamicJavaDirectSchedNode *call = new CallDynamicJavaDirectSchedNode(); 3546 call->_method_handle_invoke = _method_handle_invoke; 3547 call->_vtable_index = _vtable_index; |