shithub: femtolisp

Download patch

ref: 99741712b707101ef2f3bb13d2f3ea2ebe774baf
parent: 21973ff5337936387681435e507c19d393e52c27
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Dec 26 13:25:42 EST 2024

compiler: if: fix the wrong missing out label

--- a/compiler.lsp
+++ b/compiler.lsp
@@ -268,7 +268,7 @@
         (then  (caddr x))
         (else  (if (cons? (cdddr x))
                    (cadddr x)
-                   (void))))
+                   #f)))
     (cond ((eq? test #t)
            (compile-in g env tail? then))
           ((eq? test #f)
--- a/flisp.boot
+++ b/flisp.boot
@@ -78,7 +78,7 @@
   bcode:nconst #fn(has?) #fn(get) #fn(put!)) bcode:indexfor)
 	    bcode:nconst #fn("6000n10r2G:" #() bcode:nconst) bcode:sp
 	    #fn("6000n10r4G:" #() bcode:sp) bcode:stack #fn("8000n20r40r4G1Mp:" #() bcode:stack)
-	    box-vars #fn("9000n2\x8d\x8a68620086>2_486<^1161:" #(#fn("9000n10B3Q00<T3B070A21720<5153@30\x8d4F<0=61:\x8d:" #(emit
+	    box-vars #fn("9000n2\x8d\x8a68620086>2_486<^1161:" #(#fn("9000n10B3Q00<T3B070A21720<5153@30O4F<0=61:O:" #(emit
   box caddr))) box-vars)
 	    bq-bracket #fn(";000n20H3=070710152e2:0<22CR01El380700=P:707324710=1K~52e3e2:0<25CS01El390260Te2:707027710T1K~52e3e2:0<28CO01El3500T:707029710T1K~52e3e2:70710152e2:" #(list
   bq-process unquote cons 'unquote unquote-splicing copy-list 'unquote-splicing unquote-nsplicing
@@ -111,7 +111,7 @@
 	    closure? #fn("6000n10\\;36040[S:" #() closure?) compile
 	    #fn("8000n170q7105162:" #(compile-f lower-define) compile) compile-and #fn("<000n570018283D218467:" #(compile-short-circuit
   brf) compile-and)
-	    compile-app #fn("E000n483<88R3U07088152IK088Z3E0218851[3;0218851@40887283=23523i07401O89544750K524760183=537508:U5247708237028@40298:63:89[;39047:8951892;Cf07089152I\\0212;517;d3P07<83r2523E07401O83T5447702;62:89B3P07=89<513F07>83513=07?01828364:8:IE07401O89544750K52@30\x8d4760183=537508;U5248:I<0750r/52@30\x8d48:3C07@018283898:8;67:770823702A@402B8;63:" #(in-env?
+	    compile-app #fn("E000n483<88R3U07088152IK088Z3E0218851[3;0218851@40887283=23523i07401O89544750K524760183=537508:U5247708237028@40298:63:89[;39047:8951892;Cf07089152I\\0212;517;d3P07<83r2523E07401O83T5447702;62:89B3P07=89<513F07>83513=07?01828364:8:IE07401O89544750K52@30O4760183=537508;U5248:I<0750r/52@30O48:3C07@018283898:8;67:770823702A@402B8;63:" #(in-env?
   #fn(top-level-value) length> 255 compile-in bcode:stack compile-arglist emit tcall.l call.l
   builtin->instruction cadr length= is-lambda? inlineable? compile-let compile-builtin-call tcall
   call) compile-app)
@@ -122,39 +122,39 @@
   compile-app aset! > aref list-head compile-arglist list-tail bcode:stack emit argc-error) compile-aset!)
 	    compile-begin #fn("9000n483H3?0700182715064:83=H3>070018283<64:7001O83<5447202352474018283=64:" #(compile-in
   void emit pop compile-begin) compile-begin)
