8301995: Move invokedynamic resolution information out of ConstantPoolCacheEntry

Co-authored-by: Richard Reingruber <rrich@openjdk.org>
Co-authored-by: Dingli Zhang <dzhang@openjdk.org>
Co-authored-by: Gui Cao <gcao@openjdk.org>
Co-authored-by: Amit Kumar <amitkumar@openjdk.org>
Reviewed-by: coleenp, dnsimon, fparain, gcao, aph, fyang, amitkumar, lucy
This commit is contained in:
Matias Saavedra Silva 2023-03-28 19:50:38 +00:00
parent 50a995f03a
commit 3fbbfd1749
58 changed files with 1342 additions and 406 deletions

View file

@ -29,6 +29,7 @@
#include "memory/allocation.hpp"
#include "oops/array.hpp"
#include "oops/oopHandle.hpp"
#include "oops/resolvedIndyEntry.hpp"
#include "runtime/handles.hpp"
#include "utilities/align.hpp"
#include "utilities/constantTag.hpp"
@ -256,11 +257,6 @@ class ConstantPoolCacheEntry {
const CallInfo &call_info // Call link information
);
void set_dynamic_call(
const constantPoolHandle& cpool, // holding constant pool (required for locking)
const CallInfo &call_info // Call link information
);
// Common code for invokedynamic and MH invocations.
// The "appendix" is an optional call-site-specific parameter which is
@ -282,13 +278,6 @@ class ConstantPoolCacheEntry {
const CallInfo &call_info // Call link information
);
// Return TRUE if resolution failed and this thread got to record the failure
// status. Return FALSE if another thread succeeded or failed in resolving
// the method and recorded the success or failure before this thread had a
// chance to record its failure.
bool save_and_throw_indy_exc(const constantPoolHandle& cpool, int cpool_index,
int index, constantTag tag, TRAPS);
// invokedynamic and invokehandle call sites have an "appendix" item in the
// resolved references array.
Method* method_if_resolved(const constantPoolHandle& cpool) const;
@ -417,6 +406,8 @@ class ConstantPoolCache: public MetaspaceObj {
// RedefineClasses support
uint64_t _gc_epoch;
Array<ResolvedIndyEntry>* _resolved_indy_entries;
CDS_ONLY(Array<ConstantPoolCacheEntry>* _initial_entries;)
// Sizing
@ -425,18 +416,18 @@ class ConstantPoolCache: public MetaspaceObj {
// Constructor
ConstantPoolCache(int length,
const intStack& inverse_index_map,
const intStack& invokedynamic_inverse_index_map,
const intStack& invokedynamic_references_map);
const intStack& invokedynamic_references_map,
Array<ResolvedIndyEntry>* indy_info);
// Initialization
void initialize(const intArray& inverse_index_map,
const intArray& invokedynamic_inverse_index_map,
const intArray& invokedynamic_references_map);
public:
static ConstantPoolCache* allocate(ClassLoaderData* loader_data,
const intStack& cp_cache_map,
const intStack& invokedynamic_cp_cache_map,
const intStack& invokedynamic_references_map, TRAPS);
const intStack& invokedynamic_references_map,
const GrowableArray<ResolvedIndyEntry> indy_entries,
TRAPS);
int length() const { return _length; }
void metaspace_pointers_do(MetaspaceClosure* it);
@ -451,8 +442,18 @@ class ConstantPoolCache: public MetaspaceObj {
Array<u2>* reference_map() const { return _reference_map; }
void set_reference_map(Array<u2>* o) { _reference_map = o; }
Array<ResolvedIndyEntry>* resolved_indy_entries() { return _resolved_indy_entries; }
ResolvedIndyEntry* resolved_indy_entry_at(int index) const { return _resolved_indy_entries->adr_at(index); }
int resolved_indy_entries_length() const { return _resolved_indy_entries->length(); }
void print_resolved_indy_entries(outputStream* st) const {
for (int i = 0; i < _resolved_indy_entries->length(); i++) {
_resolved_indy_entries->at(i).print_on(st);
}
}
// Assembly code support
static int resolved_references_offset_in_bytes() { return offset_of(ConstantPoolCache, _resolved_references); }
static ByteSize invokedynamic_entries_offset() { return byte_offset_of(ConstantPoolCache, _resolved_indy_entries); }
#if INCLUDE_CDS
void remove_unshareable_info();
@ -512,6 +513,13 @@ class ConstantPoolCache: public MetaspaceObj {
void record_gc_epoch();
uint64_t gc_epoch() { return _gc_epoch; }
// Return TRUE if resolution failed and this thread got to record the failure
// status. Return FALSE if another thread succeeded or failed in resolving
// the method and recorded the success or failure before this thread had a
// chance to record its failure.
bool save_and_throw_indy_exc(const constantPoolHandle& cpool, int cpool_index, int index, constantTag tag, TRAPS);
oop set_dynamic_call(const CallInfo &call_info, int index);
// Printing
void print_on(outputStream* st) const;
void print_value_on(outputStream* st) const;