History

Alter register address decoding using a lookup table instead of single function with multiple switch blocks. Reduced scheduler sleep time during tool dispatch setting.

arr committed 10 years ago

Commit 824a71a1 parent fcc75fd7 files · +500 −86Browse files

Showing the changes to src/vm/module_reader.cpp (1 of 7 files). Show all

Unified · Split

src/vm/module_reader.cpp+4−6
@@ -191,16 +191,13 @@ namespace · 190 unmodified lines
191191 return dest;
192192 }
193193
194− std::tuple<address_mode_middle_t, address_mode_t, address_mode_t> convert_to_address_mode(uint8_t instr_addr_mode)
194+ std::tuple<address_mode_middle_t, address_mode_t, address_mode_t> convert_to_address_mode(addr_code_t instr_addr_mode)
195195 {
196− // Taken from Dis VM specification
197− // bit 7 6 5 4 3 2 1 0
198− // m1 m0 s2 s1 s0 d2 d1 d0
199−
196+ // See definition of addr_code_t
200197 static const auto mid_mask = uint8_t{ 0xc0 };
201198 static const auto src_mask = uint8_t{ 0x38 };
202199 static const auto dest_mask = uint8_t{ 0x07 };
203− assert((mid_mask | src_mask | dest_mask) == std::numeric_limits<uint8_t>::max());
200+ assert((mid_mask | src_mask | dest_mask) == std::numeric_limits<addr_code_t>::max());
204201
205202 const auto mid = static_cast<address_mode_middle_t>((instr_addr_mode & mid_mask) >> 6);
206203 const auto src = static_cast<address_mode_t>((instr_addr_mode & src_mask) >> 3);
@@ -286,6 +283,7 @@ namespace · 79 unmodified lines
286283
287284 instr.opcode = static_cast<opcode_t>(op_and_addrmode[0]);
288285 assert(opcode_t::first_opcode <= instr.opcode && instr.opcode <= opcode_t::last_opcode);
286+ instr.addr_code = op_and_addrmode[1];
289287
290288 std::tie(instr.middle.mode, instr.source.mode, instr.destination.mode) = convert_to_address_mode(op_and_addrmode[1]);
291289