-	    compile-builtin-call #fn("=000n7207185O538;3I07283=8;52I=073858;52@30\x8d4858<24CK086El3:07502662:750858663:8<27C[086El3:07502862:86r2l3:07502962:750858663:8<2:Cj086El3:07385K62:86Kl3:07502;62:86r2l3:07502<62:750858663:8<2=CK086El3:07502>62:750858663:8<2?CK086El3:07385K62:750858663:8<2@CM086El3<07502A2B63:750858663:8<2CCW086r2L3;07385r262:750823702D@402C8663:8<2ECc086r2l3:07502F62:7G86r2523?07508586r3~63:7385r262:7508562:" #(#fn(get)
+	    compile-builtin-call #fn("=000n7207185O538;3I07283=8;52I=073858;52@30O4858<24CK086El3:07502662:750858663:8<27C[086El3:07502862:86r2l3:07502962:750858663:8<2:Cj086El3:07385K62:86Kl3:07502;62:86r2l3:07502<62:750858663:8<2=CK086El3:07502>62:750858663:8<2?CK086El3:07385K62:750858663:8<2@CM086El3<07502A2B63:750858663:8<2CCW086r2L3;07385r262:750823702D@402C8663:8<2ECc086r2l3:07502F62:7G86r2523?07508586r3~63:7385r262:7508562:" #(#fn(get)
   arg-counts length= argc-error list emit loadnil + load0 add2 - neg sub2 * load1 / vector loadv #()
   apply tapply aref aref2 >) compile-builtin-call)
 	    compile-f #fn("8000n2702101>22262:" #(call-with-values #fn("7000n070AF62:" #(compile-f-))
 						  #fn("5000n20:" #())) compile-f)
-	    compile-f- #fn("O000n270501T711T517215173741T52711518;J7025@408;87H360E@802687518=268:51~73778:528:\x85\xa208?JL07886298>88J708=@508=U54@r07:867;2<7=2<7>8?527?268?5151535152478862@8>268?5188J708=@508=U5547A8608:898>55@30\x8d47B8=2C523I0788688J702D@402E8=53@W088\x85?078862F8=53@E08:J?078862G8=53@30O47H0897I7J1518952537K868@<52486r4268951r4Mp47L868@D7J15154478862M5247N2O7P7Q8651517R86518<537S865162:" #(make-code-emitter
+	    compile-f- #fn("O000n270501T711T517215173741T52711518;J7025@408;87H360E@802687518=268:51~73778:528:\x85\xa208?JL07886298>88J708=@508=U54@r07:867;2<7=2<7>8?527?268?5151535152478862@8>268?5188J708=@508=U5547A8608:898>55@30O47B8=2C523I0788688J702D@402E8=53@W088\x85?078862F8=53@E08:J?078862G8=53@30O47H0897I7J1518952537K868@<52486r4268951r4Mp47L868@D7J15154478862M5247N2O7P7Q8651517R86518<537S865162:" #(make-code-emitter
   lastcdr lambda:vars filter cons? λ #fn(length) keyword-arg? emit optargs bcode:indexfor
   make-perfect-hash-table #fn(map) cons car iota keyargs emit-optional-arg-inits > 255 largc lvargc
   vargc argc extend-env complex-bindings lambda:body box-vars compile-in ret values #fn(function)
   encode-byte-code bcode:code const-to-idx-vec bcode:cenv) compile-f-)
-	    compile-if #fn("A000n470051700517005183T718351728351B3;0738351@6074508;DC=07501828<64:8;OC=07501828=64:7501O8;895547602789534780885247501828<544823<07602952@;07602:8:534780895247501828=5447808:62:" #(make-label
-  caddr cdddr cadddr void compile-in emit brf mark-label ret jmp) compile-if)
+	    compile-if #fn("A000n470051700517005183T718351728351B3;0738351@30O8;DC=07401828<64:8;OC=07401828=64:7401O8;895547502689534770885247401828<544823<07502852@;0750298:534770895247401828=5447708:62:" #(make-label
+  caddr cdddr cadddr compile-in emit brf mark-label ret jmp) compile-if)
 	    compile-in #fn("B000\x8740005000\x884000I60O?4483R3<0700183D64:83H3\xa6083EC:07102262:83KC:07102362:83DC:07102462:83OC:07102562:83qC:07102662:7783513:07102862:7983513<07102:8363:7102;8363:83<2<C<07=0183=63:83<RS;ID0483<Z;I;047>83<1523=07?01828364:83<892@CS07A83T513>07B018283T64:7102;83T63:892CC=07D01828364:892EC>07F018283=64:892GC;07H018363:892ICD07J2K183>22L01>262:892MC@07N018283=8465:892OC>07P018283=64:892QCE07R0183T2E7S8351P64:892TCE07B01D83T5447102U62:892VC\x93083T7S83517W8;518:R360O@807X2Y5148<3`08;=?;47Z8:8<8;<B;3G047[8;<<51;3:047\\8;<5153@30O47]018:8;<64:892^Cp07B01O2Iq83Te35447_7`835151360O@807X2a5147B01O7`83515447102^62:7?01828364:" #(compile-sym
   emit load0 load1 loadt loadf loadnil void? loadvoid fits-i8 loadi8 loadv aset! compile-aset!
   in-env? compile-app quote self-evaluating? compile-in if compile-if begin compile-begin prog1
   compile-prog1 λ call-with-values #fn("7000n070AF62:" #(compile-f-))
