comparison src/cpu/x86/vm/vtableStubs_x86_32.cpp @ 12294:891687731b59

7009641: Don't fail VM when CodeCache is full Summary: Allocation in the code cache returns NULL instead of failing the entire VM Reviewed-by: kvn, iveresov
author anoll
date Tue, 24 Sep 2013 15:56:25 +0200
parents cd3d6a6b95d9
children 5ccbab1c69f3
comparison
equal deleted inserted replaced
12274:8a6a85321d3a 12294:891687731b59
56 // Note that rax and rdx are also used for return values. 56 // Note that rax and rdx are also used for return values.
57 // 57 //
58 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 58 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
59 const int i486_code_length = VtableStub::pd_code_size_limit(true); 59 const int i486_code_length = VtableStub::pd_code_size_limit(true);
60 VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index); 60 VtableStub* s = new(i486_code_length) VtableStub(true, vtable_index);
61 // Can be NULL if there is no free space in the code cache.
62 if (s == NULL) {
63 return NULL;
64 }
65
61 ResourceMark rm; 66 ResourceMark rm;
62 CodeBuffer cb(s->entry_point(), i486_code_length); 67 CodeBuffer cb(s->entry_point(), i486_code_length);
63 MacroAssembler* masm = new MacroAssembler(&cb); 68 MacroAssembler* masm = new MacroAssembler(&cb);
64 69
65 #ifndef PRODUCT 70 #ifndef PRODUCT
130 VtableStub* VtableStubs::create_itable_stub(int itable_index) { 135 VtableStub* VtableStubs::create_itable_stub(int itable_index) {
131 // Note well: pd_code_size_limit is the absolute minimum we can get away with. If you 136 // Note well: pd_code_size_limit is the absolute minimum we can get away with. If you
132 // add code here, bump the code stub size returned by pd_code_size_limit! 137 // add code here, bump the code stub size returned by pd_code_size_limit!
133 const int i486_code_length = VtableStub::pd_code_size_limit(false); 138 const int i486_code_length = VtableStub::pd_code_size_limit(false);
134 VtableStub* s = new(i486_code_length) VtableStub(false, itable_index); 139 VtableStub* s = new(i486_code_length) VtableStub(false, itable_index);
140 // Can be NULL if there is no free space in the code cache.
141 if (s == NULL) {
142 return NULL;
143 }
144
135 ResourceMark rm; 145 ResourceMark rm;
136 CodeBuffer cb(s->entry_point(), i486_code_length); 146 CodeBuffer cb(s->entry_point(), i486_code_length);
137 MacroAssembler* masm = new MacroAssembler(&cb); 147 MacroAssembler* masm = new MacroAssembler(&cb);
138 148
139 // Entry arguments: 149 // Entry arguments: