-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop emitting a SET and POP opcode right before a RETURN opcode
- Loading branch information
1 parent
e94c63b
commit 1ffa8c0
Showing
3 changed files
with
24 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
# Opcodes | ||
|
||
| Opcode | Description | | ||
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **MAKE_CLOSURE** _i (IS_LOCAL j)*_ | Push a ClosureAtom onto the stack, created from the FnAtom at `const[i]`. For each upvalue in the ClosureAtom, capture it from `stack[j]` if `IS_LOCAL` is `1`, capture from `upvalues[j]` otherwise. | | ||
| **CALL** _argc_ | Call the function at **TOS** - `argc` with `argc` parameters. | | ||
| **RETURN** | Return **TOS**. | | ||
| **POP_TOP** | Pop **TOS**. | | ||
| **POP** _argc_ | Pop **TOS** `argc` times. | | ||
| **CLOSE_UPVALUE** | Close the free variables at **TOS**. | | ||
| **LOAD_CONST** _idx_ | Push `const[idx]` onto the stack. | | ||
| **LOAD_SYM** _idx_ | Push `globals[const[idx]]` onto the stack. | | ||
| **DEF_SYM** _idx_ | Define `globals[const[idx]]` as **TOS**. | | ||
| **SET_SYM** _idx_ | Set `globals[const[idx]]` as **TOS**. | | ||
| **LOAD_UPVALUE** _idx_ | Push `upvalues[idx]` onto the stack. | | ||
| **SET_UPVALUE** _idx_ | Set `upvalues[idx]` as **TOS**. | | ||
| **LOAD_STACK** _idx_ | Push `upvalues[idx]` onto the stack. | | ||
| **SET_STACK** _idx_ | Set `upvalues[idx]` to **TOS**. | | ||
| **JUMP** _offset_ | Set `ip` of current frame to `offset`. | | ||
| **POP_JUMP_IF_FALSE** _offset_ | Set `ip` of current frame to `offset` if **TOS** is not _truthy_. | | ||
| **MAKE_LIST** _offset_ | Pop all elements from **BASE_PTR** + _offset_ to **TOS**, push those elements as cons list onto the stack. | | ||
| **MAKE_NIL** | Push `'()` onto the stack | | ||
| Opcode | Description | | ||
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| **MAKE_CLOSURE** _i (IS_LOCAL j)*_ | Push a Closure onto the stack, created from the Prototype at `const[i]`. For each upvalue in the Closure, capture it from `stack[j]` if `IS_LOCAL` is `1`, capture from `upvalues[j]` otherwise. | | ||
| **CALL** _argc_ | Call the function at **TOS** - `argc` with `argc` parameters. | | ||
| **RETURN** | Return **TOS**. | | ||
| **POP_TOP** | Pop **TOS**. | | ||
| **POP** _argc_ | Pop **TOS** `argc` times. | | ||
| **CLOSE_UPVALUE** | Close the free variables at **TOS**. | | ||
| **LOAD_CONST** _idx_ | Push `const[idx]` onto the stack. | | ||
| **LOAD_SYM** _idx_ | Push `globals[const[idx]]` onto the stack. | | ||
| **DEF_SYM** _idx_ | Define `globals[const[idx]]` as **TOS**. | | ||
| **SET_SYM** _idx_ | Set `globals[const[idx]]` as **TOS**. | | ||
| **LOAD_UPVALUE** _idx_ | Push `upvalues[idx]` onto the stack. | | ||
| **SET_UPVALUE** _idx_ | Set `upvalues[idx]` as **TOS**. | | ||
| **LOAD_STACK** _idx_ | Push `upvalues[idx]` onto the stack. | | ||
| **SET_STACK** _idx_ | Set `upvalues[idx]` to **TOS**. | | ||
| **JUMP** _offset_ | Set `ip` of current frame to `offset`. | | ||
| **POP_JUMP_IF_FALSE** _offset_ | Set `ip` of current frame to `offset` if **TOS** is not _truthy_. | | ||
| **MAKE_LIST** _offset_ | Pop all elements from **BASE_PTR** + _offset_ to **TOS**, push those elements as cons list onto the stack. | | ||
| **MAKE_NIL** | Push `'()` onto the stack | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters