308 CHECK_BAILOUT();
309 }
310
311 // Emit the handler to remove the activation from the stack and
312 // dispatch to the caller.
313 offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
314
315 // done
316 masm()->flush();
317 }
318
319
320 bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
321 // Preinitialize the consts section to some large size:
322 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
323 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
324 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
325 locs_buffer_size / sizeof(relocInfo));
326 code->initialize_consts_size(Compilation::desired_max_constant_size());
327 // Call stubs + two deopt handlers (regular and MH) + exception handler
328 int stub_size = (call_stub_estimate * LIR_Assembler::call_stub_size) +
329 LIR_Assembler::exception_handler_size +
330 (2 * LIR_Assembler::deopt_handler_size);
331 if (stub_size >= code->insts_capacity()) return false;
332 code->initialize_stubs_size(stub_size);
333 return true;
334 }
335
336
337 int Compilation::emit_code_body() {
338 // emit code
339 if (!setup_code_buffer(code(), allocator()->num_calls())) {
340 BAILOUT_("size requested greater than avail code buffer size", 0);
341 }
342 code()->initialize_oop_recorder(env()->oop_recorder());
343
344 _masm = new C1_MacroAssembler(code());
345 _masm->set_oop_recorder(env()->oop_recorder());
346
347 LIR_Assembler lir_asm(this);
348
|
308 CHECK_BAILOUT();
309 }
310
311 // Emit the handler to remove the activation from the stack and
312 // dispatch to the caller.
313 offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
314
315 // done
316 masm()->flush();
317 }
318
319
320 bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
321 // Preinitialize the consts section to some large size:
322 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
323 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
324 code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
325 locs_buffer_size / sizeof(relocInfo));
326 code->initialize_consts_size(Compilation::desired_max_constant_size());
327 // Call stubs + two deopt handlers (regular and MH) + exception handler
328 int call_stub_size = LIR_Assembler::call_stub_size;
329 int stub_size = (call_stub_estimate * call_stub_size) +
330 LIR_Assembler::exception_handler_size +
331 (2 * LIR_Assembler::deopt_handler_size);
332 if (stub_size >= code->insts_capacity()) return false;
333 code->initialize_stubs_size(stub_size);
334 return true;
335 }
336
337
338 int Compilation::emit_code_body() {
339 // emit code
340 if (!setup_code_buffer(code(), allocator()->num_calls())) {
341 BAILOUT_("size requested greater than avail code buffer size", 0);
342 }
343 code()->initialize_oop_recorder(env()->oop_recorder());
344
345 _masm = new C1_MacroAssembler(code());
346 _masm->set_oop_recorder(env()->oop_recorder());
347
348 LIR_Assembler lir_asm(this);
349
|