--- old/src/share/vm/runtime/stubRoutines.cpp 2015-08-19 13:37:45.451392584 -0400 +++ new/src/share/vm/runtime/stubRoutines.cpp 2015-08-19 13:37:45.317154873 -0400 @@ -181,7 +181,7 @@ StubGenerator_generate(&buffer, false); // When new stubs added we need to make sure there is some space left // to catch situation when we should increase size again. - assert(buffer.insts_remaining() > 200, "increase code_size1"); + buffer.check_code_size(); } } @@ -274,7 +274,7 @@ StubGenerator_generate(&buffer, true); // When new stubs added we need to make sure there is some space left // to catch situation when we should increase size again. - assert(buffer.insts_remaining() > 200, "increase code_size2"); + buffer.check_code_size(); } #ifdef ASSERT --- old/src/share/vm/asm/codeBuffer.hpp 2015-08-19 13:37:45.476203577 -0400 +++ new/src/share/vm/asm/codeBuffer.hpp 2015-08-19 13:37:45.344334112 -0400 @@ -532,7 +532,11 @@ csize_t insts_capacity() const { return _insts.capacity(); } // number of bytes remaining in the insts section - csize_t insts_remaining() const { return _insts.remaining(); } + void check_code_size() const { + // When new stubs added we need to make sure there is some space left + // to catch situation when we should increase size again. + assert(insts_size() == 0 || _insts.remaining() > 200, "increase code_size1"); + } // is a given address in the insts section? (2nd version is end-inclusive) bool insts_contains(address pc) const { return _insts.contains(pc); }