[Mono-bugs] [Bug 58026][Wis] Changed - Add infrastructure for implementing icalls in IL

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 4 May 2004 22:25:31 -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 bmaurer@users.sf.net.


--- shadow/58026	2004-05-04 15:18:37.000000000 -0400
+++ shadow/58026.tmp.9332	2004-05-04 22:25:31.000000000 -0400
@@ -1,22 +1,21 @@
 Bug#: 58026
 Product: Mono: Runtime
 Version: unspecified
+OS: unknown
 OS Details: 
 Status: NEW   
+Severity: Unknown
 Priority: Wishlist
 Component: misc
 AssignedTo: vargaz@freemail.hu                            
 ReportedBy: vargaz@freemail.hu               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 Summary: Add infrastructure for implementing icalls in IL
 OtherBugsDependingOnThis: 52395
 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 
@@ -46,6 +45,47 @@
 mono_register_il_icall (mono_defaults.array_class, "Rank", ....,
 The JIT will need to be modified to handle these icalls and potentially
 inline them.
+------- Additional Comments From bmaurer@users.sf.net  2004-05-04 22:25 -------
+Hey Zoltan,
+In general I think your idea is good. However...
+What I would rather see is for the structures to be available to C#
+code. Imagine the following:
+We add structs to corlib:
+internal unsafe struct MonoVTable {
+    /* mono vtable fields */
+    ...
+    MonoClass* klass;
+internal unsafe struct MonoClass {
+    ...
+    int rank;
+[obviously, there are layout attributes missing here -- look at the
+In System.Object, we would add the following field:
+internal MonoVTable* vtable;
+Thus, we could implement GetRank as:
+public int Rank {
+   get { return vtable->klass->rank; }
+There are a few advantages to this, imho:
+1) I am not sure how your solution would play with the interp.
+2) I think the code above is alot cleaner :-).
+3) If one is required to write IL to do this stuff, i highly doubt it
+will be used as often as it can be.