RFR: 8343685: C2 SuperWord: refactor VPointer with MemPointer [v4]

Emanuel Peter epeter at openjdk.org
Tue Jan 14 06:36:48 UTC 2025


On Mon, 13 Jan 2025 19:38:45 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 116 commits:
>> 
>>  - copyright 2025
>>  - Merge branch 'master' into JDK-8343685-VPointer-MemPointer
>>  - manual merge
>>  - fix printing
>>  - rename
>>  - fix up print
>>  - add TestEquivalentInvariants.java
>>  - improve documentation
>>  - hide parser via delegation
>>  - Merge branch 'master' into JDK-8343685-VPointer-MemPointer
>>  - ... and 106 more: https://git.openjdk.org/jdk/compare/84e6432b...b64f9295
>
> src/hotspot/share/opto/memnode.cpp line 2951:
> 
>> 2949: #endif
>> 2950:   const MemPointer pointer_use(NOT_PRODUCT(trace COMMA) use_store);
>> 2951:   const MemPointer pointer_def(NOT_PRODUCT(trace COMMA) def_store);
> 
> Why you swapped arguments? Main argument will different in debug vs product VMs.

Ok, I will put `NOT_PRODUCT` last. I think it was somehow easier, but cannot remember why now.

> src/hotspot/share/opto/noOverflowInt.hpp line 109:
> 
>> 107:     } else if (b.is_NaN()) {
>> 108:       return -1;
>> 109:     }
> 
> This is strange NaN compare results. May be add comment explaining that it is not really float arithmetic "NaN".

@vnkozlov At the top of the file I explain the meaning of `NaN`:

// Wrapper around jint, which detects overflow.
// If any operation overflows, then it returns a NaN.
class NoOverflowInt {
private:
  bool _is_NaN; // overflow, uninitialized, etc.
  jint _value;


Is that sufficient? Or would you prefer me to rename the int `NaN` to something else?

I added a comment line now, I hope that helps locally:

  static int cmp(const NoOverflowInt& a, const NoOverflowInt& b) {
    // Order NaN (overflow, uninitialized, etc) after non-NaN.
    if (a.is_NaN()) {
      return b.is_NaN() ? 0 : 1;
    } else if (b.is_NaN()) {
      return -1;
    }
    if (a.value() < b.value()) { return -1; }
    if (a.value() > b.value()) { return  1; }
    return 0;
  }

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21926#discussion_r1914314070
PR Review Comment: https://git.openjdk.org/jdk/pull/21926#discussion_r1914313125


More information about the hotspot-compiler-dev mailing list