diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 5 | ||||
-rw-r--r-- | src/interp/compiler.boot | 12 | ||||
-rw-r--r-- | src/interp/nruncomp.boot | 25 |
3 files changed, 23 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f6fe5c1c..8a01b9fb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-11-26 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/nruncomp.boot (genDeltaEntry): Split first argument into + separate arguments (operation and modemap). Adjust callers. + +2011-11-26 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/c-util.boot (updateCapsuleDirectory): Simplify. * interp/define.boot (compDefineCapsuleFunction): Call it from here. * interp/functor.boot (DescendCode): Not here. diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index b3743845..1b5fbe75 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1327,7 +1327,7 @@ compElt(form,m,E) == mmList.0 [sig,[pred,val]]:= modemap #sig ~= 2 and val isnt ["CONST",:.] => nil - val := genDeltaEntry([opOf anOp,:modemap],E) + val := genDeltaEntry(opOf anOp,modemap,E) coerce([['%call,val],second sig,E], m) compForm(form,m,E) @@ -1649,7 +1649,7 @@ compCase1(x,m,e) == | mm.mmSignature is [=$Boolean,s,t] and modeEqual(maybeSpliceMode t,m) and modeEqual(s,m')] or return nil fn := (or/[mm for mm in u | mm.mmCondition = true]) or return nil - fn := genDeltaEntry(["case",:fn],e) + fn := genDeltaEntry("case",fn,e) [['%call,fn,x',MKQ m],$Boolean,e'] @@ -1918,7 +1918,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],e) + fn := genDeltaEntry('coerce,mm,e) [['%call,fn,x],m',e] autoCoerceByModemap([x,source,e],target) == @@ -1930,11 +1930,11 @@ autoCoerceByModemap([x,source,e],target) == source is ["Union",:l] and listMember?(target,l) => (y:= get(x,"condition",e)) and (or/[u is ["case",., =target] for u in y]) - => [['%call,genDeltaEntry(["autoCoerce", :fn],e),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],e),x],target,e] + [['%call,genDeltaEntry("autoCoerce",fn,e),x],target,e] ++ Compile a comma separated expression list. These typically are @@ -2031,7 +2031,7 @@ compViableModemap(op,argTl,mm,e) == -- 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],e),argTl] + [genDeltaEntry(op,mm,e),argTl] [f,argTl] compApplyModemap(form,modemap,$e) == diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index e12fc240..e4caf564 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -157,7 +157,7 @@ needToQuoteFlags?(sig,env) == selector?(t,e) == ident? t and null get(t,"value",e) -optDeltaEntry(op,sig,dc,eltOrConst) == +optDeltaEntry(op,sig,dc,kind) == $killOptimizeIfTrue => nil -- references to modemaps from current domain are folded in a later -- stage of the compilation process. @@ -184,7 +184,6 @@ optDeltaEntry(op,sig,dc,eltOrConst) == fun is ['makeSpadConstant,:.] and (fun' := getFunctionReplacement second fun) => return fun' - --eltOrConst = 'CONST => return ['XLAM,nil, SPADCALL fun] cons? fun => first fun fun getFunctionReplacement fun @@ -193,13 +192,12 @@ optDeltaEntry(op,sig,dc,eltOrConst) == ++ slot number in the template vector. $onlyAbstractSlot := false -genDeltaEntry(opMmPair,e) == ---called from compApplyModemap - [op,[dc,:sig],[.,cform:=[eltOrConst,.,nsig]]] := opMmPair +genDeltaEntry(op,mm,e) == + [[dc,:sig],[.,cform:=[kind,.,nsig]]] := mm if $profileCompiler then profileRecord(dc,op,sig) - eltOrConst is 'XLAM => cform - if eltOrConst is 'Subsumed then eltOrConst := 'ELT - $onlyAbstractSlot => [eltOrConst,'$,[op,[dc,:sig]]] + kind is 'XLAM => cform + if kind is 'Subsumed then kind := 'ELT + $onlyAbstractSlot => [kind,'$,[op,[dc,:sig]]] db := constructorDB currentConstructor e if dc isnt [.,:.] then dc = "$" => nsig := sig @@ -212,21 +210,22 @@ genDeltaEntry(opMmPair,e) == dc := substitute("$$","$",dc) opModemapPair := [op,[dc,:[getLocalIndex(db,x) for x in nsig]],["T",cform]] -- force pred to T - if null NRTassocIndex(db,dc) and - (member(dc,$functorLocalParameters) or cons? dc) then - --create "%domain" entry to dbUsedEntities + if NRTassocIndex(db,dc) = nil and (dc is [.,:.] or + ident? dc and symbolMember?(dc,$functorLocalParameters)) then + -- This modemap's domain of computation did not contributte an + -- an operation before; give it a slot before the modemap itself. entry := [["%domain",NRTaddInner(db,dc)]] dbUsedEntities(db) := [entry,:dbUsedEntities db] dbEntityCount(db) := dbEntityCount db + 1 entry.rest := compOrCroak(odc,$EmptyMode,e).expr u := - [eltOrConst,'$,index] where index() == + [kind,'$,index] where index() == n := dbEntitySlot(db,opModemapPair) => n n := dbEntityCount db + $NRTbase dbUsedEntities(db) := [[opModemapPair],:dbUsedEntities db] dbEntityCount(db) := dbEntityCount db + 1 n - impl := optDeltaEntry(op,nsig,odc,eltOrConst) => impl + impl := optDeltaEntry(op,nsig,odc,kind) => impl u ++ Return the slot number (within the template vector of the functor |