diff options
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/c-util.boot | 15 | ||||
-rw-r--r-- | src/interp/compiler.boot | 2 | ||||
-rw-r--r-- | src/interp/define.boot | 23 |
3 files changed, 23 insertions, 17 deletions
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 |