> Also fixed the bug with NPE in `IndirectVarHandle::isAccessModeSupported`.
> 
> A few implementation-detail methods in VarHandle are now documented with the 
> implied constraints to avoid subtle problems in the future. Changed 
> `IndirectVarHandle` to call `asDirect` lazily to accomodate the lazy 
> VarHandle changes. Also changed VarHandleBaseTest to report the whole 
> incorrect type of exception caught than swallow it and leaving only a message.
> 
> Current problems:
> - [ ] The lazy var handle is quite slow on the first invocation.
>    - As seen in the benchmark, users can first call 
> `Lookup::ensureInitialized` to create an eager handle.
>    - After that, the lazy handle has a performance on par with the regular 
> var handle.
> - [ ] The class-loading-based test is not in a unit test
>    - The test frameworks don't seem to offer fine-grained control for 
> class-loading detection or reliable unloading
> 
> 
> Benchmark                                            Mode  Cnt  Score   Error 
>  Units
> VarHandleLazyStaticInvocation.initializedInvocation  avgt   30  0.817 ± 0.012 
>  ns/op
> VarHandleLazyStaticInvocation.lazyInvocation         avgt   30  0.805 ± 0.007 
>  ns/op
> 
> 
> Benchmark                                            Mode  Cnt     Score     
> Error  Units
> Benchmark                                            Mode  Cnt   Score    
> Error  Units
> LazyStaticColdStart.methodHandleCreateEager            ss   10  36.890 ±  
> 2.891  us/op
> LazyStaticColdStart.methodHandleCreateLazy             ss   10  18.340 ±  
> 1.537  us/op
> LazyStaticColdStart.methodHandleInitializeCallEager    ss   10  50.000 ±  
> 5.590  us/op
> LazyStaticColdStart.methodHandleInitializeCallLazy     ss   10  90.550 ± 
> 10.142  us/op
> LazyStaticColdStart.varHandleCreateEager               ss   10  36.610 ±  
> 2.685  us/op
> LazyStaticColdStart.varHandleCreateLazy                ss   10  18.200 ±  
> 1.811  us/op
> LazyStaticColdStart.varHandleInitializeCallEager       ss   10  71.680 ± 
> 11.097  us/op
> LazyStaticColdStart.varHandleInitializeCallLazy        ss   10  72.090 ±  
> 4.494  us/op

Chen Liang has updated the pull request with a new target base due to a merge 
or a rebase. The pull request now contains 25 commits:

 - Fix bugs
 - Merge branch 'master' into lazy-static-varhandle
 - Move initialization barrier to getMethodHandle(Uncached)
 - Merge branch 'master' into lazy-static-varhandle
 - Remove meaningless target calls and clear outdated cache as needed
 - Split ensureInitialized
 - Merge branch 'master' into lazy-static-varhandle
 - Significantly improve Lazy VH initial call performance
 - Rename asDirect to target
 - Merge branch 'master' into lazy-static-varhandle
 - ... and 15 more: https://git.openjdk.org/jdk/compare/87e6fab2...0ac094b8

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

Changes: https://git.openjdk.org/jdk/pull/13821/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13821&range=11
  Stats: 789 lines in 11 files changed: 613 ins; 16 del; 160 mod
  Patch: https://git.openjdk.org/jdk/pull/13821.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13821/head:pull/13821

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

Reply via email to