Making a WebAssembly interpreter in Ruby, part 4: refactoring integer instructions

Опубликовано: 03 Март 2026
на канале: Tom Stuart
192
4

https://github.com/tomstuart/wasminna...

00:00:00 — Waiting to start
00:00:49 — Hello
00:02:38 — Retro
00:09:58 — Implement the `i64.extend32_s` instruction
00:16:44 — Add i64.wast to CI tests
00:18:43 — Implement the `i64.extend_i32_s` instruction
00:27:00 — Implement the `i32.wrap_i64` instruction
00:28:00 — Implement the `i64.extend_i32_u` instruction
00:33:28 — Add int_exprs.wast to CI tests
00:34:20 — Use String#slice instead of getting MatchData with Regexp.last_match
01:08:31 — Write shorter implementations of `clz`, `ctz` and `popcnt`
01:20:52 — Extract #with_signed helper from `div_s` and `rem_s` implementations
01:28:56 — Use #with_signed helper in `shr_s` implementation
01:34:16 — Use #with_signed helper in `lt_s`, `le_s`, `gt_s` and `ge_s` implementations
01:40:24 — Separate recursive evaluation of `i32.*` and `i64.*` arguments from computation
01:46:50 — Take modulo of shift distance before shifting in all shift instructions
01:48:55 — Make `rotl` and `rotr` implementations look more like the other shift instructions
01:52:08 — Move `i32.const` and `i64.const` out of general integer instruction handling
01:58:42 — Recursively evaluate arguments for all integer instructions
02:01:14 — Use #unsigned helper in #interpret_integer
02:23:47 — Evaluate `assert_return`’s expected value directly
02:28:45 — Unwrap `assert_return` pattern
02:29:51 — Wrapping up
03:14:56 — Bye