Skip to content

Commit

Permalink
added back checkCasts before invokeInterface calls
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Dec 29, 2008
1 parent 8fb9bdd commit e6fed02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/clj/clojure/core_proxy.clj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
(. gen (dup))
(. gen (ifNull else-label))
;if found
(.checkCast gen ifn-type)
(. gen (loadThis))
;box args
(dotimes [i (count ptypes)]
Expand Down Expand Up @@ -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)"))))
Expand Down
3 changes: 3 additions & 0 deletions src/clj/clojure/genclass.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/jvm/clojure/lang/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ public void emitUnboxed(C context, FnExpr fn, GeneratorAdapter gen){
{
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)
Expand All @@ -1179,7 +1179,7 @@ public void emit(C context, FnExpr fn, GeneratorAdapter gen){
{
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)
Expand Down

0 comments on commit e6fed02

Please sign in to comment.