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/vm/string.cpp (1 of 10 files). Show all

Unified · Split

src/vm/string.cpp+4−4
@@ -264,10 +264,10 @@ vm_string_t::vm_string_t(const vm_string_t &other, word_t begin_index, word_t en · 263 unmodified lines
264264 throw out_of_range_memory{};
265265
266266 if (begin_index < 0)
267− throw out_of_range_memory{ 0, other._length, begin_index };
267+ throw index_out_of_range_memory{ 0, other._length, begin_index };
268268
269269 if (other._length < end_index)
270− throw out_of_range_memory{ 0, other._length, end_index };
270+ throw index_out_of_range_memory{ 0, other._length, end_index };
271271
272272 // Allocate memory based on character count and size
273273 auto src = other._mem.local;
@@ -384,7 +384,7 @@ word_t vm_string_t::get_length() const · 110 unmodified lines
384384 rune_t vm_string_t::get_rune(word_t index) const
385385 {
386386 if (index < 0 && _length <= index)
387− throw out_of_range_memory{ 0, _length - 1, index };
387+ throw index_out_of_range_memory{ 0, _length - 1, index };
388388
389389 // Determine if local or allocated memory
390390 auto source = reinterpret_cast<const char *>(_mem.local);
@@ -410,7 +410,7 @@ void vm_string_t::set_rune(word_t index, rune_t value) · 19 unmodified lines
410410
411411 // Index equal to length is allowed to grow the string
412412 if (index < 0 && _length <= index)
413− throw out_of_range_memory{ 0, _length, index };
413+ throw index_out_of_range_memory{ 0, _length, index };
414414
415415 // Determine if local or allocated memory
416416 auto source = static_cast<uint8_t *>(_mem.local);