RFR: 8367475: Incorrect lock usage in LambdaFormInvokers::regenerate_holder_classes [v2]

Ioi Lam iklam at openjdk.org
Fri Sep 12 04:20:27 UTC 2025


> The assert happens because we attempt to allocate Java objects while holding a mutex:
> 
> 
>     MutexLocker ml(Thread::current(), LambdaFormInvokers_lock);
>     list_lines = oopFactory::new_objArray_handle(vmClasses::String_klass(), len, CHECK);
>     for (int i = 0; i < len; i++) {
>       Handle h_line = java_lang_String::create_from_str(_lambdaform_lines->at(i), CHECK);
> 
> 
> It's possible for the allocations to trigger a call to Java when JVMTI is enabled.
> 
> The fix is to do the allocation outside of the mutex. However, we still use the mutex to make sure we have a consistent view of `_lambdaform_lines`, which may be modified by concurrent Java threads.

Ioi Lam has updated the pull request incrementally with one additional commit since the last revision:

  @dholmes-ora comment - Thread::current() never returns nullptr

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/27231/files
  - new: https://git.openjdk.org/jdk/pull/27231/files/f018244e..b6f054da

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=27231&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27231&range=00-01

  Stats: 3 lines in 1 file changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/27231.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27231/head:pull/27231

PR: https://git.openjdk.org/jdk/pull/27231


More information about the hotspot-runtime-dev mailing list