< prev index next >

src/share/vm/opto/output.cpp

Print this page

        

@@ -1502,10 +1502,18 @@
       // "Normal" instruction case
       DEBUG_ONLY( uint instr_offset = cb->insts_size(); )
       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();
         assert(false, "wrong size of mach node");
       }
< prev index next >