RFR: 8256823: C2 compilation fails with "assert(isShiftCount(imm8 >> 1)) failed: illegal shift count" [v2]

Tobias Hartmann thartmann at openjdk.java.net
Mon Nov 23 15:18:12 UTC 2020


> The ideal transformation added by [JDK-8254872](https://bugs.openjdk.java.net/browse/JDK-8254872) converts `RotateLeftNode(val, shift)` into `RotateRightNode(val, 32/64 - (shift & 31/63))`. If `shift` later becomes zero, we end up trying to emit a rotate with a 32/64 shift value which triggers an assert.
> 
> I've added an identity transformation similar to what is implemented for ShiftNodes that takes care of this. I've also noticed that the corresponding assert is not strong enough for `roll` and `rorl` (probably the author used the assert corresponding to the 64-bit version by accident). The patch also includes some refactoring.
> 
> Thanks,
> Tobias

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  Refactored getShiftCon method

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1384/files
  - new: https://git.openjdk.java.net/jdk/pull/1384/files/f12cccb1..9c7234b0

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1384&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1384&range=00-01

  Stats: 74 lines in 1 file changed: 30 ins; 2 del; 42 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1384.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1384/head:pull/1384

PR: https://git.openjdk.java.net/jdk/pull/1384


More information about the hotspot-compiler-dev mailing list