RFR: 8367531: Template Framework: use scopes and tokens instead of misbehaving immediate-return-queries [v11]

Emanuel Peter epeter at openjdk.org
Wed Nov 5 12:51:20 UTC 2025


On Wed, 5 Nov 2025 11:45:12 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   small adjustments after call with Roberto and Christian
>
> Comments for `TestTemplate.java`. It was more a skim of the file and I stopped here and there for having a closer look but I trust you here that you covered all the functionality - at least it suggests that you were quite thorough :-)

@chhagedorn Thanks a lot for your review, I really appreciate the time you put in! I think I addressed/answered all your points :)

> test/hotspot/jtreg/testlibrary_tests/template_framework/tests/TestTemplate.java line 469:
> 
>> 467:         var hook1 = new Hook("Hook1");
>> 468: 
>> 469:         var template0 = Template.make(() -> scope("t0 isAnchored: ", hook1.isAnchored(a -> scope(a)), "\n"));
> 
> You could directly use `Template::scope` instead of `a -> scope(a)`. Same below.

But is that really more readable? I fear not really. And it is also longer... I'm a little torn with these. @robcasloz @mhaessig what are your votes?

Before:
`"t2 isAnchored: ", hook1.isAnchored(a -> scope(a)), "\n",`
After:
`"t2 isAnchored: ", hook1.isAnchored(Template::scope), "\n",`

> test/hotspot/jtreg/testlibrary_tests/template_framework/tests/TestTemplate.java line 1334:
> 
>> 1332:             dataNames(MUTABLE_OR_IMMUTABLE).exactOf(myInt).hasAny(h -> scope(h)),
>> 1333:             ", ",
>> 1334:             dataNames(MUTABLE_OR_IMMUTABLE).exactOf(myInt).count(c -> scope(c)),
> 
> Here you can simplify it again:
> 
> Suggestion:
> 
>             dataNames(MUTABLE_OR_IMMUTABLE).exactOf(myInt).hasAny(Template::scope),
> ", ",
>             dataNames(MUTABLE_OR_IMMUTABLE).exactOf(myInt).count(Template::scope),

Is it really simpler? It looks longer to me ;)

Probably the same question of taste... let's see if the others have an opinion here :)

> test/hotspot/jtreg/testlibrary_tests/template_framework/tests/TestTemplate.java line 1901:
> 
>> 1899:                 "int #v1 = x + 1;\n"
>> 1900:             )),
>> 1901:             // Using "transparentScope", is is available.
> 
> "it is available"? Same below

fixed.

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

PR Comment: https://git.openjdk.org/jdk/pull/27255#issuecomment-3491031530
PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2494300120
PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2494313357
PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2494316726


More information about the hotspot-compiler-dev mailing list