1 /* 2 * Copyright (c) 2013, Red Hat Inc. 3 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 4 * All rights reserved. 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This code is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 only, as 9 * published by the Free Software Foundation. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 * 25 */ 26 27 #ifndef CPU_AARCH64_VM_C1_MACROASSEMBLER_AARCH64_HPP 28 #define CPU_AARCH64_VM_C1_MACROASSEMBLER_AARCH64_HPP 29 30 using MacroAssembler::build_frame; 31 using MacroAssembler::null_check; 32 33 // C1_MacroAssembler contains high-level macros for C1 34 35 private: 36 int _rsp_offset; // track rsp changes 37 // initialization 38 void pd_init() { _rsp_offset = 0; } 39 40 void zero_memory(Register addr, Register len, Register t1); 41 42 public: 43 void try_allocate( 44 Register obj, // result: pointer to object after successful allocation 45 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 46 int con_size_in_bytes, // object size in bytes if known at compile time 47 Register t1, // temp register 48 Register t2, // temp register 49 Label& slow_case // continuation point if fast allocation fails 50 ); 51 52 void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2); 53 void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1); 54 55 void float_cmp(bool is_float, int unordered_result, 56 FloatRegister f0, FloatRegister f1, 57 Register result); 58 59 // locking 60 // hdr : must be r0, contents destroyed 61 // obj : must point to the object to lock, contents preserved 62 // disp_hdr: must point to the displaced header location, contents preserved 63 // scratch : scratch register, contents destroyed 64 // returns code offset at which to add null check debug information 65 int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case); 66 67 // unlocking 68 // hdr : contents destroyed 69 // obj : must point to the object to lock, contents preserved 70 // disp_hdr: must be r0 & must point to the displaced header location, contents destroyed 71 void unlock_object(Register swap, Register obj, Register lock, Label& slow_case); 72 73 void initialize_object( 74 Register obj, // result: pointer to object after successful allocation 75 Register klass, // object klass 76 Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise 77 int con_size_in_bytes, // object size in bytes if known at compile time 78 Register t1, // temp register 79 Register t2 // temp register 80 ); 81 82 // allocation of fixed-size objects 83 // (can also be used to allocate fixed-size arrays, by setting 84 // hdr_size correctly and storing the array length afterwards) 85 // obj : will contain pointer to allocated object 86 // t1, t2 : scratch registers - contents destroyed 87 // header_size: size of object header in words 88 // object_size: total size of object in words 89 // slow_case : exit to slow case implementation if fast allocation fails 90 void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case); 91 92 enum { 93 max_array_allocation_length = 0x00FFFFFF 94 }; 95 96 // allocation of arrays 97 // obj : will contain pointer to allocated object 98 // len : array length in number of elements 99 // t : scratch register - contents destroyed 100 // header_size: size of object header in words 101 // f : element scale factor 102 // slow_case : exit to slow case implementation if fast allocation fails 103 void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, int f, Register klass, Label& slow_case); 104 105 int rsp_offset() const { return _rsp_offset; } 106 void set_rsp_offset(int n) { _rsp_offset = n; } 107 108 void invalidate_registers(bool inv_r0, bool inv_r19, bool inv_r2, bool inv_r3, bool inv_r4, bool inv_r5) PRODUCT_RETURN; 109 110 #endif // CPU_AARCH64_VM_C1_MACROASSEMBLER_AARCH64_HPP