commit 1f6efd216ee5887ab7d461fe17c69520348fe321
parent f71cfa018162755bb49ddd55ed25b215c5f5468b
Author: Alexander Burger <abu@software-lab.de>
Date: Fri, 24 May 2013 21:18:26 +0200
Save 'prg' in coroutine
Diffstat:
4 files changed, 78 insertions(+), 76 deletions(-)
diff --git a/lib/map b/lib/map
@@ -1,5 +1,5 @@
-! (2858 . "@src64/flow.l")
-$ (2960 . "@src64/flow.l")
+! (2861 . "@src64/flow.l")
+$ (2963 . "@src64/flow.l")
% (2572 . "@src64/big.l")
& (2807 . "@src64/big.l")
* (2389 . "@src64/big.l")
@@ -46,7 +46,7 @@ bool (1724 . "@src64/flow.l")
box (828 . "@src64/flow.l")
box? (1131 . "@src64/sym.l")
by (1669 . "@src64/apply.l")
-bye (3408 . "@src64/flow.l")
+bye (3411 . "@src64/flow.l")
bytes (2973 . "@src64/subr.l")
caaaar (271 . "@src64/subr.l")
caaadr (288 . "@src64/subr.l")
@@ -62,7 +62,7 @@ caddar (409 . "@src64/subr.l")
cadddr (435 . "@src64/subr.l")
caddr (156 . "@src64/subr.l")
cadr (45 . "@src64/subr.l")
-call (3060 . "@src64/flow.l")
+call (3063 . "@src64/flow.l")
car (5 . "@src64/subr.l")
case (1965 . "@src64/flow.l")
catch (2467 . "@src64/flow.l")
@@ -115,7 +115,7 @@ diff (2590 . "@src64/subr.l")
dir (3153 . "@src64/main.l")
dm (545 . "@src64/flow.l")
do (2141 . "@src64/flow.l")
-e (2921 . "@src64/flow.l")
+e (2924 . "@src64/flow.l")
echo (4434 . "@src64/io.l")
env (608 . "@src64/main.l")
eof (3549 . "@src64/io.l")
@@ -141,13 +141,13 @@ flip (1700 . "@src64/subr.l")
flush (5143 . "@src64/io.l")
fold (3521 . "@src64/sym.l")
for (2230 . "@src64/flow.l")
-fork (3234 . "@src64/flow.l")
+fork (3237 . "@src64/flow.l")
format (2089 . "@src64/big.l")
free (1960 . "@src64/db.l")
from (3568 . "@src64/io.l")
full (1076 . "@src64/subr.l")
fun? (750 . "@src64/sym.l")
-gc (431 . "@src64/gc.l")
+gc (430 . "@src64/gc.l")
ge0 (2707 . "@src64/big.l")
get (2903 . "@src64/sym.l")
getd (758 . "@src64/sym.l")
@@ -169,12 +169,12 @@ inc (2256 . "@src64/big.l")
index (2638 . "@src64/subr.l")
info (3055 . "@src64/main.l")
intern (1007 . "@src64/sym.l")
-ipid (3179 . "@src64/flow.l")
+ipid (3182 . "@src64/flow.l")
isa (967 . "@src64/flow.l")
job (1429 . "@src64/flow.l")
journal (971 . "@src64/db.l")
key (3401 . "@src64/io.l")
-kill (3211 . "@src64/flow.l")
+kill (3214 . "@src64/flow.l")
last (2045 . "@src64/subr.l")
le0 (2693 . "@src64/big.l")
length (2742 . "@src64/subr.l")
@@ -239,7 +239,7 @@ on (1717 . "@src64/sym.l")
onOff (1747 . "@src64/sym.l")
one (1780 . "@src64/sym.l")
open (4360 . "@src64/io.l")
-opid (3195 . "@src64/flow.l")
+opid (3198 . "@src64/flow.l")
opt (3344 . "@src64/main.l")
or (1640 . "@src64/flow.l")
out (4236 . "@src64/io.l")
@@ -324,7 +324,7 @@ tail (1912 . "@src64/subr.l")
tell (3285 . "@src64/io.l")
text (1407 . "@src64/sym.l")
throw (2493 . "@src64/flow.l")
-tick (3147 . "@src64/flow.l")
+tick (3150 . "@src64/flow.l")
till (3635 . "@src64/io.l")
time (2860 . "@src64/main.l")
touch (1181 . "@src64/sym.l")
@@ -352,7 +352,7 @@ wr (5268 . "@src64/io.l")
xchg (1672 . "@src64/sym.l")
xor (1701 . "@src64/flow.l")
x| (2887 . "@src64/big.l")
-yield (2709 . "@src64/flow.l")
+yield (2712 . "@src64/flow.l")
yoke (1197 . "@src64/subr.l")
zap (1195 . "@src64/sym.l")
zero (1765 . "@src64/sym.l")
diff --git a/src64/flow.l b/src64/flow.l
@@ -2665,8 +2665,11 @@
push E # Save 'tag'
push 0 # Mark 'stk' as active
sub S "EnvMid-EnvCo" # Space for 'env'
- ld X (X CDR) # Run 'prg'
- prog X
+ ld X (X CDR)
+ link
+ push X # Save 'prg'
+ link
+ prog X # Run 'prg'
ld (Y -I) 0 # Not yielded: Mark segment as unused
ld S (EnvCo7) # Restore stack pointer
load (EnvCo) (EnvMid) (S III) # Restore environment
diff --git a/src64/gc.l b/src64/gc.l
@@ -145,8 +145,6 @@
push Y
ld Y ((Y -II)) # Else get saved L
do
- null Y # End of stack?
- while ne # No
ld Z (Y) # Keep end of frame in Z
do
add Y I # End of frame?
@@ -156,7 +154,8 @@
call markE # Mark it
loop
ld Y (Y) # Next frame
- loop
+ null Y # End of stack?
+ until eq # Yes
pop Y
end
pop C
diff --git a/src64/tags b/src64/tags
@@ -999,46 +999,46 @@ sys/x86-64.linux.defs.l,1959
markE5,63
needC54,1336
gc65,1529
-doGc431,11123
-cons_A454,11644
-cons_C466,11908
-cons_E478,12172
-cons_X490,12436
-cons_Y502,12700
-cons_Z514,12964
-consA_A526,13228
-consC_A542,13551
-consE_A558,13860
-consX_A574,14169
-consA_C590,14478
-consC_C606,14787
-consE_C622,15110
-consA_E638,15419
-consC_E654,15728
-consE_E670,16037
-consX_E686,16360
-consA_X702,16669
-consE_X718,16978
-consY_X734,17287
-consA_Y750,17596
-consA_Z766,17905
-consAC_E782,18214
-consSymX_E800,18567
-boxNum_A820,19017
-boxNum_C832,19302
-boxNum_E844,19587
-boxNum_X856,19872
-boxNumA_A868,20157
-boxNumE_E882,20486
-consNumAC_A896,20815
-consNumAE_A914,21191
-consNumCA_C932,21567
-consNumCE_A950,21943
-consNumCE_C967,22310
-consNumCE_E985,22686
-consNumEA_A1002,23036
-consNumEA_E1019,23386
-consNumEC_E1037,23762
+doGc430,11107
+cons_A453,11628
+cons_C465,11892
+cons_E477,12156
+cons_X489,12420
+cons_Y501,12684
+cons_Z513,12948
+consA_A525,13212
+consC_A541,13535
+consE_A557,13844
+consX_A573,14153
+consA_C589,14462
+consC_C605,14771
+consE_C621,15094
+consA_E637,15403
+consC_E653,15712
+consE_E669,16021
+consX_E685,16344
+consA_X701,16653
+consE_X717,16962
+consY_X733,17271
+consA_Y749,17580
+consA_Z765,17889
+consAC_E781,18198
+consSymX_E799,18551
+boxNum_A819,19001
+boxNum_C831,19286
+boxNum_E843,19571
+boxNum_X855,19856
+boxNumA_A867,20141
+boxNumE_E881,20470
+consNumAC_A895,20799
+consNumAE_A913,21175
+consNumCA_C931,21551
+consNumCE_A949,21927
+consNumCE_C966,22294
+consNumCE_E984,22670
+consNumEA_A1001,23020
+consNumEA_E1018,23370
+consNumEC_E1036,23746
./flow.l,1658
redefMsgEC4,51
@@ -1108,25 +1108,25 @@ sys/x86-64.linux.defs.l,1959
doFinally2524,58583
doCo2548,59123
resumeCoroutine2573,59902
-doYield2709,64337
-cutLocalCX2821,67431
-joinLocalCX2834,67661
-closeCoFilesC2844,67824
-doBreak2858,68087
-brkLoadE_E2866,68239
-doE2921,69839
-doTrace2960,70605
-traceCY3032,72520
-doCall3060,73008
-doTick3147,75200
-doIpid3179,76197
-doOpid3195,76485
-doKill3211,76780
-doFork3234,77215
-forkLispX_FE3247,77436
-doBye3408,81996
-byeE3420,82168
-finishE3432,82479
+doYield2712,64386
+cutLocalCX2824,67480
+joinLocalCX2837,67710
+closeCoFilesC2847,67873
+doBreak2861,68136
+brkLoadE_E2869,68288
+doE2924,69888
+doTrace2963,70654
+traceCY3035,72569
+doCall3063,73057
+doTick3150,75249
+doIpid3182,76246
+doOpid3198,76534
+doKill3214,76829
+doFork3237,77264
+forkLispX_FE3250,77485
+doBye3411,82045
+byeE3423,82217
+finishE3435,82528
./subr.l,2147
doCar5,71