diff options
author | Rich Hickey <richhickey@gmail.com> | 2009-11-02 14:13:06 -0500 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2009-11-02 14:13:06 -0500 |
commit | 679c79508713acddca1e18d1e28dafae885e5096 (patch) | |
tree | 195c46f4a70f2244d2064ad97cbee60bae024b23 | |
parent | bb51320ebeac95ca137148e16da9b09fc29f2b66 (diff) |
get rid of keyword call site references
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 120 |
1 files changed, 60 insertions, 60 deletions
diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index d4938ca4..3c2e6d97 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -2541,58 +2541,58 @@ static class KeywordInvokeExpr implements Expr{ } } -static class KeywordSiteInvokeExpr implements Expr{ - public final Expr site; - public final Object tag; - public final Expr target; - public final int line; - public final String source; - - public KeywordSiteInvokeExpr(String source, int line, Symbol tag, Expr site, Expr target){ - this.source = source; - this.site = site; - this.target = target; - this.line = line; - this.tag = tag; - } - - public Object eval() throws Exception{ - try - { - KeywordCallSite s = (KeywordCallSite) site.eval(); - return s.thunk.invoke(s,target.eval()); - } - catch(Throwable e) - { - if(!(e instanceof CompilerException)) - throw new CompilerException(source, line, e); - else - throw (CompilerException) e; - } - } - - public void emit(C context, ObjExpr objx, GeneratorAdapter gen){ - gen.visitLineNumber(line, gen.mark()); - site.emit(C.EXPRESSION, objx, gen); - gen.dup(); - gen.getField(Type.getType(KeywordCallSite.class),"thunk",IFN_TYPE); - gen.swap(); - target.emit(C.EXPRESSION, objx, gen); - - gen.invokeInterface(IFN_TYPE, new Method("invoke", OBJECT_TYPE, ARG_TYPES[2])); - if(context == C.STATEMENT) - gen.pop(); - } - - public boolean hasJavaClass() throws Exception{ - return tag != null; - } - - public Class getJavaClass() throws Exception{ - return HostExpr.tagToClass(tag); - } - -} +//static class KeywordSiteInvokeExpr implements Expr{ +// public final Expr site; +// public final Object tag; +// public final Expr target; +// public final int line; +// public final String source; +// +// public KeywordSiteInvokeExpr(String source, int line, Symbol tag, Expr site, Expr target){ +// this.source = source; +// this.site = site; +// this.target = target; +// this.line = line; +// this.tag = tag; +// } +// +// public Object eval() throws Exception{ +// try +// { +// KeywordCallSite s = (KeywordCallSite) site.eval(); +// return s.thunk.invoke(s,target.eval()); +// } +// catch(Throwable e) +// { +// if(!(e instanceof CompilerException)) +// throw new CompilerException(source, line, e); +// else +// throw (CompilerException) e; +// } +// } +// +// public void emit(C context, ObjExpr objx, GeneratorAdapter gen){ +// gen.visitLineNumber(line, gen.mark()); +// site.emit(C.EXPRESSION, objx, gen); +// gen.dup(); +// gen.getField(Type.getType(KeywordCallSite.class),"thunk",IFN_TYPE); +// gen.swap(); +// target.emit(C.EXPRESSION, objx, gen); +// +// gen.invokeInterface(IFN_TYPE, new Method("invoke", OBJECT_TYPE, ARG_TYPES[2])); +// if(context == C.STATEMENT) +// gen.pop(); +// } +// +// public boolean hasJavaClass() throws Exception{ +// return tag != null; +// } +// +// public Class getJavaClass() throws Exception{ +// return HostExpr.tagToClass(tag); +// } +// +//} static class InvokeExpr implements Expr{ public final Expr fexpr; public final Object tag; @@ -3181,12 +3181,12 @@ static public class ObjExpr implements Expr{ gen.invokeStatic(Type.getType(Keyword.class), Method.getMethod("clojure.lang.Keyword intern(clojure.lang.Symbol)")); } - else if(value instanceof KeywordCallSite) - { - emitValue(((KeywordCallSite) value).k.sym, gen); - gen.invokeStatic(Type.getType(KeywordCallSite.class), - Method.getMethod("clojure.lang.KeywordCallSite create(clojure.lang.Symbol)")); - } +// else if(value instanceof KeywordCallSite) +// { +// emitValue(((KeywordCallSite) value).k.sym, gen); +// gen.invokeStatic(Type.getType(KeywordCallSite.class), +// Method.getMethod("clojure.lang.KeywordCallSite create(clojure.lang.Symbol)")); +// } else if(value instanceof Var) { Var var = (Var) value; @@ -3488,8 +3488,8 @@ static public class ObjExpr implements Expr{ return Type.getType(ISeq.class); else if(c == Keyword.class) return Type.getType(Keyword.class); - else if(c == KeywordCallSite.class) - return Type.getType(KeywordCallSite.class); +// else if(c == KeywordCallSite.class) +// return Type.getType(KeywordCallSite.class); else if(RestFn.class.isAssignableFrom(c)) return Type.getType(RestFn.class); else if(AFn.class.isAssignableFrom(c)) |