Fri, 07 Jan 2011 15:57:02 -0500
Merge
1.1 --- a/src/share/vm/c1/c1_Compilation.cpp Fri Jan 07 03:38:19 2011 -0800 1.2 +++ b/src/share/vm/c1/c1_Compilation.cpp Fri Jan 07 15:57:02 2011 -0500 1.3 @@ -245,7 +245,7 @@ 1.4 } 1.5 1.6 1.7 -void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { 1.8 +bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { 1.9 // Preinitialize the consts section to some large size: 1.10 int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo)); 1.11 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size); 1.12 @@ -253,15 +253,20 @@ 1.13 locs_buffer_size / sizeof(relocInfo)); 1.14 code->initialize_consts_size(Compilation::desired_max_constant_size()); 1.15 // Call stubs + two deopt handlers (regular and MH) + exception handler 1.16 - code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) + 1.17 - LIR_Assembler::exception_handler_size + 1.18 - 2 * LIR_Assembler::deopt_handler_size); 1.19 + int stub_size = (call_stub_estimate * LIR_Assembler::call_stub_size) + 1.20 + LIR_Assembler::exception_handler_size + 1.21 + (2 * LIR_Assembler::deopt_handler_size); 1.22 + if (stub_size >= code->insts_capacity()) return false; 1.23 + code->initialize_stubs_size(stub_size); 1.24 + return true; 1.25 } 1.26 1.27 1.28 int Compilation::emit_code_body() { 1.29 // emit code 1.30 - setup_code_buffer(code(), allocator()->num_calls()); 1.31 + if (!setup_code_buffer(code(), allocator()->num_calls())) { 1.32 + BAILOUT_("size requested greater than avail code buffer size", 0); 1.33 + } 1.34 code()->initialize_oop_recorder(env()->oop_recorder()); 1.35 1.36 _masm = new C1_MacroAssembler(code());
2.1 --- a/src/share/vm/c1/c1_Compilation.hpp Fri Jan 07 03:38:19 2011 -0800 2.2 +++ b/src/share/vm/c1/c1_Compilation.hpp Fri Jan 07 15:57:02 2011 -0500 2.3 @@ -192,7 +192,7 @@ 2.4 return desired_max_code_buffer_size() / 10; 2.5 } 2.6 2.7 - static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate); 2.8 + static bool setup_code_buffer(CodeBuffer* cb, int call_stub_estimate); 2.9 2.10 // timers 2.11 static void print_timers();