On Wed, 18 Nov 2026 06:49:26 GMT, David Holmes <[email protected]> wrote:

>> Another mechanism allows this lifetime choice to retain unnecessary 
>> implementation classes without retransformation. When multiple threads 
>> concurrently attempt to resolve the same invokedynamic instruction, the 
>> bootstrap method may be invoked several times. The Java Virtual Machine 
>> (JVM) selects the result of one invocation, while disregarding the results 
>> of other invocations. [JVMS 
>> §5.4.3.6](https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-5.html#jvms-5.4.3.6)
>> 
>> If each of these competing invocations generates implementation classes with 
>> STRONG_LOADER_LINK, discarding their linkage results does not permit the 
>> classes to be unloaded. These classes remain associated with the defining 
>> loader, including those whose implementations were never selected for the 
>> call site.
>> 
>> This means even the initial resolution process can leave redundant 
>> implementation classes for the lifetime of the loader. As additional 
>> core-library functionality adopts class-generating bootstraps, more sites 
>> become susceptible to this retention.
>> 
>> The current change addresses subsequent generations following redefinition 
>> or retransformation, but does not modify the initial-resolution scenario.
>
> Thanks for clarifying the expectation here. I still have a concern though:
> 
>> 3. When execution reaches those sites, resolution invokes their bootstrap 
>> methods again. Newly generated lambda proxy classes are now defined without 
>> STRONG_LOADER_LINK, because the caller satisfies the redefinition predicate.
> 
> So what now ensures the strong link to these temporary proxy classes whilst 
> tracing is enabled?

The resolved call site already retains the lambda implementation through its 
target method handle. Removing STRONG_LOADER_LINK leaves those references 
intact; it removes the additional requirement to retain the class for the 
lifetime of its defining loader.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33921#discussion_r4610171484

Reply via email to