| 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 // Declares a Simulator for ARM64 instructions if we are not generating a native | 5 // Declares a Simulator for ARM64 instructions if we are not generating a native |
| 6 // ARM64 binary. This Simulator allows us to run and debug ARM64 code generation | 6 // ARM64 binary. This Simulator allows us to run and debug ARM64 code generation |
| 7 // on regular desktop machines. | 7 // on 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 ARM64 HW platform. | 10 // on a ARM64 HW platform. |
| 11 | 11 |
| 12 #ifndef VM_SIMULATOR_ARM64_H_ | 12 #ifndef VM_SIMULATOR_ARM64_H_ |
| 13 #define VM_SIMULATOR_ARM64_H_ | 13 #define VM_SIMULATOR_ARM64_H_ |
| 14 | 14 |
| 15 #ifndef VM_SIMULATOR_H_ | 15 #ifndef VM_SIMULATOR_H_ |
| 16 #error Do not include simulator_arm64.h directly; use simulator.h. | 16 #error Do not include simulator_arm64.h directly; use simulator.h. |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #include "vm/constants_arm64.h" | 19 #include "vm/constants_arm64.h" |
| 20 #include "vm/object.h" | 20 #include "vm/object.h" |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 | 23 |
| 24 class Isolate; | 24 class Isolate; |
| 25 class SimulatorSetjmpBuffer; | 25 class SimulatorSetjmpBuffer; |
| 26 | 26 |
| 27 typedef struct { | 27 typedef struct { |
| 28 int64_t lo; | 28 union { |
| 29 int64_t hi; | 29 int64_t i64[2]; |
| 30 int32_t i32[4]; |
| 31 } bits; |
| 30 } simd_value_t; | 32 } simd_value_t; |
| 31 | 33 |
| 32 class Simulator { | 34 class Simulator { |
| 33 public: | 35 public: |
| 34 static const uword kSimulatorStackUnderflowSize = 64; | 36 static const uword kSimulatorStackUnderflowSize = 64; |
| 35 | 37 |
| 36 Simulator(); | 38 Simulator(); |
| 37 ~Simulator(); | 39 ~Simulator(); |
| 38 | 40 |
| 39 // The currently executing Simulator instance, which is associated to the | 41 // The currently executing Simulator instance, which is associated to the |
| 40 // current isolate | 42 // current isolate |
| 41 static Simulator* Current(); | 43 static Simulator* Current(); |
| 42 | 44 |
| 43 // Accessors for register state. | 45 // Accessors for register state. |
| 44 // The default value for R31Type has to be R31IsSP because get_register is | 46 // The default value for R31Type has to be R31IsSP because get_register is |
| 45 // accessed from architecture independent code through SPREG without | 47 // accessed from architecture independent code through SPREG without |
| 46 // specifying the type. We also can't translate a dummy value for SPREG into | 48 // specifying the type. We also can't translate a dummy value for SPREG into |
| 47 // a real value because the architecture independent code expects SPREG to | 49 // a real value because the architecture independent code expects SPREG to |
| 48 // be a real register value. | 50 // be a real register value. |
| 49 void set_register(Register reg, int64_t value, R31Type r31t = R31IsSP); | 51 void set_register(Register reg, int64_t value, R31Type r31t = R31IsSP); |
| 50 int64_t get_register(Register reg, R31Type r31t = R31IsSP) const; | 52 int64_t get_register(Register reg, R31Type r31t = R31IsSP) const; |
| 51 void set_wregister(Register reg, int32_t value, R31Type r31t = R31IsSP); | 53 void set_wregister(Register reg, int32_t value, R31Type r31t = R31IsSP); |
| 52 int32_t get_wregister(Register reg, R31Type r31t = R31IsSP) const; | 54 int32_t get_wregister(Register reg, R31Type r31t = R31IsSP) const; |
| 53 | 55 |
| 54 // Get and set a V register in double ('d') mode. Setting clears the high | 56 int32_t get_vregisters(VRegister reg, int idx) const; |
| 55 // 64 bits of the V register. Getting ignores the high 64 bits. | 57 void set_vregisters(VRegister reg, int idx, int32_t value); |
| 56 int64_t get_vregisterd(VRegister reg) const; | 58 |
| 57 void set_vregisterd(VRegister reg, int64_t value); | 59 int64_t get_vregisterd(VRegister reg, int idx) const; |
| 60 void set_vregisterd(VRegister reg, int idx, int64_t value); |
| 61 |
| 58 void get_vregister(VRegister reg, simd_value_t* value) const; | 62 void get_vregister(VRegister reg, simd_value_t* value) const; |
| 59 void set_vregister(VRegister reg, const simd_value_t& value); | 63 void set_vregister(VRegister reg, const simd_value_t& value); |
| 60 | 64 |
| 61 int64_t get_pc() const; | 65 int64_t get_pc() const; |
| 62 int64_t get_last_pc() const; | 66 int64_t get_last_pc() const; |
| 63 void set_pc(int64_t pc); | 67 void set_pc(int64_t pc); |
| 64 | 68 |
| 65 // Accessor to the internal simulator stack top. | 69 // Accessor to the internal simulator stack top. |
| 66 uword StackTop() const; | 70 uword StackTop() const; |
| 67 | 71 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 } | 222 } |
| 219 | 223 |
| 220 friend class SimulatorDebugger; | 224 friend class SimulatorDebugger; |
| 221 friend class SimulatorSetjmpBuffer; | 225 friend class SimulatorSetjmpBuffer; |
| 222 DISALLOW_COPY_AND_ASSIGN(Simulator); | 226 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 223 }; | 227 }; |
| 224 | 228 |
| 225 } // namespace dart | 229 } // namespace dart |
| 226 | 230 |
| 227 #endif // VM_SIMULATOR_ARM64_H_ | 231 #endif // VM_SIMULATOR_ARM64_H_ |
| OLD | NEW |