1 /* 2 * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef SHARE_C1_C1_MACROASSEMBLER_HPP 26 #define SHARE_C1_C1_MACROASSEMBLER_HPP 27 28 #include "asm/macroAssembler.hpp" 29 #include "utilities/macros.hpp" 30 31 class CodeEmitInfo; 32 class CompiledEntrySignature; 33 class C1_MacroAssembler: public MacroAssembler { 34 private: 35 int scalarized_entry(const CompiledEntrySignature* ces, int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc, Label& verified_inline_entry_label, bool is_inline_ro_entry); 36 void build_frame_helper(int frame_size_in_bytes, int sp_offset_for_orig_pc, int sp_inc, bool reset_orig_pc, bool needs_stack_repair); 37 public: 38 // creation 39 C1_MacroAssembler(CodeBuffer* code) : MacroAssembler(code) { pd_init(); } 40 41 //---------------------------------------------------- 42 void explicit_null_check(Register base); 43 44 void build_frame(int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc = 0, bool needs_stack_repair = false, bool has_scalarized_args = false, Label* verified_inline_entry_label = nullptr); 45 46 int verified_entry(const CompiledEntrySignature* ces, int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc, Label& verified_inline_entry_label) { 47 return scalarized_entry(ces, frame_size_in_bytes, bang_size_in_bytes, sp_offset_for_orig_pc, verified_inline_entry_label, false); 48 } 49 int verified_inline_ro_entry(const CompiledEntrySignature* ces, int frame_size_in_bytes, int bang_size_in_bytes, int sp_offset_for_orig_pc, Label& verified_inline_entry_label) { 50 return scalarized_entry(ces, frame_size_in_bytes, bang_size_in_bytes, sp_offset_for_orig_pc, verified_inline_entry_label, true); 51 } 52 void verified_entry(bool breakAtEntry); 53 54 void verify_stack_oop(int offset) PRODUCT_RETURN; 55 void verify_not_null_oop(Register r) PRODUCT_RETURN; 56 57 #include CPU_HEADER(c1_MacroAssembler) 58 59 }; 60 61 62 63 // A StubAssembler is a MacroAssembler w/ extra functionality for runtime 64 // stubs. Currently it 'knows' some stub info. Eventually, the information 65 // may be set automatically or can be asserted when using specialised 66 // StubAssembler functions. 67 68 class StubAssembler: public C1_MacroAssembler { 69 private: 70 const char* _name; 71 bool _must_gc_arguments; 72 int _frame_size; 73 int _num_rt_args; 74 int _stub_id; 75 76 public: 77 // creation 78 StubAssembler(CodeBuffer* code, const char * name, int stub_id); 79 void set_info(const char* name, bool must_gc_arguments); 80 81 void set_frame_size(int size); 82 void set_num_rt_args(int args); 83 84 void save_live_registers(); 85 void restore_live_registers_without_return(); 86 87 // accessors 88 const char* name() const { return _name; } 89 bool must_gc_arguments() const { return _must_gc_arguments; } 90 int frame_size() const { return _frame_size; } 91 int num_rt_args() const { return _num_rt_args; } 92 int stub_id() const { return _stub_id; } 93 94 // runtime calls (return offset of call to be used by GC map) 95 int call_RT(Register oop_result1, Register metadata_result, address entry, int args_size = 0); 96 int call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1); 97 int call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2); 98 int call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3); 99 100 void prologue(const char* name, bool must_gc_arguments); 101 void epilogue(); 102 }; 103 104 #endif // SHARE_C1_C1_MACROASSEMBLER_HPP