Integrated: 8281146: Replace StringCoding.hasNegatives with countPositives

2022-03-17 Thread Claes Redestad
On Wed, 26 Jan 2022 12:51:31 GMT, Claes Redestad wrote: > I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v16]

2022-03-17 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-15 Thread Claes Redestad
On Mon, 14 Mar 2022 20:30:51 GMT, Roger Riggs wrote: >> Claes Redestad has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Fix copyright year in new test > > core libs String.java changes look fine. Thanks @RogerRiggs I intend to push thi

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-14 Thread Roger Riggs
On Wed, 9 Mar 2022 23:59:32 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-14 Thread Claes Redestad
On Wed, 9 Mar 2022 23:59:32 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v15]

2022-03-09 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v14]

2022-03-09 Thread Claes Redestad
On Wed, 9 Mar 2022 23:44:22 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v14]

2022-03-09 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v13]

2022-03-09 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v12]

2022-03-09 Thread Claes Redestad
On Wed, 9 Mar 2022 16:52:54 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v12]

2022-03-09 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v11]

2022-03-08 Thread Lutz Schmidt
On Mon, 7 Mar 2022 23:13:36 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v11]

2022-03-08 Thread Claes Redestad
On Mon, 7 Mar 2022 23:13:36 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v11]

2022-03-07 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v10]

2022-03-07 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Claes Redestad
On Thu, 3 Mar 2022 14:43:52 GMT, Lutz Schmidt wrote: > I don't think the intrinsic has to be implemented on every target, but AFAICR > it does have to be declared as an intrinsic in HotSpot. Yeah, I got confused. To me it looks like a declaration of intent, and thought the only strict requirem

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Lutz Schmidt
On Thu, 3 Mar 2022 14:37:34 GMT, Andrew Haley wrote: > > > Well, it just didn't build. With the annotation being present, you also > > > need an intrinsic implementation. That's what the error message is > > > saying... > > > > > > Doh, I had no idea the presence of `@IntrinsicCandidate` was

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Andrew Haley
On Thu, 3 Mar 2022 13:31:35 GMT, Claes Redestad wrote: > > Well, it just didn't build. With the annotation being present, you also > > need an intrinsic implementation. That's what the error message is saying... > > Doh, I had no idea the presence of `@IntrinsicCandidate` was mandating the VM

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Claes Redestad
On Thu, 3 Mar 2022 13:21:36 GMT, Lutz Schmidt wrote: > Well, it just didn't build. With the annotation being present, you also need > an intrinsic implementation. That's what the error message is saying... Doh, I had no idea the presence of `@IntrinsicCandidate` was mandating the VM has an int

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Lutz Schmidt
On Thu, 3 Mar 2022 12:45:51 GMT, Claes Redestad wrote: >>> * There are a few minor regressions (~5%) in the x86 implementation on >>> `encode-/decodeLatin1Short`. Those regressions disappear when mixing >>> inputs, for example `encode-/decodeShortMixed` even see a minor >>> improvement, wh

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Claes Redestad
On Thu, 3 Mar 2022 12:30:29 GMT, Andrew Haley wrote: > > ``` > > * There are a few minor regressions (~5%) in the x86 implementation on > > `encode-/decodeLatin1Short`. Those regressions disappear when mixing > > inputs, for example `encode-/decodeShortMixed` even see a minor > > improvement,

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Andrew Haley
On Thu, 3 Mar 2022 12:04:47 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-03 Thread Claes Redestad
On Wed, 2 Mar 2022 14:06:10 GMT, Claes Redestad wrote: >> Claes Redestad has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 29 commits: >> >> - Resolve merge conflict >> - Fix TestCountPositives to correctly allow 0 return when exp

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v9]

2022-03-03 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-02 Thread Lutz Schmidt
On Wed, 2 Mar 2022 14:06:10 GMT, Claes Redestad wrote: >> Claes Redestad has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 29 commits: >> >> - Resolve merge conflict >> - Fix TestCountPositives to correctly allow 0 return when exp

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-02 Thread Andrew Haley
On Tue, 1 Mar 2022 19:12:17 GMT, Claes Redestad wrote: > > @theRealAph , @a74nh or someone familiar with aarch64 code, please review > > aarch64 changes. > > Note that the aarch64 changes I've put in for now implements `countPositives` > to return `0` if there's a negative value anywhere, othe

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-02 Thread Claes Redestad
On Wed, 23 Feb 2022 14:19:20 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v7]

2022-03-02 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-01 Thread Lutz Schmidt
On Tue, 1 Mar 2022 19:12:17 GMT, Claes Redestad wrote: >> @theRealAph , @a74nh or someone familiar with aarch64 code, please review >> aarch64 changes. > >> @theRealAph , @a74nh or someone familiar with aarch64 code, please review >> aarch64 changes. > > Note that the aarch64 changes I've put

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-01 Thread Claes Redestad
On Tue, 1 Mar 2022 18:32:00 GMT, Vladimir Kozlov wrote: > @theRealAph , @a74nh or someone familiar with aarch64 code, please review > aarch64 changes. Note that the aarch64 changes I've put in for now implements `countPositives` to return `0` if there's a negative value anywhere, otherwise `le

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-01 Thread Lutz Schmidt
On Wed, 23 Feb 2022 14:19:20 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-03-01 Thread Vladimir Kozlov
On Wed, 23 Feb 2022 14:19:20 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v6]

