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 eb2239406da5a88ed98f4d4d3d98dfd26a04aaca
parent 7ebaa2914466053a0163345b70a39c79fdd74fda
Author: Alexander Burger <abu@software-lab.de>
Date:   Fri,  2 Nov 2012 08:34:25 +0100

emu64 continued
Diffstat:
Mdoc64/asm | 3++-
Mlib/map | 34+++++++++++++++++-----------------
Msrc64/arch/emu.l | 22+++++++++++++++++++---
Msrc64/arch/ppc64.l | 4+++-
Msrc64/arch/x86-64.l | 4+++-
Msrc64/lib/asm.l | 3++-
Msrc64/main.l | 3++-
Msrc64/tags | 76++++++++++++++++++++++++++++++++++++++--------------------------------------
8 files changed, 86 insertions(+), 63 deletions(-)

diff --git a/doc64/asm b/doc64/asm @@ -1,4 +1,4 @@ -# 24oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger @@ -171,6 +171,7 @@ stf # Store float value at address 'Z' ret # Return [---] + func # Convert 'E' to function pointer begin # Called from foreign function return # Return to foreign function diff --git a/lib/map b/lib/map @@ -32,9 +32,9 @@ and (1613 . "@src64/flow.l") any (3965 . "@src64/io.l") append (1338 . "@src64/subr.l") apply (713 . "@src64/apply.l") -arg (2368 . "@src64/main.l") -args (2344 . "@src64/main.l") -argv (2991 . "@src64/main.l") +arg (2369 . "@src64/main.l") +args (2345 . "@src64/main.l") +argv (2992 . "@src64/main.l") as (139 . "@src64/flow.l") asoq (3008 . "@src64/subr.l") assoc (2973 . "@src64/subr.l") @@ -65,7 +65,7 @@ call (3085 . "@src64/flow.l") car (5 . "@src64/subr.l") case (1954 . "@src64/flow.l") catch (2456 . "@src64/flow.l") -cd (2743 . "@src64/main.l") +cd (2744 . "@src64/main.l") cdaaar (464 . "@src64/subr.l") cdaadr (487 . "@src64/subr.l") cdaar (179 . "@src64/subr.l") @@ -88,7 +88,7 @@ circ (816 . "@src64/subr.l") circ? (2402 . "@src64/subr.l") clip (1799 . "@src64/subr.l") close (4378 . "@src64/io.l") -cmd (2973 . "@src64/main.l") +cmd (2974 . "@src64/main.l") cnt (1413 . "@src64/apply.l") co (2537 . "@src64/flow.l") commit (1498 . "@src64/db.l") @@ -99,9 +99,9 @@ connect (224 . "@src64/net.l") cons (747 . "@src64/subr.l") copy (1225 . "@src64/subr.l") ctl (4251 . "@src64/io.l") -ctty (2768 . "@src64/main.l") +ctty (2769 . "@src64/main.l") cut (1922 . "@src64/sym.l") -date (2482 . "@src64/main.l") +date (2483 . "@src64/main.l") dbck (2113 . "@src64/db.l") de (532 . "@src64/flow.l") dec (2323 . "@src64/big.l") @@ -111,7 +111,7 @@ del (1977 . "@src64/sym.l") delete (1401 . "@src64/subr.l") delq (1452 . "@src64/subr.l") diff (2589 . "@src64/subr.l") -dir (2903 . "@src64/main.l") +dir (2904 . "@src64/main.l") dm (545 . "@src64/flow.l") do (2130 . "@src64/flow.l") e (2917 . "@src64/flow.l") @@ -128,7 +128,7 @@ extern (1023 . "@src64/sym.l") extra (1258 . "@src64/flow.l") extract (1218 . "@src64/apply.l") fifo (2088 . "@src64/sym.l") -file (2850 . "@src64/main.l") +file (2851 . "@src64/main.l") fill (3243 . "@src64/subr.l") filter (1161 . "@src64/apply.l") fin (2033 . "@src64/subr.l") @@ -166,7 +166,7 @@ ifn (1854 . "@src64/flow.l") in (4191 . "@src64/io.l") inc (2256 . "@src64/big.l") index (2637 . "@src64/subr.l") -info (2805 . "@src64/main.l") +info (2806 . "@src64/main.l") intern (998 . "@src64/sym.l") ipid (3204 . "@src64/flow.l") isa (961 . "@src64/flow.l") @@ -225,7 +225,7 @@ nand (1648 . "@src64/flow.l") native (1379 . "@src64/main.l") need (919 . "@src64/subr.l") new (835 . "@src64/flow.l") -next (2351 . "@src64/main.l") +next (2352 . "@src64/main.l") nil (1731 . "@src64/flow.l") nond (1931 . "@src64/flow.l") nor (1669 . "@src64/flow.l") @@ -239,7 +239,7 @@ onOff (1738 . "@src64/sym.l") one (1771 . "@src64/sym.l") open (4335 . "@src64/io.l") opid (3220 . "@src64/flow.l") -opt (3094 . "@src64/main.l") +opt (3095 . "@src64/main.l") or (1629 . "@src64/flow.l") out (4211 . "@src64/io.l") pack (1270 . "@src64/sym.l") @@ -272,7 +272,7 @@ push (1813 . "@src64/sym.l") push1 (1849 . "@src64/sym.l") put (2835 . "@src64/sym.l") putl (3113 . "@src64/sym.l") -pwd (2732 . "@src64/main.l") +pwd (2733 . "@src64/main.l") queue (2045 . "@src64/sym.l") quit (1085 . "@src64/main.l") quote (134 . "@src64/flow.l") @@ -283,7 +283,7 @@ raw (451 . "@src64/main.l") rd (5160 . "@src64/io.l") read (2656 . "@src64/io.l") replace (1499 . "@src64/subr.l") -rest (2397 . "@src64/main.l") +rest (2398 . "@src64/main.l") reverse (1678 . "@src64/subr.l") rewind (5126 . "@src64/io.l") rollback (1898 . "@src64/db.l") @@ -325,7 +325,7 @@ text (1398 . "@src64/sym.l") throw (2482 . "@src64/flow.l") tick (3172 . "@src64/flow.l") till (3610 . "@src64/io.l") -time (2615 . "@src64/main.l") +time (2616 . "@src64/main.l") touch (1172 . "@src64/sym.l") trim (1759 . "@src64/subr.l") try (1168 . "@src64/flow.l") @@ -338,9 +338,9 @@ up (693 . "@src64/main.l") upp? (3393 . "@src64/sym.l") uppc (3460 . "@src64/sym.l") use (1562 . "@src64/flow.l") -usec (2720 . "@src64/main.l") +usec (2721 . "@src64/main.l") val (1588 . "@src64/sym.l") -version (3108 . "@src64/main.l") +version (3109 . "@src64/main.l") wait (3150 . "@src64/io.l") when (1873 . "@src64/flow.l") while (2050 . "@src64/flow.l") diff --git a/src64/arch/emu.l b/src64/arch/emu.l @@ -1,4 +1,4 @@ -# 31oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger # Byte order @@ -687,9 +687,9 @@ " A.d = A.f * (float)(E.n >> 4);" "else" " A.d = A.d * (double)(E.n >> 4);" - "if (isinf(A.d) == 1 || A.d > (double)0xFFFFFFFFFFFFFFF)" + "if (isinf(A.d) == 1 || A.d > (double)0xFFFFFFFFFFFFFFFLL)" " E.p = @1;" - "else if (isnan(A.d) || isinf(A.d) == -1 || A.d < (double)-0xFFFFFFFFFFFFFFF)" + "else if (isnan(A.d) || isinf(A.d) == -1 || A.d < (double)-0xFFFFFFFFFFFFFFFLL)" " E.p = @2;" "else if (A.d >= 0)" " E.n = (uint64_t)(A.d + 0.5) << 4 | 2;" @@ -945,6 +945,10 @@ "else" " A.n = (*(uint64_t (*)(long,long,long,long,long,long,long,long))Y.p)(((ptr)(S.p + 8))->n, ((ptr)(S.p + 24))->n, ((ptr)(S.p + 40))->n, ((ptr)(S.p + 56))->n, ((ptr)(S.p + 72))->n, ((ptr)(S.p + 88))->n, ((ptr)(S.p + 104))->n, ((ptr)(S.p + 120))->n);" ) ) ) ) ) ) +(asm func () + (genCode NIL '(func) ((directExpr "cbl1")) + "E.n = (uint64_t)(unsigned long)(void(*)())cbl[(E.p-@1)/2];" ) ) + (asm begin ()) (asm return () @@ -1352,9 +1356,21 @@ (prinl "}}") ) ) (prinl "};") (prinl) + (unless *FPic + (for I 24 + (sysFun (pack "cbl" I) T) ) ) (when *SysFun (mapc prinl (flip @)) (prinl) ) + (unless *FPic + (prinl + "static void (*cbl[])() = {" + (glue "," + (make + (for I 24 + (link (pack "fun" (absCode (pack "cbl" I)))) ) ) ) + "};" ) + (prinl) ) (prinl (and *FPic "static ") "uint16_t " diff --git a/src64/arch/ppc64.l b/src64/arch/ppc64.l @@ -1,4 +1,4 @@ -# 24oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger # Byte order @@ -1147,6 +1147,8 @@ (gt0 (- (length Arg) 8)) (prinst "addi" 1 1 (* @ 8)) ) ) +(asm func ()) + (asm begin () (prinst ".quad" ".+24" ".TOC.@tocbase" 0) (prinst "mflr" 0) diff --git a/src64/arch/x86-64.l b/src64/arch/x86-64.l @@ -1,4 +1,4 @@ -# 24oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger # Byte order @@ -825,6 +825,8 @@ (prinst "mov" "%r12" "%rdx") (prinst "xor" "%r12" "%r12") ) ) +(asm func ()) + (asm begin () (prinst "call" "begin") ) diff --git a/src64/lib/asm.l b/src64/lib/asm.l @@ -1,4 +1,4 @@ -# 24oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger # *LittleEndian *AlignedCode *Registers optimize @@ -422,6 +422,7 @@ (exec (reg (read))) (fixnum) (float) + (func) (hx2 (read)) (inc (destination) "*Mode") (initCode) diff --git a/src64/main.l b/src64/main.l @@ -1,4 +1,4 @@ -# 24oct12abu +# 02nov12abu # (c) Software Lab. Alexander Burger (code 'Code) @@ -2065,6 +2065,7 @@ pop A ld (A I) E # Store in slot pop E # Get function pointer + func pop Y pop X test E (hex "F000000000000000") # Fit in short number? diff --git a/src64/tags b/src64/tags @@ -425,12 +425,12 @@ badFdErrEX err.l 531 badInputErrB err.l 551 balanceCEY sym.l 910 balanceXY sym.l 892 -begString main.l 2306 +begString main.l 2307 binPrintEZ io.l 731 binReadZ_FE io.l 520 blkPeekCEZ db.l 392 blkPokeCEZ db.l 403 -boxE_E main.l 2274 +boxE_E main.l 2275 boxNumA_A gc.l 872 boxNumE_E gc.l 886 boxNum_A gc.l 824 @@ -532,7 +532,7 @@ ctOpenEXY io.l 1671 currFdX_C io.l 1334 currFd_C io.l 1338 cutLocalCX flow.l 2830 -dateXYZ_E main.l 2421 +dateXYZ_E main.l 2422 dbAEX db.l 1331 dbFetchEX db.l 1319 dbFileBlkY_AC db.l 246 @@ -562,9 +562,9 @@ doAnd flow.l 1613 doAny io.l 3965 doAppend subr.l 1338 doApply apply.l 713 -doArg main.l 2368 -doArgs main.l 2344 -doArgv main.l 2991 +doArg main.l 2369 +doArgs main.l 2345 +doArgv main.l 2992 doArrow subr.l 3916 doAs flow.l 139 doAsoq subr.l 3008 @@ -600,7 +600,7 @@ doCall flow.l 3085 doCar subr.l 5 doCase flow.l 1954 doCatch flow.l 2456 -doCd main.l 2743 +doCd main.l 2744 doCdaaar subr.l 464 doCdaadr subr.l 487 doCdaar subr.l 179 @@ -623,7 +623,7 @@ doCirc subr.l 816 doCircQ subr.l 2402 doClip subr.l 1799 doClose io.l 4378 -doCmd main.l 2973 +doCmd main.l 2974 doCnt apply.l 1413 doCo flow.l 2537 doCol sym.l 3051 @@ -635,9 +635,9 @@ doConnect net.l 224 doCons subr.l 747 doCopy subr.l 1225 doCtl io.l 4251 -doCtty main.l 2768 +doCtty main.l 2769 doCut sym.l 1922 -doDate main.l 2482 +doDate main.l 2483 doDbck db.l 2113 doDe flow.l 532 doDec big.l 2323 @@ -647,7 +647,7 @@ doDel sym.l 1977 doDelete subr.l 1401 doDelq subr.l 1452 doDiff subr.l 2589 -doDir main.l 2903 +doDir main.l 2904 doDiv big.l 2513 doDm flow.l 545 doDo flow.l 2130 @@ -669,7 +669,7 @@ doExtern sym.l 1023 doExtra flow.l 1258 doExtract apply.l 1218 doFifo sym.l 2088 -doFile main.l 2850 +doFile main.l 2851 doFill subr.l 3243 doFilter apply.l 1161 doFin subr.l 2033 @@ -710,7 +710,7 @@ doIfn flow.l 1854 doIn io.l 4191 doInc big.l 2256 doIndex subr.l 2637 -doInfo main.l 2805 +doInfo main.l 2806 doIntern sym.l 998 doIpid flow.l 3204 doIsa flow.l 961 @@ -774,7 +774,7 @@ doNand flow.l 1648 doNative main.l 1379 doNeed subr.l 919 doNew flow.l 835 -doNext main.l 2351 +doNext main.l 2352 doNil flow.l 1731 doNond flow.l 1931 doNor flow.l 1669 @@ -788,7 +788,7 @@ doOnOff sym.l 1738 doOne sym.l 1771 doOpen io.l 4335 doOpid flow.l 3220 -doOpt main.l 3094 +doOpt main.l 3095 doOr flow.l 1629 doOut io.l 4211 doPack sym.l 1270 @@ -822,7 +822,7 @@ doPush sym.l 1813 doPush1 sym.l 1849 doPut sym.l 2835 doPutl sym.l 3113 -doPwd main.l 2732 +doPwd main.l 2733 doQueue sym.l 2045 doQuit main.l 1085 doQuote flow.l 134 @@ -834,7 +834,7 @@ doRd io.l 5160 doRead io.l 2656 doRem big.l 2572 doReplace subr.l 1499 -doRest main.l 2397 +doRest main.l 2398 doReverse subr.l 1678 doRewind io.l 5126 doRollback db.l 1898 @@ -880,7 +880,7 @@ doText sym.l 1398 doThrow flow.l 2482 doTick flow.l 3172 doTill io.l 3610 -doTime main.l 2615 +doTime main.l 2616 doTouch sym.l 1172 doTrace flow.l 2956 doTrim subr.l 1759 @@ -894,9 +894,9 @@ doUp main.l 693 doUppQ sym.l 3393 doUppc sym.l 3460 doUse flow.l 1562 -doUsec main.l 2720 +doUsec main.l 2721 doVal sym.l 1588 -doVersion main.l 3108 +doVersion main.l 3109 doWait io.l 3150 doWhen flow.l 1873 doWhile flow.l 2050 @@ -909,7 +909,7 @@ doYield flow.l 2709 doYoke subr.l 1196 doZap sym.l 1186 doZero sym.l 1756 -endString_E main.l 2317 +endString_E main.l 2318 eofErr err.l 540 eolA_F io.l 3684 equalAE_F main.l 772 @@ -918,15 +918,15 @@ errEXYZ err.l 33 errnoC sys/x86-64.linux.code.l 10 errnoEXY err.l 24 errno_A sys/x86-64.linux.code.l 5 -evCntEX_FE main.l 2245 -evCntXY_FE main.l 2243 +evCntEX_FE main.l 2246 +evCntXY_FE main.l 2244 evExprCE_E main.l 1103 evListE_E main.l 1247 evMethodACXYZ_E flow.l 645 -evSymE_E main.l 2220 -evSymX_E main.l 2215 -evSymY_E main.l 2218 -execE main.l 2129 +evSymE_E main.l 2221 +evSymX_E main.l 2216 +evSymY_E main.l 2219 +execE main.l 2130 execErrS main.l 187 extErrEX err.l 440 extNmCE_X db.l 64 @@ -954,7 +954,7 @@ fmtWordACX_CX big.l 2046 forkErrX err.l 521 forkLispX_FE flow.l 3272 fsyncDB db.l 932 -funqE_FE main.l 2153 +funqE_FE main.l 2154 gc gc.l 65 getAdrZ_A db.l 6 getBinaryZ_FB io.l 448 @@ -996,7 +996,7 @@ isaCE_F flow.l 1012 jnlErrX err.l 624 jnlFileno_A db.l 344 joinLocalCX flow.l 2843 -lisp main.l 2083 +lisp main.l 2084 loadAllX_E main.l 162 loadBEX_E io.l 4072 lockErr err.l 613 @@ -1020,7 +1020,7 @@ methodEY_FCYZ flow.l 791 mkCharA_A sym.l 573 mkStrEZ_A sym.l 650 mkStrE_E sym.l 623 -msec_A main.l 2331 +msec_A main.l 2332 msgErrAX err.l 494 msgErrEX err.l 496 msgErrYX err.l 492 @@ -1088,7 +1088,7 @@ putACE sym.l 2491 putBlockBZ db.l 612 putSrcEC_E flow.l 25 putStdoutB io.l 4622 -putStringB main.l 2294 +putStringB main.l 2295 putTellBZ io.l 997 putUdpBZ net.l 377 rdAtomBY_E io.l 2118 @@ -1125,7 +1125,7 @@ retnc err.l 716 retnz err.l 722 retz err.l 719 rewindLog db.l 928 -runE_E main.l 2141 +runE_E main.l 2142 rwUnlockDbA db.l 269 selectErrX err.l 564 serverCEY_FE net.l 273 @@ -1174,8 +1174,8 @@ tellErr err.l 652 tenfoldA_A big.l 157 testEscA_F io.l 2051 throwErrZX flow.l 2507 -tmDateC_E main.l 2411 -tmTimeY_E main.l 2598 +tmDateC_E main.l 2412 +tmTimeY_E main.l 2599 tokenCE_E io.l 2522 trSyncErrX err.l 608 traceCY flow.l 3028 @@ -1216,10 +1216,10 @@ wrOpenEXY io.l 1496 wrSetCL_F io.l 2737 wrSyncErrX err.l 581 wtermsigS_A sys/x86-64.linux.code.l 28 -xCntAX_FA main.l 2265 -xCntCX_FC main.l 2256 -xCntEX_FE main.l 2247 -xSymE_E main.l 2222 +xCntAX_FA main.l 2266 +xCntCX_FC main.l 2257 +xCntEX_FE main.l 2248 +xSymE_E main.l 2223 xoruAE_A big.l 465 yieldErrEX err.l 488 yieldErrX err.l 486