Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-18 Thread Coleen Phillimore
On Fri, 18 Aug 2023 02:13:57 GMT, David Holmes wrote: >> template bool primitive_equals(const K& k0, const K& k1) { >> return k0 == k1; >> } >> >> template int primitive_compare(const K& k0, const K& k1) { >> return ((k0 < k1) ? -1 : (k0 == k1) ? 0 : 1); >> } >> >> >> This is the primitive

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-18 Thread Coleen Phillimore
On Thu, 17 Aug 2023 12:37:03 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread David Holmes
On Fri, 18 Aug 2023 01:20:59 GMT, Coleen Phillimore wrote: >> It is the name `primitive_compare` - I only previously saw it used for >> integer types. Using it with pointers seems "wrong". Don't we have to >> convert to `intptr_t` to compare pointers numerically anyway? > > template bool primit

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread David Holmes
On Thu, 17 Aug 2023 12:37:03 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread David Holmes
On Fri, 18 Aug 2023 01:24:20 GMT, Coleen Phillimore wrote: >> I don't follow. The fields are int so cast them to jlong before returning >> them. All the callers of these methods expect jlong so there can't be any >> issue there. > > You don't need to cast from int to jlong. The callers of the

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Fri, 18 Aug 2023 00:24:07 GMT, David Holmes wrote: >> If they stay jlong returns (note that these fields are in fact int), then we >> need to add casting to all the callers. Casting is worse than returning the >> correct types. If someone wants to make these fields jlong someday then >> t

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Fri, 18 Aug 2023 00:22:10 GMT, David Holmes wrote: >> Was it odd before or odd now? What we want to do is compare pointers for a >> sort function. This primitive_compare has been used in other places as an >> improvement. > > It is the name `primitive_compare` - I only previously saw it us

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread David Holmes
On Thu, 17 Aug 2023 12:10:51 GMT, Coleen Phillimore wrote: >> src/hotspot/share/logging/logOutput.cpp line 69: >> >>> 67: >>> 68: static int tag_cmp(const LogTagType *a, const LogTagType *b) { >>> 69: return primitive_compare(a, b); >> >> This looks very odd given we are dealing with pointer

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 12:37:03 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread Christian Hagedorn
On Thu, 17 Aug 2023 12:37:03 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 00:20:44 GMT, David Holmes wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Change size of op_index back. > > src/hotspot/share/logging/logOutput.cpp line 69: > >> 67: >> 68: static int ta

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread Thomas Stuefe
On Thu, 17 Aug 2023 12:37:03 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 07:52:07 GMT, Christian Hagedorn wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> put sizes back to uint32_t. > > src/hotspot/share/utilities/elfFuncDescTable.cpp line 49: > >> 47: } >> 48

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 07:44:54 GMT, Christian Hagedorn wrote: >> I see Dean indicated this is platform specific, but I don't know how. It >> sounds like this is a bug if it should be 64-bit. > > I think `uint32_t` was wrong here since it could be a larger 64-bit value on > 64-bit platforms. `Elf

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 07:53:07 GMT, Christian Hagedorn wrote: >> Thanks Christian. I'll revert to use the static cast. One of the cases has >> a comment why. > > That looks good! Thanks Christian! - PR Review Comment: https://git.openjdk.org/jdk/pull/15233#discussion_r1297135202

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 12:24:48 GMT, Coleen Phillimore wrote: >> Wasting what? > > This calls move_position with the value next: > > > bool DwarfFile::MarkedDwarfFileReader::move_position(const long offset) { > if (offset == 0) { > return true; > } > return set_position(_current_pos + of

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 12:15:24 GMT, Coleen Phillimore wrote: >> src/hotspot/share/utilities/elfFile.cpp line 792: >> >>> 790: // We must align to twice the address size. >>> 791: uint8_t alignment = DwarfFile::ADDRESS_SIZE * 2; >>> 792: uint64_t padding = alignment - (_reader.get_position()

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-17 Thread Coleen Phillimore
On Thu, 17 Aug 2023 01:01:02 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v8]

2023-08-17 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-17 Thread Christian Hagedorn
On Thu, 17 Aug 2023 01:01:02 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-17 Thread Christian Hagedorn
On Wed, 16 Aug 2023 13:43:34 GMT, Coleen Phillimore wrote: >> I've quickly skimmed through the usages of `read_uleb128`. We only seem to >> be reading either directly into a proper `uint64_t` or we are reading 4 >> bytes (i.e. `check_size = 4`). In the latter case, we could either: >> - add a `

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-17 Thread Christian Hagedorn
On Thu, 17 Aug 2023 02:06:22 GMT, David Holmes wrote: >> src/hotspot/share/utilities/elfFile.hpp line 486: >> >>> 484: DwarfFile* _dwarf_file; >>> 485: MarkedDwarfFileReader _reader; >>> 486: uintptr_t _section_start_address; >> >> This seems suspicious - is this a 32-bit value or 6

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-16 Thread David Holmes
On Thu, 17 Aug 2023 01:57:46 GMT, David Holmes wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Change size of op_index back. > > src/hotspot/share/utilities/elfFile.hpp line 486: > >> 484: DwarfFile* _dwa

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-16 Thread David Holmes
On Wed, 16 Aug 2023 23:56:58 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-16 Thread David Holmes
On Thu, 17 Aug 2023 01:01:02 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-16 Thread Coleen Phillimore
On Thu, 17 Aug 2023 00:37:55 GMT, Dean Long wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Change size of op_index back. > > src/hotspot/share/utilities/elfFile.cpp line 1454: > >> 1452: return false

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v7]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-16 Thread Dean Long
On Wed, 16 Aug 2023 23:56:58 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 23:43:36 GMT, Coleen Phillimore wrote: >> uint64_t operation_advance; >> if (!_reader.read_uleb128(&operation_advance, 4)) { >> // Must be at most 4 bytes because the index register is only 4 >> bytes wide. >> return false; >> } >> _state->ad

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v6]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 23:10:30 GMT, Coleen Phillimore wrote: >> So put the cast here? > > uint64_t operation_advance; > if (!_reader.read_uleb128(&operation_advance, 4)) { > // Must be at most 4 bytes because the index register is only 4 bytes > wide. > return false; >

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 23:02:45 GMT, Coleen Phillimore wrote: >> src/hotspot/share/utilities/elfFile.cpp line 1723: >> >>> 1721: void >>> DwarfFile::LineNumberProgram::LineNumberProgramState::set_index_register(const >>> uint64_t operation_advance, >>> 1722:

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 21:38:52 GMT, Dean Long wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Remove wrong comment. > > src/hotspot/share/utilities/elfFile.cpp line 1723: > >> 1721: void >> DwarfFile::LineNumb

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v5]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Dean Long
On Wed, 16 Aug 2023 19:16:28 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Dean Long
On Wed, 16 Aug 2023 19:16:28 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Dean Long
On Wed, 16 Aug 2023 19:16:28 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v3]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 18:51:03 GMT, Thomas Stuefe wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Revert to use static_cast. > > src/hotspot/share/logging/logOutput.cpp line 77: > >> 75: ntags++; >> 76: }

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v3]

2023-08-16 Thread Thomas Stuefe
On Wed, 16 Aug 2023 13:48:35 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v3]

2023-08-16 Thread Johan Sjölen
On Wed, 16 Aug 2023 13:48:35 GMT, Coleen Phillimore wrote: >> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion >> warnings in runtime code. This is the last one I'm going to do for runtime >> for a while. >> Tested with tier1-4. > > Coleen Phillimore has updated the pul

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v3]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v3]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 13:01:53 GMT, Christian Hagedorn wrote: >> This code: >> >> uint64_t isa; >> if (!_reader.read_uleb128(&isa, 4)) { >> // isa register is 4 bytes wide. >> return false; >> } >> _state->_isa = isa; // only save 4 bytes >> >> returns 64

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v2]

2023-08-16 Thread Christian Hagedorn
On Wed, 16 Aug 2023 12:33:47 GMT, Coleen Phillimore wrote: >> When we read the 64 bit values in the code, the values are 64 bits though. >> So static_cast<> to narrow the result is more correct ? > > This code: > > uint64_t isa; > if (!_reader.read_uleb128(&isa, 4)) { > //

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v2]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 12:30:18 GMT, Coleen Phillimore wrote: >> According to the DWARF 4 spec, the discriminator is an unsigned integer >> (i.e. 32 bits). Also, the other fields like `isa or `column` are unsigned >> integer. I think we would be good to keep them as unsigned integer to follow >>

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v2]

2023-08-16 Thread Coleen Phillimore
On Wed, 16 Aug 2023 12:22:15 GMT, Christian Hagedorn wrote: >> src/hotspot/share/utilities/elfFile.cpp line 1426: >> >>> 1424: return false; >>> 1425: } >>> 1426: _state->_discriminator = static_cast(discriminator); >> >> @chhagedorn These fields are declared as 32 bits but

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v2]

2023-08-16 Thread Christian Hagedorn
On Wed, 16 Aug 2023 11:45:54 GMT, Coleen Phillimore wrote: >> Coleen Phillimore has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Make elf fields 64 bits removing some static casts. > > src/hotspot/share/utilities/elfFile.cpp line 1426: >

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v2]

2023-08-16 Thread Coleen Phillimore
> Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. Coleen Phillimore has updated the pull request incrementally with one additional commit since the last r

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code

2023-08-16 Thread Coleen Phillimore
On Thu, 10 Aug 2023 20:31:20 GMT, Coleen Phillimore wrote: > Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. src/hotspot/share/utilities/elfFile.cpp line

Re: RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code

2023-08-15 Thread Coleen Phillimore
On Thu, 10 Aug 2023 20:31:20 GMT, Coleen Phillimore wrote: > Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion > warnings in runtime code. This is the last one I'm going to do for runtime > for a while. > Tested with tier1-4. @tstuefe There are some metaspace changes he

RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code

2023-08-15 Thread Coleen Phillimore
Fix MaxElementPrintSize and casts. Also fixed miscellaneous -Wconversion warnings in runtime code. This is the last one I'm going to do for runtime for a while. Tested with tier1-4. - Commit messages: - Use parse_integer instead of strtol with a cast. - Unset Wconversion - Fix e