The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
db8b191
)
Return stack restoration working?
author
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Aug 2018 09:08:18 +0000
(11:08 +0200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Aug 2018 09:08:18 +0000
(11:08 +0200)
src/scheme.4th
patch
|
blob
|
history
diff --git
a/src/scheme.4th
b/src/scheme.4th
index
135bdab
..
4f04d8c
100644
(file)
--- a/
src/scheme.4th
+++ b/
src/scheme.4th
@@
-588,15
+588,37
@@
global-env obj!
2drop
;
2drop
;
+: list->pad ( list -- n )
+
+ 2dup car drop -rot \ keep length of list on stack
+ 2dup cdr 2swap car drop \ get length from list
+
+ pad + 1- \ final dest addr
+ pad \ initial dest addr
+ swap
+ do
+ 2dup cdr 2swap car
+ drop i !
+ -1 +loop
+
+ 2drop
+;
+
: restore-return-stack ( continuation -- )
: restore-return-stack ( continuation -- )
- R> -rot \ store top of return stack on PS
+ trace
+
continuation->rstack-list
continuation->rstack-list
- 2dup print 2dup
+ list->pad
+ dup
+ RSP0 + RSP! \ expand return stack to accommodate entries
- \ TODO: Implement body of return stack restoration
+ 0 \ initial offset
+ do
+ pad i + @ RSP0 i 1+ + !
+ loop
- >R \ restore original top of return stack
+ trace
;
: restore-continuation ( continuation -- )
;
: restore-continuation ( continuation -- )