Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-19 Thread Stuart Marks
On Fri, 19 Nov 2021 22:50:49 GMT, David Holmes wrote: >> Regarding **jcmd** updates, I'm thinking maybe this would be better handled >> separately. There is the potential to update to `GC.finalizer_info` >> discussed previously. Looking at the **jcmd** tool docs, it seems like >>

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-19 Thread David Holmes
On Fri, 19 Nov 2021 20:13:06 GMT, Stuart Marks wrote: >> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove Finalizer.Holder class. > > Regarding **jcmd** updates, I'm thinking maybe this would be better handled >

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-19 Thread Brent Christian
On Fri, 19 Nov 2021 00:14:18 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-19 Thread Stuart Marks
On Fri, 19 Nov 2021 00:14:18 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread Kim Barrett
On Fri, 19 Nov 2021 00:14:18 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread David Holmes
On Fri, 19 Nov 2021 02:29:33 GMT, Stuart Marks wrote: >>> When the finalization is disabled, perhaps jcmd GC.finalizer_info should >>> just be made as a nop in the VM. >> >> Yes that is a trivial change to add. @stuart-marks I can provide the code. >> You can choose whether to include in this

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread Jaikiran Pai
On Fri, 19 Nov 2021 00:14:34 GMT, Stuart Marks wrote: >> src/java.base/share/classes/java/lang/ref/Finalizer.java line 195: >> >>> 193: >>> 194: static { >>> 195: if (Holder.ENABLED) { >> >> Hello Stuart, >> My understanding of the the lazy `Holder` is that it's there to delay the

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread Stuart Marks
On Fri, 19 Nov 2021 00:59:10 GMT, David Holmes wrote: >> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove Finalizer.Holder class. > > src/java.base/share/classes/java/lang/ref/Finalizer.java line 64: > >> 62: }

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Stuart Marks
On Fri, 19 Nov 2021 01:03:22 GMT, David Holmes wrote: > > When the finalization is disabled, perhaps jcmd GC.finalizer_info should > > just be made as a nop in the VM. > > Yes that is a trivial change to add. @stuart-marks I can provide the code. > You can choose whether to include in this PR

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread David Holmes
On Fri, 19 Nov 2021 00:14:18 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread David Holmes
On Thu, 18 Nov 2021 23:36:23 GMT, Brent Christian wrote: > When the finalization is disabled, perhaps jcmd GC.finalizer_info should just > be made as a nop in the VM. Yes that is a trivial change to add. @stuart-marks I can provide the code. You can choose whether to include in this PR or

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread David Holmes
On Fri, 19 Nov 2021 00:14:18 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 04:13:21 GMT, Jaikiran Pai wrote: >> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove Finalizer.Holder class. > > src/java.base/share/classes/java/lang/ref/Finalizer.java line 195: > >> 193: >>

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v4]

2021-11-18 Thread Stuart Marks
> Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so that this state can be queried from Java. This is used

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Brent Christian
On Thu, 18 Nov 2021 21:15:11 GMT, Mandy Chung wrote: > When the finalization is disabled, perhaps jcmd GC.finalizer_info should just > be made as a nop in the VM. Would it be interesting (perhaps in a follow-up) for GC.finalizer_info to report that the given VM had finalization disabled?

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread David Holmes
On Thu, 18 Nov 2021 20:05:15 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread David Holmes
Hi Mandy, On 19/11/2021 6:16 am, Mandy Chung wrote: On Thu, 18 Nov 2021 06:49:03 GMT, Kim Barrett wrote: src/hotspot/share/prims/jvm.cpp line 694: 692: 693: JVM_ENTRY(jboolean, JVM_IsFinalizationEnabled(JNIEnv * env)) 694: return InstanceKlass::finalization_enabled() ? JNI_TRUE :

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Mandy Chung
On Thu, 18 Nov 2021 22:04:52 GMT, Stuart Marks 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

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 21:19:44 GMT, Stuart Marks wrote: >> One typical way for VM to pass the arguments to the library is via private >> system properties. System::initPhase1 will save the VM properties in >> `jdk.internal.misc.VM` and filters out the private properties from the >> system

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 06:47:05 GMT, Aleksey Shipilev wrote: >> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Rename InstanceKlass::finalization_enabled to is_finalization_enabled. >> Minor cleanups. > >

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 20:13:23 GMT, Mandy Chung wrote: >> I think this could just be `return InstanceKlass::finalization_enabled();`. >> There is lots of code in this file and elsewhere that assumes C++ `bool` >> converts to `jboolean` appropriately. > > One typical way for VM to pass the

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Mandy Chung
On Thu, 18 Nov 2021 20:05:15 GMT, Stuart Marks wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Mandy Chung
On Thu, 18 Nov 2021 06:49:03 GMT, Kim Barrett wrote: >> src/hotspot/share/prims/jvm.cpp line 694: >> >>> 692: >>> 693: JVM_ENTRY(jboolean, JVM_IsFinalizationEnabled(JNIEnv * env)) >>> 694: return InstanceKlass::finalization_enabled() ? JNI_TRUE : JNI_FALSE; >> >> missing indentation > > I

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v3]

