diff options
author | dos-reis <gdr@axiomatics.org> | 2011-01-26 05:06:32 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-01-26 05:06:32 +0000 |
commit | f739a0a8d77e564cf9a7853b0f135c99b45ff831 (patch) | |
tree | fbd1d273b02e5e5829b43e69155502416d53cda8 /src/interp | |
parent | 5bcd66d747349ff167ffcd3953c95faf08aa8c1e (diff) | |
download | open-axiom-f739a0a8d77e564cf9a7853b0f135c99b45ff831.tar.gz |
* interp/compiler.boot (compForm1): Use %listlit form.
(compExpressionList): Likewise.
(compCons1): Likewise.
(compList): Likewise.
(compVector): Likewise.
* interp/g-timer.boot (timedEvaluate): Likewise.
* interp/wi1.boot: Likewise.
* interp/slam.boot: Likewise.
* interp/nruncomp.boot: Likewise.
* interp/i-object.boot: Likewise.
* interp/g-opt.boot (optMkRecord): Likewise.
(optRECORDCOPY): Likewise.
(optLIST): Remove.
(optListlit): New.
* interp/g-util.boot (optListlit): New. Expand %listlit forms.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/compiler.boot | 12 | ||||
-rw-r--r-- | src/interp/g-opt.boot | 10 | ||||
-rw-r--r-- | src/interp/g-timer.boot | 6 | ||||
-rw-r--r-- | src/interp/g-util.boot | 19 | ||||
-rw-r--r-- | src/interp/i-object.boot | 4 | ||||
-rw-r--r-- | src/interp/nruncomp.boot | 4 | ||||
-rw-r--r-- | src/interp/slam.boot | 8 | ||||
-rw-r--r-- | src/interp/wi1.boot | 2 |
8 files changed, 35 insertions, 30 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 36d29900..635e4879 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2011, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -525,7 +525,7 @@ compForm1(form is [op,:argl],m,e) == compExpressionList(argl,m,e) == Tl:= [[.,.,e]:= comp(x,$Expression,e) or return "failed" for x in argl] Tl="failed" => nil - convert([["LIST",:[y.expr for y in Tl]],$Expression,e],m) + convert([['%listlit,:[y.expr for y in Tl]],$Expression,e],m) compForm2(form is [op,:argl],m,e,modemapList) == sargl:= TAKE(# argl, $TriangleVariableList) @@ -769,14 +769,14 @@ compCons(form,m,e) == compCons1(form,m,e) or compForm(form,m,e) compCons1(["CONS",x,y],m,e) == [x,mx,e]:= comp(x,$EmptyMode,e) or return nil - null y => convert([["LIST",x],["List",mx],e],m) + null y => convert([['%listlit,x],["List",mx],e],m) yt:= [y,my,e]:= comp(y,$EmptyMode,e) or return nil T:= my is ["List",m',:.] => mr:= ["List",resolve(m',mx) or return nil] yt':= convert(yt,mr) or return nil [x,.,e]:= convert([x,mx,yt'.env],second mr) or return nil - yt'.expr is ["LIST",:.] => [["LIST",x,:rest yt'.expr],mr,e] + yt'.expr is ['%listlit,:.] => [['%listlit,x,:rest yt'.expr],mr,e] [["CONS",x,yt'.expr],mr,e] [["CONS",x,y],["Pair",mx,my],e] convert(T,m) @@ -982,14 +982,14 @@ compList(l,m is ["List",mUnder],e) == null l => [NIL,m,e] Tl:= [[.,mUnder,e]:= comp(x,mUnder,e) or return "failed" for x in l] Tl="failed" => nil - T:= [["LIST",:[T.expr for T in Tl]],["List",mUnder],e] + T:= [['%listlit,:[T.expr for T in Tl]],["List",mUnder],e] compVector: (%Form,%Mode,%Env) -> %Maybe %Triple compVector(l,m is ["Vector",mUnder],e) == Tl:= [[.,mUnder,e]:= comp(x,mUnder,e) or return "failed" for x in l] Tl="failed" => nil [["MAKE-ARRAY", #Tl, KEYWORD::ELEMENT_-TYPE, quoteForm getVMType mUnder, - KEYWORD::INITIAL_-CONTENTS, ["LIST", :[T.expr for T in Tl]]],m,e] + KEYWORD::INITIAL_-CONTENTS, ['%listlit, :[T.expr for T in Tl]]],m,e] --% MACROS diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot index 718c06aa..b0211eb4 100644 --- a/src/interp/g-opt.boot +++ b/src/interp/g-opt.boot @@ -296,7 +296,7 @@ compileTimeBindingOf u == name optMkRecord ["mkRecord",:u] == - u is [x] => ["LIST",x] + u is [x] => ['%listlit,x] #u=2 => ['%makepair,:u] ["VECTOR",:u] @@ -420,7 +420,7 @@ optSETRECORDELT ["SETRECORDELT",name,ind,len,expr] == ['%store,['%vref,name,ind],expr] optRECORDCOPY ["RECORDCOPY",name,len] == - len = 1 => ["LIST",['%head,name]] + len = 1 => ['%listlit,['%head,name]] len = 2 => ['%makepair,['%head,name],['%tail,name]] ["REPLACE",["MAKE_-VEC",len],name] @@ -605,8 +605,8 @@ optTry form == form isnt ['try,e,hs,f] or not(isFloatableVMForm e) or f ~= nil => form e -optLIST form == - form is ["LIST"] => nil +optListlit form == + form is ['%listlit] => nil form optCollectVector form == @@ -794,7 +794,7 @@ for x in '( (%call optCall) _ (%imul optImul)_ (%2bit opt2bit)_ (%2bool opt2bool)_ - (LIST optLIST)_ + (%listlit optListlit)_ (QSMINUS optQSMINUS)_ (SPADCALL optSPADCALL)_ (_| optSuchthat)_ diff --git a/src/interp/g-timer.boot b/src/interp/g-timer.boot index 786ab65d..7acf5804 100644 --- a/src/interp/g-timer.boot +++ b/src/interp/g-timer.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2011, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -260,8 +260,8 @@ timedEVALFUN(code) == r timedEvaluate code == - code is ["LIST",:a] and #a > 200 => - "append"/[eval ["LIST",:x] for x in splitIntoBlocksOf200 a] + code is ['%listlit,:a] and #a > 200 => + "append"/[eval ['%listlit,:x] for x in splitIntoBlocksOf200 a] eval code displayHeapStatsIfWanted() == diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 38882026..95b36c06 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -247,6 +247,12 @@ expandCollect ['%collect,:iters,body] == -- in reverse order. expandLoop ['%loop,:iters,["%init",val,nil],body,["NREVERSE",val]] +expandListlit(x is ['%listlit,:args]) == + args := [expandToVMForm arg for arg in args] + args = nil => nil + and/[integer? arg or string? arg for arg in args] => quoteForm args + ['LIST,:args] + expandReturn(x is ['%return,.,y]) == $FUNNAME = nil => systemErrorHere ['expandReturn,x] ['RETURN_-FROM,$FUNNAME,expandToVMForm y] @@ -560,7 +566,6 @@ for x in [ ['%lthird, :'CADDR], ['%pair?, :'CONSP], ['%tail, :'CDR], - ['%listlit, :'LIST], -- binary list operations ['%lconcat, :'APPEND], @@ -593,6 +598,7 @@ for x in [ ++ Table of opcode-expander pairs. for x in [ + ['%listlit, :function expandListlit], ['%collect, :function expandCollect], ['%loop, :function expandLoop], ['%return, :function expandReturn], @@ -701,7 +707,6 @@ isSharpVarWithNum x == atomic? x == not cons? x or x.op = 'QUOTE - --% Sub-domains information handlers ++ If `dom' is a subdomain, return its immediate super-domain. @@ -767,7 +772,7 @@ isSubDomain(d1,d2) == --% mkList u == - u => ["LIST",:u] + u => ['%listlit,:u] nil ELEMN(x, n, d) == @@ -1183,11 +1188,11 @@ isLetter c == -- the key function extracts the key from an item for comparison by pred listSort(pred,list,:optional) == - NOT functionp pred => error "listSort: first arg must be a function" - NOT LISTP list => error "listSort: second argument must be a list" - null optional => mergeSort(pred,function Identity,list,# list) + not functionp pred => error "listSort: first arg must be a function" + not LISTP list => error "listSort: second argument must be a list" + optional = nil => mergeSort(pred,function Identity,list,# list) key := first optional - NOT functionp key => error "listSort: last arg must be a function" + not functionp key => error "listSort: last arg must be a function" mergeSort(pred,key,list,# list) -- non-destructive merge sort using NOT GGREATERP as predicate diff --git a/src/interp/i-object.boot b/src/interp/i-object.boot index 1d065fa4..93a4f261 100644 --- a/src/interp/i-object.boot +++ b/src/interp/i-object.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2011, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -145,7 +145,7 @@ asTupleNew0(eltType,listOfElts) == [#listOfElts,:makeSimpleArrayFromList(eltType,listOfElts)] asTupleNewCode(eltType, size, listOfElts) == - ["asTupleNew", quoteForm getVMType eltType, size, ["LIST", :listOfElts]] + ["asTupleNew", quoteForm getVMType eltType, size, ['%listlit, :listOfElts]] asTupleNewCode0(eltType,listForm) == ["asTupleNew0", quoteForm getVMType eltType, listForm] diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index b922c7cd..8674d9b8 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -1,6 +1,6 @@ -- Copyright (c) 1991-2002, The Numerical Algorithms Group Ltd. -- All rights reserved. --- Copyright (C) 2007-2010, Gabriel Dos Reis. +-- Copyright (C) 2007-2011, Gabriel Dos Reis. -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without @@ -397,7 +397,7 @@ washFunctorBody form == main form where stmts = nil => nil rest stmts = nil => first stmts ["PROGN",:stmts] - x is ["LIST"] => nil + x is ['%listlit] => nil x buildFunctor($definition is [name,:args],sig,code,$locals,$e) == diff --git a/src/interp/slam.boot b/src/interp/slam.boot index 3adb29c9..ce9c4ad4 100644 --- a/src/interp/slam.boot +++ b/src/interp/slam.boot @@ -280,7 +280,7 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) == rotateCode:= [["%LET",p,q] for p in gsRev for q in [:rest gsRev,g]] advanceCode:= ["%LET",gIndex,['ADD1,gIndex]] - newTripleCode := ["LIST",sharpArg,:gsList] + newTripleCode := ['%listlit,sharpArg,:gsList] newStateCode := null extraArguments => ["%store",["%dynval", MKQ stateNam],newTripleCode] ["HPUT",["%dynval", MKQ stateNam],extraArgumentCode,newTripleCode] @@ -304,7 +304,7 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) == mainFunction:= [nam,["LAM",margl,mbody]] where margl:= [:argl,'envArg] max:= gensym() - tripleCode := ["CONS",n,["LIST",:initCode]] + tripleCode := ["CONS",n,['%listlit,:initCode]] -- initialSetCode initializes the global variable if necessary and -- also binds "stateVar" to its current value @@ -332,9 +332,9 @@ compileRecurrenceRelation(op,nam,argl,junk,[body,sharpArg,n,:initCode]) == [auxfn,:argl,stateVar]] phrase2:= [["%igt",sharpArg,["SETQ",max,["DIFFERENCE",max,k]]], ["ELT",stateVar,["QSADD1",["QSDIFFERENCE",k,["DIFFERENCE",sharpArg,max]]]]] - phrase3:= [["%igt",sharpArg,n],[auxfn,:argl,["LIST",n,:initCode]]] + phrase3:= [["%igt",sharpArg,n],[auxfn,:argl,['%listlit,n,:initCode]]] phrase4:= [["%igt",sharpArg,n-k], - ["ELT",["LIST",:initCode],["QSDIFFERENCE",n,sharpArg]]] + ["ELT",['%listlit,:initCode],["QSDIFFERENCE",n,sharpArg]]] phrase5:= ['%true,['recurrenceError,MKQ op,sharpArg]] ['PROGN,:preset,['COND,phrase1,phrase2,phrase3,phrase4,phrase5]] if $verbose then diff --git a/src/interp/wi1.boot b/src/interp/wi1.boot index bc72afb4..88fd76ce 100644 --- a/src/interp/wi1.boot +++ b/src/interp/wi1.boot @@ -689,7 +689,7 @@ compList(l,m is ["List",mUnder],e) == Tl:= [[.,mUnder,e]:= comp(x,mUnder,e) or return "failed" for i in 1.. for x in l] Tl="failed" => nil - T:= [["LIST",:[T.expr for T in Tl]],["List",mUnder],e] + T:= [['%listlit,:[T.expr for T in Tl]],["List",mUnder],e] compVector(l,m is ["Vector",mUnder],e) == markImport m |