Skip to content

Bytecode dispatch, VM architecture, and simple JIT guidance for implementing language runtimes in C and C++.

CCM score
62 of 100
skills.sh installs
689
GitHub stars
303
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers stack-based versus register-based VM design, dispatch loop strategies, and value representation such as tagged pointers and NaN boxing
  • Includes switch dispatch, computed goto with a GCC/Clang fallback, inline caching, and an mmap/mprotect x86-64 JIT example
  • Notes performance tips such as profiling dispatch overhead, specialised handlers, and trace recording as used by LuaJIT-style tracing JITs
  • Designed for developers building scripting language runtimes who need dispatch and JIT trade-off guidance

Install

$ npx -y skills add mohitmishra786/low-level-dev-skills --skill interpreters -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Interpreters and Bytecode VMs

Purpose

Guide agents through implementing efficient bytecode interpreters and simple JITs in C/C++: dispatch strategies, VM architecture choices, and performance patterns.

Triggers

  • "How do I implement a fast bytecode dispatch loop?"
  • "What is the difference between switch dispatch and computed goto?"
  • "How do I implement a register-based vs stack-based VM?"
  • "How do I add basic JIT compilation to my interpreter?"
  • "Why is my interpreter slow?"

Workflow

1. VM architecture choice

StyleDescriptionExamples
Stack-basedOperands on a value stack; compact bytecodeJVM, CPython, WebAssembly
Register-basedOperands in virtual registers; fewer instructionsLua 5+, Dalvik
Direct threadingEach "instruction" is a function callSome Forth implementations
Continuation-passingInterpreter functions return continuationsAcademic

Details

Repository
github.com/mohitmishra786/low-level-dev-skills
First seen
Jun 3, 2026

Questions

What does the interpreters skill help me build?

It guides agents through implementing efficient bytecode interpreters and simple JITs in C and C++, covering dispatch strategies, VM architecture choices and performance patterns. It is aimed at implementing language runtimes and scripting language runtimes. The skill also covers tracing JITs and understanding performance trade-offs in interpreter design.

How do I install the interpreters skill?

Run npx -y skills add mohitmishra786/low-level-dev-skills --skill interpreters -y in your project. This adds the interpreters skill to your agent setup. The agent can then guide dispatch loop design, VM architecture and simple mmap-based JIT work.

What is the difference between switch dispatch and computed goto in this skill?

The skill describes switch dispatch as the simplest baseline, where one indirect branch is shared across all opcodes and can mispredict heavily. Computed goto, a GCC and Clang extension, gives each opcode its own indirect branch so the CPU can predict better. It advises guarding computed goto with a compiler check and falling back to switch on other compilers.

Does the interpreters skill cover JIT compilation?

Yes, it shows how to add a simple JIT on x86-64 by allocating executable memory with mmap, writing machine code bytes and calling them. It also notes that macOS Apple Silicon needs pthread_jit_write_protect_np or the MAP_JIT flag. The skill mentions trace JITs, the LuaJIT approach, as a way to compile hot traces instead of full functions.

How does the interpreters skill handle value representation and inline caching?

It covers tagged pointers, which store a type tag in the low bits of a pointer, and NaN boxing, which stores non-double values in NaN bit patterns. For method dispatch it describes inline caching, which caches the last observed receiver type at each call site, and polymorphic inline caching that keeps up to about four type and method pairs. These patterns are meant to keep hot paths fast.

More from mohitmishra786/low-level-dev-skills

All 54

Similar to Interpreters