Skip to content

refactor: simplize interp#116

Merged
siyul-park merged 1 commit into
mainfrom
codex/interp-simplify
Jul 5, 2026
Merged

refactor: simplize interp#116
siyul-park merged 1 commit into
mainfrom
codex/interp-simplify

Conversation

@siyul-park

@siyul-park siyul-park commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Changes Made

Related Issues

Additional Information

Summary by CodeRabbit

  • Bug Fixes
    • Improved profiling and JIT-related reporting so metrics are more consistent and easier to read.
    • Refined debugger and instruction-boundary behavior for more exact execution tracking.
    • Fixed host-call and reset-related behavior for more reliable interpreter execution.
  • Documentation
    • Updated coding and architecture guidance to match the latest runtime behavior and naming.
    • Revised profiling examples and API notes to reflect the current workflow.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a47e680a-bc6d-4b0b-b736-ff0ac4fbfb6a

📥 Commits

Reviewing files that changed from the base of the PR and between 931fca2 and 1b8c2a9.

📒 Files selected for processing (15)
  • .claude/CLAUDE.md
  • AGENTS.md
  • docs/coding-patterns.md
  • docs/debugging.md
  • docs/instruction-set.md
  • docs/jit-internals.md
  • docs/profile.md
  • interp/fuse.go
  • interp/interp.go
  • interp/interp_test.go
  • interp/jit.go
  • interp/jit_arm64.go
  • interp/threaded.go
  • interp/trace.go
  • interp/trace_test.go

📝 Walkthrough

Walkthrough

This PR renames internal VM concepts from "precise/threadedCompiler" to "exact/threader" throughout the interpreter, fusion, tracing, and JIT code, renames Interpreter fields (local→samples, jitted→tried, hbase→heapBase, limit→heapLimit), restructures JIT module entries with a native struct combining callable and loop flag, renames newFrame to newActivation, and updates documentation and tests to match.

Changes

Core VM rename and refactor

Layer / File(s) Summary
threader type and dispatch table
interp/threaded.go
Replaces threadedCompiler with threader, dispatch closures use exact, adds invalid handler and callHostDirect with ref-release control.
Fusion helpers migrated to threader
interp/fuse.go
All fusion functions move to *threader receiver with c.exact gating; fuseHostFunction delegates to callHostDirect; fuseString/fuseError removed.
Tracer cache field renamed
interp/trace.go, interp/trace_test.go
Tracer.precise becomes Tracer.exact, with codes()/remove() and tests updated accordingly.
JIT module restructure
interp/jit.go, interp/jit_arm64.go
module.entries now maps to a native{callable, loop} struct; newFrame renamed to newActivation; scratch/funcs construction inlined.
Interpreter field renames and JIT flow refactor
interp/interp.go, interp/interp_test.go
localsamples, jittedtried, hbaseheapBase, limitheapLimit; adds build/fallback helpers; tests updated to match field names.
Documentation and style-guide updates
AGENTS.md, docs/debugging.md, docs/instruction-set.md, docs/jit-internals.md, docs/profile.md, docs/coding-patterns.md, .claude/CLAUDE.md
Docs updated for "exact"/"threader" terminology, functional-options ordering guidance, and prof-package-based profiler API.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Interpreter
  participant threader
  participant HostFunc
  participant module

  Interpreter->>threader: Compile(code, locals, captures)
  threader-->>Interpreter: []func(*Interpreter)
  Interpreter->>threader: dispatch(exact)
  threader->>HostFunc: callHostDirect(refs)
  HostFunc-->>threader: result
  Interpreter->>Interpreter: build(compiler, addr)
  Interpreter->>module: install(entries: native{callable, loop})
  Interpreter->>Interpreter: exit(root) / fallback(root)
Loading

Possibly related PRs

  • siyul-park/minivm#106: Both PRs modify the threaded/JIT fusion pipeline in interp/threaded.go, including exact-gating changes and host-call ref-release mechanics.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/interp-simplify

Comment @coderabbitai help to get the list of available commands.

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