2022-02-23 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v5]

2022-02-23 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v4]

2022-02-18 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v3]

2022-02-17 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-15 Thread Claes Redestad
On Tue, 15 Feb 2022 11:20:55 GMT, Lutz Schmidt wrote: > Well, with the existing implementations for ppc and s390, I do not see a > complexity advantage with a relaxed spec. The code would have to be there > anyway. Same for x86, but we could avoid going into and checking the tail on a negative

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-15 Thread Lutz Schmidt
On Fri, 11 Feb 2022 12:11:54 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-15 Thread Claes Redestad
On Tue, 15 Feb 2022 08:25:29 GMT, Lutz Schmidt wrote: > Hi Claes, I'm working on the s390 implementation. Awesome, thanks! > > Just for clarification: the return value must be the index of the first > negative byte? Yes, or the length if there are no such bytes. I've considered (and am st

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-15 Thread Lutz Schmidt
On Fri, 11 Feb 2022 12:11:54 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-11 Thread Claes Redestad
On Fri, 11 Feb 2022 12:11:54 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-11 Thread Martin Doerr
On Fri, 11 Feb 2022 12:11:54 GMT, Claes Redestad wrote: >> I'm requesting comments and, hopefully, some help with this patch to replace >> `StringCoding.hasNegatives` with `countPositives`. The new method does a >> very similar pass, but alters the intrinsic to retur

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives [v2]

2022-02-11 Thread Claes Redestad
> I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of leading bytes > in the `byte[]` range which only h

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives

2022-02-11 Thread Claes Redestad
On Wed, 26 Jan 2022 12:51:31 GMT, Claes Redestad wrote: > I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of

Re: RFR: 8281146: Replace StringCoding.hasNegatives with countPositives

2022-02-10 Thread Martin Doerr
On Wed, 26 Jan 2022 12:51:31 GMT, Claes Redestad wrote: > I'm requesting comments and, hopefully, some help with this patch to replace > `StringCoding.hasNegatives` with `countPositives`. The new method does a very > similar pass, but alters the intrinsic to return the number of

RFR: 8281146: Replace StringCoding.hasNegatives with countPositives

2022-02-09 Thread Claes Redestad
I'm requesting comments and, hopefully, some help with this patch to replace `StringCoding.hasNegatives` with `countPositives`. The new method does a very similar pass, but alters the intrinsic to return the number of leading bytes in the `byte[]` range which only has positive bytes.

Re: StringCoding.hasNegatives

2021-10-01 Thread Claes Redestad
On 2021-10-01 16:53, Aleksey Shipilev wrote: On 10/1/21 4:46 PM, Brett Okken wrote: The current pure Java implementation does two things: it provides a fallback for pure-interpreter JVMs and it provides the reader with a simple implementation. I'm not at all sure we'd want a complex impleme

Re: StringCoding.hasNegatives

2021-10-01 Thread Aleksey Shipilev
On 10/1/21 4:46 PM, Brett Okken wrote: The current pure Java implementation does two things: it provides a fallback for pure-interpreter JVMs and it provides the reader with a simple implementation. I'm not at all sure we'd want a complex implementation. I thought this might be the case. Hav

Re: StringCoding.hasNegatives

2021-10-01 Thread Brett Okken
> The current pure Java implementation does two things: it provides a fallback > for pure-interpreter JVMs and it provides the reader with a simple > implementation. > I'm not at all sure we'd want a complex implementation. I thought this might be the case. > Having said that, if I were looking

Re: StringCoding.hasNegatives

2021-10-01 Thread Andrew Haley
On 10/1/21 1:57 PM, Brett Okken wrote: > I know java.lang.StringCoding.hasNegatives has a > HotSpotIntrinsicCandidate annotation/implementation, but is there > interest/value in a faster pure java implementation? > > Using Unsafe to read and compare 8 bytes at a time as a long is faster > than the

StringCoding.hasNegatives

2021-10-01 Thread Brett Okken
I know java.lang.StringCoding.hasNegatives has a HotSpotIntrinsicCandidate annotation/implementation, but is there interest/value in a faster pure java implementation? Using Unsafe to read and compare 8 bytes at a time as a long is faster than the current simple implementation both in interpreter