diff options
author | dos-reis <gdr@axiomatics.org> | 2010-05-30 20:06:08 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-05-30 20:06:08 +0000 |
commit | b34d97dda5ce8c88d31412d11b1ad67da058480e (patch) | |
tree | 55222ea664797f046a2e7a8f807d36fb59438419 /src/interp | |
parent | ded226fca8f3a75d33602a7fbbc941c55e985fdf (diff) | |
download | open-axiom-b34d97dda5ce8c88d31412d11b1ad67da058480e.tar.gz |
* interp/c-util.boot (middleEndExpand): Tidy.
* interp/g-util.boot (expandToVMForm): Likewise.
(expandStore): Refine store to pair components.
* algebra/any.spad.pamphlet (Scope): Use builtin operators.
(Environment): Likewise.
* algebra/domain.spad.pamphlet (FunctionDescriptor): Likewise.
(ConstructorCall): Likewise.
(FunctorData): Likewise.
(OperatorSignature): Likewise.
(Category): Likewise.
(Domain): Likewise.
* algebra/integer.spad.pamphlet (Integer): Likewise.
(NonNegativeInteger): Likewise.
* algebra/outform.spad.pamphlet: Likewise.
* algebra/si.spad.pamphlet (SingleInteger): Likewise.
* algebra/syntax.spad.pamphlet (Syntax): Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/c-util.boot | 5 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 9 | ||||
-rw-r--r-- | src/interp/g-util.boot | 29 |
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 |