@@ -53,6 +53,8 @@ class OopMapCacheEntry: private InterpreterOopMap {
53
53
// Deallocate bit masks and initialize fields
54
54
void flush ();
55
55
56
+ static void deallocate (OopMapCacheEntry* const entry);
57
+
56
58
private:
57
59
void allocate_bit_mask (); // allocates the bit mask on C heap f necessary
58
60
void deallocate_bit_mask (); // allocates the bit mask on C heap f necessary
@@ -399,6 +401,10 @@ void OopMapCacheEntry::flush() {
399
401
initialize ();
400
402
}
401
403
404
+ void OopMapCacheEntry::deallocate (OopMapCacheEntry* const entry) {
405
+ entry->flush ();
406
+ FREE_C_HEAP_OBJ (entry);
407
+ }
402
408
403
409
// Implementation of OopMapCache
404
410
@@ -472,8 +478,7 @@ void OopMapCache::flush() {
472
478
OopMapCacheEntry* entry = _array[i];
473
479
if (entry != nullptr ) {
474
480
_array[i] = nullptr ; // no barrier, only called in OopMapCache destructor
475
- entry->flush ();
476
- FREE_C_HEAP_OBJ (entry);
481
+ OopMapCacheEntry::deallocate (entry);
477
482
}
478
483
}
479
484
}
@@ -492,8 +497,7 @@ void OopMapCache::flush_obsolete_entries() {
492
497
entry->method ()->name ()->as_C_string (), entry->method ()->signature ()->as_C_string (), i);
493
498
}
494
499
_array[i] = nullptr ;
495
- entry->flush ();
496
- FREE_C_HEAP_OBJ (entry);
500
+ OopMapCacheEntry::deallocate (entry);
497
501
}
498
502
}
499
503
}
@@ -540,8 +544,7 @@ void OopMapCache::lookup(const methodHandle& method,
540
544
// at this time. We give the caller of lookup() a copy of the
541
545
// interesting info via parameter entry_for, but we don't add it to
542
546
// the cache. See the gory details in Method*.cpp.
543
- tmp->flush ();
544
- FREE_C_HEAP_OBJ (tmp);
547
+ OopMapCacheEntry::deallocate (tmp);
545
548
return ;
546
549
}
547
550
@@ -564,7 +567,7 @@ void OopMapCache::lookup(const methodHandle& method,
564
567
if (put_at (probe + 0 , tmp, old)) {
565
568
enqueue_for_cleanup (old);
566
569
} else {
567
- enqueue_for_cleanup (tmp);
570
+ OopMapCacheEntry::deallocate (tmp);
568
571
}
569
572
570
573
assert (!entry_for->is_empty (), " A non-empty oop map should be returned" );
@@ -599,8 +602,7 @@ void OopMapCache::cleanup_old_entries() {
599
602
entry->method ()->name_and_sig_as_C_string (), entry->bci ());
600
603
}
601
604
OopMapCacheEntry* next = entry->_next ;
602
- entry->flush ();
603
- FREE_C_HEAP_OBJ (entry);
605
+ OopMapCacheEntry::deallocate (entry);
604
606
entry = next;
605
607
}
606
608
}
@@ -611,6 +613,5 @@ void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, Inter
611
613
tmp->initialize ();
612
614
tmp->fill (method, bci);
613
615
entry->resource_copy (tmp);
614
- tmp->flush ();
615
- FREE_C_HEAP_OBJ (tmp);
616
+ OopMapCacheEntry::deallocate (tmp);
616
617
}
0 commit comments