66 int _next_id;
67 int _next_block_id;
68 AbstractCompiler* _compiler;
69 DirectiveSet* _directive;
70 ciEnv* _env;
71 CompileLog* _log;
72 ciMethod* _method;
73 int _osr_bci;
74 IR* _hir;
75 int _max_spills;
76 FrameMap* _frame_map;
77 C1_MacroAssembler* _masm;
78 bool _has_exception_handlers;
79 bool _has_fpu_code;
80 bool _has_unsafe_access;
81 bool _has_irreducible_loops;
82 bool _would_profile;
83 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
84 bool _has_reserved_stack_access;
85 bool _has_monitors; // Fastpath monitors detection for Continuations
86 bool _install_code;
87 const char* _bailout_msg;
88 ExceptionInfoList* _exception_info_list;
89 ExceptionHandlerTable _exception_handler_table;
90 ImplicitExceptionTable _implicit_exception_table;
91 LinearScan* _allocator;
92 CodeOffsets _offsets;
93 CodeBuffer _code;
94 bool _has_access_indexed;
95 int _interpreter_frame_size; // Stack space needed in case of a deoptimization
96 int _immediate_oops_patched;
97
98 // compilation helpers
99 void initialize();
100 void build_hir();
101 void emit_lir();
102
103 void emit_code_epilog(LIR_Assembler* assembler);
104 int emit_code_body();
105
123 public:
124 // creation
125 Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
126 int osr_bci, BufferBlob* buffer_blob, bool install_code, DirectiveSet* directive);
127 ~Compilation();
128
129
130 static Compilation* current() {
131 return (Compilation*) ciEnv::current()->compiler_data();
132 }
133
134 // accessors
135 ciEnv* env() const { return _env; }
136 DirectiveSet* directive() const { return _directive; }
137 CompileLog* log() const { return _log; }
138 AbstractCompiler* compiler() const { return _compiler; }
139 bool has_exception_handlers() const { return _has_exception_handlers; }
140 bool has_fpu_code() const { return _has_fpu_code; }
141 bool has_unsafe_access() const { return _has_unsafe_access; }
142 bool has_monitors() const { return _has_monitors; }
143 bool has_irreducible_loops() const { return _has_irreducible_loops; }
144 int max_vector_size() const { return 0; }
145 ciMethod* method() const { return _method; }
146 int osr_bci() const { return _osr_bci; }
147 bool is_osr_compile() const { return osr_bci() >= 0; }
148 IR* hir() const { return _hir; }
149 int max_spills() const { return _max_spills; }
150 FrameMap* frame_map() const { return _frame_map; }
151 CodeBuffer* code() { return &_code; }
152 C1_MacroAssembler* masm() const { return _masm; }
153 CodeOffsets* offsets() { return &_offsets; }
154 Arena* arena() { return _arena; }
155 bool has_access_indexed() { return _has_access_indexed; }
156 bool should_install_code() { return _install_code && InstallMethods; }
157 LinearScan* allocator() { return _allocator; }
158
159 // Instruction ids
160 int get_next_id() { return _next_id++; }
161 int number_of_instructions() const { return _next_id; }
162
163 // BlockBegin ids
164 int get_next_block_id() { return _next_block_id++; }
165 int number_of_blocks() const { return _next_block_id; }
166
167 // setters
168 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
169 void set_has_fpu_code(bool f) { _has_fpu_code = f; }
170 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
171 void set_has_irreducible_loops(bool f) { _has_irreducible_loops = f; }
172 void set_would_profile(bool f) { _would_profile = f; }
173 void set_has_access_indexed(bool f) { _has_access_indexed = f; }
174 void set_has_monitors(bool f) { _has_monitors = f; }
175 // Add a set of exception handlers covering the given PC offset
176 void add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers);
177 // Statistics gathering
178 void notice_inlined_method(ciMethod* method);
179
180 // JSR 292
181 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
182 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
183
184 bool has_reserved_stack_access() const { return _has_reserved_stack_access; }
185 void set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
186
187 DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
188 Dependencies* dependency_recorder() const; // = _env->dependencies()
189 ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; }
190
191 Instruction* current_instruction() const { return _current_instruction; }
192 Instruction* set_current_instruction(Instruction* instr) {
193 Instruction* previous = _current_instruction;
194 _current_instruction = instr;
|
66 int _next_id;
67 int _next_block_id;
68 AbstractCompiler* _compiler;
69 DirectiveSet* _directive;
70 ciEnv* _env;
71 CompileLog* _log;
72 ciMethod* _method;
73 int _osr_bci;
74 IR* _hir;
75 int _max_spills;
76 FrameMap* _frame_map;
77 C1_MacroAssembler* _masm;
78 bool _has_exception_handlers;
79 bool _has_fpu_code;
80 bool _has_unsafe_access;
81 bool _has_irreducible_loops;
82 bool _would_profile;
83 bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
84 bool _has_reserved_stack_access;
85 bool _has_monitors; // Fastpath monitors detection for Continuations
86 int _max_monitors; // Max number of active monitors, for fast-locking
87 bool _install_code;
88 const char* _bailout_msg;
89 ExceptionInfoList* _exception_info_list;
90 ExceptionHandlerTable _exception_handler_table;
91 ImplicitExceptionTable _implicit_exception_table;
92 LinearScan* _allocator;
93 CodeOffsets _offsets;
94 CodeBuffer _code;
95 bool _has_access_indexed;
96 int _interpreter_frame_size; // Stack space needed in case of a deoptimization
97 int _immediate_oops_patched;
98
99 // compilation helpers
100 void initialize();
101 void build_hir();
102 void emit_lir();
103
104 void emit_code_epilog(LIR_Assembler* assembler);
105 int emit_code_body();
106
124 public:
125 // creation
126 Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
127 int osr_bci, BufferBlob* buffer_blob, bool install_code, DirectiveSet* directive);
128 ~Compilation();
129
130
131 static Compilation* current() {
132 return (Compilation*) ciEnv::current()->compiler_data();
133 }
134
135 // accessors
136 ciEnv* env() const { return _env; }
137 DirectiveSet* directive() const { return _directive; }
138 CompileLog* log() const { return _log; }
139 AbstractCompiler* compiler() const { return _compiler; }
140 bool has_exception_handlers() const { return _has_exception_handlers; }
141 bool has_fpu_code() const { return _has_fpu_code; }
142 bool has_unsafe_access() const { return _has_unsafe_access; }
143 bool has_monitors() const { return _has_monitors; }
144 int max_monitors() const { return _max_monitors; }
145 bool has_irreducible_loops() const { return _has_irreducible_loops; }
146 int max_vector_size() const { return 0; }
147 ciMethod* method() const { return _method; }
148 int osr_bci() const { return _osr_bci; }
149 bool is_osr_compile() const { return osr_bci() >= 0; }
150 IR* hir() const { return _hir; }
151 int max_spills() const { return _max_spills; }
152 FrameMap* frame_map() const { return _frame_map; }
153 CodeBuffer* code() { return &_code; }
154 C1_MacroAssembler* masm() const { return _masm; }
155 CodeOffsets* offsets() { return &_offsets; }
156 Arena* arena() { return _arena; }
157 bool has_access_indexed() { return _has_access_indexed; }
158 bool should_install_code() { return _install_code && InstallMethods; }
159 LinearScan* allocator() { return _allocator; }
160
161 // Instruction ids
162 int get_next_id() { return _next_id++; }
163 int number_of_instructions() const { return _next_id; }
164
165 // BlockBegin ids
166 int get_next_block_id() { return _next_block_id++; }
167 int number_of_blocks() const { return _next_block_id; }
168
169 // setters
170 void set_has_exception_handlers(bool f) { _has_exception_handlers = f; }
171 void set_has_fpu_code(bool f) { _has_fpu_code = f; }
172 void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
173 void set_has_irreducible_loops(bool f) { _has_irreducible_loops = f; }
174 void set_would_profile(bool f) { _would_profile = f; }
175 void set_has_access_indexed(bool f) { _has_access_indexed = f; }
176 void set_has_monitors(bool f) { _has_monitors = f; }
177 void push_monitor() { _max_monitors++; }
178
179 // Add a set of exception handlers covering the given PC offset
180 void add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers);
181 // Statistics gathering
182 void notice_inlined_method(ciMethod* method);
183
184 // JSR 292
185 bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
186 void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
187
188 bool has_reserved_stack_access() const { return _has_reserved_stack_access; }
189 void set_has_reserved_stack_access(bool z) { _has_reserved_stack_access = z; }
190
191 DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
192 Dependencies* dependency_recorder() const; // = _env->dependencies()
193 ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; }
194
195 Instruction* current_instruction() const { return _current_instruction; }
196 Instruction* set_current_instruction(Instruction* instr) {
197 Instruction* previous = _current_instruction;
198 _current_instruction = instr;
|