Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(613)

Side by Side Diff: runtime/vm/simulator_arm64.cc

Issue 1722013002: Enable concurrent sweep on MIPS and ARM64. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: clrex and assembler tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/simulator_arm64.h ('k') | runtime/vm/simulator_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1216 }
1217 1217
1218 1218
1219 void Simulator::ClearExclusive() { 1219 void Simulator::ClearExclusive() {
1220 MutexLocker ml(exclusive_access_lock_); 1220 MutexLocker ml(exclusive_access_lock_);
1221 // Remove the reservation for this thread. 1221 // Remove the reservation for this thread.
1222 SetExclusiveAccess(NULL); 1222 SetExclusiveAccess(NULL);
1223 } 1223 }
1224 1224
1225 1225
1226 intptr_t Simulator::ReadExclusiveW(uword addr, Instr* instr) { 1226 intptr_t Simulator::ReadExclusiveX(uword addr, Instr* instr) {
1227 MutexLocker ml(exclusive_access_lock_); 1227 MutexLocker ml(exclusive_access_lock_);
1228 SetExclusiveAccess(addr); 1228 SetExclusiveAccess(addr);
1229 return ReadW(addr, instr); 1229 return ReadX(addr, instr);
1230 } 1230 }
1231 1231
1232 1232
1233 intptr_t Simulator::WriteExclusiveW(uword addr, intptr_t value, Instr* instr) { 1233 intptr_t Simulator::WriteExclusiveX(uword addr, intptr_t value, Instr* instr) {
1234 MutexLocker ml(exclusive_access_lock_); 1234 MutexLocker ml(exclusive_access_lock_);
1235 bool write_allowed = HasExclusiveAccessAndOpen(addr); 1235 bool write_allowed = HasExclusiveAccessAndOpen(addr);
1236 if (write_allowed) { 1236 if (write_allowed) {
1237 WriteW(addr, value, instr); 1237 WriteX(addr, value, instr);
1238 return 0; // Success. 1238 return 0; // Success.
1239 } 1239 }
1240 return 1; // Failure. 1240 return 1; // Failure.
1241 } 1241 }
1242 1242
1243 1243
1244 uword Simulator::CompareExchange(uword* address, 1244 uword Simulator::CompareExchange(uword* address,
1245 uword compare_value, 1245 uword compare_value,
1246 uword new_value) { 1246 uword new_value) {
1247 MutexLocker ml(exclusive_access_lock_); 1247 MutexLocker ml(exclusive_access_lock_);
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 } else { 1742 } else {
1743 UnimplementedInstruction(instr); 1743 UnimplementedInstruction(instr);
1744 } 1744 }
1745 } else { 1745 } else {
1746 UnimplementedInstruction(instr); 1746 UnimplementedInstruction(instr);
1747 } 1747 }
1748 } 1748 }
1749 1749
1750 1750
1751 void Simulator::DecodeSystem(Instr* instr) { 1751 void Simulator::DecodeSystem(Instr* instr) {
1752 if (instr->InstructionBits() == CLREX) {
1753 // Format(instr, "clrex");
1754 ClearExclusive();
1755 return;
1756 }
1757
1752 if ((instr->Bits(0, 8) == 0x1f) && (instr->Bits(12, 4) == 2) && 1758 if ((instr->Bits(0, 8) == 0x1f) && (instr->Bits(12, 4) == 2) &&
1753 (instr->Bits(16, 3) == 3) && (instr->Bits(19, 2) == 0) && 1759 (instr->Bits(16, 3) == 3) && (instr->Bits(19, 2) == 0) &&
1754 (instr->Bit(21) == 0)) { 1760 (instr->Bit(21) == 0)) {
1755 if (instr->Bits(8, 4) == 0) { 1761 if (instr->Bits(8, 4) == 0) {
1756 // Format(instr, "nop"); 1762 // Format(instr, "nop");
1757 } else { 1763 } else {
1758 UnimplementedInstruction(instr); 1764 UnimplementedInstruction(instr);
1759 } 1765 }
1760 } else { 1766 } else {
1761 UnimplementedInstruction(instr); 1767 UnimplementedInstruction(instr);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 if (instr->Bit(30)) { 2163 if (instr->Bit(30)) {
2158 // Format(instr, "ldrx 'rt, 'pcldr"); 2164 // Format(instr, "ldrx 'rt, 'pcldr");
2159 set_register(instr, rt, val, R31IsZR); 2165 set_register(instr, rt, val, R31IsZR);
2160 } else { 2166 } else {
2161 // Format(instr, "ldrw 'rt, 'pcldr"); 2167 // Format(instr, "ldrw 'rt, 'pcldr");
2162 set_wregister(rt, static_cast<int32_t>(val), R31IsZR); 2168 set_wregister(rt, static_cast<int32_t>(val), R31IsZR);
2163 } 2169 }
2164 } 2170 }
2165 2171
2166 2172
2173 void Simulator::DecodeLoadStoreExclusive(Instr* instr) {
2174 if ((instr->Bit(23) != 0) ||
2175 (instr->Bit(21) != 0) ||
2176 (instr->Bit(15) != 0)) {
2177 UNIMPLEMENTED();
2178 }
2179 const int32_t size = instr->Bits(30, 2);
2180 if (size != 3) {
2181 UNIMPLEMENTED();
2182 }
2183
2184 const Register rs = instr->RsField();
2185 const Register rn = instr->RnField();
2186 const Register rt = instr->RtField();
2187 const bool is_load = instr->Bit(22) == 1;
2188 if (is_load) {
2189 // Format(instr, "ldxr 'rt, 'rn");
2190 const int64_t addr = get_register(rn, R31IsSP);
2191 intptr_t value = ReadExclusiveX(addr, instr);
2192 set_register(instr, rt, value, R31IsSP);
2193 } else {
2194 // Format(instr, "stxr 'rs, 'rt, 'rn");
2195 uword value = get_register(rt, R31IsSP);
2196 uword addr = get_register(rn, R31IsSP);
2197 intptr_t status = WriteExclusiveX(addr, value, instr);
2198 set_register(instr, rs, status, R31IsSP);
2199 }
2200 }
2201
2202
2167 void Simulator::DecodeLoadStore(Instr* instr) { 2203 void Simulator::DecodeLoadStore(Instr* instr) {
2168 if (instr->IsLoadStoreRegOp()) { 2204 if (instr->IsLoadStoreRegOp()) {
2169 DecodeLoadStoreReg(instr); 2205 DecodeLoadStoreReg(instr);
2170 } else if (instr->IsLoadStoreRegPairOp()) { 2206 } else if (instr->IsLoadStoreRegPairOp()) {
2171 DecodeLoadStoreRegPair(instr); 2207 DecodeLoadStoreRegPair(instr);
2172 } else if (instr->IsLoadRegLiteralOp()) { 2208 } else if (instr->IsLoadRegLiteralOp()) {
2173 DecodeLoadRegLiteral(instr); 2209 DecodeLoadRegLiteral(instr);
2210 } else if (instr->IsLoadStoreExclusiveOp()) {
2211 DecodeLoadStoreExclusive(instr);
2174 } else { 2212 } else {
2175 UnimplementedInstruction(instr); 2213 UnimplementedInstruction(instr);
2176 } 2214 }
2177 } 2215 }
2178 2216
2179 2217
2180 int64_t Simulator::ShiftOperand(uint8_t reg_size, 2218 int64_t Simulator::ShiftOperand(uint8_t reg_size,
2181 int64_t value, 2219 int64_t value,
2182 Shift shift_type, 2220 Shift shift_type,
2183 uint8_t amount) { 2221 uint8_t amount) {
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3568 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); 3606 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
3569 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); 3607 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
3570 buf->Longjmp(); 3608 buf->Longjmp();
3571 } 3609 }
3572 3610
3573 } // namespace dart 3611 } // namespace dart
3574 3612
3575 #endif // !defined(USING_SIMULATOR) 3613 #endif // !defined(USING_SIMULATOR)
3576 3614
3577 #endif // defined TARGET_ARCH_ARM64 3615 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/simulator_arm64.h ('k') | runtime/vm/simulator_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698