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

Side by Side Diff: runtime/vm/simulator_arm.h

Issue 616223005: Adds back arm ldrex strex. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm_test.cc ('k') | runtime/vm/simulator_arm.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) 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 // Declares a Simulator for ARM instructions if we are not generating a native 5 // Declares a Simulator for ARM instructions if we are not generating a native
6 // ARM binary. This Simulator allows us to run and debug ARM code generation on 6 // ARM binary. This Simulator allows us to run and debug ARM code generation on
7 // regular desktop machines. 7 // regular desktop machines.
8 // Dart calls into generated code by "calling" the InvokeDartCode stub, 8 // Dart calls into generated code by "calling" the InvokeDartCode stub,
9 // which will start execution in the Simulator or forwards to the real entry 9 // which will start execution in the Simulator or forwards to the real entry
10 // on a ARM HW platform. 10 // on a ARM HW platform.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // If fp_args is true, the parameters0-3 are placed in S0-3. Otherwise, they 87 // If fp_args is true, the parameters0-3 are placed in S0-3. Otherwise, they
88 // are placed in R0-3. 88 // are placed in R0-3.
89 int64_t Call(int32_t entry, 89 int64_t Call(int32_t entry,
90 int32_t parameter0, 90 int32_t parameter0,
91 int32_t parameter1, 91 int32_t parameter1,
92 int32_t parameter2, 92 int32_t parameter2,
93 int32_t parameter3, 93 int32_t parameter3,
94 bool fp_return = false, 94 bool fp_return = false,
95 bool fp_args = false); 95 bool fp_args = false);
96 96
97 // Implementation of atomic compare and exchange in the same synchronization
98 // domain as other synchronization primitive instructions (e.g. ldrex, strex).
99 static uword CompareExchange(uword* address,
100 uword compare_value,
101 uword new_value);
97 102
98 // Runtime and native call support. 103 // Runtime and native call support.
99 enum CallKind { 104 enum CallKind {
100 kRuntimeCall, 105 kRuntimeCall,
101 kLeafRuntimeCall, 106 kLeafRuntimeCall,
102 kLeafFloatRuntimeCall, 107 kLeafFloatRuntimeCall,
103 kBootstrapNativeCall, 108 kBootstrapNativeCall,
104 kNativeCall 109 kNativeCall
105 }; 110 };
106 static uword RedirectExternalReference(uword function, 111 static uword RedirectExternalReference(uword function,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 inline int8_t ReadB(uword addr); 202 inline int8_t ReadB(uword addr);
198 inline void WriteB(uword addr, uint8_t value); 203 inline void WriteB(uword addr, uint8_t value);
199 204
200 inline uint16_t ReadHU(uword addr, Instr* instr); 205 inline uint16_t ReadHU(uword addr, Instr* instr);
201 inline int16_t ReadH(uword addr, Instr* instr); 206 inline int16_t ReadH(uword addr, Instr* instr);
202 inline void WriteH(uword addr, uint16_t value, Instr* instr); 207 inline void WriteH(uword addr, uint16_t value, Instr* instr);
203 208
204 inline intptr_t ReadW(uword addr, Instr* instr); 209 inline intptr_t ReadW(uword addr, Instr* instr);
205 inline void WriteW(uword addr, intptr_t value, Instr* instr); 210 inline void WriteW(uword addr, intptr_t value, Instr* instr);
206 211
212 // Synchronization primitives support.
213 void ClearExclusive();
214 intptr_t ReadExclusiveW(uword addr, Instr* instr);
215 intptr_t WriteExclusiveW(uword addr, intptr_t value, Instr* instr);
216
217 // In Dart, there is at most one thread per isolate.
218 // We keep track of 16 exclusive access address tags across all isolates.
219 // Since we cannot simulate a native context switch, which clears
220 // the exclusive access state of the local monitor (using the CLREX
221 // instruction), we associate the isolate requesting exclusive access to the
222 // address tag. Multiple isolates requesting exclusive access (using the LDREX
223 // instruction) to the same address will result in multiple address tags being
224 // created for the same address, one per isolate.
225 // At any given time, each isolate is associated to at most one address tag.
226 static Mutex* exclusive_access_lock_;
227 static const int kNumAddressTags = 16;
228 static struct AddressTag {
229 Isolate* isolate;
230 uword addr;
231 } exclusive_access_state_[kNumAddressTags];
232 static int next_address_tag_;
233
234 // Set access to given address to 'exclusive state' for current isolate.
235 static void SetExclusiveAccess(uword addr);
236
237 // Returns true if the current isolate has exclusive access to given address,
238 // returns false otherwise. In either case, set access to given address to
239 // 'open state' for all isolates.
240 // If given addr is NULL, set access to 'open state' for current
241 // isolate (CLREX).
242 static bool HasExclusiveAccessAndOpen(uword addr);
243
207 // Executing is handled based on the instruction type. 244 // Executing is handled based on the instruction type.
208 void DecodeType01(Instr* instr); // Both type 0 and type 1 rolled into one. 245 void DecodeType01(Instr* instr); // Both type 0 and type 1 rolled into one.
209 void DecodeType2(Instr* instr); 246 void DecodeType2(Instr* instr);
210 void DecodeType3(Instr* instr); 247 void DecodeType3(Instr* instr);
211 void DecodeType4(Instr* instr); 248 void DecodeType4(Instr* instr);
212 void DecodeType5(Instr* instr); 249 void DecodeType5(Instr* instr);
213 void DecodeType6(Instr* instr); 250 void DecodeType6(Instr* instr);
214 void DecodeType7(Instr* instr); 251 void DecodeType7(Instr* instr);
215 void DecodeSIMDDataProcessing(Instr* instr); 252 void DecodeSIMDDataProcessing(Instr* instr);
216 253
(...skipping 12 matching lines...) Expand all
229 } 266 }
230 267
231 friend class SimulatorDebugger; 268 friend class SimulatorDebugger;
232 friend class SimulatorSetjmpBuffer; 269 friend class SimulatorSetjmpBuffer;
233 DISALLOW_COPY_AND_ASSIGN(Simulator); 270 DISALLOW_COPY_AND_ASSIGN(Simulator);
234 }; 271 };
235 272
236 } // namespace dart 273 } // namespace dart
237 274
238 #endif // VM_SIMULATOR_ARM_H_ 275 #endif // VM_SIMULATOR_ARM_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm_test.cc ('k') | runtime/vm/simulator_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698