| 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> | 5 #include <setjmp.h> |
| 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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 void Simulator::WriteB(uword addr, uint8_t value) { | 934 void Simulator::WriteB(uword addr, uint8_t value) { |
| 935 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); | 935 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); |
| 936 *ptr = value; | 936 *ptr = value; |
| 937 } | 937 } |
| 938 | 938 |
| 939 | 939 |
| 940 // Synchronization primitives support. | 940 // Synchronization primitives support. |
| 941 void Simulator::SetExclusiveAccess(uword addr) { | 941 void Simulator::SetExclusiveAccess(uword addr) { |
| 942 Isolate* isolate = Isolate::Current(); | 942 Isolate* isolate = Isolate::Current(); |
| 943 ASSERT(isolate != NULL); | 943 ASSERT(isolate != NULL); |
| 944 ASSERT(exclusive_access_lock_->Owner() == isolate); | 944 DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate); |
| 945 int i = 0; | 945 int i = 0; |
| 946 // Find an entry for this isolate in the exclusive access state. | 946 // Find an entry for this isolate in the exclusive access state. |
| 947 while ((i < kNumAddressTags) && | 947 while ((i < kNumAddressTags) && |
| 948 (exclusive_access_state_[i].isolate != isolate)) { | 948 (exclusive_access_state_[i].isolate != isolate)) { |
| 949 i++; | 949 i++; |
| 950 } | 950 } |
| 951 // Round-robin replacement of previously used entries. | 951 // Round-robin replacement of previously used entries. |
| 952 if (i == kNumAddressTags) { | 952 if (i == kNumAddressTags) { |
| 953 i = next_address_tag_; | 953 i = next_address_tag_; |
| 954 if (++next_address_tag_ == kNumAddressTags) { | 954 if (++next_address_tag_ == kNumAddressTags) { |
| 955 next_address_tag_ = 0; | 955 next_address_tag_ = 0; |
| 956 } | 956 } |
| 957 exclusive_access_state_[i].isolate = isolate; | 957 exclusive_access_state_[i].isolate = isolate; |
| 958 } | 958 } |
| 959 // Remember the address being reserved. | 959 // Remember the address being reserved. |
| 960 exclusive_access_state_[i].addr = addr; | 960 exclusive_access_state_[i].addr = addr; |
| 961 } | 961 } |
| 962 | 962 |
| 963 | 963 |
| 964 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { | 964 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { |
| 965 Isolate* isolate = Isolate::Current(); | 965 Isolate* isolate = Isolate::Current(); |
| 966 ASSERT(isolate != NULL); | 966 ASSERT(isolate != NULL); |
| 967 ASSERT(addr != 0); | 967 ASSERT(addr != 0); |
| 968 ASSERT(exclusive_access_lock_->Owner() == isolate); | 968 DEBUG_ASSERT(exclusive_access_lock_->Owner() == isolate); |
| 969 bool result = false; | 969 bool result = false; |
| 970 for (int i = 0; i < kNumAddressTags; i++) { | 970 for (int i = 0; i < kNumAddressTags; i++) { |
| 971 if (exclusive_access_state_[i].isolate == isolate) { | 971 if (exclusive_access_state_[i].isolate == isolate) { |
| 972 // Check whether the current isolates address reservation matches. | 972 // Check whether the current isolates address reservation matches. |
| 973 if (exclusive_access_state_[i].addr == addr) { | 973 if (exclusive_access_state_[i].addr == addr) { |
| 974 result = true; | 974 result = true; |
| 975 } | 975 } |
| 976 exclusive_access_state_[i].addr = 0; | 976 exclusive_access_state_[i].addr = 0; |
| 977 } else if (exclusive_access_state_[i].addr == addr) { | 977 } else if (exclusive_access_state_[i].addr == addr) { |
| 978 // Other isolates with matching address lose their reservations. | 978 // Other isolates with matching address lose their reservations. |
| (...skipping 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3246 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3246 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
| 3247 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3247 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
| 3248 buf->Longjmp(); | 3248 buf->Longjmp(); |
| 3249 } | 3249 } |
| 3250 | 3250 |
| 3251 } // namespace dart | 3251 } // namespace dart |
| 3252 | 3252 |
| 3253 #endif // !defined(HOST_ARCH_ARM64) | 3253 #endif // !defined(HOST_ARCH_ARM64) |
| 3254 | 3254 |
| 3255 #endif // defined TARGET_ARCH_ARM64 | 3255 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |