Skip to content

Commit

Permalink
add dynamic cfe & cfs (FuelLabs#471)
Browse files Browse the repository at this point in the history
closes: FuelLabs#346

Adds the ability to perform a dynamic cfe
  • Loading branch information
Voxelot authored Mar 17, 2023
1 parent e02d131 commit 94953e6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/vm/instruction_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 42,9 @@
- [RET: Return from context](#ret-return-from-context)
- [Memory Instructions](#memory-instructions)
- [ALOC: Allocate memory](#aloc-allocate-memory)
- [CFE: Extend call frame](#cfe-extend-call-frame)
- [CFEI: Extend call frame immediate](#cfei-extend-call-frame-immediate)
- [CFS: Shrink call frame](#cfs-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 @@ -807,6 809,21 @@ Panic if:
- `$hp - $rA` underflows
- `$hp - $rA < $sp`

### CFE: Extend call frame

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

Panic if:

- `$sp $rA` overflows
- `$sp $rA > $hp`

### CFEI: Extend call frame immediate

| | |
Expand All @@ -822,6 839,21 @@ 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

0 comments on commit 94953e6

Please sign in to comment.