Skip to content

Commit 3d74cbe

Browse files
committed
8361844: Build without C1 or C2 fails after 8360707
Reviewed-by: kvn
1 parent f5afbbd commit 3d74cbe

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

src/hotspot/share/runtime/stubInfo.cpp

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,33 @@ int StubInfo::span(EntryId second, EntryId first) {
156156
}
157157

158158
int StubInfo::span(StubId second, StubId first) {
159+
// normally when the two ids are equal the entry span is 1 but we
160+
// have a special case when the base and max are both NO_STUBID in
161+
// which case the entry count is 0. n.b. that only happens in the
162+
// case where a stub group is empty e.g. when either C1 or C2 is
163+
// omitted from the build
159164
int idx1 = static_cast<int>(first);
160165
int idx2 = static_cast<int>(second);
161-
assert(idx2 >= 0 && idx2 >= idx1, "bad stub ids first %d and second %d", idx1, idx2);
166+
assert((idx1 < 0 && idx2 < 0) || (idx1 >= 0 && idx2 >= idx1), "bad stub ids first %d and second %d", idx1, idx2);
167+
if (idx1 < 0) {
168+
return 0;
169+
}
162170
// span is inclusive of first and second
163171
return idx2 + 1 - idx1;
164172
}
165173

166174
int StubInfo::span(BlobId second, BlobId first) {
175+
// normally when the two ids are equal the entry span is 1 but we
176+
// have a special case when the base and max are both NO_BLOBID in
177+
// which case the entry count is 0. n.b. that only happens in the
178+
// case where a stub group is empty e.g. when either C1 or C2 is
179+
// omitted from the build
167180
int idx1 = static_cast<int>(first);
168181
int idx2 = static_cast<int>(second);
169-
assert(idx2 >= 0 && idx2 >= idx1, "bad blob ids first %d and second %d", idx1, idx2);
182+
assert((idx1 < 0 && idx2 < 0) || (idx1 >= 0 && idx2 >= idx1), "bad blob ids first %d and second %d", idx1, idx2);
183+
if (idx1 < 0) {
184+
return 0;
185+
}
170186
// span is inclusive of first and second
171187
return idx2 + 1 - idx1;
172188
}
@@ -777,9 +793,16 @@ void StubInfo::dump_group_table(LogStream& ls) {
777793
GroupDetails& g = _group_table[i];
778794
ls.print_cr("%1d: %-8s", i, g._name);
779795
if (g._base == g._max) {
780-
ls.print_cr(" blobs: %s(%d)",
781-
blob_details(g._base)._name,
782-
static_cast<int>(g._base));
796+
// some groups don't have a blob
797+
if (g._base == BlobId::NO_BLOBID) {
798+
ls.print_cr(" blobs: %s(%d)",
799+
"no_blobs",
800+
static_cast<int>(g._base));
801+
} else {
802+
ls.print_cr(" blobs: %s(%d)",
803+
blob_details(g._base)._name,
804+
static_cast<int>(g._base));
805+
}
783806
} else {
784807
ls.print_cr(" blobs: %s(%d) ... %s(%d)",
785808
blob_details(g._base)._name,
@@ -796,9 +819,16 @@ void StubInfo::dump_blob_table(LogStream& ls) {
796819
BlobDetails& b = _blob_table[i];
797820
ls.print_cr("%-3d: %s", i, b._name);
798821
if (b._base == b._max) {
799-
ls.print_cr(" stubs: %s(%d)",
800-
stub_details(b._base)._name,
801-
static_cast<int>(b._base));
822+
// some blobs don't have a stub
823+
if (b._base == StubId::NO_STUBID) {
824+
ls.print_cr(" stubs: %s(%d)",
825+
"no_stubs",
826+
static_cast<int>(b._base));
827+
} else {
828+
ls.print_cr(" stubs: %s(%d)",
829+
stub_details(b._base)._name,
830+
static_cast<int>(b._base));
831+
}
802832
} else {
803833
ls.print_cr(" stubs: %s(%d) ... %s(%d)",
804834
stub_details(b._base)._name,
@@ -905,13 +935,13 @@ int StubInfo::blob_count(StubGroup stub_group) {
905935
}
906936

907937
StubId StubInfo::stub_base(StubGroup stub_group) {
908-
// delegate
909-
return stub_base(blob_base(stub_group));
938+
BlobId base = blob_base(stub_group);
939+
return (base == BlobId::NO_BLOBID ? StubId::NO_STUBID : stub_base(base));
910940
}
911941

912942
StubId StubInfo::stub_max(StubGroup stub_group) {
913-
// delegate
914-
return stub_max(blob_max(stub_group));
943+
BlobId base = blob_max(stub_group);
944+
return (base == BlobId::NO_BLOBID ? StubId::NO_STUBID : stub_max(base));
915945
}
916946

917947
int StubInfo::stub_count(StubGroup stub_group) {

0 commit comments

Comments
 (0)