RFR: Enable field access instrumentation for aarch64

Arthur Eubanks aeubanks at openjdk.java.net
Tue May 26 17:02:08 UTC 2020


On Thu, 21 May 2020 09:58:14 GMT, eric.1iu <github.com+10482586+erik1iu at openjdk.org> wrote:

> This patch enables field access instrumentation for aarch64.
> 
> According to the implementation of x86, this patch inserts TSAN
> functions in interpreter (templateTable_aarch64.cpp) at three places
> which can cover all field accesses:
> 
>   1. getfield_or_static
>   2. putfield_or_static
>   3. load_field_cp_cache_entry
> 
> This patch implements the annotation
> 'java.util.concurrent.annotation.LazyInit', which causes TSAN to ignore
> races on that field. References that marked by @LazyInit are not simply
> ignored, but a release/acquire is performed on them. This is so that any
> following accesses to its member variables are not also reported as race.
> 
> This patch also moves some architecture independent code into common
> files.
> 
> TODO:
>   - Array access instrumentation will be updated in later patch.
> 
> [Tests]
> test/hotspot/jtreg/tsan/RacyByteMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyCharMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyShortMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyIntMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyFloatMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyLongMemberLoopTest.java
> test/hotspot/jtreg/tsan/RacyDoubleMemberLoopTest.java
> test/hotspot/jtreg/tsan/LazyInitLoopTest.java
> test/hotspot/jtreg/tsan/LazyInitReferenceLoopTest.java
> 
> With this patch, those test cases above passed on aarch64.
> No new failure found on x86.

LGTM, just one minor nit

src/hotspot/share/interpreter/templateTable.hpp line 335:

> 334:   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg     ), int
> arg     ); 335:   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg
> ), bool arg    ); 336:   static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void
> (*gen)(TosState tos), TosState tos);

This seems unnecessary and can introduce potential merge conflicts

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

PR: https://git.openjdk.java.net/tsan/pull/11


More information about the tsan-dev mailing list