mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8144024: Octane fails with "memory leak: allocating handle outside HandleMark"
Reviewed-by: kvn
This commit is contained in:
parent
d4170d0bba
commit
419a331a48
2 changed files with 8 additions and 16 deletions
|
@ -3220,12 +3220,7 @@ void java_lang_invoke_MethodHandleNatives_CallSiteContext::compute_offsets() {
|
||||||
DependencyContext java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(oop call_site) {
|
DependencyContext java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(oop call_site) {
|
||||||
assert(java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(call_site), "");
|
assert(java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(call_site), "");
|
||||||
intptr_t* vmdeps_addr = (intptr_t*)call_site->address_field_addr(_vmdependencies_offset);
|
intptr_t* vmdeps_addr = (intptr_t*)call_site->address_field_addr(_vmdependencies_offset);
|
||||||
#ifndef ASSERT
|
|
||||||
DependencyContext dep_ctx(vmdeps_addr);
|
DependencyContext dep_ctx(vmdeps_addr);
|
||||||
#else
|
|
||||||
// Verify that call_site isn't moved during DependencyContext lifetime.
|
|
||||||
DependencyContext dep_ctx(vmdeps_addr, Handle(call_site));
|
|
||||||
#endif // ASSERT
|
|
||||||
return dep_ctx;
|
return dep_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,19 +114,16 @@ class DependencyContext : public StackObj {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// Verification for dependency contexts rooted at Java objects.
|
// Safepoints are forbidden during DC lifetime. GC can invalidate
|
||||||
Handle _base; // non-NULL if dependency context resides in an oop (e.g. CallSite).
|
// _dependency_context_addr if it relocates the holder
|
||||||
oop _base_oop;
|
// (e.g. CallSiteContext Java object).
|
||||||
|
int _safepoint_counter;
|
||||||
|
|
||||||
DependencyContext(intptr_t* addr, Handle base = Handle())
|
DependencyContext(intptr_t* addr) : _dependency_context_addr(addr),
|
||||||
: _dependency_context_addr(addr), _base(base)
|
_safepoint_counter(SafepointSynchronize::_safepoint_counter) {}
|
||||||
{
|
|
||||||
_base_oop = _base();
|
|
||||||
}
|
|
||||||
|
|
||||||
~DependencyContext() {
|
~DependencyContext() {
|
||||||
// Base oop relocation invalidates _dependency_context_addr.
|
assert(_safepoint_counter == SafepointSynchronize::_safepoint_counter, "safepoint happened");
|
||||||
assert(_base_oop == _base(), "base oop relocation is forbidden");
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DependencyContext(intptr_t* addr) : _dependency_context_addr(addr) {}
|
DependencyContext(intptr_t* addr) : _dependency_context_addr(addr) {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue