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