@@ -173,10 +173,10 @@ int CodeCache::Sweep::_compiled_method_iterators = 0;
173
173
bool CodeCache::Sweep::_pending_sweep = false ;
174
174
175
175
// Initialize arrays of CodeHeap subsets
176
- GrowableArray<CodeHeap*>* CodeCache::_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, mtCode);
177
- GrowableArray<CodeHeap*>* CodeCache::_compiled_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, mtCode);
178
- GrowableArray<CodeHeap*>* CodeCache::_nmethod_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, mtCode);
179
- GrowableArray<CodeHeap*>* CodeCache::_allocable_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (CodeBlobType::All, mtCode);
176
+ GrowableArray<CodeHeap*>* CodeCache::_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (static_cast < int >( CodeBlobType::All) , mtCode);
177
+ GrowableArray<CodeHeap*>* CodeCache::_compiled_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (static_cast < int >( CodeBlobType::All) , mtCode);
178
+ GrowableArray<CodeHeap*>* CodeCache::_nmethod_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (static_cast < int >( CodeBlobType::All) , mtCode);
179
+ GrowableArray<CodeHeap*>* CodeCache::_allocable_heaps = new (ResourceObj::C_HEAP, mtCode) GrowableArray<CodeHeap*> (static_cast < int >( CodeBlobType::All) , mtCode);
180
180
181
181
void CodeCache::check_heap_sizes (size_t non_nmethod_size, size_t profiled_size, size_t non_profiled_size, size_t cache_size, bool all_set) {
182
182
size_t total_size = non_nmethod_size + profiled_size + non_profiled_size;
@@ -370,7 +370,7 @@ ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size) {
370
370
}
371
371
372
372
// Heaps available for allocation
373
- bool CodeCache::heap_available (int code_blob_type) {
373
+ bool CodeCache::heap_available (CodeBlobType code_blob_type) {
374
374
if (!SegmentedCodeCache) {
375
375
// No segmentation: use a single code heap
376
376
return (code_blob_type == CodeBlobType::All);
@@ -387,7 +387,7 @@ bool CodeCache::heap_available(int code_blob_type) {
387
387
}
388
388
}
389
389
390
- const char * CodeCache::get_code_heap_flag_name (int code_blob_type) {
390
+ const char * CodeCache::get_code_heap_flag_name (CodeBlobType code_blob_type) {
391
391
switch (code_blob_type) {
392
392
case CodeBlobType::NonNMethod:
393
393
return " NonNMethodCodeHeapSize" ;
@@ -398,16 +398,17 @@ const char* CodeCache::get_code_heap_flag_name(int code_blob_type) {
398
398
case CodeBlobType::MethodProfiled:
399
399
return " ProfiledCodeHeapSize" ;
400
400
break ;
401
+ default :
402
+ ShouldNotReachHere ();
403
+ return NULL ;
401
404
}
402
- ShouldNotReachHere ();
403
- return NULL ;
404
405
}
405
406
406
407
int CodeCache::code_heap_compare (CodeHeap* const &lhs, CodeHeap* const &rhs) {
407
408
if (lhs->code_blob_type () == rhs->code_blob_type ()) {
408
409
return (lhs > rhs) ? 1 : ((lhs < rhs) ? -1 : 0 );
409
410
} else {
410
- return lhs->code_blob_type () - rhs->code_blob_type ();
411
+ return static_cast < int >( lhs->code_blob_type ()) - static_cast < int >( rhs->code_blob_type () );
411
412
}
412
413
}
413
414
@@ -416,7 +417,7 @@ void CodeCache::add_heap(CodeHeap* heap) {
416
417
417
418
_heaps->insert_sorted <code_heap_compare>(heap);
418
419
419
- int type = heap->code_blob_type ();
420
+ CodeBlobType type = heap->code_blob_type ();
420
421
if (code_blob_type_accepts_compiled (type)) {
421
422
_compiled_heaps->insert_sorted <code_heap_compare>(heap);
422
423
}
@@ -428,7 +429,7 @@ void CodeCache::add_heap(CodeHeap* heap) {
428
429
}
429
430
}
430
431
431
- void CodeCache::add_heap (ReservedSpace rs, const char * name, int code_blob_type) {
432
+ void CodeCache::add_heap (ReservedSpace rs, const char * name, CodeBlobType code_blob_type) {
432
433
// Check if heap is needed
433
434
if (!heap_available (code_blob_type)) {
434
435
return ;
@@ -470,7 +471,7 @@ CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
470
471
return NULL ;
471
472
}
472
473
473
- CodeHeap* CodeCache::get_code_heap (int code_blob_type) {
474
+ CodeHeap* CodeCache::get_code_heap (CodeBlobType code_blob_type) {
474
475
FOR_ALL_HEAPS (heap) {
475
476
if ((*heap)->accepts (code_blob_type)) {
476
477
return *heap;
@@ -519,7 +520,7 @@ CodeBlob* CodeCache::first_blob(CodeHeap* heap) {
519
520
return (CodeBlob*)heap->first ();
520
521
}
521
522
522
- CodeBlob* CodeCache::first_blob (int code_blob_type) {
523
+ CodeBlob* CodeCache::first_blob (CodeBlobType code_blob_type) {
523
524
if (heap_available (code_blob_type)) {
524
525
return first_blob (get_code_heap (code_blob_type));
525
526
} else {
@@ -540,7 +541,7 @@ CodeBlob* CodeCache::next_blob(CodeHeap* heap, CodeBlob* cb) {
540
541
* run the constructor for the CodeBlob subclass he is busy
541
542
* instantiating.
542
543
*/
543
- CodeBlob* CodeCache::allocate (int size, int code_blob_type, bool handle_alloc_failure, int orig_code_blob_type) {
544
+ CodeBlob* CodeCache::allocate (int size, CodeBlobType code_blob_type, bool handle_alloc_failure, CodeBlobType orig_code_blob_type) {
544
545
// Possibly wakes up the sweeper thread.
545
546
NMethodSweeper::report_allocation ();
546
547
assert_locked_or_safepoint (CodeCache_lock);
@@ -568,7 +569,7 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool handle_alloc_fa
568
569
// NonNMethod -> MethodNonProfiled -> MethodProfiled (-> MethodNonProfiled)
569
570
// Note that in the sweeper, we check the reverse_free_ratio of the code heap
570
571
// and force stack scanning if less than 10% of the entire code cache are free.
571
- int type = code_blob_type;
572
+ CodeBlobType type = code_blob_type;
572
573
switch (type) {
573
574
case CodeBlobType::NonNMethod:
574
575
type = CodeBlobType::MethodNonProfiled;
@@ -582,6 +583,8 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, bool handle_alloc_fa
582
583
type = CodeBlobType::MethodNonProfiled;
583
584
}
584
585
break ;
586
+ default :
587
+ break ;
585
588
}
586
589
if (type != code_blob_type && type != orig_code_blob_type && heap_available (type)) {
587
590
if (PrintCodeCacheExtension) {
@@ -873,7 +876,7 @@ void CodeCache::verify_oops() {
873
876
}
874
877
}
875
878
876
- int CodeCache::blob_count (int code_blob_type) {
879
+ int CodeCache::blob_count (CodeBlobType code_blob_type) {
877
880
CodeHeap* heap = get_code_heap (code_blob_type);
878
881
return (heap != NULL ) ? heap->blob_count () : 0 ;
879
882
}
@@ -886,7 +889,7 @@ int CodeCache::blob_count() {
886
889
return count;
887
890
}
888
891
889
- int CodeCache::nmethod_count (int code_blob_type) {
892
+ int CodeCache::nmethod_count (CodeBlobType code_blob_type) {
890
893
CodeHeap* heap = get_code_heap (code_blob_type);
891
894
return (heap != NULL ) ? heap->nmethod_count () : 0 ;
892
895
}
@@ -899,7 +902,7 @@ int CodeCache::nmethod_count() {
899
902
return count;
900
903
}
901
904
902
- int CodeCache::adapter_count (int code_blob_type) {
905
+ int CodeCache::adapter_count (CodeBlobType code_blob_type) {
903
906
CodeHeap* heap = get_code_heap (code_blob_type);
904
907
return (heap != NULL ) ? heap->adapter_count () : 0 ;
905
908
}
@@ -912,12 +915,12 @@ int CodeCache::adapter_count() {
912
915
return count;
913
916
}
914
917
915
- address CodeCache::low_bound (int code_blob_type) {
918
+ address CodeCache::low_bound (CodeBlobType code_blob_type) {
916
919
CodeHeap* heap = get_code_heap (code_blob_type);
917
920
return (heap != NULL ) ? (address)heap->low_boundary () : NULL ;
918
921
}
919
922
920
- address CodeCache::high_bound (int code_blob_type) {
923
+ address CodeCache::high_bound (CodeBlobType code_blob_type) {
921
924
CodeHeap* heap = get_code_heap (code_blob_type);
922
925
return (heap != NULL ) ? (address)heap->high_boundary () : NULL ;
923
926
}
@@ -930,7 +933,7 @@ size_t CodeCache::capacity() {
930
933
return cap;
931
934
}
932
935
933
- size_t CodeCache::unallocated_capacity (int code_blob_type) {
936
+ size_t CodeCache::unallocated_capacity (CodeBlobType code_blob_type) {
934
937
CodeHeap* heap = get_code_heap (code_blob_type);
935
938
return (heap != NULL ) ? heap->unallocated_capacity () : 0 ;
936
939
}
@@ -1305,7 +1308,7 @@ void CodeCache::verify() {
1305
1308
// A CodeHeap is full. Print out warning and report event.
1306
1309
PRAGMA_DIAG_PUSH
1307
1310
PRAGMA_FORMAT_NONLITERAL_IGNORED
1308
- void CodeCache::report_codemem_full (int code_blob_type, bool print) {
1311
+ void CodeCache::report_codemem_full (CodeBlobType code_blob_type, bool print) {
1309
1312
// Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
1310
1313
CodeHeap* heap = get_code_heap (code_blob_type);
1311
1314
assert (heap != NULL , " heap is null" );
0 commit comments