Author: lupus
Date: 2007-01-11 13:01:09 -0500 (Thu, 11 Jan 2007)
New Revision: 70870
Modified:
trunk/mono/mono/metadata/ChangeLog
trunk/mono/mono/metadata/marshal.c
Log:
Thu Jan 11 19:00:03 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
* marshal.c: memory retention fixes: use the proper
image cache for runtime_invoke method lookups.
Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog 2007-01-11 17:58:42 UTC (rev 70869)
+++ trunk/mono/mono/metadata/ChangeLog 2007-01-11 18:01:09 UTC (rev 70870)
@@ -1,4 +1,9 @@
+Thu Jan 11 19:00:03 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+ * marshal.c: memory retention fixes: use the proper
+ image cache for runtime_invoke method lookups.
+
Thu Jan 11 18:53:19 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
* mempool.c: added code to help debug mempool allocations.
Modified: trunk/mono/mono/metadata/marshal.c
===================================================================
--- trunk/mono/mono/metadata/marshal.c 2007-01-11 17:58:42 UTC (rev 70869)
+++ trunk/mono/mono/metadata/marshal.c 2007-01-11 18:01:09 UTC (rev 70870)
@@ -4278,14 +4278,14 @@
if (method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK)
return method;
- sig = signature_no_pinvoke (method);
-
/* we cant remote methods without this pointer */
- g_assert (sig->hasthis);
+ g_assert (mono_method_signature (method)->hasthis);
if ((res = mono_marshal_remoting_find_in_cache (method,
MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK)))
return res;
+ sig = signature_no_pinvoke (method);
+
mb = mono_mb_new (method->klass, method->name,
MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK);
for (i = 0; i <= sig->param_count; i++)
@@ -4485,8 +4485,6 @@
g_assert (method);
- target_klass = method->klass;
-
mono_marshal_lock ();
if (method->string_ctor) {
@@ -4521,7 +4519,22 @@
}
}
- cache = method->klass->image->runtime_invoke_cache;
+ target_klass = mono_defaults.object_class;
+ /*
+ * if types in the signature belong to non-mscorlib, we cache only
+ * in the method image
+ */
+ if (mono_class_from_mono_type (callsig->ret)->image !=
mono_defaults.corlib) {
+ target_klass = method->klass;
+ } else {
+ for (i = 0; i < callsig->param_count; i++) {
+ if (mono_class_from_mono_type (callsig->params
[i])->image != mono_defaults.corlib) {
+ target_klass = method->klass;
+ break;
+ }
+ }
+ }
+ cache = target_klass->image->runtime_invoke_cache;
/* from mono_marshal_find_in_cache */
res = g_hash_table_lookup (cache, callsig);
@@ -4537,8 +4550,6 @@
dealy_abort_sig->pinvoke = 0;
}
- target_klass = mono_defaults.object_class;
-
/* to make it work with our special string constructors */
if (!string_dummy) {
MONO_GC_REGISTER_ROOT (string_dummy);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches