Skip to content

Commit fa3dccb

Browse files
authored
[mono][interp] Free var_values table later (#98482)
It contains, among other things, ref count information for vars. This is also used late in the codgen process, for peephole optimization when generating marvin block intrinsic.
1 parent 64204a5 commit fa3dccb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/mono/mono/mini/interp/transform.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9022,12 +9022,6 @@ generate (MonoMethod *method, MonoMethodHeader *header, InterpMethod *rtm, MonoG
90229022
if (td->optimized) {
90239023
MONO_TIME_TRACK (mono_interp_stats.optimize_time, interp_optimize_code (td));
90249024
interp_alloc_offsets (td);
9025-
// Offset allocator uses computed ref counts from var values. We have to free this
9026-
// table later here.
9027-
if (td->var_values != NULL) {
9028-
g_free (td->var_values);
9029-
td->var_values = NULL;
9030-
}
90319025
interp_squash_initlocals (td);
90329026
#if HOST_BROWSER
90339027
if (mono_interp_opt & INTERP_OPT_JITERPRETER)
@@ -9037,6 +9031,15 @@ generate (MonoMethod *method, MonoMethodHeader *header, InterpMethod *rtm, MonoG
90379031

90389032
generate_compacted_code (rtm, td);
90399033

9034+
if (td->optimized) {
9035+
// Offset allocator and compacted code generation use computed ref counts
9036+
// from var values. We have to free this table later here.
9037+
if (td->var_values != NULL) {
9038+
g_free (td->var_values);
9039+
td->var_values = NULL;
9040+
}
9041+
}
9042+
90409043
if (td->total_locals_size >= G_MAXUINT16) {
90419044
if (td->disable_inlining && td->optimized) {
90429045
char *name = mono_method_get_full_name (method);

0 commit comments

Comments
 (0)