@@ -105,18 +105,28 @@ class CodeBlob_sizes {
105105 bool is_empty () const { return count == 0 ; }
106106
107107 void print (const char * title) const {
108- tty->print_cr (" #%d %s = %dK (hdr %dK, loc %dK, code %dK, stub %dK, [oops %dK, metadata %dK, data %dK, pcs %dK])" ,
109- count,
110- title,
111- (int )(total () / K),
112- (int )(header_size / K),
113- (int )(relocation_size / K),
114- (int )(code_size / K),
115- (int )(stub_size / K),
116- (int )(scopes_oop_size / K),
117- (int )(scopes_metadata_size / K),
118- (int )(scopes_data_size / K),
119- (int )(scopes_pcs_size / K));
108+ if (is_empty ())
109+ {
110+ tty->print_cr (" #%d %s = %dK" ,
111+ count,
112+ title,
113+ (int )(total () / K));
114+ }
115+ else
116+ {
117+ tty->print_cr (" #%d %s = %dK (hdr %dK, loc %dK, code %dK, stub %dK, [oops %dK, metadata %dK, data %dK, pcs %dK])" ,
118+ count,
119+ title,
120+ (int )(total () / K),
121+ (int )(header_size / K),
122+ (int )(relocation_size / K),
123+ (int )(code_size / K),
124+ (int )(stub_size / K),
125+ (int )(scopes_oop_size / K),
126+ (int )(scopes_metadata_size / K),
127+ (int )(scopes_data_size / K),
128+ (int )(scopes_pcs_size / K));
129+ }
120130 }
121131
122132 void add (CodeBlob* cb) {
@@ -1430,25 +1440,24 @@ void CodeCache::print() {
14301440#ifndef PRODUCT
14311441 if (!Verbose) return ;
14321442
1433- static_assert (0 < CompLevel_simple && CompLevel_simple <= CompLevel_full_optimization, " tier range check" );
1434- CodeBlob_sizes live[CompLevel_full_optimization];
1435- CodeBlob_sizes dead[CompLevel_full_optimization];
1443+ CodeBlob_sizes live[CompLevel_full_optimization + 1 ];
1444+ CodeBlob_sizes dead[CompLevel_full_optimization + 1 ];
14361445 CodeBlob_sizes runtimeStub;
14371446 CodeBlob_sizes uncommonTrapStub;
14381447 CodeBlob_sizes deoptimizationStub;
14391448 CodeBlob_sizes adapter;
14401449 CodeBlob_sizes bufferBlob;
1450+ CodeBlob_sizes other;
14411451
14421452 FOR_ALL_ALLOCABLE_HEAPS (heap) {
14431453 FOR_ALL_BLOBS (cb, *heap) {
14441454 if (cb->is_nmethod ()) {
1445- const int level = cb->as_nmethod_or_null ()->comp_level ();
1446- if (CompLevel_simple <= level && level <= CompLevel_full_optimization) {
1447- if (!cb->is_alive ()) {
1448- dead[level - 1 ].add (cb);
1449- } else {
1450- live[level - 1 ].add (cb);
1451- }
1455+ const int level = cb->as_nmethod ()->comp_level ();
1456+ assert (0 <= level && level <= CompLevel_full_optimization, " Invalid compilation level" );
1457+ if (!cb->is_alive ()) {
1458+ dead[level].add (cb);
1459+ } else {
1460+ live[level].add (cb);
14521461 }
14531462 } else if (cb->is_runtime_stub ()) {
14541463 runtimeStub.add (cb);
@@ -1460,36 +1469,33 @@ void CodeCache::print() {
14601469 adapter.add (cb);
14611470 } else if (cb->is_buffer_blob ()) {
14621471 bufferBlob.add (cb);
1472+ } else {
1473+ other.add (cb);
14631474 }
14641475 }
14651476 }
14661477
14671478 tty->print_cr (" nmethod dependency checking time %fs" , dependentCheckTime.seconds ());
1468- for (int i = CompLevel_simple ; i <= CompLevel_full_optimization; i++) {
1479+ for (int i = 0 ; i <= CompLevel_full_optimization; i++) {
14691480 tty->print_cr (" Tier %d:" , i);
1470- if (!live[i - 1 ].is_empty ()) {
1471- live[i - 1 ].print (" live" );
1472- }
1473- if (!dead[i - 1 ].is_empty ()) {
1474- dead[i - 1 ].print (" dead" );
1475- }
1481+ live[i].print (" live" );
1482+ dead[i].print (" dead" );
14761483 }
14771484
14781485 struct {
14791486 const char *name;
14801487 const CodeBlob_sizes *sizes;
14811488 } stubs[] = {
1482- { " runtime" , &runtimeStub },
1483- { " uncommon trap" , &uncommonTrapStub },
1489+ { " runtime" , &runtimeStub },
1490+ { " uncommon trap" , &uncommonTrapStub },
14841491 { " deoptimization" , &deoptimizationStub },
1485- { " adapter" , &adapter },
1486- { " buffer blob" , &bufferBlob },
1492+ { " adapter" , &adapter },
1493+ { " buffer blob" , &bufferBlob },
1494+ { " other" , &other },
14871495 };
14881496 tty->print_cr (" Stubs:" );
14891497 for (auto &stub: stubs) {
1490- if (!stub.sizes ->is_empty ()) {
1491- stub.sizes ->print (stub.name );
1492- }
1498+ stub.sizes ->print (stub.name );
14931499 }
14941500
14951501 if (WizardMode) {
0 commit comments