[mono/mono] 5106e3a5: [llvm] Use a pointer type as the type of 'this' instead of an int.

"Zoltan Varga ([email protected])" <[email protected]> Mon, 18 Nov 2013 05:09:40 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000142699d399c-eb67b164-a873-4285-9a20-71caebf2586c-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/31d92920135e...5106e3a56d72

   Commit: 5106e3a56d728a517b873f33bd6ce92df7f2011f
   Author: Zoltan Varga <[email protected]> (vargaz)
     Date: 2013-11-18 05:08:29 GMT
      URL: https://github.com/mono/mono/commit/5106e3a56d728a517b873f33bd6ce92df7f2011f

[llvm] Use a pointer type as the type of 'this' instead of an int.

Changed paths:
  M mono/mini/mini-llvm.c

Modified: mono/mini/mini-llvm.c
===================================================================
@@ -211,6 +211,12 @@
 	return sizeof (gpointer) == 8 ? LLVMPointerType (LLVMInt64Type (), 0) : LLVMPointerType (LLVMInt32Type (), 0);
 }
 
+static LLVMTypeRef
+ThisType (void)
+{
+	return sizeof (gpointer) == 8 ? LLVMPointerType (LLVMInt64Type (), 0) : LLVMPointerType (LLVMInt32Type (), 0);
+}
+
 /*
  * get_vtype_size:
  *
@@ -1098,7 +1104,7 @@
 	if (sig->hasthis) {
 		if (sinfo)
 			sinfo->this_arg_pindex = pindex;
-		param_types [pindex ++] = IntPtrType ();
+		param_types [pindex ++] = ThisType ();
 	}
 	if (vretaddr && vret_arg_pindex == pindex)
 		param_types [pindex ++] = IntPtrType ();
@@ -1765,7 +1771,7 @@
 		 * with the "mono.this" custom metadata to tell llvm that it needs to save its
 		 * location into the LSDA.
 		 */
-		this_alloc = mono_llvm_build_alloca (builder, IntPtrType (), LLVMConstInt (LLVMInt32Type (), 1, FALSE), 0, "");
+		this_alloc = mono_llvm_build_alloca (builder, ThisType (), LLVMConstInt (LLVMInt32Type (), 1, FALSE), 0, "");
 		/* This volatile store will keep the alloca alive */
 		mono_llvm_build_store (builder, ctx->values [cfg->args [0]->dreg], this_alloc, TRUE);
 
@@ -2029,7 +2035,7 @@
 		} else {
 			g_assert (args [pindex]);
 			if (i == 0 && sig->hasthis)
-				args [pindex] = convert (ctx, args [pindex], IntPtrType ());
+				args [pindex] = convert (ctx, args [pindex], ThisType ());
 			else
 				args [pindex] = convert (ctx, args [pindex], type_to_llvm_arg_type (ctx, sig->params [i - sig->hasthis]));
 		}


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches