[Mono-bugs] [Bug 58558][Blo] Changed - static constructors don't get called
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 27 May 2004 12:05:02 -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 totte@hiddenpeaks.com.
http://bugzilla.ximian.com/show_bug.cgi?id=58558
--- shadow/58558 2004-05-27 11:57:51.000000000 -0400
+++ shadow/58558.tmp.30058 2004-05-27 12:05:02.000000000 -0400
@@ -259,6 +259,40 @@
------- Additional Comments From totte@hiddenpeaks.com 2004-05-27 11:57 -------
Created an attachment (id=7873)
Fix for static constructor bug
+
+------- Additional Comments From totte@hiddenpeaks.com 2004-05-27 12:05 -------
+The reason why static constructors don't get executed (sometimes in
+second domain) is because our shared runtime invoke code generation,
+before it generated runtime_invoke per method and class. This caused
+a lot of code that was equal to be compiled therefore we changed this
+behavior into caching on signature instead, sadly this caused some
+side effects:
+
+1. Some classes are still dependent on the method, like string and
+value type methods
+
+2. The class in the cached method (cached by signature) was set to
+the class of the first method that was cached (by signature), so when
+compiling this method the class was initialized (in
+mono_jit_compile_method) but instead of initializing the runtime
+invoke method class we initialized the first called method cached
+class again (and sometimes as in this bug, the wrong class in the
+wrong order) and this caused deadlocks in the class init
+functionality.
+
+So, the "Fix for static constructor bug" patch changes the behavior
+into:
+
+1. Signatures that are cached are now cached in object not the class
+of the first method called.
+2. Value type and string helpers are not cached at all (we should fix
+this later)
+3. We initialize the correct class in mono_jit_runtime_invoke because
+mono_jit_compile_method may just initialize system object again
+(mono_runtime_class_init has functionality to detect if a class is
+initialized or not)
+
+ugh.