Mercurial > hg > graal-compiler
comparison src/cpu/ppc/vm/macroAssembler_ppc.hpp @ 14726:92aa6797d639
Backed out merge changeset: b51e29501f30
Backed out merge revision to its first parent (8f483e200405)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 24 Mar 2014 21:30:43 +0100 |
parents | 58cf34613a72 |
children |
comparison
equal
deleted
inserted
replaced
14719:0bdd0d157040 | 14726:92aa6797d639 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. | 3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
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 abi_reg_args on top. | 282 // Push a frame of size `bytes' plus abi112 on top. |
283 void push_frame_reg_args(unsigned int bytes, Register tmp); | 283 void push_frame_abi112(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_reg_args_nonvolatiles(unsigned int bytes, Register tmp); | 287 void push_frame_abi112_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 | |
304 // Generic version of a call to C function via a function descriptor | 299 // Generic version of a call to C function via a function descriptor |
305 // with variable support for C calling conventions (TOC, ENV, etc.). | 300 // with variable support for C calling conventions (TOC, ENV, etc.). |
306 // updates and returns _last_calls_return_pc. | 301 // updates and returns _last_calls_return_pc. |
307 address branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call, | 302 address branch_to(Register function_descriptor, bool and_link, bool save_toc_before_call, |
308 bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee); | 303 bool restore_toc_after_call, bool load_toc_of_callee, bool load_env_of_callee); |
309 #endif | |
310 | 304 |
311 public: | 305 public: |
312 | 306 |
313 // Get the pc where the last call will return to. returns _last_calls_return_pc. | 307 // Get the pc where the last call will return to. returns _last_calls_return_pc. |
314 inline address last_calls_return_pc(); | 308 inline address last_calls_return_pc(); |
315 | 309 |
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 | |
324 // Call a C function via a function descriptor and use full C | 310 // Call a C function via a function descriptor and use full C |
325 // calling conventions. Updates and returns _last_calls_return_pc. | 311 // calling conventions. Updates and returns _last_calls_return_pc. |
326 address call_c(Register function_descriptor); | 312 address call_c(Register function_descriptor); |
327 // For tail calls: only branch, don't link, so callee returns to caller of this function. | 313 // For tail calls: only branch, don't link, so callee returns to caller of this function. |
328 address call_c_and_return_to_caller(Register function_descriptor); | 314 address call_c_and_return_to_caller(Register function_descriptor); |
329 address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt); | 315 address call_c(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt); |
330 address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt, | 316 address call_c_using_toc(const FunctionDescriptor* function_descriptor, relocInfo::relocType rt, |
331 Register toc); | 317 Register toc); |
332 #endif | |
333 | 318 |
334 protected: | 319 protected: |
335 | 320 |
336 // It is imperative that all calls into the VM are handled via the | 321 // It is imperative that all calls into the VM are handled via the |
337 // call_VM macros. They make sure that the stack linkage is setup | 322 // call_VM macros. They make sure that the stack linkage is setup |
564 // Check accessed object for null. Use SIGTRAP-based null checks on AIX. | 549 // Check accessed object for null. Use SIGTRAP-based null checks on AIX. |
565 inline void load_with_trap_null_check(Register d, int si16, Register s1); | 550 inline void load_with_trap_null_check(Register d, int si16, Register s1); |
566 | 551 |
567 // Load heap oop and decompress. Loaded oop may not be null. | 552 // Load heap oop and decompress. Loaded oop may not be null. |
568 inline void load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1 = noreg); | 553 inline void load_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1 = noreg); |
569 inline void store_heap_oop_not_null(Register d, RegisterOrConstant offs, Register s1, | |
570 /*specify if d must stay uncompressed*/ Register tmp = noreg); | |
571 | 554 |
572 // Null allowed. | 555 // Null allowed. |
573 inline void load_heap_oop(Register d, RegisterOrConstant offs, Register s1 = noreg); | 556 inline void load_heap_oop(Register d, RegisterOrConstant offs, Register s1 = noreg); |
574 | 557 |
575 // Encode/decode heap oop. Oop may not be null, else en/decoding goes wrong. | 558 // Encode/decode heap oop. Oop may not be null, else en/decoding goes wrong. |
576 inline Register encode_heap_oop_not_null(Register d, Register src = noreg); | 559 inline void encode_heap_oop_not_null(Register d); |
577 inline void decode_heap_oop_not_null(Register d); | 560 inline void decode_heap_oop_not_null(Register d); |
578 | 561 |
579 // Null allowed. | 562 // Null allowed. |
580 inline void decode_heap_oop(Register d); | 563 inline void decode_heap_oop(Register d); |
581 | 564 |
582 // Load/Store klass oop from klass field. Compress. | 565 // Load/Store klass oop from klass field. Compress. |
583 void load_klass(Register dst, Register src); | 566 void load_klass(Register dst, Register src); |
584 void load_klass_with_trap_null_check(Register dst, Register src); | 567 void load_klass_with_trap_null_check(Register dst, Register src); |
585 void store_klass(Register dst_oop, Register klass, Register tmp = R0); | 568 void store_klass(Register dst_oop, Register klass, Register tmp = R0); |
586 void store_klass_gap(Register dst_oop, Register val = noreg); // Will store 0 if val not specified. | |
587 static int instr_size_for_decode_klass_not_null(); | 569 static int instr_size_for_decode_klass_not_null(); |
588 void decode_klass_not_null(Register dst, Register src = noreg); | 570 void decode_klass_not_null(Register dst, Register src = noreg); |
589 void encode_klass_not_null(Register dst, Register src = noreg); | 571 void encode_klass_not_null(Register dst, Register src = noreg); |
590 | 572 |
591 // Load common heap base into register. | 573 // Load common heap base into register. |
665 | 647 |
666 // TODO: verify method and klass metadata (compare against vptr?) | 648 // TODO: verify method and klass metadata (compare against vptr?) |
667 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {} | 649 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {} |
668 void _verify_klass_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) {} |
669 | 651 |
670 // Convenience method returning function entry. For the ELFv1 case | |
671 // creates function descriptor at the current address and returs | |
672 // the pointer to it. For the ELFv2 case returns the current address. | |
673 inline address function_entry(); | |
674 | |
675 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__) | 652 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__) |
676 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__) | 653 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__) |
677 | 654 |
678 private: | 655 private: |
679 | 656 |
694 void should_not_reach_here() { stop(stop_shouldnotreachhere, "", -1); } | 671 void should_not_reach_here() { stop(stop_shouldnotreachhere, "", -1); } |
695 | 672 |
696 void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN; | 673 void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN; |
697 }; | 674 }; |
698 | 675 |
699 // class SkipIfEqualZero: | |
700 // | |
701 // Instantiating this class will result in assembly code being output that will | |
702 // jump around any code emitted between the creation of the instance and it's | |
703 // automatic destruction at the end of a scope block, depending on the value of | |
704 // the flag passed to the constructor, which will be checked at run-time. | |
705 class SkipIfEqualZero : public StackObj { | |
706 private: | |
707 MacroAssembler* _masm; | |
708 Label _label; | |
709 | |
710 public: | |
711 // 'Temp' is a temp register that this object can use (and trash). | |
712 explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr); | |
713 ~SkipIfEqualZero(); | |
714 }; | |
715 | |
716 #endif // CPU_PPC_VM_MACROASSEMBLER_PPC_HPP | 676 #endif // CPU_PPC_VM_MACROASSEMBLER_PPC_HPP |