RFR: 8283660: Convert com/sun/jndi/ldap/AbstractLdapNamingEnumeration.java finalizer to Cleaner [v16]
Hans Boehm
hboehm at google.com
Wed Aug 3 03:22:29 UTC 2022
On Tue, Aug 2, 2022 at 7:43 PM Stuart Marks <smarks at openjdk.org> wrote:
> ...
> Setting this aside, it does seem like all uses of a cleanable object need
> to have a try/finally statement, with at least an RF in the finally clause.
> Is there any evidence that shows that this construct isn't needed?
>
I think the reachabilityFence is clearly needed with current
implementations, though their omission is hard to test for, since the
failures tend to only occur with unlikely schedules. But those schedules
clearly exist. And fixing implementations to avoid that by unconditionally
preserving references is problematic, especially given that bytecode tends
to hide scopes. (Back during Java memory model discussions, there was also
an argument that this would cause us to pay everywhere for a rarely used
feature. I believe the "rarely used" part less and less. On the other hand,
I also now tend to view a percent or two performance difference as more
significant than back then, so maybe that overall argument still applies.)
I would also guess that the try-finally is required by some current
optimizations. But that's more based on an argument that such optimizations
exist, so somebody must have implemented them, rather than anything more
concrete.
Hans
> -------------
>
> PR: https://git.openjdk.org/jdk/pull/8311
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20220802/49ce514e/attachment.htm>
More information about the core-libs-dev
mailing list