Re: RFR: 8286849: Use @Stable for generic repositories

2022-05-23 Thread liach
On Tue, 17 May 2022 04:40:50 GMT, liach  wrote:

> Generic repositories, the implementation detail for generic information in 
> core reflection, can be updated to use the `@Stable` annotation to replace 
> their `volatile` access. Their existing accessor code is already safe, 
> reading the cache fields only once.
> 
> In addition, fixed potentially non-thread-safe `genericInfo` access in 
> `Method`, `Field`, and `RecordComponent`.

This should offer slight performance benefit if a reflection object has its 
generic information accessed frequently, as reading a stable field is faster 
than reading a volatile field for cached objects. If the `genericInfo` fields 
are updated by JVMTI then they need to be declared `volatile` instead. In 
addition, some of the `genericInfo` fields may have been not thread-safe for 
their multiple field reads.

-

PR: https://git.openjdk.java.net/jdk/pull/8742


Re: RFR: 8286849: Use @Stable for generic repositories

2022-05-23 Thread Sergey Bylokhov
On Tue, 17 May 2022 04:40:50 GMT, liach  wrote:

> Generic repositories, the implementation detail for generic information in 
> core reflection, can be updated to use the `@Stable` annotation to replace 
> their `volatile` access. Their existing accessor code is already safe, 
> reading the cache fields only once.
> 
> In addition, fixed potentially non-thread-safe `genericInfo` access in 
> `Method`, `Field`, and `RecordComponent`.

Just curious about any performance benefits of this patch?

-

PR: https://git.openjdk.java.net/jdk/pull/8742


RFR: 8286849: Use @Stable for generic repositories

2022-05-16 Thread liach
Generic repositories, the implementation detail for generic information in core 
reflection, can be updated to use the `@Stable` annotation to replace their 
`volatile` access. Their existing accessor code is already safe, reading the 
cache fields only once.

In addition, fixed potentially non-thread-safe `genericInfo` access in 
`Method`, `Field`, and `RecordComponent`.

-

Commit messages:
 - 8286849: Use @Stable for generic repositories

Changes: https://git.openjdk.java.net/jdk/pull/8742/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=8742=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286849
  Stats: 45 lines in 11 files changed: 29 ins; 0 del; 16 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8742.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8742/head:pull/8742

PR: https://git.openjdk.java.net/jdk/pull/8742