From d76c902f18d1ee40c52372c37336631c0f81bfc8 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 30 Oct 2011 16:38:47 +0000 Subject: * 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. --- src/interp/compiler.boot | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/interp/compiler.boot') 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 := -- cgit v1.2.3