Skip to content

feat(vm): 8 opcode handler modules (4)#7

Open
haeter525 wants to merge 3 commits into
pr-b/vm-scaffoldfrom
pr-d/handlers
Open

feat(vm): 8 opcode handler modules (4)#7
haeter525 wants to merge 3 commits into
pr-b/vm-scaffoldfrom
pr-d/handlers

Conversation

@haeter525
Copy link
Copy Markdown
Member

@haeter525 haeter525 commented May 21, 2026

Summary

Fills in the handler modules with the following type of instructions:

  • arithmetic
  • array
  • branch
  • compare
  • field
  • throw
  • type_check
  • type_convert

So the VM can execute every non-stub-dependent opcode end-to-end.

Depends on #4 (Emulator Foundation) which depends on #5 (parser). Base of this PR is pr-b/vm-scaffold; once #4 and #5 merge, the base auto-updates to main and the diff shrinks to handler-only.

Scope

Area Change
src/dextrace/vm/handlers/ 8 new handler modules (arithmetic, array, branch, compare, field, throw, type_check, type_conv)
src/dextrace/vm/engine.py Add handler imports + register() calls
tests/vm/ test_{arithmetic,wide_arithmetic,handlers,type_check,throw_signal,trace,call_return}.py — handler unit tests + engine integration
tests/test_vm_run_*.py arrays, fibonacci, inheritance, instance_fields, interface_dispatch, long_arithmetic, packed_switch, try_catch, try_catch_with_fields — end-to-end execution tests
tools/gen_*_fixture.py 8 new fixture generators (auto-run by tests/conftest.py at session start; the generated .dex files are gitignored)

One-line verification

pytest tests/vm/test_arithmetic.py tests/vm/test_wide_arithmetic.py -q

Full suite:

pytest -q   # 314 passed

haeter525 and others added 2 commits May 21, 2026 22:49
Fills in the held-back handler modules from the scaffold: arithmetic,
array, branch, compare, field, throw, type_check, type_conv. Re-enables
their imports and register() calls in engine.py so the VM can execute
every non-Android-stub-dependent opcode.

Verification (one-liner):
    pytest tests/vm/test_arithmetic.py tests/vm/test_wide_arithmetic.py -q

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@haeter525 haeter525 changed the title feat(vm): 8 opcode handler modules feat(vm): 8 opcode handler modules (4) May 21, 2026
@haeter525 haeter525 marked this pull request as ready for review May 21, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant