--- old/src/cpu/sparc/vm/sparc.ad 2016-04-11 14:42:23.150406126 +0300 +++ new/src/cpu/sparc/vm/sparc.ad 2016-04-11 14:42:22.966401111 +0300 @@ -1775,9 +1775,11 @@ AddressLiteral exception_blob(OptoRuntime::exception_blob()->entry_point()); MacroAssembler _masm(&cbuf); - address base = - __ start_a_stub(size_exception_handler()); - if (base == NULL) return 0; // CodeBuffer::expand failed + address base = __ start_a_stub(size_exception_handler()); + if (base == NULL) { + ciEnv::current()->record_failure("CodeCache is full"); + return 0; // CodeBuffer::expand failed + } int offset = __ offset(); @@ -1798,9 +1800,11 @@ AddressLiteral deopt_blob(SharedRuntime::deopt_blob()->unpack()); MacroAssembler _masm(&cbuf); - address base = - __ start_a_stub(size_deopt_handler()); - if (base == NULL) return 0; // CodeBuffer::expand failed + address base = __ start_a_stub(size_deopt_handler()); + if (base == NULL) { + ciEnv::current()->record_failure("CodeCache is full"); + return 0; // CodeBuffer::expand failed + } int offset = __ offset(); __ save_frame(0); @@ -2601,7 +2605,12 @@ emit_call_reloc(cbuf, $meth$$method, relocInfo::static_call_type); } if (_method) { // Emit stub for static call. - CompiledStaticCall::emit_to_interp_stub(cbuf); + address stub = CompiledStaticCall::emit_to_interp_stub(cbuf); + // Stub does not fit into scratch buffer if TraceJumps is enabled + if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) { + ciEnv::current()->record_failure("CodeCache is full"); + return; + } } %}