-  #fn("9000n270A2105341\x85K02223AF>2152470A242515163:\x8d:" #(emit loadv #fn(for-each)
-							       #fn("9000n170AF0O64:" #(compile-sym))
-							       closure #fn(length))) and
-  compile-and or compile-or while compile-while cddr return ret set! value-get-doc error "set!: name must be a symbol"
+  #fn("9000n270A2105341\x85K02223AF>2152470A242515163:O:" #(emit loadv #fn(for-each)
+							    #fn("9000n170AF0O64:" #(compile-sym))
+							    closure #fn(length))) and compile-and
+  or compile-or while compile-while cddr return ret set! value-get-doc error "set!: name must be a symbol"
   symbol-set-doc is-lambda? lambda:vars compile-set! trycatch 1arg-lambda? caddr "trycatch: second form must be a 1-argument lambda") compile-in)
-	    compile-let #fn("A000n483<83=7005188T71018953728;737488518;528:537508=524268=1<521=P7708>827488515447808<U524798<E523A082I<07:02;8<63:\x8d:" #(bcode:sp
+	    compile-let #fn("A000n483<83=7005188T71018953728;737488518;528:537508=524268=1<521=P7708>827488515447808<U524798<E523A082I<07:02;8<63:O:" #(bcode:sp
   compile-arglist vars-to-env complex-bindings caddr box-vars #fn(nconc) compile-in bcode:stack >
   emit shift) compile-let)
 	    compile-or #fn("<000n470018283O21O67:" #(compile-short-circuit brt) compile-or)
-	    compile-prog1 #fn(":000n37001O82T544718251B3W0720K5247301O71825154474025524720r/62:\x8d:" #(compile-in
+	    compile-prog1 #fn(":000n37001O82T544718251B3W0720K5247301O71825154474025524720r/62:O:" #(compile-in
   cddr bcode:stack compile-begin emit pop) compile-prog1)
-	    compile-set! #fn("?000n470821E538821CF07201O83544730248263:88<El88=T893<07588=51@9076082528:3g07308937027@40288;534790K5247201O83544790r/5247302:62:7201O8354489IA07;2<2=825251@30\x8d47302>8;63:" #(lookup-sym
+	    compile-set! #fn("?000n470821E538821CF07201O83544730248263:88<El88=T893<07588=51@9076082528:3g07308937027@40288;534790K5247201O83544790r/5247302:62:7201O8354489IA07;2<2=825251@30O47302>8;63:" #(lookup-sym
   global compile-in emit setg vinfo:index capture-var! loada loadc bcode:stack set-car! error #fn(string)
   "internal error: misallocated var " seta) compile-set!)
 	    compile-short-circuit #fn("?000n783H3?0700182848665:83=H3@070018283<8665:86;I804710517001O83<86554720K52486360O@9073024524730858;534720r/52486360O@907302552476018283=84858657486340O:7708;62:" #(compile-in
   make-label bcode:stack emit dup pop compile-short-circuit mark-label) compile-short-circuit)
