free_hash (image->stfld_wrapper_cache);
free_hash (image->isinst_cache);
free_hash (image->castclass_cache);
+ free_hash (image->icall_wrapper_cache);
free_hash (image->proxy_isinst_cache);
free_hash (image->var_cache_slow);
free_hash (image->mvar_cache_slow);
int i;
WrapperInfo *info;
+ GHashTable *cache = get_cache (&mono_defaults.object_class->image->icall_wrapper_cache, mono_aligned_addr_hash, NULL);
+ if ((res = mono_marshal_find_in_cache (cache, (gpointer) func)))
+ return res;
+
g_assert (sig->pinvoke);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_ICALL_WRAPPER);
info->d.icall.func = (gpointer)func;
- res = mono_mb_create (mb, csig, csig->param_count + 16, info);
+ res = mono_mb_create_and_cache_full (cache, (gpointer) func, mb, csig, csig->param_count + 16, info, NULL);
mono_mb_free (mb);
return res;
GHashTable *ldflda_wrapper_cache;
GHashTable *stfld_wrapper_cache;
GHashTable *isinst_cache;
+
+ GHashTable *icall_wrapper_cache;
GHashTable *castclass_cache;
GHashTable *proxy_isinst_cache;
GHashTable *rgctx_template_hash; /* LOCKING: templates lock */