Integrated: 8332547: Unloaded signature classes in DirectMethodHandles

2024-06-03 Thread Vladimir Ivanov
On Mon, 20 May 2024 21:29:20 GMT, Vladimir Ivanov wrote: > JVM routinely installs loader constraints for unloaded signature classes when > method resolution takes place. MethodHandle resolution took a different route > and eagerly resolves signature classes ins

Re: RFR: 8332547: Unloaded signature classes in DirectMethodHandles [v2]

2024-06-03 Thread Vladimir Ivanov
On Mon, 3 Jun 2024 19:36:58 GMT, Vladimir Ivanov wrote: >> JVM routinely installs loader constraints for unloaded signature classes >> when method resolution takes place. MethodHandle resolution took a different >> route and eagerly resolves signature cl

Re: RFR: 8332547: Unloaded signature classes in DirectMethodHandles [v2]

2024-06-03 Thread Vladimir Ivanov
f arguments), but > `MethodHandle` construction step is not performance critical. > > Testing: hs-tier1 - hs-tier4 Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision: Renaming: isTypeVisible -> ensureTypeVisible ---

Re: RFR: 8332547: Unloaded signature classes in DirectMethodHandles

2024-06-03 Thread Vladimir Ivanov
On Tue, 21 May 2024 20:14:41 GMT, Jorn Vernee wrote: >> Class loading triggered by `Class.forName()` call is at the core of >> `isTypeVisible`. (The rest is fast path checks.) It's what makes >> `isTypeVisible` query idempotent. >> >> I can definitely name it differently (e.g,

Re: RFR: 8332547: Unloaded signature classes in DirectMethodHandles

2024-05-21 Thread Vladimir Ivanov
On Mon, 20 May 2024 21:29:20 GMT, Vladimir Ivanov wrote: > JVM routinely installs loader constraints for unloaded signature classes when > method resolution takes place. MethodHandle resolution took a different route > and eagerly resolves signature classes ins

RFR: 8332547: Unloaded signature classes in DirectMethodHandles

2024-05-20 Thread Vladimir Ivanov
JVM routinely installs loader constraints for unloaded signature classes when method resolution takes place. MethodHandle resolution took a different route and eagerly resolves signature classes instead (see `java.lang.invoke.MemberName$Factory::resolve` and

Re: RFR: 8324433: Introduce a way to determine if an expression is evaluated as a constant by the Jit compiler [v7]

2024-01-28 Thread Vladimir Ivanov
On Thu, 25 Jan 2024 14:01:59 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch introduces `JitCompiler::isConstantExpression` which can be used >> to statically determine whether an expression has been constant-folded by >> the Jit compiler, leading to more constant-folding opportunities. For

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v14]

2023-11-13 Thread Vladimir Ivanov
On Mon, 13 Nov 2023 12:51:36 GMT, Jorn Vernee wrote: >> Add the ability to pass heap segments to native code. This requires using >> `Linker.Option.critical(true)` as a linker option. It has the same >> limitations as normal critical calls, namely: upcalls into Java are not >> allowed, and

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v11]

2023-11-08 Thread Vladimir Ivanov
On Sat, 21 Oct 2023 12:04:10 GMT, Jorn Vernee wrote: >> Add the ability to pass heap segments to native code. This requires using >> `Linker.Option.critical(true)` as a linker option. It has the same >> limitations as normal critical calls, namely: upcalls into Java are not >> allowed, and

Re: RFR: 8254693: Add Panama feature to pass heap segments to native code [v12]

2023-11-08 Thread Vladimir Ivanov
On Tue, 24 Oct 2023 15:09:57 GMT, Jorn Vernee wrote: >> Add the ability to pass heap segments to native code. This requires using >> `Linker.Option.critical(true)` as a linker option. It has the same >> limitations as normal critical calls, namely: upcalls into Java are not >> allowed, and

Re: RFR: 8317763: Follow-up to AVX512 intrinsics for Arrays.sort() PR [v5]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 20:58:23 GMT, Srinivas Vamsi Parasa wrote: >> The goal of this PR is to address the follow-up comments to the SIMD >> accelerated sort PR (#14227) which implemented AVX512 intrinsics for >> Arrays.sort() methods. >> The proposed changes are: >> >> 1) Restriction of the

Re: RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v42]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 23:38:05 GMT, Sandhya Viswanathan wrote: >> Also, for on-heap case the fallback implementation is equivalent to >> intrinsified case only when offset points at the 0th element of the array. > > @iwanowww Yes, you are late to the party :). The fallback implementation >

Re: RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v42]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 23:25:22 GMT, Vladimir Ivanov wrote: >> Srinivas Vamsi Parasa has updated the pull request with a new target base >> due to a merge or a rebase. The pull request now contains 45 commits: >> >> - fix code style and formatting >> -

Re: RFR: 8309130: x86_64 AVX512 intrinsics for Arrays.sort methods (int, long, float and double arrays) [v42]

2023-10-11 Thread Vladimir Ivanov
On Thu, 5 Oct 2023 23:36:48 GMT, Srinivas Vamsi Parasa wrote: >> The goal is to develop faster sort routines for x86_64 CPUs by taking >> advantage of AVX512 instructions. This enhancement provides an order of >> magnitude speedup for Arrays.sort() using int, long, float and double arrays. >>

Re: RFR: 8317763: Follow-up to AVX512 intrinsics for Arrays.sort() PR [v5]

2023-10-11 Thread Vladimir Ivanov
On Wed, 11 Oct 2023 20:58:23 GMT, Srinivas Vamsi Parasa wrote: >> The goal of this PR is to address the follow-up comments to the SIMD >> accelerated sort PR (#14227) which implemented AVX512 intrinsics for >> Arrays.sort() methods. >> The proposed changes are: >> >> 1) Restriction of the

Re: RFR: 8313406: nep_invoker_blob can be simplified more

2023-08-14 Thread Vladimir Ivanov
On Mon, 31 Jul 2023 12:22:00 GMT, Yasumasa Suenaga wrote: > In FFM, native function would be called via `nep_invoker_blob`. If the > function has two arguments, it would be following: > > > Decoding RuntimeStub - nep_invoker_blob 0x7fcae394cd10 >

Re: RFR: 8313023: Return value corrupted when using CCS + isTrivial (mainline)

2023-07-28 Thread Vladimir Ivanov
On Tue, 25 Jul 2023 19:17:38 GMT, Jorn Vernee wrote: > Port of: https://github.com/openjdk/panama-foreign/pull/848 from the > panama-foreign repo. > > Copying the PR body here for convenience: > > Due to a bug in the downcall linker stub generation, we don't save the return > value when

Re: RFR: 8303762: [vectorapi] Intrinsification of Vector.slice [v6]

2023-04-11 Thread Vladimir Ivanov
On Tue, 4 Apr 2023 13:46:12 GMT, Quan Anh Mai wrote: >> `Vector::slice` is a method at the top-level class of the Vector API that >> concatenates the 2 inputs into an intermediate composite and extracts a >> window equal to the size of the inputs into the result. It is used in vector >>

Re: RFR: 8304450: [vectorapi] Refactor VectorShuffle implementation [v7]

2023-04-11 Thread Vladimir Ivanov
On Fri, 7 Apr 2023 17:13:50 GMT, Quan Anh Mai wrote: >> Hi, >> >> This patch reimplements `VectorShuffle` implementations to be a vector of >> the bit type. Currently, VectorShuffle is stored as a byte array, and would >> be expanded upon usage. This poses several drawbacks: >> >> 1.

Re: RFR: 8304265: Implementation of Foreign Function and Memory API (Third Preview) [v20]

2023-04-11 Thread Vladimir Ivanov
On Thu, 6 Apr 2023 10:54:18 GMT, Per Minborg wrote: >> API changes for the FFM API (third preview) >> >> Specdiff: >> https://cr.openjdk.org/~pminborg/panama/21/v1/specdiff/overview-summary.html >> >> Javadoc: >>

Re: RFR: 8304303: implement VirtualThread class notifyJvmti methods as C2 intrinsics [v4]

2023-03-17 Thread Vladimir Ivanov
On Fri, 17 Mar 2023 10:31:46 GMT, Serguei Spitsyn wrote: >> This is needed for performance improvements in support of virtual threads. >> The update includes the following: >> >> 1. Refactored the `VirtualThread` native methods: >> `notifyJvmtiMountBegin` and `notifyJvmtiMountEnd`

Re: RFR: 8303022: "assert(allocates2(pc)) failed: not in CodeBuffer memory" When linking downcall handle [v3]

2023-03-15 Thread Vladimir Ivanov
On Fri, 10 Mar 2023 14:14:55 GMT, Jorn Vernee wrote: >> The issue is that the size of the code buffer is not large enough to hold >> the whole stub. >> >> Proposed solution is to scale the size of the stub with the number of >> arguments. I've adjusted sizes for both downcall and upcall

Re: RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter [v5]

2023-03-08 Thread Vladimir Ivanov
On Wed, 8 Mar 2023 23:14:05 GMT, Vladimir Kozlov wrote: >> Implemented `Float.floatToFloat16` and `Float.float16ToFloat` intrinsics in >> Interpreter and C1 compiler to produce the same results as C2 intrinsics on >> x64, Aarch64 and RISC-V - all platforms where C2 intrinsics for these Java

Re: RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter [v4]

2023-03-08 Thread Vladimir Ivanov
On Wed, 8 Mar 2023 21:41:31 GMT, Vladimir Ivanov wrote: > Or encapsulate the constant folding logic (along with the guard) into > SharedRuntime and return Type* (instead of int/float scalar). I take this particular suggestion back. `SharedRuntime` is compiler-agnostic while `Type`

Re: RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter [v4]

2023-03-08 Thread Vladimir Ivanov
On Wed, 8 Mar 2023 20:55:29 GMT, Vladimir Kozlov wrote: >> src/hotspot/share/opto/convertnode.cpp line 171: >> >>> 169: if (t == Type::TOP) return Type::TOP; >>> 170: if (t == Type::FLOAT) return TypeInt::SHORT; >>> 171: if (StubRoutines::f2hf() == nullptr) return bottom_type(); >> >>

Re: RFR: 8302976: C2 intrinsification of Float.floatToFloat16 and Float.float16ToFloat yields different result than the interpreter [v4]

2023-03-08 Thread Vladimir Ivanov
On Wed, 8 Mar 2023 05:17:53 GMT, Vladimir Kozlov wrote: >> Implemented `Float.floatToFloat16` and `Float.float16ToFloat` intrinsics in >> Interpreter and C1 compiler to produce the same results as C2 intrinsics on >> x64, Aarch64 and RISC-V - all platforms where C2 intrinsics for these Java

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v20]

