Add some missing barriers when dealing with global caches (mono/mono#18032)
authorJay Krell <jaykrell@microsoft.com>
Sun, 8 Dec 2019 14:30:48 +0000 (06:30 -0800)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Sun, 8 Dec 2019 14:30:48 +0000 (15:30 +0100)
commit7ff9eeb5abc4e69cddbd77f149a918acb36dbbd8
treefa38b139e4c3394257f318eb3a67b0faeae93ec3
parent5cfb55e112fecfa2b98b4b877c61c13fc4ec9ea4
Add some missing barriers when dealing with global caches (mono/mono#18032)

* Add some missing barriers when dealing with global caches
accessed from multiple threads without locks.

This is based on earlier PR https://github.com/mono/mono/pull/17849.

Read-side barriers are removed.
  More analysis is needed to determine if they are needed (which pointer
  read vs. written).
Write-side barriers are compiler barrier + store-release instead of full barrier.

Note all candidates are converted to new form yet.

Cases that do motivate read-wide barriers are skipped.
e.g.
`mono_arch_start_dyn_call`
`get_agent_domain_info`
`init_jit_info_dbg_attrs`

* PR: Remove 'Try one more time..'

Commit migrated from https://github.com/mono/mono/commit/a6c4eafee8a264ce786d00c6035b0acc7fa97a8b
src/mono/mono/metadata/appdomain.c
src/mono/mono/metadata/assembly-load-context.c
src/mono/mono/metadata/boehm-gc.c
src/mono/mono/metadata/class-init.c
src/mono/mono/metadata/class-internals.h