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:30 UTC 2025


On Wed, 5 Nov 2025 08:26:18 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
>
> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 501:
> 
>> 499:             // Let us go back to where we anchored the hook with anchor() and define a field named $field1 there.
>> 500:             """,
>> 501:             myHook.insert(scope( // <- insertion scope
> 
> I'm not yet clear on that one. What happens when we insert a transparentScope here and for example add a `let("y", 42)`. Where could we then use `#y` (might not be a thing one might want to do, though)? Anywhere in the anchor scope and/or in the caller scope?

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.

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

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


More information about the hotspot-compiler-dev mailing list