aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-05-27 05:43:57 +0000
committerdos-reis <gdr@axiomatics.org>2010-05-27 05:43:57 +0000
commit8f5399e77de0741651b0d058b1aa7f57f43aedb0 (patch)
tree99afff91fbcc1a5b0668cb62c703bd52e3ecbbd6 /src
parenta7e98a2ab2fcc87c3505ab11708d5bf24607ae85 (diff)
downloadopen-axiom-8f5399e77de0741651b0d058b1aa7f57f43aedb0.tar.gz
* interp/i-map.boot (compileCoerceMap): Minivectors are global
variables. Generate appropriate code. * interp/i-spec1.boot (compileTargetedADEF): Likewise. (compileADEFBody): Likewise. * interp/slam.boot (isRecurrenceRelation): Likewise. Adjust patterns to match minivectors. (mkDiffAssoc): Likewise. (reportFunctionCompilation): Don't declare minivectors.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/interp/i-map.boot12
-rw-r--r--src/interp/i-spec1.boot8
-rw-r--r--src/interp/slam.boot37
4 files changed, 40 insertions, 28 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index c24c65b3..75a8470a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/i-map.boot (compileCoerceMap): Minivectors are global
+ variables. Generate appropriate code.
+ * interp/i-spec1.boot (compileTargetedADEF): Likewise.
+ (compileADEFBody): Likewise.
+ * interp/slam.boot (isRecurrenceRelation): Likewise. Adjust
+ patterns to match minivectors.
+ (mkDiffAssoc): Likewise.
+ (reportFunctionCompilation): Don't declare minivectors.
+
2010-05-26 Gabriel Dos Reis <gdr@cs.tamu.edu>
* interp/slam.boot (compileRecurrenceRelation): Generate code to
diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot
index ab24945f..713f32d2 100644
--- a/src/interp/i-map.boot
+++ b/src/interp/i-map.boot
@@ -763,16 +763,16 @@ compileCoerceMap(op,argTypes,mm) ==
name:= makeLocalModemap(op,[first sig,:argTypes])
argCode := [objVal(coerceInteractive(objNew(arg,t1),t2) or
throwKeyedMsg("S2IC0001",[arg,$mapName,t1,t2]))
- for t1 in argTypes for t2 in rest sig for arg in parms]
+ for t1 in argTypes for t2 in sig.source for arg in parms]
$insideCompileBodyIfTrue := false
parms:= [:parms,'envArg]
body := ['SPADCALL,:argCode,['LIST,['function,imp]]]
- minivectorName := makeInternalMapMinivectorName(name)
- body := declareUnusedParameters(parms,substitute(minivectorName,"$$$",body))
+ minivectorName := makeInternalMapMinivectorName name
+ body := substitute(["%dynval",MKQ minivectorName],"$$$",body)
setDynamicBinding(minivectorName,LIST2VEC $minivector)
- compileInteractive
- [name,['LAMBDA,parms,declareGlobalVariables [minivectorName],:body]]
- first sig
+ compileInteractive
+ [name,['LAMBDA,parms,:declareUnusedParameters(parms,body)]]
+ sig.target
depthOfRecursion(opName,body) ==
-- returns the "depth" of recursive calls of opName in body
diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot
index 2b3b5ba3..4164d514 100644
--- a/src/interp/i-spec1.boot
+++ b/src/interp/i-spec1.boot
@@ -153,8 +153,8 @@ compileTargetedADEF(t,vars,types,body) ==
compileADEFBody(t,vars,types,body,computedResultType) ==
--+
$compiledOpNameList := [$mapName]
- minivectorName := makeInternalMapMinivectorName(PNAME $mapName)
- body := substitute(minivectorName,"$$$",body)
+ minivectorName := makeInternalMapMinivectorName PNAME $mapName
+ body := substitute(["%dynval",MKQ minivectorName],"$$$",body)
setDynamicBinding(minivectorName,LIST2VEC $minivector)
-- The use of the three variables $definingMap, $genValue and $compilingMap
@@ -177,9 +177,7 @@ compileADEFBody(t,vars,types,body,computedResultType) ==
-- MCD 13/3/96
parms := [:vars,"envArg"]
if not $definingMap and ($genValue or $compilingMap) then
- fun := [$mapName,["LAMBDA",parms,
- declareGlobalVariables [minivectorName],
- :declareUnusedParameters(parms,body)]]
+ fun := [$mapName,["LAMBDA",parms,:declareUnusedParameters(parms,body)]]
code := wrap compileInteractive fun
else
$freeVariables: local := []
diff --git a/src/interp/slam.boot b/src/interp/slam.boot
index 3da6c906..3c94696e 100644
--- a/src/interp/slam.boot
+++ b/src/interp/slam.boot
@@ -60,11 +60,12 @@ isRecurrenceRelation(op,body,minivectorName) ==
lesspSlot:=compiledLookupCheck("<",[$Boolean,"$","$"],integer)
notpSlot:= compiledLookupCheck("not",["$","$"],eval $Boolean)
for [p,c] in pcl repeat
- p is ['SPADCALL,sharpVar,n1,['ELT,=minivectorName,slot]]
- and EQ(iequalSlot,$minivector.slot) =>
- initList:= [[n1,:c],:initList]
- sharpList := insert(sharpVar,sharpList)
- n:=n1
+ p is ['SPADCALL,sharpVar,n1,
+ ["ELT",["%dynval",=MKQ minivectorName],slot]]
+ and EQ(iequalSlot,$minivector.slot) =>
+ initList:= [[n1,:c],:initList]
+ sharpList := insert(sharpVar,sharpList)
+ n:=n1
miscList:= [[p,c],:miscList]
miscList isnt [[generalPred,generalTerm]] or sharpList isnt [sharpArg] =>
return false
@@ -86,14 +87,17 @@ isRecurrenceRelation(op,body,minivectorName) ==
--Check general predicate
predOk :=
generalPred is '(QUOTE T) => true
- generalPred is ['SPADCALL,m,=sharpArg,['ELT,=minivectorName,slot]]
- and EQ(lesspSlot,$minivector.slot)=> m+1
+ generalPred is ['SPADCALL,m,=sharpArg,
+ ["ELT",["%dynval",=MKQ minivectorName],slot]]
+ and EQ(lesspSlot,$minivector.slot)=> m+1
generalPred is ['SPADCALL,['SPADCALL,=sharpArg,m,
- ['ELT,=minivectorName,slot]], ['ELT,=minivectorName,notSlot]]
- and EQ(lesspSlot,$minivector.slot)
- and EQ(notpSlot,$minivector.notSlot) => m
- generalPred is ['NOT,['SPADCALL,=sharpArg,m,['ELT,=minivectorName, =lesspSlot]]]
- and EQ(lesspSlot,$minivector.slot) => m
+ ["ELT",["%dynval",=MKQ minivectorName],slot]],
+ ["ELT",["%dynval",=MKQ minivectorName],notSlot]]
+ and EQ(lesspSlot,$minivector.slot)
+ and EQ(notpSlot,$minivector.notSlot) => m
+ generalPred is ['NOT,['SPADCALL,=sharpArg,m,
+ ["ELT",["%dynval",=MKQ minivectorName], =lesspSlot]]]
+ and EQ(lesspSlot,$minivector.slot) => m
return nil
integer? predOk and predOk ~= n =>
sayKeyedMsg("S2IX0006",[n,m])
@@ -125,7 +129,7 @@ mkDiffAssoc(op,body,k,sharpPosition,sharpArg,diffSlot,vecname) ==
"union"/[mkDiffAssoc(op,c,k,sharpPosition,sharpArg,diffSlot,vecname) for [p,c] in pl]
body is [fn,:argl] =>
(fn = op) and argl.(sharpPosition-1) is
- ['SPADCALL,=sharpArg,n,['ELT,=vecname,=diffSlot]] =>
+ ['SPADCALL,=sharpArg,n,["ELT",["%dynval",=MKQ vecname],=diffSlot]] =>
NUMP n and n > 0 and n <= k =>
[[body,:$TriangleVariableList.n]]
['$failed]
@@ -137,8 +141,8 @@ reportFunctionCompilation(op,nam,argl,body,isRecursive) ==
-- dynamic caching, see SLAMOLD BOOT
--+
$compiledOpNameList := [nam]
- minivectorName := makeInternalMapMinivectorName(nam)
- body := substitute(minivectorName,"$$$",body)
+ minivectorName := makeInternalMapMinivectorName nam
+ body := substitute(["%dynval",MKQ minivectorName],"$$$",body)
setDynamicBinding(minivectorName,LIST2VEC $minivector)
argl := COPY argl -- play it safe for optimization
init :=
@@ -149,8 +153,7 @@ reportFunctionCompilation(op,nam,argl,body,isRecursive) ==
cacheCount = "all" => reportFunctionCacheAll(op,nam,argl,body)
parms := [:argl,"envArg"]
cacheCount = 0 or null argl =>
- fun:= [nam,["LAMBDA",parms,declareGlobalVariables [minivectorName],
- :declareUnusedParameters(parms,body)]]
+ fun:= [nam,["LAMBDA",parms,:declareUnusedParameters(parms,body)]]
compileInteractive fun
nam
num :=