Bugzilla – Attachment 363090 Details for
Bug 605295
Memory leak with DynamicMethod and --debug
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
revert some patches
26-diff (text/plain), 8.34 KB, created by
Geoff Norton
on 2010-05-19 01:04:36 UTC
(
hide
)
Description:
revert some patches
Filename:
MIME Type:
Creator:
Geoff Norton
Created:
2010-05-19 01:04:36 UTC
Size:
8.34 KB
patch
obsolete
>diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog >index 03ff298..90fa9ce 100644 >--- a/mono/metadata/ChangeLog >+++ b/mono/metadata/ChangeLog >@@ -4273,12 +4273,6 @@ Thu Jun 25 15:48:09 CEST 2009 Paolo Molaro <lupus@ximian.com> > > * security-core-clr.c: Fix typo > >-2009-04-14 Zoltan Varga <vargaz@gmail.com> >- >- * marshal.c (delegate_hash_table_add): Make delegate_target_locations >- a MonoGHashTable to keep its values alive. >- (emit_marshal_boolean): Fix a warning. >- > 2009-04-13 Gonzalo Paniagua Javier <gonzalo@novell.com> > > * socket-io.c: don't return IPv4/IPv6 addresses if the machine does >@@ -4290,10 +4284,6 @@ Thu Jun 25 15:48:09 CEST 2009 Paolo Molaro <lupus@ximian.com> > > 2009-04-14 Zoltan Varga <vargaz@gmail.com> > >- * marshal.c (mono_delegate_to_ftnptr): Use mono_gc_alloc_fixed () for >- allocating the location holding the this argument to prevent >- 'too many root sets' errors. >- > * object.c (mono_class_create_runtime_vtable): Set field->offset to -1 > to mark fields as special static. > (mono_field_static_get_value): Handle special static fields. >diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c >index a254e33..88b6d7f 100644 >--- a/mono/metadata/marshal.c >+++ b/mono/metadata/marshal.c >@@ -81,7 +81,7 @@ static guint32 last_error_tls_id; > static guint32 load_type_info_tls_id; > > static void >-delegate_hash_table_add (MonoDelegate *d, MonoObject **target_loc); >+delegate_hash_table_add (MonoDelegate *d); > > static void > emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object); >@@ -313,7 +313,6 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate) > { > MonoMethod *method, *wrapper; > MonoClass *klass; >- MonoObject **target_loc; > > if (!delegate) > return NULL; >@@ -338,20 +337,12 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate) > return ftnptr; > } > >- if (delegate->target) { >- /* Produce a location which can be embedded in JITted code */ >- target_loc = mono_gc_alloc_fixed (sizeof (MonoObject*), NULL); >- *target_loc = delegate->target; >- } else { >- target_loc = NULL; >- } >- >- wrapper = mono_marshal_get_managed_wrapper (method, klass, target_loc); >+ wrapper = mono_marshal_get_managed_wrapper (method, klass, delegate->target); > >- delegate->delegate_trampoline = mono_compile_method (wrapper); >+ delegate->delegate_trampoline = mono_compile_method (wrapper); > > // Add the delegate to the delegate hash table >- delegate_hash_table_add (delegate, target_loc); >+ delegate_hash_table_add (delegate); > > /* when the object is collected, collect the dynamic method, too */ > mono_object_register_finalizer ((MonoObject*)delegate); >@@ -365,8 +356,6 @@ mono_delegate_to_ftnptr (MonoDelegate *delegate) > * object pointer itself, otherwise we use a GC handle. > */ > static GHashTable *delegate_hash_table; >-/* Contains root locations pointing to the this arguments of delegates */ >-static MonoGHashTable *delegate_target_locations; > > static GHashTable * > delegate_hash_table_new (void) { >@@ -376,7 +365,6 @@ delegate_hash_table_new (void) { > static void > delegate_hash_table_remove (MonoDelegate *d) > { >- MonoObject **target_loc; > #ifdef HAVE_MOVING_COLLECTOR > guint32 gchandle; > #endif >@@ -387,23 +375,14 @@ delegate_hash_table_remove (MonoDelegate *d) > gchandle = GPOINTER_TO_UINT (g_hash_table_lookup (delegate_hash_table, d->delegate_trampoline)); > #endif > g_hash_table_remove (delegate_hash_table, d->delegate_trampoline); >- if (delegate_target_locations) >- target_loc = mono_g_hash_table_lookup (delegate_target_locations, d->delegate_trampoline); >- else >- target_loc = NULL; >- if (target_loc) >- mono_g_hash_table_remove (delegate_target_locations, d->delegate_trampoline); > mono_marshal_unlock (); >- if (target_loc) { >- mono_gc_free_fixed (target_loc); >- } > #ifdef HAVE_MOVING_COLLECTOR > mono_gchandle_free (gchandle); > #endif > } > > static void >-delegate_hash_table_add (MonoDelegate *d, MonoObject **target_loc) >+delegate_hash_table_add (MonoDelegate *d) > { > #ifdef HAVE_MOVING_COLLECTOR > guint32 gchandle = mono_gchandle_new_weakref ((MonoObject*)d, FALSE); >@@ -412,11 +391,6 @@ delegate_hash_table_add (MonoDelegate *d, MonoObject **target_loc) > mono_marshal_lock (); > if (delegate_hash_table == NULL) > delegate_hash_table = delegate_hash_table_new (); >- if (delegate_target_locations == NULL) { >- /* Has to be conservative as the values are not object references */ >- delegate_target_locations = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_CONSERVATIVE_GC); >- MONO_GC_REGISTER_ROOT (delegate_target_locations); >- } > #ifdef HAVE_MOVING_COLLECTOR > old_gchandle = GPOINTER_TO_UINT (g_hash_table_lookup (delegate_hash_table, d->delegate_trampoline)); > g_hash_table_insert (delegate_hash_table, d->delegate_trampoline, GUINT_TO_POINTER (gchandle)); >@@ -425,9 +399,6 @@ delegate_hash_table_add (MonoDelegate *d, MonoObject **target_loc) > #else > g_hash_table_insert (delegate_hash_table, d->delegate_trampoline, d); > #endif >- if (target_loc) >- /* This keeps target_loc alive for Boehm */ >- mono_g_hash_table_insert (delegate_target_locations, d->delegate_trampoline, target_loc); > mono_marshal_unlock (); > } > >@@ -7578,6 +7549,7 @@ emit_marshal_boolean (EmitMarshalContext *m, int argnum, MonoType *t, > > case MARSHAL_ACTION_MANAGED_CONV_IN: { > MonoClass* conv_arg_class = mono_defaults.int32_class; >+ gint variant_bool = 0; > guint8 ldop = CEE_LDIND_I4; > int label_null, label_false; > >@@ -8272,16 +8244,9 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig > return res; > } > >-/* >- * mono_marshal_emit_managed_wrapper: >- * >- * Emit the body of a native-to-managed wrapper. INVOKE_SIG is the signature of >- * the delegate which wraps the managed method to be called. For closed delegates, >- * it could have fewer parameters than the method it wraps. >- * THIS_LOC is the memory location where the target of the delegate is stored. >- */ >+/* FIXME: moving GC */ > void >-mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, MonoObject** this_loc) >+mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, MonoObject* this) > { > MonoMethodSignature *sig, *csig; > int i, *tmp_locals; >@@ -8339,10 +8304,11 @@ mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *i > > emit_thread_interrupt_checkpoint (mb); > >+ /* fixme: howto handle this ? */ > if (sig->hasthis) { >- if (this_loc) { >- mono_mb_emit_ptr (mb, this_loc); >- mono_mb_emit_byte (mb, CEE_LDIND_REF); >+ if (this) { >+ /* FIXME: need a solution for the moving GC here */ >+ mono_mb_emit_ptr (mb, this); > } else { > /* fixme: */ > g_assert_not_reached (); >@@ -8497,7 +8463,7 @@ mono_marshal_set_callconv_from_modopt (MonoMethod *method, MonoMethodSignature * > * generates IL code to call managed methods from unmanaged code > */ > MonoMethod * >-mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, MonoObject **this_loc) >+mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, MonoObject *this) > { > static MonoClass *UnmanagedFunctionPointerAttribute; > MonoMethodSignature *sig, *csig, *invoke_sig; >@@ -8518,7 +8484,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, > * options. > */ > cache = get_cache (&method->klass->image->managed_wrapper_cache, mono_aligned_addr_hash, NULL); >- if (!this_loc && (res = mono_marshal_find_in_cache (cache, method))) >+ if (!this && (res = mono_marshal_find_in_cache (cache, method))) > return res; > > invoke = mono_get_delegate_invoke (delegate_klass); >@@ -8532,7 +8498,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, > mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_NATIVE_TO_MANAGED); > > /* we copy the signature, so that we can modify it */ >- if (this_loc) >+ if (this) > /* Need to free this later */ > csig = mono_metadata_signature_dup (invoke_sig); > else >@@ -8577,9 +8543,9 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, > } > } > >- mono_marshal_emit_managed_wrapper (mb, invoke_sig, mspecs, &m, method, this_loc); >+ mono_marshal_emit_managed_wrapper (mb, invoke_sig, mspecs, &m, method, this); > >- if (!this_loc) >+ if (!this) > res = mono_mb_create_and_cache (cache, method, > mb, csig, sig->param_count + 16); > else {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 605295
:
361890
|
362494
|
363024
| 363090