RFR: [type-classes] Witness symbols with wrong owner lead to verifier errors
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Feb 3 14:16:16 UTC 2026
A witness lookup of the kind `T.__witness` is translated as a condy instruction.
Condy-backed `ldc` are modelled in the AST as references to `DynamicVariableSymbol`.
Such symbols have a owner. While the owner of a dynamic symbol is relatively unimportant for code generation issues (we don't need it to emit the correct bytecode), other compilation steps (such as `LambdaToMethod`) might be tricked into thinking that the dynamic symbol is actually a reference to an enclosing class symbol. This happens if the dynamic symbol owner is set to be a class symbol, instead of a method symbol.
The fix is therefore to translate the dynamic symbol of a witness lookup as a "local variable" -- that is, a variable symbol whose owner is a method (not a class) symbol.
-------------
Commit messages:
- Initial push
Changes: https://git.openjdk.org/valhalla/pull/2021/files
Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2021&range=00
Stats: 70 lines in 2 files changed: 69 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/valhalla/pull/2021.diff
Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2021/head:pull/2021
PR: https://git.openjdk.org/valhalla/pull/2021
More information about the valhalla-dev
mailing list