398 record_failure("Not enough space for scratch buffer in CodeCache"); |
398 record_failure("Not enough space for scratch buffer in CodeCache"); |
399 return; |
399 return; |
400 } |
400 } |
401 |
401 |
402 // Initialize the relocation buffers |
402 // Initialize the relocation buffers |
403 relocInfo* locs_buf = (relocInfo*) blob->instructions_end() - MAX_locs_size; |
403 relocInfo* locs_buf = (relocInfo*) blob->content_end() - MAX_locs_size; |
404 set_scratch_locs_memory(locs_buf); |
404 set_scratch_locs_memory(locs_buf); |
405 } |
405 } |
406 |
406 |
407 |
407 |
408 //-----------------------scratch_emit_size------------------------------------- |
408 //-----------------------scratch_emit_size------------------------------------- |
420 // expensive, since it has to grab the code cache lock. |
420 // expensive, since it has to grab the code cache lock. |
421 BufferBlob* blob = this->scratch_buffer_blob(); |
421 BufferBlob* blob = this->scratch_buffer_blob(); |
422 assert(blob != NULL, "Initialize BufferBlob at start"); |
422 assert(blob != NULL, "Initialize BufferBlob at start"); |
423 assert(blob->size() > MAX_inst_size, "sanity"); |
423 assert(blob->size() > MAX_inst_size, "sanity"); |
424 relocInfo* locs_buf = scratch_locs_memory(); |
424 relocInfo* locs_buf = scratch_locs_memory(); |
425 address blob_begin = blob->instructions_begin(); |
425 address blob_begin = blob->content_begin(); |
426 address blob_end = (address)locs_buf; |
426 address blob_end = (address)locs_buf; |
427 assert(blob->instructions_contains(blob_end), "sanity"); |
427 assert(blob->content_contains(blob_end), "sanity"); |
428 CodeBuffer buf(blob_begin, blob_end - blob_begin); |
428 CodeBuffer buf(blob_begin, blob_end - blob_begin); |
429 buf.initialize_consts_size(MAX_const_size); |
429 buf.initialize_consts_size(MAX_const_size); |
430 buf.initialize_stubs_size(MAX_stubs_size); |
430 buf.initialize_stubs_size(MAX_stubs_size); |
431 assert(locs_buf != NULL, "sanity"); |
431 assert(locs_buf != NULL, "sanity"); |
432 int lsize = MAX_locs_size / 2; |
432 int lsize = MAX_locs_size / 2; |
433 buf.insts()->initialize_shared_locs(&locs_buf[0], lsize); |
433 buf.insts()->initialize_shared_locs(&locs_buf[0], lsize); |
434 buf.stubs()->initialize_shared_locs(&locs_buf[lsize], lsize); |
434 buf.stubs()->initialize_shared_locs(&locs_buf[lsize], lsize); |
435 n->emit(buf, this->regalloc()); |
435 n->emit(buf, this->regalloc()); |
436 return buf.code_size(); |
436 return buf.insts_size(); |
437 } |
437 } |
438 |
438 |
439 |
439 |
440 // ============================================================================ |
440 // ============================================================================ |
441 //------------------------------Compile standard------------------------------- |
441 //------------------------------Compile standard------------------------------- |