comparison src/cpu/x86/vm/vtableStubs_x86_64.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 7944aba7ba41
children 5ccbab1c69f3
comparison
equal deleted inserted replaced
12274:8a6a85321d3a 12294:891687731b59
47 #endif 47 #endif
48 48
49 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) { 49 VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
50 const int amd64_code_length = VtableStub::pd_code_size_limit(true); 50 const int amd64_code_length = VtableStub::pd_code_size_limit(true);
51 VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index); 51 VtableStub* s = new(amd64_code_length) VtableStub(true, vtable_index);
52 // Can be NULL if there is no free space in the code cache.
53 if (s == NULL) {
54 return NULL;
55 }
56
52 ResourceMark rm; 57 ResourceMark rm;
53 CodeBuffer cb(s->entry_point(), amd64_code_length); 58 CodeBuffer cb(s->entry_point(), amd64_code_length);
54 MacroAssembler* masm = new MacroAssembler(&cb); 59 MacroAssembler* masm = new MacroAssembler(&cb);
55 60
56 #ifndef PRODUCT 61 #ifndef PRODUCT
124 // Note well: pd_code_size_limit is the absolute minimum we can get 129 // Note well: pd_code_size_limit is the absolute minimum we can get
125 // away with. If you add code here, bump the code stub size 130 // away with. If you add code here, bump the code stub size
126 // returned by pd_code_size_limit! 131 // returned by pd_code_size_limit!
127 const int amd64_code_length = VtableStub::pd_code_size_limit(false); 132 const int amd64_code_length = VtableStub::pd_code_size_limit(false);
128 VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index); 133 VtableStub* s = new(amd64_code_length) VtableStub(false, itable_index);
134 // Can be NULL if there is no free space in the code cache.
135 if (s == NULL) {
136 return NULL;
137 }
138
129 ResourceMark rm; 139 ResourceMark rm;
130 CodeBuffer cb(s->entry_point(), amd64_code_length); 140 CodeBuffer cb(s->entry_point(), amd64_code_length);
131 MacroAssembler* masm = new MacroAssembler(&cb); 141 MacroAssembler* masm = new MacroAssembler(&cb);
132 142
133 #ifndef PRODUCT 143 #ifndef PRODUCT