RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10]

Brian Goetz briangoetz at openjdk.org
Thu Jun 8 16:37:45 UTC 2023


On Thu, 8 Jun 2023 13:37:33 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html
>> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert "ClassHierarchyResolver::ofSystem is now thread-unsafe"
>   
>   This reverts commit f3099cd5b252924392995bf65edc710c27822d2b.

On 6/8/2023 12:09 PM, Adam Sotona wrote:
>
>     Here are a few options:
>      - Make the CHA cache thread-safe using, say, CHM;
>
> This is current solution for the default system CH cache.
>
> We may also use a bit less strict custom semi-synchronization (just 
> enough to be thread safe) instead of fully-synchronized 
> |CHM::computeIfAbsent|, for example |CHM:get … (compute if absent 
> without lock) ... CHM::put|.
> CHM does not lock on get, so the only penalty would be synchronous put 
> call.
>
>      - Make the CHA cache unshared, by using a ThreadLocal (this
>     brings the context back to being immutable)
>
> This is interesting option for small number of threads, however it 
> makes big footprint for heavy-parallel systems.
>

I have a hard time imagining heavy parallel use here; concurrency 
against the same cache would most likely come from accidental sharing.  
So this is not necessarily a problem.  Are you imagining differnet use 
cases?

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

PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1583003584


More information about the core-libs-dev mailing list