aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog42
-rw-r--r--src/interp/c-util.boot4
-rw-r--r--src/interp/clam.boot9
-rw-r--r--src/interp/g-timer.boot2
-rw-r--r--src/interp/g-util.boot7
-rw-r--r--src/interp/i-analy.boot4
-rw-r--r--src/interp/i-eval.boot4
-rw-r--r--src/interp/i-map.boot27
-rw-r--r--src/interp/i-spec1.boot39
-rw-r--r--src/interp/i-spec2.boot21
-rw-r--r--src/interp/i-util.boot4
-rw-r--r--src/interp/slam.boot15
-rw-r--r--src/interp/sys-macros.lisp2
13 files changed, 121 insertions, 59 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 75a8470a..5836068b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,47 @@
2010-05-27 Gabriel Dos Reis <gdr@cs.tamu.edu>
+ * interp/sys-macros.lisp (eval): Expand opcodes before calling EVAL.
+ * interp/slam.boot (reportFunctionCompilation): Tidy. Take extra
+ care when generating code that access global variables.
+ (reportFunctionCacheAll): Likewise.
+ * interp/i-util.boot (isLocallyBound): Define.
+ * interp/i-spec1.boot (upCOLLECT1): Bind $iteratorVars to nil.
+ (upLoopIterSTEP): Call mkIteratorVariable instead of mkLocalVar.
+ (upLoopIterIN): Likewise.
+ (upStreamIterIN): Likewise.
+ (upStreamIterSTEP): Likewise.
+ (collectOneStream): Tidy.
+ (mkAndApplyPredicates): Likewise.
+ (mkIterFun): Lose last parameter. Tidy.
+ (declare): Use isLocallyBound.
+ (getAndEvalConstructorArgument): Likewise.
+ (mkIteratorVariable): New.
+ ($iteratorVars): New.
+ * interp/i-spec2.boot (upREPEAT1): Bind $iteratorVars to nil.
+ (isLocalPred): Use isLocallyBound.
+ (compileIs): Likewise.
+ (evalLETput): Likewise.
+ (evalLETchangeValue): Likewise.
+ (isType): Likewise.
+ * interp/i-analy.boot (bottomUp): Likewise.
+ (bottomUpDefaultCompile): Likewise.
+ * interp/i-eval.boot (evalForm): Likewise.
+ (getMappingArgValue): Likewise.
+ * interp/i-map.boot (findLocalVars1): Likewise.
+ (findLocalsInLoop): Tidy. Filter out iterator variables.
+ (isLocalVar): Remove.
+ * interp/g-util.boot (mkCacheName): Define here.
+ (mkAuxiliaryName): Likewise.
+ * interp/c-util.boot (backendCompileSLAM): Use mkCacheName.
+ (backendCompileSPADSLAM): Likewise.
+ * interp/clam.boot (compClam): Likewise.
+ (clearCategoryCaches): Likewise.
+ (clearCategoryCache): Likewise.
+ * interp/g-timer.boot (timedEVALFUN): expandToVMForm is now
+ implicitly called by eval.
+
+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.
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index 42268eee..16532e20 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1316,7 +1316,7 @@ backendCompileNEWNAM x ==
++ as alists.
backendCompileSLAM: (%Symbol,%List,%Code) -> %Symbol
backendCompileSLAM(name,args,body) ==
- al := INTERNL(name,'";AL") -- name of the cache alist.
+ al := mkCacheName name -- name of the cache alist.
auxfn := INTERNL(name,'";") -- name of the worker function.
g1 := gensym() -- name for the parameter.
g2 := gensym() -- name for the cache value
@@ -1348,7 +1348,7 @@ backendCompileSLAM(name,args,body) ==
++ table. This backend compiler is used to compile constructors.
backendCompileSPADSLAM: (%Symbol,%List,%Code) -> %Symbol
backendCompileSPADSLAM(name,args,body) ==
- al := INTERNL(name,'";AL") -- name of the cache hash table.
+ al := mkCacheName name -- name of the cache hash table.
auxfn := INTERNL(name,'";") -- name of the worker function.
g1 := gensym() -- name of the worker function parameter
g2 := gensym() -- name for the cache value.
diff --git a/src/interp/clam.boot b/src/interp/clam.boot
index c3349527..71073268 100644
--- a/src/interp/clam.boot
+++ b/src/interp/clam.boot
@@ -103,7 +103,7 @@ compClam(op,argl,body,$clamList) ==
[arg,computeValue] :=
argl is [.] => [[g1],[auxfn,g1]] --g1 is a parameter
[g1,['APPLX,['function,auxfn],g1]] --g1 is a parameter list
- cacheName:= INTERNL(op,'";AL")
+ cacheName:= mkCacheName op
if $reportCounts=true then
hitCounter:= INTERNL(op,'";hit")
callCounter:= INTERNL(op,'";calls")
@@ -203,7 +203,7 @@ compHash(op,argl,body,cacheNameOrNil,eqEtc,countFl) ==
[[g1],['LIST,key],[auxfn,g1]] --g1 is a parameter
key:= (cacheNameOrNil => ['devaluateList,g1] ; g1)
[g1,key,['APPLY,['function,auxfn],g1]] --g1 is a parameter list
- cacheName:= cacheNameOrNil or INTERNL(op,'";AL")
+ cacheName:= cacheNameOrNil or mkCacheName op
if $reportCounts=true then
hitCounter:= INTERNL(op,'";hit")
callCounter:= INTERNL(op,'";calls")
@@ -355,14 +355,13 @@ clearConstructorAndLisplibCaches() ==
clearCategoryCaches() ==
for name in allConstructors() repeat
if getConstructorKindFromDB name = "category" then
- if BOUNDP(cacheName:= INTERNL strconc(PNAME name,'";AL"))
+ if BOUNDP(cacheName:= mkCacheName name)
then setDynamicBinding(cacheName,nil)
if BOUNDP(cacheName:= INTERNL strconc(PNAME name,'";CAT"))
then setDynamicBinding(cacheName,nil)
clearCategoryCache catName ==
- cacheName:= INTERNL strconc(PNAME catName,'";AL")
- setDynamicBinding(cacheName,nil)
+ setDynamicBinding(mkCacheName catName,nil)
displayHashtable x ==
l:= nreverse SORTBY('CAR,[[opOf HGET(x,key),key] for key in HKEYS x])
diff --git a/src/interp/g-timer.boot b/src/interp/g-timer.boot
index 83570472..49f73575 100644
--- a/src/interp/g-timer.boot
+++ b/src/interp/g-timer.boot
@@ -255,7 +255,7 @@ timedOptimization(code) ==
timedEVALFUN(code) ==
startTimingProcess 'evaluation
- r := timedEvaluate expandToVMForm code
+ r := timedEvaluate code
stopTimingProcess 'evaluation
r
diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot
index 8815cf5b..95943989 100644
--- a/src/interp/g-util.boot
+++ b/src/interp/g-util.boot
@@ -267,6 +267,13 @@ $interpOnly := false
--% Utility Functions of General Use
+mkCacheName(name) ==
+ INTERN strconc(PNAME name,'";AL")
+
+mkAuxiliaryName(name) ==
+ INTERN strconc(PNAME name,'";AUX")
+
+
homogeneousListToVector(t,l) ==
makeSimpleArrayFromList(t,l)
diff --git a/src/interp/i-analy.boot b/src/interp/i-analy.boot
index 30d8603a..6dcf0421 100644
--- a/src/interp/i-analy.boot
+++ b/src/interp/i-analy.boot
@@ -225,7 +225,7 @@ bottomUp t ==
[om]
if atom op then
opName:= getUnname op
- if opName in $localVars then
+ if isLocallyBound opName then
putModeSet(op,bottomUpIdentifier(op,opName))
else
transferPropsToNode(opName,op)
@@ -470,7 +470,7 @@ bottomUpDefaultCompile(t,id,defaultMode,target,isSub) ==
tmode := getMode t
tval := getValue t
expr:=
- id in $localVars => id
+ isLocallyBound id => id
get(id,"mode",$env) => id -- declared local variable
tmode or tval =>
envMode := tmode or objMode tval
diff --git a/src/interp/i-eval.boot b/src/interp/i-eval.boot
index 652818fb..32b55375 100644
--- a/src/interp/i-eval.boot
+++ b/src/interp/i-eval.boot
@@ -248,7 +248,7 @@ evalForm(op,opName,argl,mmS) ==
form :=
dc='local => --[fun,:form]
atom fun =>
- fun in $localVars => ['SPADCALL,:form,fun]
+ isLocallyBound fun => ['SPADCALL,:form,fun]
[fun,:form,NIL]
['SPADCALL,:form,fun]
dc is ["__FreeFunction__",:freeFun] =>
@@ -321,7 +321,7 @@ getArgValueOrThrow(x, type) ==
getArgValue(x,type) or throwKeyedMsg("S2IC0007",[type])
getMappingArgValue(a,t,m is ['Mapping,:ml]) ==
- (una := getUnname a) in $localVars =>
+ isLocallyBound(una := getUnname a) =>
$genValue =>
name := get(una,'name,$env)
a.0 := name
diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot
index 713f32d2..91f41976 100644
--- a/src/interp/i-map.boot
+++ b/src/interp/i-map.boot
@@ -70,10 +70,6 @@ makeInternalMapMinivectorName(name) ==
INTERN strconc(name,'";MV")
INTERN strconc(PNAME name,'";MV")
-mkCacheName(name) == INTERNL(STRINGIMAGE name,'";AL")
-
-mkAuxiliaryName(name) == INTERNL(STRINGIMAGE name,'";AUX")
-
--% Adding a function definition
isMapExpr x == x is ["%Map",:.]
@@ -685,7 +681,7 @@ compileDeclaredMap(op,sig,mapDef) ==
-- creates a local modemap and puts it into the environment
$localVars: local := nil
$freeVars: local := nil
- $env:local:= [[nil]]
+ $env: local:= [[nil]]
parms:=[var for var in $FormalMapVariableList for m in rest sig]
for m in rest sig for var in parms repeat
$env:= put(var,'mode,m,$env)
@@ -736,7 +732,7 @@ genMapCode(op,body,sig,fnName,parms,isRecursive) ==
-- loop variables and variables that do have %LET expressions, but that
-- can be finessed later.
- locals := SETDIFFERENCE(COPY $localVars, parms)
+ locals := setDifference($localVars,parms)
if locals then
lets := [["%LET", l, ''UNINITIALIZED__VARIABLE, op] for l in locals]
body := ['PROGN, :lets, body]
@@ -798,9 +794,9 @@ mapRecurDepth(opName,opList,body) ==
analyzeUndeclaredMap(op,argTypes,mapDef,$mapList) ==
-- Computes the signature of the map named op, and compiles the body
- $freeVars:local := NIL
+ $freeVars: local := NIL
$localVars: local := NIL
- $env:local:= [[nil]]
+ $env: local:= [[nil]]
$mapList := [op,:$mapList]
parms:=[var for var in $FormalMapVariableList for m in argTypes]
for m in argTypes for var in parms repeat
@@ -1006,7 +1002,7 @@ findLocalVars1(op,form) ==
-- sets the two lists $localVars and $freeVars
atom form =>
not IDENTP form or isSharpVarWithNum form => nil
- isLocalVar(form) or isFreeVar(form) => nil
+ isLocallyBound form or isFreeVar form => nil
mkFreeVar($mapName,form)
form is ['local, :vars] =>
for x in vars repeat
@@ -1042,13 +1038,18 @@ findLocalVars1(op,form) ==
keyedSystemError("S2IM0020",[op])
findLocalsInLoop(op,itrl,body) ==
+ savedLocalVars := $localVars
+ iterVars := nil
for it in itrl repeat
it is ['STEP,index,lower,step,:upperList] =>
+ iterVars := [index,:iterVars]
mkLocalVar(op,index)
findLocalVars1(op,lower)
for up in upperList repeat findLocalVars1(op,up)
it is ['IN,index,s] =>
- mkLocalVar(op,index) ; findLocalVars1(op,s)
+ iterVars := [index,:iterVars]
+ mkLocalVar(op,index)
+ findLocalVars1(op,s)
it is ['WHILE,b] =>
findLocalVars1(op,b)
it is ['_|,pred] =>
@@ -1057,16 +1058,16 @@ findLocalsInLoop(op,itrl,body) ==
for it in itrl repeat
it is [op,b] and (op in '(UNTIL)) =>
findLocalVars1(op,b)
+ $localVars := setUnion(savedLocalVars,setDifference($localVars,iterVars))
-isLocalVar(var) == member(var,$localVars)
+isFreeVar(var) ==
+ member(var,$freeVars)
mkLocalVar(op,var) ==
-- add var to the local variable list
isFreeVar(var) => $localVars
$localVars:= insert(var,$localVars)
-isFreeVar(var) == member(var,$freeVars)
-
mkFreeVar(op,var) ==
-- op here for symmetry with mkLocalVar
$freeVars:= insert(var,$freeVars)
diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot
index 4164d514..ca70e66e 100644
--- a/src/interp/i-spec1.boot
+++ b/src/interp/i-spec1.boot
@@ -460,6 +460,7 @@ upCOLLECT1 t ==
putTarget(body,S)
$interpOnly => interpCOLLECT(op,itrl,body)
isStreamCollect itrl => collectStream(t,op,itrl,body)
+ $iteratorVars: local := nil
upLoopIters itrl
ms:= bottomUpCompile body
[m]:= ms
@@ -516,7 +517,7 @@ upLoopIterIN(iter,index,s) ==
iterMs isnt [['List,ud]] => throwKeyedMsg("S2IS0006",[index])
put(index,'mode,ud,$env)
- mkLocalVar('"the iterator expression",index)
+ mkIteratorVariable index
upLoopIterSTEP(index,lower,step,upperList) ==
null IDENTP index => throwKeyedMsg("S2IS0005",[index])
@@ -536,7 +537,7 @@ upLoopIterSTEP(index,lower,step,upperList) ==
else types := [stype, :types]
type := resolveTypeListAny removeDuplicates types
put(index,'mode,type,$env)
- mkLocalVar('"the iterator expression",index)
+ mkIteratorVariable index
evalCOLLECT(op,[:itrl,body],m) ==
iters := [evalLoopIter itr for itr in itrl]
@@ -690,7 +691,7 @@ upStreamIterIN(iter,index,s) ==
and (iterMs isnt [['InfinitTuple, ud]]) =>
throwKeyedMsg("S2IS0006",[index])
put(index,'mode,ud,$env)
- mkLocalVar('"the iterator expression",index)
+ mkIteratorVariable index
s :=
iterMs is [['List,ud],:.] =>
form:=[mkAtreeNode 'pretend, [mkAtreeNode 'COERCE,s,['Stream,ud]],
@@ -711,7 +712,7 @@ upStreamIterSTEP(index,lower,step,upperList) ==
put(index,'mode,type := resolveTT(ltype,stype),$env)
null type => throwKeyedMsg("S2IS0010", nil)
- mkLocalVar('"the iterator expression",index)
+ mkIteratorVariable index
s :=
null upperList =>
@@ -738,7 +739,7 @@ collectOneStream(t,op,itrl,body) ==
-- build stream collect for case of iterating over a single stream
-- In this case we don't need to build records
form := mkAndApplyPredicates itrl
- bodyVec := mkIterFun(first $indexVars,body,$localVars)
+ bodyVec := mkIterFun(first $indexVars,body)
form := [mkAtreeNode 'map,bodyVec,form]
bottomUp form
val := getValue form
@@ -756,20 +757,20 @@ mkAndApplyPredicates itrl ==
for iter in itrl repeat
iter is ['WHILE,pred] =>
fun := 'filterWhile
- predVec := mkIterFun(indSet,pred,$localVars)
+ predVec := mkIterFun(indSet,pred)
s := [mkAtreeNode fun,predVec,s]
iter is ['UNTIL,pred] =>
fun := 'filterUntil
- predVec := mkIterFun(indSet,pred,$localVars)
+ predVec := mkIterFun(indSet,pred)
s := [mkAtreeNode fun,predVec,s]
iter is ['SUCHTHAT,pred] =>
fun := 'select
putTarget(pred,$Boolean)
- predVec := mkIterFun(indSet,pred,$localVars)
+ predVec := mkIterFun(indSet,pred)
s := [mkAtreeNode fun,predVec,s]
s
-mkIterFun([index,:s],funBody,$localVars) ==
+mkIterFun([index,:s],funBody) ==
-- transform funBody into a lambda with index as the parameter
mode := objMode getValue s
mode isnt ['Stream, indMode] and mode isnt ['InfiniteTuple, indMode] =>
@@ -778,13 +779,14 @@ mkIterFun([index,:s],funBody,$localVars) ==
mkLocalVar($mapName,index)
[m]:=bottomUpCompile funBody
mapMode := ['Mapping,m,indMode]
+ -- Check generated code for free variables and pass them into the
+ -- lambda as part of envArg. Since only `index' is bound, every
+ -- other symbol in non-operator position is a free variable.
$freeVariables: local := []
$boundVariables: local := [index]
- -- CCL does not support upwards funargs, so we check for any free variables
- -- and pass them into the lambda as part of envArg.
- body := checkForFreeVariables(getValue funBody,$localVars)
+ body := checkForFreeVariables(objVal getValue funBody,"ALL")
parms := [index,"envArg"]
- val:=['function,['LAMBDA,parms,:declareUnusedParameters(parms,objVal body)]]
+ val:=['function,['LAMBDA,parms,:declareUnusedParameters(parms,body)]]
vec := mkAtreeNode gensym()
putValue(vec,objNew(['CONS,val,["VECTOR",:reverse $freeVariables]],mapMode))
vec
@@ -1146,7 +1148,7 @@ declare(var,mode) ==
nargs ~= #args => throwKeyedMsg("S2IM0008",[var])
if $compilingMap then mkLocalVar($mapName,var)
else clearDependencies(var,true)
- isLocalVar(var) => put(var,'mode,mode,$env)
+ isLocallyBound var => put(var,'mode,mode,$env)
mode is ['Mapping,:.] => declareMap(var,mode)
v := get(var,'value,$e) =>
-- only allow this if either
@@ -1168,7 +1170,8 @@ getAndEvalConstructorArgument tree ==
triple := getValue tree
objMode triple = '(Domain) => triple
isWrapped objVal(triple) => triple
- isLocalVar objVal triple => compFailure('" Local variable or parameter used in type")
+ isLocallyBound objVal triple =>
+ compFailure('" Local variable or parameter used in type")
objNewWrap(timedEVALFUN objVal(triple), objMode(triple))
replaceSharps(x,d) ==
@@ -1262,3 +1265,9 @@ deleteAll(x,l) ==
x = first(l) => deleteAll(x,rest l)
[first l,:deleteAll(x,rest l)]
+
+$iteratorVars := nil
+
+mkIteratorVariable id ==
+ $iteratorVars := [id,:$iteratorVars]
+ -- mkLocalVar('"the iterator expression",id)
diff --git a/src/interp/i-spec2.boot b/src/interp/i-spec2.boot
index 85035890..989ca1da 100644
--- a/src/interp/i-spec2.boot
+++ b/src/interp/i-spec2.boot
@@ -383,18 +383,18 @@ evalis(op,[a,pattern],mode) ==
putValue(op,triple)
isLocalPred pattern ==
- -- returns true if the is predicate is to be compiled
+ -- returns true if this predicate is to be compiled
for pat in pattern repeat
- IDENTP pat and isLocalVar(pat) => return true
- pat is [":",var] and isLocalVar(var) => return true
- pat is ["=",var] and isLocalVar(var) => return true
+ IDENTP pat and isLocallyBound pat => return true
+ pat is [":",var] and isLocallyBound var => return true
+ pat is ["=",var] and isLocallyBound var => return true
compileIs(val,pattern) ==
-- produce code for compiled "is" predicate. makes pattern variables
-- into local variables of the function
vars:= NIL
for pat in rest pattern repeat
- IDENTP(pat) and isLocalVar(pat) => vars:=[pat,:vars]
+ IDENTP(pat) and isLocallyBound pat => vars:=[pat,:vars]
pat is [":",var] => vars:= [var,:vars]
pat is ["=",var] => vars:= [var,:vars]
predCode:=["%LET",g:=gensym(),["isPatternMatch",
@@ -567,7 +567,7 @@ evalLETput(lhs,value) ==
name:= getUnname lhs
if not $genValue then
code:=
- isLocalVar(name) =>
+ isLocallyBound name =>
om := objMode(value)
dm := get(name,'mode,$env)
dm and not ((om = dm) or isSubDomain(om,dm) or
@@ -584,7 +584,7 @@ evalLETput(lhs,value) ==
['unwrap,['evalLETchangeValue,MKQ name,
objNewCode(['wrap,objVal value],objMode value)]]
value:= objNew(code,objMode value)
- isLocalVar(name) =>
+ isLocallyBound name =>
if not get(name,'mode,$env) then put(name,'autoDeclare,'T,$env)
put(name,'mode,objMode(value),$env)
put(name,'automode,objMode(value),$env)
@@ -621,7 +621,7 @@ evalLETchangeValue(name,value) ==
objMode val ~= objMode(value)
if clearCompilationsFlag then
clearDependencies(name,true)
- if localEnv and isLocalVar(name)
+ if localEnv and isLocallyBound name
then $env:= putHist(name,'value,value,$env)
else putIntSymTab(name,'value,value,$e)
objVal value
@@ -745,7 +745,7 @@ isType t ==
argTypes := [isType type for type in rest t]
"or"/[null type for type in argTypes] => nil
['Mapping, :argTypes]
- isLocalVar(op) => NIL
+ isLocallyBound op => NIL
d := isDomainValuedVariable op => d
type:=
-- next line handles subscripted vars
@@ -763,7 +763,7 @@ upLETtype(op,lhs,type) ==
compFailure ['" Cannot compile type assignment to",:bright opName]
mode := conceptualType type
val:= objNew(type,mode)
- if isLocalVar(opName) then put(opName,'value,val,$env)
+ if isLocallyBound opName then put(opName,'value,val,$env)
else putHist(opName,'value,val,$e)
putValue(op,val)
-- have to fix the following
@@ -934,6 +934,7 @@ upREPEAT1 t ==
$interpOnly => interpREPEAT(op,itrl,body,repeatMode)
-- analyze iterators and loop body
+ $iteratorVars: local := nil
upLoopIters itrl
bottomUpCompile body
diff --git a/src/interp/i-util.boot b/src/interp/i-util.boot
index cb81359f..9a100a3e 100644
--- a/src/interp/i-util.boot
+++ b/src/interp/i-util.boot
@@ -172,3 +172,7 @@ extractCONDClauses clauses ==
[[pred1,:act1],:restClauses]
[[''T,clauses]]
+++ Returns true if symbol `id' is either a local variable
+++ or an iterator variable.
+isLocallyBound id ==
+ id in $localVars or id in $iteratorVars
diff --git a/src/interp/slam.boot b/src/interp/slam.boot
index 3c94696e..a2c2c778 100644
--- a/src/interp/slam.boot
+++ b/src/interp/slam.boot
@@ -174,13 +174,13 @@ reportFunctionCompilation(op,nam,argl,body,isRecursive) ==
g3:= gensym() --value computed by calling function
secondPredPair:=
null argl => [cacheName]
- [['SETQ,g3,['assocCircular,g1,cacheName]],['CDR,g3]]
+ [["%store",g3,['assocCircular,g1,["%dynval",MKQ cacheName]]],['CDR,g3]]
thirdPredPair:=
- null argl => ['(QUOTE T),['SETQ,cacheName,computeValue]]
+ null argl => ['(QUOTE T),[["%store",["%dynval",MKQ cacheName],computeValue]]]
['(QUOTE T),
["SETQ",g2,computeValue],
["SETQ",g3,
- ["CAR",["SETQ",cacheName,['predCircular,cacheName,cacheCount]]]],
+ ["CAR",["%store",["%dynval",MKQ cacheName],['predCircular,["%dynval",cacheName],cacheCount]]]],
["RPLACA",g3,g1],
["RPLACD",g3,g2],
g2]
@@ -219,8 +219,8 @@ reportFunctionCacheAll(op,nam,argl,body) ==
if null argl then g1:=nil
cacheName:= mkCacheName nam
g2:= gensym() --value computed by calling function
- secondPredPair:= [["SETQ",g2,["HGET",cacheName,g1]],g2]
- thirdPredPair:= ['(QUOTE T),["HPUT",cacheName,g1,computeValue]]
+ secondPredPair:= [["SETQ",g2,["HGET",["%dynval",MKQ cacheName],g1]],g2]
+ thirdPredPair:= ['(QUOTE T),["HPUT",["%dynval",MKQ cacheName],g1,computeValue]]
codeBody:= ["PROG",[g2],["RETURN",["COND",secondPredPair,thirdPredPair]]]
lamex:= ["LAM",arg,codeBody]
mainFunction:= [nam,lamex]
@@ -230,7 +230,7 @@ reportFunctionCacheAll(op,nam,argl,body) ==
compileInteractive mainFunction
compileInteractive computeFunction
cacheType:= 'hash_-table
- cacheResetCode:= ["SETQ",cacheName,['hashTable,''EQUAL]]
+ cacheResetCode:= ["%store",["%dynval",MKQ cacheName],['hashTable,''EQUAL]]
cacheCountCode:= ['hashCount,cacheName]
cacheVector:=
mkCacheVec(op,cacheName,cacheType,cacheResetCode,cacheCountCode)
@@ -437,5 +437,4 @@ clearAllSlams x ==
NCONC(thoseToClear,someMoreToClear)
clearSlam("functor")==
- id:= mkCacheName functor
- setDynamicBinding(id,nil)
+ setDynamicBinding(mkCacheName functor,nil)
diff --git a/src/interp/sys-macros.lisp b/src/interp/sys-macros.lisp
index d0f934ad..34ad5fcc 100644
--- a/src/interp/sys-macros.lisp
+++ b/src/interp/sys-macros.lisp
@@ -371,7 +371,7 @@
(the (values t) (funcall (car ,gi) ,@args (cdr ,gi))))))
(defmacro |eval| (form)
- `(EVAL ,form))
+ `(EVAL (|expandToVMForm| ,form)))
;;
;; -*- Arithmetics -*-