2023-01-17 Thread Vladimir Ivanov
On Mon, 16 Jan 2023 23:28:37 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify >> polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` >> method. To make this work I've harmonized how they

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v18]

2023-01-11 Thread Vladimir Ivanov
On Mon, 9 Jan 2023 16:49:25 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify >> polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` >> method. To make this work I've harmonized how they

Re: RFR: 8296477: Foreign linker implementation update following JEP 434 [v7]

2022-11-21 Thread Vladimir Ivanov
On Fri, 18 Nov 2022 14:54:52 GMT, Jorn Vernee wrote: >> Pull in linker implementation changes, that include non-trivial changes to >> VM code, from the panama-foreign repo into the main JDK. >> >> This is split off from the main JEP integration to make reviewing easier. >> >> This includes

Re: RFR: 8296477: Foreign linker implementation update following JEP 434 [v4]

2022-11-14 Thread Vladimir Ivanov
On Thu, 10 Nov 2022 16:48:19 GMT, Jorn Vernee wrote: >> Pull in linker implementation changes, that include non-trivial changes to >> VM code, from the panama-foreign repo into the main JDK. >> >> This is split off from the main JEP integration to make reviewing easier. >> >> This includes

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-14 Thread Vladimir Ivanov
On Sun, 13 Nov 2022 21:08:53 GMT, Claes Redestad wrote: > How far off is this ...? Back then it looked way too constrained (tight constraints on code shapes). But I considered it as a generally applicable optimization. > ... do you think it'll be able to match the efficiency we see here

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-14 Thread Vladimir Ivanov
On Sun, 13 Nov 2022 19:50:46 GMT, Claes Redestad wrote: > ... several challenges were brought up to the table, including how to deal > with all the different contingencies that might be the result of a safepoint, > including deoptimization. FTR if the intrinsic is represented as a stand-alone

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-14 Thread Vladimir Ivanov
On Sun, 13 Nov 2022 21:01:21 GMT, Claes Redestad wrote: >> src/hotspot/share/opto/intrinsicnode.hpp line 175: >> >>> 173: // as well as adjusting for special treatment of various encoding of >>> String >>> 174: // arrays. Must correspond to declared constants in >>>

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-11 Thread Vladimir Ivanov
On Fri, 11 Nov 2022 13:00:06 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify >> polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` >> method. To make this work I've harmonized how they

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-11 Thread Vladimir Ivanov
On Sat, 12 Nov 2022 00:55:56 GMT, Vladimir Ivanov wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Missing & 0xff in StringLatin1::hashCode > > src/hotspot/cpu/x86/x86_64.ad

Re: RFR: 8282664: Unroll by hand StringUTF16 and StringLatin1 polynomial hash loops [v13]

2022-11-11 Thread Vladimir Ivanov
On Fri, 11 Nov 2022 13:00:06 GMT, Claes Redestad wrote: >> Continuing the work initiated by @luhenry to unroll and then intrinsify >> polynomial hash loops. >> >> I've rewired the library changes to route via a single `@IntrinsicCandidate` >> method. To make this work I've harmonized how they

Re: RFR: JDK-8285932 Implementation of JEP-430 String Templates (Preview) [v11]

2022-11-02 Thread Vladimir Ivanov
On Wed, 2 Nov 2022 19:44:00 GMT, Jim Laskey wrote: >> Enhance the Java programming language with string templates, which are >> similar to string literals but contain embedded expressions. A string >> template is interpreted at run time by replacing each expression with the >> result of

Re: RFR: 8295302: Do not use ArrayList when LambdaForm has a single ClassData [v2]

2022-10-13 Thread Vladimir Ivanov
On Fri, 14 Oct 2022 04:37:22 GMT, Ioi Lam wrote: >> Please review this small optimization. As shown in the JBS issue, most of >> the generated LambdaForm classes have a single ClassData, so we can get a >> small footprint/speed improvement. > > Ioi Lam has updated the pull request

Re: RFR: 8295302: Do not use ArrayList when LambdaForm has a single ClassData

2022-10-13 Thread Vladimir Ivanov
On Thu, 13 Oct 2022 21:53:47 GMT, Ioi Lam wrote: > Please review this small optimization. As shown in the JBS issue, most of the > generated LambdaForm classes have a single ClassData, so we can get a small > footprint/speed improvement.