Showing the changes to src/exec/main.cpp (1 of 10 files). Show all
Unified · Split
| @@ -93,13 +93,17 @@ namespace · 92 unmodified lines | ||
| 93 | 93 | if (args != nullptr) |
| 94 | 94 | mp_base[2] = args->get_allocation(); |
| 95 | 95 | |
| 96 | + // Define the frame offsets for the two arguments | |
| 97 | + const auto first_arg_offset = vm_frame_constants::limbo_first_arg_register_offset; | |
| 98 | + const auto second_arg_offset = first_arg_offset + vm_frame_constants::register_size_in_bytes; | |
| 99 | + | |
| 96 | 100 | e.code_section = |
| 97 | 101 | { |
| 98 | 102 | { vm_exec_op_t |
| 99 | 103 | { |
| 100 | 104 | opcode_t::load, |
| 101 | 105 | { address_mode_t::offset_indirect_mp, 0, 0 }, // command module path |
| 102 | − { address_mode_middle_t::small_immediate, 0 }, | |
| 106 | + { address_mode_middle_t::small_immediate, 0 }, // import table index | |
| 103 | 107 | { address_mode_t::offset_indirect_fp, 20, 0 } // module reference |
| 104 | 108 | } |
| 105 | 109 | }, |
| @@ -107,7 +111,7 @@ namespace · 1 unmodified line | ||
| 107 | 111 | { |
| 108 | 112 | opcode_t::mframe, |
| 109 | 113 | { address_mode_t::offset_indirect_fp, 20, 0 }, // module reference |
| 110 | − { address_mode_middle_t::small_immediate, 0 }, | |
| 114 | + { address_mode_middle_t::small_immediate, 0 }, // function index into module | |
| 111 | 115 | { address_mode_t::offset_indirect_fp, 24, 0 } // module call frame |
| 112 | 116 | } |
| 113 | 117 | }, |
| @@ -116,7 +120,7 @@ namespace · 2 unmodified lines | ||
| 116 | 120 | opcode_t::movp, |
| 117 | 121 | { address_mode_t::offset_indirect_mp, 4, 0 }, // UI context |
| 118 | 122 | { address_mode_middle_t::none }, |
| 119 | − { address_mode_t::offset_double_indirect_fp, 24, 32 } // module call frame -> UI context offset | |
| 123 | + { address_mode_t::offset_double_indirect_fp, 24, first_arg_offset } // module call frame -> UI context offset | |
| 120 | 124 | } |
| 121 | 125 | }, |
| 122 | 126 | { vm_exec_op_t |
| @@ -124,14 +128,14 @@ namespace · 1 unmodified line | ||
| 124 | 128 | opcode_t::movp, |
| 125 | 129 | { address_mode_t::offset_indirect_mp, 8, 0 }, // Argument list |
| 126 | 130 | { address_mode_middle_t::none }, |
| 127 | − { address_mode_t::offset_double_indirect_fp, 24, 36 } // module call frame -> argument list offset | |
| 131 | + { address_mode_t::offset_double_indirect_fp, 24, second_arg_offset } // module call frame -> argument list offset | |
| 128 | 132 | } |
| 129 | 133 | }, |
| 130 | 134 | { vm_exec_op_t |
| 131 | 135 | { |
| 132 | 136 | opcode_t::mcall, |
| 133 | 137 | { address_mode_t::offset_indirect_fp, 24, 0 }, // module call frame |
| 134 | − { address_mode_middle_t::small_immediate, 0 }, | |
| 138 | + { address_mode_middle_t::small_immediate, 0 }, // function index into module | |
| 135 | 139 | { address_mode_t::offset_indirect_fp, 20, 0 } // module reference |
| 136 | 140 | } |
| 137 | 141 | }, |