diff --git a/src/hotspot/share/cds/cppVtables.cpp b/src/hotspot/share/cds/cppVtables.cpp index 64f50327798..7905b4d938b 100644 --- a/src/hotspot/share/cds/cppVtables.cpp +++ b/src/hotspot/share/cds/cppVtables.cpp @@ -66,9 +66,11 @@ // the virtual printing functions in AnyObj). using GrowableArray_ModuleEntry_ptr = GrowableArray; +using GrowableArray_SigEntry = GrowableArray; #define DEBUG_CPP_VTABLE_TYPES_DO(f) \ f(GrowableArray_ModuleEntry_ptr) \ + f(GrowableArray_SigEntry) \ #endif diff --git a/src/hotspot/share/memory/metaspaceClosureType.hpp b/src/hotspot/share/memory/metaspaceClosureType.hpp index adf6805521b..c2c1b500b82 100644 --- a/src/hotspot/share/memory/metaspaceClosureType.hpp +++ b/src/hotspot/share/memory/metaspaceClosureType.hpp @@ -34,6 +34,7 @@ f(GrowableArray) \ f(ModuleEntry) \ f(PackageEntry) \ + f(SigEntry) \ #define METASPACE_CLOSURE_TYPE_DECLARE(name) name ## Type, diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index 75495c1fb7f..36f7b89637b 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -3424,8 +3424,6 @@ void AdapterHandlerEntry::remove_unshareable_info() { #endif // ASSERT _adapter_blob = nullptr; _linked = false; - _sig_cc = nullptr; - _sig_cc_ro = nullptr; } class CopyAdapterTableToArchive : StackObj { @@ -3505,23 +3503,6 @@ void AdapterHandlerEntry::link() { log_warning(aot)("Failed to link AdapterHandlerEntry (fp=%s) to its code in the AOT code cache", _fingerprint->as_basic_args_string()); generate_code = true; } - - if (get_sig_cc() == nullptr) { - // Calling conventions have to be regenerated at runtime and are accessed through method adapters, - // which are archived in the AOT code cache. If the adapters are not regenerated, the - // calling conventions should be regenerated here. - CompiledEntrySignature ces; - ces.initialize_from_fingerprint(_fingerprint); - if (ces.has_scalarized_args()) { - // Save a C heap allocated version of the scalarized signature and store it in the adapter - GrowableArray* heap_sig = new (mtInternal) GrowableArray(ces.sig_cc()->length(), mtInternal); - heap_sig->appendAll(ces.sig_cc()); - set_sig_cc(heap_sig); - heap_sig = new (mtInternal) GrowableArray(ces.sig_cc_ro()->length(), mtInternal); - heap_sig->appendAll(ces.sig_cc_ro()); - set_sig_cc_ro(heap_sig); - } - } } else { generate_code = true; } @@ -3613,6 +3594,8 @@ void AdapterHandlerEntry::metaspace_pointers_do(MetaspaceClosure* it) { lsh.cr(); } it->push(&_fingerprint); + it->push(&_sig_cc); + it->push(&_sig_cc_ro); } AdapterHandlerEntry::~AdapterHandlerEntry() { @@ -4334,3 +4317,7 @@ JRT_BLOCK_ENTRY(void, SharedRuntime::store_inline_type_fields_to_buf(JavaThread* JRT_BLOCK_END; } JRT_END + +void SigEntry::metaspace_pointers_do(MetaspaceClosure* it) { + it->push(&_name); +} diff --git a/src/hotspot/share/runtime/sharedRuntime.hpp b/src/hotspot/share/runtime/sharedRuntime.hpp index 39de4047513..2b1919bd890 100644 --- a/src/hotspot/share/runtime/sharedRuntime.hpp +++ b/src/hotspot/share/runtime/sharedRuntime.hpp @@ -734,8 +734,8 @@ class AdapterHandlerEntry : public MetaspaceObj { static const char *_entry_names[]; // Support for scalarized inline type calling convention - const GrowableArray* _sig_cc; - const GrowableArray* _sig_cc_ro; + GrowableArray* _sig_cc; + GrowableArray* _sig_cc_ro; #ifdef ASSERT // Captures code and signature used to generate this adapter when @@ -850,16 +850,16 @@ class AdapterHandlerEntry : public MetaspaceObj { bool is_linked() const { return _linked; } // Support for scalarized inline type calling convention - void set_sig_cc(const GrowableArray* sig) { + void set_sig_cc(GrowableArray* sig) { assert(_sig_cc == nullptr, "Already initialized"); _sig_cc = sig; } - const GrowableArray* get_sig_cc() const { return _sig_cc; } - void set_sig_cc_ro(const GrowableArray* sig) { + GrowableArray* get_sig_cc() const { return _sig_cc; } + void set_sig_cc_ro(GrowableArray* sig) { assert(_sig_cc_ro == nullptr, "Already initialized"); _sig_cc_ro = sig; } - const GrowableArray* get_sig_cc_ro() const { return _sig_cc_ro; } + GrowableArray* get_sig_cc_ro() const { return _sig_cc_ro; } uint id() const { return _id; } AdapterFingerPrint* fingerprint() const { return _fingerprint; } diff --git a/src/hotspot/share/runtime/signature.hpp b/src/hotspot/share/runtime/signature.hpp index 20154c9e1f9..3975a288047 100644 --- a/src/hotspot/share/runtime/signature.hpp +++ b/src/hotspot/share/runtime/signature.hpp @@ -28,8 +28,11 @@ #include "classfile/symbolTable.hpp" #include "memory/allocation.hpp" +#include "memory/metaspaceClosureType.hpp" #include "oops/method.hpp" +class MetaspaceClosure; + // Static routines and parsing loops for processing field and method // descriptors. In the HotSpot sources we call them "signatures". // @@ -595,6 +598,11 @@ class SigEntry { static int fill_sig_bt(const GrowableArray* sig, BasicType* sig_bt); static TempNewSymbol create_symbol(const GrowableArray* sig); + void metaspace_pointers_do(MetaspaceClosure* it); + int size_in_heapwords() const { return (int)heap_word_size(sizeof(SigEntry)); } + MetaspaceClosureType type() const { return MetaspaceClosureType::SigEntryType; } + static bool is_read_only_by_default() { return true; } + void print_on(outputStream* st) const; };