Wed, 21 Jan 2015 12:38:11 +0100
8068013: [TESTBUG] Aix support in hotspot jtreg tests
Reviewed-by: ctornqvi, fzhinkin, farvidsson
duke@435 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP |
stefank@2314 | 26 | #define CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP |
stefank@2314 | 27 | |
duke@435 | 28 | // C1_MacroAssembler contains high-level macros for C1 |
duke@435 | 29 | |
duke@435 | 30 | private: |
duke@435 | 31 | int _rsp_offset; // track rsp changes |
duke@435 | 32 | // initialization |
duke@435 | 33 | void pd_init() { _rsp_offset = 0; } |
duke@435 | 34 | |
duke@435 | 35 | public: |
duke@435 | 36 | void try_allocate( |
duke@435 | 37 | Register obj, // result: pointer to object after successful allocation |
duke@435 | 38 | Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise |
duke@435 | 39 | int con_size_in_bytes, // object size in bytes if known at compile time |
duke@435 | 40 | Register t1, // temp register |
duke@435 | 41 | Register t2, // temp register |
duke@435 | 42 | Label& slow_case // continuation point if fast allocation fails |
duke@435 | 43 | ); |
duke@435 | 44 | |
duke@435 | 45 | void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2); |
duke@435 | 46 | void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1); |
duke@435 | 47 | |
duke@435 | 48 | // locking |
duke@435 | 49 | // hdr : must be rax, contents destroyed |
duke@435 | 50 | // obj : must point to the object to lock, contents preserved |
duke@435 | 51 | // disp_hdr: must point to the displaced header location, contents preserved |
duke@435 | 52 | // scratch : scratch register, contents destroyed |
duke@435 | 53 | // returns code offset at which to add null check debug information |
duke@435 | 54 | int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case); |
duke@435 | 55 | |
duke@435 | 56 | // unlocking |
duke@435 | 57 | // hdr : contents destroyed |
duke@435 | 58 | // obj : must point to the object to lock, contents preserved |
duke@435 | 59 | // disp_hdr: must be eax & must point to the displaced header location, contents destroyed |
duke@435 | 60 | void unlock_object(Register swap, Register obj, Register lock, Label& slow_case); |
duke@435 | 61 | |
duke@435 | 62 | void initialize_object( |
duke@435 | 63 | Register obj, // result: pointer to object after successful allocation |
duke@435 | 64 | Register klass, // object klass |
duke@435 | 65 | Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise |
duke@435 | 66 | int con_size_in_bytes, // object size in bytes if known at compile time |
duke@435 | 67 | Register t1, // temp register |
duke@435 | 68 | Register t2 // temp register |
duke@435 | 69 | ); |
duke@435 | 70 | |
duke@435 | 71 | // allocation of fixed-size objects |
duke@435 | 72 | // (can also be used to allocate fixed-size arrays, by setting |
duke@435 | 73 | // hdr_size correctly and storing the array length afterwards) |
duke@435 | 74 | // obj : must be rax, will contain pointer to allocated object |
duke@435 | 75 | // t1, t2 : scratch registers - contents destroyed |
duke@435 | 76 | // header_size: size of object header in words |
duke@435 | 77 | // object_size: total size of object in words |
duke@435 | 78 | // slow_case : exit to slow case implementation if fast allocation fails |
duke@435 | 79 | void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case); |
duke@435 | 80 | |
duke@435 | 81 | enum { |
duke@435 | 82 | max_array_allocation_length = 0x00FFFFFF |
duke@435 | 83 | }; |
duke@435 | 84 | |
duke@435 | 85 | // allocation of arrays |
duke@435 | 86 | // obj : must be rax, will contain pointer to allocated object |
duke@435 | 87 | // len : array length in number of elements |
duke@435 | 88 | // t : scratch register - contents destroyed |
duke@435 | 89 | // header_size: size of object header in words |
duke@435 | 90 | // f : element scale factor |
duke@435 | 91 | // slow_case : exit to slow case implementation if fast allocation fails |
duke@435 | 92 | void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case); |
duke@435 | 93 | |
duke@435 | 94 | int rsp_offset() const { return _rsp_offset; } |
duke@435 | 95 | void set_rsp_offset(int n) { _rsp_offset = n; } |
duke@435 | 96 | |
duke@435 | 97 | // Note: NEVER push values directly, but only through following push_xxx functions; |
duke@435 | 98 | // This helps us to track the rsp changes compared to the entry rsp (->_rsp_offset) |
duke@435 | 99 | |
never@739 | 100 | void push_jint (jint i) { _rsp_offset++; push(i); } |
duke@435 | 101 | void push_oop (jobject o) { _rsp_offset++; pushoop(o); } |
never@739 | 102 | // Seems to always be in wordSize |
never@739 | 103 | void push_addr (Address a) { _rsp_offset++; pushptr(a); } |
never@739 | 104 | void push_reg (Register r) { _rsp_offset++; push(r); } |
never@739 | 105 | void pop_reg (Register r) { _rsp_offset--; pop(r); assert(_rsp_offset >= 0, "stack offset underflow"); } |
duke@435 | 106 | |
duke@435 | 107 | void dec_stack (int nof_words) { |
duke@435 | 108 | _rsp_offset -= nof_words; |
duke@435 | 109 | assert(_rsp_offset >= 0, "stack offset underflow"); |
never@739 | 110 | addptr(rsp, wordSize * nof_words); |
duke@435 | 111 | } |
duke@435 | 112 | |
duke@435 | 113 | void dec_stack_after_call (int nof_words) { |
duke@435 | 114 | _rsp_offset -= nof_words; |
duke@435 | 115 | assert(_rsp_offset >= 0, "stack offset underflow"); |
duke@435 | 116 | } |
duke@435 | 117 | |
duke@435 | 118 | void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN; |
stefank@2314 | 119 | |
stefank@2314 | 120 | #endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP |