-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Asm.fif improvements (#631) Add missing opcodes, CUSTOMOP, disallow 256 PUSHPOW256, recursive PROGRAM, require-asm-fif-version * Fix nested PROGRAM, add test * Simplify require-asm-fif-version --------- Co-authored-by: EmelyanenkoK <[email protected]>
- Loading branch information
1 parent
fbb1e54
commit 4d5ded5
Showing
4 changed files
with
198 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
"Asm.fif" include | ||
|
||
// Four programs: | ||
// 4 contains 2 and 3, 2 contains 1 | ||
|
||
// Program #1 | ||
PROGRAM{ | ||
DECLPROC foo1 | ||
DECLPROC foo2 | ||
DECLPROC foo3 | ||
DECLPROC main | ||
foo1 PROC:<{ MUL INC }> | ||
foo2 PROCINLINE:<{ PLDREF }> | ||
foo3 PROC:<{ CTOS foo2 INLINECALLDICT CTOS 32 PLDU }> | ||
main PROC:<{ 0 PUSHINT }> | ||
}END>c constant code-1 | ||
|
||
// Program #2 | ||
PROGRAM{ | ||
DECLPROC foo3 | ||
DECLPROC foo4 | ||
DECLPROC main | ||
foo3 PROC:<{ code-1 PUSHREF }> | ||
foo4 PROC:<{ CTOS 8 PLDU }> | ||
main PROC:<{ foo3 CALLDICT foo4 CALLDICT NEWC ROT STUX }> | ||
}END>c constant code-2 | ||
|
||
// Program #3 | ||
PROGRAM{ | ||
DECLPROC foo1 | ||
DECLPROC foo4 | ||
DECLPROC main | ||
foo1 PROC:<{ DUP 137 PUSHINT MUL PAIR }> | ||
foo4 PROC:<{ UNPAIR SWAP DIV }> | ||
main PROC:<{ 70 PUSHINT DIV }> | ||
}END>c constant code-3 | ||
|
||
// Program #4 | ||
PROGRAM{ | ||
DECLPROC foo2 | ||
DECLPROC foo3 | ||
DECLPROC foo5 | ||
DECLPROC main | ||
foo2 PROC:<{ code-2 PUSHREF }> | ||
foo3 PROC:<{ code-3 PUSHREF }> | ||
foo5 PROC:<{ foo2 CALLDICT CTOS 8 PLDU 1 RSHIFT# }> | ||
main PROC:<{ foo5 CALLDICT 5 MULCONST }> | ||
}END>c | ||
|
||
.dump cr | ||
|
||
// Program #4, nested | ||
PROGRAM{ | ||
DECLPROC foo2 | ||
DECLPROC foo3 | ||
DECLPROC foo5 | ||
DECLPROC main | ||
foo2 PROC:<{ | ||
PROGRAM{ | ||
DECLPROC foo3 | ||
DECLPROC foo4 | ||
DECLPROC main | ||
foo3 PROC:<{ | ||
PROGRAM{ | ||
DECLPROC foo1 | ||
DECLPROC foo2 | ||
DECLPROC foo3 | ||
DECLPROC main | ||
foo1 PROC:<{ MUL INC }> | ||
foo2 PROCINLINE:<{ PLDREF }> | ||
foo3 PROC:<{ CTOS foo2 INLINECALLDICT CTOS 32 PLDU }> | ||
main PROC:<{ 0 PUSHINT }> | ||
}END>c PUSHREF | ||
}> | ||
foo4 PROC:<{ CTOS 8 PLDU }> | ||
main PROC:<{ foo3 CALLDICT foo4 CALLDICT NEWC ROT STUX }> | ||
}END>c PUSHREF | ||
}> | ||
foo3 PROC:<{ | ||
PROGRAM{ | ||
DECLPROC foo1 | ||
DECLPROC foo4 | ||
DECLPROC main | ||
foo1 PROC:<{ DUP 137 PUSHINT MUL PAIR }> | ||
foo4 PROC:<{ UNPAIR SWAP DIV }> | ||
main PROC:<{ 70 PUSHINT DIV }> | ||
}END>c PUSHREF | ||
}> | ||
foo5 PROC:<{ foo2 CALLDICT CTOS 8 PLDU 1 RSHIFT# }> | ||
main PROC:<{ foo5 CALLDICT 5 MULCONST }> | ||
}END>c | ||
|
||
.dump cr |
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