8256517: (ref) Reference.clear during reference processing may lose notification

8240696: (ref) Reference.clear may extend the lifetime of the referent

Use private native helper to implement Reference.clear.

Reviewed-by: pliden, rkennke, mchung
This commit is contained in:
Kim Barrett 2020-11-25 03:34:50 +00:00
parent 3c230b8ac5
commit 66943fefa7
14 changed files with 295 additions and 31 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,7 +82,7 @@ final class Finalizer extends FinalReference<Object> { /* Package-private; must
}
try {
Object finalizee = this.getInactive();
Object finalizee = this.get();
assert finalizee != null;
if (!(finalizee instanceof java.lang.Enum)) {
jla.invokeFinalize(finalizee);