aboutsummaryrefslogtreecommitdiff
path: root/src/interp/compiler.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-10-30 16:38:47 +0000
committerdos-reis <gdr@axiomatics.org>2011-10-30 16:38:47 +0000
commitd76c902f18d1ee40c52372c37336631c0f81bfc8 (patch)
tree0a79d6ab8b42d9da5cb824f2871b0e355b21296c /src/interp/compiler.boot
parentfe017bc0d4dfb95fa051aaa18188506c0857707d (diff)
downloadopen-axiom-d76c902f18d1ee40c52372c37336631c0f81bfc8.tar.gz
* interp/sys-macros.lisp (MKPF1): Tidy.
* interp/sys-constants.boot ($QueryVariables): New. * interp/define.boot ($whreDecls): Remove. (checkRepresentation): Take a DB as first parameter. Adjust Callers. (buildConstructorCondition): New (deduceImplicitParameters): Likewise (compDefineCategory2): Use it. (compDefineFunctor1): Likewise. (typeDependencyPath): Remove. (inferConstructorImplicitParameters): Likewise. * interp/compiler.boot (compTopLevel): Do not bind $whereDecls. (recordDeclarationInSideCondition): Take additional reference parameter to the list of processed decls. Adjust callers. (compWhere): Record any side decls in compilation environment. * interp/c-util.boot (makeCompilationData): Initialize implicit data. (dbParameters): New. (dbImplicitData): New accessor macro. (dbImplicitParameters): New. (dbImplicitConstraints): Likewise. (dbSubstituteFormals): Likewise. (dbSubstituteQueries): Likewise. * interp/database.boot (fixUpPredicate): Tidy. * boot/utility.boot (applySubst): Early exit on identity substitution. (applySubst!): Likewise. (applySubstNQ): Likewise. * boot/ast.boot (bfIS1): Accept pattern matching against Boolean constant true.
Diffstat (limited to 'src/interp/compiler.boot')
-rw-r--r--src/interp/compiler.boot17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 768e1b5b..4afa3d4f 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -98,7 +98,6 @@ compTopLevel(x,m,e) ==
$NRTderivedTargetIfTrue: local := false
$killOptimizeIfTrue: local:= false
$forceAdd: local:= false
- $whereDecls: local := nil
-- start with a base list of domains we may want to inline.
$optimizableConstructorNames: local := $SystemInlinableConstructorNames
x is ["DEF",:.] or x is ["where",["DEF",:.],:.] =>
@@ -943,27 +942,31 @@ compileQuasiquote(["[||]",:form],m,e) ==
++ The form `item' appears in a side condition of a where-expression.
++ Register all declarations it locally introduces.
-recordDeclarationInSideCondition(item,e) ==
+recordDeclarationInSideCondition(item,e,decls) ==
item is [":",x,t] =>
t := macroExpand(t,e)
- ident? x => $whereDecls := [[x,t],:$whereDecls]
+ ident? x => deref(decls) := [[x,t],:deref decls]
x is ['%Comma,:.] =>
- $whereDecls := [:[[x',t] for x' in x.args],:$whereDecls]
+ deref(decls) := [:[[x',t] for x' in x.args],:deref decls]
item is ['SEQ,:stmts,["exit",.,val]] =>
for stmt in stmts repeat
- recordDeclarationInSideCondition(stmt,e)
- recordDeclarationInSideCondition(val,e)
+ recordDeclarationInSideCondition(stmt,e,decls)
+ recordDeclarationInSideCondition(val,e,decls)
compWhere: (%Form,%Mode,%Env) -> %Maybe %Triple
compWhere([.,form,:exprList],m,eInit) ==
$insideExpressionIfTrue: local:= false
$insideWhereIfTrue: local := true
e := eInit
+ decls := ref get('%compilerData,'%whereDecls,e)
u :=
for item in exprList repeat
- recordDeclarationInSideCondition(item,e)
+ recordDeclarationInSideCondition(item,e,decls)
[.,.,e]:= comp(item,$EmptyMode,e) or return "failed"
u is "failed" => return nil
+ -- Remember side declaration constraints, if any.
+ if deref decls ~= nil then
+ e := put('%compilerData,'%whereDecls,deref decls,e)
$insideWhereIfTrue := false
[x,m,eAfter] := comp(macroExpand(form,eBefore := e),m,e) or return nil
eFinal :=