400 }
401
402 // Create CodeHeap
403 CodeHeap* heap = new CodeHeap(name, code_blob_type);
404 add_heap(heap);
405
406 // Reserve Space
407 size_t size_initial = MIN2(InitialCodeCacheSize, rs.size());
408 size_initial = round_to(size_initial, os::vm_page_size());
409 if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) {
410 vm_exit_during_initialization("Could not reserve enough space for code cache");
411 }
412
413 // Register the CodeHeap
414 MemoryService::add_code_heap_memory_pool(heap, name);
415 }
416
417 CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
418 assert(cb != NULL, "CodeBlob is null");
419 FOR_ALL_HEAPS(heap) {
420 if ((*heap)->contains(cb->code_begin())) {
421 return *heap;
422 }
423 }
424 ShouldNotReachHere();
425 return NULL;
426 }
427
428 CodeHeap* CodeCache::get_code_heap(int code_blob_type) {
429 FOR_ALL_HEAPS(heap) {
430 if ((*heap)->accepts(code_blob_type)) {
431 return *heap;
432 }
433 }
434 return NULL;
435 }
436
437 CodeBlob* CodeCache::first_blob(CodeHeap* heap) {
438 assert_locked_or_safepoint(CodeCache_lock);
439 assert(heap != NULL, "heap is null");
440 return (CodeBlob*)heap->first();
|
400 }
401
402 // Create CodeHeap
403 CodeHeap* heap = new CodeHeap(name, code_blob_type);
404 add_heap(heap);
405
406 // Reserve Space
407 size_t size_initial = MIN2(InitialCodeCacheSize, rs.size());
408 size_initial = round_to(size_initial, os::vm_page_size());
409 if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) {
410 vm_exit_during_initialization("Could not reserve enough space for code cache");
411 }
412
413 // Register the CodeHeap
414 MemoryService::add_code_heap_memory_pool(heap, name);
415 }
416
417 CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
418 assert(cb != NULL, "CodeBlob is null");
419 FOR_ALL_HEAPS(heap) {
420 if ((*heap)->contains(cb)) {
421 guarantee((char*) cb >= (*heap)->low_boundary() && (char*) cb < (*heap)->high(),
422 "Code blob " INTPTR_FORMAT " should be after "
423 "heap low boundary " INTPTR_FORMAT " "
424 "and before heap high boundary " INTPTR_FORMAT,
425 p2i(cb), p2i((*heap)->low_boundary()), p2i((*heap)->high()));
426 return *heap;
427 }
428 }
429 ShouldNotReachHere();
430 return NULL;
431 }
432
433 CodeHeap* CodeCache::get_code_heap(int code_blob_type) {
434 FOR_ALL_HEAPS(heap) {
435 if ((*heap)->accepts(code_blob_type)) {
436 return *heap;
437 }
438 }
439 return NULL;
440 }
441
442 CodeBlob* CodeCache::first_blob(CodeHeap* heap) {
443 assert_locked_or_safepoint(CodeCache_lock);
444 assert(heap != NULL, "heap is null");
445 return (CodeBlob*)heap->first();
|