Expand description
The instruction set, transcribed from the reference quickjs-opcode.h.
That header is the single source of truth for three things: the opcode numbering, the instruction length, and how many values each instruction pops and pushes. Those are exactly the facts the compiler, the verifier and the disassembler need, so the table below is a transcription rather than a re-derivation: a typo there would be a typo in three places at once.
Two numbering spaces exist in the reference implementation:
Opcode— instructions that appear in finished bytecode, numbered0 .. OP_COUNT.TempOpcode— instructions the compiler emits while building a function and removes before the bytecode is finished (scope bookkeeping, labels, line numbers). Their numbers overlap the short-form opcodes, so they can never be confused with a finished instruction.
The numbering matches the C implementation even though the serialised format
is our own (see crate::serialize): it makes disassembly diffs against
qjsc readable, and costs nothing.
Structs§
- OpInfo
- Static description of one instruction.
Enums§
- OpFormat
- Operand encoding of an instruction.
- Opcode
- An instruction of finished bytecode.
- Temp
Opcode - An instruction that only exists while a function is being compiled.
Constants§
- OP_
COUNT - Number of finished instructions (the reference
OP_COUNT).