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: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 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 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 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 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 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