shithub: femtolisp

Download patch

ref: 4a408b2e2c76e424afc0527fbc4ba75b957be533
parent: 76aec5fa7a058f6a9f69570efe13dff3cb957e76
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Dec 11 21:36:41 EST 2024

remove OP_BOOL_CONST_{F,T} and OP_NIL - instead reuse already existing OP_LOAD* ops

--- a/flisp.boot
+++ b/flisp.boot
@@ -14,8 +14,7 @@
 	      #fn("8000z0700}2:" #(div0))
 	      #fn("6000n201l:" #()) #fn("6000n201m:" #()) 0 #fn("8000z0700}2:" #(vector))
 	      #fn("8000z0700}2:" #(aset!)) 0 0 0 0 0 0 0 0 0 0 0 #fn("9000n3012082>1|:" #(#fn("6000n1A061:" #())))
-	      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #fn("8000z0700}2:" #(aref)) 0 0 0
-	      0)
+	      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #fn("8000z0700}2:" #(aref)) 0)
 	    *empty-string* "" *runestring-type* (array rune) *string-type* (array
   byte)
 	    *syntax-environment* #table(when #fn(";000z1200211POe4:" #(if begin))  with-output-to #fn("<000z12021e1220e2e1e12315163:" #(#fn(nconc)
@@ -49,7 +48,7 @@
   length=) 1arg-lambda?)
 	    <= #fn("6000n210L;IB0470051;380470151S:" #(nan?) <=) >
 	    #fn("6000n210L:" #() >) >= #fn("6000n201L;IB0470051;380470151S:" #(nan?) >=)
-	    Instructions #table(call.l 81  trycatch 75  largc 79  loadg.l 68  aref2 23  box 90  cadr 36  argc 62  setg 71  load0 21  vector? 45  fixnum? 41  loadc0 17  loada0 0  div0 59  keyargs 89  call 5  loada.l 69  brt.l 50  pair? 18  sub2 78  add2 29  loadc.l 70  loadc 9  builtin? 43  set-car! 47  brt 25  ret 10  loadi8 66  tapply 77  loada1 1  shift 46  boolean? 39  atom? 24  cdr 13  brne.l 83  / 58  loadf 31  equal? 52  apply 54  dup 11  loadt 20  jmp.l 48  null? 38  not 35  = 60  set-cdr! 30  eq? 33  * 57  load1 27  dummy_t 94  bound? 42  brf 3  function? 44  box.l 91  < 28  brnn.l 84  jmp 16  loadv 2  for 76  lvargc 80  dummy_eof 96  + 55  dummy_f 93  brne 19  compare 61  neg 37  loadv.l 67  number? 40  vargc 74  brn 85  brbound 88  vector 63  loadc1 22  setg.l 72  brf.l 49  aref 92  symbol? 34  aset! 64  car 12  cons 32  tcall.l 82  - 56  brn.l 86  optargs 87  closure 14  pop 4  eqv? 51  list 53  seta 15  seta.l 73  brnn 26  loadnil 65  loadg 7  loada 8  dummy_nil 95  tcall 6)
+	    Instructions #table(call.l 81  trycatch 75  largc 79  loadg.l 68  aref2 23  box 90  cadr 36  argc 62  setg 71  load0 21  vector? 45  fixnum? 41  loadc0 17  loada0 0  div0 59  keyargs 89  call 5  loada.l 69  brt.l 50  pair? 18  sub2 78  add2 29  loadc.l 70  loadc 9  builtin? 43  set-car! 47  brt 25  ret 10  loadi8 66  tapply 77  loada1 1  shift 46  boolean? 39  atom? 24  cdr 13  brne.l 83  / 58  loadf 31  equal? 52  apply 54  dup 11  loadt 20  jmp.l 48  null? 38  not 35  = 60  set-cdr! 30  eq? 33  * 57  load1 27  bound? 42  brf 3  function? 44  box.l 91  < 28  brnn.l 84  jmp 16  loadv 2  for 76  lvargc 80  dummy_eof 93  + 55  brne 19  compare 61  neg 37  loadv.l 67  number? 40  vargc 74  brn 85  brbound 88  vector 63  loadc1 22  setg.l 72  brf.l 49  aref 92  symbol? 34  aset! 64  car 12  cons 32  tcall.l 82  - 56  brn.l 86  optargs 87  closure 14  pop 4  eqv? 51  list 53  seta 15  seta.l 73  brnn 26  loadnil 65  loadg 7  loada 8  tcall 6)
 	    __init_globals #fn("5000n020w1422w3474w5476w7478w9:" #("/"
 								   *directory-separator*
 								   "\n"
--- a/flisp.h
+++ b/flisp.h
@@ -328,9 +328,9 @@
 #include "opcodes.h"
 
 enum {
-	FL_nil = builtin(OP_NIL),
-	FL_t = builtin(OP_BOOL_CONST_T),
-	FL_f = builtin(OP_BOOL_CONST_F),
+	FL_nil = builtin(OP_LOADNIL),
+	FL_t = builtin(OP_LOADT),
+	FL_f = builtin(OP_LOADF),
 	FL_eof = builtin(OP_EOF_OBJECT),
 	FL_unspecified = FL_t,
 };
--- a/gen.lsp
+++ b/gen.lsp
@@ -93,9 +93,6 @@
     OP_BOX            box       #f      0
     OP_BOXL           box.l     #f      0
     OP_AREF           aref      -2      (λ rest (apply aref rest))
-    OP_BOOL_CONST_F   dummy_f   #f      0
-    OP_BOOL_CONST_T   dummy_t   #f      0
-    OP_NIL            dummy_nil #f      0
     OP_EOF_OBJECT     dummy_eof #f      0
 ))
 
--- a/opcodes.h
+++ b/opcodes.h
@@ -92,9 +92,6 @@
 	OP_BOX,
 	OP_BOXL,
 	OP_AREF,
-	OP_BOOL_CONST_F,
-	OP_BOOL_CONST_T,
-	OP_NIL,
 	OP_EOF_OBJECT,
 	N_OPCODES
 };