Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: runtime/vm/simulator_arm.h

Issue 2999853002: [vm] Implement more efficient CAS in simarm/simarm64 modes, v.2 (Closed)
Patch Set: Include simulator.h explicitly where it is required Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/simulator_arm.h
diff --git a/runtime/vm/simulator_arm.h b/runtime/vm/simulator_arm.h
index 5a59f5bcdf998d19a60dd1b1984751ce23dab1ab..b81ad9efb32d6f63a5a86a3498ae840042e77986 100644
--- a/runtime/vm/simulator_arm.h
+++ b/runtime/vm/simulator_arm.h
@@ -104,15 +104,6 @@ class Simulator {
bool fp_return = false,
bool fp_args = false);
- // Implementation of atomic compare and exchange in the same synchronization
- // domain as other synchronization primitive instructions (e.g. ldrex, strex).
- static uword CompareExchange(uword* address,
- uword compare_value,
- uword new_value);
- static uint32_t CompareExchangeUint32(uint32_t* address,
- uint32_t compare_value,
- uint32_t new_value);
-
// Runtime and native call support.
enum CallKind {
kRuntimeCall,
@@ -218,31 +209,13 @@ class Simulator {
intptr_t ReadExclusiveW(uword addr, Instr* instr);
intptr_t WriteExclusiveW(uword addr, intptr_t value, Instr* instr);
- // We keep track of 16 exclusive access address tags across all threads.
- // Since we cannot simulate a native context switch, which clears
- // the exclusive access state of the local monitor (using the CLREX
- // instruction), we associate the thread requesting exclusive access to the
- // address tag. Multiple threads requesting exclusive access (using the LDREX
- // instruction) to the same address will result in multiple address tags being
- // created for the same address, one per thread.
- // At any given time, each thread is associated to at most one address tag.
- static Mutex* exclusive_access_lock_;
- static const int kNumAddressTags = 16;
- static struct AddressTag {
- Thread* thread;
- uword addr;
- } exclusive_access_state_[kNumAddressTags];
- static int next_address_tag_;
-
- // Set access to given address to 'exclusive state' for current thread.
- static void SetExclusiveAccess(uword addr);
-
- // Returns true if the current thread has exclusive access to given address,
- // returns false otherwise. In either case, set access to given address to
- // 'open state' for all threads.
- // If given addr is NULL, set access to 'open state' for current
- // thread (CLREX).
- static bool HasExclusiveAccessAndOpen(uword addr);
+ // Exclusive access reservation: address and value observed during
+ // load-exclusive. Store-exclusive verifies that address is the same and
+ // performs atomic compare-and-swap with remembered value to observe value
+ // changes. This implementation of ldrex/strex instructions does not detect
+ // ABA situation and our uses of ldrex/strex don't need this detection.
+ uword exclusive_access_addr_;
+ uword exclusive_access_value_;
// Executing is handled based on the instruction type.
void DecodeType01(Instr* instr); // Both type 0 and type 1 rolled into one.
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698