瀏覽代碼

[jvm] avoid some more checkcast ops to Object

Simon Krajewski 5 年之前
父節點
當前提交
de65a4df4f
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      src/generators/jvm/jvmMethod.ml

+ 5 - 5
src/generators/jvm/jvmMethod.ml

@@ -618,15 +618,15 @@ class builder jc name jsig = object(self)
 		| TObject((["java";"lang"],"String"),_),_ when allow_to_string ->
 			self#expect_reference_type;
 			self#invokestatic (["haxe";"jvm"],"Jvm") "toString" (method_sig [object_sig] (Some string_sig))
-		| TObject(path1,_),TObject(path2,_) ->
-			if path1 = object_path then begin
+		| TObject(path1,_),t2 ->
+			if is_unboxed t2 then
+				self#expect_reference_type
+			else if path1 = object_path then begin
 				(* We should never need a checkcast to Object, but we should adjust the stack so stack maps are wide enough *)
 				ignore(code#get_stack#pop);
 				code#get_stack#push object_sig
 			end else
-				code#checkcast path1;
-		| TObject(path,_),TTypeParameter _ ->
-			code#checkcast path
+				code#checkcast path1
 		| TMethod _,TMethod _ ->
 			()
 		| TMethod _,_ ->