aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/c-util.boot15
-rw-r--r--src/interp/define.boot7
2 files changed, 12 insertions, 10 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot
index 5a42c2f0..199d1a6e 100644
--- a/src/interp/c-util.boot
+++ b/src/interp/c-util.boot
@@ -1710,15 +1710,6 @@ compileQuietly fn ==
--% Compile Time operation lookup for the benefit of domain inlining.
--%
-++ Subroutine of lookupDefiningFunction.
-++ Called when the domain of computation `dc' is closed (this is the
-++ case of niladic constructors) to lookup up the definition function
-++ of the operation `op' with signature `sig'.
-lookupFunctionInstance(op,sig,dc) ==
- dom := eval dc
- sig := MSUBST(devaluate dom,dc,sig)
- compiledLookup(op,sig,dom)
-
++ If `x' is a formal map variable, returns its position.
++ Otherwise return nil.
isFormal: %Symbol -> %Maybe %Short
@@ -1803,7 +1794,11 @@ lookupDefiningFunction(op,sig,dc) ==
-- 1. Read domain information, if available.
[ctor,:args] := dc
-- 1.1. Niladic constructors don't need approximation.
- null args => lookupFunctionInstance(op,sig,dc)
+ -- FIXME: However, there may be cylic dependencies
+ -- such as AN ~> IAN ~> EXPR INT ~> AN that prevents
+ -- us from full evaluation.
+ null args and ctor in $SystemInlinableConstructorNames =>
+ compiledLookup(op,sig,dc)
-- 1.2. Don't look into defaulting package
isDefaultPackageName ctor => nil
-- 1.2. Silently give up if the constructor is just not there
diff --git a/src/interp/define.boot b/src/interp/define.boot
index 039f1618..62a18cc8 100644
--- a/src/interp/define.boot
+++ b/src/interp/define.boot
@@ -1314,6 +1314,10 @@ bootStrapError(functorForm,sourceFile) ==
[''T, ['systemError,['LIST,''%b,MKQ functorForm.op,''%d,'"from", _
''%b,MKQ namestring sourceFile,''%d,'"needs to be compiled"]]]]
+registerInlinableDomain(x,e) ==
+ macroExpand(x,e) is [ctor,:.] and constructor? ctor =>
+ nominateForInlining ctor
+
compAdd(['add,$addForm,capsule],m,e) ==
$bootStrapMode = true =>
if $addForm is ["%Comma",:.] then code := nil
@@ -1327,6 +1331,7 @@ compAdd(['add,$addForm,capsule],m,e) ==
if $addForm is ["SubDomain",domainForm,predicate] then
$NRTaddForm := domainForm
NRTgetLocalIndex domainForm
+ registerInlinableDomain(domainForm,e)
--need to generate slot for add form since all $ go-get
-- slots will need to access it
[$addForm,.,e]:= compSubDomain1(domainForm,predicate,m,e)
@@ -1335,7 +1340,9 @@ compAdd(['add,$addForm,capsule],m,e) ==
[$addForm,.,e]:=
$addForm is ["%Comma",:.] =>
$NRTaddForm := ["%Comma",:[NRTgetLocalIndex x for x in rest $addForm]]
+ for x in $addForm.args repeat registerInlinableDomain(x,e)
compOrCroak(compTuple2Record $addForm,$EmptyMode,e)
+ registerInlinableDomain($addForm,e)
compOrCroak($addForm,$EmptyMode,e)
compCapsule(capsule,m,e)