RFR: JDK-8286666: JEP 429: Implementation of Scoped Values (Incubator)
Dean Long
dlong at openjdk.org
Tue Nov 15 14:20:54 UTC 2022
On Fri, 4 Nov 2022 09:53:39 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Thread.java line 1610:
>>
>>> 1608: ensureMaterializedForStackWalk(bindings);
>>> 1609: task.run();
>>> 1610: Reference.reachabilityFence(bindings);
>>
>> This should probably be in a `try`‑`finally` block:
>> Suggestion:
>>
>> try {
>> task.run();
>> } finally {
>> Reference.reachabilityFence(bindings);
>> }
>
> I wonder. The pattern I'm using here is based on `AccessController.executePrivileged`, which doesn't have the `finally` clause. Perhaps I should add one here anyway.
I hope it doesn't matter. There is an example in the reachabilityFence javadocs where it does not use finally. For it to matter, I think the compiler would need to inline through run() and prove that it can throw an exception, but I don't think that's how the JIT compilers currently implement reachabilityFence. I suppose a finally shouldn't hurt, however.
-------------
PR: https://git.openjdk.org/jdk/pull/10952
More information about the security-dev
mailing list