| 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 MIPS instructions if we are not generating a native | 5 // Declares a Simulator for MIPS instructions if we are not generating a native |
| 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation | 6 // MIPS binary. This Simulator allows us to run and debug MIPS 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 MIPS HW platform. | 10 // on a MIPS HW platform. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Call on program start. | 41 // Call on program start. |
| 42 static void InitOnce(); | 42 static void InitOnce(); |
| 43 | 43 |
| 44 // Dart generally calls into generated code with 5 parameters. This is a | 44 // Dart generally calls into generated code with 5 parameters. This is a |
| 45 // convenience function, which sets up the simulator state and grabs the | 45 // convenience function, which sets up the simulator state and grabs the |
| 46 // result on return. | 46 // result on return. |
| 47 int64_t Call(int32_t entry, | 47 int64_t Call(int32_t entry, |
| 48 int32_t parameter0, | 48 int32_t parameter0, |
| 49 int32_t parameter1, | 49 int32_t parameter1, |
| 50 int32_t parameter2, | 50 int32_t parameter2, |
| 51 int32_t parameter3, | 51 int32_t parameter3); |
| 52 int32_t parameter4); | |
| 53 | 52 |
| 54 private: | 53 private: |
| 54 // A pc value used to signal the simulator to stop execution. Generally |
| 55 // the ra is set to this value on transition from native C code to |
| 56 // simulated execution, so that the simulator can "return" to the native |
| 57 // C code. |
| 58 static const uword kEndSimulatingPC = -1; |
| 59 |
| 60 int32_t registers_[kNumberOfCpuRegisters]; |
| 61 uword pc_; |
| 62 |
| 63 // Simulator support. |
| 55 char* stack_; | 64 char* stack_; |
| 65 int icount_; |
| 66 bool delay_slot_; |
| 67 |
| 68 void set_pc(uword value) { pc_ = value; } |
| 69 |
| 70 void Format(Instr* instr, const char* format); |
| 71 |
| 72 void DecodeSpecial(Instr* instr); |
| 73 void InstructionDecode(Instr* instr); |
| 74 |
| 75 void Execute(); |
| 76 void ExecuteDelaySlot(); |
| 56 }; | 77 }; |
| 57 | 78 |
| 58 } // namespace dart | 79 } // namespace dart |
| 59 | 80 |
| 60 #endif // VM_SIMULATOR_MIPS_H_ | 81 #endif // VM_SIMULATOR_MIPS_H_ |
| OLD | NEW |