Index: runtime/vm/simulator_mips.cc |
=================================================================== |
--- runtime/vm/simulator_mips.cc (revision 43532) |
+++ runtime/vm/simulator_mips.cc (working copy) |
@@ -795,7 +795,17 @@ |
argument_count_(argument_count), |
break_instruction_(Instr::kSimulatorRedirectInstruction), |
next_(list_) { |
- list_ = this; |
+ // Atomically prepend this element to the front of the global list. |
+ // Note: Since elements are never removed, there is no ABA issue. |
+ Redirection* old_list = list_; |
+ do { |
+ next_ = old_list; |
+ old_list = reinterpret_cast<Redirection*>( |
+ AtomicOperations::CompareAndSwapWord( |
+ reinterpret_cast<uword*>(&list_), |
+ reinterpret_cast<uword>(next_), |
+ reinterpret_cast<uword>(this))); |
+ } while (old_list != next_); |
} |
uword external_function_; |