2021-11-18 Thread Stuart Marks
> Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so that this state can be queried from Java. This is used

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 07:52:18 GMT, David Holmes wrote: >> Yeah, "flag" is `Holder.ENABLED` here. I mean, are Java methods >> `registerFinalizer` and `runFinalization` called only by VM? If so, can VM >> check the whole thing on VM side, without going to Java and asking back from >> there? > >

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Stuart Marks
On Thu, 18 Nov 2021 15:05:49 GMT, Peter Levart wrote: >> Or, you could move the static initialization block that statrts the >> finalizer thread into the Finalizer.FinalizerThread class itself and then >> arrange for that class to be initialized explicitly immediately after the >> Finalizer

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Peter Levart
On Thu, 18 Nov 2021 14:53:38 GMT, Peter Levart wrote: >> I think @shipilev asks a good question. This could be done completely in the >> VM without the changes to j.l.ref.Finalizer. The CLI option is for >> experimenting, at least in the short term, and should be benign to have the >>

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Peter Levart
On Thu, 18 Nov 2021 08:39:52 GMT, Alan Bateman wrote: >> Yeah, "flag" is `Holder.ENABLED` here. I mean, are Java methods >> `registerFinalizer` and `runFinalization` called only by VM? If so, can VM >> check the whole thing on VM side, without going to Java and asking back from >> there? > >

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Alan Bateman
On Thu, 18 Nov 2021 07:44:05 GMT, Aleksey Shipilev wrote: >> @shipilev not sure what you mean by "a flag on the Java side". The Java >> code just queries the VM for the finalization enabled/disabled state and >> uses that to control things. > > Yeah, "flag" is `Holder.ENABLED` here. I mean,

Re: RFR: JDK-8276422 Add command-line option to disable finalization [v2]

2021-11-18 Thread Stuart Marks
> Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so that this state can be queried from Java. This is used

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread David Holmes
On Thu, 18 Nov 2021 07:44:05 GMT, Aleksey Shipilev wrote: >> @shipilev not sure what you mean by "a flag on the Java side". The Java >> code just queries the VM for the finalization enabled/disabled state and >> uses that to control things. > > Yeah, "flag" is `Holder.ENABLED` here. I mean,

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread David Holmes
On Thu, 18 Nov 2021 07:16:56 GMT, Kim Barrett wrote: > There is nothing here to make the various GCs take advantage of finalization > being disabled. Is the plan to leave that to followup changes? @kimbarrett I provided the basic VM parts here. I'm not aware of what specifically a GC might

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Aleksey Shipilev
On Thu, 18 Nov 2021 07:40:34 GMT, David Holmes wrote: >> Do we even have to have a flag on Java side? It looks like these calls are >> only done as the upcalls from VM, so we might just keep the flag on VM side? > > @shipilev not sure what you mean by "a flag on the Java side". The Java code

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread David Holmes
On Thu, 18 Nov 2021 07:27:30 GMT, Aleksey Shipilev wrote: >> @stuart-marks not sure I see how anything is different here compared to the >> existing logic. The `Finalizer` class is explicitly initialized quite early >> in the init process, but if a preceding class's initialization created an

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Aleksey Shipilev
On Thu, 18 Nov 2021 07:13:55 GMT, David Holmes wrote: >> Huh, good catch! This was mostly left over from an earlier version of the >> flag that used system properties, which aren't initialized until after the >> Finalizer class is initialized. >> >> It might be the case that the Holder can be

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Aleksey Shipilev
On Thu, 18 Nov 2021 01:34:36 GMT, Stuart Marks wrote: > Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Kim Barrett
On Thu, 18 Nov 2021 01:34:36 GMT, Stuart Marks wrote: > Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Kim Barrett
On Thu, 18 Nov 2021 06:43:01 GMT, Kim Barrett wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread David Holmes
On Thu, 18 Nov 2021 05:20:02 GMT, Stuart Marks wrote: >> src/java.base/share/classes/java/lang/ref/Finalizer.java line 195: >> >>> 193: >>> 194: static { >>> 195: if (Holder.ENABLED) { >> >> Hello Stuart, >> My understanding of the the lazy `Holder` is that it's there to delay the

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Stuart Marks
On Thu, 18 Nov 2021 04:13:21 GMT, Jaikiran Pai wrote: >> Pretty much what it says. The new option controls a static member in >> InstanceKlass that's consulted to determine whether the finalization >> machinery is activated for instances when a class is loaded. A new native >> method is added

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Jaikiran Pai
On Thu, 18 Nov 2021 01:34:36 GMT, Stuart Marks wrote: > Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so

Re: RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread David Holmes
On Thu, 18 Nov 2021 01:34:36 GMT, Stuart Marks wrote: > Pretty much what it says. The new option controls a static member in > InstanceKlass that's consulted to determine whether the finalization > machinery is activated for instances when a class is loaded. A new native > method is added so

RFR: JDK-8276422 Add command-line option to disable finalization

2021-11-17 Thread Stuart Marks
Pretty much what it says. The new option controls a static member in InstanceKlass that's consulted to determine whether the finalization machinery is activated for instances when a class is loaded. A new native method is added so that this state can be queried from Java. This is used to