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:
c6aa8bc
)
Working on restore-return-stack
author
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Nov 2017 21:43:12 +0000
(22:43 +0100)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Wed, 1 Nov 2017 22:06:19 +0000
(23:06 +0100)
src/scheme.4th
patch
|
blob
|
history
diff --git
a/src/scheme.4th
b/src/scheme.4th
index
2edd16d
..
a360b47
100644
(file)
--- a/
src/scheme.4th
+++ b/
src/scheme.4th
@@
-564,8
+564,7
@@
global-env obj!
: continuation->rstack-list
drop pair-type cdr ;
: continuation->rstack-list
drop pair-type cdr ;
-: restore-param-stack ( continuation -- obj_stack continuation )
-
+: restore-param-stack ( continuation -- obj_stack )
continuation->pstack-list
2dup >R >R
continuation->pstack-list
2dup >R >R
@@
-587,12
+586,40
@@
global-env obj!
-2 +loop
2drop
-2 +loop
2drop
+;
+
+: restore-return-stack ( continuation -- )
+ R> \ store top of return stack on PS
+ continuation->rstack-list
+ 2dup >R >R
+ ( Allocate stack space first using rsp!,
+ then copy objects from list. )
+
+ car drop
+ rsp0 + rsp!
+
+ R> R> 2dup cdr
+ 2swap
+ car drop 0 swap do
+ 2dup car drop
+ rsp0 i + 1 + !
+ cdr
+ 1- +loop
+
+ 2drop
+ trace
+ >R \ restore original top of return stack
;
;
-: restore-continuation
+: restore-continuation
( continuation -- )
\ TODO: replace current parameter and return stacks with
\ contents of continuation object.
\ TODO: replace current parameter and return stacks with
\ contents of continuation object.
+
+ 2dup >R >R
+ restore-param-stack
+ R> R>
+ restore-return-stack
;
\ }}}
;
\ }}}