@@ -55,6 +55,8 @@ class OopMapCacheEntry: private InterpreterOopMap {
55
55
// Deallocate bit masks and initialize fields
56
56
void flush ();
57
57
58
+ static void deallocate (OopMapCacheEntry* const entry);
59
+
58
60
private:
59
61
void allocate_bit_mask (); // allocates the bit mask on C heap f necessary
60
62
void deallocate_bit_mask (); // allocates the bit mask on C heap f necessary
@@ -401,6 +403,10 @@ void OopMapCacheEntry::flush() {
401
403
initialize ();
402
404
}
403
405
406
+ void OopMapCacheEntry::deallocate (OopMapCacheEntry* const entry) {
407
+ entry->flush ();
408
+ FREE_C_HEAP_OBJ (entry);
409
+ }
404
410
405
411
// Implementation of OopMapCache
406
412
@@ -476,8 +482,7 @@ void OopMapCache::flush() {
476
482
OopMapCacheEntry* entry = _array[i];
477
483
if (entry != nullptr ) {
478
484
_array[i] = nullptr ; // no barrier, only called in OopMapCache destructor
479
- entry->flush ();
480
- FREE_C_HEAP_OBJ (entry);
485
+ OopMapCacheEntry::deallocate (entry);
481
486
}
482
487
}
483
488
}
@@ -496,8 +501,7 @@ void OopMapCache::flush_obsolete_entries() {
496
501
entry->method ()->name ()->as_C_string (), entry->method ()->signature ()->as_C_string (), i);
497
502
}
498
503
_array[i] = nullptr ;
499
- entry->flush ();
500
- FREE_C_HEAP_OBJ (entry);
504
+ OopMapCacheEntry::deallocate (entry);
501
505
}
502
506
}
503
507
}
@@ -544,8 +548,7 @@ void OopMapCache::lookup(const methodHandle& method,
544
548
// at this time. We give the caller of lookup() a copy of the
545
549
// interesting info via parameter entry_for, but we don't add it to
546
550
// the cache. See the gory details in Method*.cpp.
547
- tmp->flush ();
548
- FREE_C_HEAP_OBJ (tmp);
551
+ OopMapCacheEntry::deallocate (tmp);
549
552
return ;
550
553
}
551
554
@@ -568,7 +571,7 @@ void OopMapCache::lookup(const methodHandle& method,
568
571
if (put_at (probe + 0 , tmp, old)) {
569
572
enqueue_for_cleanup (old);
570
573
} else {
571
- enqueue_for_cleanup (tmp);
574
+ OopMapCacheEntry::deallocate (tmp);
572
575
}
573
576
574
577
assert (!entry_for->is_empty (), " A non-empty oop map should be returned" );
@@ -603,8 +606,7 @@ void OopMapCache::cleanup_old_entries() {
603
606
entry->method ()->name_and_sig_as_C_string (), entry->bci ());
604
607
}
605
608
OopMapCacheEntry* next = entry->_next ;
606
- entry->flush ();
607
- FREE_C_HEAP_OBJ (entry);
609
+ OopMapCacheEntry::deallocate (entry);
608
610
entry = next;
609
611
}
610
612
}
@@ -617,6 +619,5 @@ void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, Inter
617
619
if (tmp->has_valid_mask ()) {
618
620
entry->resource_copy (tmp);
619
621
}
620
- tmp->flush ();
621
- FREE_C_HEAP_OBJ (tmp);
622
+ OopMapCacheEntry::deallocate (tmp);
622
623
}
0 commit comments