Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v9]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 14:56:47 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v9]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 14:15:43 GMT, Daniel Fuchs wrote: >>> OK - I will change codeLengthOf as suggested. It was not immediately >>> obvious to me that the values would fit in the first 31 bits. >> >> In fact, it would even fit into the first 30 bits. There's a top-level >> comment that explains

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v9]

2022-05-12 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Typo

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v8]

2022-05-12 Thread Roger Riggs
On Thu, 12 May 2022 14:25:44 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v8]

2022-05-12 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Move assert -

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v7]

2022-05-12 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Pavel's feedba

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v7]

2022-05-12 Thread Daniel Fuchs
On Thu, 12 May 2022 11:41:04 GMT, Pavel Rappo wrote: >> OK - I will change codeLengthOf as suggested. It was not immediately >> obvious to me that the values would fit in the first 31 bits. > >> OK - I will change codeLengthOf as suggested. It was not immediately obvious >> to me that the valu

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v6]

2022-05-12 Thread Michael McMahon
On Thu, 12 May 2022 10:51:04 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v6]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 10:05:14 GMT, Daniel Fuchs wrote: > OK - I will change codeLengthOf as suggested. It was not immediately obvious > to me that the values would fit in the first 31 bits. In fact, it would even fit into the first 30 bits. There's a top-level comment that explains the layout o

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 10:08:23 GMT, Daniel Fuchs wrote: >> src/java.net.http/share/classes/jdk/internal/net/http/websocket/Frame.java >> line 291: >> >>> 289: >>> 290: HeaderWriter noMask() { >>> 291: // The negation "~" sets the high order bits >> >> Rubber-stamping this in

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v6]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 10:51:04 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v6]

2022-05-12 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: lengthOfCode()

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Daniel Fuchs
On Thu, 12 May 2022 09:15:19 GMT, Pavel Rappo wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Revert adding char constants > > src/java.net.http/share/classes/jdk/internal/net/http/websocket/Frame.java > line 291:

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Daniel Fuchs
On Thu, 12 May 2022 09:00:37 GMT, Pavel Rappo wrote: >> This is what I mean: >> >> jshell> long codeLengthOf = (long)Integer.MAX_VALUE + 1 >> codeLengthOf ==> 2147483648 >> >> jshell> int bufferLen = 0 >> bufferLen ==> 0 >> >> jshell> bufferLen + codeLengthOf <= 64 >> $3 ==> false >> >> jshel

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Pavel Rappo
On Wed, 11 May 2022 18:42:46 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Pavel Rappo
On Thu, 12 May 2022 08:56:26 GMT, Daniel Fuchs wrote: >> No because the int returned could be negative, while the long will not. >> Assuming bufferLen is 0 and codeLengthOf() returns some value that has the >> 32th bit set to 1 then when codeLengthOf() returns long, bufferLen + >> codeLengthOf

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Daniel Fuchs
On Thu, 12 May 2022 08:42:39 GMT, Daniel Fuchs wrote: >> codeLengthOf() returns long. It could be changed to return int with a cast >> internally and then you could avoid the two new casts. > > No because the int returned could be negative, while the long will not. > Assuming bufferLen is 0 and

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-12 Thread Daniel Fuchs
On Wed, 11 May 2022 20:31:00 GMT, Michael McMahon wrote: >> I believe the method returns an "unsigned int" - having the method return an >> int would then potentially cause `bufferLen + len <= 64` to yield true when >> it shouldn't. Hopefully @pavelrappo will comment. > > codeLengthOf() returns

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-11 Thread Michael McMahon
On Wed, 11 May 2022 17:10:45 GMT, Daniel Fuchs wrote: >> src/java.net.http/share/classes/jdk/internal/net/http/hpack/QuickHuffman.java >> line 739: >> >>> 737: buffer |= (codeValueOf(c) >>> bufferLen); // >>> append >>> 738: bufferLen += (int) le

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-11 Thread Roger Riggs
On Wed, 11 May 2022 18:33:44 GMT, Daniel Fuchs wrote: >> So if x is a char, ~x seems to be an int :-( > > I have reverted adding constant fields. Too bad - the casts are back. Phooey: Sorry to have lead you astray. :( And casting before `~` does the same not wanted result. - PR:

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v5]

2022-05-11 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Revert adding

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v4]

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 18:25:00 GMT, Daniel Fuchs wrote: >> @RogerRiggs Actually - I'm no longer sure that this will work: >> >> >> jshell> char x = 0b1000_ >> x ==> '耀' >> >> jshell> var y = ~x >> y ==> -32769 >> >> jshell> char y = ~x >> | Error: >> | incompatible types: possible

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v4]

2022-05-11 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Revert adding

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v3]

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 18:23:30 GMT, Daniel Fuchs wrote: >> 👍 I'd put `_MASK` in the name along with whatever name is used for the bits >> in the frame spec . > > @RogerRiggs Actually - I'm no longer sure that this will work: > > > jshell> char x = 0b1000_ > x ==> '耀' > > jshell> var

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v3]

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 17:49:28 GMT, Roger Riggs wrote: >> Ah! Good point. Maybe I should use a constant and get rid of the cast. > > 👍 I'd put `_MASK` in the name along with whatever name is used for the bits > in the frame spec . @RogerRiggs Actually - I'm no longer sure that this will work: j

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v3]

2022-05-11 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Add _MASK suff

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v2]

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 17:49:28 GMT, Roger Riggs wrote: >> Ah! Good point. Maybe I should use a constant and get rid of the cast. > > 👍 I'd put `_MASK` in the name along with whatever name is used for the bits > in the frame spec . Done - PR: https://git.openjdk.java.net/jdk/pull/865

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v2]

2022-05-11 Thread Roger Riggs
On Wed, 11 May 2022 18:02:32 GMT, Daniel Fuchs wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > Daniel Fuchs has updated the pull request incrementally with one

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http [v2]

2022-05-11 Thread Daniel Fuchs
> In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Use char const

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 17:37:44 GMT, Roger Riggs wrote: >> Yes - that's my understanding. > > These methods either set or clear a single bit in `firstChar`. > The constant is an `int` so its complement is a 32 bit int. > > It could also be written as `~ (char) 0b100_000`. Then the 16 bit

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Roger Riggs
On Wed, 11 May 2022 17:46:15 GMT, Daniel Fuchs wrote: >> These methods either set or clear a single bit in `firstChar`. >> The constant is an `int` so its complement is a 32 bit int. >> >> It could also be written as `~ (char) 0b100_000`. Then the 16 bit >> unsigned char would be comp

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Roger Riggs
On Wed, 11 May 2022 17:04:19 GMT, Daniel Fuchs wrote: >> src/java.net.http/share/classes/jdk/internal/net/http/websocket/Frame.java >> line 222: >> >>> 220: // compiler will emit a warning if not cast >>> 221: firstChar &= (char) ~0b1000_; >>> 222:

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 16:52:07 GMT, Michael McMahon wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > src/java.net.http/share/classes/jdk/internal/net/http/hpack/Q

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 16:55:16 GMT, Michael McMahon wrote: >> In relation to >> [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find >> here a patch that addresses possibly lossy conversions in java.net.http > > src/java.net.http/share/classes/jdk/internal/net/http/websock

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Michael McMahon
On Wed, 11 May 2022 15:42:25 GMT, Daniel Fuchs wrote: > In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http src/java.net.http/share/classes/jdk/internal/net/http/hpack/QuickHuffm

Re: RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Daniel Fuchs
On Wed, 11 May 2022 15:42:25 GMT, Daniel Fuchs wrote: > In relation to > [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find > here a patch that addresses possibly lossy conversions in java.net.http @pavelrappo I would appreciate if you could review these changes

RFR: 8286386: Address possibly lossy conversions in java.net.http

2022-05-11 Thread Daniel Fuchs
In relation to [JDK-8244681](https://bugs.openjdk.java.net/browse/JDK-8244681), please find here a patch that addresses possibly lossy conversions in java.net.http - Commit messages: - Fix comments - 8286386: Address possibly lossy conversions in java.net.http Changes: https://gi