Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340646

C2: ImplicitNullChecks regression after JDK-8338442

XMLWordPrintable

      JDK-8338442 replaced the addressable memoryN operands with memory operands which may require extra code emission (effectively a lea) before the address can be used. This break C2's ImplicitNullChecks for load and store nodes, which assumes that the first emitted instruction is the implicit null check pc.

      The current behaviour is to only add implicit null checks when the offset is within a page size (16K). This means that 32 and 64bit loads/stores are addressable. However, using 8 or 16bit loads/stores (and I assume unaligned accesses as well where the offset is 8 or 16 bit scale) will cause problems as they are expected to be implicitly null check by C2, but are not addressable resulting in unexpected extra code emission.

      I will attach a reproducer which is a modified version of `test/hotspot/jtreg/compiler/codegen/TestConvertImplicitNullCheck.java` where a large amount of `char` fields are added and a field with a non addressable offset is used.

      This tests crashes with mainline (head: 63e611cd5d7eb4fc6ea6633ff9123e4bee5f5993) and passes with `-XX:-ImplicitNullChecks`

      After reverting JDK-8338442 (git revert 38591315058e6d3b764ca325facc5bf46bf7b16b) and JDK-8336245 (git revert d10afa26e5c59475e49b353ed34e8e85d0615d92) the modified test once again runs without crashing.

            fgao Fei Gao
            aboldtch Axel Boldt-Christmas
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: