[code-reflection] RFR: Make sure method parameters keep their slots when lowering
Hannes Greule
hgreule at openjdk.org
Fri Jan 26 08:52:15 UTC 2024
Previously, unused method parameters didn't get a slot, resulting in either wrong results or bad classfiles.
I propose a simple fix: Make sure that all parameters of the entry block get a slot, in the order they are defined.
I didn't want to change too much code here, so I decided to add a boolean flag to indicate that even values without uses get a slot.
If you have a better idea or more plans on this, please let me know.
I also added multiple test cases showcasing the issue: One that results in the wrong value returned, one with a type mismatch resulting in a VerifyError, and one with a type mismatch due to being non-static, also causing a VerifyError (this is the case that made me discover this issue).
I ran the tests in `langtools/tools/javac/reflect/` and `java/lang/reflect/code/` to make sure they all (still) pass.
-------------
Commit messages:
- Make sure method parameters keep their slots when lowering
Changes: https://git.openjdk.org/babylon/pull/8/files
Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=8&range=00
Stats: 68 lines in 2 files changed: 67 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/babylon/pull/8.diff
Fetch: git fetch https://git.openjdk.org/babylon.git pull/8/head:pull/8
PR: https://git.openjdk.org/babylon/pull/8
More information about the babylon-dev
mailing list