[Mono-bugs] [Bug 58026][Wis] New - Add infrastructure for implementing icalls in IL
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 4 May 2004 14:59:41 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by vargaz@freemail.hu.
http://bugzilla.ximian.com/show_bug.cgi?id=58026
--- shadow/58026 2004-05-04 14:59:41.000000000 -0400
+++ shadow/58026.tmp.23262 2004-05-04 14:59:41.000000000 -0400
@@ -0,0 +1,50 @@
+Bug#: 58026
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: misc
+AssignedTo: vargaz@freemail.hu
+ReportedBy: vargaz@freemail.hu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Add infrastructure for implementing icalls in IL
+
+Currently, all icalls are implemented in native C code. This means that
+calling them incures a performance penalty due to the managed->unmanaged
+transition. Also, they can't be inlined. For simple icalls, like
+Array:Rank, the cost of the call and the transition is much greater than
+the cost of the operation itself. This is why under mono,
+System.Buffer.BlockCopy is slower than System.Array.Copy (bug #53295).
+
+An alternative would be to implement some icalls in IL code like this:
+
+static guint8 array_rank_il [] = {
+ /* Load vtable ptr */
+ CEE_LDIND_I,
+ /* Load klass */
+ CEE_LDC_I4,
+ G_STRUCT_OFFSET (MonoVTable, klass),
+ CEE_ADD,
+ CEE_LDIND_I,
+ /* Load rank */
+ CEE_LDC_I4,
+ G_STRUCT_OFFSET (MonoClass, rank),
+ CEE_ADD,
+ CEE_LDIND_I
+ RET
+};
+
+Later:
+mono_register_il_icall (mono_defaults.array_class, "Rank", ....,
+array_rank_il);
+
+
+The JIT will need to be modified to handle these icalls and potentially
+inline them.