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. |
11 | 11 |
12 #ifndef VM_SIMULATOR_MIPS_H_ | 12 #ifndef VM_SIMULATOR_MIPS_H_ |
13 #define VM_SIMULATOR_MIPS_H_ | 13 #define VM_SIMULATOR_MIPS_H_ |
14 | 14 |
15 #ifndef VM_SIMULATOR_H_ | 15 #ifndef VM_SIMULATOR_H_ |
16 #error Do not include simulator_mips.h directly; use simulator.h. | 16 #error Do not include simulator_mips.h directly; use simulator.h. |
17 #endif | 17 #endif |
18 | 18 |
19 #include "vm/constants_mips.h" | 19 #include "vm/constants_mips.h" |
| 20 #include "vm/object.h" |
20 | 21 |
21 namespace dart { | 22 namespace dart { |
22 | 23 |
23 class Isolate; | 24 class Isolate; |
24 class SimulatorSetjmpBuffer; | 25 class SimulatorSetjmpBuffer; |
25 | 26 |
26 class Simulator { | 27 class Simulator { |
27 public: | 28 public: |
28 static const uword kSimulatorStackUnderflowSize = 64; | 29 static const uword kSimulatorStackUnderflowSize = 64; |
29 | 30 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 int32_t parameter3); | 83 int32_t parameter3); |
83 | 84 |
84 // Runtime and native call support. | 85 // Runtime and native call support. |
85 enum CallKind { | 86 enum CallKind { |
86 kRuntimeCall, | 87 kRuntimeCall, |
87 kLeafRuntimeCall, | 88 kLeafRuntimeCall, |
88 kNativeCall | 89 kNativeCall |
89 }; | 90 }; |
90 static uword RedirectExternalReference(uword function, CallKind call_kind); | 91 static uword RedirectExternalReference(uword function, CallKind call_kind); |
91 | 92 |
| 93 void Longjmp(uword pc, |
| 94 uword sp, |
| 95 uword fp, |
| 96 RawObject* raw_exception, |
| 97 RawObject* raw_stacktrace); |
| 98 |
92 private: | 99 private: |
93 // A pc value used to signal the simulator to stop execution. Generally | 100 // A pc value used to signal the simulator to stop execution. Generally |
94 // the ra is set to this value on transition from native C code to | 101 // the ra is set to this value on transition from native C code to |
95 // simulated execution, so that the simulator can "return" to the native | 102 // simulated execution, so that the simulator can "return" to the native |
96 // C code. | 103 // C code. |
97 static const uword kEndSimulatingPC = -1; | 104 static const uword kEndSimulatingPC = -1; |
98 | 105 |
99 // Special registers for the results of div, divu. | 106 // Special registers for the results of div, divu. |
100 int32_t hi_reg_; | 107 int32_t hi_reg_; |
101 int32_t lo_reg_; | 108 int32_t lo_reg_; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Longjmp support for exceptions. | 171 // Longjmp support for exceptions. |
165 SimulatorSetjmpBuffer* last_setjmp_buffer() { | 172 SimulatorSetjmpBuffer* last_setjmp_buffer() { |
166 return last_setjmp_buffer_; | 173 return last_setjmp_buffer_; |
167 } | 174 } |
168 void set_last_setjmp_buffer(SimulatorSetjmpBuffer* buffer) { | 175 void set_last_setjmp_buffer(SimulatorSetjmpBuffer* buffer) { |
169 last_setjmp_buffer_ = buffer; | 176 last_setjmp_buffer_ = buffer; |
170 } | 177 } |
171 | 178 |
172 friend class SimulatorDebugger; | 179 friend class SimulatorDebugger; |
173 friend class SimulatorSetjmpBuffer; | 180 friend class SimulatorSetjmpBuffer; |
| 181 DISALLOW_COPY_AND_ASSIGN(Simulator); |
174 }; | 182 }; |
175 | 183 |
176 } // namespace dart | 184 } // namespace dart |
177 | 185 |
178 #endif // VM_SIMULATOR_MIPS_H_ | 186 #endif // VM_SIMULATOR_MIPS_H_ |
OLD | NEW |