| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 <math.h> // for isnan. | 5 #include <math.h> // for isnan. |
| 6 #include <setjmp.h> | 6 #include <setjmp.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #if defined(TARGET_ARCH_ARM) | 10 #if defined(TARGET_ARCH_ARM) |
| (...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 | 701 |
| 702 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { | 702 bool Simulator::HasExclusiveAccessAndOpen(uword addr) { |
| 703 Isolate* isolate = Isolate::Current(); | 703 Isolate* isolate = Isolate::Current(); |
| 704 ASSERT(isolate != NULL); | 704 ASSERT(isolate != NULL); |
| 705 bool result = false; | 705 bool result = false; |
| 706 for (int i = 0; i < kNumAddressTags; i++) { | 706 for (int i = 0; i < kNumAddressTags; i++) { |
| 707 if (exclusive_access_state_[i].isolate == isolate) { | 707 if (exclusive_access_state_[i].isolate == isolate) { |
| 708 if (exclusive_access_state_[i].addr == addr) { | 708 if (exclusive_access_state_[i].addr == addr) { |
| 709 result = true; | 709 result = true; |
| 710 } | 710 } |
| 711 exclusive_access_state_[i].addr = NULL; | 711 exclusive_access_state_[i].addr = static_cast<uword>(NULL); |
| 712 continue; | 712 continue; |
| 713 } | 713 } |
| 714 if (exclusive_access_state_[i].addr == addr) { | 714 if (exclusive_access_state_[i].addr == addr) { |
| 715 exclusive_access_state_[i].addr = NULL; | 715 exclusive_access_state_[i].addr = static_cast<uword>(NULL); |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 return result; | 718 return result; |
| 719 } | 719 } |
| 720 | 720 |
| 721 | 721 |
| 722 void Simulator::InitOnce() { | 722 void Simulator::InitOnce() { |
| 723 // Setup exclusive access state. | 723 // Setup exclusive access state. |
| 724 exclusive_access_lock_ = new Mutex(); | 724 exclusive_access_lock_ = new Mutex(); |
| 725 for (int i = 0; i < kNumAddressTags; i++) { | 725 for (int i = 0; i < kNumAddressTags; i++) { |
| 726 exclusive_access_state_[i].isolate = NULL; | 726 exclusive_access_state_[i].isolate = NULL; |
| 727 exclusive_access_state_[i].addr = NULL; | 727 exclusive_access_state_[i].addr = static_cast<uword>(NULL); |
| 728 } | 728 } |
| 729 next_address_tag_ = 0; | 729 next_address_tag_ = 0; |
| 730 } | 730 } |
| 731 | 731 |
| 732 | 732 |
| 733 Simulator::Simulator() { | 733 Simulator::Simulator() { |
| 734 // Setup simulator support first. Some of this information is needed to | 734 // Setup simulator support first. Some of this information is needed to |
| 735 // setup the architecture state. | 735 // setup the architecture state. |
| 736 // We allocate the stack here, the size is computed as the sum of | 736 // We allocate the stack here, the size is computed as the sum of |
| 737 // the size specified by the user and the buffer space needed for | 737 // the size specified by the user and the buffer space needed for |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); | 1099 uint8_t* ptr = reinterpret_cast<uint8_t*>(addr); |
| 1100 *ptr = value; | 1100 *ptr = value; |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 | 1103 |
| 1104 // Synchronization primitives support. | 1104 // Synchronization primitives support. |
| 1105 void Simulator::ClearExclusive() { | 1105 void Simulator::ClearExclusive() { |
| 1106 // This lock is initialized in Simulator::InitOnce(). | 1106 // This lock is initialized in Simulator::InitOnce(). |
| 1107 MutexLocker ml(exclusive_access_lock_); | 1107 MutexLocker ml(exclusive_access_lock_); |
| 1108 // Set exclusive access to open state for this isolate. | 1108 // Set exclusive access to open state for this isolate. |
| 1109 HasExclusiveAccessAndOpen(NULL); | 1109 HasExclusiveAccessAndOpen(static_cast<uword>(NULL)); |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 | 1112 |
| 1113 intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { | 1113 intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { |
| 1114 // This lock is initialized in Simulator::InitOnce(). | 1114 // This lock is initialized in Simulator::InitOnce(). |
| 1115 MutexLocker ml(exclusive_access_lock_); | 1115 MutexLocker ml(exclusive_access_lock_); |
| 1116 SetExclusiveAccess(addr); | 1116 SetExclusiveAccess(addr); |
| 1117 return ReadW(addr, instr); | 1117 return ReadW(addr, instr); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| (...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3799 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); | 3799 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); |
| 3800 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); | 3800 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); |
| 3801 buf->Longjmp(); | 3801 buf->Longjmp(); |
| 3802 } | 3802 } |
| 3803 | 3803 |
| 3804 } // namespace dart | 3804 } // namespace dart |
| 3805 | 3805 |
| 3806 #endif // !defined(HOST_ARCH_ARM) | 3806 #endif // !defined(HOST_ARCH_ARM) |
| 3807 | 3807 |
| 3808 #endif // defined TARGET_ARCH_ARM | 3808 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |