< prev index next > src/hotspot/share/cds/aotStreamedHeapWriter.cpp
Print this page
/*
- * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
if ((roots_length % 2) != 0) {
write(-1); // Align up to a 64 bit word
}
}
- static bool is_interned_string(oop obj) {
- if (!java_lang_String::is_instance(obj)) {
- return false;
- }
-
- ResourceMark rm;
- int len;
- jchar* name = java_lang_String::as_unicode_string_or_null(obj, len);
- if (name == nullptr) {
- fatal("Insufficient memory for dumping");
- }
- return StringTable::lookup(name, len) == obj;
- }
-
static BitMap::idx_t bit_idx_for_buffer_offset(size_t buffer_offset) {
if (UseCompressedOops) {
return BitMap::idx_t(buffer_offset / sizeof(narrowOop));
} else {
return BitMap::idx_t(buffer_offset / sizeof(HeapWord));
}
}
- bool AOTStreamedHeapWriter::is_dumped_interned_string(oop obj) {
- return is_interned_string(obj) && HeapShared::get_cached_oop_info(obj) != nullptr;
- }
-
void AOTStreamedHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeap<oop, mtClassShared>* roots) {
for (int i = 0; i < _source_objs->length(); i++) {
oop src_obj = _source_objs->at(i);
HeapShared::CachedOopInfo* info = HeapShared::get_cached_oop_info(src_obj);
assert(info != nullptr, "must be");
size_t new_used = _buffer_used + byte_size;
assert(new_used > _buffer_used, "no wrap around");
ensure_buffer_space(new_used);
- if (is_interned_string(src_obj)) {
+ if (HeapShared::is_interned_string(src_obj)) {
java_lang_String::hash_code(src_obj); // Sets the hash code field(s)
java_lang_String::set_deduplication_forbidden(src_obj); // Allows faster interning at runtime
assert(java_lang_String::hash_is_set(src_obj), "hash must be set");
}
if (src_obj != nullptr) {
intptr_t src_hash = src_obj->identity_hash();
mw = mw.copy_set_hash(src_hash);
}
- if (is_interned_string(src_obj)) {
+ if (HeapShared::is_interned_string(src_obj)) {
// Mark the mark word of interned string so the loader knows to link these to
// the string table at runtime.
mw = mw.set_marked();
}
< prev index next >