Showing the changes to src/include (3 of 10 files). Show all
Unified · Split
| @@ -66,9 +66,18 @@ namespace disvm · 65 unmodified lines | |||
| 66 | // Includes registers on base frame plus the implied return register | 66 | // Includes registers on base frame plus the implied return register |
| 67 | static const auto default_register_count = (sizeof(vm_frame_base_alloc_t) / register_size_in_bytes) + 1; | 67 | static const auto default_register_count = (sizeof(vm_frame_base_alloc_t) / register_size_in_bytes) + 1; |
| 68 | 68 | ||
| 69 | // See VM frame definition | 69 | // [SPEC] The fixed point registers are defined by their usage in the |
| 70 | static const auto fixed_point_register_1_frame_offset = default_register_count * register_size_in_bytes; | 70 | // Inferno implementation. They rely on the 'temp' registers defined below. |
| 71 | static const auto fixed_point_register_2_frame_offset = fixed_point_register_1_frame_offset + (2 * register_size_in_bytes); | 71 | // See fixed point op-codes in Inferno (libinterp/xec.c). |
| 72 | static const auto fixed_point_register_1_offset = default_register_count * register_size_in_bytes; | ||
| 73 | static const auto fixed_point_register_2_offset = fixed_point_register_1_offset + (2 * register_size_in_bytes); | ||
| 74 | |||
| 75 | // [SPEC] The official Limbo compiler allocates additional 'temp' registers on all call frames. | ||
| 76 | // See 'STemp', 'RTemp', and 'DTemp' in Inferno (limbo/limbo.h) | ||
| 77 | static const auto limbo_temp_register_count = 3; | ||
| 78 | |||
| 79 | // Define the first argument offset in a Limbo compiler generated call frame. | ||
| 80 | static const auto limbo_first_arg_register_offset = (default_register_count + limbo_temp_register_count) * register_size_in_bytes; | ||
| 72 | }; | 81 | }; |
| 73 | 82 | ||
| 74 | // | 83 | // |
| @@ -60,7 +60,7 @@ namespace disvm · 59 unmodified lines | |||
| 60 | { } | 60 | { } |
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | class invalid_utf8 : public vm_user_exception | 63 | class invalid_utf8 final : public vm_user_exception |
| 64 | { | 64 | { |
| 65 | public: | 65 | public: |
| 66 | explicit invalid_utf8() | 66 | explicit invalid_utf8() |
| @@ -84,7 +84,7 @@ namespace disvm · 17 unmodified lines | |||
| 84 | const char *operation; | 84 | const char *operation; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | class type_violation : public vm_user_exception | 87 | class type_violation final : public vm_user_exception |
| 88 | { | 88 | { |
| 89 | public: | 89 | public: |
| 90 | explicit type_violation() | 90 | explicit type_violation() |
| @@ -92,26 +92,23 @@ namespace disvm · 1 unmodified line | |||
| 92 | { } | 92 | { } |
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | class out_of_range_memory final : public vm_user_exception | 95 | class out_of_range_memory : public vm_user_exception |
| 96 | { | 96 | { |
| 97 | public: | 97 | public: |
| 98 | explicit out_of_range_memory() | 98 | explicit out_of_range_memory() |
| 99 | : vm_user_exception("Out of range access") | 99 | : vm_user_exception("Out of range access") |
| 100 | , invalid_value{ 0 } | ||
| 101 | , range_defined{ false } | ||
| 102 | , valid_max{ 0 } | ||
| 103 | , valid_min{ 0 } | ||
| 104 | { } | 100 | { } |
| 101 | }; | ||
| 105 | 102 | ||
| 106 | explicit out_of_range_memory(word_t valid_min, word_t valid_max, word_t invalid_valid) | 103 | class index_out_of_range_memory final : public out_of_range_memory |
| 107 | : vm_user_exception("Out of range access") | 104 | { |
| 108 | , invalid_value{ invalid_valid } | 105 | public: |
| 109 | , range_defined{ true } | 106 | explicit index_out_of_range_memory(word_t valid_min, word_t valid_max, word_t invalid_value) |
| 107 | : invalid_value{ invalid_value } | ||
| 110 | , valid_max{ valid_max } | 108 | , valid_max{ valid_max } |
| 111 | , valid_min{ valid_min } | 109 | , valid_min{ valid_min } |
| 112 | { } | 110 | { } |
| 113 | 111 | ||
| 114 | const bool range_defined; | ||
| 115 | const word_t valid_min; | 112 | const word_t valid_min; |
| 116 | const word_t valid_max; | 113 | const word_t valid_max; |
| 117 | const word_t invalid_value; | 114 | const word_t invalid_value; |
| @@ -759,7 +759,7 @@ namespace disvm · 758 unmodified lines | |||
| 759 | 759 | ||
| 760 | ~vm_thread_t(); | 760 | ~vm_thread_t(); |
| 761 | 761 | ||
| 762 | vm_thread_state_t execute(vm_t &virtual_machine, uint32_t quanta); | 762 | vm_thread_state_t execute(vm_t &virtual_machine, const uint32_t quanta); |
| 763 | 763 | ||
| 764 | vm_thread_state_t get_state() const; | 764 | vm_thread_state_t get_state() const; |
| 765 | 765 | ||