# HG changeset patch # User bobv # Date 1294433822 18000 # Node ID 4537d449ba5704aa61b548ea55664b9c48bb4225 # Parent 039eb4201e064db6125d81853e672619168a890f# Parent 2f9d59b0fa5cfd102bb8dadc4f419539be1e9eb0 Merge diff -r 039eb4201e06 -r 4537d449ba57 src/share/vm/c1/c1_Compilation.cpp --- a/src/share/vm/c1/c1_Compilation.cpp Fri Jan 07 03:38:19 2011 -0800 +++ b/src/share/vm/c1/c1_Compilation.cpp Fri Jan 07 15:57:02 2011 -0500 @@ -245,7 +245,7 @@ } -void Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { +bool Compilation::setup_code_buffer(CodeBuffer* code, int call_stub_estimate) { // Preinitialize the consts section to some large size: int locs_buffer_size = 20 * (relocInfo::length_limit + sizeof(relocInfo)); char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size); @@ -253,15 +253,20 @@ locs_buffer_size / sizeof(relocInfo)); code->initialize_consts_size(Compilation::desired_max_constant_size()); // Call stubs + two deopt handlers (regular and MH) + exception handler - code->initialize_stubs_size((call_stub_estimate * LIR_Assembler::call_stub_size) + - LIR_Assembler::exception_handler_size + - 2 * LIR_Assembler::deopt_handler_size); + int stub_size = (call_stub_estimate * LIR_Assembler::call_stub_size) + + LIR_Assembler::exception_handler_size + + (2 * LIR_Assembler::deopt_handler_size); + if (stub_size >= code->insts_capacity()) return false; + code->initialize_stubs_size(stub_size); + return true; } int Compilation::emit_code_body() { // emit code - setup_code_buffer(code(), allocator()->num_calls()); + if (!setup_code_buffer(code(), allocator()->num_calls())) { + BAILOUT_("size requested greater than avail code buffer size", 0); + } code()->initialize_oop_recorder(env()->oop_recorder()); _masm = new C1_MacroAssembler(code()); diff -r 039eb4201e06 -r 4537d449ba57 src/share/vm/c1/c1_Compilation.hpp --- a/src/share/vm/c1/c1_Compilation.hpp Fri Jan 07 03:38:19 2011 -0800 +++ b/src/share/vm/c1/c1_Compilation.hpp Fri Jan 07 15:57:02 2011 -0500 @@ -192,7 +192,7 @@ return desired_max_code_buffer_size() / 10; } - static void setup_code_buffer(CodeBuffer* cb, int call_stub_estimate); + static bool setup_code_buffer(CodeBuffer* cb, int call_stub_estimate); // timers static void print_timers();