picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit c5a49b8384d50230b80248226983cc5d601de6c0
parent b99c1511587d130b726934df2b54c29122e20580
Author: Alexander Burger <abu@software-lab.de>
Date:   Sat, 25 May 2013 08:52:04 +0200

Proper 'Catch' handling in coroutines
Diffstat:
Mlib/map | 24++++++++++++------------
Msrc64/flow.l | 6++++++
Msrc64/gc.l | 15++++++++++++++-
Msrc64/tags | 244+++++++++++++++++++++----------------------------------------------------------
4 files changed, 97 insertions(+), 192 deletions(-)

diff --git a/lib/map b/lib/map @@ -1,5 +1,5 @@ -! (2860 . "@src64/flow.l") -$ (2962 . "@src64/flow.l") +! (2866 . "@src64/flow.l") +$ (2968 . "@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 (3410 . "@src64/flow.l") +bye (3416 . "@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 (3062 . "@src64/flow.l") +call (3068 . "@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 (2923 . "@src64/flow.l") +e (2929 . "@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 (3236 . "@src64/flow.l") +fork (3242 . "@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 (430 . "@src64/gc.l") +gc (443 . "@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 (3181 . "@src64/flow.l") +ipid (3187 . "@src64/flow.l") isa (967 . "@src64/flow.l") job (1429 . "@src64/flow.l") journal (971 . "@src64/db.l") key (3401 . "@src64/io.l") -kill (3213 . "@src64/flow.l") +kill (3219 . "@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 (3197 . "@src64/flow.l") +opid (3203 . "@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 (3149 . "@src64/flow.l") +tick (3155 . "@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 (2711 . "@src64/flow.l") +yield (2714 . "@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 @@ -2577,6 +2577,9 @@ sub A (StkSize) ld (StkLimit) A load (EnvCo) (EnvMid) (Y (pack -II "-(EnvMid-EnvCo)")) # Restore environment + ld X Catch # Pointer to catch frames + ld C (Z (pack III "+(Catch-EnvCo)")) # Local catch frames + call joinLocalCX # Join locals ld X (EnvBind) # Reversed bindings ld C (Z (pack III "+(EnvBind-EnvCo)")) # Main bindings do @@ -2800,6 +2803,9 @@ loop end ld (EnvBind) C # Store back link in coroutine's env + ld X Catch # Pointer to catch frames + ld C (Z (pack III "+(Catch-EnvCo)")) # Local catch frames + call cutLocalCX # Cut off locals pop Y # Restore taget coroutine ld X (Z II) # Get 'seg' ld (X -II) S # Save stack pointer diff --git a/src64/gc.l b/src64/gc.l @@ -142,7 +142,7 @@ ld E (Y -I) # Mark 'tag' call markE else - push Y + push Y # <S> ld Y ((Y -II)) # Else get saved L do ld Z (Y) # Keep end of frame in Z @@ -156,6 +156,19 @@ ld Y (Y) # Next frame null Y # End of stack? until eq # Yes + ld Y ((S) (pack -II "-(EnvMid-Catch)")) # Saved catch frames + do + null Y # Any? + while ne # Yes + ld E (Y I) # Mark 'tag' + null E # Any? + if ne + call markE # Yes + end + ld E (Y II) # Mark 'fin' + call markE + ld Y (Y) # Next frame + loop pop Y end pop C diff --git a/src64/tags b/src64/tags @@ -48,120 +48,6 @@ CHAR_LETTER63,1516 CHAR_DIGIT64,1537 -sys/x86-64.linux.defs.l,1959 -ENOENT5,59 -EINTR6,108 -EBADF7,155 -EAGAIN8,194 -EACCES9,227 -EPIPE10,268 -ECONNRESET11,303 -O_RDONLY14,365 -O_WRONLY15,382 -O_RDWR16,399 -O_CREAT17,414 -O_EXCL18,431 -O_TRUNC19,448 -O_APPEND20,466 -F_GETFD21,486 -F_SETFD22,502 -FD_CLOEXEC23,518 -BUFSIZ26,546 -PIPE_BUF27,564 -MAXPATHLEN29,585 -RTLD_LAZY32,613 -RTLD_GLOBAL33,631 -FLOCK36,662 -L_TYPE37,702 -L_WHENCE38,722 -L_START39,744 -L_LEN40,760 -L_PID41,775 -SEEK_SET42,790 -SEEK_CUR43,807 -F_RDLCK44,824 -F_WRLCK45,840 -F_UNLCK46,856 -F_GETFL47,872 -F_SETFL48,888 -F_GETLK49,904 -F_SETLK50,920 -F_SETLKW51,936 -F_SETOWN52,953 -O_NONBLOCK53,970 -O_ASYNC54,992 -STAT57,1019 -ST_MODE58,1061 -ST_SIZE59,1083 -ST_MTIME60,1100 -S_IFMT61,1118 -S_IFDIR62,1144 -TMS65,1180 -TMS_UTIME66,1214 -TMS_STIME67,1232 -TERMIOS70,1261 -C_IFLAG71,1304 -C_LFLAG72,1320 -C_CC73,1337 -ISIG74,1351 -VMIN75,1364 -VTIME76,1377 -TCSADRAIN77,1391 -SIGACTION80,1419 -SIGSET_T81,1462 -SA_HANDLER82,1481 -SA_MASK83,1500 -SA_FLAGS84,1516 -SIG_DFL86,1536 -SIG_IGN87,1552 -SIG_UNBLOCK88,1568 -SIGHUP90,1589 -SIGINT91,1615 -SIGUSR192,1630 -SIGUSR293,1647 -SIGPIPE94,1664 -SIGALRM95,1681 -SIGTERM96,1698 -SIGCHLD97,1715 -SIGCONT98,1732 -SIGSTOP99,1749 -SIGTSTP100,1766 -SIGTTIN101,1783 -SIGTTOU102,1800 -SIGIO103,1817 -SIGNALS104,1832 -WNOHANG107,1894 -WUNTRACED108,1910 -FD_SET111,1938 -TM_SEC114,1975 -TM_MIN115,1990 -TM_HOUR116,2005 -TM_MDAY117,2021 -TM_MON118,2038 -TM_YEAR119,2054 -D_NAME122,2078 -SOCK_STREAM125,2105 -SOCK_DGRAM126,2125 -AF_UNSPEC127,2144 -AF_INET6128,2162 -SOL_SOCKET129,2180 -SO_REUSEADDR130,2199 -IPPROTO_IPV6131,2220 -IPV6_V6ONLY132,2242 -INET6_ADDRSTRLEN133,2263 -NI_MAXHOST135,2290 -NI_NAMEREQD136,2312 -SOCKADDR_IN6138,2333 -SIN6_FAMILY139,2355 -SIN6_PORT140,2375 -SIN6_ADDR141,2393 -ADDRINFO143,2412 -AI_FAMILY144,2430 -AI_SOCKTYPE145,2448 -AI_ADDRLEN146,2468 -AI_ADDR147,2488 -AI_NEXT148,2505 - ./glob.l,4330 Data4,51 AV7,77 @@ -999,46 +885,46 @@ sys/x86-64.linux.defs.l,1959 markE5,63 needC54,1336 gc65,1529 -doGc430,11103 -cons_A453,11624 -cons_C465,11888 -cons_E477,12152 -cons_X489,12416 -cons_Y501,12680 -cons_Z513,12944 -consA_A525,13208 -consC_A541,13531 -consE_A557,13840 -consX_A573,14149 -consA_C589,14458 -consC_C605,14767 -consE_C621,15090 -consA_E637,15399 -consC_E653,15708 -consE_E669,16017 -consX_E685,16340 -consA_X701,16649 -consE_X717,16958 -consY_X733,17267 -consA_Y749,17576 -consA_Z765,17885 -consAC_E781,18194 -consSymX_E799,18547 -boxNum_A819,18997 -boxNum_C831,19282 -boxNum_E843,19567 -boxNum_X855,19852 -boxNumA_A867,20137 -boxNumE_E881,20466 -consNumAC_A895,20795 -consNumAE_A913,21171 -consNumCA_C931,21547 -consNumCE_A949,21923 -consNumCE_C966,22290 -consNumCE_E984,22666 -consNumEA_A1001,23016 -consNumEA_E1018,23366 -consNumEC_E1036,23742 +doGc443,11525 +cons_A466,12046 +cons_C478,12310 +cons_E490,12574 +cons_X502,12838 +cons_Y514,13102 +cons_Z526,13366 +consA_A538,13630 +consC_A554,13953 +consE_A570,14262 +consX_A586,14571 +consA_C602,14880 +consC_C618,15189 +consE_C634,15512 +consA_E650,15821 +consC_E666,16130 +consE_E682,16439 +consX_E698,16762 +consA_X714,17071 +consE_X730,17380 +consY_X746,17689 +consA_Y762,17998 +consA_Z778,18307 +consAC_E794,18616 +consSymX_E812,18969 +boxNum_A832,19419 +boxNum_C844,19704 +boxNum_E856,19989 +boxNum_X868,20274 +boxNumA_A880,20559 +boxNumE_E894,20888 +consNumAC_A908,21217 +consNumAE_A926,21593 +consNumCA_C944,21969 +consNumCE_A962,22345 +consNumCE_C979,22712 +consNumCE_E997,23088 +consNumEA_A1014,23438 +consNumEA_E1031,23788 +consNumEC_E1049,24164 ./flow.l,1658 redefMsgEC4,51 @@ -1108,25 +994,25 @@ sys/x86-64.linux.defs.l,1959 doFinally2524,58583 doCo2548,59123 resumeCoroutine2573,59902 -doYield2711,64374 -cutLocalCX2823,67468 -joinLocalCX2836,67698 -closeCoFilesC2846,67861 -doBreak2860,68124 -brkLoadE_E2868,68276 -doE2923,69876 -doTrace2962,70642 -traceCY3034,72557 -doCall3062,73045 -doTick3149,75237 -doIpid3181,76234 -doOpid3197,76522 -doKill3213,76817 -doFork3236,77252 -forkLispX_FE3249,77473 -doBye3410,82033 -byeE3422,82205 -finishE3434,82516 +doYield2714,64539 +cutLocalCX2829,67773 +joinLocalCX2842,68003 +closeCoFilesC2852,68166 +doBreak2866,68429 +brkLoadE_E2874,68581 +doE2929,70181 +doTrace2968,70947 +traceCY3040,72862 +doCall3068,73350 +doTick3155,75542 +doIpid3187,76539 +doOpid3203,76827 +doKill3219,77122 +doFork3242,77557 +forkLispX_FE3255,77778 +doBye3416,82338 +byeE3428,82510 +finishE3440,82821 ./subr.l,2147 doCar5,71 @@ -1255,9 +1141,9 @@ sys/x86-64.linux.defs.l,1959 getUdpZ_FB373,9872 putUdpBZ380,10017 -sys/x86-64.linux.code.l,94 -errno_A5,67 -errnoC10,169 -wifstoppedS_F16,287 -wifsignaledS_F21,413 -wtermsigS_A28,568 +sys/emu.code.l,95 +errno_A8,134 +errnoC16,260 +wifstoppedS_F24,409 +wifsignaledS_F32,570 +wtermsigS_A40,725