RFR: 8262912: ciReplay: replay does not simulate unresolved classes

Christian Hagedorn chagedorn at openjdk.java.net
Wed Oct 13 09:30:09 UTC 2021


When trying to replay compile, the JVM will always resolve some classes before actually doing the replay compilation. When finally replay compiling the method, the state of `ciInstanceKlasses` which are resolved/unresolved could be different compared to the state at which the replay file was dumped. This will even be a bigger problem when tackling [JDK-8254110](https://bugs.openjdk.java.net/browse/JDK-8254110).

This change intends to fix this by only treating a `ciInstanceKlass` as *not* unresolved if there is a corresponding entry for it in the replay file. This is achieved by a whitelist (`ciInstanceKlassRecord`). All accesses to get a pointer to a `ciInstanceKlass` are eventually routed through `ciEnv::get_metadata()`. This method is hooked to compare it against the replay compilation whitelist. If the corresponding `Klass` is not on the list, an unresolved `ciInstanceKlass` is returned instead.

Finding a way to reliably test this feature was difficult. I therefore came up with a test which first creates a replay file with `CICrashAt` and then removes the `ciInstanceKlass` entry for class `Foo` to simulate that `Foo` was unresolved at replay dump time. This will result in a different C2 IR which is verified by checking the `PrintIdeal` output (see comments in test).

Thanks,
Christian

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

Commit messages:
 - 8262912: ciReplay: replay does not simulate unresolved classes

Changes: https://git.openjdk.java.net/jdk/pull/5926/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5926&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262912
  Stats: 241 lines in 8 files changed: 226 ins; 0 del; 15 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5926.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5926/head:pull/5926

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


More information about the hotspot-compiler-dev mailing list