RFR: 8330465: Stable Values and Collections (Internal) [v5]

Chen Liang liach at openjdk.org
Thu May 16 11:18:10 UTC 2024


On Thu, 16 May 2024 07:11:20 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 139:
>> 
>>> 137:             case NON_NULL: { return valueVolatile(); }
>>> 138:             case ERROR:    { throw StableUtil.error(this); }
>>> 139:             case DUMMY:    { throw shouldNotReachHere(); }
>> 
>> Redundant branch?
>
> The idea here is to have the most likely value in the middle... Not sure if that motivates the added complexity though.

Is there any refernce on how/why the middle entry in a tableswitch instruction is the fastest?

>> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 236:
>> 
>>> 234:                 } catch (Throwable t) {
>>> 235:                     putState(ERROR);
>>> 236:                     putMutex(t.getClass());
>> 
>> Should we cache the exception instance so we can rethrow it in future ERROR state `orThrow` calls?
>
> We considered recording the entire exception instance but for security reasons, we ended up just recording the type of exception. I will add a comment explaining this in the code.

Thanks for this clarification. Makes sense.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18794#discussion_r1603149806
PR Review Comment: https://git.openjdk.org/jdk/pull/18794#discussion_r1603150592


More information about the compiler-dev mailing list