On Fri, 14 Mar 2025 00:01:21 GMT, Chen Liang <li...@openjdk.org> wrote:
> The recent patch #23866 makes calling `ClassValue::remove()` from > `ClassValue::computeValue()` end up in infinite loops while fixing the stale > value risk from the method. > > The proposed fix is to preserve the stale value risk fix, and update the > remove-from-compute behavior from the original designated no-op behavior to > throwing an exception, as the original behavior conflicts with the stale > value fix. > > The implementation track the owner thread in promises (accessed in locked > section); as a result, we can fail-fast on recursive removals from > `computeValue`. I did not choose to use `ThreadTracker` as it is designed for > single tracker and multiple threads, while this case here sees often just one > thread, and the threads outlive the promise objects. > > Also updated the API specs for `remove` to more concisely describe the memory > effects. Please review the associated CSR as well. This pull request has now been integrated. Changeset: 9223ed78 Author: Chen Liang <li...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/9223ed788a53820dcc1e285a6e0df0c97b05fb09 Stats: 646 lines in 2 files changed: 387 ins; 137 del; 122 mod 8351996: Behavioral updates for ClassValue::remove Co-authored-by: John R Rose <jr...@openjdk.org> Reviewed-by: vklang, jrose ------------- PR: https://git.openjdk.org/jdk/pull/24043