aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-01-02 09:39:28 +0000
committerdos-reis <gdr@axiomatics.org>2009-01-02 09:39:28 +0000
commitc13363c1cf68242db7fac7970baa80fcd8911972 (patch)
treeb70407ac7af27c7a581e0beacabbf7a9eac4cd0e /src/interp
parent8e2eb71cea7c58615b87344af16d57b703b4c5b5 (diff)
downloadopen-axiom-c13363c1cf68242db7fac7970baa80fcd8911972.tar.gz
* interp/c-util.boot (updateCapsuleDirectory): Record constant
makers too. (replaceSimpleFunctions): Fold simple constant form makers.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index 29debb01..3bcf12c2 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -900,10 +900,15 @@ getCapsuleDirectoryEntry slot ==
++ Update the current capsule directory with entry controlled by
++ predicate `pred'.
-updateCapsuleDirectory(entry,pred) ==
+updateCapsuleDirectory(item,pred) ==
pred ^= true => nil
- entry isnt ["$",slot,["CONS",["dispatchFunction",fun],:.],:.] => nil
- $capsuleDirectory := [[slot,:fun],:$capsuleDirectory]
+ entry :=
+ item is ["$",slot,["CONS",["dispatchFunction",fun],:.],:.] => [slot,:fun]
+ item is ["$",slot,["CONS","IDENTITY",
+ ["FUNCALL",["dispatchFunction",fun],"$"]]] => [slot,:fun]
+ nil
+ entry = nil => nil
+ $capsuleDirectory := [entry,:$capsuleDirectory]
@@ -989,6 +994,12 @@ replaceSimpleFunctions form ==
mutateCONDFormWithUnaryFunction(form,"replaceSimpleFunctions")
form is ["LET",:.] =>
optLET mutateLETFormWithUnaryFunction(form,"replaceSimpleFunctions")
+ form is ["spadConstant","$",n] =>
+ null(op := getCapsuleDirectoryEntry n) => form
+ getFunctionReplacement op is ["XLAM",=nil,body] and atom body => body
+ -- Conservatively preserve object identity and storage
+ -- consumption by not folding non-atomic constant forms.
+ form
-- 1. process argument first.
for args in tails rest form repeat
arg' := replaceSimpleFunctions(arg := first args)