| @@ -635,7 +635,7 @@ namespace · 634 unmodified lines |
| 635 | 635 | const auto value = at_val<vm_string_t>(r.src); |
| 636 | 636 | |
| 637 | 637 | assert(r.dest != nullptr); |
| 638 | | − const auto table = reinterpret_cast<const word_t *>(r.dest); |
| 638 | + auto table = reinterpret_cast<word_t *>(r.dest); |
| 639 | 639 | const auto entry_count = table[case_op_constants::table_length_index]; |
| 640 | 640 | |
| 641 | 641 | // Initialize the target PC with the fallback value. |
| @@ -648,7 +648,7 @@ namespace · 6 unmodified lines |
| 648 | 648 | // Find the matching table entry |
| 649 | 649 | for (auto entry = word_t{ 0 }; entry < entry_count; ++entry) |
| 650 | 650 | { |
| 651 | | − auto string_low = at_val<vm_string_t>(reinterpret_cast<pointer_t>(const_cast<word_t *>(current_entry + case_op_constants::entry_low_index))); |
| 651 | + auto string_low = at_val<vm_string_t>(reinterpret_cast<pointer_t>(current_entry + case_op_constants::entry_low_index)); |
| 652 | 652 | |
| 653 | 653 | // Compare the value against the low string |
| 654 | 654 | int result = vm_string_t::compare(value, string_low); |
| @@ -662,7 +662,7 @@ namespace · 7 unmodified lines |
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // Compare the value against the high string |
| 665 | | − auto string_high = at_val<vm_string_t>(reinterpret_cast<pointer_t>(const_cast<word_t *>(current_entry + case_op_constants::entry_high_index))); |
| 665 | + auto string_high = at_val<vm_string_t>(reinterpret_cast<pointer_t>(current_entry + case_op_constants::entry_high_index)); |
| 666 | 666 | if (string_high == nullptr || vm_string_t::compare(value, string_high) != 0) |
| 667 | 667 | { |
| 668 | 668 | current_entry += case_op_constants::entry_length; |
| @@ -692,7 +692,7 @@ namespace · 23 unmodified lines |
| 692 | 692 | EXEC_DECL(lenc) |
| 693 | 693 | { |
| 694 | 694 | auto len = word_t{ 0 }; |
| 695 | | − auto str = at_val<vm_string_t>(r.src); |
| 695 | + const auto str = at_val<vm_string_t>(r.src); |
| 696 | 696 | if (str != nullptr) |
| 697 | 697 | len = str->get_length(); |
| 698 | 698 | |
| @@ -740,14 +740,14 @@ namespace · 41 unmodified lines |
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | | − vm_string_t *_addc(vm_string_t *s1, vm_string_t *s2, /* in out */ bool &append_to_s1) |
| 743 | + vm_string_t *_addc(vm_string_t *s1, const vm_string_t *s2, /* in out */ bool &append_to_s1) |
| 744 | 744 | { |
| 745 | 745 | if (s1 == nullptr) |
| 746 | 746 | { |
| 747 | 747 | if (s2 == nullptr) |
| 748 | | − return new vm_string_t(); |
| 748 | + return new vm_string_t{}; |
| 749 | 749 | |
| 750 | | − return new vm_string_t(*s2, 0, s2->get_length()); |
| 750 | + return new vm_string_t{ *s2, 0, s2->get_length() }; |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | // There are other references to this string so we will not alter it. |
| @@ -776,14 +776,14 @@ namespace · 22 unmodified lines |
| 776 | 776 | EXEC_DECL(addc) |
| 777 | 777 | { |
| 778 | 778 | auto s1 = at_val<vm_string_t>(r.mid); |
| 779 | | − auto s2 = at_val<vm_string_t>(r.src); |
| 779 | + const auto s2 = at_val<vm_string_t>(r.src); |
| 780 | 780 | auto dest_maybe = at_val<vm_string_t>(r.dest); |
| 781 | 781 | |
| 782 | 782 | // If the source is the same as the destination and the |
| 783 | 783 | // destination is not null, append the string. This can |
| 784 | 784 | // change during the concat process. |
| 785 | 785 | auto append_to_source = dest_maybe != nullptr && s1 == dest_maybe; |
| 786 | | − auto str = _addc(s1, s2, append_to_source); |
| 786 | + const auto str = _addc(s1, s2, append_to_source); |
| 787 | 787 | |
| 788 | 788 | if (!append_to_source) |
| 789 | 789 | { |
| @@ -822,7 +822,7 @@ namespace · 32 unmodified lines |
| 822 | 822 | EXEC_DECL(lena) |
| 823 | 823 | { |
| 824 | 824 | auto len = word_t{ 0 }; |
| 825 | | − auto arr = at_val<vm_array_t>(r.src); |
| 825 | + const auto arr = at_val<vm_array_t>(r.src); |
| 826 | 826 | if (arr != nullptr) |
| 827 | 827 | len = arr->get_length(); |
| 828 | 828 | |
| @@ -872,7 +872,7 @@ namespace · 43 unmodified lines |
| 872 | 872 | |
| 873 | 873 | void _index_in(vm_registers_t &r) |
| 874 | 874 | { |
| 875 | | − auto arr = at_val<vm_array_t>(r.src); |
| 875 | + const auto arr = at_val<vm_array_t>(r.src); |
| 876 | 876 | if (arr == nullptr) |
| 877 | 877 | throw dereference_nil{ "Indexing into array" }; |
| 878 | 878 | |
| @@ -897,7 +897,7 @@ namespace · 18 unmodified lines |
| 897 | 897 | EXEC_DECL(lenl) |
| 898 | 898 | { |
| 899 | 899 | auto len = word_t{ 0 }; |
| 900 | | − auto list = at_val<vm_list_t>(r.src); |
| 900 | + const auto list = at_val<vm_list_t>(r.src); |
| 901 | 901 | if (list != nullptr) |
| 902 | 902 | { |
| 903 | 903 | assert(list->alloc_type == vm_list_t::type_desc()); |
| @@ -983,7 +983,7 @@ namespace · 79 unmodified lines |
| 983 | 983 | template<typename PrimitiveType> |
| 984 | 984 | void _head(vm_registers_t &r) |
| 985 | 985 | { |
| 986 | | − auto head = at_val<vm_list_t>(r.src); |
| 986 | + const auto head = at_val<vm_list_t>(r.src); |
| 987 | 987 | if (head == nullptr) |
| 988 | 988 | throw dereference_nil{ "Head of list" }; |
| 989 | 989 | |
| @@ -999,7 +999,7 @@ namespace · 9 unmodified lines |
| 999 | 999 | |
| 1000 | 1000 | EXEC_DECL(headp) |
| 1001 | 1001 | { |
| 1002 | | − auto list = at_val<vm_list_t>(r.src); |
| 1002 | + const auto list = at_val<vm_list_t>(r.src); |
| 1003 | 1003 | if (list == nullptr) |
| 1004 | 1004 | throw dereference_nil{ "Head of list" }; |
| 1005 | 1005 | |
| @@ -1009,7 +1009,7 @@ namespace · 3 unmodified lines |
| 1009 | 1009 | |
| 1010 | 1010 | EXEC_DECL(headmp) |
| 1011 | 1011 | { |
| 1012 | | − auto list = at_val<vm_list_t>(r.src); |
| 1012 | + const auto list = at_val<vm_list_t>(r.src); |
| 1013 | 1013 | if (list == nullptr) |
| 1014 | 1014 | throw dereference_nil{ "Head of list" }; |
| 1015 | 1015 | |
| @@ -1019,7 +1019,7 @@ namespace · 3 unmodified lines |
| 1019 | 1019 | |
| 1020 | 1020 | EXEC_DECL(tail) |
| 1021 | 1021 | { |
| 1022 | | − auto list = at_val<vm_list_t>(r.src); |
| 1022 | + const auto list = at_val<vm_list_t>(r.src); |
| 1023 | 1023 | if (list == nullptr) |
| 1024 | 1024 | throw dereference_nil{ "Tail of list" }; |
| 1025 | 1025 | |
| @@ -1397,8 +1397,8 @@ namespace · 371 unmodified lines |
| 1397 | 1397 | |
| 1398 | 1398 | EXEC_DECL(tcmp) |
| 1399 | 1399 | { |
| 1400 | | − auto s = at_val<vm_alloc_t>(r.src); |
| 1401 | | − auto d = at_val<vm_alloc_t>(r.dest); |
| 1400 | + const auto s = at_val<vm_alloc_t>(r.src); |
| 1401 | + const auto d = at_val<vm_alloc_t>(r.dest); |
| 1402 | 1402 | |
| 1403 | 1403 | if (s == nullptr) |
| 1404 | 1404 | return; |
| @@ -1558,10 +1558,10 @@ namespace · 153 unmodified lines |
| 1558 | 1558 | |
| 1559 | 1559 | EXEC_DECL(goto_) |
| 1560 | 1560 | { |
| 1561 | | − auto pc_index = vt_ref<word_t>(r.src); |
| 1561 | + const auto pc_index = vt_ref<word_t>(r.src); |
| 1562 | 1562 | |
| 1563 | 1563 | assert(r.dest != nullptr); |
| 1564 | | − auto pc_table = reinterpret_cast<vm_pc_t *>(r.dest); |
| 1564 | + const auto pc_table = reinterpret_cast<vm_pc_t *>(r.dest); |
| 1565 | 1565 | |
| 1566 | 1566 | r.pc = pc_table[pc_index]; |
| 1567 | 1567 | } |