Mercurial > hg > graal-compiler
diff src/cpu/ppc/vm/ppc.ad @ 14684:e5e8aa897002
8035647: PPC64: Support for elf v2 abi.
Summary: ELFv2 ABI used by the little endian PowerPC64 on Linux.
Reviewed-by: kvn
Contributed-by: asmundak@google.com
author | goetz |
---|---|
date | Thu, 06 Mar 2014 10:55:28 -0800 |
parents | 7e8e4d1a41d6 |
children | 92aa6797d639 |
line wrap: on
line diff
--- a/src/cpu/ppc/vm/ppc.ad Thu Mar 06 02:37:44 2014 -0800 +++ b/src/cpu/ppc/vm/ppc.ad Thu Mar 06 10:55:28 2014 -0800 @@ -1008,7 +1008,11 @@ } int MachCallRuntimeNode::ret_addr_offset() { +#if defined(ABI_ELFv2) + return 28; +#else return 40; +#endif } //============================================================================= @@ -3674,6 +3678,10 @@ MacroAssembler _masm(&cbuf); const address start_pc = __ pc(); +#if defined(ABI_ELFv2) + address entry= !($meth$$method) ? NULL : (address)$meth$$method; + __ call_c(entry, relocInfo::runtime_call_type); +#else // The function we're going to call. FunctionDescriptor fdtemp; const FunctionDescriptor* fd = !($meth$$method) ? &fdtemp : (FunctionDescriptor*)$meth$$method; @@ -3684,6 +3692,7 @@ // Put entry, env, toc into the constant pool, this needs up to 3 constant // pool entries; call_c_using_toc will optimize the call. __ call_c_using_toc(fd, relocInfo::runtime_call_type, Rtoc); +#endif // Check the ret_addr_offset. assert(((MachCallRuntimeNode*)this)->ret_addr_offset() == __ last_calls_return_pc() - start_pc, @@ -3699,20 +3708,25 @@ __ mtctr($src$$Register); %} - // postalloc expand emitter for runtime leaf calls. + // Postalloc expand emitter for runtime leaf calls. enc_class postalloc_expand_java_to_runtime_call(method meth, iRegLdst toc) %{ + loadConLNodesTuple loadConLNodes_Entry; +#if defined(ABI_ELFv2) + jlong entry_address = (jlong) this->entry_point(); + assert(entry_address, "need address here"); + loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), + OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); +#else // Get the struct that describes the function we are about to call. FunctionDescriptor* fd = (FunctionDescriptor*) this->entry_point(); assert(fd, "need fd here"); + jlong entry_address = (jlong) fd->entry(); // new nodes - loadConLNodesTuple loadConLNodes_Entry; loadConLNodesTuple loadConLNodes_Env; loadConLNodesTuple loadConLNodes_Toc; - MachNode *mtctr = NULL; - MachCallLeafNode *call = NULL; // Create nodes and operands for loading the entry point. - loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->entry()), + loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address), OptoReg::Name(R12_H_num), OptoReg::Name(R12_num)); @@ -3733,8 +3747,9 @@ // Create nodes and operands for loading the Toc point. loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->toc()), OptoReg::Name(R2_H_num), OptoReg::Name(R2_num)); +#endif // ABI_ELFv2 // mtctr node - mtctr = new (C) CallLeafDirect_mtctrNode(); + MachNode *mtctr = new (C) CallLeafDirect_mtctrNode(); assert(loadConLNodes_Entry._last != NULL, "entry must exist"); mtctr->add_req(0, loadConLNodes_Entry._last); @@ -3743,10 +3758,10 @@ mtctr->_opnds[1] = new (C) iRegLdstOper(); // call node - call = new (C) CallLeafDirectNode(); + MachCallLeafNode *call = new (C) CallLeafDirectNode(); call->_opnds[0] = _opnds[0]; - call->_opnds[1] = new (C) methodOper((intptr_t) fd->entry()); // may get set later + call->_opnds[1] = new (C) methodOper((intptr_t) entry_address); // May get set later. // Make the new call node look like the old one. call->_name = _name; @@ -3773,8 +3788,10 @@ // These must be reqired edges, as the registers are live up to // the call. Else the constants are handled as kills. call->add_req(mtctr); +#if !defined(ABI_ELFv2) call->add_req(loadConLNodes_Env._last); call->add_req(loadConLNodes_Toc._last); +#endif // ...as well as prec for (uint i = req(); i < len(); ++i) { @@ -3787,10 +3804,12 @@ // Insert the new nodes. if (loadConLNodes_Entry._large_hi) nodes->push(loadConLNodes_Entry._large_hi); if (loadConLNodes_Entry._last) nodes->push(loadConLNodes_Entry._last); +#if !defined(ABI_ELFv2) if (loadConLNodes_Env._large_hi) nodes->push(loadConLNodes_Env._large_hi); if (loadConLNodes_Env._last) nodes->push(loadConLNodes_Env._last); if (loadConLNodes_Toc._large_hi) nodes->push(loadConLNodes_Toc._large_hi); if (loadConLNodes_Toc._last) nodes->push(loadConLNodes_Toc._last); +#endif nodes->push(mtctr); nodes->push(call); %} @@ -3837,7 +3856,7 @@ // out_preserve_stack_slots for calls to C. Supports the var-args // backing area for register parms. // - varargs_C_out_slots_killed(((frame::abi_112_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size)); + varargs_C_out_slots_killed(((frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size)); // The after-PROLOG location of the return address. Location of // return address specifies a type (REG or STACK) and a number