Showing the changes to src/include (3 of 9 files). Show all
Unified · Split
| @@ -128,6 +128,18 @@ namespace disvm · 127 unmodified lines | ||
| 128 | 128 | const char *module_name; |
| 129 | 129 | const vm_pc_t program_counter; |
| 130 | 130 | }; |
| 131 | + | |
| 132 | + class vm_term_request final : public vm_user_exception | |
| 133 | + { | |
| 134 | + public: | |
| 135 | + explicit vm_term_request() | |
| 136 | + : vm_user_exception("VM termination requested") | |
| 137 | + { } | |
| 138 | + | |
| 139 | + explicit vm_term_request(const char *msg) | |
| 140 | + : vm_user_exception(msg) | |
| 141 | + { } | |
| 142 | + }; | |
| 131 | 143 | } |
| 132 | 144 | } |
| 133 | 145 | |
| @@ -717,7 +717,7 @@ namespace disvm · 716 unmodified lines | ||
| 717 | 717 | exiting, // exit instruction |
| 718 | 718 | empty_stack, |
| 719 | 719 | |
| 720 | − broken, // thread crashed | |
| 720 | + broken, // thread crashed - the scheduler is free to terminate the entire VM if any thread enters this state. | |
| 721 | 721 | }; |
| 722 | 722 | |
| 723 | 723 | // Forward declaration |
| @@ -787,6 +787,10 @@ namespace disvm · 63 unmodified lines | ||
| 787 | 787 | |
| 788 | 788 | vm_thread_state_t get_state() const; |
| 789 | 789 | |
| 790 | + // This function will only return a non-null | |
| 791 | + // value if this thread is in the broken state. | |
| 792 | + const char *get_error_message() const; | |
| 793 | + | |
| 790 | 794 | uint32_t get_thread_id() const; |
| 791 | 795 | |
| 792 | 796 | uint32_t get_parent_thread_id() const; |
| @@ -794,9 +798,10 @@ namespace disvm · 1 unmodified line | ||
| 794 | 798 | const vm_registers_t& get_registers() const; |
| 795 | 799 | |
| 796 | 800 | private: |
| 801 | + vm_registers_t _registers; | |
| 797 | 802 | const uint32_t _thread_id; |
| 798 | 803 | const uint32_t _parent_thread_id; |
| 799 | − vm_registers_t _registers; | |
| 804 | + char *_error_message; | |
| 800 | 805 | }; |
| 801 | 806 | |
| 802 | 807 | // |
| @@ -49,6 +49,7 @@ namespace disvm · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | thread_begin, // value1: const vm_thread_t |
| 51 | 51 | thread_end, // value1: const vm_thread_t |
| 52 | + thread_broken, // value1: const vm_thread_t | |
| 52 | 53 | |
| 53 | 54 | exception_raised, // value1: vm_registers_t |
| 54 | 55 | // value2: const vm_string_t - exception ID |