Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v21]

2024-10-03 Thread Paul Sandoz
y in a follow-up patch. >> >> [1] https://mail.openjdk.org/pipermail/panama-dev/2024-May/020408.html > > Jatin Bhateja has updated the pull request incrementally with one additional > commit since the last revision: > > Doc fixups src/jdk.incubator.vector/share/classes/jdk/incubator/v

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v20]

2024-10-03 Thread Paul Sandoz
On Thu, 3 Oct 2024 19:13:22 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >>

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

2024-10-02 Thread Paul Sandoz
On Wed, 2 Oct 2024 14:02:19 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: 8338023: Support two vector selectFrom API [v13]

2024-09-30 Thread Paul Sandoz
On Sat, 28 Sep 2024 17:37:10 GMT, Sandhya Viswanathan wrote: >> Jatin Bhateja has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Handling NPOT vector length for AArch64 SVE with vector sizes varying b/w >> 128 and 2048 bits at 128 bit inc

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v17]

2024-09-24 Thread Paul Sandoz
On Thu, 19 Sep 2024 06:53:15 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation

2024-09-19 Thread Paul Sandoz
On Tue, 17 Sep 2024 16:13:55 GMT, Quan Anh Mai wrote: > Hi, > > This is just a redo of https://github.com/openjdk/jdk/pull/13093. mostly just > the revert of the backout. > > Regarding the related issues: > > - [JDK-8306008](https://bugs.openjdk.org/browse/JDK-8306008) and > [JDK-8309531](ht

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation

2024-09-18 Thread Paul Sandoz
On Tue, 17 Sep 2024 16:13:55 GMT, Quan Anh Mai wrote: > Hi, > > This is just a redo of https://github.com/openjdk/jdk/pull/13093. mostly just > the revert of the backout. > > Regarding the related issues: > > - [JDK-8306008](https://bugs.openjdk.org/browse/JDK-8306008) and > [JDK-8309531](ht

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v15]

2024-09-18 Thread Paul Sandoz
On Wed, 18 Sep 2024 16:22:30 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >>

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v13]

2024-09-18 Thread Paul Sandoz
On Wed, 18 Sep 2024 14:22:16 GMT, Emanuel Peter wrote: > > > Why is this even called `VectorMath`? Because those ops are not at all > > > restricted to vectorization, right? > > > > > > Nomenclature is suggested by Paul. > > @PaulSandoz Do you want to limit these **scalar** operations to a cl

Re: RFR: 8310691: [REDO] [vectorapi] Refactor VectorShuffle implementation

2024-09-18 Thread Paul Sandoz
On Tue, 17 Sep 2024 16:59:07 GMT, Quan Anh Mai wrote: > @PaulSandoz What do you think regarding x86-32? I don't see anything obvious in the changes of this PR that would affect x86-32, but i ain't a HotSpot expert. Perhaps this just exacerbates some existing bug?@sviswa7 what do you think? My

Re: RFR: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes

2024-09-17 Thread Paul Sandoz
On Thu, 22 Aug 2024 18:43:56 GMT, Paul Sandoz wrote: > Adding link to UTF-8 decoding use case for convenience and reminder: > https://github.com/AugustNagro/utf8.java/blob/master/src/main/java/com/augustnagro/utf8/Utf8.java. Another related link to base 64 decoding https://github.com/s

Re: RFR: 8338023: Support two vector selectFrom API [v10]

2024-09-17 Thread Paul Sandoz
On Tue, 17 Sep 2024 07:02:12 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template >> line 2974: >> >>> 2972: final $abstractvectortype$ selectFromTemplate(Class>> Vector<$Boxbitstype$>> indexVecClass, >>> 2973:

Re: RFR: 8338023: Support two vector selectFrom API [v10]

2024-09-17 Thread Paul Sandoz
On Tue, 17 Sep 2024 07:02:15 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template >> line 561: >> >>> 559: for (int i = 0; i < vlen; i++) { >>> 560: int index = ((int)vecPayload1[i]); >>> 561: res[i] = in

Re: RFR: 8338023: Support two vector selectFrom API [v10]

2024-09-16 Thread Paul Sandoz
On Mon, 16 Sep 2024 02:58:41 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new two vector permutation APIs. >> >> >> Declaration:- >> Vector.selectFrom(Vector v1, Vector v2) >> >> >> Semantics:- >>

Re: RFR: 8338023: Support two vector selectFrom API [v10]

2024-09-16 Thread Paul Sandoz
On Mon, 16 Sep 2024 02:58:41 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new two vector permutation APIs. >> >> >> Declaration:- >> Vector.selectFrom(Vector v1, Vector v2) >> >> >> Semantics:- >>

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v12]

2024-09-16 Thread Paul Sandoz
On Sat, 14 Sep 2024 08:40:44 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >>

Re: RFR: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes [v2]

2024-09-16 Thread Paul Sandoz
On Fri, 13 Sep 2024 22:30:36 GMT, Sandhya Viswanathan wrote: >> Currently the rearrange and selectFrom APIs check shuffle indices and throw >> IndexOutOfBoundsException if there is any exceptional source index in the >> shuffle. This causes the generated code to be less optimal. This PR modifi

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v10]

2024-09-13 Thread Paul Sandoz
On Fri, 13 Sep 2024 16:20:28 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >>

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v10]

2024-09-13 Thread Paul Sandoz
On Fri, 13 Sep 2024 16:20:28 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> following new vector operators. >> >> >> . SUADD : Saturating unsigned addition. >> . SADD: Saturating signed addition. >>

Re: RFR: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes

2024-09-13 Thread Paul Sandoz
On Mon, 19 Aug 2024 21:47:23 GMT, Sandhya Viswanathan wrote: > Currently the rearrange and selectFrom APIs check shuffle indices and throw > IndexOutOfBoundsException if there is any exceptional source index in the > shuffle. This causes the generated code to be less optimal. This PR modifies

Re: RFR: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes

2024-09-13 Thread Paul Sandoz
On Fri, 13 Sep 2024 18:17:21 GMT, Sandhya Viswanathan wrote: > > The guidance from Paul Sandoz and John Rose is to keep the the partial > wrapping at shuffle construction as is for now and only change the rearrange > and selectFrom apis. Yes, we are trying to take smaller incre

Re: RFR: 8338023: Support two vector selectFrom API [v7]

2024-09-13 Thread Paul Sandoz
On Fri, 6 Sep 2024 18:08:09 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Vector.java line >> 2770: >> >>> 2768: >>> 2769: /** >>> 2770: * Rearranges the lane elements of two vectors, selecting lanes >> >> I have a bit of a name concern here

Re: RFR: 8340079: Modify rearrange/selectFrom Vector API methods to perform wrapIndexes instead of checkIndexes

2024-09-12 Thread Paul Sandoz
On Mon, 19 Aug 2024 21:47:23 GMT, Sandhya Viswanathan wrote: > Currently the rearrange and selectFrom APIs check shuffle indices and throw > IndexOutOfBoundsException if there is any exceptional source index in the > shuffle. This causes the generated code to be less optimal. This PR modifies

Re: RFR: 8339677: [vectorapi] YYYXXXVector::withLaneHelper and laneHelper should use Double::doubleToRawLongBits/Float::floatToRawIntBits

2024-09-09 Thread Paul Sandoz
On Sat, 7 Sep 2024 04:47:36 GMT, Jaikiran Pai wrote: >> Hi, >> >> This patch fixes an issue where we mistakenly use `Double::doubleToLongBits` >> in `DoubleXXXVector::withLaneHelper` and `DoubleXXXVector::laneHelper`. We >> should use the raw bit version instead. >> >> Please kindly review, t

Re: RFR: 8339677: [vectorapi] YYYXXXVector::withLaneHelper and laneHelper should use Double::doubleToRawLongBits/Float::floatToRawIntBits

2024-09-06 Thread Paul Sandoz
On Fri, 6 Sep 2024 18:31:00 GMT, Quan Anh Mai wrote: > Hi, > > This patch fixes an issue where we mistakenly use `Double::doubleToLongBits` > in `DoubleXXXVector::withLaneHelper` and `DoubleXXXVector::laneHelper`. We > should use the raw bit version instead. > > Please kindly review, thanks v

Re: RFR: 8338021: Support new unsigned and saturating vector operators in VectorAPI [v7]

2024-09-06 Thread Paul Sandoz
On Fri, 6 Sep 2024 06:40:18 GMT, Jatin Bhateja wrote: >> src/jdk.incubator.vector/share/classes/jdk/incubator/vector/VectorMathUtils.java >> line 78: >> >>> 76: * @since 24 >>> 77: */ >>> 78: public static long addSaturating(long a, long b) { >> >> Are these public methods any Ja

Re: RFR: 8338967: Improve performance for MemorySegment::fill [v7]

2024-08-28 Thread Paul Sandoz
On Wed, 28 Aug 2024 11:10:05 GMT, Per Minborg wrote: >> The performance of the `MemorySegment::fil` can be improved by replacing the >> `checkAccess()` method call with calling `checkReadOnly()` instead (as the >> bounds of the segment itself do not need to be checked). >> >> Also, smaller seg

Re: RFR: 8338967: Improve performance for MemorySegment::fill [v5]

2024-08-27 Thread Paul Sandoz
On Tue, 27 Aug 2024 10:38:46 GMT, Per Minborg wrote: >> The performance of the `MemorySegment::fil` can be improved by replacing the >> `checkAccess()` method call with calling `checkReadOnly()` instead (as the >> bounds of the segment itself do not need to be checked). >> >> Also, smaller seg

Re: RFR: 8338023: Support two vector selectFrom API [v6]

2024-08-27 Thread Paul Sandoz
On Tue, 27 Aug 2024 09:58:44 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new two vector permutation APIs. >> >> >> Declaration:- >> Vector.selectFrom(Vector v1, Vector v2) >> >> >> Semantics:- >>

Re: RFR: 8338731: MemoryLayout::offsetHandle can return a negative offset

2024-08-26 Thread Paul Sandoz
On Wed, 21 Aug 2024 13:26:58 GMT, Maurizio Cimadamore wrote: > When working on startup improvements, I noticed that the method handle > returned by `MemoryLayout::offsetHandle` can overflow if the client calls the > handle with a base offset that is too big. > > In other similar situations, t

Re: RFR: 8338728: Misc issues in memory layout javadoc [v2]

2024-08-26 Thread Paul Sandoz
On Wed, 21 Aug 2024 13:24:15 GMT, Maurizio Cimadamore wrote: >> This PR fixes two minor issues in the `MemoryLayout` javadoc: >> * the section describing dereference path talks about `P` and `P'` but then >> only uses `P` in the code; >> * the `ceilDiv` math on the `PathElement::sequenceElement

Re: RFR: 8338023: Support two vector selectFrom API [v5]

2024-08-23 Thread Paul Sandoz
On Fri, 23 Aug 2024 06:09:48 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new two vector permutation APIs. >> >> >> Declaration:- >> Vector.selectFrom(Vector v1, Vector v2) >> >> >> Semantics:- >>

Re: RFR: 8338023: Support two vector selectFrom API [v3]

2024-08-21 Thread Paul Sandoz
On Wed, 21 Aug 2024 16:42:44 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> for following new two vector permutation APIs. >> >> >> Declaration:- >> Vector.selectFrom(Vector v1, Vector v2) >> >> >> Semantics:- >>

Re: RFR: 8338021: Support saturating vector operators in VectorAPI [v2]

2024-08-12 Thread Paul Sandoz
On Thu, 8 Aug 2024 17:20:06 GMT, Jatin Bhateja wrote: >> Hi All, >> >> As per the discussion on panama-dev mailing list[1], patch adds the support >> following new vector operators. >> >> >> . SATURATING_UADD : Saturating unsigned addition. >> . SATURATING_ADD: Saturating sig

Re: RFR: 8338023: Support two vector selectFrom API

2024-08-12 Thread Paul Sandoz
On Thu, 8 Aug 2024 06:57:28 GMT, Jatin Bhateja wrote: > Hi All, > > As per the discussion on panama-dev mailing list[1], patch adds the support > for following new two vector permutation APIs. > > > Declaration:- > Vector.selectFrom(Vector v1, Vector v2) > > > Semantics:- > Using in

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

2024-07-03 Thread Paul Sandoz
On Wed, 3 Jul 2024 19:43:05 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. src/hotspot/share/pr

Re: RFR: 8327854: Test java/util/stream/test/org/openjdk/tests/java/util/stream/WhileOpStatefulTest.java failed with RuntimeException

2024-07-01 Thread Paul Sandoz
On Sat, 1 Jun 2024 11:49:39 GMT, Viktor Klang wrote: > This PR improves the test failure output for the failing test case, and the > underlying issue is likely going to be addressed by > https://github.com/openjdk/jdk/pull/19131 /cc @DougLea Marked as reviewed by psandoz (Reviewer). -

Re: RFR: 8335252: Reduce size of j.u.Formatter.Conversion#isValid [v4]

2024-06-28 Thread Paul Sandoz
On Fri, 28 Jun 2024 12:46:49 GMT, Shaojin Wen wrote: >> Currently, the java.util.Formatter$Conversion::isValid method is implemented >> based on switch, which cannot be inlined because codeSize > 325. This >> problem can be avoided by implementing it with ImmutableBitSetPredicate. >> >> use `-

Re: RFR: 8335252: ForceInline j.u.Formatter.Conversion#isValid [v2]

2024-06-27 Thread Paul Sandoz
On Thu, 27 Jun 2024 14:12:36 GMT, Shaojin Wen wrote: >> Currently, the java.util.Formatter$Conversion::isValid method is implemented >> based on switch, which cannot be inlined because codeSize > 325. This >> problem can be avoided by implementing it with ImmutableBitSetPredicate. >> >> use `-

Re: [External] : Gatherer and primitive specialization

2024-06-13 Thread Paul Sandoz
> On Jun 13, 2024, at 8:20 AM, fo...@univ-mlv.fr wrote: > > > > From: "Viktor Klang" > To: "Remi Forax" , "core-libs-dev" > > Sent: Thursday, June 13, 2024 12:52:03 PM > Subject: Re: [External] : Gatherer and primitive specialization > Hi Rémi, > > Given that Collector has not been special

Re: RFR: 8331196: vector api: Remove unnecessary index check in Byte/ShortVector.fromArray/fromArray0Template

2024-05-22 Thread Paul Sandoz
On Fri, 26 Apr 2024 14:06:02 GMT, Hamlin Li wrote: > Hi, > Can you help to review this simple patch? > Some index check in Byte/ShortVector.fromArray/fromArray0Template seems not > necessary, could be removed. > Thanks The intrinsic implementation will not perform bounds checks. I think what yo

Re: RFR: 8331865: Consolidate size and alignment checks in LayoutPath [v3]

2024-05-21 Thread Paul Sandoz
On Tue, 21 May 2024 10:20:27 GMT, Maurizio Cimadamore wrote: >> When creating a nested memory access var handle, we ensure that the segment >> is accessed at the correct alignment for the root layout being accessed. But >> we do not ensure that the segment has at least the size of the accessed

Re: RFR: 8331196: vector api: Remove unnecessary index check in Byte/ShortVector.fromArray/fromArray0Template

2024-05-21 Thread Paul Sandoz
On Mon, 20 May 2024 19:21:44 GMT, Paul Sandoz wrote: >> Hi, >> Can you help to review this simple patch? >> Some index check in Byte/ShortVector.fromArray/fromArray0Template seems not >> necessary, could be removed. >> Thanks > > That does not look correct

Re: RFR: 8331196: vector api: Remove unnecessary index check in Byte/ShortVector.fromArray/fromArray0Template

2024-05-20 Thread Paul Sandoz
On Fri, 26 Apr 2024 14:06:02 GMT, Hamlin Li wrote: > Hi, > Can you help to review this simple patch? > Some index check in Byte/ShortVector.fromArray/fromArray0Template seems not > necessary, could be removed. > Thanks That does not look correct and will only check a prefix indexes. A `ByteVect

Re: RFR: 8332486: ClassFile API ArrayIndexOutOfBoundsException with label metadata

2024-05-20 Thread Paul Sandoz
On Mon, 20 May 2024 08:37:49 GMT, Adam Sotona wrote: > Parsing of a specifically corrupted class file cause unexpected > `ArrayIndexOutOfBoundsException` during label inflation. > This patch checks the valid range and throws expected > `IllegalArgumentException` instead. > Relevant test is adde

Re: RFR: 8331865: Consolidate size and alignment checks in LayoutPath [v2]

2024-05-20 Thread Paul Sandoz
On Mon, 20 May 2024 16:31:18 GMT, Maurizio Cimadamore wrote: > > Ah, got it. You mean more support in VarHandleGuards. Yes, I have a separate > patch for that (actually had that for quite a while), but we're not super > sure how to evaluate what impact it has :-) Ah, i did not realize that.

Re: RFR: 8331865: Consolidate size and alignment checks in LayoutPath [v2]

2024-05-17 Thread Paul Sandoz
On Thu, 16 May 2024 14:37:15 GMT, Maurizio Cimadamore wrote: >> When creating a nested memory access var handle, we ensure that the segment >> is accessed at the correct alignment for the root layout being accessed. But >> we do not ensure that the segment has at least the size of the accessed

Re: RFR: 8331865: Consolidate size and alignment checks in LayoutPath [v2]

2024-05-17 Thread Paul Sandoz
On Thu, 16 May 2024 14:37:15 GMT, Maurizio Cimadamore wrote: >> When creating a nested memory access var handle, we ensure that the segment >> is accessed at the correct alignment for the root layout being accessed. But >> we do not ensure that the segment has at least the size of the accessed

Re: RFR: 8331940: ClassFile API ArrayIndexOutOfBoundsException with certain class files [v2]

2024-05-15 Thread Paul Sandoz
On Wed, 15 May 2024 07:51:33 GMT, Adam Sotona wrote: >> Class file with `LineNumberTable` attribute element pointing behind the >> bytecode array throws `ArrayIndexOutOfBoundsException`. >> This patch performs the check and throws expected >> `IllegalArgumentException` instead. >> Relevant tes

Re: RFR: 8331940: ClassFile API ArrayIndexOutOfBoundsException with certain class files

2024-05-14 Thread Paul Sandoz
On Tue, 14 May 2024 13:18:51 GMT, Adam Sotona wrote: > Class file with `LineNumberTable` attribute element pointing behind the > bytecode array throws `ArrayIndexOutOfBoundsException`. > This patch performs the check and throws expected `IllegalArgumentException` > instead. > Relevant test is

Re: RFR: 8332003: Clarify javadoc for MemoryLayout::offsetHandle [v5]

2024-05-10 Thread Paul Sandoz
On Fri, 10 May 2024 16:10:29 GMT, Maurizio Cimadamore wrote: >> Consider this layout: >> >> >> MemoryLayout SEQ = MemoryLayout.sequenceLayout(5, >> MemoryLayout.sequenceLayout(10, JAVA_INT)); >> >> >> And the corresponding offset handle: >> >> >> MethodHandle offsetHandle = SE

Re: RFR: 8332003: Clarify javadoc for MemoryLayout::offsetHandle [v2]

2024-05-09 Thread Paul Sandoz
On Thu, 9 May 2024 18:26:17 GMT, Maurizio Cimadamore wrote: >> Consider this layout: >> >> >> MemoryLayout SEQ = MemoryLayout.sequenceLayout(5, >> MemoryLayout.sequenceLayout(10, JAVA_INT)); >> >> >> And the corresponding offset handle: >> >> >> MethodHandle offsetHandle = SEQ

Re: RFR: 8331734: Atomic MemorySegment VarHandle operations fails for element layouts

2024-05-07 Thread Paul Sandoz
On Tue, 7 May 2024 15:42:23 GMT, Maurizio Cimadamore wrote: > This PR fixes an issue that has crept into the FFM API implementation. > > From very early stages, the FFM API used to disable the alignment check on > nested layout elements, in favor of an alignment check against the memory > seg

Re: RFR: 8048691: Spliterator.SORTED characteristics gets cleared for BaseStream.spliterator

2024-05-07 Thread Paul Sandoz
On Tue, 7 May 2024 14:58:00 GMT, Viktor Klang wrote: > Removes SORTED if not also ORDERED for escape-hatch `Stream::spliterator()` Marked as reviewed by psandoz (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/19123#pullrequestreview-2043897612

Re: RFR: 8331655: ClassFile API ClassCastException with verbose output of certain class files [v2]

2024-05-03 Thread Paul Sandoz
On Fri, 3 May 2024 17:13:04 GMT, Adam Sotona wrote: >> Specifically corrupted constant pool of a class file can cause >> ClassCastException, when the entries are accessed by Class-File API in exact >> order. >> >> This fix avoids the ClassCastException and throws ConstantPoolException >> inst

Re: RFR: 8331655: ClassFile API ClassCastException with verbose output of certain class files

2024-05-03 Thread Paul Sandoz
On Fri, 3 May 2024 15:28:05 GMT, Adam Sotona wrote: > Specifically corrupted constant pool of a class file can cause > ClassCastException, when the entries are accessed by Class-File API in exact > order. > > This fix avoids the ClassCastException and throws ConstantPoolException > instead. >

Re: RFR: 8331320: ClassFile API OutOfMemoryError with certain class files [v2]

2024-05-02 Thread Paul Sandoz
On Thu, 2 May 2024 11:13:22 GMT, Adam Sotona wrote: >> Class files with specifically corrupted tableswitch or lookupswitch >> instructions in the bytecode cause OutOfMemoryError while parsing with >> Class-File API. >> This patch performs additional checks to avoid OOME and adds relevant tests.

Re: RFR: 8331320: ClassFile API OutOfMemoryError with certain class files

2024-04-30 Thread Paul Sandoz
On Tue, 30 Apr 2024 15:31:02 GMT, Adam Sotona wrote: > Class files with specifically corrupted tableswitch or lookupswitch > instructions in the bytecode cause OutOfMemoryError while parsing with > Class-File API. > This patch performs additional checks to avoid OOME and adds relevant tests. >

Re: RFR: 8330684: ClassFile API runs into StackOverflowError while parsing certain class' bytes [v3]

2024-04-26 Thread Paul Sandoz
On Fri, 26 Apr 2024 13:34:08 GMT, Adam Sotona wrote: >> ClassFile API dives into the nested constant pool entries without type >> restrictions, while parsing a class file. Validation of the entry is >> performed post-parsing. Specifically corrupted constant pool entry may cause >> infinite loo

Re: RFR: 8322847: java.lang.classfile.BufWriter should specify @throws for its writeXXX methods

2024-04-25 Thread Paul Sandoz
On Tue, 23 Apr 2024 11:56:41 GMT, Adam Sotona wrote: > This patch adds missing `@throws` javadoc annotations to > `java.lang.classfile.BufWriter`. > > Please review. > > Thank you, > Adam Marked as reviewed by psandoz (Reviewer). - PR Review: https://git.openjdk.org/jdk/pull/189

Re: RFR: 8330684: ClassFile API runs into StackOverflowError while parsing certain class' bytes

2024-04-25 Thread Paul Sandoz
On Thu, 25 Apr 2024 00:51:41 GMT, Adam Sotona wrote: > Unfortunately it would have to be an expected tags list or an extra > constructed bit mask, due to the multiple tags allowed for MemberRefEntry and > it would slightly affect the performance. Ah yes, i missed that. It could be two tags, a

Re: RFR: 8325373: Improve StackCounter error reporting for bad switch cases

2024-04-24 Thread Paul Sandoz
On Tue, 23 Apr 2024 12:59:18 GMT, Adam Sotona wrote: > ClassFile API `StackMapGenerator` attaches print or hex dump of the method to > an error message. > However there is no such attachment when the stack maps generation is turned > off. > > This patch moves class print/dump to `impl.Util::d

Re: RFR: 8322847: java.lang.classfile.BufWriter should specify @throws for its writeXXX methods

2024-04-24 Thread Paul Sandoz
On Tue, 23 Apr 2024 11:56:41 GMT, Adam Sotona wrote: > This patch adds missing `@throws` javadoc annotations to > `java.lang.classfile.BufWriter`. > > Please review. > > Thank you, > Adam This looks good, but for completeness it will need a CSR. - PR Review: https://git.openjdk.

Re: RFR: 8330684: ClassFile API runs into StackOverflowError while parsing certain class' bytes

2024-04-24 Thread Paul Sandoz
On Tue, 23 Apr 2024 07:39:47 GMT, Adam Sotona wrote: > ClassFile API dives into the nested constant pool entries without type > restrictions, while parsing a class file. Validation of the entry is > performed post-parsing. Specifically corrupted constant pool entry may cause > infinite loop du

Re: Vector (and integer) API: unsigned min/max

2024-04-18 Thread Paul Sandoz
Hi David, It’s not at all outlandish, but would caution it's more work than one might initially think. Could you describe a little more about your use case? that can be helpful to understand the larger picture and demand. Using unsigned comparison would be my recommended approach with the curr

Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v3]

2024-04-17 Thread Paul Sandoz
On Wed, 17 Apr 2024 16:08:31 GMT, Adam Sotona wrote: >> Current implementation of `LambdaMetafactory` does not allow to use lambdas >> in hidden classes. Invocation throws `NoClassDefFoundError` instead. >> >> This patch includes lambda implementation in a hidden class under the >> special han

Re: RFR: 8330467: NoClassDefFoundError when lambda is in a hidden class [v2]

2024-04-17 Thread Paul Sandoz
On Wed, 17 Apr 2024 12:51:55 GMT, Adam Sotona wrote: >> Current implementation of `LambdaMetafactory` does not allow to use lambdas >> in hidden classes. Invocation throws `NoClassDefFoundError` instead. >> >> This patch includes lambda implementation in a hidden class under the >> special han

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v8]

2024-04-15 Thread Paul Sandoz
On Sat, 13 Apr 2024 14:27:12 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v7]

2024-04-12 Thread Paul Sandoz
On Fri, 12 Apr 2024 14:53:01 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams [v2]

2024-04-09 Thread Paul Sandoz
On Tue, 9 Apr 2024 10:07:46 GMT, Viktor Klang wrote: >> This PR implements Gatherer-inspired encoding of `flatMap` that shows that >> it is both competitive performance-wise as well as improve correctness. >> >> Below is the performance of `Stream::flatMap` (for reference types): >> >> Before

Re: RFR: 8196106: Support nested infinite or recursive flat mapped streams

2024-04-09 Thread Paul Sandoz
On Mon, 8 Apr 2024 10:20:11 GMT, Viktor Klang wrote: > @PaulSandoz @AlanBateman I've added a commit to this PR which removes the use > of Gatherer for Stream::flatMap, but instead implements flatMap for all of > the pipelines using the same encoding which Gatherer would use. It seems very > co

Re: RFR: 8325659: Normalize Random usage by incubator vector tests

2024-04-08 Thread Paul Sandoz
On Mon, 8 Apr 2024 10:50:00 GMT, Evgeny Nikitin wrote: > Improve RNG usage in said tests: > > 1. The RNG is not created by our Utils class, as suggested in our JTReg tests; > 2. The seed, accordingly, is not a fixed value now, but truly random; > 3. The tests that had been creating their own Ran

Re: RFR: 8328316: Finisher cannot emit if stream is sequential and integrator returned false [v4]

2024-03-21 Thread Paul Sandoz
On Wed, 20 Mar 2024 23:58:32 GMT, Viktor Klang wrote: >> Adds differentiation between direct and transitive short circuiting which >> could prevent pushing downstream in the finisher for built-ins that were not >> `collect()`. >> >> Creating this as a draft PR for now, just need to run some be

Re: RFR: 8328316: Finisher cannot emit if stream is sequential and integrator returned false

2024-03-20 Thread Paul Sandoz
On Mon, 18 Mar 2024 16:27:13 GMT, Viktor Klang wrote: > Adds differentiation between direct and transitive short circuiting which > could prevent pushing downstream in the finisher for built-ins that were not > `collect()`. > > Creating this as a draft PR for now, just need to run some benchma

Re: RFR: 8318650: Optimized subword gather for x86 targets. [v17]

2024-03-04 Thread Paul Sandoz
On Sat, 2 Mar 2024 16:22:22 GMT, Jatin Bhateja wrote: >> Hi All, >> >> This patch optimizes sub-word gather operation for x86 targets with AVX2 and >> AVX512 features. >> >> Following is the summary of changes:- >> >> 1) Intrinsify sub-word gather using hybrid algorithm which initially >> pa

Re: RFR: 8318650: Optimized subword gather for x86 targets. [v16]

2024-02-27 Thread Paul Sandoz
On Tue, 27 Feb 2024 02:47:13 GMT, Jatin Bhateja wrote: >> Hi All, >> >> This patch optimizes sub-word gather operation for x86 targets with AVX2 and >> AVX512 features. >> >> Following is the summary of changes:- >> >> 1) Intrinsify sub-word gather using hybrid algorithm which initially >> p

Re: [jdk22] RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-07 Thread Paul Sandoz
On Wed, 7 Feb 2024 09:13:33 GMT, Aleksey Shipilev wrote: > Looks fine. Thanks! - PR Comment: https://git.openjdk.org/jdk22/pull/109#issuecomment-1932769043

[jdk22] Integrated: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-07 Thread Paul Sandoz
On Tue, 6 Feb 2024 16:50:10 GMT, Paul Sandoz wrote: > This pull request contains a backport of commit > [1ae85138](https://github.com/openjdk/jdk/commit/1ae851387f881263ccc6aeace5afdd0f49d41d33) > from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. > > The commit b

[jdk22] RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-06 Thread Paul Sandoz
This pull request contains a backport of commit [1ae85138](https://github.com/openjdk/jdk/commit/1ae851387f881263ccc6aeace5afdd0f49d41d33) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. The commit being backported was authored by Paul Sandoz on 2 Feb 2024 and was reviewed by

Re: RFR: 8323058: Revisit j.l.classfile.CodeBuilder API surface [v2]

2024-02-05 Thread Paul Sandoz
On Mon, 5 Feb 2024 18:31:44 GMT, Adam Sotona wrote: >> `java.lang.classfile.CodeBuilder` contains more than 230 API methods. >> Existing ClassFile API use cases proved the concept one big CodeBuilder is >> comfortable. However there are some redundancies, glitches in the naming >> conventions,

Integrated: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-02-02 Thread Paul Sandoz
On Mon, 29 Jan 2024 19:45:41 GMT, Paul Sandoz wrote: > The implementation of method `VectorSpecies::fromMemorySegment`, in > `AbstractSpecies::fromMemorySegment`, neglects to perform bounds checks on > the offset argument when the method is compiled by C2 (bounds checks are > pe

Re: RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments [v2]

2024-02-01 Thread Paul Sandoz
On Thu, 1 Feb 2024 12:22:10 GMT, Maurizio Cimadamore wrote: >> My expectation is the risk is small, but of course non-zero. These tests can >> be expensive to run so i was trying balance the risk without increasing test >> execution times. >> >> I could strengthen the comment from: >> >>

Re: RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments [v2]

2024-02-01 Thread Paul Sandoz
possible in the knowledge that it calls the vector access method (the > tests were intended to test out of bounds access when compiled by C2). > > Thinking ahead its tempting to remove the species access methods, simplifying > functionality that is duplicated. Paul Sandoz has upd

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2024-02-01 Thread Paul Sandoz
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8318650: Optimized subword gather for x86 targets. [v11]

2024-01-31 Thread Paul Sandoz
On Wed, 31 Jan 2024 23:53:16 GMT, Sandhya Viswanathan wrote: >> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 1613: >> >>> 1611: vpand(xtmp, idx_vec, xtmp, vlen_enc); >>> 1612: // Load double words from normalized indices. >>> 1613: evpgatherdd(dst, gmask, Address(base, xtmp, scale),

Re: RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-01-30 Thread Paul Sandoz
On Wed, 31 Jan 2024 00:10:26 GMT, Maurizio Cimadamore wrote: >> The implementation of method `VectorSpecies::fromMemorySegment`, in >> `AbstractSpecies::fromMemorySegment`, neglects to perform bounds checks on >> the offset argument when the method is compiled by C2 (bounds checks are >> perf

RFR: 8324858: [vectorapi] Bounds checking issues when accessing memory segments

2024-01-29 Thread Paul Sandoz
The implementation of method `VectorSpecies::fromMemorySegment`, in `AbstractSpecies::fromMemorySegment`, neglects to perform bounds checks on the offset argument when the method is compiled by C2 (bounds checks are performed when interpreted and by C1). This is an oversight and explicit bounds

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

2024-01-24 Thread Paul Sandoz
On Wed, 24 Jan 2024 18:48:34 GMT, Aleksey Shipilev wrote: >> @dholmes-ora Indeed it's a compiler magic, albeit not really weird. While >> the method execution only receives the evaluated value of `expr`, the method >> compilation has the expression in its original form. As a result, it can >>

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

2024-01-23 Thread Paul Sandoz
On Tue, 23 Jan 2024 17:21:47 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: 8316641: VarHandle template classes can share code in the base class [v8]

2023-12-04 Thread Paul Sandoz
On Mon, 4 Dec 2023 14:58:34 GMT, Jorn Vernee wrote: >> src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template >> line 594: >> >>> 592: @ForceInline >>> 593: static int indexRO(ByteBuffer bb, int index) { >>> 594: if (bb.isReadOnly()) >>

Re: RFR: 8321223: Implementation of Scoped Values (Second Preview)

2023-12-03 Thread Paul Sandoz
On Sun, 3 Dec 2023 08:46:07 GMT, Alan Bateman wrote: > This API is sitting out JDK 22, meaning no API/implementation changes in this > PR. Some small API changes are likely for JDK 23. > > For now, we just need to bump JEP number/title that shows up in the preview > section of the javadoc. Ma

Re: RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v3]

2023-11-22 Thread Paul Sandoz
On Wed, 22 Nov 2023 09:05:31 GMT, Andrew Haley wrote: > > Have you considered the possibility of copying the sleef source to the > > OpenJDK repository and thereby it becomes part of the build process? I > > don't know how straightforward that is technically and IANAL but I think > > it's wort

Re: RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v3]

2023-11-21 Thread Paul Sandoz
On Wed, 15 Nov 2023 01:32:00 GMT, Xiaohong Gong wrote: >> Currently the vector floating-point math APIs like >> `VectorOperators.SIN/COS/TAN...` are not intrinsified on AArch64 platform, >> which causes large performance gap on AArch64. Note that those APIs are >> optimized by C2 compiler on X

Re: RFR: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF [v3]

2023-11-21 Thread Paul Sandoz
On Mon, 23 Oct 2023 09:02:35 GMT, Xiaohong Gong wrote: > This looks good. As far as I can tell the choice you've made of accuracy > matches what we need to meet the spec. Same here . Sinh/cosh/tanh/expm1 are specified to be within 2.5 ulps of the exact result, but i believe sleef does not off

Re: RFR: 8318966: Some methods make promises about Java array element alignment that are too strong

2023-11-16 Thread Paul Sandoz
On Wed, 15 Nov 2023 22:46:03 GMT, Jorn Vernee wrote: > See the JBS issue for an extended problem description. > > This patch changes the specification and implementation of > `MethodHandles::byteArrayViewVarHandle`, > `MethodHandles::byteBufferViewVarHandle`, `ByteBuffer::alignedSlice`, and >

Re: RFR: 8319123: Implement JEP 461: Stream Gatherers (Preview) [v9]

2023-11-15 Thread Paul Sandoz
On Wed, 15 Nov 2023 17:50:48 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > Viktor Klang has updated the pull request incrementally with one additional > commit since the last revision: > > Improvements after feedback Elegantly and thorou

Re: RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview) [v5]

2023-11-13 Thread Paul Sandoz
On Mon, 13 Nov 2023 09:22:13 GMT, Viktor Klang wrote: >> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461) > > Viktor Klang has updated the pull request incrementally with one additional > commit since the last revision: > > Minor improvements to Gatherer Javadoc src/java.

Re: RFR: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch

2023-11-07 Thread Paul Sandoz
On Tue, 7 Nov 2023 17:45:36 GMT, Paul Sandoz wrote: >> This test requires certain methods to be compiled, but without `-Xbatch` the >> compiler races against the test code, which can lead to intermittent >> failures. > > Marked as reviewed by psandoz (Reviewer). >

Re: RFR: 8315680: java/lang/ref/ReachabilityFenceTest.java should run with -Xbatch

2023-11-07 Thread Paul Sandoz
On Tue, 3 Oct 2023 07:47:30 GMT, Gergö Barany wrote: > This test requires certain methods to be compiled, but without `-Xbatch` the > compiler races against the test code, which can lead to intermittent failures. Marked as reviewed by psandoz (Reviewer). - PR Review: https://git.o

Re: RFR: 8318678: Vector access on heap MemorySegments only works for byte[] [v3]

2023-10-30 Thread Paul Sandoz
On Mon, 30 Oct 2023 13:43:13 GMT, Per Minborg wrote: >> This PR proposes removing the restriction that only heap `MemorySegment` >> wrapping a `byte` array can be accessed by Vectors. Now any array type can >> be used provided the element alignment constraints are respected. > > Per Minborg has

  1   2   3   4   >