Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2022-01-12 Thread Сергей Цыпанов
On Mon, 13 Dec 2021 09:39:55 GMT, Сергей Цыпанов wrote: > Originally this was spotted by by Amir Hadadi in > https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor > > It looks like in the following code in `String(byte[], int, int, Charset)` >

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-21 Thread amirhadadi
On Tue, 21 Dec 2021 12:50:36 GMT, Roland Westrelin wrote: >> @dean-long actually the issue reproduces with Java 17 where >> `checkBoundsOffCount` was implemented in a more straight forward manner: >> >> >> static void checkBoundsOffCount(int offset, int count, int length) { >> if (offset

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-21 Thread Roland Westrelin
On Sat, 18 Dec 2021 21:48:33 GMT, amirhadadi wrote: >> This does look like a HotSpot JIT compiler issue to me. My guess is that it >> is related to how checkBoundsOffCount() checks for offset < 0: >> >> 396 if ((length | fromIndex | size) < 0 || size > length - >> fromIndex) >> >>

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-18 Thread amirhadadi
On Fri, 17 Dec 2021 22:33:30 GMT, Dean Long wrote: >> Originally this was spotted by by Amir Hadadi in >> https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor >> >> It looks like in the following code in `String(byte[], int, int, Charset)` >>

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-17 Thread Dean Long
On Mon, 13 Dec 2021 09:39:55 GMT, Сергей Цыпанов wrote: > Originally this was spotted by by Amir Hadadi in > https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor > > It looks like in the following code in `String(byte[], int, int, Charset)` >

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-15 Thread Mai Đặng Quân Anh
On Wed, 15 Dec 2021 08:29:20 GMT, Сергей Цыпанов wrote: >>> @AlanBateman the benchmark is mine along with the changes for >>> `translateEscapes` and `newStringUTF8NoRepl`, the change for constructor is >>> from SO. >> >> I don't know how we can progress this PR if the patch includes code

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-15 Thread Сергей Цыпанов
On Tue, 14 Dec 2021 13:20:46 GMT, Alan Bateman wrote: >>> Originally this was spotted by by Amir Hadadi in >>> https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor >> >> Before anyone looks at this, can you confirm that the patch does not

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-14 Thread Сергей Цыпанов
On Tue, 14 Dec 2021 19:12:29 GMT, Mai Đặng Quân Anh wrote: > The problem, at first glance, seems to be that our compiled code is trying to > compute this mysterious number @merykitty how do you view it? 樂 - PR: https://git.openjdk.java.net/jdk/pull/6812

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-14 Thread Mai Đặng Quân Anh
On Mon, 13 Dec 2021 09:39:55 GMT, Сергей Цыпанов wrote: > Originally this was spotted by by Amir Hadadi in > https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor > > It looks like in the following code in `String(byte[], int, int, Charset)` >

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-14 Thread amirhadadi
On Tue, 14 Dec 2021 13:20:46 GMT, Alan Bateman wrote: >>> Originally this was spotted by by Amir Hadadi in >>> https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor >> >> Before anyone looks at this, can you confirm that the patch does not

Re: RFR: 8278518: String(byte[], int, int, Charset) constructor and String.translateEscapes() miss bounds check elimination

2021-12-14 Thread Alan Bateman
On Mon, 13 Dec 2021 09:55:36 GMT, Alan Bateman wrote: >> Originally this was spotted by by Amir Hadadi in >> https://stackoverflow.com/questions/70272651/missing-bounds-checking-elimination-in-string-constructor >> >> It looks like in the following code in `String(byte[], int, int, Charset)`