aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-05-10 14:25:56 +0000
committerdos-reis <gdr@axiomatics.org>2009-05-10 14:25:56 +0000
commit05e0d43a6021eefccbf2ba0f68c1d72089a102b1 (patch)
treec62820a8c57d254c7f7a97fecb230bb6445f313a /src
parent3038de25849b587893cb7de2302aad17cccd5f74 (diff)
downloadopen-axiom-05e0d43a6021eefccbf2ba0f68c1d72089a102b1.tar.gz
* interp/g-opt.boot (emitIndirectCall): New.
(optCall): Use it. (optSpecialCall): Likewise. (optSPADCALL): Tidy.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/interp/g-opt.boot37
2 files changed, 28 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7760c9e6..f1c04308 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-10 Gabriel Dos Reis <gdr@cs.tamu.edu>
+
+ * interp/g-opt.boot (emitIndirectCall): New.
+ (optCall): Use it.
+ (optSpecialCall): Likewise.
+ (optSPADCALL): Tidy.
+
2009-05-09 Gabriel Dos Reis <gdr@cs.tamu.edu>
* algebra/term.spad.pamphlet (zero?$Arity): New.
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index e78ceb7a..dd8c04e0 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -39,6 +39,22 @@ namespace BOOT
$optimizableConstructorNames := $SystemInlinableConstructorNames
+--%
+
+++ return the template of the instantiating functor for
+++ the domain form `dom'.
+getDomainTemplate dom ==
+ atom dom => nil
+ getInfovec first dom
+
+++ Emit code for an indirect call to domain-wide Spad function.
+++ This is usually the case for exported functions.
+emitIndirectCall(fn,args,x) ==
+ rplac(first x, "SPADCALL")
+ rplac(first fn,"getShellEntry")
+ rplac(rest x, [:args,fn])
+ x
+
--% OPTIMIZER
optimizeFunctionDef(def) ==
@@ -133,10 +149,8 @@ optCatch (x is ["CATCH",g,a]) ==
optSPADCALL(form is ['SPADCALL,:argl]) ==
null $InteractiveMode => form
-- last arg is function/env, but may be a form
- argl is [:argl,fun] =>
- fun is ['ELT,dom,slot] =>
- optCall ['call,['ELT,dom,slot],:argl]
- form
+ argl is [:argl,fun] and fun is ["ELT",dom,slot] =>
+ optCall ['call,['ELT,dom,slot],:argl]
form
optCall (x is ["call",:u]) ==
@@ -150,14 +164,8 @@ optCall (x is ["call",:u]) ==
(RPLAC(first x,"SPADCALL"); RPLAC(rest x,[:a,name]); x)
fn is [q,R,n] and MEMQ(q,'(getShellEntry ELT QREFELT CONST)) =>
not $bootStrapMode and (w:= optCallSpecially(q,x,n,R)) => w
- q="CONST" =>
---+
- ["spadConstant",R,n]
- --putInLocalDomainReferences will change this to ELT or QREFELT
- RPLAC(first x,"SPADCALL")
- RPLACA(fn,"getShellEntry")
- RPLAC(rest x,[:a,fn])
- x
+ q="CONST" => ["spadConstant",R,n]
+ emitIndirectCall(fn,a,x)
systemErrorHere ["optCall",x]
optCallSpecially(q,x,n,R) ==
@@ -211,10 +219,7 @@ optSpecialCall(x,y,n) ==
--DEF-EQUAL is really an optimiser
x
[fn,:a]:= first x
- RPLAC(first x,"SPADCALL")
- RPLACA(fn,"getShellEntry")
- RPLAC(rest x,[:a,fn])
- x
+ emitIndirectCall(fn,a,x)
compileTimeBindingOf u ==
NULL(name:= BPINAME u) => keyedSystemError("S2OO0001",[u])