28 #include "c1/c1_CodeStubs.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "oops/methodData.hpp"
31 #include "utilities/top.hpp"
32
33 class Compilation;
34 class ScopeValue;
35 class BarrierSet;
36
37 class LIR_Assembler: public CompilationResourceObj {
38 private:
39 C1_MacroAssembler* _masm;
40 CodeStubList* _slow_case_stubs;
41 BarrierSet* _bs;
42
43 Compilation* _compilation;
44 FrameMap* _frame_map;
45 BlockBegin* _current_block;
46
47 Instruction* _pending_non_safepoint;
48 int _pending_non_safepoint_offset;
49
50 Label _unwind_handler_entry;
51
52 #ifdef ASSERT
53 BlockList _branch_target_blocks;
54 void check_no_unbound_labels();
55 #endif
56
57 FrameMap* frame_map() const { return _frame_map; }
58
59 void set_current_block(BlockBegin* b) { _current_block = b; }
60 BlockBegin* current_block() const { return _current_block; }
61
62 // non-safepoint debug info management
63 void flush_debug_info(int before_pc_offset) {
64 if (_pending_non_safepoint != NULL) {
65 if (_pending_non_safepoint_offset < before_pc_offset)
66 record_non_safepoint_debug_info();
67 _pending_non_safepoint = NULL;
68 }
69 }
70 void process_debug_info(LIR_Op* op);
71 void record_non_safepoint_debug_info();
72
73 // unified bailout support
74 void bailout(const char* msg) const { compilation()->bailout(msg); }
75 bool bailed_out() const { return compilation()->bailed_out(); }
76
77 // code emission patterns and accessors
78 void check_codespace();
79 bool needs_icache(ciMethod* method) const;
80
81 // returns offset of icache check
82 int check_icache();
83
84 void jobject2reg(jobject o, Register reg);
85 void jobject2reg_with_patching(Register reg, CodeEmitInfo* info);
86
129 ciMethod* method() const { return compilation()->method(); }
130
131 CodeOffsets* offsets() const { return _compilation->offsets(); }
132 int code_offset() const;
133 address pc() const;
134
135 int initial_frame_size_in_bytes() const;
136 int bang_size_in_bytes() const;
137
138 // test for constants which can be encoded directly in instructions
139 static bool is_small_constant(LIR_Opr opr);
140
141 static LIR_Opr receiverOpr();
142 static LIR_Opr osrBufferPointer();
143
144 // stubs
145 void emit_slow_case_stubs();
146 void emit_static_call_stub();
147 void append_code_stub(CodeStub* op);
148 void add_call_info_here(CodeEmitInfo* info) { add_call_info(code_offset(), info); }
149
150 // code patterns
151 int emit_exception_handler();
152 int emit_unwind_handler();
153 void emit_exception_entries(ExceptionInfoList* info_list);
154 int emit_deopt_handler();
155
156 void emit_code(BlockList* hir);
157 void emit_block(BlockBegin* block);
158 void emit_lir_list(LIR_List* list);
159
160 // any last minute peephole optimizations are performed here. In
161 // particular sparc uses this for delay slot filling.
162 void peephole(LIR_List* list);
163
164 void emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst, CodeEmitInfo* info);
165
166 void return_op(LIR_Opr result);
167
168 // returns offset of poll instruction
|
28 #include "c1/c1_CodeStubs.hpp"
29 #include "ci/ciMethodData.hpp"
30 #include "oops/methodData.hpp"
31 #include "utilities/top.hpp"
32
33 class Compilation;
34 class ScopeValue;
35 class BarrierSet;
36
37 class LIR_Assembler: public CompilationResourceObj {
38 private:
39 C1_MacroAssembler* _masm;
40 CodeStubList* _slow_case_stubs;
41 BarrierSet* _bs;
42
43 Compilation* _compilation;
44 FrameMap* _frame_map;
45 BlockBegin* _current_block;
46
47 Instruction* _pending_non_safepoint;
48 int _pending_non_safepoint_begin_offset;
49 int _pending_non_safepoint_end_offset;
50
51 Label _unwind_handler_entry;
52
53 #ifdef ASSERT
54 BlockList _branch_target_blocks;
55 void check_no_unbound_labels();
56 #endif
57
58 FrameMap* frame_map() const { return _frame_map; }
59
60 void set_current_block(BlockBegin* b) { _current_block = b; }
61 BlockBegin* current_block() const { return _current_block; }
62
63 // non-safepoint debug info management
64 void flush_debug_info(int before_pc_offset) {
65 if (_pending_non_safepoint != NULL) {
66 if (_pending_non_safepoint_end_offset < before_pc_offset) {
67 record_non_safepoint_debug_info();
68 } else if (_pending_non_safepoint_begin_offset < before_pc_offset) {
69 // stretch as far as possible before the conflict
70 _pending_non_safepoint_end_offset = before_pc_offset - 1;
71 record_non_safepoint_debug_info();
72 }
73 _pending_non_safepoint = NULL;
74 }
75 }
76 void process_debug_info(LIR_Op* op);
77 void record_non_safepoint_debug_info();
78
79 // unified bailout support
80 void bailout(const char* msg) const { compilation()->bailout(msg); }
81 bool bailed_out() const { return compilation()->bailed_out(); }
82
83 // code emission patterns and accessors
84 void check_codespace();
85 bool needs_icache(ciMethod* method) const;
86
87 // returns offset of icache check
88 int check_icache();
89
90 void jobject2reg(jobject o, Register reg);
91 void jobject2reg_with_patching(Register reg, CodeEmitInfo* info);
92
135 ciMethod* method() const { return compilation()->method(); }
136
137 CodeOffsets* offsets() const { return _compilation->offsets(); }
138 int code_offset() const;
139 address pc() const;
140
141 int initial_frame_size_in_bytes() const;
142 int bang_size_in_bytes() const;
143
144 // test for constants which can be encoded directly in instructions
145 static bool is_small_constant(LIR_Opr opr);
146
147 static LIR_Opr receiverOpr();
148 static LIR_Opr osrBufferPointer();
149
150 // stubs
151 void emit_slow_case_stubs();
152 void emit_static_call_stub();
153 void append_code_stub(CodeStub* op);
154 void add_call_info_here(CodeEmitInfo* info) { add_call_info(code_offset(), info); }
155 void add_non_safepoint_debug_info_here(CodeEmitInfo* info);
156
157 // code patterns
158 int emit_exception_handler();
159 int emit_unwind_handler();
160 void emit_exception_entries(ExceptionInfoList* info_list);
161 int emit_deopt_handler();
162
163 void emit_code(BlockList* hir);
164 void emit_block(BlockBegin* block);
165 void emit_lir_list(LIR_List* list);
166
167 // any last minute peephole optimizations are performed here. In
168 // particular sparc uses this for delay slot filling.
169 void peephole(LIR_List* list);
170
171 void emit_string_compare(LIR_Opr left, LIR_Opr right, LIR_Opr dst, CodeEmitInfo* info);
172
173 void return_op(LIR_Opr result);
174
175 // returns offset of poll instruction
|