@@ -2199,10 +2199,11 @@ class AdapterFingerPrint : public MetaspaceObj {
2199
2199
}
2200
2200
2201
2201
// Private construtor. Use allocate() to get an instance.
2202
- AdapterFingerPrint (int total_args_passed, BasicType* sig_bt) {
2202
+ AdapterFingerPrint (int total_args_passed, BasicType* sig_bt, int len ) {
2203
2203
int * data = data_pointer ();
2204
2204
// Pack the BasicTypes with 8 per int
2205
- _length = length (total_args_passed);
2205
+ assert (len == length (total_args_passed), " sanity" );
2206
+ _length = len;
2206
2207
int sig_index = 0 ;
2207
2208
for (int index = 0 ; index < _length; index++) {
2208
2209
int value = 0 ;
@@ -2217,16 +2218,15 @@ class AdapterFingerPrint : public MetaspaceObj {
2217
2218
2218
2219
// Call deallocate instead
2219
2220
~AdapterFingerPrint () {
2220
- FreeHeap ( this );
2221
+ ShouldNotCallThis ( );
2221
2222
}
2222
2223
2223
2224
static int length (int total_args) {
2224
2225
return (total_args + (_basic_types_per_int-1 )) / _basic_types_per_int;
2225
2226
}
2226
2227
2227
- static int compute_size (int total_args_passed, BasicType* sig_bt) {
2228
- int len = length (total_args_passed);
2229
- return sizeof (AdapterFingerPrint) + (len * sizeof (int ));
2228
+ static int compute_size_in_words (int len) {
2229
+ return (int )heap_word_size (sizeof (AdapterFingerPrint) + (len * sizeof (int )));
2230
2230
}
2231
2231
2232
2232
// Remap BasicTypes that are handled equivalently by the adapters.
@@ -2289,12 +2289,15 @@ class AdapterFingerPrint : public MetaspaceObj {
2289
2289
2290
2290
public:
2291
2291
static AdapterFingerPrint* allocate (int total_args_passed, BasicType* sig_bt) {
2292
- int size_in_bytes = compute_size (total_args_passed, sig_bt);
2293
- return new (size_in_bytes) AdapterFingerPrint (total_args_passed, sig_bt);
2292
+ int len = length (total_args_passed);
2293
+ int size_in_bytes = BytesPerWord * compute_size_in_words (len);
2294
+ AdapterFingerPrint* afp = new (size_in_bytes) AdapterFingerPrint (total_args_passed, sig_bt, len);
2295
+ assert ((afp->size () * BytesPerWord) == size_in_bytes, " should match" );
2296
+ return afp;
2294
2297
}
2295
2298
2296
2299
static void deallocate (AdapterFingerPrint* fp) {
2297
- fp-> ~AdapterFingerPrint ( );
2300
+ FreeHeap (fp );
2298
2301
}
2299
2302
2300
2303
int value (int index) {
@@ -2418,7 +2421,7 @@ class AdapterFingerPrint : public MetaspaceObj {
2418
2421
2419
2422
// methods required by virtue of being a MetaspaceObj
2420
2423
void metaspace_pointers_do (MetaspaceClosure* it) { return ; /* nothing to do here */ }
2421
- int size () const { return ( int ) heap_word_size ( sizeof (AdapterFingerPrint) + ( _length * sizeof ( int )) ); }
2424
+ int size () const { return compute_size_in_words ( _length); }
2422
2425
MetaspaceObj::Type type () const { return AdapterFingerPrintType; }
2423
2426
2424
2427
static bool equals (AdapterFingerPrint* const & fp1, AdapterFingerPrint* const & fp2) {
0 commit comments