| 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 // 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. |
| 11 | 11 |
| 12 #ifndef VM_SIMULATOR_ARM_H_ | 12 #ifndef VM_SIMULATOR_ARM_H_ |
| 13 #define VM_SIMULATOR_ARM_H_ | 13 #define VM_SIMULATOR_ARM_H_ |
| 14 | 14 |
| 15 #ifndef VM_SIMULATOR_H_ | 15 #ifndef VM_SIMULATOR_H_ |
| 16 #error Do not include simulator_arm.h directly; use simulator.h. | 16 #error Do not include simulator_arm.h directly; use simulator.h. |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 #include "vm/allocation.h" | 19 #include "vm/allocation.h" |
| 20 #include "vm/constants_arm.h" | 20 #include "vm/constants_arm.h" |
| 21 #include "vm/object.h" | 21 #include "vm/object.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 class Isolate; | 25 class Isolate; |
| 26 class SimulatorSetjmpBuffer; | 26 class SimulatorSetjmpBuffer; |
| 27 | 27 |
| 28 class Simulator { | 28 class Simulator { |
| 29 public: | 29 public: |
| 30 static const size_t kSimulatorStackUnderflowSize = 64; | 30 static const uword kSimulatorStackUnderflowSize = 64; |
| 31 | 31 |
| 32 Simulator(); | 32 Simulator(); |
| 33 ~Simulator(); | 33 ~Simulator(); |
| 34 | 34 |
| 35 // The currently executing Simulator instance, which is associated to the | 35 // The currently executing Simulator instance, which is associated to the |
| 36 // current isolate | 36 // current isolate |
| 37 static Simulator* Current(); | 37 static Simulator* Current(); |
| 38 | 38 |
| 39 // Accessors for register state. Reading the pc value adheres to the ARM | 39 // Accessors for register state. Reading the pc value adheres to the ARM |
| 40 // architecture specification and is off by 8 from the currently executing | 40 // architecture specification and is off by 8 from the currently executing |
| 41 // instruction. | 41 // instruction. |
| 42 void set_register(Register reg, int32_t value); | 42 void set_register(Register reg, int32_t value); |
| 43 int32_t get_register(Register reg) const; | 43 int32_t get_register(Register reg) const; |
| 44 | 44 |
| 45 // Special case of set_register and get_register to access the raw PC value. | 45 // Special case of set_register and get_register to access the raw PC value. |
| 46 void set_pc(int32_t value); | 46 void set_pc(int32_t value); |
| 47 int32_t get_pc() const; | 47 int32_t get_pc() const; |
| 48 | 48 |
| 49 // Accessors for VFP register state. | 49 // Accessors for VFP register state. |
| 50 void set_sregister(SRegister reg, float value); | 50 void set_sregister(SRegister reg, float value); |
| 51 float get_sregister(SRegister reg) const; | 51 float get_sregister(SRegister reg) const; |
| 52 void set_dregister(DRegister reg, double value); | 52 void set_dregister(DRegister reg, double value); |
| 53 double get_dregister(DRegister reg) const; | 53 double get_dregister(DRegister reg) const; |
| 54 | 54 |
| 55 // Accessor to the internal simulator stack area. | 55 // Accessor to the internal simulator stack top. |
| 56 uintptr_t StackTop() const; | 56 uword StackTop() const; |
| 57 uintptr_t StackLimit() const; | |
| 58 | 57 |
| 59 // Executes ARM instructions until the PC reaches end_sim_pc. | 58 // Executes ARM instructions until the PC reaches end_sim_pc. |
| 60 void Execute(); | 59 void Execute(); |
| 61 | 60 |
| 62 // Call on program start. | 61 // Call on program start. |
| 63 static void InitOnce(); | 62 static void InitOnce(); |
| 64 | 63 |
| 65 // Dart generally calls into generated code with 5 parameters. This is a | 64 // Dart generally calls into generated code with 5 parameters. This is a |
| 66 // convenience function, which sets up the simulator state and grabs the | 65 // convenience function, which sets up the simulator state and grabs the |
| 67 // result on return. | 66 // result on return. |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 220 } |
| 222 | 221 |
| 223 friend class SimulatorDebugger; | 222 friend class SimulatorDebugger; |
| 224 friend class SimulatorSetjmpBuffer; | 223 friend class SimulatorSetjmpBuffer; |
| 225 DISALLOW_COPY_AND_ASSIGN(Simulator); | 224 DISALLOW_COPY_AND_ASSIGN(Simulator); |
| 226 }; | 225 }; |
| 227 | 226 |
| 228 } // namespace dart | 227 } // namespace dart |
| 229 | 228 |
| 230 #endif // VM_SIMULATOR_ARM_H_ | 229 #endif // VM_SIMULATOR_ARM_H_ |
| OLD | NEW |