aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot5
-rw-r--r--src/interp/g-opt.boot9
-rw-r--r--src/interp/g-util.boot29
3 files changed, 26 insertions, 17 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index be422d75..e135583f 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1075,11 +1075,10 @@ $middleEndMacroList ==
middleEndExpand: %Form -> %Form
middleEndExpand x ==
- x = '%false => 'NIL
- x = '%true => 'T
+ x = '%false or x = '%nil => 'NIL
+ IDENTP x and (x' := x has %Rename) => x'
isAtomicForm x => x
[op,:args] := x
- IDENTP op and (op' := op has %Rename) => [op',:middleEndExpand args]
IDENTP op and (fun := getOpcodeExpander op) => apply(fun,x,nil)
op in $middleEndMacroList =>
middleEndExpand MACROEXPAND_-1 x
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 85da2c38..bf094be5 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -402,10 +402,11 @@ $VMsideEffectFreeOperators ==
SPADfirst QVELT _+ _- _* _< _= _<_= _> _>_= ASH INTEGER_-LENGTH
QEQCAR QCDR QCAR INTEGERP FLOATP STRINGP IDENTP SYMBOLP
MINUSP GREATERP ZEROP ODDP FLOAT_-RADIX FLOAT FLOAT_-SIGN FLOAT_-DIGITS
- CGREATERP GGREATERP CHAR BOOLE GET BVEC_-GREATER FUNCALL
- %and %or %not %eq %ieq %ilt %ile %igt %ige %head %tail
- %imul %iadd %isub %igcd %ilcm %iexp %imin %imax
- %feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax)
+ CGREATERP GGREATERP CHAR BOOLE GET BVEC_-GREATER FUNCALL %false %true
+ %and %or %not %eq %ieq %ilt %ile %igt %ige %head %tail %integer?
+ %imul %iadd %isub %igcd %ilcm %ipow %imin %imax %ieven? %iodd?
+ %feq %flt %fle %fgt %fge %fmul %fadd %fsub %fexp %fmin %fmax
+ %fpow %nil %pair?)
++ List of simple VM operators
$simpleVMoperators ==
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 139eff6e..5e1a228a 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -231,26 +231,33 @@ expandDynval ["%dynval",:args] ==
["SYMBOL-VALUE",:expandToVMForm args]
expandStore ["%store",place,value] ==
- place := expandToVMForm place
value := expandToVMForm value
+ place is ['%head,x] => ['RPLACA,expandToVMForm x,value]
+ place is ['%tail,x] => ['RPLACD,expandToVMForm x,value]
+ place := expandToVMForm place
cons? place => ["SETF",place,value]
["SETQ",place,value]
++ Opcodes with direct mapping to target operations.
for x in [
+ -- Boolean constants
+ -- ['%false, :'NIL],
+ ['%true, :'T],
-- unary Boolean operations
['%not, :'NOT],
-
-- binary Boolean operations
['%and, :'AND],
['%or, :'OR],
-- unary integer operations.
- ['%iabs,:'ABS],
-
+ ['%iabs, :'ABS],
+ ['%ieven?, :'EVENP],
+ ['%ineg, :"-"],
+ ['%integer?,:'INTEGERP],
+ ['%iodd?, :'ODDP],
-- binary integer operations.
['%iadd,:"+"],
- ['%iexp,:'EXPT],
+ ['%ieq, :"EQL"],
['%igcd,:'GCD],
['%ige, :">="],
['%igt, :">"],
@@ -260,14 +267,13 @@ for x in [
['%imax,:'MAX],
['%imin,:'MIN],
['%imul,:"*"],
+ ['%ipow,:'EXPT],
['%isub,:"-"],
-- unary float operations.
['%fabs,:'ABS],
-
-- binary float operations.
['%fadd,:"+"],
- ['%fexp,:'EXPT],
['%fge, :">="],
['%fgt, :">"],
['%fle, :"<="],
@@ -275,10 +281,14 @@ for x in [
['%fmax,:'MAX],
['%fmin,:'MIN],
['%fmul,:"*"],
+ ['%fpow,:'EXPT],
['%fsub,:"-"],
+ -- list contants
+ -- ['%nil, :'NIL],
-- unary list operations
['%head,:'CAR],
+ ['%pair?, :'CONSP],
['%tail,:'CDR]
] repeat property(first x,'%Rename) := rest x
@@ -301,11 +311,10 @@ getOpcodeExpander op ==
++ Expand all opcodes contained in the form `x' into a form
++ suitable for evaluation by the VM.
expandToVMForm x ==
- x = '%false => 'NIL
- x = '%true => 'T
+ x = '%false or x = '%nil => 'NIL
+ IDENTP x and (x' := x has %Rename) => x'
isAtomicForm x => x
[op,:args] := x
- IDENTP op and (op' := op has %Rename) => [op',:expandToVMForm args]
IDENTP op and (fun:= getOpcodeExpander op) => apply(fun,x,nil)
op' := expandToVMForm op
args' := expandToVMForm args