diff options
author | dos-reis <gdr@axiomatics.org> | 2010-05-24 07:41:13 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-05-24 07:41:13 +0000 |
commit | 0e841ba86255626a17d29105e6df715250aebbdc (patch) | |
tree | b355155160d80db73036101e6f3a82099f268620 | |
parent | cd465d2c88f45cb35d3488dbe0ad24e4ee0e05ab (diff) | |
download | open-axiom-0e841ba86255626a17d29105e6df715250aebbdc.tar.gz |
* interp/c-util.boot ($middleEndOpcodes): New.
(getOpcodeExpander): Likewise.
(middleEndExpand): Use it to expand middle end opcodes.
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/interp/c-util.boot | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index afa9f1a1..6f82c21d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2010-05-24 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * interp/c-util.boot ($middleEndOpcodes): New. + (getOpcodeExpander): Likewise. + (middleEndExpand): Use it to expand middle end opcodes. + 2010-05-23 Gabriel Dos Reis <gdr@cs.tamu.edu> * interp/i-spec1.boot (compileADEFBody): Establish a dynamic diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 6fca669a..596a7949 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1069,18 +1069,27 @@ mutateLETFormWithUnaryFunction(form,fun) == $middleEndMacroList == '(COLLECT REPEAT SUCHTHATCLAUSE THETA THETA1 SPADREDUCE SPADDO) +++ List of opcode-expander pairs. +$middleEndOpcodes == nil + +++ Return the expander of a middle-end opcode, or nil if there is none. +getOpcodeExpander op == + x := ASSOC(op,$middleEndOpcodes) => rest op + nil + middleEndExpand: %Form -> %Form middleEndExpand x == isAtomicForm x => x - first x in $middleEndMacroList => + [op,:args] := x + op in $middleEndMacroList => middleEndExpand MACROEXPAND_-1 x - a := middleEndExpand first x - b := middleEndExpand rest x - EQ(a,first x) and EQ(b,rest x) => x + IDENTP op and (fun := getOpcodeExpander op) => apply(fun,args) + a := middleEndExpand op + b := middleEndExpand args + EQ(a,op) and EQ(b,args) => x [a,:b] - -- A function is simple if it looks like a super combinator, and it -- does not use its environment argument. They can be safely replaced -- by more efficient (hopefully) functions. |