From 1c6cef480393a8531153737bf2c72da748ca2589 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 30 Nov 2011 22:39:52 +0000 Subject: * interp/define.boot (registerInlinableDomain): Lose last argument. Recursively nominate constructor argument for inlining. Adjust callers. * interp/c-util.boot: Tidy. * algebra/Makefile.in: Tidy. --- src/ChangeLog | 7 +++++ src/algebra/Makefile.in | 66 ++++++++++++++++++++++++++---------------------- src/interp/c-util.boot | 15 ++++++----- src/interp/compiler.boot | 2 +- src/interp/define.boot | 23 ++++++++++------- 5 files changed, 66 insertions(+), 47 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cc069516..e9e15390 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-11-30 Gabriel Dos Reis + + * interp/define.boot (registerInlinableDomain): Lose last argument. + Recursively nominate constructor argument for inlining. Adjust callers. + * interp/c-util.boot: Tidy. + * algebra/Makefile.in: Tidy. + 2011-11-30 Gabriel Dos Reis * interp/c-util.boot (clearReplacement): Clear redex replacement. diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 73b5800a..8b220ca2 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -1637,12 +1637,13 @@ axiom_algebra_layer_7_objects = \ $(OUT)/BSTREE.$(FASLEXT): $(OUT)/BTREE.$(FASLEXT) $(OUT)/ITAYLOR.$(FASLEXT): $(OUT)/STREAM.$(FASLEXT) +$(OUT)/BTREE.$(FASLEXT): $(OUT)/TREE.$(FASLEXT) axiom_algebra_layer_8 = \ - BSTREE BTOURN CARD DRAWHACK FACTFUNC \ + BSTREE BTOURN CARD DRAWHACK FACTFUNC TREE \ FR2 FRAC2 FRUTIL ITAYLOR MLO NAALG \ NAALG- OP ORDCOMP2 RANDSRC UNISEG2 XALG \ - BTREE ARR2CAT ARR2CAT- + BTREE POLY SMP ARR2CAT ARR2CAT- axiom_algebra_layer_8_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_8)) @@ -1650,7 +1651,7 @@ axiom_algebra_layer_8_nrlibs = \ axiom_algebra_layer_8_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_8))) -$(OUT)/FT.$(FASLEXT): $(OUT)/FST.$(FASLEXT) +$(OUT)/FT.$(FASLEXT): $(OUT)/FST.$(FASLEXT) $(OUT)/POLY.$(FASLEXT) axiom_algebra_layer_9 = \ AMR AMR- DEGRED DLP EAB \ @@ -1672,7 +1673,8 @@ $(OUT)/ANY.$(FASLEXT): $(OUT)/SEX.$(FASLEXT) $(OUT)/SEX.$(FASLEXT): $(OUT)/SEXOF.$(FASLEXT) $(OUT)/LEXP.$(FASLEXT): $(OUT)/XPBWPOLY.$(FASLEXT) -$(OUT)/XPBWPOLY.$(FASLEXT): $(OUT)/XPOLYC.$(FASLEXT) +$(OUT)/XPBWPOLY.$(FASLEXT): $(OUT)/XPOLYC.$(FASLEXT) \ + $(OUT)/PBWLB.$(FASLEXT) $(OUT)/PENDTREE.$(FASLEXT): $(OUT)/TREE.$(FASLEXT) $(OUT)/QFORM.$(FASLEXT): $(OUT)/SQMATRIX.$(FASLEXT) $(OUT)/SQMATRIX.$(FASLEXT): $(OUT)/SMATCAT.$(FASLEXT) \ @@ -1684,9 +1686,12 @@ $(OUT)/DIRPCAT.$(FASLEXT): $(OUT)/VSPACE.$(FASLEXT) $(OUT)/IVECTOR.$(FASLEXT) $(OUT)/MATRIX.$(FASLEXT): $(OUT)/MATCAT.$(FASLEXT) $(OUT)/BTAGG.$(FASLEXT): $(OUT)/BOOLE.$(FASLEXT) $(OUT)/PATLRES.$(FASLEXT): $(OUT)/PATRES.$(FASLEXT) +$(OUT)/PBWLB.$(FASLEXT): $(OUT)/LWORD.$(FASLEXT) +$(OUT)/LWORD.$(FASLEXT): $(OUT)/MAGMA.$(FASLEXT) +$(OUT)/PFR.$(FASLEXT): $(OUT)/FR.$(FASLEXT) axiom_algebra_layer_10 = \ - BPADIC ANY \ + BPADIC ANY LWORD FR \ SEXOF CRAPACK DEQUEUE DLIST \ DRAWCX \ DRAWPT FAMR FAMR- FLASORT \ @@ -1694,7 +1699,7 @@ axiom_algebra_layer_10 = \ FPC FPC- FMONOID INDE \ IPADIC IROOT IR2 LEXP \ LIECAT LIECAT- LIST2 LIST2MAP \ - SEX HASHTBL TREE MAGMA \ + SEX HASHTBL MAGMA \ MESH MOEBIUS MODFIELD MODOP \ MRING MTHING NCNTFRAC NCODIV \ NUMTUBE ODR OFMONOID ONECOMP \ @@ -1723,15 +1728,17 @@ axiom_algebra_layer_10_objects = \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_10))) $(OUT)/ARRAY2.$(FASLEXT): $(OUT)/IFARRAY.$(FASLEXT) $(OUT)/ORESUP.$(FASLEXT): $(OUT)/PR.$(FASLEXT) +$(OUT)/PLOT3D.$(FASLEXT): $(OUT)/POINT.$(FASLEXT) +$(OUT)/POINT.$(FASLEXT): $(OUT)/PTCAT.$(FASLEXT) axiom_algebra_layer_11 = \ APPLYORE ARRAY1 ARRAY12 ARRAY2 \ - ASTACK COMBINAT \ + ASTACK COMBINAT POINT PTCAT \ CSTTOOLS FARRAY \ FLALG GALUTIL HEAP \ IARRAY2 IFARRAY INTCAT INTHEORY \ IRREDFFX LFCAT LODOCAT LODOCAT- \ - LWORD MATSTOR \ + MATSTOR \ ORESUP OREPCTO OREUP PLOT3D \ PR PREASSOC PRIMARR2 REDORDER \ SYMPOLY \ @@ -1748,7 +1755,7 @@ axiom_algebra_layer_11_objects = \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_11))) axiom_algebra_layer_12 = \ ULSCAT BITS DIRPROD2 IMATRIX \ - LPOLY LSMP LSMP1 MATCAT2 PTCAT TRIMAT \ + LPOLY LSMP LSMP1 MATCAT2 TRIMAT \ SYSTEM HOSTNAME PORTNUM axiom_algebra_layer_12_nrlibs = \ @@ -1769,7 +1776,7 @@ axiom_algebra_layer_13 = \ FNLA GRAY HB IRSN \ MHROWRED NUMODE NUMQUAD \ ODESYS ODETOOLS ORDFUNS PERMAN \ - PFECAT PFECAT- POINT PSEUDLIN \ + PFECAT PFECAT- PSEUDLIN \ PTPACK REP2 SETMN \ SYMFUNC VECTOR2 VECTOR CHAR \ INBCON INBCON- OUTBCON OUTBCON- @@ -1826,7 +1833,7 @@ axiom_algebra_layer_14 = \ RESRING RETSOL RF RFFACTOR \ RRCC RRCC- \ SCPKG SHDP SHP SIGNRF \ - SMITH SMP SMTS SOLVEFOR \ + SMITH SMTS SOLVEFOR \ SPLTREE STINPROD STTFNC SUBRESP \ SUMRF SUP SUPFRACF TANEXP \ TEX TEXTFILE \ @@ -1860,7 +1867,7 @@ axiom_algebra_layer_15 = \ FRAMALG FRAMALG- MDAGG ODPOL \ PLOT RMCAT2 ROIRC SDPOL \ ULS ULSCONS TUBETOOL UPXSCCA \ - UPXSCCA- JVMBCODE POLY BYTEBUF OVERSET \ + UPXSCCA- JVMBCODE BYTEBUF OVERSET \ ULSCCAT ULSCCAT- UTS UTSCAT UTSCAT- axiom_algebra_layer_15_nrlibs = \ @@ -1884,13 +1891,16 @@ axiom_algebra_layer_16_nrlibs = \ axiom_algebra_layer_16_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_16))) + axiom_algebra_layer_17 = \ CCLASS FSAGG2 GALFACT IALGFACT CTORCAT CTORCAT- \ IBACHIN MMLFORM NORMMA ODERED OMSAGG OPSIG \ - PERM PERMGRP PRIMES PWFFINTB \ + PERM PERMGRP PRIMES PWFFINTB DROPT \ RDIST SAE SAEFACT SAERFFC \ SGCF VIEW3D +$(OUT)/VIEW3D.$(FASLEXT): $(OUT)/DROPT.$(FASLEXT) + axiom_algebra_layer_17_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_17)) @@ -1916,10 +1926,10 @@ $(OUT)/FPARFRAC.$(FASLEXT): $(OUT)/DIFFSPC.$(FASLEXT) axiom_algebra_layer_19 = \ ACPLOT ANTISYM \ COMPCAT \ - COMPCAT- DRAW DRAWCFUN DROPT \ + COMPCAT- DRAW DRAWCFUN \ DROPT0 EP \ FFCAT FFCAT- FFCGP FFNBP \ - FFP FLOAT FPARFRAC FR \ + FFP FLOAT FPARFRAC \ FRNAALG FRNAALG- EXPR \ FUNCTION GDMP HACKPI \ IDEAL INFORM INFORM1 IPRNTPK \ @@ -1949,6 +1959,7 @@ $(OUT)/AN.$(FASLEXT): $(OUT)/IAN.$(FASLEXT) $(OUT)/IAN.$(FASLEXT): $(OUT)/EXPR.$(FASLEXT) $(OUT)/SUTS.$(FASLEXT): $(OUT)/PDDOM.$(FASLEXT) $(OUT)/OCT.$(FASLEXT): $(OUT)/QUAT.$(FASLEXT) +$(OUT)/EXPEXPAN.$(FASLEXT): $(OUT)/UPXSSING.$(FASLEXT) axiom_algebra_layer_20 = \ AF ALGFACT ALGFF ALGMANIP ALGMFACT ALGPKG \ @@ -2037,8 +2048,8 @@ axiom_algebra_layer_23_objects = \ axiom_algebra_layer_user = \ RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ LITERAL TYPEAST IMPTAST MAPPAST ATTRAST \ - JOINAST IFAST RPTAST WHILEAST INAST CLLCAST \ - LSTAST EXITAST RETAST SEGAST PRTDAST CRCAST \ + JOINAST IFAST RPTAST WHILEAST INAST CLLCTAST \ + LSTAST EXITAST RETAST SEGAST PRTDAST CRCEAST \ LETAST SUCHAST RDUCEAST COLONAST ADDAST CAPSLAST \ CASEAST HASAST ISAST CATAST WHEREAST COMMAAST \ QQUTAST DEFAST MACROAST SPADXPT SPADAST PARAMAST \ @@ -2061,7 +2072,7 @@ $(OUT)/LITERAL.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) $(OUT)/PARAMAST.$(FASLEXT): $(OUT)/IDENT.$(FASLEXT) $(OUT)/STRING.$(FASLEXT) $(OUT)/HEADAST.$(FASLEXT): $(OUT)/PARAMAST.$(FASLEXT) $(OUT)/SPADXPT.$(FASLEXT): $(OUT)/ASTCAT.$(FASLEXT) -$(OUT)/ATTRAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) +$(OUT)/ATTRAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SPADAST.$(FASLEXT) $(OUT)/TYPEAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/IMPTAST.$(FASLEXT): $(OUT)/TYPEAST.$(FASLEXT) $(OUT)/MAPPAST.$(FASLEXT): $(OUT)/TYPEAST.$(FASLEXT) @@ -2073,14 +2084,14 @@ $(OUT)/WHILEAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/INAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/STEPAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) \ $(OUT)/IDENT.$(FASLEXT) $(OUT)/MAYBE.$(FASLEXT) -$(OUT)/CLLCTAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) +$(OUT)/CLLCTAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SPADAST.$(FASLEXT) $(OUT)/LSTAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/EXITAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/RETAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SEGAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SEQAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/PRTDAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) -$(OUT)/CRCEAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) +$(OUT)/CRCEAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SYNTAX.$(FASLEXT) $(OUT)/RSTRCAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/LETAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/RDUCEAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) @@ -2095,15 +2106,8 @@ $(OUT)/CATAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/WHEREAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/COMMAAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/QQUTAST.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) -$(OUT)/DEFAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) +$(OUT)/DEFAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) $(OUT)/SPADAST.$(FASLEXT) $(OUT)/MACROAST.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) -$(OUT)/SPADAST.$(FASLEXT): \ - $(addprefix $(OUT)/,$(addsuffix .$(FASLEXT), \ - IMPTAST DEFAST MACROAST WHEREAST CATAST CAPSLAST \ - SIGAST ATTRAST MAPPAST IFAST RPTAST WHILEAST INAST \ - CLLCTAST LSTAST EXITAST RETAST CRCEAST PRTDAST RSTRCAST \ - SEGAST SEQAST LETAST SUCHTAST COLONAST CASEAST HASAST \ - ISAST)) $(OUT)/INBFILE.$(FASLEXT): $(OUT)/FNAME.$(FASLEXT) \ $(OUT)/INBCON.$(FASLEXT) $(OUT)/STRING.$(FASLEXT) @@ -2120,14 +2124,16 @@ $(OUT)/INETCLTS.$(FASLEXT): $(OUT)/NETCLT.$(FASLEXT) $(OUT)/IRFORM.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT) -$(OUT)/COMPILER.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT) $(OUT)/ENV.$(FASLEXT) +$(OUT)/COMPILER.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT) $(OUT)/ENV.$(FASLEXT) \ + $(OUT)/ELABOR.$(FASLEXT) $(OUT)/ITFORM.$(FASLEXT): $(OUT)/IRFORM.$(FASLEXT) $(OUT)/ELABOR.$(FASLEXT): $(OUT)/ITFORM.$(FASLEXT) $(OUT)/ENV.$(FASLEXT) \ $(OUT)/IRFORM.$(FASLEXT) $(OUT)/LINBASIS.$(FASLEXT): $(OUT)/ORDFIN.$(FASLEXT) $(OUT)/OVAR.$(FASLEXT) -$(OUT)/LINELT.$(FASLEXT): $(OUT)/VSPACE.$(FASLEXT) $(OUT)/FM.$(FASLEXT) +$(OUT)/LINELT.$(FASLEXT): $(OUT)/VSPACE.$(FASLEXT) $(OUT)/FM.$(FASLEXT) \ + $(OUT)/LINBASIS.$(FASLEXT) $(OUT)/DBASIS.$(FASLEXT): $(OUT)/ORDFIN.$(FASLEXT) $(OUT)/KVTFROM.$(FASLEXT) $(OUT)/LINFORM.$(FASLEXT): $(OUT)/DBASIS.$(FASLEXT) \ $(OUT)/VSPACE.$(FASLEXT) $(OUT)/LINELT.$(FASLEXT) diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 093d46e8..b062f979 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1874,7 +1874,7 @@ getFunctionTemplate(sig,start,end,shell,args,funDesc) == nargs := #rest sig loc := nil -- candidate locations while loc ~= "ambiguous" and start < end repeat - n := funDesc.start -- arity of current operator + n := arrayRef(funDesc,start) -- arity of current operator PROGN -- Skip if arity mismatch i := start @@ -1887,7 +1887,7 @@ getFunctionTemplate(sig,start,end,shell,args,funDesc) == -- Grab the location of this match loc := integer? loc => "ambiguous" - funDesc.(i + n + 1) + arrayRef(funDesc,i + n + 1) start := start + n + 4 loc @@ -1934,28 +1934,29 @@ lookupDefiningFunction(op,sig,dc) == -- 2.2. The operation is either defined here, or is available -- from category package defaults. limit := - index + 2 < opTableLength => opTable.(index + 2) + index + 2 < opTableLength => vectorRef(opTable,index + 2) #funDesc -- 3. Locate the descriptor with matching signature loc := getFunctionTemplate(sig,opTable.index,limit,shell,args,funDesc) -- 4. Look into the add-chain if necessary - loc = nil => lookupInheritedDefiningFunction(op,sig,shell,args,shell.5) + loc = nil => + lookupInheritedDefiningFunction(op,sig,shell,args,domainRef(shell,5)) -- 5. Give up if the operation is overloaded on semantics predicates. loc is 'ambiguous => nil -- 6. We have a location to a function descriptor. - fun := shell.loc + fun := domainRef(shell,loc) -- 6.1. A constant producing functions? fun is [.,.,[.,['dispatchFunction,fun'],.]] => fun' -- 6.2. An inherited function? fun is [idx,:.] => not integer? idx => nil -- a UFO? - loc := funDesc.(idx + 1) + loc := arrayRef(funDesc,idx + 1) if loc = 0 then loc := 5 - shell.loc = nil => nil + domainRef(shell,loc) = nil => nil lookupInheritedDefiningFunction(op,sig,shell,args,shell.loc) -- 6.3. Whatever. fun diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index dea05b3d..ae2fc54a 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -2347,7 +2347,7 @@ processInlineRequest(t,e) == stackAndThrow('"%1b does not designate a domain",[t]) T.expr isnt [.,:.] => stackWarning('"inline request for type variable %1bp is meaningless",[t]) - nominateForInlining T.expr + registerInlinableDomain T.expr --% diff --git a/src/interp/define.boot b/src/interp/define.boot index c79d4d16..f9a6e6e0 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -2107,14 +2107,18 @@ bootStrapError(functorForm,sourceFile) == ['%otherwise, ['systemError,['%list,'"%b",MKQ functorForm.op,'"%d",'"from", _ '"%b",MKQ namestring sourceFile,'"%d",'"needs to be compiled"]]]] -registerInlinableDomain(x,e) == - x := macroExpand(x,e) +registerInlinableDomain x == x is [ctor,:.] => - constructor? ctor => nominateForInlining ctor - ctor is ":" => registerInlinableDomain(third x,e) + constructor? ctor => + nominateForInlining ctor + cosig := getDualSignature ctor or return nil + for a in x.args for t in cosig.source | t and a is [.,:.] repeat + registerInlinableDomain a + ctor is ":" => registerInlinableDomain third x + ctor is 'Enumeration => nil builtinFunctorName? ctor => for t in x.args repeat - registerInlinableDomain(t,e) + registerInlinableDomain t nil nil @@ -2132,7 +2136,7 @@ compAdd(['add,$addForm,capsule],m,e) == if $addForm is ["SubDomain",domainForm,predicate] then $NRTaddForm := domainForm getLocalIndex(db,domainForm) - registerInlinableDomain(domainForm,e) + registerInlinableDomain domainForm --need to generate slot for add form since all $ go-get -- slots will need to access it [$addForm,.,e]:= compSubDomain1(domainForm,predicate,m,e) @@ -2141,9 +2145,10 @@ compAdd(['add,$addForm,capsule],m,e) == [$addForm,.,e]:= $addForm is ["%Comma",:.] => $NRTaddForm := ["%Comma",:[getLocalIndex(db,x) for x in $addForm.args]] - for x in $addForm.args repeat registerInlinableDomain(x,e) + for x in $addForm.args repeat + registerInlinableDomain x compOrCroak(compTuple2Record $addForm,$EmptyMode,e) - registerInlinableDomain($addForm,e) + registerInlinableDomain $addForm compOrCroak($addForm,$EmptyMode,e) compCapsule(capsule,m,e) @@ -2247,7 +2252,7 @@ doIt(item,$predl) == --$Representation bound by compDefineFunctor, used in compNoStacking $Representation := getRepresentation $e if $optimizeRep then - registerInlinableDomain($Representation,$e) + registerInlinableDomain $Representation code is ["%LET",:.] => db := constructorDB currentConstructor $e item.op := '%store -- cgit v1.2.3