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 #include <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 #define SScanF sscanf // NOLINT | 36 #define SScanF sscanf // NOLINT |
37 | 37 |
38 | 38 |
39 // SimulatorSetjmpBuffer are linked together, and the last created one | 39 // SimulatorSetjmpBuffer are linked together, and the last created one |
40 // is referenced by the Simulator. When an exception is thrown, the exception | 40 // is referenced by the Simulator. When an exception is thrown, the exception |
41 // runtime looks at where to jump and finds the corresponding | 41 // runtime looks at where to jump and finds the corresponding |
42 // SimulatorSetjmpBuffer based on the stack pointer of the exception handler. | 42 // SimulatorSetjmpBuffer based on the stack pointer of the exception handler. |
43 // The runtime then does a Longjmp on that buffer to return to the simulator. | 43 // The runtime then does a Longjmp on that buffer to return to the simulator. |
44 class SimulatorSetjmpBuffer { | 44 class SimulatorSetjmpBuffer { |
45 public: | 45 public: |
46 int Setjmp() { return setjmp(buffer_); } | |
47 void Longjmp() { | 46 void Longjmp() { |
48 // "This" is now the last setjmp buffer. | 47 // "This" is now the last setjmp buffer. |
49 simulator_->set_last_setjmp_buffer(this); | 48 simulator_->set_last_setjmp_buffer(this); |
50 longjmp(buffer_, 1); | 49 longjmp(buffer_, 1); |
51 } | 50 } |
52 | 51 |
53 explicit SimulatorSetjmpBuffer(Simulator* sim) { | 52 explicit SimulatorSetjmpBuffer(Simulator* sim) { |
54 simulator_ = sim; | 53 simulator_ = sim; |
55 link_ = sim->last_setjmp_buffer(); | 54 link_ = sim->last_setjmp_buffer(); |
56 sim->set_last_setjmp_buffer(this); | 55 sim->set_last_setjmp_buffer(this); |
(...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3606 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); | 3605 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); |
3607 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); | 3606 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); |
3608 buf->Longjmp(); | 3607 buf->Longjmp(); |
3609 } | 3608 } |
3610 | 3609 |
3611 } // namespace dart | 3610 } // namespace dart |
3612 | 3611 |
3613 #endif // !defined(USING_SIMULATOR) | 3612 #endif // !defined(USING_SIMULATOR) |
3614 | 3613 |
3615 #endif // defined TARGET_ARCH_ARM64 | 3614 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |