236 CHECK_BAILOUT();
237 }
238
239 // Emit the handler to remove the activation from the stack and
240 // dispatch to the caller.
241 offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
242
243 // done
244 masm()->flush();
245 }
246
247
248 bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
249 // Preinitialize the consts section to some large size:
250 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
251 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
252 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
253 locs_buffer_size / sizeof(relocInfo));
254 code->initialize_consts_size(Compilation::desired_max_constant_size());
255 // Call stubs + two deopt handlers (regular and MH) + exception handler
256 int stub_size = (call_stub_estimate * LIR_Assembler::call_stub_size) +
257 LIR_Assembler::exception_handler_size +
258 (2 * LIR_Assembler::deopt_handler_size);
259 if (stub_size >= code->insts_capacity()) return false;
260 code->initialize_stubs_size(stub_size);
261 return true;
262 }
263
264
265 int Compilation::emit_code_body() {
266 // emit code
267 if (!setup_code_buffer(code(), allocator()->num_calls())) {
268 BAILOUT_("size requested greater than avail code buffer size", 0);
269 }
270 code()->initialize_oop_recorder(env()->oop_recorder());
271
272 _masm = new C1_MacroAssembler(code());
273 _masm->set_oop_recorder(env()->oop_recorder());
274
275 LIR_Assembler lir_asm(this);
276
|
236 CHECK_BAILOUT();
237 }
238
239 // Emit the handler to remove the activation from the stack and
240 // dispatch to the caller.
241 offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
242
243 // done
244 masm()->flush();
245 }
246
247
248 bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
249 // Preinitialize the consts section to some large size:
250 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
251 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
252 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
253 locs_buffer_size / sizeof(relocInfo));
254 code->initialize_consts_size(Compilation::desired_max_constant_size());
255 // Call stubs + two deopt handlers (regular and MH) + exception handler
256 int stub_size = (call_stub_estimate * (LIR_Assembler::call_stub_size + (C1ProfileInlining ? LIR_Assembler::profile_call_stub_size : 0))) +
257 LIR_Assembler::exception_handler_size +
258 (2 * LIR_Assembler::deopt_handler_size);
259 if (stub_size >= code->insts_capacity()) return false;
260 code->initialize_stubs_size(stub_size);
261 return true;
262 }
263
264
265 int Compilation::emit_code_body() {
266 // emit code
267 if (!setup_code_buffer(code(), allocator()->num_calls())) {
268 BAILOUT_("size requested greater than avail code buffer size", 0);
269 }
270 code()->initialize_oop_recorder(env()->oop_recorder());
271
272 _masm = new C1_MacroAssembler(code());
273 _masm->set_oop_recorder(env()->oop_recorder());
274
275 LIR_Assembler lir_asm(this);
276
|