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(),
422 "Code blob " INTPTR_FORMAT " should be after heap low boundary " INTPTR_FORMAT,
423 p2i(cb), p2i((*heap)->low_boundary()));
424 return *heap;
425 }
426 }
427 ShouldNotReachHere();
428 return NULL;
429 }
430
431 CodeHeap* CodeCache::get_code_heap(int code_blob_type) {
432 FOR_ALL_HEAPS(heap) {
433 if ((*heap)->accepts(code_blob_type)) {
434 return *heap;
435 }
436 }
437 return NULL;
438 }
439
440 CodeBlob* CodeCache::first_blob(CodeHeap* heap) {
441 assert_locked_or_safepoint(CodeCache_lock);
442 assert(heap != NULL, "heap is null");
443 return (CodeBlob*)heap->first();
|