Unified · Split
| @@ -32,7 +32,10 @@ void dec_src<address_mode_t::offset_double_indirect_fp>(const vm_exec_op_t &inst · 31 unmodified lines | |||
| 32 | { | 32 | { |
| 33 | assert(inst.source.mode == address_mode_t::offset_double_indirect_fp); | 33 | assert(inst.source.mode == address_mode_t::offset_double_indirect_fp); |
| 34 | const auto frame_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.stack.peek_frame()->base()) + inst.source.register1); | 34 | const auto frame_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.stack.peek_frame()->base()) + inst.source.register1); |
| 35 | reg.src = reinterpret_cast<pointer_t>(frame_offset + inst.source.register2); | 35 | if (frame_offset != disvm::runtime::runtime_constants::nil) |
| 36 | reg.src = reinterpret_cast<pointer_t>(frame_offset + inst.source.register2); | ||
| 37 | else | ||
| 38 | reg.src = reinterpret_cast<pointer_t>(disvm::runtime::runtime_constants::nil); | ||
| 36 | } | 39 | } |
| 37 | 40 | ||
| 38 | template<> | 41 | template<> |
| @@ -40,7 +43,10 @@ void dec_src<address_mode_t::offset_double_indirect_mp>(const vm_exec_op_t &inst · 1 unmodified line | |||
| 40 | { | 43 | { |
| 41 | assert(inst.source.mode == address_mode_t::offset_double_indirect_mp); | 44 | assert(inst.source.mode == address_mode_t::offset_double_indirect_mp); |
| 42 | const auto mp_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.mp_base->get_allocation()) + inst.source.register1); | 45 | const auto mp_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.mp_base->get_allocation()) + inst.source.register1); |
| 43 | reg.src = reinterpret_cast<pointer_t>(mp_offset + inst.source.register2); | 46 | if (mp_offset != disvm::runtime::runtime_constants::nil) |
| 47 | reg.src = reinterpret_cast<pointer_t>(mp_offset + inst.source.register2); | ||
| 48 | else | ||
| 49 | reg.src = reinterpret_cast<pointer_t>(disvm::runtime::runtime_constants::nil); | ||
| 44 | } | 50 | } |
| 45 | 51 | ||
| 46 | template<> | 52 | template<> |
| @@ -85,7 +91,10 @@ void dec_dest<address_mode_t::offset_double_indirect_fp>(const vm_exec_op_t &ins · 38 unmodified lines | |||
| 85 | { | 91 | { |
| 86 | assert(inst.destination.mode == address_mode_t::offset_double_indirect_fp); | 92 | assert(inst.destination.mode == address_mode_t::offset_double_indirect_fp); |
| 87 | const auto frame_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.stack.peek_frame()->base()) + inst.destination.register1); | 93 | const auto frame_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.stack.peek_frame()->base()) + inst.destination.register1); |
| 88 | reg.dest = reinterpret_cast<pointer_t>(frame_offset + inst.destination.register2); | 94 | if (frame_offset != disvm::runtime::runtime_constants::nil) |
| 95 | reg.dest = reinterpret_cast<pointer_t>(frame_offset + inst.destination.register2); | ||
| 96 | else | ||
| 97 | reg.dest = reinterpret_cast<pointer_t>(disvm::runtime::runtime_constants::nil); | ||
| 89 | } | 98 | } |
| 90 | 99 | ||
| 91 | template<> | 100 | template<> |
| @@ -93,7 +102,10 @@ void dec_dest<address_mode_t::offset_double_indirect_mp>(const vm_exec_op_t &ins · 1 unmodified line | |||
| 93 | { | 102 | { |
| 94 | assert(inst.destination.mode == address_mode_t::offset_double_indirect_mp); | 103 | assert(inst.destination.mode == address_mode_t::offset_double_indirect_mp); |
| 95 | const auto mp_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.mp_base->get_allocation()) + inst.destination.register1); | 104 | const auto mp_offset = *reinterpret_cast<std::size_t *>(reinterpret_cast<uint8_t *>(reg.mp_base->get_allocation()) + inst.destination.register1); |
| 96 | reg.dest = reinterpret_cast<pointer_t>(mp_offset + inst.destination.register2); | 105 | if (mp_offset != disvm::runtime::runtime_constants::nil) |
| 106 | reg.dest = reinterpret_cast<pointer_t>(mp_offset + inst.destination.register2); | ||
| 107 | else | ||
| 108 | reg.dest = reinterpret_cast<pointer_t>(disvm::runtime::runtime_constants::nil); | ||
| 97 | } | 109 | } |
| 98 | 110 | ||
| 99 | template<> | 111 | template<> |