summaryrefslogtreecommitdiff
path: root/src/jvm
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2010-06-08 21:33:33 -0400
committerRich Hickey <richhickey@gmail.com>2010-06-08 21:33:33 -0400
commit4db0b1f9c37fc0581bc54f13c8dfbe66f8bf02dc (patch)
tree90bc8ef6f5a145ed1ab44f867180d7aae66e0e41 /src/jvm
parentca737838aa65970775c58cd3a72fea4221a67bda (diff)
direct calls to statics, integrating into core fns
Diffstat (limited to 'src/jvm')
-rw-r--r--src/jvm/clojure/lang/Compiler.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java
index d63984fd..54da1f52 100644
--- a/src/jvm/clojure/lang/Compiler.java
+++ b/src/jvm/clojure/lang/Compiler.java
@@ -77,6 +77,7 @@ static final Symbol ISEQ = Symbol.create("clojure.lang.ISeq");
static final Keyword inlineKey = Keyword.intern(null, "inline");
static final Keyword inlineAritiesKey = Keyword.intern(null, "inline-arities");
static final Keyword staticKey = Keyword.intern(null, "static");
+static final Symbol INVOKE_STATIC = Symbol.create("invokeStatic");
static final Keyword volatileKey = Keyword.intern(null, "volatile");
static final Keyword implementsKey = Keyword.intern(null, "implements");
@@ -2896,8 +2897,8 @@ static class InvokeExpr implements Expr{
)
{
//todo - more specific criteria for binding these
- this.isDirect = true;
- this.siteIndex = registerVarCallsite(((VarExpr) fexpr).var);
+// this.isDirect = true;
+// this.siteIndex = registerVarCallsite(((VarExpr) fexpr).var);
}
}
this.tag = tag != null ? tag : (fexpr instanceof VarExpr ? ((VarExpr) fexpr).tag : null);
@@ -3051,6 +3052,16 @@ static class InvokeExpr implements Expr{
}
}
+ if(fexpr instanceof VarExpr)
+ {
+ Var v = ((VarExpr)fexpr).var;
+ if(RT.booleanCast(RT.get(RT.meta(v),staticKey)))
+ {
+ Symbol cname = Symbol.intern(v.ns.name + "$" + munge(v.sym.name));
+ return analyze(context, RT.listStar(DOT, cname, INVOKE_STATIC, RT.next(form)));
+ }
+ }
+
if(fexpr instanceof KeywordExpr && RT.count(form) == 2 && KEYWORD_CALLSITES.isBound())
{
// fexpr = new ConstantExpr(new KeywordCallSite(((KeywordExpr)fexpr).k));
@@ -5243,7 +5254,7 @@ public static class RecurExpr implements Expr{
LocalBinding lb = (LocalBinding) loopLocals.nth(i);
Class primc = lb.getPrimitiveType();
if(lb.isArg)
- gen.storeArg(lb.idx-1);
+ gen.storeArg(lb.idx-(objx.isStatic?0:1));
else
{
if(primc != null)