diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-12-29 05:55:16 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-12-29 05:55:16 +0000 |
commit | e6fed020c75318cd3afa110d3213efaed2bf6988 (patch) | |
tree | 7a6c431db0b7c7f2efcdac46e7f73058f37a837f | |
parent | 8fb9bddb590c10431ccff3e9383ba651f8b9663b (diff) |
added back checkCasts before invokeInterface calls
-rw-r--r-- | src/clj/clojure/core_proxy.clj | 2 | ||||
-rw-r--r-- | src/clj/clojure/genclass.clj | 3 | ||||
-rw-r--r-- | src/jvm/clojure/lang/Compiler.java | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/clj/clojure/core_proxy.clj b/src/clj/clojure/core_proxy.clj index 8a777347..b1e4c4cb 100644 --- a/src/clj/clojure/core_proxy.clj +++ b/src/clj/clojure/core_proxy.clj @@ -62,6 +62,7 @@ (. gen (dup)) (. gen (ifNull else-label)) ;if found + (.checkCast gen ifn-type) (. gen (loadThis)) ;box args (dotimes [i (count ptypes)] @@ -125,6 +126,7 @@ (. gen (loadThis)) (. gen (dup)) (. gen (getField ctype fmap imap-type)) + (.checkCast gen (totype clojure.lang.IPersistentCollection)) (. gen (loadArgs)) (. gen (invokeInterface (totype clojure.lang.IPersistentCollection) (. Method (getMethod "clojure.lang.IPersistentCollection cons(Object)")))) diff --git a/src/clj/clojure/genclass.clj b/src/clj/clojure/genclass.clj index e293fe0e..968e2d4b 100644 --- a/src/clj/clojure/genclass.clj +++ b/src/clj/clojure/genclass.clj @@ -181,6 +181,7 @@ (when is-overload (. gen (mark found-label))) ;if found + (.checkCast gen ifn-type) (when-not as-static (. gen (loadThis))) ;box args @@ -274,6 +275,7 @@ (emit-get-var gen init-name) (. gen dup) (. gen ifNull no-init-label) + (.checkCast gen ifn-type) ;box init args (dotimes [i (count pclasses)] (. gen (loadArg i)) @@ -386,6 +388,7 @@ (emit-get-var gen main-name) (. gen dup) (. gen ifNull no-main-label) + (.checkCast gen ifn-type) (. gen loadArgs) (. gen (invokeStatic rt-type (. Method (getMethod "clojure.lang.ISeq seq(Object)")))) (. gen (invokeInterface ifn-type (new Method "applyTo" obj-type diff --git a/src/jvm/clojure/lang/Compiler.java b/src/jvm/clojure/lang/Compiler.java index c8e520b2..364e792f 100644 --- a/src/jvm/clojure/lang/Compiler.java +++ b/src/jvm/clojure/lang/Compiler.java @@ -1155,7 +1155,7 @@ static class InstanceMethodExpr extends MethodExpr{ { Type type = Type.getType(method.getDeclaringClass()); target.emit(C.EXPRESSION, fn, gen); - if(!method.getDeclaringClass().isInterface()) + //if(!method.getDeclaringClass().isInterface()) gen.checkCast(type); MethodExpr.emitTypedArgs(fn, gen, method.getParameterTypes(), args); if(context == C.RETURN) @@ -1179,7 +1179,7 @@ static class InstanceMethodExpr extends MethodExpr{ { Type type = Type.getType(method.getDeclaringClass()); target.emit(C.EXPRESSION, fn, gen); - if(!method.getDeclaringClass().isInterface()) + //if(!method.getDeclaringClass().isInterface()) gen.checkCast(type); MethodExpr.emitTypedArgs(fn, gen, method.getParameterTypes(), args); if(context == C.RETURN) |