Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/x86/vm/c1_MacroAssembler_x86.hpp
32285 views
/*1* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP25#define CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP2627// C1_MacroAssembler contains high-level macros for C12829private:30int _rsp_offset; // track rsp changes31// initialization32void pd_init() { _rsp_offset = 0; }3334public:35void try_allocate(36Register obj, // result: pointer to object after successful allocation37Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise38int con_size_in_bytes, // object size in bytes if known at compile time39Register t1, // temp register40Register t2, // temp register41Label& slow_case // continuation point if fast allocation fails42);4344void initialize_header(Register obj, Register klass, Register len, Register t1, Register t2);45void initialize_body(Register obj, Register len_in_bytes, int hdr_size_in_bytes, Register t1);4647// locking48// hdr : must be rax, contents destroyed49// obj : must point to the object to lock, contents preserved50// disp_hdr: must point to the displaced header location, contents preserved51// scratch : scratch register, contents destroyed52// returns code offset at which to add null check debug information53int lock_object (Register swap, Register obj, Register disp_hdr, Register scratch, Label& slow_case);5455// unlocking56// hdr : contents destroyed57// obj : must point to the object to lock, contents preserved58// disp_hdr: must be eax & must point to the displaced header location, contents destroyed59void unlock_object(Register swap, Register obj, Register lock, Label& slow_case);6061void initialize_object(62Register obj, // result: pointer to object after successful allocation63Register klass, // object klass64Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise65int con_size_in_bytes, // object size in bytes if known at compile time66Register t1, // temp register67Register t2 // temp register68);6970// allocation of fixed-size objects71// (can also be used to allocate fixed-size arrays, by setting72// hdr_size correctly and storing the array length afterwards)73// obj : must be rax, will contain pointer to allocated object74// t1, t2 : scratch registers - contents destroyed75// header_size: size of object header in words76// object_size: total size of object in words77// slow_case : exit to slow case implementation if fast allocation fails78void allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case);7980enum {81max_array_allocation_length = 0x00FFFFFF82};8384// allocation of arrays85// obj : must be rax, will contain pointer to allocated object86// len : array length in number of elements87// t : scratch register - contents destroyed88// header_size: size of object header in words89// f : element scale factor90// slow_case : exit to slow case implementation if fast allocation fails91void allocate_array(Register obj, Register len, Register t, Register t2, int header_size, Address::ScaleFactor f, Register klass, Label& slow_case);9293int rsp_offset() const { return _rsp_offset; }94void set_rsp_offset(int n) { _rsp_offset = n; }9596// Note: NEVER push values directly, but only through following push_xxx functions;97// This helps us to track the rsp changes compared to the entry rsp (->_rsp_offset)9899void push_jint (jint i) { _rsp_offset++; push(i); }100void push_oop (jobject o) { _rsp_offset++; pushoop(o); }101// Seems to always be in wordSize102void push_addr (Address a) { _rsp_offset++; pushptr(a); }103void push_reg (Register r) { _rsp_offset++; push(r); }104void pop_reg (Register r) { _rsp_offset--; pop(r); assert(_rsp_offset >= 0, "stack offset underflow"); }105106void dec_stack (int nof_words) {107_rsp_offset -= nof_words;108assert(_rsp_offset >= 0, "stack offset underflow");109addptr(rsp, wordSize * nof_words);110}111112void dec_stack_after_call (int nof_words) {113_rsp_offset -= nof_words;114assert(_rsp_offset >= 0, "stack offset underflow");115}116117void invalidate_registers(bool inv_rax, bool inv_rbx, bool inv_rcx, bool inv_rdx, bool inv_rsi, bool inv_rdi) PRODUCT_RETURN;118119#endif // CPU_X86_VM_C1_MACROASSEMBLER_X86_HPP120121122