-	    compile-sym #fn(";000n470821E538821C`02282513M073248251513@07502624825163:750278263:88<El3W0750287988=51534833A088=T3:07502:62:\x8d:7502;7<08252534833A088=T3:07502:62:\x8d:" #(lookup-sym
+	    compile-sym #fn(";000n470821E538821C`02282513M073248251513@07502624825163:750278263:88<El3W0750287988=51534833A088=T3:07502:62:O:7502;7<08252534833A088=T3:07502:62:O:" #(lookup-sym
   global #fn(constant?) printable? #fn(top-level-value) emit loadv loadg loada vinfo:index car
   loadc capture-var!) compile-sym)
 	    compile-thunk #fn(":000n170q21q72051e362:" #(compile-f λ lower-define) compile-thunk)
@@ -164,7 +164,7 @@
 										  complex-bindings-
 										  filter #fn("7000n120A062:" #(#fn(has?)))
 										  table-keys) complex-bindings)
-	    complex-bindings- #fn("=000n61J40O:0R3K0833D02001523;021840D63:\x8d:0H;I80472051340O:0<23Co0200T1523Q021850TD534833>021840TD53@30\x8d@30\x8d474750511O83848566:760<513U074770517817905152O82S;I50483848566:740<17:051838485562;2<1838485>40=52P:" #(#fn(memq)
+	    complex-bindings- #fn("=000n61J40O:0R3K0833D02001523;021840D63:O:0H;I80472051340O:0<23Co0200T1523Q021850TD534833>021840TD53@30O@30O474750511O83848566:760<513U074770517817905152O82S;I50483848566:740<17:051838485562;2<1838485>40=52P:" #(#fn(memq)
   #fn(put!) quoted? set! complex-bindings- caddr is-lambda? lambda:body diff lambda:vars
   inlineable? #fn(map) #fn(";000n1700AOF929366:" #(complex-bindings-))) complex-bindings-)
 	    const-to-idx-vec #fn("9000n1207105151222385>17405152485:" #(#fn(vector-alloc)
@@ -179,7 +179,7 @@
 									     #fn(put!))) member
   delete-duplicates) delete-duplicates)
 	    diff #fn("8000n20J40q:200<1523:0710=162:0<710=152P:" #(#fn(memq) diff) diff)
-	    disassemble #fn("U000\x871000.///\x881000I60O?14z282JG07001E534715047260:@30\x8d482<2305124051\x8d\x8d252687>1?:5142527187>2?;514r4288851\x8a<\x8d8<<8=L3\x9324292:888<>2O7;537<8<<r4523907150@30\x8d4E87K~2=|48<8<<KM_48>2>8?2?523[08;8>8<<r45348:897@888<<52G5148<8<<r4M_@\x1f12>8?2A523V08;8>8<<K5348:89888<<GG5148<8<<KM_@\xf012>8?2B523e08;8>8<<K5347C2D888<<G8>2EC70r3@30EM515148<8<<KM_@\xb212>8?2F523\\08;8>8<<r45347C2D7@888<<52515148<8<<r4M_@}12>8?2G523\xb808;8>8<<r88>2HC70r4@30EM5347C2D7@888<<52512I5248<8<<r4M_47C2D7@888<<52515148<8<<r4M_48>2HCY07C2I5147C2D7@888<<52512I5248<8<<r4M_@30\x8d@\xec08?2Jc3^08;8>8<<r45347C2D7@888<<52512I5248<8<<r4M_@\xb802>8?2K523e08;8>8<<r25347C2L7M8<<r,7N888<<52g3515248<8<<r2M_@z02>8?2O523e08;8>8<<r45347C2L7M8<<r,7@888<<52g3515248<8<<r4M_@<08;8>8<<E53^1^1@\xc8-:" #(disassemble
+	    disassemble #fn("U000\x871000.///\x881000I60O?14z282JG07001E534715047260:@30O482<2305124051\x8d\x8d252687>1?:5142527187>2?;514r4288851\x8a<\x8d8<<8=L3\x9324292:888<>2O7;537<8<<r4523907150@30O4E87K~2=|48<8<<KM_48>2>8?2?523[08;8>8<<r45348:897@888<<52G5148<8<<r4M_@\x1f12>8?2A523V08;8>8<<K5348:89888<<GG5148<8<<KM_@\xf012>8?2B523e08;8>8<<K5347C2D888<<G8>2EC70r3@30EM515148<8<<KM_@\xb212>8?2F523\\08;8>8<<r45347C2D7@888<<52515148<8<<r4M_@}12>8?2G523\xb808;8>8<<r88>2HC70r4@30EM5347C2D7@888<<52512I5248<8<<r4M_47C2D7@888<<52515148<8<<r4M_48>2HCY07C2I5147C2D7@888<<52512I5248<8<<r4M_@30O@\xec08?2Jc3^08;8>8<<r45347C2D7@888<<52512I5248<8<<r4M_@\xb802>8?2K523e08;8>8<<r25347C2L7M8<<r,7N888<<52g3515248<8<<r2M_@z02>8?2O523e08;8>8<<r45347C2L7M8<<r,7@888<<52g3515248<8<<r4M_@<08;8>8<<E53^1^1@\xc8-:" #(disassemble
   newline void #fn(function:code) #fn(function:vals)
   #1=#fn("7000z0\x8d:" #() void) #fn("9000n10\\3F00[IA070504710OAKM63:72061:" #(newline disassemble
 										print) print-val)
@@ -192,15 +192,15 @@
   (optargs keyargs) keyargs " " brbound (jmp brf brt brne brnn brn) "@" hex5 ref-int16-LE (jmp.l
   brf.l brt.l brne.l brnn.l brn.l)) disassemble)
 	    div #fn("7000n201k0EL;3C041EL;3404K;I504r/;I404EM:" #() div) emit
-	    #fn("O000z20EG82JR0120CB087<21C:08722_@900E187Pp@\x9e123124523A075082<52e1?2@30\x8d42612752883F07882<29523:088T?1@30\x8d^142612:52883F07882<29523:088T?1@30\x8d^1412;C\\0822<d3=02=?14q?2@F0822>d3=02??14q?2@30O@30\x8d412@C\\0822<d3=02A?14q?2@F0822>d3=02B?14q?2@30O@30\x8d487<12CQ;3\x9b04882DCM087T2ECE00E82<2F7G8751PPp@x0882DCB00E82<2H87=PPp@a0882ICB00E82<2J87=PPp@J0882ECB00E82<2K87=PPp@30O;I]0412HCI0882ECB00E82<2F87=PPp@?00E7L182P8752p^140:" #(car
+	    #fn("O000z20EG82JR0120CB087<21C:08722_@900E187Pp@\x9e123124523A075082<52e1?2@30O42612752883F07882<29523:088T?1@30O^142612:52883F07882<29523:088T?1@30O^1412;C\\0822<d3=02=?14q?2@F0822>d3=02??14q?2@30O@30O412@C\\0822<d3=02A?14q?2@F0822>d3=02B?14q?2@30O@30O487<12CQ;3\x9b04882DCM087T2ECE00E82<2F7G8751PPp@x0882DCB00E82<2H87=PPp@a0882ICB00E82<2J87=PPp@J0882ECB00E82<2K87=PPp@30O;I]0412HCI0882ECB00E82<2F87=PPp@?00E7L182P8752p^140:" #(car
   cdr cadr #fn(memq) (loadv loadg setg) bcode:indexfor #fn(assq)
   ((loadv loadv.l) (loadg loadg.l) (setg setg.l) (loada loada.l) (seta seta.l) (box box.l)) > 255
   ((loadc loadc.l)) loada (0) loada0 (1) loada1 loadc loadc0 loadc1 brf not null? brn cddr brt eq?
   brne brnn nreconc) emit)
-	    emit-optional-arg-inits #fn("<000n582B3\x900700517102284534710238953474075176838452q53O7782515447102884534710295247:0895247;0182=8384KM65:\x8d:" #(make-label
+	    emit-optional-arg-inits #fn("<000n582B3\x900700517102284534710238953474075176838452q53O7782515447102884534710295247:0895247;0182=8384KM65:O:" #(make-label
   emit brbound brt compile-in extend-env list-head cadar seta pop mark-label
   emit-optional-arg-inits) emit-optional-arg-inits)
