RFR: 8256368: Avoid repeated upcalls into Java to re-resolve MH/VH linkers/invokers

Vladimir Ivanov vlivanov at openjdk.java.net
Thu Nov 26 13:49:01 UTC 2020


Method linkage of `invokehandle` instructions involve an upcall into Java (`MethodHandleNatives::linkMethod`), but the result is not cached. Unless the upcall behaves idempotently (which is highly desirable, but not guaranteed), repeated invokehandle resolution attempts enter a vicious cycle in tiered mode: switching to a higher tier involves call site re-resolution in generated code, but re-resolution installs a fresh method which puts execution back into interpreter.

(Another prerequisite is no inlining through a `invokehandle` which doesn't normally happen in practice - relevant methods are marked w/ `@ForceInline` - except some testing modes, `-Xcomp` in particular.)

Proposed fix is to inspect `ConstantPoolCache` first. Previous resolution attempts from interpreter and C1 records their results there and it stabilises the execution.         

Testing:
 - failing test
 - tier1-4

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

Commit messages:
 - Remove affected test from the problem list
 - Avoid repeated upcalls into Java to re-resolve MH/VH linkers/invokers.

Changes: https://git.openjdk.java.net/jdk/pull/1453/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1453&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8256368
  Stats: 51 lines in 5 files changed: 26 ins; 12 del; 13 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1453.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1453/head:pull/1453

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


More information about the hotspot-compiler-dev mailing list