On Thu, 18 Nov 2021 22:04:52 GMT, Stuart Marks <sma...@openjdk.org> wrote:
>> I renamed the function to `is_finalization_enabled` per previous comment, >> and I also made these cleanups. > > Regarding using system properties, my initial prototype did this in the > launcher, and it did run into the problem that the Finalizer class is > initialized before system properties are available. That's why I created the > Holder class, so that reading the property could be delayed until the first > upcall to Finalizer::register. I suppose the initialization of Finalizer > could be moved later, but that seems more invasive. > > The flag needs to be available in the VM in order to avoid upcalls for > instances-with-finalizers in the first place. Alan had > [suggested](https://bugs.openjdk.java.net/browse/JDK-8276422?focusedCommentId=14456185&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14456185) > moving the argument processing into the VM, and David suggested putting the > flag into InstanceKlass, which seems a sensible place to me. It's also > reasonably accessible there to GC implementations, should they want to > inspect it. > Alan had suggested moving the argument processing into the VM, and David > suggested putting the flag into InstanceKlass, which seems a sensible place > to me. It's also reasonably accessible there to GC implementations, should > they want to inspect it. That's still all good. What I meant is for the VM to add a private system property (not the launcher) as to pass the flag to the library code. The precedence is like `sun.nio.MaxDirectMemorySize` or `java.lang.Integer.IntegerCache.high`. ------------- PR: https://git.openjdk.java.net/jdk/pull/6442