-	    encode-byte-code #fn("S000n17005171855172238651r3238651r2ki2M2452238651E255025502650OO278<28524\x8d8988L3\xd9148689G?=48=29CP02:8:8689KMG2;8<5153489r2M?9@\xa81278<2<2=7>873\x8308=8D2?C702@@p08D2AC702B@d08D2CC702D@X08D2EC702F@L08D2GC702H@@08D2IC702J@408=^1@408=525152489KM?948988L3:08689G@30O?>42K8=2L523`02:8;2;8<518>534278<873707M@407NE5152489KM?9@\xeb08=2OCH0278<2P8>5152489KM?9@\xce08>X3\xc708=2K8?2Q523H0278<2P8>5152489KM?9@\x9f02K8?2R523\x810278<2P8>5152489KM?94278<2P8689G5152489KM?948=2SCK0278<2P8689G5152489KM?9@30\x8d@E0278<2T8>5152489KM?9^1@30O@\x83.42U2V8<878:>38;5242W8<61:" #(reverse!
+	    encode-byte-code #fn("S000n17005171855172238651r3238651r2ki2M2452238651E255025502650OO278<28524\x8d8988L3\xd9148689G?=48=29CP02:8:8689KMG2;8<5153489r2M?9@\xa81278<2<2=7>873\x8308=8D2?C702@@p08D2AC702B@d08D2CC702D@X08D2EC702F@L08D2GC702H@@08D2IC702J@408=^1@408=525152489KM?948988L3:08689G@30O?>42K8=2L523`02:8;2;8<518>534278<873707M@407NE5152489KM?9@\xeb08=2OCH0278<2P8>5152489KM?9@\xce08>X3\xc708=2K8?2Q523H0278<2P8>5152489KM?9@\x9f02K8?2R523\x810278<2P8>5152489KM?94278<2P8689G5152489KM?948=2SCK0278<2P8689G5152489KM?9@30O@E0278<2T8>5152489KM?9^1@30O@\x83.42U2V8<878:>38;5242W8<61:" #(reverse!
   list->vector >= #fn(length) 65536 #fn(table) #fn(buffer)
   #fn(io-write) #int32(0) label #fn(put!) #fn(sizeof)
   #fn(byte) #fn(get) Instructions jmp jmp.l brt brt.l brf brf.l brne brne.l brnn brnn.l brn brn.l
@@ -336,7 +336,7 @@
 									       thrown-value ffound
 									       #fn(function:vals)
 									       1- #fn(length)
-									       #fn("8000n170A0G513>0F<A0G929363:\x8d:" #(closure?))) find-in-f)
+									       #fn("8000n170A0G513>0F<A0G929363:O:" #(closure?))) find-in-f)
   #fn(";000n220A01>321{863I02273247576865152275261:28:" #(#fn("8000n02021AF>292524O:" #(#fn(for-each)
 											#fn("8000n1A<0Fq63:" #())))
 							  #fn("6000n10B3F00<20C?00T21C8072061:23061:" #(thrown-value
@@ -424,13 +424,12 @@
 											print-stack-trace
 											#fn(stacktrace)))
 							  #fn("6000n1A50420061:" #(#fn(raise)))) top-level-exception-handler)
-	    trace #fn("A000n1200512150728551Ig0230742586262728290e286e3e22:e12;2985e286e3e4e35152@30\x8d^1^142<:" #(#fn(top-level-value)
+	    trace #fn("A000n1200512150728551Ig0230742586262728290e286e3e22:e12;2985e286e3e4e35152@30O^1^142<:" #(#fn(top-level-value)
   #fn(gensym) traced? #fn(set-top-level-value!) eval λ begin write cons quote newline apply ok) trace)
 	    traced? #fn("7000n170051;3?042105121A<51d:" #(closure? #fn(function:code)) #((#fn("9000z020210P51472504230}2:" #(#fn(write)
   x newline #.apply)))))
-	    untrace #fn("9000n1200517185513A0220238551r2G62:\x8d:" #(#fn(top-level-value) traced?
-								     #fn(set-top-level-value!)
-								     #fn(function:vals)) untrace)
+	    untrace #fn("9000n1200517185513A0220238551r2G62:O:" #(#fn(top-level-value) traced? #fn(set-top-level-value!)
+								  #fn(function:vals)) untrace)
 	    value-get-doc #fn("8000n10<0=208551;3=0486B;350485:" #(#fn(string?)) value-get-doc)
 	    values #fn("8000z00B3:00=J500<:A0P:" #() #(#3#)) vars-to-env
 	    #fn(":000n32021182>2072230515163:" #(#fn(map)