OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 private: | 843 private: |
844 static const int32_t kRedirectInstruction = Instr::kRedirectInstruction; | 844 static const int32_t kRedirectInstruction = Instr::kRedirectInstruction; |
845 Redirection(uword external_function, | 845 Redirection(uword external_function, |
846 Simulator::CallKind call_kind, | 846 Simulator::CallKind call_kind, |
847 int argument_count) | 847 int argument_count) |
848 : external_function_(external_function), | 848 : external_function_(external_function), |
849 call_kind_(call_kind), | 849 call_kind_(call_kind), |
850 argument_count_(argument_count), | 850 argument_count_(argument_count), |
851 hlt_instruction_(kRedirectInstruction), | 851 hlt_instruction_(kRedirectInstruction), |
852 next_(list_) { | 852 next_(list_) { |
853 list_ = this; | 853 // Atomically prepend this element to the front of the global list. |
| 854 // Note: Since elements are never removed, there is no ABA issue. |
| 855 Redirection* old_list = list_; |
| 856 do { |
| 857 next_ = old_list; |
| 858 old_list = reinterpret_cast<Redirection*>( |
| 859 AtomicOperations::CompareAndSwapWord( |
| 860 reinterpret_cast<uword*>(&list_), |
| 861 reinterpret_cast<uword>(next_), |
| 862 reinterpret_cast<uword>(this))); |
| 863 } while (old_list != next_); |
854 } | 864 } |
855 | 865 |
856 uword external_function_; | 866 uword external_function_; |
857 Simulator::CallKind call_kind_; | 867 Simulator::CallKind call_kind_; |
858 int argument_count_; | 868 int argument_count_; |
859 uint32_t hlt_instruction_; | 869 uint32_t hlt_instruction_; |
860 Redirection* next_; | 870 Redirection* next_; |
861 static Redirection* list_; | 871 static Redirection* list_; |
862 }; | 872 }; |
863 | 873 |
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3495 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3505 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3496 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3506 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3497 buf->Longjmp(); | 3507 buf->Longjmp(); |
3498 } | 3508 } |
3499 | 3509 |
3500 } // namespace dart | 3510 } // namespace dart |
3501 | 3511 |
3502 #endif // !defined(HOST_ARCH_ARM64) | 3512 #endif // !defined(HOST_ARCH_ARM64) |
3503 | 3513 |
3504 #endif // defined TARGET_ARCH_ARM64 | 3514 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |