[lworld] RFR: 8280164: [lworld] Generate Preload attribute to enumerate value classes encountered [v2]
Srikanth Adayapalam
sadayapalam at openjdk.java.net
Wed Jan 19 15:33:56 UTC 2022
On Wed, 19 Jan 2022 13:42:49 GMT, Aggelos Biboudis <duke at openjdk.java.net> wrote:
> I would expect all V* classes to be part of the `Preload`'s, `classes` field. Maybe my understanding is wrong. I checked with `javap` and it reports only one:
>
> ```
> Classes to be preloaded:
> #14; // value class PreloadAttributeTest$X
> ```
This is the javap output of PreloadAttributeTest.class - this class does not reference the V* classes at all.
If you look at the javap output of PreloadAttributeTest$X.class, you will see the V* classes
>
> In any case, even if my understanding is wrong, can we use the same style as in `test/langtools/tools/javac/valhalla/value-objects/ValueCreationTest.java` to assert that the contents of the `Preload` attribute are the expected ones? (in this case 1).
>
That test uses textual comparison which in general is turns out to be flaky - constant pool indices, byte code offsets can change when code generation changes in some minor unrelated way causing tests to "fail" needlessly.
The test you cite itself needs to move away to more robust form that avoid including immaterial things (such as indices/offsets etc) - this is a separate task that should be taken up.
> What do you think? Otherwise it looks good.
-------------
PR: https://git.openjdk.java.net/valhalla/pull/605
More information about the valhalla-dev
mailing list