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

Unified · Split

src/exec/main.cpp+9−5
@@ -93,13 +93,17 @@ namespace · 92 unmodified lines
93 if (args != nullptr)93 if (args != nullptr)
94 mp_base[2] = args->get_allocation();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 e.code_section =100 e.code_section =
97 {101 {
98 { vm_exec_op_t102 { vm_exec_op_t
99 {103 {
100 opcode_t::load,104 opcode_t::load,
101 { address_mode_t::offset_indirect_mp, 0, 0 }, // command module path105 { 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 { address_mode_t::offset_indirect_fp, 20, 0 } // module reference107 { 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 opcode_t::mframe,112 opcode_t::mframe,
109 { address_mode_t::offset_indirect_fp, 20, 0 }, // module reference113 { 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 { address_mode_t::offset_indirect_fp, 24, 0 } // module call frame115 { address_mode_t::offset_indirect_fp, 24, 0 } // module call frame
112 }116 }
113 },117 },
@@ -116,7 +120,7 @@ namespace · 2 unmodified lines
116 opcode_t::movp,120 opcode_t::movp,
117 { address_mode_t::offset_indirect_mp, 4, 0 }, // UI context121 { address_mode_t::offset_indirect_mp, 4, 0 }, // UI context
118 { address_mode_middle_t::none },122 { address_mode_middle_t::none },
119 { address_mode_t::offset_double_indirect_fp, 24, 32 } // module call frame -> UI context offset123 { address_mode_t::offset_double_indirect_fp, 24, first_arg_offset } // module call frame -> UI context offset
120 }124 }
121 },125 },
122 { vm_exec_op_t126 { vm_exec_op_t
@@ -124,14 +128,14 @@ namespace · 1 unmodified line
124 opcode_t::movp,128 opcode_t::movp,
125 { address_mode_t::offset_indirect_mp, 8, 0 }, // Argument list129 { address_mode_t::offset_indirect_mp, 8, 0 }, // Argument list
126 { address_mode_middle_t::none },130 { address_mode_middle_t::none },
127 { address_mode_t::offset_double_indirect_fp, 24, 36 } // module call frame -> argument list offset131 { address_mode_t::offset_double_indirect_fp, 24, second_arg_offset } // module call frame -> argument list offset
128 }132 }
129 },133 },
130 { vm_exec_op_t134 { vm_exec_op_t
131 {135 {
132 opcode_t::mcall,136 opcode_t::mcall,
133 { address_mode_t::offset_indirect_fp, 24, 0 }, // module call frame137 { 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 { address_mode_t::offset_indirect_fp, 20, 0 } // module reference139 { address_mode_t::offset_indirect_fp, 20, 0 } // module reference
136 }140 }
137 },141 },