History

Create specific exception when index is out of range. Update thread class to print out exception details. Throw exception when an invalid op-code is detected. Enforce mspawn instruction cannot start from a built-in module.

arr committed 10 years ago

Commit 266fad61 parent 9af409310 files · +63 −40Browse files

Showing the changes to src/include/exceptions.h (1 of 10 files). Show all

Unified · Split

src/include/exceptions.h+9−12
@@ -60,7 +60,7 @@ namespace disvm · 59 unmodified lines
6060 { }
6161 };
6262
63− class invalid_utf8 : public vm_user_exception
63+ class invalid_utf8 final : public vm_user_exception
6464 {
6565 public:
6666 explicit invalid_utf8()
@@ -84,7 +84,7 @@ namespace disvm · 17 unmodified lines
8484 const char *operation;
8585 };
8686
87− class type_violation : public vm_user_exception
87+ class type_violation final : public vm_user_exception
8888 {
8989 public:
9090 explicit type_violation()
@@ -92,26 +92,23 @@ namespace disvm · 1 unmodified line
9292 { }
9393 };
9494
95− class out_of_range_memory final : public vm_user_exception
95+ class out_of_range_memory : public vm_user_exception
9696 {
9797 public:
9898 explicit out_of_range_memory()
9999 : vm_user_exception("Out of range access")
100− , invalid_value{ 0 }
101− , range_defined{ false }
102− , valid_max{ 0 }
103− , valid_min{ 0 }
104100 { }
101+ };
105102
106− explicit out_of_range_memory(word_t valid_min, word_t valid_max, word_t invalid_valid)
107− : vm_user_exception("Out of range access")
108− , invalid_value{ invalid_valid }
109− , range_defined{ true }
103+ class index_out_of_range_memory final : public out_of_range_memory
104+ {
105+ public:
106+ explicit index_out_of_range_memory(word_t valid_min, word_t valid_max, word_t invalid_value)
107+ : invalid_value{ invalid_value }
110108 , valid_max{ valid_max }
111109 , valid_min{ valid_min }
112110 { }
113111
114− const bool range_defined;
115112 const word_t valid_min;
116113 const word_t valid_max;
117114 const word_t invalid_value;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t