aboutsummaryrefslogtreecommitdiff
path: root/src/interp/compiler.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-11-11 05:53:12 +0000
committerdos-reis <gdr@axiomatics.org>2011-11-11 05:53:12 +0000
commit218672555b561f73b25f07168d16b24c56a494d4 (patch)
tree338b08b7e17b286e194242949b74bdfa0595eb4d /src/interp/compiler.boot
parentecd77af5ce74ac002bd6550bed79eae5a3704c35 (diff)
downloadopen-axiom-218672555b561f73b25f07168d16b24c56a494d4.tar.gz
* interp/compiler.boot (applyMapping): Emit special call for
domain producing mapping variables. (compWithMappingMode): Coerce constructors to function objets. (compFormWithModemap): Constructor calls are direct calls. Everything else is ordinary indirect call. * interp/g-opt.boot (optCall): Handle function objects. * interp/nruncomp.boot (NRTencode): Encode the elaboration of atomic forms, not the source level form. * testsuite/compiler/ctor-mapping.spad: New.
Diffstat (limited to 'src/interp/compiler.boot')
-rw-r--r--src/interp/compiler.boot17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 5ab502a0..aecd95aa 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -224,8 +224,12 @@ applyMapping([op,:argl],m,e,ml) ==
argl' :=
[T.expr for x in argl for m' in rest ml'] where
T() == [.,.,e]:= comp(x,m',e) or return "failed"
- if argl'="failed" then return nil
- form:= [op,:argl']
+ argl' is "failed" => nil
+ form :=
+ ident? op and symbolMember?(op,$formalArgList) =>
+ -- this domain form is given by a general function application
+ ['%funcall,op,:argl'] -- constructor call linkage is special
+ [op,:argl']
convert([form,first ml',e],m)
argl':=
[T.expr for x in argl for m' in rest ml] where
@@ -328,7 +332,8 @@ compWithMappingMode(x,m is ["Mapping",m',:sl],oldE) ==
isFunctor x =>
if get(x,"modemap",$CategoryFrame) is [[[.,target,:argModeList],.],:.] and
(and/[extendsCategoryForm("$",s,mode) for mode in argModeList for s in sl]
- ) and extendsCategoryForm("$",target,m') then return [x,m,e]
+ ) and extendsCategoryForm("$",target,m') then
+ return [['%function,x],m,e]
x is ["+->",:.] => compLambda(x,m,oldE)
if string? x then x := makeSymbol x
for m in sl for v in (vl:= take(#sl,$FormalMapVariableList)) repeat
@@ -603,7 +608,11 @@ compFormWithModemap(form,m,e,modemap) ==
[x',target,e'] where
x':=
form':= [f,:[t.expr for t in Tl]]
- target=$Category or isCategoryForm(target,e) => form'
+ target = $Category or isCategoryForm(target,e) =>
+ -- Constructor instantiations are direct calls
+ ident? f and constructorDB f ~= nil => form'
+ -- Otherwise, this is an indirect call
+ ['%call,:form']
-- try to deal with new-style Unions where we know the conditions
op = "elt" and f is ['XLAM,:.] and ident?(z := first argl) and
(c := get(z,'condition,e)) and