src/cpu/ppc/vm/ppc.ad

changeset 6511
31e80afe3fed
parent 6510
7c462558a08a
child 6515
71a71b0bc844
     1.1 --- a/src/cpu/ppc/vm/ppc.ad	Thu Feb 20 11:05:12 2014 +0100
     1.2 +++ b/src/cpu/ppc/vm/ppc.ad	Thu Mar 06 10:55:28 2014 -0800
     1.3 @@ -1008,7 +1008,11 @@
     1.4  }
     1.5  
     1.6  int MachCallRuntimeNode::ret_addr_offset() {
     1.7 +#if defined(ABI_ELFv2)
     1.8 +  return 28;
     1.9 +#else
    1.10    return 40;
    1.11 +#endif
    1.12  }
    1.13  
    1.14  //=============================================================================
    1.15 @@ -3686,6 +3690,10 @@
    1.16      MacroAssembler _masm(&cbuf);
    1.17      const address start_pc = __ pc();
    1.18  
    1.19 +#if defined(ABI_ELFv2)
    1.20 +    address entry= !($meth$$method) ? NULL : (address)$meth$$method;
    1.21 +    __ call_c(entry, relocInfo::runtime_call_type);
    1.22 +#else
    1.23      // The function we're going to call.
    1.24      FunctionDescriptor fdtemp;
    1.25      const FunctionDescriptor* fd = !($meth$$method) ? &fdtemp : (FunctionDescriptor*)$meth$$method;
    1.26 @@ -3696,6 +3704,7 @@
    1.27      // Put entry, env, toc into the constant pool, this needs up to 3 constant
    1.28      // pool entries; call_c_using_toc will optimize the call.
    1.29      __ call_c_using_toc(fd, relocInfo::runtime_call_type, Rtoc);
    1.30 +#endif
    1.31  
    1.32      // Check the ret_addr_offset.
    1.33      assert(((MachCallRuntimeNode*)this)->ret_addr_offset() ==  __ last_calls_return_pc() - start_pc,
    1.34 @@ -3711,20 +3720,25 @@
    1.35      __ mtctr($src$$Register);
    1.36    %}
    1.37  
    1.38 -  // postalloc expand emitter for runtime leaf calls.
    1.39 +  // Postalloc expand emitter for runtime leaf calls.
    1.40    enc_class postalloc_expand_java_to_runtime_call(method meth, iRegLdst toc) %{
    1.41 +    loadConLNodesTuple loadConLNodes_Entry;
    1.42 +#if defined(ABI_ELFv2)
    1.43 +    jlong entry_address = (jlong) this->entry_point();
    1.44 +    assert(entry_address, "need address here");
    1.45 +    loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address),
    1.46 +                                                    OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
    1.47 +#else
    1.48      // Get the struct that describes the function we are about to call.
    1.49      FunctionDescriptor* fd = (FunctionDescriptor*) this->entry_point();
    1.50      assert(fd, "need fd here");
    1.51 +    jlong entry_address = (jlong) fd->entry();
    1.52      // new nodes
    1.53 -    loadConLNodesTuple loadConLNodes_Entry;
    1.54      loadConLNodesTuple loadConLNodes_Env;
    1.55      loadConLNodesTuple loadConLNodes_Toc;
    1.56 -    MachNode         *mtctr = NULL;
    1.57 -    MachCallLeafNode *call  = NULL;
    1.58  
    1.59      // Create nodes and operands for loading the entry point.
    1.60 -    loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->entry()),
    1.61 +    loadConLNodes_Entry = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper(entry_address),
    1.62                                                      OptoReg::Name(R12_H_num), OptoReg::Name(R12_num));
    1.63  
    1.64  
    1.65 @@ -3745,8 +3759,9 @@
    1.66      // Create nodes and operands for loading the Toc point.
    1.67      loadConLNodes_Toc = loadConLNodesTuple_create(C, ra_, n_toc, new (C) immLOper((jlong) fd->toc()),
    1.68                                                    OptoReg::Name(R2_H_num), OptoReg::Name(R2_num));
    1.69 +#endif // ABI_ELFv2
    1.70      // mtctr node
    1.71 -    mtctr = new (C) CallLeafDirect_mtctrNode();
    1.72 +    MachNode *mtctr = new (C) CallLeafDirect_mtctrNode();
    1.73  
    1.74      assert(loadConLNodes_Entry._last != NULL, "entry must exist");
    1.75      mtctr->add_req(0, loadConLNodes_Entry._last);
    1.76 @@ -3755,10 +3770,10 @@
    1.77      mtctr->_opnds[1] = new (C) iRegLdstOper();
    1.78  
    1.79      // call node
    1.80 -    call = new (C) CallLeafDirectNode();
    1.81 +    MachCallLeafNode *call = new (C) CallLeafDirectNode();
    1.82  
    1.83      call->_opnds[0] = _opnds[0];
    1.84 -    call->_opnds[1] = new (C) methodOper((intptr_t) fd->entry()); // may get set later
    1.85 +    call->_opnds[1] = new (C) methodOper((intptr_t) entry_address); // May get set later.
    1.86  
    1.87      // Make the new call node look like the old one.
    1.88      call->_name        = _name;
    1.89 @@ -3785,8 +3800,10 @@
    1.90      // These must be reqired edges, as the registers are live up to
    1.91      // the call. Else the constants are handled as kills.
    1.92      call->add_req(mtctr);
    1.93 +#if !defined(ABI_ELFv2)
    1.94      call->add_req(loadConLNodes_Env._last);
    1.95      call->add_req(loadConLNodes_Toc._last);
    1.96 +#endif
    1.97  
    1.98      // ...as well as prec
    1.99      for (uint i = req(); i < len(); ++i) {
   1.100 @@ -3799,10 +3816,12 @@
   1.101      // Insert the new nodes.
   1.102      if (loadConLNodes_Entry._large_hi) nodes->push(loadConLNodes_Entry._large_hi);
   1.103      if (loadConLNodes_Entry._last)     nodes->push(loadConLNodes_Entry._last);
   1.104 +#if !defined(ABI_ELFv2)
   1.105      if (loadConLNodes_Env._large_hi)   nodes->push(loadConLNodes_Env._large_hi);
   1.106      if (loadConLNodes_Env._last)       nodes->push(loadConLNodes_Env._last);
   1.107      if (loadConLNodes_Toc._large_hi)   nodes->push(loadConLNodes_Toc._large_hi);
   1.108      if (loadConLNodes_Toc._last)       nodes->push(loadConLNodes_Toc._last);
   1.109 +#endif
   1.110      nodes->push(mtctr);
   1.111      nodes->push(call);
   1.112    %}
   1.113 @@ -3849,7 +3868,7 @@
   1.114    // out_preserve_stack_slots for calls to C. Supports the var-args
   1.115    // backing area for register parms.
   1.116    //
   1.117 -  varargs_C_out_slots_killed(((frame::abi_112_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size));
   1.118 +  varargs_C_out_slots_killed(((frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size));
   1.119  
   1.120    // The after-PROLOG location of the return address. Location of
   1.121    // return address specifies a type (REG or STACK) and a number

mercurial