mirror of
https://github.com/openjdk/jdk.git
synced 2026-06-08 03:25:05 +00:00
8381932: Publish stubgen entries when -XX:-AOTStubCaching configured
Reviewed-by: asmehra, kvn
This commit is contained in:
parent
aa5677afcb
commit
322f3a3447
@ -1862,11 +1862,8 @@ void AOTCodeReader::read_dbg_strings(DbgStrings& dbg_strings) {
|
||||
// addresses, respectively, keyed by the relevant address
|
||||
|
||||
void AOTCodeAddressTable::hash_address(address addr, int idx) {
|
||||
// only do this if we are caching stubs and we have a non-null
|
||||
// address to record
|
||||
if (!AOTStubCaching) {
|
||||
return;
|
||||
}
|
||||
// only do this if we have a non-null address to record and the
|
||||
// cache is open for dumping
|
||||
if (addr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -2515,10 +2512,11 @@ AOTStubData::AOTStubData(BlobId blob_id) :
|
||||
// cannot be accessed before initialising the universe
|
||||
if (blob_id == BlobId::stubgen_preuniverse_id) {
|
||||
// invalidate any attempt to use this
|
||||
_flags |= INVALID;
|
||||
_flags = INVALID;
|
||||
return;
|
||||
}
|
||||
if (AOTCodeCache::is_on()) {
|
||||
_flags = OPEN;
|
||||
// allow update of stub entry addresses
|
||||
if (AOTCodeCache::is_using_stub()) {
|
||||
// allow stub loading
|
||||
|
||||
@ -236,9 +236,10 @@ private:
|
||||
// whether we are loading or storing stubs or have encountered any
|
||||
// invalid stubs.
|
||||
enum Flags {
|
||||
USING = 1 << 0, // open and loading stubs
|
||||
DUMPING = 1 << 1, // open and storing stubs
|
||||
INVALID = 1 << 2, // found invalid stub when loading
|
||||
OPEN = 1 << 0, // cache is open
|
||||
USING = 1 << 1, // open and loading stubs
|
||||
DUMPING = 1 << 2, // open and storing stubs
|
||||
INVALID = 1 << 3, // found invalid stub when loading
|
||||
};
|
||||
|
||||
uint32_t _flags;
|
||||
@ -253,6 +254,7 @@ public:
|
||||
|
||||
~AOTStubData() CDS_ONLY({FREE_C_HEAP_ARRAY(StubAddrRange, _ranges);}) NOT_CDS({})
|
||||
|
||||
bool is_open() CDS_ONLY({ return (_flags & OPEN) != 0; }) NOT_CDS_RETURN_(false);
|
||||
bool is_using() CDS_ONLY({ return (_flags & USING) != 0; }) NOT_CDS_RETURN_(false);
|
||||
bool is_dumping() CDS_ONLY({ return (_flags & DUMPING) != 0; }) NOT_CDS_RETURN_(false);
|
||||
bool is_invalid() CDS_ONLY({ return (_flags & INVALID) != 0; }) NOT_CDS_RETURN_(false);
|
||||
|
||||
@ -178,18 +178,23 @@ static BufferBlob* initialize_stubs(BlobId blob_id,
|
||||
AOTStubData* stub_data_p = nullptr;
|
||||
LogTarget(Info, stubs) lt;
|
||||
|
||||
// we need to track and publish details of stubs in a stubgen blob
|
||||
// when we are 1) using stubs from the cache 2) dumping stubs to the
|
||||
// cache 3) generating stubs that may be needed by other cache
|
||||
// elements.
|
||||
|
||||
if (stub_data.is_open()) {
|
||||
stub_data_p = &stub_data;
|
||||
}
|
||||
if (code_size > 0 && stub_data.is_using()) {
|
||||
// AOTCodeEntry tracks and logs status of any cached blob
|
||||
bool loaded = stub_data.load_code_blob();
|
||||
if (loaded) {
|
||||
// try to load the blob and details of its stubs from cache. if
|
||||
// that fails we will still generate all necessary stubs
|
||||
if (stub_data.load_code_blob()) {
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print_cr("Found blob %s in AOT cache", StubInfo::name(blob_id));
|
||||
}
|
||||
stub_data_p = &stub_data;
|
||||
}
|
||||
} else if (stub_data.is_dumping()) {
|
||||
stub_data_p = &stub_data;
|
||||
}
|
||||
|
||||
// Even if we managed to load a blob from the AOT cache we still
|
||||
@ -236,17 +241,8 @@ static BufferBlob* initialize_stubs(BlobId blob_id,
|
||||
"increase %s, code_size: %d, used: %d, free: %d",
|
||||
assert_msg, code_size, buffer.total_content_size(), buffer.insts_remaining());
|
||||
|
||||
if (stub_data.is_using()) {
|
||||
// we generated some new entries so republish all entries TODO -
|
||||
// ensure we publish collect and publish the preuniverse stubs but
|
||||
// don't try to save them
|
||||
AOTCodeCache::publish_stub_addresses(*stubs_code, blob_id, &stub_data);
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print_cr("Republished entries for blob '%s'", buffer_name);
|
||||
}
|
||||
} else if (stub_data.is_dumping()) {
|
||||
// save the blob and publihs the entry addresses
|
||||
if (stub_data.is_dumping()) {
|
||||
// save the blob and publish the entry addresses
|
||||
if (stub_data.store_code_blob(*stubs_code, &buffer)) {
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
@ -258,6 +254,17 @@ static BufferBlob* initialize_stubs(BlobId blob_id,
|
||||
ls.print_cr("Failed to store blob '%s' to Startup Code Cache", buffer_name);
|
||||
}
|
||||
}
|
||||
} else if (stub_data.is_open()) {
|
||||
// we either loaded some entries or generated new entries so
|
||||
// publish all entries
|
||||
//
|
||||
// TODO - ensure we publish collect and publish the preuniverse
|
||||
// stubs but don't try to save them
|
||||
AOTCodeCache::publish_stub_addresses(*stubs_code, blob_id, &stub_data);
|
||||
if (lt.is_enabled()) {
|
||||
LogStream ls(lt);
|
||||
ls.print_cr("Republished entries for blob '%s'", buffer_name);
|
||||
}
|
||||
}
|
||||
|
||||
// close off recording of any further stubgen generation
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user