aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-03-10 09:02:58 +0000
committerdos-reis <gdr@axiomatics.org>2010-03-10 09:02:58 +0000
commit6844898e025e87c3d6753d648a65fe4a82b8bc55 (patch)
tree8337810e54a19623ecca05419f8e36bc7b73ffba /src/interp
parentc4e4529187db6e0aba25f8af43cf7be4cc15386e (diff)
downloadopen-axiom-6844898e025e87c3d6753d648a65fe4a82b8bc55.tar.gz
* interp/nruncomp.boot (genDeltaEntry): Take a second, environment
argument. Pass to compOrCroak. * interp/compiler.boot (compElt): Adjust call to genDeltaEntry. (compCase1): Likewise. (coerceByModemap): Likewise. (autoCoerceByModemap): Likewise. (compCat): Likewise. (compViableModemap): Take an additional environment argument. Pass it to genDeltaEntry. (compApplyModemap): Adjust call to compViableModemap. (compResolveCall): Likewise.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/compiler.boot19
-rw-r--r--src/interp/nruncomp.boot4
-rw-r--r--src/interp/wi1.boot2
-rw-r--r--src/interp/wi2.boot6
4 files changed, 15 insertions, 16 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 12e8f363..36c75a74 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -1154,7 +1154,7 @@ compElt(form,m,E) ==
mmList.(0)
[sig,[pred,val]]:= modemap
#sig ~= 2 and val isnt ["CONST",:.] => nil
- val := genDeltaEntry [opOf anOp,:modemap]
+ val := genDeltaEntry([opOf anOp,:modemap],E)
convert([["call",val],second sig,E], m)
compForm(form,m,E)
@@ -1515,7 +1515,7 @@ compCase1(x,m,e) ==
| map is [.,=$Boolean,s,t] and modeEqual(maybeSpliceMode t,m)
and modeEqual(s,m')] or return nil
fn:= (or/[mm for (mm := [.,[cond,selfn]]) in u | cond=true]) or return nil
- fn := genDeltaEntry ["case",:fn]
+ fn := genDeltaEntry(["case",:fn],e)
-- user-defined `case' functions really are binary, as opposed to
-- the compiler-synthetized versions for Union instances.
not isUnionMode(m',e') => [["call",fn,x',MKQ m],$Boolean,e']
@@ -1798,8 +1798,7 @@ coerceByModemap([x,m,e],m') ==
--mm:= (or/[mm for (mm:=[.,[cond,.]]) in u | cond=true]) or return nil
mm:=first u -- patch for non-trival conditons
- fn :=
- genDeltaEntry ['coerce,:mm]
+ fn := genDeltaEntry(['coerce,:mm],e)
[["call",fn,x],m',e]
autoCoerceByModemap([x,source,e],target) ==
@@ -1812,11 +1811,11 @@ autoCoerceByModemap([x,source,e],target) ==
source is ["Union",:l] and member(target,l) =>
(y:= get(x,"condition",e)) and (or/[u is ["case",., =target] for u in y])
- => [["call",genDeltaEntry ["autoCoerce", :fn],x],target,e]
+ => [["call",genDeltaEntry(["autoCoerce", :fn],e),x],target,e]
x="$fromCoerceable$" => nil
stackMessage('"cannot coerce %1b of mode %2pb to %3pb without a case statement",
[x,source,target])
- [["call",genDeltaEntry ["autoCoerce", :fn],x],target,e]
+ [["call",genDeltaEntry(["autoCoerce", :fn],e),x],target,e]
++ Compile a comma separated expression list. These typically are
@@ -1898,7 +1897,7 @@ compCat(form is [functorName,:argl],m,e) ==
++ `op' has been selected as a viable candidate exported operation,
++ for argument triple list `argTl', modemap `mm'.
++ Return the most refined implementation that makes the call successful.
-compViableModemap(op,argTl,mm) ==
+compViableModemap(op,argTl,mm,e) ==
[[dc,.,:margl],fnsel] := mm
-- 1. Give up if the call is hopeless.
argTl := [coerce(x,m) or return "failed" for x in argTl for m in margl]
@@ -1913,7 +1912,7 @@ compViableModemap(op,argTl,mm) ==
-- information which is no longer valid; thus ignore this index and
-- store the signature instead.
f is [op1,.,.] and op1 in '(ELT CONST Subsumed) =>
- [genDeltaEntry [op,:mm],argTl]
+ [genDeltaEntry([op,:mm],e),argTl]
[f,argTl]
compApplyModemap(form,modemap,$e) ==
@@ -1933,7 +1932,7 @@ compApplyModemap(form,modemap,$e) ==
lt="failed" => return nil
-- 2. Select viable modemap implementation.
- compViableModemap(op,lt,modemap)
+ compViableModemap(op,lt,modemap,$e)
compMapCond': (%Form,%Mode) -> %Boolean
compMapCond'(cexpr,dc) ==
@@ -1965,7 +1964,7 @@ compResolveCall(op,argTs,m,$e) ==
[t for mm in getModemapList(op,#argTs,$e) | t := tryMM] where
tryMM() ==
not coerceable(mm.mmTarget,m,$e) =>nil
- compViableModemap(op,argTs,mm) isnt [f,Ts] => nil
+ compViableModemap(op,argTs,mm,$e) isnt [f,Ts] => nil
coerce([["call",f,:[T.expr for T in Ts]],mm.mmTarget,$e],m)
#outcomes ~= 1 => nil
first outcomes
diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot
index 3b1dd8e3..69a50c7a 100644
--- a/src/interp/nruncomp.boot
+++ b/src/interp/nruncomp.boot
@@ -188,7 +188,7 @@ optDeltaEntry(op,sig,dc,eltOrConst) ==
fun := first fun
getFunctionReplacement compileTimeBindingOf fun
-genDeltaEntry opMmPair ==
+genDeltaEntry(opMmPair,e) ==
--called from compApplyModemap
--$NRTdeltaLength=0.. always equals length of $NRTdeltaList
[op,[dc,:sig],[.,cform:=[eltOrConst,.,nsig]]] := opMmPair
@@ -212,7 +212,7 @@ genDeltaEntry opMmPair ==
$NRTdeltaList:= [["%domain",NRTaddInner dc],:$NRTdeltaList]
saveNRTdeltaListComp:= $NRTdeltaListComp:=[nil,:$NRTdeltaListComp]
$NRTdeltaLength := $NRTdeltaLength+1
- compEntry:= (compOrCroak(odc,$EmptyMode,$e)).expr
+ compEntry:= (compOrCroak(odc,$EmptyMode,e)).expr
RPLACA(saveNRTdeltaListComp,compEntry)
u :=
[eltOrConst,'$,$NRTbase+$NRTdeltaLength-index] where index() ==
diff --git a/src/interp/wi1.boot b/src/interp/wi1.boot
index 09e160f8..172c6b2e 100644
--- a/src/interp/wi1.boot
+++ b/src/interp/wi1.boot
@@ -933,7 +933,7 @@ coerceByModemap([x,m,e],m') ==
s] and (modeEqual(t,m') or isSubset(t,m',e))
and (modeEqual(s,m) or isSubset(m,s,e))] or return nil
mm:=first u -- patch for non-trival conditons
- fn := genDeltaEntry ['coerce,:mm]
+ fn := genDeltaEntry(['coerce,:mm],e)
T := [["call",fn,x],m',e]
markCoerceByModemap(x,m,m',markCallCoerce(x,m',T),nil)
diff --git a/src/interp/wi2.boot b/src/interp/wi2.boot
index 7e9e99a5..c66763cf 100644
--- a/src/interp/wi2.boot
+++ b/src/interp/wi2.boot
@@ -583,7 +583,7 @@ compElt(origForm,m,E) ==
[sig,[pred,val]]:= modemap
#sig~=2 and val isnt ["CONST",:.] => nil
--+
- val := genDeltaEntry [opOf anOp,:modemap]
+ val := genDeltaEntry([opOf anOp,:modemap],E)
x := markTran(origForm,[val],sig,[E])
[x,second sig,E] --implies fn calls used to access constants
compForm(origForm,m,E)
@@ -630,7 +630,7 @@ compApplyModemap(form,modemap,$e) ==
--$NRTflag=true and f is [op1,d,.] and NE(d,'$) and member(op1,'(ELT CONST)) =>
f is [op1,d,.] and op1 in '(ELT CONST Subsumed) =>
- [genDeltaEntry [op,:modemap],lt',$bindings]
+ [genDeltaEntry([op,:modemap],$e),lt',$bindings]
markImport mc
[f,lt',$bindings]
@@ -693,7 +693,7 @@ optDeltaEntry(op,sig,dc,eltOrConst) ==
-- ['XLAM,'ignore,MKQ SPADCALL fn]
getFunctionReplacement compileTimeBindingOf first fn
-genDeltaEntry opMmPair ==
+genDeltaEntry(opMmPair,e) ==
--called from compApplyModemap
--$NRTdeltaLength=0.. always equals length of $NRTdeltaList
[.,[odc,:.],.] := opMmPair