comparison src/cpu/ppc/vm/macroAssembler_ppc.hpp @ 17803:31e80afe3fed

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 67fa91961822
children 58cf34613a72
comparison
equal deleted inserted replaced
17802:7c462558a08a 17803:31e80afe3fed
277 void push_frame(Register bytes, Register tmp); 277 void push_frame(Register bytes, Register tmp);
278 278
279 // Push a frame of size `bytes'. No abi space provided. 279 // Push a frame of size `bytes'. No abi space provided.
280 void push_frame(unsigned int bytes, Register tmp); 280 void push_frame(unsigned int bytes, Register tmp);
281 281
282 // Push a frame of size `bytes' plus abi112 on top. 282 // Push a frame of size `bytes' plus abi_reg_args on top.
283 void push_frame_abi112(unsigned int bytes, Register tmp); 283 void push_frame_reg_args(unsigned int bytes, Register tmp);
284 284
285 // Setup up a new C frame with a spill area for non-volatile GPRs and additional 285 // Setup up a new C frame with a spill area for non-volatile GPRs and additional
286 // space for local variables 286 // space for local variables
287 void push_frame_abi112_nonvolatiles(unsigned int bytes, Register tmp); 287 void push_frame_reg_args_nonvolatiles(unsigned int bytes, Register tmp);
288 288
289 // pop current C frame 289 // pop current C frame
290 void pop_frame(); 290 void pop_frame();
291 291
292 // 292 //
294 // 294 //
295 295
296 private: 296 private:
297 address _last_calls_return_pc; 297 address _last_calls_return_pc;
298 298
299 #if defined(ABI_ELFv2)
300 // Generic version of a call to C function.
301 // Updates and returns _last_calls_return_pc.
302 address branch_to(Register function_entry, bool and_link);
303 #else
299 // Generic version of a call to C function via a function descriptor 304 // Generic version of a call to C function via a function descriptor
300 // with variable support for C calling conventions (TOC, ENV, etc.). 305 // with variable support for C calling conventions (TOC, ENV, etc.).
301 // updates and returns _last_calls_return_pc. 306 // updates and returns _last_calls_return_pc.
302 address branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call, 307 address branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call,
303 bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee); 308 bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee);
309 #endif
304 310
305 public: 311 public:
306 312
307 // Get the pc where the last call will return to. returns _last_calls_return_pc. 313 // Get the pc where the last call will return to. returns _last_calls_return_pc.
308 inline address last_calls_return_pc(); 314 inline address last_calls_return_pc();
309 315
316 #if defined(ABI_ELFv2)
317 // Call a C function via a function descriptor and use full C
318 // calling conventions. Updates and returns _last_calls_return_pc.
319 address call_c(Register function_entry);
320 // For tail calls: only branch, don't link, so callee returns to caller of this function.
321 address call_c_and_return_to_caller(Register function_entry);
322 address call_c(address function_entry, relocInfo::relocType rt);
323 #else
310 // Call a C function via a function descriptor and use full C 324 // Call a C function via a function descriptor and use full C
311 // calling conventions. Updates and returns _last_calls_return_pc. 325 // calling conventions. Updates and returns _last_calls_return_pc.
312 address call_c(Register function_descriptor); 326 address call_c(Register function_descriptor);
313 // For tail calls: only branch, don't link, so callee returns to caller of this function. 327 // For tail calls: only branch, don't link, so callee returns to caller of this function.
314 address call_c_and_return_to_caller(Register function_descriptor); 328 address call_c_and_return_to_caller(Register function_descriptor);
315 address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt); 329 address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt);
316 address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt, 330 address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt,
317 Register toc); 331 Register toc);
332 #endif
318 333
319 protected: 334 protected:
320 335
321 // It is imperative that all calls into the VM are handled via the 336 // It is imperative that all calls into the VM are handled via the
322 // call_VM macros. They make sure that the stack linkage is setup 337 // call_VM macros. They make sure that the stack linkage is setup
647 662
648 // TODO: verify method and klass metadata (compare against vptr?) 663 // TODO: verify method and klass metadata (compare against vptr?)
649 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {} 664 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
650 void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {} 665 void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {}
651 666
667 // Convenience method returning function entry. For the ELFv1 case
668 // creates function descriptor at the current address and returs
669 // the pointer to it. For the ELFv2 case returns the current address.
670 inline address function_entry();
671
652 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__) 672 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
653 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__) 673 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
654 674
655 private: 675 private:
656 676