mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8256106: Bypass intrinsic/barrier when calling Reference.get() from Finalizer
Reviewed-by: eosterlund
This commit is contained in:
parent
3c3469b9ce
commit
96e0261041
2 changed files with 15 additions and 1 deletions
|
@ -82,7 +82,7 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
|
|||
}
|
||||
|
||||
try {
|
||||
Object finalizee = this.get();
|
||||
Object finalizee = this.getInactive();
|
||||
if (finalizee != null && !(finalizee instanceof java.lang.Enum)) {
|
||||
jla.invokeFinalize(finalizee);
|
||||
|
||||
|
|
|
@ -342,6 +342,20 @@ public abstract class Reference<T> {
|
|||
return this.referent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load referent with strong semantics. Treating the referent
|
||||
* as strong referent is ok when the Reference is inactive,
|
||||
* because then the referent is switched to strong semantics
|
||||
* anyway.
|
||||
*
|
||||
* This is only used from Finalizer to bypass the intrinsic,
|
||||
* which might return a null referent, even though it is not
|
||||
* null, and would subsequently not finalize the referent/finalizee.
|
||||
*/
|
||||
T getInactive() {
|
||||
return this.referent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the referent of this reference object is {@code obj}.
|
||||
* Using a {@code null} {@code obj} returns {@code true} if the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue