Re: RFR: 8338544: Dedicated Array class descriptor implementation

2024-10-04 Thread Jorn Vernee
On Fri, 4 Oct 2024 18:24:37 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/constant/ArrayClassDescImpl.java >> line 116: >> >>> 114: sb.append(componentDesc); >>> 115: return sb.toString(); >>> 116: } >> >> Is there really that much benefit in lazily com

Re: RFR: 8338544: Dedicated Array class descriptor implementation

2024-10-04 Thread Jorn Vernee
On Wed, 21 Aug 2024 20:25:07 GMT, Chen Liang wrote: > @cl4es discovered that Stack Map generation in ClassFile API uses > `componentType` and `arrayType` for `aaload` `aastore` instructions, which > are currently quite slow. We can split out array class descriptors from class > or interfaces t

Integrated: 8337753: Target class of upcall stub may be unloaded

2024-10-03 Thread Jorn Vernee
On Tue, 6 Aug 2024 17:26:55 GMT, Jorn Vernee wrote: > As discussed in the JBS issue: > > FFM upcall stubs embed a `Method*` of the target method in the stub. This > `Method*` is read from the `LambdaForm::vmentry` field associated with the > target method handle at the time

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v6]

2024-10-02 Thread Jorn Vernee
On Thu, 19 Sep 2024 12:20:13 GMT, Jorn Vernee wrote: >> As discussed in the JBS issue: >> >> FFM upcall stubs embed a `Method*` of the target method in the stub. This >> `Method*` is read from the `LambdaForm::vmentry` field associated with the >> target meth

Re: RFR: 8341127: Extra call to MethodHandle::asType from memory segment var handles fails to inline [v4]

2024-10-01 Thread Jorn Vernee
On Tue, 1 Oct 2024 17:49:12 GMT, Maurizio Cimadamore wrote: >> The fix for JDK-8331865 introduced an accidental performance regression. >> The main issue is that now *all* memory segment var handles go through some >> round of adaptation. >> Adapting a var handle results in a so called *indirec

Re: RFR: 8341127: Extra call to MethodHandle::asType from memory segment var handles fails to inline [v2]

2024-10-01 Thread Jorn Vernee
On Tue, 1 Oct 2024 16:22:36 GMT, Maurizio Cimadamore wrote: >> The issue with using a compile command is that it will then work globally. >> So the benchmark would not really test much - besides checking that var >> handle access is slow when `asType` cannot inline. What I was trying to do >>

Re: RFR: 8340812: LambdaForm customization via MethodHandle::updateForm is not thread safe

2024-10-01 Thread Jorn Vernee
On Tue, 1 Oct 2024 06:28:02 GMT, David Holmes wrote: >> In this case there is no classic release/acquire. Instead, we rely on other >> properties: The `vmentry` field is loaded in >> `MethodHandles::jump_to_lambda_form`, using a plain load. I believe a >> load-acquire is not needed here becaus

Re: RFR: 8341127: Extra call to MethodHandle::asType from memory segment var handles fails to inline [v2]

2024-10-01 Thread Jorn Vernee
On Tue, 1 Oct 2024 10:18:15 GMT, Maurizio Cimadamore wrote: >> The fix for JDK-8331865 introduced an accidental performance regression. >> The main issue is that now *all* memory segment var handles go through some >> round of adaptation. >> Adapting a var handle results in a so called *indirec

Re: RFR: 8340812: LambdaForm customization via MethodHandle::updateForm is not thread safe

2024-09-30 Thread Jorn Vernee
On Sun, 29 Sep 2024 23:52:29 GMT, David Holmes wrote: >> The `form` field is a final field; thus, all reads to that field is a >> load-acquire. This load-load barrier is critical to ensure observing the >> correct, non-null `vmentry` field value if the updated form is observed. >> >> Note that

Re: RFR: 8340812: LambdaForm customization via MethodHandle::updateForm is not thread safe

2024-09-25 Thread Jorn Vernee
On Tue, 24 Sep 2024 14:18:58 GMT, Tobias Hartmann wrote: > When investigating an intermittent NPE with an Oracle internal test on > AArch64, I noticed that the NPE is actually a SIGSEGV in the code emitted by > `MethodHandles::jump_to_lambda_form` when trying to load the > `MemberName::method`

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v3]

2024-09-24 Thread Jorn Vernee
On Tue, 24 Sep 2024 06:51:49 GMT, Alan Bateman wrote: > For now, I think the proposed wording in this PR is okay. Yes, I agree what I'm suggesting is out of scope for this PR. - PR Review Comment: https://git.openjdk.org/jdk/pull/21067#discussion_r1773524153

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v6]

2024-09-24 Thread Jorn Vernee
On Tue, 24 Sep 2024 14:53:22 GMT, Maurizio Cimadamore wrote: >> This PR moves the section on restricted methods from the the javadoc of >> `java.lang.foreign` package into a standalone static [javadoc >> page](https://cr.openjdk.org/~mcimadamore/jdk/restricted_javadoc_section/docs/api/java.bas

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v5]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 16:35:18 GMT, Per Minborg wrote: >> This PR prevents sequence layout with padding to be used with the Linker. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Reword doce Marked as reviewed by jvernee (Re

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v5]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 16:40:08 GMT, Maurizio Cimadamore wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Reword doce > > src/java.base/share/classes/jdk/internal/foreign/abi/AbstractLinker.java line > 225: > >> 223:

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v4]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 14:40:40 GMT, Jorn Vernee wrote: >> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Add to specification and refine detection of PL GLs > > src/java.base/share/classes/java

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v4]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 13:54:52 GMT, Per Minborg wrote: >> This PR prevents sequence layout with padding to be used with the Linker. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Add to specification and refine detection of P

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v3]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 13:37:07 GMT, Vladimir Kozelkov wrote: >> Per Minborg has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains nine additional >> com

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v3]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 11:15:08 GMT, Maurizio Cimadamore wrote: >> Previously, the check threw an `IllegalArgumentException` when presented >> with the above (or other) group layout with only padding layouts, but the >> actual message differed. So, this change only changes the exception message

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v3]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 11:45:23 GMT, Jorn Vernee wrote: >> It is documented by the CS JEP: https://openjdk.org/jeps/176 >> >>> It discovers its caller's class by invoking the >>> sun.reflect.Reflection.getCallerClass method. >> >> CS set the preced

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v3]

2024-09-23 Thread Jorn Vernee
On Mon, 23 Sep 2024 09:39:00 GMT, David Holmes wrote: >> We use "no caller class" in the CS methods, maybe it could be improved. >> >> I think "can not be determined" just begs questions. Is this a JDK >> limitation, something I'm doing wrong, or something else, ... if you see >> what I mean.

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v3]

2024-09-23 Thread Jorn Vernee
html >> >> Co-authored-by: Jorn Vernee > > src/java.base/share/classes/java/lang/doc-files/RestrictedMethods.html line > 43: > >> 41: When a restricted method is invoked by > href="../../../../specs/jni/index.html">JNI code, >>

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddindLayout

2024-09-20 Thread Jorn Vernee
On Fri, 20 Sep 2024 08:41:45 GMT, Maurizio Cimadamore wrote: > The javadoc of the `Linker` also states that: > > > [A group layout] G does not contain padding other than what is strictly > > required to align > > its non-padding layout elements, or to satisfy (2) [the size of {@code G} > > is

Re: RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddindLayout

2024-09-20 Thread Jorn Vernee
On Tue, 17 Sep 2024 14:12:58 GMT, Per Minborg wrote: > This PR prevents sequence layout with padding to be used with the Linker. src/java.base/share/classes/java/lang/foreign/Linker.java line 252: > 250: * the alignment constraint of {@code S} is set to its > 251: * natural alignment, >

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods [v2]

2024-09-19 Thread Jorn Vernee
On Thu, 19 Sep 2024 13:59:30 GMT, Maurizio Cimadamore wrote: >> This PR moves the section on restricted methods from the the javadoc of >> `java.lang.foreign` package into a standalone static [javadoc >> page](https://cr.openjdk.org/~mcimadamore/jdk/restricted_javadoc_section/docs/api/java.bas

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v5]

2024-09-19 Thread Jorn Vernee
On Thu, 19 Sep 2024 05:03:50 GMT, Amit Kumar wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> remove PC save/restore on s390 > > src/hotspot/cpu/s390/stubGenerator_s390.cpp line 3063:

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v6]

2024-09-19 Thread Jorn Vernee
core Error Units > Upcalls.panama_blank avgt 30 61.218 ± 0.554 ns/op > > > > As for the added TestUpcallStress test, it takes about 800 seconds to run > this test on the dev machine I'm using, so I've set the timeout quite high. > Since it runs for so long, I

Re: RFR: 8338596: Clarify handling of restricted and caller-sensitive methods

2024-09-18 Thread Jorn Vernee
On Wed, 18 Sep 2024 15:47:01 GMT, Maurizio Cimadamore wrote: > This PR moves the section on restricted methods from the the javadoc of > `java.lang.foreign` package into a standalone static [javadoc > page](https://cr.openjdk.org/~mcimadamore/jdk/restricted_javadoc_section/docs/api/java.base/j

Re: RFR: 8340280: Avoid calling MT.invokerType() when creating LambdaForms

2024-09-17 Thread Jorn Vernee
On Tue, 17 Sep 2024 09:28:02 GMT, Claes Redestad wrote: > This PR exploits the observation that in many of the cases where we call > `methodType.invokerType()` we immediately translate it into a `Name[]` where > the only effect is to create an array with an additional leading > `BasicType.L_TY

Re: RFR: 8340131: Refactor internal makeHiddenClassDefiner to take ClassOption ... instead of Set [v6]

2024-09-16 Thread Jorn Vernee
On Mon, 16 Sep 2024 07:58:44 GMT, Claes Redestad wrote: >> Simple internal refactor to load a few classes less on startup. Arguably >> cleaner and avoids some iterator allocations. > > Claes Redestad has updated the pull request incrementally with one additional > commit since the last revision

Re: RFR: 8340131: Refactor internal makeHiddenClassDefiner to take ClassOption ... instead of Set

2024-09-13 Thread Jorn Vernee
On Fri, 13 Sep 2024 15:40:46 GMT, Claes Redestad wrote: > Simple internal refactor to load a few classes less on startup. Arguably > cleaner. src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2223: > 2221: } > : > 2223: return makeHiddenClassDefi

Re: RFR: 8339837: Remove unused BootstrapMethodsInvokers.isLambdaMetafactoryCondyBSM

2024-09-10 Thread Jorn Vernee
On Tue, 10 Sep 2024 10:58:19 GMT, Claes Redestad wrote: > Trivially remove a static optimization mapping for a non-existent method in > LambdaMetafactory. The referenced method was refactored into a set of factory > methods in java.lang.invoke.ConstantBootstraps before ever becoming a public >

Re: RFR: 8339800: Prefer invokeBasic in BootstrapMethodInvokers

2024-09-09 Thread Jorn Vernee
On Mon, 9 Sep 2024 23:52:41 GMT, Claes Redestad wrote: > Switching to `invokeBasic` for type-check invokes in > `BootstrapMethodInvokers` instead of `invokeExact` avoids some > `MethodHandleNatives.linkMethod` calls during bootstrap. This brings a tiny > but measurable once-per-bootstrap metho

Re: RFR: 8339686: java/foreign/TestMappedHandshake.java fails with assert(depth < max_critical_stack_depth) failed: can't have more than 10 critical frames

2024-09-09 Thread Jorn Vernee
On Mon, 9 Sep 2024 12:57:17 GMT, Maurizio Cimadamore wrote: > The new test added by https://github.com/openjdk/jdk/pull/20854 fails > spuriously. > While JNI lookup is now moved into the static initializer of the > `MappedMemoryUtils` class, this class might only get initialized while in the

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v5]

2024-09-09 Thread Jorn Vernee
On Fri, 6 Sep 2024 17:51:15 GMT, Jorn Vernee wrote: >> As discussed in the JBS issue: >> >> FFM upcall stubs embed a `Method*` of the target method in the stub. This >> `Method*` is read from the `LambdaForm::vmentry` field associated with the >> target meth

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v5]

2024-09-06 Thread Jorn Vernee
core Error Units > Upcalls.panama_blank avgt 30 61.218 ± 0.554 ns/op > > > > As for the added TestUpcallStress test, it takes about 800 seconds to run > this test on the dev machine I'm using, so I've set the timeout quite high. > Since it runs for so

Integrated: 8338123: Linker crash when building a downcall handle with many arguments in x64

2024-09-06 Thread Jorn Vernee
On Tue, 3 Sep 2024 17:52:35 GMT, Jorn Vernee wrote: > - Adjust downcall stub sizes based on latest version. (per method described > in https://github.com/openjdk/jdk/pull/12908) > - Beef up test for large stubs to also cover this particular case. This pull request has now been i

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v4]

2024-09-05 Thread Jorn Vernee
core Error Units > Upcalls.panama_blank avgt 30 61.218 ± 0.554 ns/op > > > > As for the added TestUpcallStress test, it takes about 800 seconds to run > this test on the dev machine I'm using, so I've set the timeout quite high. > Since it runs for so

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v3]

2024-09-04 Thread Jorn Vernee
On Wed, 4 Sep 2024 12:46:21 GMT, Fei Yang wrote: >> Were you able to reproduce the original issue on RISC-V? > >> Were you able to reproduce the original issue on RISC-V? > > Yeah. I can reproduce similar crash on linux-riscv64 platform running this > new test as well. Ok, I'll add riscv as on

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v3]

2024-09-04 Thread Jorn Vernee
core Error Units > Upcalls.panama_blank avgt 30 61.218 ± 0.554 ns/op > > > > As for the added TestUpcallStress test, it takes about 800 seconds to run > this test on the dev machine I'm using, so I've set the timeout quite high. > Since it runs for so

Re: RFR: 8337753: Target class of upcall stub may be unloaded [v2]

2024-09-04 Thread Jorn Vernee
core Error Units > Upcalls.panama_blank avgt 30 61.218 ± 0.554 ns/op > > > > As for the added TestUpcallStress test, it takes about 800 seconds to run > this test on the dev machine I'm using, so I've set the timeout quite high. > Since it runs for so

RFR: 8338123: Linker crash when building a downcall handle with many arguments in x64

2024-09-04 Thread Jorn Vernee
- Adjust downcall stub sizes based on latest version. (per method described in https://github.com/openjdk/jdk/pull/12908) - Beef up test for large stubs to also cover this particular case. - Commit messages: - use junit - make test more rebust - add test - adjust downcall stub si

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-04 Thread Jorn Vernee
On Wed, 4 Sep 2024 06:14:57 GMT, Fei Yang wrote: >> As discussed in the JBS issue: >> >> FFM upcall stubs embed a `Method*` of the target method in the stub. This >> `Method*` is read from the `LambdaForm::vmentry` field associated with the >> target method handle at the time when the upcall s

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-04 Thread Jorn Vernee
On Wed, 4 Sep 2024 11:39:10 GMT, Jorn Vernee wrote: >> src/hotspot/share/prims/upcallLinker.cpp line 142: >> >>> 140: Handle exception_h(Thread::current(), exception); >>> 141: java_lang_Throwable::print_stack_trace(exception_h, tty); >>> 142:

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-04 Thread Jorn Vernee
On Wed, 4 Sep 2024 01:29:22 GMT, David Holmes wrote: >> As discussed in the JBS issue: >> >> FFM upcall stubs embed a `Method*` of the target method in the stub. This >> `Method*` is read from the `LambdaForm::vmentry` field associated with the >> target method handle at the time when the upca

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-03 Thread Jorn Vernee
On Tue, 6 Aug 2024 17:26:55 GMT, Jorn Vernee wrote: > As discussed in the JBS issue: > > FFM upcall stubs embed a `Method*` of the target method in the stub. This > `Method*` is read from the `LambdaForm::vmentry` field associated with the > target method handle at the time

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-03 Thread Jorn Vernee
On Tue, 3 Sep 2024 04:52:08 GMT, Amit Kumar wrote: >> As discussed in the JBS issue: >> >> FFM upcall stubs embed a `Method*` of the target method in the stub. This >> `Method*` is read from the `LambdaForm::vmentry` field associated with the >> target method handle at the time when the upcall

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-03 Thread Jorn Vernee
On Thu, 8 Aug 2024 10:51:59 GMT, Martin Doerr wrote: > Can't we do these nasty loads in C++ code and use set_vm_result_2 in > UpcallLinker::on_entry? That's what I tried. I got a ~20% hit to execution time. > I guess that upcalls are less performance critical Why so? They are certainly much m

Re: RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-03 Thread Jorn Vernee
On Tue, 6 Aug 2024 17:26:55 GMT, Jorn Vernee wrote: > As discussed in the JBS issue: > > FFM upcall stubs embed a `Method*` of the target method in the stub. This > `Method*` is read from the `LambdaForm::vmentry` field associated with the > target method handle at the time

RFR: 8337753: Target class of upcall stub may be unloaded

2024-09-03 Thread Jorn Vernee
As discussed in the JBS issue: FFM upcall stubs embed a `Method*` of the target method in the stub. This `Method*` is read from the `LambdaForm::vmentry` field associated with the target method handle at the time when the upcall stub is generated. The MH instance itself is stashed in a global J

Integrated: 8324260: java/foreign/TestStubAllocFailure.java run timeout with -Xcomp

2024-08-01 Thread Jorn Vernee
On Wed, 31 Jul 2024 13:40:31 GMT, Jorn Vernee wrote: > This test spawns 2 forked processes, which then try to trigger a code cache > OOM in FFM hotspot code. Even without `-Xcomp`, the test is already pretty > slow, which increases dramatically with `-Xcomp`, since startup Java code

Re: RFR: 8335638: Calling VarHandle.{access-mode} methods reflectively throws wrong exception [v2]

2024-08-01 Thread Jorn Vernee
On Fri, 5 Jul 2024 14:23:50 GMT, Jorn Vernee wrote: >> Hannes Greule has updated the pull request incrementally with one additional >> commit since the last revision: >> >> address comments > > I think this needs a CSR, to document the change i

RFR: 8324260: java/foreign/TestStubAllocFailure.java run timeout with -Xcomp

2024-07-31 Thread Jorn Vernee
This test spawns 2 forked processes, which then try to trigger a code cache OOM in FFM hotspot code. Even without `-Xcomp`, the test is already pretty slow, which increases dramatically with `-Xcomp`, since startup Java code has to be compiled 3 times, once for the main test process, and then 2

Integrated: 8337060: Test java/foreign/TestConcurrentClose.java failed: IllegalStateException: SegmentAccessor::doAccess method not being compiled

2024-07-25 Thread Jorn Vernee
On Thu, 25 Jul 2024 10:58:42 GMT, Jorn Vernee wrote: > We are seeing some failures of this test in our CI, particularly on Windows > machines, which are known to starve out certain threads. > > To make sure the compiler threads get a chance to work, I've added `-Xbatch` &g

Re: RFR: 8337060: Test java/foreign/TestConcurrentClose.java failed: IllegalStateException: SegmentAccessor::doAccess method not being compiled

2024-07-25 Thread Jorn Vernee
On Thu, 25 Jul 2024 10:58:42 GMT, Jorn Vernee wrote: > We are seeing some failures of this test in our CI, particularly on Windows > machines, which are known to starve out certain threads. > > To make sure the compiler threads get a chance to work, I've added `-Xbatch` &g

RFR: 8337060: Test java/foreign/TestConcurrentClose.java failed: IllegalStateException: SegmentAccessor::doAccess method not being compiled

2024-07-25 Thread Jorn Vernee
We are seeing some failures of this test in our CI, particularly on Windows machines, which are known to starve out certain threads. To make sure the compiler threads get a chance to work, I've added `-Xbatch` to the flags with which the test runs (this was missed in the original PR). I've also

Integrated: 8335480: Only deoptimize threads if needed when closing shared arena

2024-07-18 Thread Jorn Vernee
On Fri, 12 Jul 2024 13:57:23 GMT, Jorn Vernee wrote: > This PR limits the number of cases in which we deoptimize frames when closing > a shared Arena. The initial intent of this was to improve the performance of > shared arena closure in cases where a lot of threads are acce

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v7]

2024-07-17 Thread Jorn Vernee
us/op > ConcurrentClose.sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt

Re: RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index

2024-07-17 Thread Jorn Vernee
On Wed, 17 Jul 2024 13:44:58 GMT, Aleksey Shipilev wrote: > > @shipilev Would you re-review this patch, or are you no longer interested > > now that `@Stable` is removed? > > I am not sure I understand the performance implications for this change. I > can see the optimization for avoiding `Nam

Re: RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v5]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 19:59:41 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/lang/invoke/LambdaForm.java line 1388: >> >>> 1386: Name withIndex(int i) { >>> 1387: if (i == this.index) return this; >>> 1388: return new Name(i, type, function, arguments,

Re: RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v5]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 03:10:29 GMT, Chen Liang wrote: >> The `@Stable` on the `index` field is incorrect, as stable only avoids >> inlining `0`. On a strategic view, this index field should just become final >> so that `Name` becomes eligible for value class migration once valhalla >> comes. Thi

Re: RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v5]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 03:10:29 GMT, Chen Liang wrote: >> The `@Stable` on the `index` field is incorrect, as stable only avoids >> inlining `0`. On a strategic view, this index field should just become final >> so that `Name` becomes eligible for value class migration once valhalla >> comes. Thi

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v5]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 15:12:15 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v6]

2024-07-16 Thread Jorn Vernee
us/op > ConcurrentClose.sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v4]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 15:00:04 GMT, Doug Simon wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> JVMCI support > > src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotReso

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v5]

2024-07-16 Thread Jorn Vernee
us/op > ConcurrentClose.sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v4]

2024-07-16 Thread Jorn Vernee
On Tue, 16 Jul 2024 14:46:13 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v4]

2024-07-16 Thread Jorn Vernee
us/op > ConcurrentClose.sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt

Re: RFR: 8335922: Incorrect @Stable usage of LambdaForm$Name.index [v3]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 15:57:30 GMT, Chen Liang wrote: >> The `@Stable` on the `index` field is incorrect, as stable only avoids >> inlining `0`. Solution is to use bit flip on the actual index (and rename >> the field to `flippedIndex`), so we use -1 to -256 (mapping to 0 to 255) and >> 0 the de

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 11:29:49 GMT, Rémi Forax wrote: > > This is what I was thinking of as well. close() on a shared arena can be > > called by any thread, so it would be possible to have an executor service > > with 1-n threads that is dedicated to closing memory. > > This delays both the clos

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 13:09:21 GMT, Maurizio Cimadamore wrote: > > Even with `arrayElementVarHandle` it's about the same > > This is very odd, and I don't have a good explanation as to why that is the > case. What does the baseline (confined arena) look like for > `arrayElementVarHandle` ? Pre

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 12:14:52 GMT, Maurizio Cimadamore wrote: > Ah! I had `arrayElementVarHandle` in mind - maybe you can try that? Even with `arrayElementVarHandle` it's about the same - PR Comment: https://git.openjdk.org/jdk/pull/20158#issuecomment-2228425705

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 11:33:30 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 11:33:30 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v3]

2024-07-15 Thread Jorn Vernee
us/op > ConcurrentClose.sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 09:02:29 GMT, Uwe Schindler wrote: > Of course we can do that in a separate thread (this is my idea how to improve > the closes in lucene). This is what I was thinking of as well. `close()` on a shared arena can be called by any thread, so it would be possible to have an ex

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-15 Thread Jorn Vernee
On Mon, 15 Jul 2024 08:41:38 GMT, Doug Simon wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> track has_scoped_access for compiled methods > > src/hotspot/share/jvmci/jvmciRun

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Jorn Vernee
On Sat, 13 Jul 2024 15:28:57 GMT, Erik Österlund wrote: > @dougxc might want to have a look at Graal support for this one. Yes, I conservatively implemented `has_scoped_access()` for Graal (see `jvmciRuntime.cpp` changes). It won't regress anything, but there's still an opportunity for improve

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-13 Thread Jorn Vernee
On Fri, 12 Jul 2024 20:59:26 GMT, Jorn Vernee wrote: >> This PR limits the number of cases in which we deoptimize frames when >> closing a shared Arena. The initial intent of this was to improve the >> performance of shared arena closure in cases where a lot of threads are

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena

2024-07-12 Thread Jorn Vernee
On Fri, 12 Jul 2024 13:57:23 GMT, Jorn Vernee wrote: > This PR limits the number of cases in which we deoptimize frames when closing > a shared Arena. The initial intent of this was to improve the performance of > shared arena closure in cases where a lot of threads are acce

Re: RFR: 8335480: Only deoptimize threads if needed when closing shared arena [v2]

2024-07-12 Thread Jorn Vernee
sharedAccess6 avgt 10 386.697 ± 59.170 us/op > ConcurrentClose.sharedAccess5 avgt 10 291.157 ± 7.023 us/op > ConcurrentClose.sharedAccess4 avgt 10 209.178 ± 5.802 us/op > ConcurrentClose.sharedAccess1 avgt 1052.042 ± 0.630 us/op > ConcurrentClo

RFR: 8335480: Only deoptimize threads if needed when closing shared arena

2024-07-12 Thread Jorn Vernee
This PR limits the number of cases in which we deoptimize frames when closing a shared Arena. The initial intent of this was to improve the performance of shared arena closure in cases where a lot of threads are accessing and closing shared arenas at the same time (see attached benchmark), but u

[jdk23] Integrated: 8333884: MemorySegment::reinterpret removes read-only property

2024-07-11 Thread Jorn Vernee
On Wed, 10 Jul 2024 17:01:00 GMT, Jorn Vernee wrote: > Hi all, > > This pull request contains a backport of commit > [6f7f0f1d](https://github.com/openjdk/jdk/commit/6f7f0f1de05fdc0f6a88ccd90b806e8a5c5074ef) > from the [openjdk/jdk](https://git.openjdk.org/jdk) repository.

[jdk23] Integrated: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory.

2024-07-10 Thread Jorn Vernee
On Wed, 10 Jul 2024 16:08:51 GMT, Jorn Vernee wrote: > Hi all, > > This pull request contains a backport of commit > [c80e2eb3](https://github.com/openjdk/jdk/commit/c80e2eb35c4eb03f17a2a31e979e5c369453e203) > from the [openjdk/jdk](https://git.openjdk.org/jdk) repository.

[jdk23] Integrated: 8333886: Explicitly specify that asSlice and reinterpret return a memory segment backed by the same region of memory.

2024-07-10 Thread Jorn Vernee
reviewed by Jorn Vernee and Maurizio Cimadamore. This is a P4 doc-only change, which is permitted in RDP1: https://openjdk.org/jeps/3#Quick-reference This change should also make it possible to cleanly backport: https://github.com/openjdk/jdk/commit/6f7f0f1de05fdc0f6a88ccd90b806e8a5c5074ef Thanks

[jdk23] RFR: 8333884: MemorySegment::reinterpret removes read-only property

2024-07-10 Thread Jorn Vernee
reviewed by Jorn Vernee and Maurizio Cimadamore. Thanks! - Commit messages: - Backport 6f7f0f1de05fdc0f6a88ccd90b806e8a5c5074ef Changes: https://git.openjdk.org/jdk/pull/20119/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20119&range=00 Issue: https://bugs.ope

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v10]

2024-07-08 Thread Jorn Vernee
On Sat, 29 Jun 2024 06:26:57 GMT, Alan Bateman wrote: > I assume you'll create follow-up issues in JBS for the Class-Path attribute, > improvement the usage/help output to replace the "Path"/"String" types. I've filed: https://bugs.openjdk.org/browse/JDK-8335877 and https://bugs.openjdk.org/br

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v12]

2024-07-08 Thread Jorn Vernee
On Fri, 5 Jul 2024 13:44:46 GMT, Jorn Vernee wrote: >> This PR adds a new JDK tool, called `jnativescan`, that can be used to find >> code that accesses native functionality. Currently this includes `native` >> method declarations, and methods marked with `@Restricted`. >&

Integrated: 8317611: Add a tool like jdeprscan to find usage of restricted methods

2024-07-08 Thread Jorn Vernee
On Tue, 18 Jun 2024 16:30:37 GMT, Jorn Vernee wrote: > This PR adds a new JDK tool, called `jnativescan`, that can be used to find > code that accesses native functionality. Currently this includes `native` > method declarations, and methods marked with `@Restricted`. > > The

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v12]

2024-07-05 Thread Jorn Vernee
On Fri, 5 Jul 2024 13:44:46 GMT, Jorn Vernee wrote: >> This PR adds a new JDK tool, called `jnativescan`, that can be used to find >> code that accesses native functionality. Currently this includes `native` >> method declarations, and methods marked with `@Restricted`. >&

Re: RFR: 8335638: Calling VarHandle.{access-mode} methods reflectively throws wrong exception [v2]

2024-07-05 Thread Jorn Vernee
On Thu, 4 Jul 2024 06:22:31 GMT, Hannes Greule wrote: >> Similar to how `MethodHandle#invoke(Exact)` methods are already handled, >> this change adds special casing for `VarHandle.{access-mode}` methods. >> >> The exception message is less exact, but I think that's acceptable. > > Hannes Greule

Re: RFR: 8333884: MemorySegment::reinterpret removes read-only property [v4]

2024-07-05 Thread Jorn Vernee
On Fri, 5 Jul 2024 14:01:59 GMT, Per Minborg wrote: >> This PR proposes to retain the read-only state when any of the >> `MemorySegment::reinterpret` methods is called. >> >> Previously, the read-only state was lost and the returned `MemorySegment` >> was always writable regardless of the orig

Re: RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

2024-07-05 Thread Jorn Vernee
On Wed, 3 Jul 2024 19:11:34 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/constant/MethodTypeDescImpl.java >> line 228: >> >>> 226: mtype = mt; >>> 227: } catch (TypeNotPresentException ex) { >>> 228: throw (ClassNotFoundException) ex.getCaus

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v12]

2024-07-05 Thread Jorn Vernee
x27;s libclang bindings, which use the FFM API, > and thus has a lot of references to `@Restricted` methods. > - tier 1-3 Jorn Vernee has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by t

Re: RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

2024-07-03 Thread Jorn Vernee
On Tue, 2 Jul 2024 16:20:54 GMT, Chen Liang wrote: > Simple fix for `MethodTypeDescImpl`'s violation of `resolveConstantDesc` > specification. src/java.base/share/classes/jdk/internal/constant/MethodTypeDescImpl.java line 228: > 226: mtype = mt; > 227: } catch (TypeNotPres

Re: RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

2024-07-03 Thread Jorn Vernee
On Tue, 2 Jul 2024 16:20:54 GMT, Chen Liang wrote: > Simple fix for `MethodTypeDescImpl`'s violation of `resolveConstantDesc` > specification. Marked as reviewed by jvernee (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/19991#pullrequestreview-2156417137

Re: RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

2024-07-03 Thread Jorn Vernee
On Wed, 3 Jul 2024 12:04:37 GMT, Chen Liang wrote: >> src/java.base/share/classes/jdk/internal/constant/MethodTypeDescImpl.java >> line 226: >> >>> 224: } >>> 225: }); >>> 226: mtype = mt; >> >> Can you drop this intermediate variable, and just assign to

Re: RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

2024-07-03 Thread Jorn Vernee
On Tue, 2 Jul 2024 16:20:54 GMT, Chen Liang wrote: > Simple fix for `MethodTypeDescImpl`'s violation of `resolveConstantDesc` > specification. src/java.base/share/classes/jdk/internal/constant/MethodTypeDescImpl.java line 226: > 224: } > 225: }); > 226:

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v11]

2024-07-01 Thread Jorn Vernee
x27;s libclang bindings, which use the FFM API, > and thus has a lot of references to `@Restricted` methods. > - tier 1-3 Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: ofInvokeInstruction - Changes: - all: htt

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v10]

2024-06-28 Thread Jorn Vernee
x27;s libclang bindings, which use the FFM API, > and thus has a lot of references to `@Restricted` methods. > - tier 1-3 Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision: use instance resolveAndBind + use junit in tests ---

Re: RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v9]

2024-06-28 Thread Jorn Vernee
On Fri, 28 Jun 2024 16:47:27 GMT, Alan Bateman wrote: >> Jorn Vernee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> de-dupe on path, not module name > > src/jdk.jdeps/share/classes/com/sun/tools/jnativesca

  1   2   3   4   5   6   7   8   9   10   >