@@ -488,13 +488,8 @@ mono_interp_get_imethod (MonoMethod *method)
488488
489489 sig = mono_method_signature_internal (method );
490490
491- MonoMemPool * dyn_mp = NULL ;
492491 if (method -> dynamic )
493- // FIXME: Use this in more places
494- dyn_mp = mono_mempool_new_size (sizeof (InterpMethod ));
495-
496- if (dyn_mp )
497- imethod = (InterpMethod * )mono_mempool_alloc0 (dyn_mp , sizeof (InterpMethod ));
492+ imethod = (InterpMethod * )mono_dyn_method_alloc0 (method , sizeof (InterpMethod ));
498493 else
499494 imethod = (InterpMethod * )m_method_alloc0 (method , sizeof (InterpMethod ));
500495 imethod -> method = method ;
@@ -512,8 +507,8 @@ mono_interp_get_imethod (MonoMethod *method)
512507 imethod -> rtype = m_class_get_byval_arg (mono_defaults .string_class );
513508 else
514509 imethod -> rtype = mini_get_underlying_type (sig -> ret );
515- if (dyn_mp )
516- imethod -> param_types = (MonoType * * )mono_mempool_alloc0 ( dyn_mp , sizeof (MonoType * ) * sig -> param_count );
510+ if (method -> dynamic )
511+ imethod -> param_types = (MonoType * * )mono_dyn_method_alloc0 ( method , sizeof (MonoType * ) * sig -> param_count );
517512 else
518513 imethod -> param_types = (MonoType * * )m_method_alloc0 (method , sizeof (MonoType * ) * sig -> param_count );
519514 for (i = 0 ; i < sig -> param_count ; ++ i )
@@ -523,11 +518,7 @@ mono_interp_get_imethod (MonoMethod *method)
523518 InterpMethod * old_imethod ;
524519 if (!((old_imethod = mono_internal_hash_table_lookup (& jit_mm -> interp_code_hash , method )))) {
525520 mono_internal_hash_table_insert (& jit_mm -> interp_code_hash , method , imethod );
526- if (method -> dynamic )
527- ((MonoDynamicMethod * )method )-> mp = dyn_mp ;
528521 } else {
529- if (dyn_mp )
530- mono_mempool_destroy (dyn_mp );
531522 imethod = old_imethod ; /* leak the newly allocated InterpMethod to the mempool */
532523 }
533524 jit_mm_unlock (jit_mm );
@@ -1284,17 +1275,12 @@ compute_arg_offset (MonoMethodSignature *sig, int index)
12841275}
12851276
12861277static gpointer
1287- imethod_alloc0 (InterpMethod * imethod , size_t size )
1288- {
1289- if (imethod -> method -> dynamic ) {
1290- MonoJitMemoryManager * jit_mm = get_default_jit_mm ();
1291- jit_mm_lock (jit_mm );
1292- gpointer ret = mono_mempool_alloc0 (((MonoDynamicMethod * )imethod -> method )-> mp , (guint )size );
1293- jit_mm_unlock (jit_mm );
1294- return ret ;
1295- } else {
1296- return m_method_alloc0 (imethod -> method , (guint )size );
1297- }
1278+ imethod_alloc0 (InterpMethod * imethod , guint size )
1279+ {
1280+ if (imethod -> method -> dynamic )
1281+ return mono_dyn_method_alloc0 (imethod -> method , size );
1282+ else
1283+ return m_method_alloc0 (imethod -> method , size );
12981284}
12991285
13001286static guint32 *
0 commit comments