Skip to content

Commit

Permalink
chore(codegen): clean the tests of sequential_large_jumps
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop committed Nov 28, 2024
1 parent 6dceb2f commit 506ed5b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions codegen/src/jump/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,17 @@ mod tests {
table.relocate(&mut buffer)?;

// Check first jump (should use PUSH2)
assert_eq!(buffer[0x10], 0x61); // PUSH2
assert_eq!(buffer[0x11], 0x01); // First byte
assert_eq!(buffer[0x12], 0x3c); // Second byte
assert_eq!(0x013c, 0x100 + 20 * 3);

// Check last jump (should still use PUSH2 but with adjusted offset)
let last_idx = 0x10 + 19 + 19 * 3;
assert_eq!(buffer[last_idx], 0x61); // PUSH2
assert_eq!(buffer[last_idx + 1], 0x03); // First byte should be larger
assert_eq!(buffer[last_idx + 2], 0x9c); // Second byte accounts for all previous jumps

// FIXME: This is wrong, we need to add the offsets of all previous jumps
// assert_eq!(0x039c, 0x100 + 20 * 19 + 20 * 3);
assert_eq!(0x039c, 0x100 + 0x20 * 19 + 20 * 3);

Ok(())
}
Expand Down

0 comments on commit 506ed5b

Please sign in to comment.