From 57c066fcdfd6058cf51154ae00e24d6a74f3a192 Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Mon, 20 Jul 2009 04:57:17 +0000 Subject: [PATCH] simplifying code by eliminating the hybrid stack/heap calling convention other misc. cleanup --- femtolisp/bootstrap.sh | 2 +- femtolisp/builtins.c | 11 +--- femtolisp/compiler.lsp | 109 +++++++++++++++++----------------- femtolisp/cvalues.c | 2 - femtolisp/flisp.boot | 2 +- femtolisp/flisp.c | 129 +++++++++++------------------------------ femtolisp/flisp.h | 13 +---- femtolisp/iostream.c | 2 +- femtolisp/system.lsp | 11 ++-- femtolisp/table.c | 2 - femtolisp/todo | 3 +- femtolisp/unittest.lsp | 2 + 12 files changed, 106 insertions(+), 182 deletions(-) diff --git a/femtolisp/bootstrap.sh b/femtolisp/bootstrap.sh index 35c28ea..99effd6 100755 --- a/femtolisp/bootstrap.sh +++ b/femtolisp/bootstrap.sh @@ -3,7 +3,7 @@ cp flisp.boot flisp.boot.bak echo "Creating stage 0 boot file..." -#../../branches/interpreter/femtolisp/flisp mkboot0.lsp system.lsp compiler.lsp > flisp.boot +#../../branches/interpreter/femtolisp/flisp mkboot0.lsp system.lsp compiler.lsp > flisp.boot.new ./flisp mkboot0.lsp system.lsp compiler.lsp > flisp.boot.new mv flisp.boot.new flisp.boot diff --git a/femtolisp/builtins.c b/femtolisp/builtins.c index bb59c14..ce88ca8 100644 --- a/femtolisp/builtins.c +++ b/femtolisp/builtins.c @@ -35,15 +35,8 @@ static value_t fl_nconc(value_t *args, u_int32_t nargs) cons_t *c; uint32_t i=0; while (1) { - if (i >= MAX_ARGS) { - lst = car_(args[MAX_ARGS]); - args[MAX_ARGS] = cdr_(args[MAX_ARGS]); - if (!iscons(args[MAX_ARGS])) break; - } - else { - lst = args[i++]; - if (i >= nargs) break; - } + lst = args[i++]; + if (i >= nargs) break; if (iscons(lst)) { *pcdr = lst; c = (cons_t*)ptr(lst); diff --git a/femtolisp/compiler.lsp b/femtolisp/compiler.lsp index bfcbd26..c4c23de 100644 --- a/femtolisp/compiler.lsp +++ b/femtolisp/compiler.lsp @@ -209,6 +209,8 @@ ; number of non-nulls (define (nnn e) (count (lambda (x) (not (null? x))) e)) +(define (printable? x) (not (iostream? x))) + (define (compile-sym g env s Is) (let ((loc (lookup-sym s env 0 #t))) (case (car loc) @@ -216,7 +218,11 @@ (closed (emit g (aref Is 1) (cadr loc) (caddr loc)) ; update index of most distant captured frame (bcode:cdepth g (- (nnn (cdr env)) 1 (cadr loc)))) - (else (emit g (aref Is 2) s))))) + (else + (if (and (constant? s) + (printable? (top-level-value s))) + (emit g :loadv (top-level-value s)) + (emit g (aref Is 2) s)))))) (define (compile-if g env tail? x) (let ((elsel (make-label g)) @@ -300,8 +306,6 @@ (define (compile-or g env tail? forms) (compile-short-circuit g env tail? forms #f :brt)) -(define MAX_ARGS 127) - (define (list-partition l n) (define (list-part- l n i subl acc) (cond ((atom? l) (if (> i 0) @@ -313,23 +317,16 @@ (error "list-partition: invalid count") (reverse! (list-part- l n 0 () ())))) -(define (just-compile-args g lst env) - (for-each (lambda (a) - (compile-in g env #f a)) - lst)) +(define (make-nested-arglist args n) + (cons nconc + (map (lambda (l) (cons list l)) + (list-partition args n)))) (define (compile-arglist g env lst) - (let ((argtail (length> lst MAX_ARGS))) - (if argtail - (begin (just-compile-args g (list-head lst MAX_ARGS) env) - (let ((rest - (cons nconc - (map (lambda (l) (cons list l)) - (list-partition argtail MAX_ARGS))))) - (compile-in g env #f rest)) - (+ MAX_ARGS 1)) - (begin (just-compile-args g lst env) - (length lst))))) + (for-each (lambda (a) + (compile-in g env #f a)) + lst) + (length lst)) (define (argc-error head count) (error (string "compile error: " head " expects " count @@ -342,7 +339,7 @@ (if (and (pair? head) (eq? (car head) 'lambda) (list? (cadr head)) - (not (length> (cadr head) MAX_ARGS))) + (not (length> (cadr head) 255))) (compile-let g env tail? x) (compile-call g env tail? x)))) @@ -375,6 +372,33 @@ (lambda (b) (get b2i b #f)))) +(define (compile-builtin-call g env tail? x head b nargs) + (let ((count (get arg-counts b #f))) + (if (and count + (not (length= (cdr x) count))) + (argc-error head count)) + (case b ; handle special cases of vararg builtins + (:list (if (= nargs 0) (emit g :loadnil) (emit g b nargs))) + (:+ (cond ((= nargs 0) (emit g :load0)) + ((= nargs 2) (emit g :add2)) + (else (emit g b nargs)))) + (:- (cond ((= nargs 0) (argc-error head 1)) + ((= nargs 1) (emit g :neg)) + ((= nargs 2) (emit g :sub2)) + (else (emit g b nargs)))) + (:* (if (= nargs 0) (emit g :load1) + (emit g b nargs))) + (:/ (if (= nargs 0) + (argc-error head 1) + (emit g b nargs))) + (:vector (if (= nargs 0) + (emit g :loadv []) + (emit g b nargs))) + (:apply (if (< nargs 2) + (argc-error head 2) + (emit g (if tail? :tapply :apply) nargs))) + (else (emit g b))))) + (define (compile-call g env tail? x) (let ((head (car x))) (let ((head @@ -385,38 +409,19 @@ (builtin? (top-level-value head))) (top-level-value head) head))) - (let ((b (and (builtin? head) - (builtin->instruction head)))) - (if (not b) - (compile-in g env #f head)) - (let ((nargs (compile-arglist g env (cdr x)))) - (if b - (let ((count (get arg-counts b #f))) - (if (and count - (not (length= (cdr x) count))) - (argc-error head count)) - (case b ; handle special cases of vararg builtins - (:list (if (= nargs 0) (emit g :loadnil) (emit g b nargs))) - (:+ (cond ((= nargs 0) (emit g :load0)) - ((= nargs 2) (emit g :add2)) - (else (emit g b nargs)))) - (:- (cond ((= nargs 0) (argc-error head 1)) - ((= nargs 1) (emit g :neg)) - ((= nargs 2) (emit g :sub2)) - (else (emit g b nargs)))) - (:* (if (= nargs 0) (emit g :load1) - (emit g b nargs))) - (:/ (if (= nargs 0) - (argc-error head 1) - (emit g b nargs))) - (:vector (if (= nargs 0) - (emit g :loadv []) - (emit g b nargs))) - (:apply (if (< nargs 2) - (argc-error head 2) - (emit g (if tail? :tapply :apply) nargs))) - (else (emit g b)))) - (emit g (if tail? :tcall :call) nargs))))))) + (if (length> (cdr x) 255) + ; argument count is a uint8, so for more than 255 arguments + ; we use apply on a list built from sublists that fit the limit + (compile-in g env tail? + `(#.apply ,head ,(make-nested-arglist (cdr x) 255))) + (let ((b (and (builtin? head) + (builtin->instruction head)))) + (if (not b) + (compile-in g env #f head)) + (let ((nargs (compile-arglist g env (cdr x)))) + (if b + (compile-builtin-call g env tail? x head b nargs) + (emit g (if tail? :tcall :call) nargs)))))))) (define (expand-define form body) (if (symbol? form) @@ -514,7 +519,7 @@ 'lambda (lastcdr f)))) (cond ((not (null? let?)) (emit g :let)) - ((length> args MAX_ARGS) (emit g (if (null? (lastcdr args)) + ((length> args 255) (emit g (if (null? (lastcdr args)) :largc :lvargc) (length args))) ((null? (lastcdr args)) (emit g :argc (length args))) diff --git a/femtolisp/cvalues.c b/femtolisp/cvalues.c index f6ca2e5..2d53ace 100644 --- a/femtolisp/cvalues.c +++ b/femtolisp/cvalues.c @@ -464,8 +464,6 @@ value_t cvalue_array(value_t *args, u_int32_t nargs) argcount("array", nargs, 1); cnt = nargs - 1; - if (nargs > MAX_ARGS) - cnt += (llength(args[MAX_ARGS])-1); fltype_t *type = get_array_type(args[0]); elsize = type->elsz; sz = elsize * cnt; diff --git a/femtolisp/flisp.boot b/femtolisp/flisp.boot index 3000c73..3da184c 100644 --- a/femtolisp/flisp.boot +++ b/femtolisp/flisp.boot @@ -1 +1 @@ -(zero? #function("7000r1~`W;" [] zero?) vector.map #function("8000r2c0e1\x7f31u42;" [#function("8000vc0e1~31u42;" [#function(":000v`\x80azc0qw2~;" [#function(":000r1\x80~i20i21~[31\\;" [])]) vector.alloc]) length] vector.map) vector->list #function("9000r1c0e1~31_u43;" [#function(":000va~c0qw2\x7f;" [#function("8000r1i10\x80~z[\x81Ko01;" [])]) length] vector->list) values #function("9000s0~F16602~NA650~M;\x80~K;" [] #5=[(*values*) ()]) untrace #function("8000r1c0e1~31u42;" [#function("9000ve0~316@0e1\x80e2~31b2[42;^;" [traced? set-top-level-value! function:vals]) top-level-value] untrace) traced? #function("8000r1e0~31e0\x8031>;" [function:code] [#function("\xb9000s0e0c1~K312c2~x2;" [println x #.apply]) ()]) trace #function("8000r1c0e1~31u322c2;" [#function("8000vc0e130u42;" [#function("?000ve0\x8031@6a0e1i10e2c3~c4c5c6c7i10L2~L3L2c8c7\x80L2~L3L3L33142;^;" [traced? set-top-level-value! eval lambda begin println cons quote apply]) gensym]) top-level-value ok] trace) to-proper #function("8000r1~A640~;~?660~L1;~Me0~N31K;" [to-proper] to-proper) table.values #function("9000r1e0c1_~43;" [table.foldl #function("7000r3\x7fg2K;" [])] table.values) table.pairs #function("9000r1e0c1_~43;" [table.foldl #function("7000r3~\x7fKg2K;" [])] table.pairs) table.keys #function("9000r1e0c1_~43;" [table.foldl #function("7000r3~g2K;" [])] table.keys) table.invert #function("8000r1c0e130u42;" [#function("9000ve0c1q_\x80332~;" [table.foldl #function("9000r3e0\x80\x7f~43;" [put!])]) table] table.invert) table.foreach #function("9000r2e0c1q_\x7f43;" [table.foldl #function("8000r3\x80~\x7f322];" [])] table.foreach) table.clone #function("8000r1c0e130u42;" [#function("9000ve0c1q_\x80332~;" [table.foldl #function("9000r3e0\x80~\x7f43;" [put!])]) table] table.clone) symbol-syntax #function("9000r1e0e1~^43;" [get *syntax-environment*] symbol-syntax) string.trim #function("9000r3c0^^u43;" [#function("8000vc0qm02c1qm12c2e3\x8031u42;" [#function(";000r4g2g3X16?02e0\x7fe1~g232326A0\x80~\x7fe2~g232g344;g2;" [string.find string.char string.inc] trim-start) #function("<000r3e0g2`3216D02e1\x7fe2~e3~g23232326?0\x81~\x7fe3~g23243;g2;" [> string.find string.char string.dec] trim-end) #function("<000ve0i10\x80i10i11`~34\x81i10i12~3343;" [string.sub]) length])] string.trim) string.tail #function(";000r2e0~e1~`\x7f3342;" [string.sub string.inc] string.tail) string.rpad #function("<000r3e0~e1g2\x7fe2~31z3242;" [string string.rep string.count] string.rpad) string.rep #function(";000r2\x7fb4X6`0e0\x7f`32650c1;\x7faW680e2~41;\x7fb2W690e2~~42;e2~~~43;e3\x7f316@0e2~e4~\x7faz3242;e4e2~~32\x7fb2U242;" [<= "" string odd? string.rep] string.rep) string.map #function("9000r2c0e130e2\x7f31u43;" [#function("8000vc0`u322e1~41;" [#function(";000v^~\x81X6S02e0\x80i10e1i11~3231322e2i11~32m05\x0b/;" [io.putc string.char string.inc]) io.tostring!]) buffer length] string.map) string.lpad #function(";000r3e0e1g2\x7fe2~31z32~42;" [string string.rep string.count] string.lpad) string.join #function("8000r2~A650c0;c1e230u42;" ["" #function("8000ve0~\x80M322e1c2q\x80N322e3~41;" [io.write for-each #function("8000r1e0\x80i11322e0\x80~42;" [io.write]) io.tostring!]) buffer] string.join) simple-sort #function("8000r1~A17602~NA640~;c0~Mu42;" [#function("9000vc0e1c2q\x80N32u42;" [#function(":000ve0e1~M31\x80L1e1~N3143;" [nconc simple-sort]) separate #function("7000r1~\x80X;" [])])] simple-sort) set-syntax! #function("9000r2e0e1~\x7f43;" [put! *syntax-environment*] set-syntax!) separate #function(":000r2\x80~\x7f__44;" [] #0=[#function(";000r4\x7fA680g2g3K;~\x7fM316@0\x80~\x7fN\x7fMg2Kg344;\x80~\x7fNg2\x7fMg3K44;" [] #0#) ()]) self-evaluating? #function("8000r1~?16602~C@17K02e0~3116A02~C16:02~e1~31<;" [constant? top-level-value] self-evaluating?) reverse! #function("8000r1c0_u42;" [#function("9000v^\x80F6C02\x80N\x80~\x80m02P2o005\x1c/2~;" [])] reverse!) reverse #function("9000r1e0e1_~43;" [foldl cons] reverse) revappend #function("8000r2e0e1~31\x7f42;" [nconc reverse] revappend) repl #function("9000r0c0^^u43;" [#function("6000vc0m02c1qm12\x7f302e240;" [#function("8000r0e0c1312e2e3312c4c5c6tu42;" [princ "> " io.flush *output-stream* #function("8000ve0e131@16=02c2e3~31u42;" [io.eof? *input-stream* #function("7000ve0~312~k12];" [print that]) load-process]) #function("6000r0e040;" [read]) #function("7000r1e0e1312e2~41;" [io.discardbuffer *input-stream* raise])] prompt) #function("7000r0c0qc1t6;0e2302\x8140;^;" [#function("7000r0\x803016702e040;" [newline]) #function("7000r1e0~312e1e230312];" [print-exception print-stack-trace stacktrace]) newline] reploop) newline])] repl) remainder #1=#function("8000r2~~\x7fV\x7fT2z;" [] mod0) ref-int32-LE #function("=000r2e0e1~\x7f`y[`32e1~\x7fay[b832e1~\x7fb2y[b@32e1~\x7fb3y[bH32R441;" [int32 ash] ref-int32-LE) ref-int16-LE #function(";000r2e0e1~\x7f`y[`32e1~\x7fay[b832y41;" [int16 ash] ref-int16-LE) random #function("8000r1e0~316<0e1e230~42;e330~T2;" [integer? mod rand rand.double] random) quotient #.div0 quote-value #function("7000r1e0~31640~;c1~L2;" [self-evaluating? quote] quote-value) println #function("\xb9000s0e0~Q2e1302;" [print newline] println) print-to-string #function("8000r1c0e130u42;" [#function("8000ve0~\x80322e1~41;" [io.print io.tostring!]) buffer] print-to-string) print-stack-trace #function("9000r1c0^^u43;" [#function("<000vc0qm02c1qm12c2e3e4\x80b53231e5e6e7c8e9303232`u44;" [#function("8000r3c0e1~31g2Ku42;" [#function("9000ve0\x8031e0\x8131<6>0e1c2c3~L341;c4e5\x8031u42;" [function:code raise thrown-value ffound #function(":000v`e0e1~3131c2qw;" [1- length #function("9000r1e0\x80~[316A0i30\x80~[i21i1043;^;" [closure?])]) function:vals]) function:name] find-in-f) #function("8000r2c0c1qc2tu42;" [#function(";000v~6H0e0e1e2e3e4~3132c53241;c6;" [symbol string.join map string reverse! "/" lambda]) #function("8000r0e0c1q\x81322^;" [for-each #function("9000r1i10~\x80_43;" [])]) #function("7000r1~F16E02~Mc0<16;02e1~31c2<680e3~41;e4~41;" [thrown-value cadr ffound caddr raise])] fn-name) #function("8000ve0c1q~42;" [for-each #function("9000r1e0c1i02c2332e3i11~`[\x8132e4~31NK312e5302i02ayo02;" [princ "#" " " print vector->list newline])]) reverse! list-tail filter closure? map #function("7000r1~E16802e0~41;" [top-level-value]) environment])] print-stack-trace) print-exception #function("9000r1c0^^u43;" [#function("\xb9000vc0m02c1m12\x80F16D02\x80Mc2<16:02e3\x80b4326Q0~c4e5\x8031c6e7\x8031c8352\x7fe9\x8031315\xd20\x80F16@02\x80Mc:<16602\x80NF6A0~c;e5\x8031c<335\xac0\x80F16802\x80Mc=<6@0~c>312~\x80NQ25\x8f0\x80F16802\x80Mc?<6I0e@e7\x8031312~cAe5\x8031325i0eB\x803116:02e3\x80b2326K0\x7f\x80M312~cC312cDe5\x8031u325<0~cE312\x7f\x80312~eF41;" [#function("\xba000s0e0e1~x3;" [io.princ *error-stream*] eprinc) #function("\xba000s0e0e1~x3;" [io.print *error-stream*] eprint) type-error length= "type-error: " cadr ": expected " caddr ", got " cadddr unbound-error "unbound-error: eval: variable " " has no value" error "error: " load-error print-exception "in file " list? ": " #function("8000ve0~3117502~C660\x80530\x81~41;" [string?]) "*** Unhandled exception: " *linefeed*])] print-exception) print #function("\xba000s0e0e1~x3;" [io.print *output-stream*] print) princ #function("\xba000s0e0e1~x3;" [io.princ *output-stream*] princ) positive? #function("8000r1e0~`42;" [>] positive?) odd? #function("7000r1e0~31@;" [even?] odd?) nreconc #function("8000r2e0e1~31\x7f42;" [nconc reverse!] nreconc) nnn #function("8000r1e0c1~42;" [count #function("6000r1~A@;" [])] nnn) newline #function("7000r0e0e1312];" [princ *linefeed*] newline) nestlist #function(";000r3e0g2`32640_;\x7fe1~~\x7f31g2az33K;" [<= nestlist] nestlist) negative? #function("7000r1~`X;" [] negative?) mod0 #1# mod #function("9000r2~e0~\x7f32\x7fT2z;" [div] mod) min #function("<000s1\x7fA640~;e0c1~\x7f43;" [foldl #function("7000r2~\x7fX640~;\x7f;" [])] min) memv #function("8000r2\x7f?640^;\x7fM~=640\x7f;e0~\x7fN42;" [memv] memv) member #function("8000r2\x7f?640^;\x7fM~>640\x7f;e0~\x7fN42;" [member] member) max #function("<000s1\x7fA640~;e0c1~\x7f43;" [foldl #function("7000r2~\x7fX640\x7f;~;" [])] max) mark-label #function("9000r2e0~e1\x7f43;" [emit :label] mark-label) map-int #function("9000r2e0\x7f`32640_;c1~`31_K_u43;" [<= #function(":000v~m12a\x81azc0qw2~;" [#function("8000r1\x81i10~31_KP2\x81No01;" [])])] map-int) map! #function("9000r2\x7f^\x7fF6B02\x7f~\x7fM31O2\x7fNm15\x1d/2;" [] map!) map #function("=000s2c0^^u43;" [#function("9000vc0m02c1qm12i02A6;0~\x80\x81_L143;\x7f\x80\x81i02K42;" [#function("9000r3g2^\x7fF6H02g2~\x7fM31_KPNm22\x7fNm15\x17/2N;" [] map1) #function("\xb7000r2\x7fMA640_;~\x80e0\x7f_L133Q2\x81~\x80e1\x7f_L13332K;" [car cdr] mapn)])] map) make-system-image #function(";000r1c0e1~e2e3e434c5e6u44;" [#function("8000v^k02c1c2qu42;" [*print-pretty* #function("7000vc0qc1qt~302;" [#function(":000r0c0e1c2qe3e4303132u42;" [#function("\xb9000ve0i10e1e2e3~e2e4~3233Q2322e5i10e642;" [io.print nconc map list top-level-value io.write *linefeed*]) filter #function("9000r1~E16w02e0~31@16l02e1~31G@17C02e2~31e2e1~3131>@16K02e3~i1132@16=02e4e1~3131@;" [constant? top-level-value string memq iostream?]) simple-sort environment]) #function("7000r1\x80302e0~41;" [raise])]) #function("7000r0e0\x80312i02k1;" [io.close *print-pretty*])]) file :write :create :truncate (*linefeed* *directory-separator* *argv* that *print-pretty* *print-width* *print-readably*) *print-pretty*] make-system-image) make-label #function("6000r1e040;" [gensym] make-label) make-code-emitter #function("9000r0_e030`c1Z4;" [table +Inf] make-code-emitter) macroexpand-1 #function("8000r1~?640~;c0e1~31u42;" [#function("\xb7000v~680~\x80Nx2;\x80;" []) macrocall?] macroexpand-1) macroexpand #function("8000r1c0^u42;" [#function("8000vc0qm02~\x80_42;" [#function("9000r2~?640~;c0e1~M\x7f32u42;" [#function("\xb8000v~6F0i10e0~31\x80NQ2e1~3142;c2e3\x8031u42;" [cadr caddr #function("\xb8000v~6B0i20~i10NQ2i1142;i10Mc0<660i10;i10Mc1<6Y0e2c1L1e3i1031L1e4c5qe6i103132e7i103144;i10Mc8<6R0e2c8L1e3i1031L1e4c9qe6i10313243;i10Mc:<6W0c;e3i1031e2c1L1_L1e reverse! >=] list-part-) <= error "list-partition: invalid count" reverse!])] list-partition) list-head #function(":000r2e0\x7f`32640_;~Me1~N\x7faz32K;" [<= list-head] list-head) list->vector #function("\xb7000r1e0~x2;" [vector] list->vector) length> #function("9000r2\x7f`X640~;\x7f`W6;0~F16402~;~?660\x7f`X;e0~N\x7faz42;" [length>] length>) length= #function("9000r2\x7f`X640^;\x7f`W650~?;~?660\x7f`W;e0~N\x7faz42;" [length=] length=) lastcdr #function("7000r1~?640~;e0~31N;" [last-pair] lastcdr) last-pair #function("7000r1~N?640~;e0~N41;" [last-pair] last-pair) just-compile-args #function("8000r3e0c1q\x7f42;" [for-each #function(":000r1e0\x80i02^~44;" [compile-in])] just-compile-args) iota #function("8000r1e0e1~42;" [map-int identity] iota) io.readline #function("8000r1e0~c142;" [io.readuntil #\x000a] io.readline) index-of #function(":000r3\x7fA640^;~\x7fM<650g2;e0~\x7fNg2ay43;" [index-of] index-of) in-env? #function("8000r2e0c1q\x7f42;" [any #function("8000r1e0\x80~42;" [memq])] in-env?) identity #function("6000r1~;" [] identity) hex5 #function("9000r1e0e1~b@32b5c243;" [string.lpad number->string #\0] hex5) get-defined-vars #function("8000r1e0\x80~3141;" [delete-duplicates] #2=[#function("\xb7000r1~?640_;~Mc0<16602~NF6m0e1~31C16:02e1~31L117V02e1~31F16E02e2~31C16:02e2~31L117402_;~Mc3<6>0e4e5\x80~N32x2;_;" [define cadr caadr begin append map] #2#) ()]) for-each #function("8000r2\x7fF6@0~\x7fM312e0~\x7fN42;];" [for-each] for-each) foldr #function(";000r3g2A640\x7f;~g2Me0~\x7fg2N3342;" [foldr] foldr) foldl #function(":000r3g2A640\x7f;e0~~g2M\x7f32g2N43;" [foldl] foldl) fits-i8 #function("8000r1~I16F02e0~b\xb03216:02e1~b\xaf42;" [>= <=] fits-i8) filter #function("9000r2\x80~\x7f_43;" [] #3=[#function(":000r3\x7fA650g2;~\x7fM316>0\x80~\x7fN\x7fMg2K43;\x80~\x7fNg243;" [] #3#) ()]) expand-define #function("<000r2~C6:0c0~\x7fML3;c0~Me1c2L1~NL1e3\x7f31~M34L3;" [set! nconc lambda copy-list] expand-define) expand #function("7000r1e0~41;" [macroexpand] expand) every #function("8000r2\x7f?17D02~\x7fM3116:02e0~\x7fN42;" [every] every) even? #function("8000r1e0~a32`W;" [logand] even?) eval #function("8000r1e0e1~313140;" [compile-thunk expand] eval) error #function(":000s0e0c1~K41;" [raise error] error) encode-byte-code #function("8000r1c0e1~31u42;" [#function("8000vc0e1~31u42;" [#function(";000vc0e1e2~31b3e2~31b2VT2yc332u42;" [#function(">000vc0e1\x8031`e230e230e330^^u48;" [#function(">000ve0g4c1322^\x7f~X6\xe402i10\x7f[m52g5e2<6O0e3g2i10\x7fay[e4g431332\x7fb2ym15\xb30e0g4e5e6e7\x806<0c8g5u32540g53231322\x7faym12\x7f~X6:0i10\x7f[530^m62e9g5c:326^0e3g3e4g431g6332e0g4\x80670e;540e<`31322\x7faym15C0g6D6<0c=g5u32530^5z/2e>c?qg3322e@g441;" [io.write #int32(0) :label put! sizeof byte get Instructions #function("7000v~e0<650e1;~e2<650e3;~e4<650e5;i05;" [:jmp :jmp.l :brt :brt.l :brf :brf.l]) memq (:jmp :brf :brt) int32 int16 #function(":000ve0~c1326H0e2i04e3i0631322\x81ayo01;e0~c4326`0e2i04e5i0631322\x81ayo012e2i04e5i20\x81[31322\x81ayo01;e0~c6326`0e2i04e3i0631322\x81ayo012e2i04e3i20\x81[31322\x81ayo01;e2i04e5i0631322\x81ayo01;" [memq (:loadv.l :loadg.l :setg.l :loada.l :seta.l :largc :lvargc) io.write int32 (:loadc :setc) uint8 (:loadc.l :setc.l)]) table.foreach #function("<000r2e0i04~322e1i04i10670e2540e3e4i02\x7f32~z3142;" [io.seek io.write int32 int16 get]) io.tostring!]) length table buffer]) >= length 65536]) list->vector]) reverse!] encode-byte-code) emit #function("G000s2g2A6=0~`\x7f~`[K\\5\xdb0e0\x7fc1326A0e2~g2M32L1m2530^2c3e4\x7fc532u322c6e4\x7fc732u322\x7fe8<6\\0g2c9>6=0e:m12_m25F0g2c;>6=0e>6=0e?m12_m25F0g2c@>6=0eAm12_m2530^530^2~`eB\x7fg2K~`[32\\2~;" [memq (:loadv :loadg :setg) bcode:indexfor #function("8000v~16=02e0i02Mc1326;0e2~31o01;^;" [> 255 cadr]) assq ((:loadv :loadv.l) (:loadg :loadg.l) (:setg :setg.l) (:loada :loada.l) (:seta :seta.l)) #function("8000v~16O02e0i02Mc13217@02e0e2i0231c1326;0e2~31o01;^;" [> 255 cadr]) ((:loadc :loadc.l) (:setc :setc.l)) :loada (0) :loada0 (1) :loada1 :loadc (0 0) :loadc00 (0 1) :loadc01 nreconc] emit) div #function("8000r2~\x7fV~`X16C02\x7f`X16402a17502b/17402`y;" [] div) display #function("7000r1e0~312];" [princ] display) disassemble #function("=000s1\x7fA6C0e0~`322e1302];530^2c2\x7fMe3~31e4~31u44;" [disassemble newline #function("8000vc0^u42;" [#function(":000vc0qm02`\x80azc1w2e2c3e4\x81`32c5332c6b4e7\x8131u43;" [#function("9000r1~J16602~G@6D0e0c1312e2~i10ay42;e3~41;" [princ "\n" disassemble print] print-val) #function("7000r1e0c141;" [princ "\t"]) princ "maxstack " ref-int32-LE "\n" #function(":000v^~\x7fX6E02c0e1c2q^e333u325\x19/;" [#function("<000ve0\x80b432690e130530^2`i20azc2w2e3e4\x80b4z31c5e6e7~31a32c8342\x80ayo002c9~u42;" [> newline #function("7000r1e0c141;" [princ "\t"]) princ hex5 ": " string.tail string "\t" #function("=000ve0~c1326P0i20i32e2i31i1032[312i10b4yo10;e0~c3326L0i20i32i31i10[[312i10ayo10;e0~c4326K0e5e6i31i10[31312i10ayo10;e0~c7326O0e5e6e2i31i103231312i10b4yo10;e0~c8326f0e5e6i31i10[31c9322i10ayo102e5e6i31i10[31312i10ayo10;e0~c:326n0e5e6e2i31i103231c9322i10b4yo102e5e6e2i31i103231312i10b4yo10;e0~c;326X0e5ci31i1032R331322i10b2yo10;e0~c?326X0e5cstring (:loada.l :seta.l :largc :lvargc) (:loadc :setc) " " (:loadc.l :setc.l) (:jmp :brf :brt) "@" hex5 ref-int16-LE (:jmp.l :brf.l :brt.l)])]) table.foldl #function("8000r3g217@02\x7fi21\x80[<16402~;" []) Instructions]) length])]) function:code function:vals] disassemble) delete-duplicates #function("9000r1~?640~;c0~M~Nu43;" [#function("8000ve0~\x7f32680e1\x7f41;~e1\x7f31K;" [member delete-duplicates])] delete-duplicates) count #function("8000r2c0^u42;" [#function("9000vc0qm02~\x80\x81`43;" [#function(":000r3\x7fA650g2;\x80~\x7fN~\x7fM31690g2ay540g243;" [] count-)])] count) copy-tree #function("8000r1~?640~;e0~M31e0~N31K;" [copy-tree] copy-tree) const-to-idx-vec #function("9000r1c0e1e2~3131u42;" [#function("9000ve0c1qe2\x8031322~;" [table.foreach #function("8000r2\x80\x7f~\\;" []) bcode:ctable]) vector.alloc bcode:nconst] const-to-idx-vec) compile-while #function("9000r4c0e1~31e1~31u43;" [#function(":000ve0\x80\x81^^342e1\x80~322e0\x80\x81^i02342e2\x80e3\x7f332e2\x80e4322e0\x80\x81^i03342e2\x80e5~332e1\x80\x7f42;" [compile-in mark-label emit :brf :pop :jmp]) make-label] compile-while) compile-thunk #function(";000r1e0e1c2L1_L1~L1\x803441;" [compile nconc lambda] #4=[#:g546 ()]) compile-sym #function(";000r4c0e1g2\x7f`]34u42;" [#function("8000vc0~Mu42;" [#function(";000v~c0<6D0e1i10i13`[e2\x803143;~c3<6a0e1i10i13a[e2\x8031e4\x8031342e5i10e6i11N31ae2\x8031S342;e1i10i13b2[i1243;" [arg emit cadr closed caddr bcode:cdepth nnn])]) lookup-sym] compile-sym) compile-short-circuit #function(":000r6g3?6=0e0~\x7fg2g444;g3N?6>0e0~\x7fg2g3M44;c1e2~31u42;" [compile-in #function("<000ve0\x80\x81^i03M342e1\x80e2322e1\x80i05~332e1\x80e3322e4\x80\x81i02i03Ni04i05362e5\x80~42;" [compile-in emit :dup :pop compile-short-circuit mark-label]) make-label] compile-short-circuit) compile-prog1 #function(";000r3e0~\x7f^e1g231342e2g231F6H0e3~\x7f^e2g231342e4~e542;^;" [compile-in cadr cddr compile-begin emit :pop] compile-prog1) compile-or #function("<000r4e0~\x7fg2g3^e146;" [compile-short-circuit :brt] compile-or) compile-let #function("9000r4c0g3Mg3Nu43;" [#function(";000ve0\x7fe1e2~313132660^5=0e3e4c5~32312e6c7qc8q322c9e:\x80\x81\x7f33u42;" [length= length cadr error string "apply: incorrect number of arguments to " call-with-values #function("9000r0e0i11\x80]43;" [compile-f-]) #function("9000r2e0i10e1~332e2i10\x7f42;" [emit :loadv bcode:cdepth]) #function(";000ve0i10e1322e0i10i12670e2540e3a~y43;" [emit :copyenv :tcall :call]) compile-arglist])] compile-let) compile-in #function(":000r4g3C6=0e0~\x7fg3c144;g3?6\x9a0g3`<6:0e2~e342;g3a<6:0e2~e442;g3]<6:0e2~e542;g3^<6:0e2~e642;g3_<6:0e2~e742;e8g3316<0e2~e9g343;e2~e:g343;c;g3Mu42;" [compile-sym [:loada :loadc :loadg] emit :load0 :load1 :loadt :loadf :loadnil fits-i8 :loadi8 :loadv #function("=000v~c0<6A0e1\x80e2e3i033143;~c4<6?0e5\x80\x81i02i0344;~c6<6@0e7\x80\x81i02i03N44;~c8<6<0e9\x80\x81i0343;~c:<6=0e;c<6@0e?\x80\x81i02i03N44;~c@<6@0eA\x80\x81i02i03N44;~cB<6J0eC\x80\x81e3i0331c6eDi0331K44;~cE<6N0eF\x80\x81e3i0331eGi0331eHi033145;~cI<6I0eJ\x80\x81]e3i0331342e1\x80eK42;~cL<6Q0eJ\x80\x81^eGi0331342eM\x80\x81e3i0331cN44;~cO<6N0eJ\x80\x81i02ePe3i0331eDi03313244;~cQ<6v0eJ\x80\x81^c:_e3i0331L3342eReGi033131660^580eScT312eJ\x80\x81^eGi0331342e1\x80eU42;eV\x80\x81i02i0344;" [quote emit :loadv cadr if compile-if begin compile-begin prog1 compile-prog1 lambda call-with-values #function("8000r0e0i11i1342;" [compile-f-]) #function("9000r2e0i10e1~332e2i10\x7f322\x7fe3i1131X6<0e0i10e442;^;" [emit :loadv bcode:cdepth nnn :closure]) and compile-and or compile-or while compile-while cddr for compile-for caddr cadddr return compile-in :ret set! compile-sym [:seta :setc :setg] define expand-define trycatch 1arg-lambda? error "trycatch: second form must be a 1-argument lambda" :trycatch compile-app])] compile-in) compile-if #function("=000r4c0e1~31e1~31e2g331e3g331e4g331F6;0e5g331530^u46;" [#function(";000vg2]<6>0e0\x80\x81i02g344;g2^<6>0e0\x80\x81i02g444;e0\x80\x81^g2342e1\x80e2~332e0\x80\x81i02g3342i026<0e1\x80e3325:0e1\x80e4\x7f332e5\x80~322e0\x80\x81i02g4342e5\x80\x7f42;" [compile-in emit :brf :ret :jmp mark-label]) make-label cadr caddr cdddr cadddr] compile-if) compile-for #function(":000r5e0g4316X0e1~\x7f^g2342e1~\x7f^g3342e1~\x7f^g4342e2~e342;e4c541;" [1arg-lambda? compile-in emit :for error "for: third form must be a 1-argument lambda"] compile-for) compile-f- #function("<000s2c0^u42;" [#function(";000vc0qm02c1e230e3\x8131e4\x8131i10<670c5570e4\x8131u44;" [#function(":000r1c0e1~31F6N0e2~31F6=0c3e1~31K570e4~31530^u42;" [#function("8000vc0e1~31u42;" [#function(":000v~A640\x80;e0c1~\x80i4034e2c3~32K;" [list* lambda map #function("6000r1^;" [])]) get-defined-vars]) cddr cdddr begin caddr] lambda-body) #function("A000vi12A@6<0e0~e1325\x860e2\x7fe3326O0e0~e4\x7f31A670e5540e6e7\x7f31335_0e4\x7f31A6A0e0~e8e7\x7f31335G0e0~e9\x7f?660`570e7\x7f31332e:~e;\x7f31i10K]e4i1131i20<6<0ee?e@eA~3131eB~31g233~b3[42;" [emit :let length> MAX_ARGS lastcdr :largc :lvargc length :argc :vargc compile-in to-proper caddr :ret values function encode-byte-code bcode:code const-to-idx-vec]) make-code-emitter cadr lastcdr lambda])] #4#) compile-f #function("<000s2e0c1qc242;" [call-with-values #function("\xb9000r0e0\x80\x81i02x4;" [compile-f-]) #function("6000r2~;" [])] compile-f) compile-call #function("8000r4c0g3Mu42;" [#function("9000vc0~C16V02e1~\x8132@16J02~E16C02e2~3116902e3~31G6:0e3~31530~u42;" [#function("8000vc0~G16802e1~31u42;" [#function(";000v~@6A0e0i20i21^\x8034530^2c1e2i20i21i23N33u42;" [compile-in #function(":000v\x806@0c0e1e2\x80^33u42;e3i30i32670e4540e5~43;" [#function("9000v~16=02e0i43N~32@6=0e1i20~32530^2c2i10u42;" [length= argc-error #function(":000v~e0<6R0i10`W6<0e1i50e242;e1i50i20i1043;~e3<6e0i10`W6<0e1i50e442;i10b2W6<0e1i50e542;e1i50i20i1043;~e6<6v0i10`W6;0e7i30a42;i10aW6<0e1i50e842;i10b2W6<0e1i50e942;e1i50i20i1043;~e:<6R0i10`W6<0e1i50e;42;e1i50i20i1043;~e<<6Q0i10`W6;0e7i30a42;e1i50i20i1043;~e=<6T0i10`W6>0e1i50e>c?43;e1i50i20i1043;~e@<6]0i10b2X6<0e7i30b242;e1i50i52670eA540e@i1043;e1i50i2042;" [:list emit :loadnil :+ :load0 :add2 :- argc-error :neg :sub2 :* :load1 :/ :vector :loadv [] :apply :tapply])]) get arg-counts emit :tcall :call]) compile-arglist]) builtin->instruction]) in-env? constant? top-level-value])] compile-call) compile-begin #function(":000r4g3?6<0e0~\x7fg2^44;g3N?6>0e0~\x7fg2g3M44;e0~\x7f^g3M342e1~e2322e3~\x7fg2g3N44;" [compile-in emit :pop compile-begin] compile-begin) compile-arglist #function("9000r3c0e1g2e232u42;" [#function("<000v~6]0e0\x80e1i02e232\x81332c3e4e5c6e7~e23232Ku322e2ay;e0\x80i02\x81332e8i0241;" [just-compile-args list-head MAX_ARGS #function(":000ve0i10i11^~44;" [compile-in]) nconc map #function("7000r1e0~K;" [list]) list-partition length]) length> MAX_ARGS] compile-arglist) compile-app #function("8000r4c0g3Mu42;" [#function(":000v~F16W02~Mc0<16M02e1e2~313116?02e3e2~31e432@6?0e5\x80\x81i02i0344;e6\x80\x81i02i0344;" [lambda list? cadr length> MAX_ARGS compile-let compile-call])] compile-app) compile-and #function("<000r4e0~\x7fg2g3]e146;" [compile-short-circuit :brf] compile-and) compile #function("8000r1e0_~42;" [compile-f] compile) closure? #function("7000r1~J16602~G@;" [] closure?) char? #function("7000r1e0~31c1<;" [typeof wchar] char?) cddr #function("6000r1~NN;" [] cddr) cdddr #function("6000r1~NNN;" [] cdddr) cddar #function("6000r1~MNN;" [] cddar) cdar #function("6000r1~MN;" [] cdar) cdadr #function("6000r1~NMN;" [] cdadr) cdaar #function("6000r1~MMN;" [] cdaar) call-with-values #function("8000r2c0~30u42;" [#function("\xb7000v~F16902i10~M<680\x81~Nx2;\x81~41;" [])] #5#) cadr #function("6000r1~NM;" [] cadr) caddr #function("6000r1~NNM;" [] caddr) cadddr #function("6000r1~NNNM;" [] cadddr) cadar #function("6000r1~MNM;" [] cadar) caar #function("6000r1~MM;" [] caar) caadr #function("6000r1~NMM;" [] caadr) caaar #function("6000r1~MMM;" [] caaar) builtin->instruction #function("9000r1e0\x80~^43;" [get] [#table(#.number? :number? #.cons :cons #.fixnum? :fixnum? #.equal? :equal? #.eq? :eq? #.symbol? :symbol? #.div0 :div0 #.builtin? :builtin? #.aset! :aset! #.- :- #.boolean? :boolean? #.not :not #.apply :apply #.atom? :atom? #.set-cdr! :set-cdr! #./ :/ #.function? :function? #.vector :vector #.list :list #.bound? :bound? #.< :< #.* :* #.cdr :cdr #.null? :null? #.+ :+ #.eqv? :eqv? #.compare :compare #.aref :aref #.set-car! :set-car! #.car :car #.pair? :pair? #.= := #.vector? :vector?) ()]) bq-process #function("8000r1c0^u42;" [#function(":000vc0m02e1\x80316H0\x80H6A0c2e3e4\x803131u42;\x80;\x80?680c5\x80L2;\x80Mc6<6@0e3e3e7\x80313141;\x80Mc8<680e7\x8041;e9~\x8032@6D0c:e;\x8031e\x80_u43;" [#function("7000r1~F16B02~Mc0<17802~Mc1<17702~c2<;" [*comma-at* *comma-dot* *comma*] splice-form?) self-evaluating? #function("8000v~Mc0<680e1~NK;e2e1~L3;" [list vector apply]) bq-process vector->list quote backquote cadr *comma* any #function("9000v~A670c0\x7fK;e1c2\x7fKe3~31L142;" [list nconc list* bq-process]) lastcdr map bq-bracket1 #function("<000v^~F16902~Mc0<@6E02e1~M31\x7fKm12~Nm05\x0f/2c2~F6A0e3\x7fe4~31L1325K0~A6:0e5\x7f315>0e3\x7fe6~31L132u42;" [*comma* bq-bracket #function("7000v~NA650~M;c0~K;" [nconc]) nreconc cadr reverse! bq-process])])] bq-process) bq-bracket1 #function("7000r1~F16802~Mc0<680e1~41;e2~41;" [*comma* cadr bq-process] bq-bracket1) bq-bracket #function("8000r1~?6<0e0e1~31L2;~Mc2<6<0e0e3~31L2;~Mc4<6<0c5e3~31L2;~Mc6<680e3~41;e0e1~31L2;" [list bq-process *comma* cadr *comma-at* copy-list *comma-dot*] bq-bracket) bcode:nconst #function("7000r1~b2[;" [] bcode:nconst) bcode:indexfor #function("9000r2c0e1~31e2~31u43;" [#function(":000ve0~\x8132690e1~\x8142;e2~\x81\x7f332\x7f\x80b2\x7fay\\2;" [has? get put!]) bcode:ctable bcode:nconst] bcode:indexfor) bcode:ctable #function("7000r1~a[;" [] bcode:ctable) bcode:code #function("7000r1~`[;" [] bcode:code) bcode:cdepth #function(":000r2~b3e0~b3[\x7f32\\;" [min] bcode:cdepth) assv #function("8000r2\x7f?640^;e0\x7f31~=650\x7fM;e1~\x7fN42;" [caar assv] assv) assoc #function("8000r2\x7f?640^;e0\x7f31~>650\x7fM;e1~\x7fN42;" [caar assoc] assoc) array? #function("8000r1~H17=02c0e1~31u42;" [#function("7000v~F16802~Mc0<;" [array]) typeof] array?) argc-error #function("=000r2e0e1c2~c3\x7f\x7faW670c4540c53541;" [error string "compile error: " " expects " " argument." " arguments."] argc-error) arg-counts #table(:not 1 :set-cdr! 2 :cons 2 :number? 1 :equal? 2 :cdr 1 :vector? 1 :eqv? 2 := 2 :div0 2 :atom? 1 :aref 2 :compare 2 :< 2 :null? 1 :eq? 2 :car 1 :set-car! 2 :builtin? 1 :aset! 3 :bound? 1 :boolean? 1 :pair? 1 :symbol? 1 :fixnum? 1) any #function("8000r2\x7fF16D02~\x7fM3117:02e0~\x7fN42;" [any] any) abs #function("7000r1~`X650~{;~;" [] abs) __start #function("8000r1e0302~NF6C0~Nk12e2e3~31315A0~k12e4e5312e6302e7`41;" [__init_globals *argv* __script cadr princ *banner* repl exit] __start) __script #function("7000r1c0qc1t;" [#function("7000r0e0\x8041;" [load]) #function("7000r1e0~312e1a41;" [print-exception exit])] __script) __init_globals #function("7000r0e0c1<17B02e0c2<17802e0c3<6>0c4k52c6k75;0c8k52c9k72e:k;2ek?;" [*os-name* win32 win64 windows "\\" *directory-separator* "\r\n" *linefeed* "/" "\n" *stdout* *output-stream* *stdin* *input-stream* *stderr* *error-stream*] __init_globals) MAX_ARGS 127 Instructions #table(:sub2 74 :nop 0 :set-cdr! 32 :/ 37 :setc 63 :tapply 72 :lvargc 77 :cons 27 :loada1 79 dummy_nil 84 :equal? 14 :cdr 30 :call 3 :eqv? 13 := 39 :setg.l 60 :list 28 :atom? 15 :aref 43 :load0 48 :let 70 dummy_t 82 :argc 66 :< 40 :null? 17 :loadg 53 :load1 49 :car 29 :brt.l 10 :vargc 67 :loada 55 :set-car! 31 :setg 59 :aset! 44 :loadc01 81 :bound? 21 :pair? 22 :symbol? 19 :fixnum? 25 :loadi8 50 :not 16 :* 36 :neg 75 :pop 2 :largc 76 :loadnil 47 :brf 6 :vector 42 :- 35 :loadv 51 :loada.l 56 :seta.l 62 :closure 65 :loadc00 80 :number? 20 dummy_f 83 :trycatch 68 :add2 73 :loadv.l 52 :vector? 24 :brf.l 9 :seta 61 :apply 33 :dup 1 :div0 38 :setc.l 64 :copyenv 69 :for 71 :loada0 78 :loadc 57 :loadc.l 58 :compare 41 :eq? 12 :function? 26 :+ 34 :jmp 5 :loadt 45 :brt 7 :builtin? 23 :loadg.l 54 :tcall 4 :ret 11 :boolean? 18 :loadf 46 :jmp.l 8) >= #function("7000r2\x7f~X17602~\x7fW;" [] >=) > #function("7000r2\x7f~X;" [] >) <= #function("7000r2~\x7fX17602~\x7fW;" [] <=) 1arg-lambda? #function("8000r1~F16Z02~Mc0<16P02~NF16H02e1~31F16=02e2e1~31a42;" [lambda cadr length=] 1arg-lambda?) 1- #function("7000r1~az;" [] 1-) 1+ #function("7000r1~ay;" [] 1+) /= #function("7000r2~\x7fW@;" [] /=) *whitespace* "\t\n\v\f\r \u0085  ᠎           \u2028\u2029   " *syntax-environment* #table(assert #function("<000r1c0~]c1c2c3~L2L2L2L4;" [if raise quote assert-failed]) letrec #function("?000s1e0e0c1L1e2e3~32L1e2c4~32e5\x7f3134L1e2c6~3242;" [nconc lambda map car #function("9000r1e0c1L1e2~3142;" [nconc set! copy-list]) copy-list #function("6000r1^;" [])]) backquote #function("7000r1e0~41;" [bq-process]) label #function(":000r2c0~L1c1~\x7fL3L3^L2;" [lambda set!]) do #function("A000s2c0e130\x7fMe2e3~32e2e4~32e2c5~32u46;" [#function("B000vc0~c1g2c2\x7fe3c4L1e5\x81N3132e3c4L1e5i0231e3~L1g432L133L4L3L2L1e3~L1g332L3;" [letrec lambda if nconc begin copy-list]) gensym map car cadr #function("7000r1e0~31F680e1~41;~M;" [cddr caddr])]) when #function("<000s1c0~c1\x7fK^L4;" [if begin]) unwind-protect #function("9000r2c0e130e130u43;" [#function("@000vc0\x7fc1_\x81L3L2L1c2c3\x80c1~L1c4\x7fL1c5~L2L3L3L3\x7fL1L3L3;" [let lambda prog1 trycatch begin raise]) gensym]) dotimes #function("<000s1c0~Me1~31u43;" [#function("=000vc0`c1\x7faL3e2c3L1~L1L1e4\x813133L4;" [for - nconc lambda copy-list]) cadr]) define-macro #function("?000s1c0c1~ML2e2c3L1~NL1e4\x7f3133L3;" [set-syntax! quote nconc lambda copy-list]) receive #function("@000s2c0c1_\x7fL3e2c1L1~L1e3g23133L3;" [call-with-values lambda nconc copy-list]) unless #function("=000s1c0~^c1\x7fKL4;" [if begin]) let #function(";000s1c0^u42;" [#function("<000v\x80C6D0\x80m02\x81Mo002\x81No01530^2c0e1c2L1e3c4\x8032L1e5\x813133e3c6\x8032u43;" [#function("8000v\x806;0c0\x80~L3530~\x7fK;" [label]) nconc lambda map #function("6000r1~F650~M;~;" []) copy-list #function("7000r1~F680e0~41;^;" [cadr])])]) cond #function(":000s0c0^u42;" [#function("7000vc0qm02~\x8041;" [#function("8000r1~?640^;c0~Mu42;" [#function(":000v~Mc0<17702~M]<6A0~NA650~M;c1~NK;~NA6@0c2~Mi10\x80N31L3;c3~Mc1~NKi10\x80N31L4;" [else begin or if])] cond-clauses->if)])]) throw #function(":000r2c0c1c2c3L2~\x7fL4L2;" [raise list quote thrown-value]) time #function("8000r1c0e130u42;" [#function(">000vc0~c1L1L2L1c2\x80c3c4c5c1L1~L3c6L4L3L3;" [let time.now prog1 princ "Elapsed time: " - " seconds\n"]) gensym]) let* #function("A000s1~?6E0e0c1L1_L1e2\x7f3133L1;e0c1L1e3~31L1L1e2~NF6H0e0c4L1~NL1e2\x7f3133L1530\x7f3133e5~31L2;" [nconc lambda copy-list caar let* cadar]) case #function(";000s1c0^u42;" [#function("8000vc0m02c1e230u42;" [#function("9000r2\x7fc0<650c0;\x7fA640^;\x7fC6=0c1~e2\x7f31L3;\x7f?6=0c3~e2\x7f31L3;\x7fNA6>0c3~e2\x7fM31L3;e4e5\x7f326=0c6~c7\x7fL2L3;c8~c7\x7fL2L3;" [else eq? quote-value eqv? every symbol? memq quote memv] vals->cond) #function("<000vc0~i10L2L1e1c2L1e3c4qi113232L3;" [let nconc cond map #function("8000r1i10\x80~M32~NK;" [])]) gensym])]) catch #function("8000r2c0e130u42;" [#function("@000vc0\x81c1~L1c2c3c4~L2c5c6~L2c7c8L2L3c5c9~L2\x80L3L4c:~L2c;~L2L4L3L3;" [trycatch lambda if and pair? eq car quote thrown-value cadr caddr raise]) gensym])) *banner* "; _\n; |_ _ _ |_ _ | . _ _\n; | (-||||_(_)|__|_)|_)\n;-------------------|----------------------------------------------------------\n\n") +(zero? #function("7000r1~`W;" [] zero?) vector.map #function("8000r2c0e1\x7f31u42;" [#function("8000vc0e1~31u42;" [#function(":000v`\x80azc0qw2~;" [#function(":000r1\x80~i20i21~[31\\;" [])]) vector.alloc]) length] vector.map) vector->list #function("9000r1c0e1~31_u43;" [#function(":000va~c0qw2\x7f;" [#function("8000r1i10\x80~z[\x81Ko01;" [])]) length] vector->list) values #function("9000s0~F16602~NA650~M;\x80~K;" [] #5=[(*values*) ()]) untrace #function("8000r1c0e1~31u42;" [#function("9000ve0~316@0e1\x80e2~31b2[42;^;" [traced? set-top-level-value! function:vals]) top-level-value] untrace) traced? #function("8000r1e0~31e0\x8031>;" [function:code] [#function(":000s0e0c1~K312c2~x2;" [println x #.apply]) ()]) trace #function("8000r1c0e1~31u322c2;" [#function("8000vc0e130u42;" [#function("?000ve0\x8031@6a0e1i10e2c3~c4c5c6c7i10L2~L3L2c8c7\x80L2~L3L3L33142;^;" [traced? set-top-level-value! eval lambda begin println cons quote apply]) gensym]) top-level-value ok] trace) to-proper #function("8000r1~A640~;~?660~L1;~Me0~N31K;" [to-proper] to-proper) table.values #function("9000r1e0c1_~43;" [table.foldl #function("7000r3\x7fg2K;" [])] table.values) table.pairs #function("9000r1e0c1_~43;" [table.foldl #function("7000r3~\x7fKg2K;" [])] table.pairs) table.keys #function("9000r1e0c1_~43;" [table.foldl #function("7000r3~g2K;" [])] table.keys) table.invert #function("8000r1c0e130u42;" [#function("9000ve0c1q_\x80332~;" [table.foldl #function("9000r3e0\x80\x7f~43;" [put!])]) table] table.invert) table.foreach #function("9000r2e0c1q_\x7f43;" [table.foldl #function("8000r3\x80~\x7f322];" [])] table.foreach) table.clone #function("8000r1c0e130u42;" [#function("9000ve0c1q_\x80332~;" [table.foldl #function("9000r3e0\x80~\x7f43;" [put!])]) table] table.clone) symbol-syntax #function("9000r1e0e1~^43;" [get *syntax-environment*] symbol-syntax) string.trim #function("9000r3c0^^u43;" [#function("8000vc0qm02c1qm12c2e3\x8031u42;" [#function(";000r4g2g3X16?02e0\x7fe1~g232326A0\x80~\x7fe2~g232g344;g2;" [string.find string.char string.inc] trim-start) #function("<000r3e0g2`3216D02e1\x7fe2~e3~g23232326?0\x81~\x7fe3~g23243;g2;" [> string.find string.char string.dec] trim-end) #function("<000ve0i10\x80i10i11`~34\x81i10i12~3343;" [string.sub]) length])] string.trim) string.tail #function(";000r2e0~e1~`\x7f3342;" [string.sub string.inc] string.tail) string.rpad #function("<000r3e0~e1g2\x7fe2~31z3242;" [string string.rep string.count] string.rpad) string.rep #function(";000r2\x7fb4X6`0e0\x7f`32650c1;\x7faW680e2~41;\x7fb2W690e2~~42;e2~~~43;e3\x7f316@0e2~e4~\x7faz3242;e4e2~~32\x7fb2U242;" [<= "" string odd? string.rep] string.rep) string.map #function("9000r2c0e130e2\x7f31u43;" [#function("8000vc0`u322e1~41;" [#function(";000v^~\x81X6S02e0\x80i10e1i11~3231322e2i11~32m05\x0b/;" [io.putc string.char string.inc]) io.tostring!]) buffer length] string.map) string.lpad #function(";000r3e0e1g2\x7fe2~31z32~42;" [string string.rep string.count] string.lpad) string.join #function("8000r2~A650c0;c1e230u42;" ["" #function("8000ve0~\x80M322e1c2q\x80N322e3~41;" [io.write for-each #function("8000r1e0\x80i11322e0\x80~42;" [io.write]) io.tostring!]) buffer] string.join) simple-sort #function("8000r1~A17602~NA640~;c0~Mu42;" [#function("9000vc0e1c2q\x80N32u42;" [#function(":000ve0e1~M31\x80L1e1~N3143;" [nconc simple-sort]) separate #function("7000r1~\x80X;" [])])] simple-sort) set-syntax! #function("9000r2e0e1~\x7f43;" [put! *syntax-environment*] set-syntax!) separate #function(":000r2\x80~\x7f__44;" [] #0=[#function(";000r4\x7fA680g2g3K;~\x7fM316@0\x80~\x7fN\x7fMg2Kg344;\x80~\x7fNg2\x7fMg3K44;" [] #0#) ()]) self-evaluating? #function("8000r1~?16602~C@17K02e0~3116A02~C16:02~e1~31<;" [constant? top-level-value] self-evaluating?) reverse! #function("8000r1c0_u42;" [#function("9000v^\x80F6C02\x80N\x80~\x80m02P2o005\x1c/2~;" [])] reverse!) reverse #function("9000r1e0c1_~43;" [foldl #.cons] reverse) revappend #function("8000r2e0e1~31\x7f42;" [nconc reverse] revappend) repl #function("9000r0c0^^u43;" [#function("6000vc0m02c1qm12\x7f302e240;" [#function("8000r0e0c1312e2e3312c4c5c6tu42;" [princ "> " io.flush *output-stream* #function("8000ve0e131@16=02c2e3~31u42;" [io.eof? *input-stream* #function("7000ve0~312~k12];" [print that]) load-process]) #function("6000r0e040;" [read]) #function("7000r1e0e1312e2~41;" [io.discardbuffer *input-stream* raise])] prompt) #function("7000r0c0qc1t6;0e2302\x8140;^;" [#function("7000r0\x803016702e040;" [newline]) #function("7000r1e0~312e1e230312];" [print-exception print-stack-trace stacktrace]) newline] reploop) newline])] repl) remainder #1=#function("8000r2~~\x7fV\x7fT2z;" [] mod0) ref-int32-LE #function("=000r2e0e1~\x7f`y[`32e1~\x7fay[b832e1~\x7fb2y[b@32e1~\x7fb3y[bH32R441;" [int32 ash] ref-int32-LE) ref-int16-LE #function(";000r2e0e1~\x7f`y[`32e1~\x7fay[b832y41;" [int16 ash] ref-int16-LE) random #function("8000r1e0~316<0e1e230~42;e330~T2;" [integer? mod rand rand.double] random) quotient #.div0 quote-value #function("7000r1e0~31640~;c1~L2;" [self-evaluating? quote] quote-value) println #function("9000s0e0~Q2e1302;" [print newline] println) printable? #function("7000r1e0~31@;" [iostream?] printable?) print-to-string #function("8000r1c0e130u42;" [#function("8000ve0~\x80322e1~41;" [io.print io.tostring!]) buffer] print-to-string) print-stack-trace #function("9000r1c0^^u43;" [#function("<000vc0qm02c1qm12c2e3e4\x80b53231e5e6e7c8e9303232`u44;" [#function("8000r3c0e1~31g2Ku42;" [#function("9000ve0\x8031e0\x8131<6>0e1c2c3~L341;c4e5\x8031u42;" [function:code raise thrown-value ffound #function(":000v`e0e1~3131c2qw;" [1- length #function("9000r1e0\x80~[316A0i30\x80~[i21i1043;^;" [closure?])]) function:vals]) function:name] find-in-f) #function("8000r2c0c1qc2tu42;" [#function(";000v~6H0e0e1e2e3e4~3132c53241;c6;" [symbol string.join map string reverse! "/" lambda]) #function("8000r0e0c1q\x81322^;" [for-each #function("9000r1i10~\x80_43;" [])]) #function("7000r1~F16E02~Mc0<16;02e1~31c2<680e3~41;e4~41;" [thrown-value cadr ffound caddr raise])] fn-name) #function("8000ve0c1q~42;" [for-each #function("9000r1e0c1i02c2332e3i11~`[\x8132e4~31NK312e5302i02ayo02;" [princ "#" " " print vector->list newline])]) reverse! list-tail filter closure? map #function("7000r1~E16802e0~41;" [top-level-value]) environment])] print-stack-trace) print-exception #function("9000r1c0^^u43;" [#function("<000vc0m02c1m12\x80F16D02\x80Mc2<16:02e3\x80b4326Q0~c4e5\x8031c6e7\x8031c8352\x7fe9\x8031315\xd20\x80F16@02\x80Mc:<16602\x80NF6A0~c;e5\x8031c<335\xac0\x80F16802\x80Mc=<6@0~c>312~\x80NQ25\x8f0\x80F16802\x80Mc?<6I0e@e7\x8031312~cAe5\x8031325i0eB\x803116:02e3\x80b2326K0\x7f\x80M312~cC312cDe5\x8031u325<0~cE312\x7f\x80312~eF41;" [#function(":000s0e0e1~x3;" [io.princ *error-stream*] eprinc) #function(":000s0e0e1~x3;" [io.print *error-stream*] eprint) type-error length= "type-error: " cadr ": expected " caddr ", got " cadddr unbound-error "unbound-error: eval: variable " " has no value" error "error: " load-error print-exception "in file " list? ": " #function("8000ve0~3117502~C660\x80530\x81~41;" [string?]) "*** Unhandled exception: " *linefeed*])] print-exception) print #function(":000s0e0e1~x3;" [io.print *output-stream*] print) princ #function(":000s0e0e1~x3;" [io.princ *output-stream*] princ) positive? #function("8000r1e0~`42;" [>] positive?) odd? #function("7000r1e0~31@;" [even?] odd?) nreconc #function("8000r2e0e1~31\x7f42;" [nconc reverse!] nreconc) nnn #function("8000r1e0c1~42;" [count #function("6000r1~A@;" [])] nnn) newline #function("7000r0e0e1312];" [princ *linefeed*] newline) nestlist #function(";000r3e0g2`32640_;\x7fe1~~\x7f31g2az33K;" [<= nestlist] nestlist) negative? #function("7000r1~`X;" [] negative?) mod0 #1# mod #function("9000r2~e0~\x7f32\x7fT2z;" [div] mod) min #function("<000s1\x7fA640~;e0c1~\x7f43;" [foldl #function("7000r2~\x7fX640~;\x7f;" [])] min) memv #function("8000r2\x7f?640^;\x7fM~=640\x7f;e0~\x7fN42;" [memv] memv) member #function("8000r2\x7f?640^;\x7fM~>640\x7f;e0~\x7fN42;" [member] member) max #function("<000s1\x7fA640~;e0c1~\x7f43;" [foldl #function("7000r2~\x7fX640\x7f;~;" [])] max) mark-label #function("9000r2e0~c1\x7f43;" [emit :label] mark-label) map-int #function("9000r2e0\x7f`32640_;c1~`31_K_u43;" [<= #function(":000v~m12a\x81azc0qw2~;" [#function("8000r1\x81i10~31_KP2\x81No01;" [])])] map-int) map! #function("9000r2\x7f^\x7fF6B02\x7f~\x7fM31O2\x7fNm15\x1d/2;" [] map!) map #function("=000s2c0^^u43;" [#function("9000vc0m02c1qm12i02A6;0~\x80\x81_L143;\x7f\x80\x81i02K42;" [#function("9000r3g2^\x7fF6H02g2~\x7fM31_KPNm22\x7fNm15\x17/2N;" [] map1) #function("<000r2\x7fMA640_;~\x80c0\x7f_L133Q2\x81~\x80c1\x7f_L13332K;" [#.car #.cdr] mapn)])] map) make-system-image #function(";000r1c0e1~c2c3c434c5e6u44;" [#function("8000v^k02c1c2qu42;" [*print-pretty* #function("7000vc0qc1qt~302;" [#function(":000r0c0e1c2qe3e4303132u42;" [#function(">000ve0i10e1e2c3~e2e4~3233Q2322e5i10e642;" [io.print nconc map #.list top-level-value io.write *linefeed*]) filter #function("9000r1~E16w02e0~31@16l02e1~31G@17C02e2~31e2e1~3131>@16K02e3~i1132@16=02e4e1~3131@;" [constant? top-level-value string memq iostream?]) simple-sort environment]) #function("7000r1\x80302e0~41;" [raise])]) #function("7000r0e0\x80312i02k1;" [io.close *print-pretty*])]) file :write :create :truncate (*linefeed* *directory-separator* *argv* that *print-pretty* *print-width* *print-readably*) *print-pretty*] make-system-image) make-nested-arglist #function(";000r2e0e1c2e3~\x7f3232K;" [nconc map #function("7000r1c0~K;" [#.list]) list-partition] make-nested-arglist) make-label #function("6000r1e040;" [gensym] make-label) make-code-emitter #function("9000r0_e030`c1Z4;" [table +Inf] make-code-emitter) macroexpand-1 #function("8000r1~?640~;c0e1~31u42;" [#function("7000v~680~\x80Nx2;\x80;" []) macrocall?] macroexpand-1) macroexpand #function("8000r1c0^u42;" [#function("8000vc0qm02~\x80_42;" [#function("9000r2~?640~;c0e1~M\x7f32u42;" [#function("9000v~6F0i10e0~31\x80NQ2e1~3142;c2e3\x8031u42;" [cadr caddr #function("=000v~6B0i20~i10NQ2i1142;i10Mc0<660i10;i10Mc1<6Y0e2c1L1e3i1031L1e4c5qe6i103132e7i103144;i10Mc8<6R0e2c8L1e3i1031L1e4c9qe6i10313243;i10Mc:<6W0c;e3i1031e2c1L1_L1e reverse! >=] list-part-) <= error "list-partition: invalid count" reverse!])] list-partition) list-head #function(":000r2e0\x7f`32640_;~Me1~N\x7faz32K;" [<= list-head] list-head) list->vector #function("7000r1c0~x2;" [#.vector] list->vector) length> #function("9000r2\x7f`X640~;\x7f`W6;0~F16402~;~?660\x7f`X;e0~N\x7faz42;" [length>] length>) length= #function("9000r2\x7f`X640^;\x7f`W650~?;~?660\x7f`W;e0~N\x7faz42;" [length=] length=) lastcdr #function("7000r1~?640~;e0~31N;" [last-pair] lastcdr) last-pair #function("7000r1~N?640~;e0~N41;" [last-pair] last-pair) iota #function("8000r1e0e1~42;" [map-int identity] iota) io.readline #function("8000r1e0~c142;" [io.readuntil #\x000a] io.readline) index-of #function(":000r3\x7fA640^;~\x7fM<650g2;e0~\x7fNg2ay43;" [index-of] index-of) in-env? #function("8000r2e0c1q\x7f42;" [any #function("8000r1e0\x80~42;" [memq])] in-env?) identity #function("6000r1~;" [] identity) hex5 #function("9000r1e0e1~b@32b5c243;" [string.lpad number->string #\0] hex5) get-defined-vars #function("8000r1e0\x80~3141;" [delete-duplicates] #2=[#function("9000r1~?640_;~Mc0<16602~NF6m0e1~31C16:02e1~31L117V02e1~31F16E02e2~31C16:02e2~31L117402_;~Mc3<6>0e4e5\x80~N32x2;_;" [define cadr caadr begin append map] #2#) ()]) for-each #function("8000r2\x7fF6@0~\x7fM312e0~\x7fN42;];" [for-each] for-each) foldr #function(";000r3g2A640\x7f;~g2Me0~\x7fg2N3342;" [foldr] foldr) foldl #function(":000r3g2A640\x7f;e0~~g2M\x7f32g2N43;" [foldl] foldl) fits-i8 #function("8000r1~I16F02e0~b\xb03216:02e1~b\xaf42;" [>= <=] fits-i8) filter #function("9000r2\x80~\x7f_43;" [] #3=[#function(":000r3\x7fA650g2;~\x7fM316>0\x80~\x7fN\x7fMg2K43;\x80~\x7fNg243;" [] #3#) ()]) expand-define #function("<000r2~C6:0c0~\x7fML3;c0~Me1c2L1~NL1e3\x7f31~M34L3;" [set! nconc lambda copy-list] expand-define) expand #function("7000r1e0~41;" [macroexpand] expand) every #function("8000r2\x7f?17D02~\x7fM3116:02e0~\x7fN42;" [every] every) even? #function("8000r1e0~a32`W;" [logand] even?) eval #function("8000r1e0e1~313140;" [compile-thunk expand] eval) error #function(":000s0e0c1~K41;" [raise error] error) encode-byte-code #function("8000r1c0e1~31u42;" [#function("8000vc0e1~31u42;" [#function(";000vc0e1e2~31b3e2~31b2VT2yc332u42;" [#function(">000vc0e1\x8031`e230e230e330^^u48;" [#function(">000ve0g4c1322^\x7f~X6\xe402i10\x7f[m52g5c2<6O0e3g2i10\x7fay[e4g431332\x7fb2ym15\xb30e0g4e5e6e7\x806<0c8g5u32540g53231322\x7faym12\x7f~X6:0i10\x7f[530^m62e9g5c:326^0e3g3e4g431g6332e0g4\x80670e;540e<`31322\x7faym15C0g6D6<0c=g5u32530^5z/2e>c?qg3322e@g441;" [io.write #int32(0) :label put! sizeof byte get Instructions #function("7000v~c0<650c1;~c2<650c3;~c4<650c5;i05;" [:jmp :jmp.l :brt :brt.l :brf :brf.l]) memq (:jmp :brf :brt) int32 int16 #function(":000ve0~c1326H0e2i04e3i0631322\x81ayo01;e0~c4326`0e2i04e5i0631322\x81ayo012e2i04e5i20\x81[31322\x81ayo01;e0~c6326`0e2i04e3i0631322\x81ayo012e2i04e3i20\x81[31322\x81ayo01;e2i04e5i0631322\x81ayo01;" [memq (:loadv.l :loadg.l :setg.l :loada.l :seta.l :largc :lvargc) io.write int32 (:loadc :setc) uint8 (:loadc.l :setc.l)]) table.foreach #function("<000r2e0i04~322e1i04i10670e2540e3e4i02\x7f32~z3142;" [io.seek io.write int32 int16 get]) io.tostring!]) length table buffer]) >= length 65536]) list->vector]) reverse!] encode-byte-code) emit #function("G000s2g2A6=0~`\x7f~`[K\\5\xdb0e0\x7fc1326A0e2~g2M32L1m2530^2c3e4\x7fc532u322c6e4\x7fc732u322\x7fc8<6\\0g2c9>6=0c:m12_m25F0g2c;>6=0c>6=0c?m12_m25F0g2c@>6=0cAm12_m2530^530^2~`eB\x7fg2K~`[32\\2~;" [memq (:loadv :loadg :setg) bcode:indexfor #function("8000v~16=02e0i02Mc1326;0e2~31o01;^;" [> 255 cadr]) assq ((:loadv :loadv.l) (:loadg :loadg.l) (:setg :setg.l) (:loada :loada.l) (:seta :seta.l)) #function("8000v~16O02e0i02Mc13217@02e0e2i0231c1326;0e2~31o01;^;" [> 255 cadr]) ((:loadc :loadc.l) (:setc :setc.l)) :loada (0) :loada0 (1) :loada1 :loadc (0 0) :loadc00 (0 1) :loadc01 nreconc] emit) div #function("8000r2~\x7fV~`X16C02\x7f`X16402a17502b/17402`y;" [] div) display #function("7000r1e0~312];" [princ] display) disassemble #function("=000s1\x7fA6C0e0~`322e1302];530^2c2\x7fMe3~31e4~31u44;" [disassemble newline #function("8000vc0^u42;" [#function(":000vc0qm02`\x80azc1w2e2c3e4\x81`32c5332c6b4e7\x8131u43;" [#function("9000r1~J16602~G@6D0e0c1312e2~i10ay42;e3~41;" [princ "\n" disassemble print] print-val) #function("7000r1e0c141;" [princ "\t"]) princ "maxstack " ref-int32-LE "\n" #function(":000v^~\x7fX6E02c0e1c2q^e333u325\x19/;" [#function("<000ve0\x80b432690e130530^2`i20azc2w2e3e4\x80b4z31c5e6e7~31a32c8342\x80ayo002c9~u42;" [> newline #function("7000r1e0c141;" [princ "\t"]) princ hex5 ": " string.tail string "\t" #function("=000ve0~c1326P0i20i32e2i31i1032[312i10b4yo10;e0~c3326L0i20i32i31i10[[312i10ayo10;e0~c4326K0e5e6i31i10[31312i10ayo10;e0~c7326O0e5e6e2i31i103231312i10b4yo10;e0~c8326f0e5e6i31i10[31c9322i10ayo102e5e6i31i10[31312i10ayo10;e0~c:326n0e5e6e2i31i103231c9322i10b4yo102e5e6e2i31i103231312i10b4yo10;e0~c;326X0e5ci31i1032R331322i10b2yo10;e0~c?326X0e5cstring (:loada.l :seta.l :largc :lvargc) (:loadc :setc) " " (:loadc.l :setc.l) (:jmp :brf :brt) "@" hex5 ref-int16-LE (:jmp.l :brf.l :brt.l)])]) table.foldl #function("8000r3g217@02\x7fi21\x80[<16402~;" []) Instructions]) length])]) function:code function:vals] disassemble) delete-duplicates #function("9000r1~?640~;c0~M~Nu43;" [#function("8000ve0~\x7f32680e1\x7f41;~e1\x7f31K;" [member delete-duplicates])] delete-duplicates) count #function("8000r2c0^u42;" [#function("9000vc0qm02~\x80\x81`43;" [#function(":000r3\x7fA650g2;\x80~\x7fN~\x7fM31690g2ay540g243;" [] count-)])] count) copy-tree #function("8000r1~?640~;e0~M31e0~N31K;" [copy-tree] copy-tree) const-to-idx-vec #function("9000r1c0e1e2~3131u42;" [#function("9000ve0c1qe2\x8031322~;" [table.foreach #function("8000r2\x80\x7f~\\;" []) bcode:ctable]) vector.alloc bcode:nconst] const-to-idx-vec) compile-while #function("9000r4c0e1~31e1~31u43;" [#function(":000ve0\x80\x81^^342e1\x80~322e0\x80\x81^i02342e2\x80c3\x7f332e2\x80c4322e0\x80\x81^i03342e2\x80c5~332e1\x80\x7f42;" [compile-in mark-label emit :brf :pop :jmp]) make-label] compile-while) compile-thunk #function(";000r1e0e1c2L1_L1~L1\x803441;" [compile nconc lambda] #4=[#:g549 ()]) compile-sym #function(";000r4c0e1g2\x7f`]34u42;" [#function("8000vc0~Mu42;" [#function(";000v~c0<6D0e1i10i13`[e2\x803143;~c3<6a0e1i10i13a[e2\x8031e4\x8031342e5i10e6i11N31ae2\x8031S342;e7i123116>02e8e9i1231316C0e1i10c:e9i123143;e1i10i13b2[i1243;" [arg emit cadr closed caddr bcode:cdepth nnn constant? printable? top-level-value :loadv])]) lookup-sym] compile-sym) compile-short-circuit #function(":000r6g3?6=0e0~\x7fg2g444;g3N?6>0e0~\x7fg2g3M44;c1e2~31u42;" [compile-in #function("<000ve0\x80\x81^i03M342e1\x80c2322e1\x80i05~332e1\x80c3322e4\x80\x81i02i03Ni04i05362e5\x80~42;" [compile-in emit :dup :pop compile-short-circuit mark-label]) make-label] compile-short-circuit) compile-prog1 #function(";000r3e0~\x7f^e1g231342e2g231F6H0e3~\x7f^e2g231342e4~c542;^;" [compile-in cadr cddr compile-begin emit :pop] compile-prog1) compile-or #function("<000r4e0~\x7fg2g3^c146;" [compile-short-circuit :brt] compile-or) compile-let #function("9000r4c0g3Mg3Nu43;" [#function(";000ve0\x7fe1e2~313132660^5=0e3e4c5~32312e6c7qc8q322c9e:\x80\x81\x7f33u42;" [length= length cadr error string "apply: incorrect number of arguments to " call-with-values #function("9000r0e0i11\x80]43;" [compile-f-]) #function("9000r2e0i10c1~332e2i10\x7f42;" [emit :loadv bcode:cdepth]) #function(";000ve0i10c1322e0i10i12670c2540c3a~y43;" [emit :copyenv :tcall :call]) compile-arglist])] compile-let) compile-in #function(":000r4g3C6=0e0~\x7fg3c144;g3?6\x9a0g3`<6:0e2~c342;g3a<6:0e2~c442;g3]<6:0e2~c542;g3^<6:0e2~c642;g3_<6:0e2~c742;e8g3316<0e2~c9g343;e2~c:g343;c;g3Mu42;" [compile-sym [:loada :loadc :loadg] emit :load0 :load1 :loadt :loadf :loadnil fits-i8 :loadi8 :loadv #function("=000v~c0<6A0e1\x80c2e3i033143;~c4<6?0e5\x80\x81i02i0344;~c6<6@0e7\x80\x81i02i03N44;~c8<6<0e9\x80\x81i0343;~c:<6=0e;c<6@0e?\x80\x81i02i03N44;~c@<6@0eA\x80\x81i02i03N44;~cB<6J0eC\x80\x81e3i0331c6eDi0331K44;~cE<6N0eF\x80\x81e3i0331eGi0331eHi033145;~cI<6I0eJ\x80\x81]e3i0331342e1\x80cK42;~cL<6Q0eJ\x80\x81^eGi0331342eM\x80\x81e3i0331cN44;~cO<6N0eJ\x80\x81i02ePe3i0331eDi03313244;~cQ<6v0eJ\x80\x81^c:_e3i0331L3342eReGi033131660^580eScT312eJ\x80\x81^eGi0331342e1\x80cU42;eV\x80\x81i02i0344;" [quote emit :loadv cadr if compile-if begin compile-begin prog1 compile-prog1 lambda call-with-values #function("8000r0e0i11i1342;" [compile-f-]) #function("9000r2e0i10c1~332e2i10\x7f322\x7fe3i1131X6<0e0i10c442;^;" [emit :loadv bcode:cdepth nnn :closure]) and compile-and or compile-or while compile-while cddr for compile-for caddr cadddr return compile-in :ret set! compile-sym [:seta :setc :setg] define expand-define trycatch 1arg-lambda? error "trycatch: second form must be a 1-argument lambda" :trycatch compile-app])] compile-in) compile-if #function("=000r4c0e1~31e1~31e2g331e3g331e4g331F6;0e5g331530^u46;" [#function(";000vg2]<6>0e0\x80\x81i02g344;g2^<6>0e0\x80\x81i02g444;e0\x80\x81^g2342e1\x80c2~332e0\x80\x81i02g3342i026<0e1\x80c3325:0e1\x80c4\x7f332e5\x80~322e0\x80\x81i02g4342e5\x80\x7f42;" [compile-in emit :brf :ret :jmp mark-label]) make-label cadr caddr cdddr cadddr] compile-if) compile-for #function(":000r5e0g4316X0e1~\x7f^g2342e1~\x7f^g3342e1~\x7f^g4342e2~c342;e4c541;" [1arg-lambda? compile-in emit :for error "for: third form must be a 1-argument lambda"] compile-for) compile-f- #function("<000s2c0^u42;" [#function(";000vc0qm02c1e230e3\x8131e4\x8131i10<670c5570e4\x8131u44;" [#function(":000r1c0e1~31F6N0e2~31F6=0c3e1~31K570e4~31530^u42;" [#function("8000vc0e1~31u42;" [#function(":000v~A640\x80;e0c1~\x80i4034e2c3~32K;" [list* lambda map #function("6000r1^;" [])]) get-defined-vars]) cddr cdddr begin caddr] lambda-body) #function("A000vi12A@6<0e0~c1325\x860e2\x7fc3326O0e0~e4\x7f31A670c5540c6e7\x7f31335_0e4\x7f31A6A0e0~c8e7\x7f31335G0e0~c9\x7f?660`570e7\x7f31332e:~e;\x7f31i10K]e4i1131i20<6<0ee?e@eA~3131eB~31g233~b3[42;" [emit :let length> 255 lastcdr :largc :lvargc length :argc :vargc compile-in to-proper caddr :ret values function encode-byte-code bcode:code const-to-idx-vec]) make-code-emitter cadr lastcdr lambda])] #4#) compile-f #function("<000s2e0c1qc242;" [call-with-values #function("9000r0e0\x80\x81i02x4;" [compile-f-]) #function("6000r2~;" [])] compile-f) compile-call #function("8000r4c0g3Mu42;" [#function("9000vc0~C16V02e1~\x8132@16J02~E16C02e2~3116902e3~31G6:0e3~31530~u42;" [#function(">000ve0i13Nc1326O0e2i10i11i12c3~e4i13Nc132L344;c5~G16802e6~31u42;" [length> 255 compile-in #.apply make-nested-arglist #function(";000v~@6A0e0i20i21^\x8034530^2c1e2i20i21i23N33u42;" [compile-in #function("=000v\x806H0e0i30i31i32i33i10\x80~47;e1i30i32670c2540c3~43;" [compile-builtin-call emit :tcall :call]) compile-arglist]) builtin->instruction]) in-env? constant? top-level-value])] compile-call) compile-builtin-call #function(":000r7c0e1e2g5^33u42;" [#function("9000v~16=02e0i03N~32@6=0e1i04~32530^2c2i05u42;" [length= argc-error #function(":000v~c0<6R0i16`W6<0e1i10c242;e1i10i15i1643;~c3<6e0i16`W6<0e1i10c442;i16b2W6<0e1i10c542;e1i10i15i1643;~c6<6v0i16`W6;0e7i14a42;i16aW6<0e1i10c842;i16b2W6<0e1i10c942;e1i10i15i1643;~c:<6R0i16`W6<0e1i10c;42;e1i10i15i1643;~c<<6Q0i16`W6;0e7i14a42;e1i10i15i1643;~c=<6T0i16`W6>0e1i10c>c?43;e1i10i15i1643;~c@<6]0i16b2X6<0e7i14b242;e1i10i12670cA540c@i1643;e1i10i1542;" [:list emit :loadnil :+ :load0 :add2 :- argc-error :neg :sub2 :* :load1 :/ :vector :loadv [] :apply :tapply])]) get arg-counts] compile-builtin-call) compile-begin #function(":000r4g3?6<0e0~\x7fg2^44;g3N?6>0e0~\x7fg2g3M44;e0~\x7f^g3M342e1~c2322e3~\x7fg2g3N44;" [compile-in emit :pop compile-begin] compile-begin) compile-arglist #function("8000r3e0c1qg2322e2g241;" [for-each #function(":000r1e0\x80\x81^~44;" [compile-in]) length] compile-arglist) compile-app #function("8000r4c0g3Mu42;" [#function(":000v~F16W02~Mc0<16M02e1e2~313116?02e3e2~31c432@6?0e5\x80\x81i02i0344;e6\x80\x81i02i0344;" [lambda list? cadr length> 255 compile-let compile-call])] compile-app) compile-and #function("<000r4e0~\x7fg2g3]c146;" [compile-short-circuit :brf] compile-and) compile #function("8000r1e0_~42;" [compile-f] compile) closure? #function("7000r1~J16602~G@;" [] closure?) char? #function("7000r1e0~31c1<;" [typeof wchar] char?) cddr #function("6000r1~NN;" [] cddr) cdddr #function("6000r1~NNN;" [] cdddr) cddar #function("6000r1~MNN;" [] cddar) cdar #function("6000r1~MN;" [] cdar) cdadr #function("6000r1~NMN;" [] cdadr) cdaar #function("6000r1~MMN;" [] cdaar) call-with-values #function("8000r2c0~30u42;" [#function("7000v~F16902i10~M<680\x81~Nx2;\x81~41;" [])] #5#) cadr #function("6000r1~NM;" [] cadr) caddr #function("6000r1~NNM;" [] caddr) cadddr #function("6000r1~NNNM;" [] cadddr) cadar #function("6000r1~MNM;" [] cadar) caar #function("6000r1~MM;" [] caar) caadr #function("6000r1~NMM;" [] caadr) caaar #function("6000r1~MMM;" [] caaar) builtin->instruction #function("9000r1e0\x80~^43;" [get] [#table(#.number? :number? #.cons :cons #.fixnum? :fixnum? #.equal? :equal? #.eq? :eq? #.symbol? :symbol? #.div0 :div0 #.builtin? :builtin? #.aset! :aset! #.- :- #.boolean? :boolean? #.not :not #.apply :apply #.atom? :atom? #.set-cdr! :set-cdr! #./ :/ #.function? :function? #.vector :vector #.list :list #.bound? :bound? #.< :< #.* :* #.cdr :cdr #.null? :null? #.+ :+ #.eqv? :eqv? #.compare :compare #.aref :aref #.set-car! :set-car! #.car :car #.pair? :pair? #.= := #.vector? :vector?) ()]) bq-process #function("9000r1c0^^u43;" [#function(":000vc0m02c1m12e2\x80316H0\x80H6A0c3e4e5\x803131u42;\x80;\x80?680c6\x80L2;\x80Mc7<6@0e4e4e8\x80313141;\x80Mc9<680e8\x8041;e:~\x8032@6C0c;e<\x8031e=\x7f\x8032u43;c>\x80_u43;" [#function("7000r1~F16B02~Mc0<17802~Mc1<17702~c2<;" [*comma-at* *comma-dot* *comma*] splice-form?) #function("7000r1~F16802~Mc0<680e1~41;e2~41;" [*comma* cadr bq-process] bq-bracket1) self-evaluating? #function("8000v~Mc0<680c1~NK;c2c1~L3;" [list #.vector #.apply]) bq-process vector->list quote backquote cadr *comma* any #function("9000v~A670c0\x7fK;e1c2\x7fKe3~31L142;" [list nconc list* bq-process]) lastcdr map #function("<000v^~F16902~Mc0<@6E02e1~M31\x7fKm12~Nm05\x0f/2c2~F6A0e3\x7fe4~31L1325K0~A6:0e5\x7f315>0e3\x7fe6~31L132u42;" [*comma* bq-bracket #function("7000v~NA650~M;c0~K;" [nconc]) nreconc cadr reverse! bq-process])])] bq-process) bq-bracket #function("8000r1~?6<0c0e1~31L2;~Mc2<6<0c0e3~31L2;~Mc4<6<0c5e3~31L2;~Mc6<680e3~41;c0e1~31L2;" [#.list bq-process *comma* cadr *comma-at* copy-list *comma-dot*] bq-bracket) bcode:nconst #function("7000r1~b2[;" [] bcode:nconst) bcode:indexfor #function("9000r2c0e1~31e2~31u43;" [#function(":000ve0~\x8132690e1~\x8142;e2~\x81\x7f332\x7f\x80b2\x7fay\\2;" [has? get put!]) bcode:ctable bcode:nconst] bcode:indexfor) bcode:ctable #function("7000r1~a[;" [] bcode:ctable) bcode:code #function("7000r1~`[;" [] bcode:code) bcode:cdepth #function(":000r2~b3e0~b3[\x7f32\\;" [min] bcode:cdepth) assv #function("8000r2\x7f?640^;e0\x7f31~=650\x7fM;e1~\x7fN42;" [caar assv] assv) assoc #function("8000r2\x7f?640^;e0\x7f31~>650\x7fM;e1~\x7fN42;" [caar assoc] assoc) array? #function("8000r1~H17=02c0e1~31u42;" [#function("7000v~F16802~Mc0<;" [array]) typeof] array?) argc-error #function("=000r2e0e1c2~c3\x7f\x7faW670c4540c53541;" [error string "compile error: " " expects " " argument." " arguments."] argc-error) arg-counts #table(:not 1 :set-cdr! 2 :cons 2 :number? 1 :equal? 2 :cdr 1 :vector? 1 :eqv? 2 := 2 :div0 2 :atom? 1 :aref 2 :compare 2 :< 2 :null? 1 :eq? 2 :car 1 :set-car! 2 :builtin? 1 :aset! 3 :bound? 1 :boolean? 1 :pair? 1 :symbol? 1 :fixnum? 1) any #function("8000r2\x7fF16D02~\x7fM3117:02e0~\x7fN42;" [any] any) abs #function("7000r1~`X650~{;~;" [] abs) __start #function("8000r1e0302~NF6C0~Nk12e2e3~31315A0~k12e4e5312e6302e7`41;" [__init_globals *argv* __script cadr princ *banner* repl exit] __start) __script #function("7000r1c0qc1t;" [#function("7000r0e0\x8041;" [load]) #function("7000r1e0~312e1a41;" [print-exception exit])] __script) __init_globals #function("7000r0c0c1<17B02c0c2<17802c0c3<6>0c4k52c6k75;0c8k52c9k72e:k;2ek?;" [linux win32 win64 windows "\\" *directory-separator* "\r\n" *linefeed* "/" "\n" *stdout* *output-stream* *stdin* *input-stream* *stderr* *error-stream*] __init_globals) Instructions #table(:sub2 74 :nop 0 :set-cdr! 32 :/ 37 :setc 63 :tapply 72 :lvargc 77 :cons 27 :loada1 79 dummy_nil 84 :equal? 14 :cdr 30 :call 3 :eqv? 13 := 39 :setg.l 60 :list 28 :atom? 15 :aref 43 :load0 48 :let 70 dummy_t 82 :argc 66 :< 40 :null? 17 :loadg 53 :load1 49 :car 29 :brt.l 10 :vargc 67 :loada 55 :set-car! 31 :setg 59 :aset! 44 :loadc01 81 :bound? 21 :pair? 22 :symbol? 19 :fixnum? 25 :loadi8 50 :not 16 :* 36 :neg 75 :pop 2 :largc 76 :loadnil 47 :brf 6 :vector 42 :- 35 :loadv 51 :loada.l 56 :seta.l 62 :closure 65 :loadc00 80 :number? 20 dummy_f 83 :trycatch 68 :add2 73 :loadv.l 52 :vector? 24 :brf.l 9 :seta 61 :apply 33 :dup 1 :div0 38 :setc.l 64 :copyenv 69 :for 71 :loada0 78 :loadc 57 :loadc.l 58 :compare 41 :eq? 12 :function? 26 :+ 34 :jmp 5 :loadt 45 :brt 7 :builtin? 23 :loadg.l 54 :tcall 4 :ret 11 :boolean? 18 :loadf 46 :jmp.l 8) >= #function("7000r2\x7f~X17602~\x7fW;" [] >=) > #function("7000r2\x7f~X;" [] >) <= #function("7000r2~\x7fX17602~\x7fW;" [] <=) 1arg-lambda? #function("8000r1~F16Z02~Mc0<16P02~NF16H02e1~31F16=02e2e1~31a42;" [lambda cadr length=] 1arg-lambda?) 1- #function("7000r1~az;" [] 1-) 1+ #function("7000r1~ay;" [] 1+) /= #function("7000r2~\x7fW@;" [] /=) *whitespace* "\t\n\v\f\r \u0085  ᠎           \u2028\u2029   " *syntax-environment* #table(assert #function("<000r1c0~]c1c2c3~L2L2L2L4;" [if raise quote assert-failed]) letrec #function("?000s1e0e0c1L1e2c3~32L1e2c4~32e5\x7f3134L1e2c6~3242;" [nconc lambda map #.car #function("9000r1e0c1L1e2~3142;" [nconc set! copy-list]) copy-list #function("6000r1^;" [])]) backquote #function("7000r1e0~41;" [bq-process]) label #function(":000r2c0~L1c1~\x7fL3L3^L2;" [lambda set!]) do #function("A000s2c0e130\x7fMe2c3~32e2e4~32e2c5~32u46;" [#function("B000vc0~c1g2c2\x7fe3c4L1e5\x81N3132e3c4L1e5i0231e3~L1g432L133L4L3L2L1e3~L1g332L3;" [letrec lambda if nconc begin copy-list]) gensym map #.car cadr #function("7000r1e0~31F680e1~41;~M;" [cddr caddr])]) when #function("<000s1c0~c1\x7fK^L4;" [if begin]) unwind-protect #function("9000r2c0e130e130u43;" [#function("@000vc0\x7fc1_\x81L3L2L1c2c3\x80c1~L1c4\x7fL1c5~L2L3L3L3\x7fL1L3L3;" [let lambda prog1 trycatch begin raise]) gensym]) dotimes #function("<000s1c0~Me1~31u43;" [#function("=000vc0`c1\x7faL3e2c3L1~L1L1e4\x813133L4;" [for - nconc lambda copy-list]) cadr]) define-macro #function("?000s1c0c1~ML2e2c3L1~NL1e4\x7f3133L3;" [set-syntax! quote nconc lambda copy-list]) receive #function("@000s2c0c1_\x7fL3e2c1L1~L1e3g23133L3;" [call-with-values lambda nconc copy-list]) unless #function("=000s1c0~^c1\x7fKL4;" [if begin]) let #function(";000s1c0^u42;" [#function("<000v\x80C6D0\x80m02\x81Mo002\x81No01530^2c0e1c2L1e3c4\x8032L1e5\x813133e3c6\x8032u43;" [#function("8000v\x806;0c0\x80~L3530~\x7fK;" [label]) nconc lambda map #function("6000r1~F650~M;~;" []) copy-list #function("7000r1~F680e0~41;^;" [cadr])])]) cond #function(":000s0c0^u42;" [#function("7000vc0qm02~\x8041;" [#function("8000r1~?640^;c0~Mu42;" [#function(":000v~Mc0<17702~M]<6A0~NA650~M;c1~NK;~NA6@0c2~Mi10\x80N31L3;c3~Mc1~NKi10\x80N31L4;" [else begin or if])] cond-clauses->if)])]) throw #function(":000r2c0c1c2c3L2~\x7fL4L2;" [raise list quote thrown-value]) time #function("8000r1c0e130u42;" [#function(">000vc0~c1L1L2L1c2\x80c3c4c5c1L1~L3c6L4L3L3;" [let time.now prog1 princ "Elapsed time: " - " seconds\n"]) gensym]) let* #function("A000s1~?6E0e0c1L1_L1e2\x7f3133L1;e0c1L1e3~31L1L1e2~NF6H0e0c4L1~NL1e2\x7f3133L1530\x7f3133e5~31L2;" [nconc lambda copy-list caar let* cadar]) case #function(";000s1c0^u42;" [#function("8000vc0m02c1e230u42;" [#function("9000r2\x7fc0<650c0;\x7fA640^;\x7fC6=0c1~e2\x7f31L3;\x7f?6=0c3~e2\x7f31L3;\x7fNA6>0c3~e2\x7fM31L3;e4c5\x7f326=0c6~c7\x7fL2L3;c8~c7\x7fL2L3;" [else eq? quote-value eqv? every #.symbol? memq quote memv] vals->cond) #function("<000vc0~i10L2L1e1c2L1e3c4qi113232L3;" [let nconc cond map #function("8000r1i10\x80~M32~NK;" [])]) gensym])]) catch #function("8000r2c0e130u42;" [#function("@000vc0\x81c1~L1c2c3c4~L2c5c6~L2c7c8L2L3c5c9~L2\x80L3L4c:~L2c;~L2L4L3L3;" [trycatch lambda if and pair? eq car quote thrown-value cadr caddr raise]) gensym])) *banner* "; _\n; |_ _ _ |_ _ | . _ _\n; | (-||||_(_)|__|_)|_)\n;-------------------|----------------------------------------------------------\n\n") diff --git a/femtolisp/flisp.c b/femtolisp/flisp.c index bca919b..e7f6bf7 100644 --- a/femtolisp/flisp.c +++ b/femtolisp/flisp.c @@ -578,12 +578,21 @@ void gc(int mustgrow) gc(0); } +static void grow_stack() +{ + size_t newsz = N_STACK + (N_STACK>>1); + value_t *ns = realloc(Stack, newsz*sizeof(value_t)); + if (ns == NULL) + lerror(MemoryError, "stack overflow"); + Stack = ns; + N_STACK = newsz; +} + // utils ---------------------------------------------------------------------- // apply function with n args on the stack static value_t _applyn(uint32_t n) { - assert(n <= MAX_ARGS+1); value_t f = Stack[SP-n-1]; uint32_t saveSP = SP; value_t v; @@ -607,10 +616,8 @@ value_t apply(value_t f, value_t l) PUSH(f); while (iscons(v)) { - if ((SP-n-1) == MAX_ARGS) { - PUSH(v); - break; - } + if (SP >= N_STACK) + grow_stack(); PUSH(car_(v)); v = cdr_(v); } @@ -622,12 +629,13 @@ value_t apply(value_t f, value_t l) value_t applyn(uint32_t n, value_t f, ...) { - assert(n <= MAX_ARGS); va_list ap; va_start(ap, f); size_t i; PUSH(f); + while (SP+n > N_STACK) + grow_stack(); for(i=0; i < n; i++) { value_t a = va_arg(ap, value_t); PUSH(a); @@ -644,6 +652,8 @@ value_t listn(size_t n, ...) uint32_t si = SP; size_t i; + while (SP+n > N_STACK) + grow_stack(); for(i=0; i < n; i++) { value_t a = va_arg(ap, value_t); PUSH(a); @@ -715,7 +725,7 @@ static value_t _list(value_t *args, uint32_t nargs, int star) c->cdr = tagptr(c+1, TAG_CONS); c++; } - if (star || nargs > MAX_ARGS) + if (star) (c-2)->cdr = (c-1)->car; else (c-1)->cdr = NIL; @@ -805,18 +815,8 @@ static value_t do_trycatch() #define DISPATCH goto dispatch #endif -static void grow_stack() -{ - size_t newsz = N_STACK + (N_STACK>>1); - value_t *ns = realloc(Stack, newsz*sizeof(value_t)); - if (ns == NULL) - lerror(MemoryError, "stack overflow"); - Stack = ns; - N_STACK = newsz; -} - /* - stack on entry: MAX_ARGS> + stack on entry: caller's responsibility: - put the stack in this state - provide arg count @@ -886,18 +886,10 @@ static value_t apply_cl(uint32_t nargs) NEXT_OP; OP(OP_VARGC) i = *ip++; + do_vargc: s = (fixnum_t)nargs - (fixnum_t)i; if (s > 0) { v = list(&Stack[bp+i], s); - if (nargs > MAX_ARGS) { - if (s == 1) { - v = car_(v); - } - else { - c = (cons_t*)curheap; - (c-2)->cdr = (c-1)->car; - } - } Stack[bp+i] = v; if (s > 1) { Stack[bp+i+1] = Stack[bp+nargs+0]; @@ -923,39 +915,17 @@ static value_t apply_cl(uint32_t nargs) nargs = i+1; NEXT_OP; OP(OP_LARGC) - OP(OP_LVARGC) - // move extra arguments from list to stack - i = GET_INT32(ip); ip+=4; - e = Stack[curr_frame-5]; // cloenv - n = Stack[curr_frame-4]; // prev curr_frame - POPN(5); - if (nargs > MAX_ARGS) { - v = POP(); // list of rest args - nargs--; - } - else v = NIL; - while (nargs < i) { - if (!iscons(v)) - lerror(ArgError, "apply: too few arguments"); - PUSH(car_(v)); - nargs++; - v = cdr_(v); - } - if (ip[-5] == OP_LVARGC) { - PUSH(v); - nargs++; - } - else { - if (iscons(v)) + n = GET_INT32(ip); ip+=4; + if (nargs != n) { + if (nargs > n) lerror(ArgError, "apply: too many arguments"); + else + lerror(ArgError, "apply: too few arguments"); } - PUSH(e); - PUSH(n); - PUSH(nargs); - SP++;//PUSH(0); - PUSH(0); - curr_frame = SP; NEXT_OP; + OP(OP_LVARGC) + i = GET_INT32(ip); ip+=4; + goto do_vargc; OP(OP_LET) // last arg is closure environment to use nargs--; @@ -1166,15 +1136,10 @@ static value_t apply_cl(uint32_t nargs) n = *ip++; apply_apply: v = POP(); // arglist - if (n > MAX_ARGS) { - v = apply_liststar(v, 1); - } n = SP-(n-2); // n-2 == # leading arguments not in the list while (iscons(v)) { - if (SP-n == MAX_ARGS) { - PUSH(v); - break; - } + if (SP >= N_STACK) + grow_stack(); PUSH(car_(v)); v = cdr_(v); } @@ -1187,7 +1152,6 @@ static value_t apply_cl(uint32_t nargs) apply_add: s = 0; i = SP-n; - if (n > MAX_ARGS) goto add_ovf; for (; i < SP; i++) { if (isfixnum(Stack[i])) { s += numval(Stack[i]); @@ -1265,13 +1229,11 @@ static value_t apply_cl(uint32_t nargs) apply_mul: accum = 1; i = SP-n; - if (n > MAX_ARGS) goto mul_ovf; for (; i < SP; i++) { if (isfixnum(Stack[i])) { accum *= numval(Stack[i]); } else { - mul_ovf: v = fl_mul_any(&Stack[i], SP-i, accum); break; } @@ -1343,23 +1305,10 @@ static value_t apply_cl(uint32_t nargs) OP(OP_VECTOR) n = *ip++; apply_vector: - if (n > MAX_ARGS) { - i = llength(Stack[SP-1])-1; - } - else i = 0; - v = alloc_vector(n+i, 0); + v = alloc_vector(n, 0); if (n) { memcpy(&vector_elt(v,0), &Stack[SP-n], n*sizeof(value_t)); - e = POP(); - POPN(n-1); - } - if (n > MAX_ARGS) { - i = n-1; - while (iscons(e)) { - vector_elt(v,i) = car_(e); - i++; - e = cdr_(e); - } + POPN(n); } PUSH(v); NEXT_OP; @@ -1684,7 +1633,6 @@ static uint32_t compute_maxstack(uint8_t *code, size_t len) break; case OP_TAPPLY: case OP_APPLY: - if (sp+MAX_ARGS+1 > maxsp) maxsp = sp+MAX_ARGS+1; n = *ip++; sp -= (n-1); break; @@ -1860,15 +1808,8 @@ value_t fl_append(value_t *args, u_int32_t nargs) fl_gc_handle(&lastcons); uint32_t i=0; while (1) { - if (i >= MAX_ARGS) { - lst = car_(args[MAX_ARGS]); - args[MAX_ARGS] = cdr_(args[MAX_ARGS]); - if (!iscons(args[MAX_ARGS])) break; - } - else { - lst = args[i++]; - if (i >= nargs) break; - } + lst = args[i++]; + if (i >= nargs) break; if (iscons(lst)) { lst = FL_COPYLIST(lst); if (first == NIL) @@ -1893,10 +1834,6 @@ value_t fl_liststar(value_t *args, u_int32_t nargs) { if (nargs == 1) return args[0]; else if (nargs == 0) argcount("list*", nargs, 1); - if (nargs > MAX_ARGS) { - args[MAX_ARGS] = apply_liststar(args[MAX_ARGS], 1); - return list(args, nargs); - } return _list(args, nargs, 1); } diff --git a/femtolisp/flisp.h b/femtolisp/flisp.h index c333478..1b15d24 100644 --- a/femtolisp/flisp.h +++ b/femtolisp/flisp.h @@ -102,22 +102,13 @@ typedef struct _symbol_t { void fl_gc_handle(value_t *pv); void fl_free_gc_handles(int n); -// maximum number of explicit arguments. the 128th arg is a list of rest args. -// the largest value nargs can have is MAX_ARGS+1 -#define MAX_ARGS 127 - #include "opcodes.h" // utility for iterating over all arguments in a builtin // i=index, i0=start index, arg = var for each arg, args = arg array // assumes "nargs" is the argument count -// modifies args[MAX_ARGS] when nargs==MAX_ARGS+1 -#define FOR_ARGS(i, i0, arg, args) \ - for(i=i0; (((size_t)iMAX_ARGS && iscons(args[MAX_ARGS]))) && \ - ((i>=MAX_ARGS?(arg=car_(args[MAX_ARGS]), \ - args[MAX_ARGS]=cdr_(args[MAX_ARGS])) : \ - (arg = args[i])) || 1)); i++) +#define FOR_ARGS(i, i0, arg, args) \ + for(i=i0; ((size_t)i) MAX_ARGS) + if (nargs < 2) argcount(fname, nargs, 2); ios_t *s = toiostream(args[0], fname); unsigned i; diff --git a/femtolisp/system.lsp b/femtolisp/system.lsp index 18fb15d..85532f5 100644 --- a/femtolisp/system.lsp +++ b/femtolisp/system.lsp @@ -309,6 +309,11 @@ (or (and (pair? x) (or (eq (car x) '*comma-at*) (eq (car x) '*comma-dot*))) (eq x '*comma*))) + ; bracket without splicing + (define (bq-bracket1 x) + (if (and (pair? x) (eq (car x) '*comma*)) + (cadr x) + (bq-process x))) (cond ((self-evaluating? x) (if (vector? x) (let ((body (bq-process (vector->list x)))) @@ -345,12 +350,6 @@ ((eq (car x) '*comma-dot*) (cadr x)) (#t (list list (bq-process x))))) -; bracket without splicing -(define (bq-bracket1 x) - (if (and (pair? x) (eq (car x) '*comma*)) - (cadr x) - (bq-process x))) - ; standard macros ------------------------------------------------------------- (define (quote-value v) diff --git a/femtolisp/table.c b/femtolisp/table.c index 7cc6103..1dc7083 100644 --- a/femtolisp/table.c +++ b/femtolisp/table.c @@ -84,8 +84,6 @@ static htable_t *totable(value_t v, char *fname) value_t fl_table(value_t *args, uint32_t nargs) { size_t cnt = (size_t)nargs; - if (nargs > MAX_ARGS) - cnt += (llength(args[MAX_ARGS])-1); if (cnt & 1) lerror(ArgError, "table: arguments must come in pairs"); value_t nt; diff --git a/femtolisp/todo b/femtolisp/todo index 5a2aa30..cb01627 100644 --- a/femtolisp/todo +++ b/femtolisp/todo @@ -1042,7 +1042,8 @@ new evaluator todo: * stack traces and better debugging support - make maxstack calculation robust against invalid bytecode * improve internal define -- try removing MAX_ARGS trickery +* try removing MAX_ARGS trickery +- apply optimization, avoid redundant list copying calling vararg fns - let eversion * lambda lifting * let optimization diff --git a/femtolisp/unittest.lsp b/femtolisp/unittest.lsp index 911e1b0..720d054 100644 --- a/femtolisp/unittest.lsp +++ b/femtolisp/unittest.lsp @@ -98,6 +98,8 @@ ; long argument lists (assert (= (apply + (iota 100000)) 4999950000)) +(define MAX_ARGS 255) + (define as (apply list* (map-int (lambda (x) (gensym)) (+ MAX_ARGS 1)))) (define f (compile `(lambda ,as ,(lastcdr as)))) (assert (equal? (apply f (iota (+ MAX_ARGS 0))) `()))