diff options
author | dos-reis <gdr@axiomatics.org> | 2011-05-19 17:02:42 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-05-19 17:02:42 +0000 |
commit | 5c4ff220c3ba9a37ffaf875e218c36ae0a436631 (patch) | |
tree | fa3160f03e36c6630c8a21e9ad0d9db035bc6d48 | |
parent | ef1f327becb0cc095e887dcfe98f9e390d225ed8 (diff) | |
download | open-axiom-5c4ff220c3ba9a37ffaf875e218c36ae0a436631.tar.gz |
* interp/i-analy.boot (bottomUpForm0): Tidy.
* interp/i-eval.boot (evalForm): Likewise.
* interp/buildom.boot (formalRecordField): New.
(eltRecordFun): Use it.
(seteltRecordFun): New.
* interp/g-opt.boot (optSETRECORDELT): Remove.
(optRECORDCOPY): Likewise.
* interp/vmlisp.lisp (MAKE-VEC): Likewise.
-rw-r--r-- | src/ChangeLog | 11 | ||||
-rw-r--r-- | src/interp/buildom.boot | 33 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 18 | ||||
-rw-r--r-- | src/interp/i-analy.boot | 10 | ||||
-rw-r--r-- | src/interp/i-eval.boot | 2 | ||||
-rw-r--r-- | src/interp/vmlisp.lisp | 2 |
6 files changed, 33 insertions, 43 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c4881406..52661c0a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2011-05-19 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/i-analy.boot (bottomUpForm0): Tidy. + * interp/i-eval.boot (evalForm): Likewise. + * interp/buildom.boot (formalRecordField): New. + (eltRecordFun): Use it. + (seteltRecordFun): New. + * interp/g-opt.boot (optSETRECORDELT): Remove. + (optRECORDCOPY): Likewise. + * interp/vmlisp.lisp (MAKE-VEC): Likewise. + +2011-05-19 Gabriel Dos Reis <gdr@cs.tamu.edu> + * interp/i-eval.boot (evalForm): Adjust. * interp/buildom.boot (mkRecordFun): New. (eltRecordFun): Likewise. diff --git a/src/interp/buildom.boot b/src/interp/buildom.boot index 2db25403..5e666fcf 100644 --- a/src/interp/buildom.boot +++ b/src/interp/buildom.boot @@ -573,7 +573,6 @@ constructorCategory (title is [op,:.]) == canonicalForm(cat) := title cat ---mkMappingFunList(nam,mapForm,e) == [[],e] mkMappingFunList(nam,mapForm,e) == nargs := #rest mapForm dc := gensym() @@ -595,16 +594,27 @@ mkRecordFun n == '%vector ["XLAM",args,[op,:args]] +++ Build expression for selecting the i-th field of a fomal record +++ variable of length `n'. +formalRecordField(n,i) == + n < 2 => ['%head,"#1"] + n = 2 => + i = 0 => ['%head,"#1"] + ['%tail,"#1"] + ['%vref,"#1",i] + ++ Build an inline function for selecting field `i' or a ++ record of length `n'. eltRecordFun(n,i) == - body := - n < 2 => ['%head,"#1"] - n = 2 => - i = 0 => ['%head,"#1"] - ['%tail,"#1"] - ['%vref,"#1",i] - ["XLAM",["#1","#2"],body] + ["XLAM",["#1","#2"],formalRecordField(n,i)] + +seteltRecordFun(n,i) == + args := take(3,$FormalMapVariableList) + field := formalRecordField(n,i) + body := + n > 2 => ['%store,field,"#3"] + ['SEQ,['%store,field,"#3"],['EXIT,field]] + ["XLAM",args,body] copyRecordFun n == body := @@ -624,10 +634,9 @@ mkRecordFunList(nam,["Record",:Alist],e) == ["coerce",[$OutputForm,nam],["ELT",dc,$FirstParamSlot+len+1]],: [["elt",[A,nam,PNAME a],eltRecordFun(len,i)] for i in 0.. for [.,a,A] in Alist],: - [["setelt",[A,nam,PNAME a,A],["XLAM",["$1","$2","$3"], - ["SETRECORDELT","$1",i, len,"$3"]]] - for i in 0.. for [.,a,A] in Alist],: - [["copy",[nam,nam],copyRecordFun len]]] + [["setelt",[A,nam,PNAME a,A],seteltRecordFun(len,i)] + for i in 0.. for [.,a,A] in Alist], + ["copy",[nam,nam],copyRecordFun len]] [substitute(nam,dc,substituteDollarIfRepHack sigFunAlist),e] mkNewUnionFunList(name,form is ["Union",:listOfEntries],e) == diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index b37b942c..39223218 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -392,21 +392,6 @@ optSEQ ["SEQ",:l] == l is ["SEQ",[op,a]] and op in '(EXIT RETURN THROW) => a l -optSETRECORDELT ["SETRECORDELT",name,ind,len,expr] == - len=1 => - ind = 0 => ['SEQ,['%store,['%head,name],expr],['EXIT,['%head,name]]] - keyedSystemError("S2OO0002",[ind]) - len=2 => - ind = 0 => ['SEQ,['%store,['%head,name],expr],['EXIT,['%head,name]]] - ind = 1 => ['SEQ,['%store,['%tail,name],expr],['EXIT,['%tail,name]]] - keyedSystemError("S2OO0002",[ind]) - ['%store,['%vref,name,ind],expr] - -optRECORDCOPY ["RECORDCOPY",name,len] == - len = 1 => ['%list,['%head,name]] - len = 2 => ['%pair,['%head,name],['%tail,name]] - ["REPLACE",["MAKE_-VEC",len],name] - optSuchthat [.,:u] == ["SUCHTHAT",:u] ++ List of VM side effect free operators. @@ -813,8 +798,7 @@ for x in '( (%call optCall) _ (CATCH optCatch)_ (%when optCond)_ (%retract optRetract)_ - (%CollectV optCollectVector)_ - (SETRECORDELT optSETRECORDELT)) _ + (%CollectV optCollectVector)) _ repeat property(first x,'OPTIMIZE) := second x --much quicker to call functions if they have an SBC diff --git a/src/interp/i-analy.boot b/src/interp/i-analy.boot index 9edac053..6fea2735 100644 --- a/src/interp/i-analy.boot +++ b/src/interp/i-analy.boot @@ -598,16 +598,6 @@ bottomUpForm0(t,op,opName,argl,argModeSetList) == m := isType t => bottomUpType(t, m) - opName = 'copy and argModeSetList is [[['Record,:rargs]]] => - -- this is a hack until Records go through the normal - -- modemap selection process - rtype := ['Record,:rargs] - code := optRECORDCOPY(['RECORDCOPY,getArgValue(first argl, rtype),#rargs]) - - val := object(code,rtype) - putValue(t,val) - putModeSet(t,[rtype]) - m := getModeOrFirstModeSetIfThere op m is ['Record,:.] and argModeSetList is [[['Variable,x]]] and member(x,getUnionOrRecordTags m) and (u := bottomUpElt t) => u diff --git a/src/interp/i-eval.boot b/src/interp/i-eval.boot index faf20da6..b8984de1 100644 --- a/src/interp/i-eval.boot +++ b/src/interp/i-eval.boot @@ -239,8 +239,6 @@ evalForm(op,opName,argl,mmS) == ['SPADCALL,:form,freeFun] fun is ['XLAM,xargs,:xbody] => rec := first form - xbody is [['SETRECORDELT,.,ind,len,.]] => - optSETRECORDELT([CAAR xbody,rec,ind,len,third form]) ['FUNCALL,['function , ['LAMBDA,xargs,:xbody]],:TAKE(#xargs, form)] dcVector := evalDomain dc fun0 := diff --git a/src/interp/vmlisp.lisp b/src/interp/vmlisp.lisp index 4159b32d..0f3d1f2f 100644 --- a/src/interp/vmlisp.lisp +++ b/src/interp/vmlisp.lisp @@ -782,8 +782,6 @@ ; 16.1 Creation -(defun MAKE-VEC (n) (make-array n)) - (defun GETREFV (n) (make-array n :initial-element nil)) |