Author: zoltan
Date: 2006-07-19 13:52:25 -0400 (Wed, 19 Jul 2006)
New Revision: 62758
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/aot-compiler.c
trunk/mono/mono/mini/mini.c
trunk/mono/mono/mini/mini.h
Log:
2006-07-19 Zoltan Varga <[EMAIL PROTECTED]>
* mini.c (mono_method_to_ir): Clear ins_flag at the end of CEE_CALL.
Fixes
#78826.
* mini.c (mono_patch_info_dup_mp): New helper function.
* aot-compiler.c (compile_method): Fix some of the memory allocated
during
compilation. Fixes #78827.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2006-07-19 17:46:12 UTC (rev 62757)
+++ trunk/mono/mono/mini/ChangeLog 2006-07-19 17:52:25 UTC (rev 62758)
@@ -1,3 +1,13 @@
+2006-07-19 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * mini.c (mono_method_to_ir): Clear ins_flag at the end of CEE_CALL.
Fixes
+ #78826.
+
+ * mini.c (mono_patch_info_dup_mp): New helper function.
+
+ * aot-compiler.c (compile_method): Fix some of the memory allocated
during
+ compilation. Fixes #78827.
+
2006-07-18 Kornél Pál <[EMAIL PROTECTED]>
* declsec.c: Use original security informations for
Modified: trunk/mono/mono/mini/aot-compiler.c
===================================================================
--- trunk/mono/mono/mini/aot-compiler.c 2006-07-19 17:46:12 UTC (rev 62757)
+++ trunk/mono/mono/mini/aot-compiler.c 2006-07-19 17:52:25 UTC (rev 62758)
@@ -82,6 +82,7 @@
MonoAotOptions aot_opts;
guint32 nmethods;
guint32 opts;
+ MonoMemPool *mempool;
int ccount, mcount, lmfcount, abscount, wrappercount, ocount;
int code_size, info_size, ex_info_size, got_size, class_info_size;
} MonoAotCompile;
@@ -1126,6 +1127,8 @@
}
}
+/* FIXME: Move this to mini.c */
+
static void
compile_method (MonoAotCompile *acfg, int index)
{
@@ -1256,6 +1259,34 @@
return;
}
+ /* Make a copy of the patch info which is in the mempool */
+ {
+ MonoJumpInfo *patches = NULL, *patches_end = NULL;
+
+ for (patch_info = cfg->patch_info; patch_info; patch_info =
patch_info->next) {
+ MonoJumpInfo *new_patch_info = mono_patch_info_dup_mp
(acfg->mempool, patch_info);
+
+ if (!patches)
+ patches = new_patch_info;
+ else
+ patches_end->next = new_patch_info;
+ patches_end = new_patch_info;
+ }
+ cfg->patch_info = patches;
+ }
+
+ /* Free some fields used by cfg to conserve memory */
+ mono_mempool_destroy (cfg->mempool);
+ cfg->mempool = NULL;
+ g_free (cfg->varinfo);
+ cfg->varinfo = NULL;
+ g_free (cfg->vars);
+ cfg->vars = NULL;
+ if (cfg->rs) {
+ mono_regstate_free (cfg->rs);
+ cfg->rs = NULL;
+ }
+
//printf ("Compile: %s\n", mono_method_full_name (method,
TRUE));
acfg->cfgs [index] = cfg;
@@ -1640,6 +1671,7 @@
acfg->image_table = g_ptr_array_new ();
acfg->image = image;
acfg->opts = opts;
+ acfg->mempool = mono_mempool_new ();
mono_aot_parse_options (aot_options, &acfg->aot_opts);
Modified: trunk/mono/mono/mini/mini.c
===================================================================
--- trunk/mono/mono/mini/mini.c 2006-07-19 17:46:12 UTC (rev 62757)
+++ trunk/mono/mono/mini/mini.c 2006-07-19 17:52:25 UTC (rev 62758)
@@ -4509,12 +4509,14 @@
}
ip += 5;
+ ins_flag = 0;
break;
}
if ((ins_flag & MONO_INST_TAILCALL) && cmethod && (*ip
== CEE_CALL) &&
(mono_metadata_signature_equal
(mono_method_signature (method), mono_method_signature (cmethod)))) {
int i;
+
/* Prevent inlining of methods with tail calls
(the call stack would be altered) */
INLINE_FAILURE;
/* FIXME: This assumes the two methods has the
same number and type of arguments */
@@ -4559,6 +4561,7 @@
}
ip += 5;
+ ins_flag = 0;
break;
}
@@ -4596,6 +4599,7 @@
bblock = ebblock;
inline_costs += costs;
+ ins_flag = 0;
break;
}
}
@@ -4634,7 +4638,7 @@
ip += 6;
else
ip += 5;
-
+ ins_flag = 0;
break;
}
}
@@ -4721,6 +4725,7 @@
}
ip += 5;
+ ins_flag = 0;
break;
}
case CEE_RET:
@@ -8379,6 +8384,36 @@
}
}
+/**
+ * mono_patch_info_dup_mp:
+ *
+ * Make a copy of PATCH_INFO, allocating memory from the mempool MP.
+ */
+MonoJumpInfo*
+mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo *patch_info)
+{
+ MonoJumpInfo *res = mono_mempool_alloc (mp, sizeof (MonoJumpInfo));
+ memcpy (res, patch_info, sizeof (MonoJumpInfo));
+
+ switch (patch_info->type) {
+ case MONO_PATCH_INFO_LDSTR:
+ case MONO_PATCH_INFO_TYPE_FROM_HANDLE:
+ case MONO_PATCH_INFO_LDTOKEN:
+ case MONO_PATCH_INFO_DECLSEC:
+ res->data.token = mono_mempool_alloc (mp, sizeof
(MonoJumpInfoToken));
+ memcpy (res->data.token, patch_info->data.token, sizeof
(MonoJumpInfoToken));
+ break;
+ case MONO_PATCH_INFO_SWITCH:
+ res->data.table = mono_mempool_alloc (mp, sizeof
(MonoJumpInfoBBTable));
+ memcpy (res->data.table, patch_info->data.table, sizeof
(MonoJumpInfoBBTable));
+ break;
+ default:
+ break;
+ }
+
+ return res;
+}
+
gpointer
mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8
*code, MonoJumpInfo *patch_info, gboolean run_cctors)
{
Modified: trunk/mono/mono/mini/mini.h
===================================================================
--- trunk/mono/mono/mini/mini.h 2006-07-19 17:46:12 UTC (rev 62757)
+++ trunk/mono/mono/mini/mini.h 2006-07-19 17:52:25 UTC (rev 62758)
@@ -852,6 +852,7 @@
void mono_disassemble_code (MonoCompile *cfg, guint8 *code,
int size, char *id);
void mono_add_patch_info (MonoCompile *cfg, int ip,
MonoJumpInfoType type, gconstpointer target);
void mono_remove_patch_info (MonoCompile *cfg, int ip);
+MonoJumpInfo* mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo
*patch_info);
gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain
*domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors);
MonoLMF** mono_get_lmf_addr (void);
void mono_jit_thread_attach (MonoDomain *domain);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches