8317240
: Promptly free OopMapEntry after fail to insert the entry to OopMapCache
Reviewed-by: coleenp, fparain
This commit is contained in:
parent
4c5b66dcea
commit
a8eacb31ab
@ -55,6 +55,8 @@ class OopMapCacheEntry: private InterpreterOopMap {
|
|||||||
// Deallocate bit masks and initialize fields
|
// Deallocate bit masks and initialize fields
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
static void deallocate(OopMapCacheEntry* const entry);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void allocate_bit_mask(); // allocates the bit mask on C heap f necessary
|
void allocate_bit_mask(); // allocates the bit mask on C heap f necessary
|
||||||
void deallocate_bit_mask(); // allocates the bit mask on C heap f necessary
|
void deallocate_bit_mask(); // allocates the bit mask on C heap f necessary
|
||||||
@ -401,6 +403,10 @@ void OopMapCacheEntry::flush() {
|
|||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OopMapCacheEntry::deallocate(OopMapCacheEntry* const entry) {
|
||||||
|
entry->flush();
|
||||||
|
FREE_C_HEAP_OBJ(entry);
|
||||||
|
}
|
||||||
|
|
||||||
// Implementation of OopMapCache
|
// Implementation of OopMapCache
|
||||||
|
|
||||||
@ -476,8 +482,7 @@ void OopMapCache::flush() {
|
|||||||
OopMapCacheEntry* entry = _array[i];
|
OopMapCacheEntry* entry = _array[i];
|
||||||
if (entry != nullptr) {
|
if (entry != nullptr) {
|
||||||
_array[i] = nullptr; // no barrier, only called in OopMapCache destructor
|
_array[i] = nullptr; // no barrier, only called in OopMapCache destructor
|
||||||
entry->flush();
|
OopMapCacheEntry::deallocate(entry);
|
||||||
FREE_C_HEAP_OBJ(entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -496,8 +501,7 @@ void OopMapCache::flush_obsolete_entries() {
|
|||||||
entry->method()->name()->as_C_string(), entry->method()->signature()->as_C_string(), i);
|
entry->method()->name()->as_C_string(), entry->method()->signature()->as_C_string(), i);
|
||||||
}
|
}
|
||||||
_array[i] = nullptr;
|
_array[i] = nullptr;
|
||||||
entry->flush();
|
OopMapCacheEntry::deallocate(entry);
|
||||||
FREE_C_HEAP_OBJ(entry);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -544,8 +548,7 @@ void OopMapCache::lookup(const methodHandle& method,
|
|||||||
// at this time. We give the caller of lookup() a copy of the
|
// at this time. We give the caller of lookup() a copy of the
|
||||||
// interesting info via parameter entry_for, but we don't add it to
|
// interesting info via parameter entry_for, but we don't add it to
|
||||||
// the cache. See the gory details in Method*.cpp.
|
// the cache. See the gory details in Method*.cpp.
|
||||||
tmp->flush();
|
OopMapCacheEntry::deallocate(tmp);
|
||||||
FREE_C_HEAP_OBJ(tmp);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +571,7 @@ void OopMapCache::lookup(const methodHandle& method,
|
|||||||
if (put_at(probe + 0, tmp, old)) {
|
if (put_at(probe + 0, tmp, old)) {
|
||||||
enqueue_for_cleanup(old);
|
enqueue_for_cleanup(old);
|
||||||
} else {
|
} else {
|
||||||
enqueue_for_cleanup(tmp);
|
OopMapCacheEntry::deallocate(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!entry_for->is_empty(), "A non-empty oop map should be returned");
|
assert(!entry_for->is_empty(), "A non-empty oop map should be returned");
|
||||||
@ -603,8 +606,7 @@ void OopMapCache::cleanup_old_entries() {
|
|||||||
entry->method()->name_and_sig_as_C_string(), entry->bci());
|
entry->method()->name_and_sig_as_C_string(), entry->bci());
|
||||||
}
|
}
|
||||||
OopMapCacheEntry* next = entry->_next;
|
OopMapCacheEntry* next = entry->_next;
|
||||||
entry->flush();
|
OopMapCacheEntry::deallocate(entry);
|
||||||
FREE_C_HEAP_OBJ(entry);
|
|
||||||
entry = next;
|
entry = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -617,6 +619,5 @@ void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, Inter
|
|||||||
if (tmp->has_valid_mask()) {
|
if (tmp->has_valid_mask()) {
|
||||||
entry->resource_copy(tmp);
|
entry->resource_copy(tmp);
|
||||||
}
|
}
|
||||||
tmp->flush();
|
OopMapCacheEntry::deallocate(tmp);
|
||||||
FREE_C_HEAP_OBJ(tmp);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user