src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/compile.cpp

Print this page




 518   // constant section is big enough, use it.  Otherwise free the
 519   // current and allocate a new one.
 520   BufferBlob* blob = scratch_buffer_blob();
 521   if ((blob != NULL) && (const_size <= _scratch_const_size)) {
 522     // Use the current blob.
 523   } else {
 524     if (blob != NULL) {
 525       BufferBlob::free(blob);
 526     }
 527 
 528     ResourceMark rm;
 529     _scratch_const_size = const_size;
 530     int size = (MAX_inst_size + MAX_stubs_size + _scratch_const_size);
 531     blob = BufferBlob::create("Compile::scratch_buffer", size);
 532     // Record the buffer blob for next time.
 533     set_scratch_buffer_blob(blob);
 534     // Have we run out of code space?
 535     if (scratch_buffer_blob() == NULL) {
 536       // Let CompilerBroker disable further compilations.
 537       record_failure("Not enough space for scratch buffer in CodeCache");
 538       CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
 539       return;
 540     }
 541   }
 542 
 543   // Initialize the relocation buffers
 544   relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size;
 545   set_scratch_locs_memory(locs_buf);
 546 }
 547 
 548 
 549 //-----------------------scratch_emit_size-------------------------------------
 550 // Helper function that computes size by emitting code
 551 uint Compile::scratch_emit_size(const Node* n) {
 552   // Start scratch_emit_size section.
 553   set_in_scratch_emit_size(true);
 554 
 555   // Emit into a trash buffer and count bytes emitted.
 556   // This is a pretty expensive way to compute a size,
 557   // but it works well enough if seldom used.
 558   // All common fixed-size instructions are given a size




 518   // constant section is big enough, use it.  Otherwise free the
 519   // current and allocate a new one.
 520   BufferBlob* blob = scratch_buffer_blob();
 521   if ((blob != NULL) && (const_size <= _scratch_const_size)) {
 522     // Use the current blob.
 523   } else {
 524     if (blob != NULL) {
 525       BufferBlob::free(blob);
 526     }
 527 
 528     ResourceMark rm;
 529     _scratch_const_size = const_size;
 530     int size = (MAX_inst_size + MAX_stubs_size + _scratch_const_size);
 531     blob = BufferBlob::create("Compile::scratch_buffer", size);
 532     // Record the buffer blob for next time.
 533     set_scratch_buffer_blob(blob);
 534     // Have we run out of code space?
 535     if (scratch_buffer_blob() == NULL) {
 536       // Let CompilerBroker disable further compilations.
 537       record_failure("Not enough space for scratch buffer in CodeCache");

 538       return;
 539     }
 540   }
 541 
 542   // Initialize the relocation buffers
 543   relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size;
 544   set_scratch_locs_memory(locs_buf);
 545 }
 546 
 547 
 548 //-----------------------scratch_emit_size-------------------------------------
 549 // Helper function that computes size by emitting code
 550 uint Compile::scratch_emit_size(const Node* n) {
 551   // Start scratch_emit_size section.
 552   set_in_scratch_emit_size(true);
 553 
 554   // Emit into a trash buffer and count bytes emitted.
 555   // This is a pretty expensive way to compute a size,
 556   // but it works well enough if seldom used.
 557   // All common fixed-size instructions are given a size


src/share/vm/opto/compile.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File