--- old/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2015-07-21 14:01:49.680735689 +0200 +++ new/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2015-07-21 14:01:49.604735687 +0200 @@ -699,7 +699,6 @@ address dest) { address stub = start_a_stub(Compile::MAX_stubs_size/2); if (stub == NULL) { - start_a_stub(Compile::MAX_stubs_size/2); Compile::current()->env()->record_out_of_memory_failure(); return; } --- old/src/share/vm/opto/output.cpp 2015-07-21 14:01:49.980735699 +0200 +++ new/src/share/vm/opto/output.cpp 2015-07-21 14:01:49.908735697 +0200 @@ -1504,6 +1504,14 @@ n->emit(*cb, _regalloc); current_offset = cb->insts_size(); + // Above we only verified that there is enough space in the instruction section. + // However, the instruction may emit stubs that cause code buffer expansion. + // Bail out here if expansion failed due to lack of code cache space. + if (cb->blob() == NULL) { + C->record_failure("CodeCache is full"); + return; + } + #ifdef ASSERT if (n->size(_regalloc) < (current_offset-instr_offset)) { n->dump();