Chromium Code Reviews| Index: runtime/vm/simulator_arm.cc |
| =================================================================== |
| --- runtime/vm/simulator_arm.cc (revision 43532) |
| +++ runtime/vm/simulator_arm.cc (working copy) |
| @@ -811,9 +811,18 @@ |
| : external_function_(external_function), |
| call_kind_(call_kind), |
| argument_count_(argument_count), |
| - svc_instruction_(Instr::kSimulatorRedirectInstruction), |
| - next_(list_) { |
| - list_ = this; |
| + svc_instruction_(Instr::kSimulatorRedirectInstruction) { |
| + // 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; |
|
Cutch
2015/02/06 00:47:10
consider renaming "old_list" to "list_head".
koda
2015/02/06 15:50:22
Done.
|
| + 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_; |