src/share/vm/c1/c1_Compilation.cpp

Print this page




 225   // different entry point address.
 226   code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler());
 227   CHECK_BAILOUT();
 228 
 229   // Emit the handler to remove the activation from the stack and
 230   // dispatch to the caller.
 231   offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
 232 
 233   // done
 234   masm()->flush();
 235 }
 236 
 237 
 238 void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
 239   // Preinitialize the consts section to some large size:
 240   int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
 241   char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
 242   code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
 243                                         locs_buffer_size / sizeof(relocInfo));
 244   code->initialize_consts_size(Compilation::desired_max_constant_size());
 245   // Call stubs + deopt/exception handler
 246   code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) +
 247                               LIR_Assembler::exception_handler_size +
 248                               LIR_Assembler::deopt_handler_size);
 249 }
 250 
 251 
 252 int Compilation::emit_code_body() {
 253   // emit code
 254   setup_code_buffer(code(), allocator()->num_calls());
 255   code()->initialize_oop_recorder(env()->oop_recorder());
 256 
 257   _masm = new C1_MacroAssembler(code());
 258   _masm->set_oop_recorder(env()->oop_recorder());
 259 
 260   LIR_Assembler lir_asm(this);
 261 
 262   lir_asm.emit_code(hir()->code());
 263   CHECK_BAILOUT_(0);
 264 
 265   emit_code_epilog(&lir_asm);
 266   CHECK_BAILOUT_(0);
 267 
 268   generate_exception_handler_table();




 225   // different entry point address.
 226   code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler());
 227   CHECK_BAILOUT();
 228 
 229   // Emit the handler to remove the activation from the stack and
 230   // dispatch to the caller.
 231   offsets()->set_value(CodeOffsets::UnwindHandler, assembler->emit_unwind_handler());
 232 
 233   // done
 234   masm()->flush();
 235 }
 236 
 237 
 238 void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) {
 239   // Preinitialize the consts section to some large size:
 240   int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo));
 241   char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
 242   code->insts()->initialize_shared_locs((relocInfo*)locs_buffer,
 243                                         locs_buffer_size / sizeof(relocInfo));
 244   code->initialize_consts_size(Compilation::desired_max_constant_size());
 245   // Call stubs + two deopt handlers (regular and MH) + exception handler
 246   code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) +
 247                               LIR_Assembler::exception_handler_size +
 248                               2 * LIR_Assembler::deopt_handler_size);
 249 }
 250 
 251 
 252 int Compilation::emit_code_body() {
 253   // emit code
 254   setup_code_buffer(code(), allocator()->num_calls());
 255   code()->initialize_oop_recorder(env()->oop_recorder());
 256 
 257   _masm = new C1_MacroAssembler(code());
 258   _masm->set_oop_recorder(env()->oop_recorder());
 259 
 260   LIR_Assembler lir_asm(this);
 261 
 262   lir_asm.emit_code(hir()->code());
 263   CHECK_BAILOUT_(0);
 264 
 265   emit_code_epilog(&lir_asm);
 266   CHECK_BAILOUT_(0);
 267 
 268   generate_exception_handler_table();