Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dynamic cfe & cfs #471

Merged
merged 4 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add dynamic CFS
  • Loading branch information
Voxelot committed Mar 17, 2023
commit 42ba074af6f8f17213e20741feb40b6edaaf53a3
19 changes: 18 additions & 1 deletion src/vm/instruction_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 42,9 @@
- [RET: Return from context](#ret-return-from-context)
- [Memory Instructions](#memory-instructions)
- [ALOC: Allocate memory](#aloc-allocate-memory)
- [CFEI: Extend call frame](#cfe-extend-call-frame)
- [CFE: Extend call frame](#cfe-extend-call-frame)
- [CFEI: Extend call frame immediate](#cfei-extend-call-frame-immediate)
- [CFS: Shrink call frame](#cfsi-shrink-call-frame)
- [CFSI: Shrink call frame immediate](#cfsi-shrink-call-frame-immediate)
- [LB: Load byte](#lb-load-byte)
- [LW: Load word](#lw-load-word)
Expand Down Expand Up @@ -838,6 839,22 @@ Panic if:
- `$sp imm` overflows
- `$sp imm > $hp`

### CFS: Shrink call frame

| | |
|-------------|----------------------------------------|
| Description | Shrink the current call frame's stack. |
| Operation | ```$sp = $sp - $rA``` |
| Syntax | `cfs $rA` |
| Encoding | `0x00 $rA - - -` |
| Notes | Does not clear memory. |

Panic if:

- `$sp - $rA` underflows
- `$sp - $rA < $ssp`


### CFSI: Shrink call frame immediate

| | |
Expand Down