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

Emanuel Peter epeter at openjdk.org
Wed Nov 5 11:52:32 UTC 2025


On Wed, 5 Nov 2025 11:47:31 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> I have examples like that in `TestTemplate.java`. A good example is in `testHookAndScopes2`.
>> 
>>   3054                 hook1.insert(transparentScope(
>>   3055                     let("nameTransparentScope", "x1c"), // escapes to caller
>>   3056                     addStructuralName("x1c", myStructuralTypeA), // escapes to anchor scope
>>   3057                     "inserted transparentScope: #nameTransparentScope\n",
>>   3058                     "local1: #local1\n",
>>   3059                     listNamesTemplate.asToken()
>>   3060                 )),
>> 
>> 
>> Note: `let` escapes to the caller, and `addDataName` excapes to the anchor scope.
>
> This is not exactly a great way to code though... most likely we don't really want the `let` to escape, and so a `hashtagScope` would be best.

I don't mention all of this in the tutorial, because it is more complexity than the user probably wants to digest at this point.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2494133650


More information about the hotspot-compiler-dev mailing list