[code-reflection] Integrated: Make sure method parameters keep their slots when lowering

Hannes Greule hgreule at openjdk.org
Mon Jan 29 19:31:41 UTC 2024


On Fri, 26 Jan 2024 08:47:23 GMT, Hannes Greule <hgreule at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 9835b5a6
Author:    Hannes Greule <hgreule at openjdk.org>
Committer: Paul Sandoz <psandoz at openjdk.org>
URL:       https://git.openjdk.org/babylon/commit/9835b5a64faf10699b4a8d17baf20caa1d094d9b
Stats:     57 lines in 2 files changed: 53 ins; 0 del; 4 mod

Make sure method parameters keep their slots when lowering

Reviewed-by: psandoz

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

PR: https://git.openjdk.org/babylon/pull/8


More information about the babylon-dev mailing list