summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-29 08:04:45 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-07-29 08:04:45 +0000
commite3c1c406fc2bf6c4c2d7308562214b00fd9f7ca1 (patch)
treec5f20d68f371fefe0a4f3a3213abdec0aee94b6d
parentc93c8e09a5ce066e4a11993d3aaf07d4afb24c1f (diff)
mjit.c: keep unit->o_file on --jit-save-temps
to use compaction with --jit-save-temps. Prior to this commit, JIT compaction didn't work with --jit-save-temps but it wasn't intentional. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--mjit.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/mjit.c b/mjit.c
index ef1a364ddd..c5fb709d92 100644
--- a/mjit.c
+++ b/mjit.c
@@ -163,11 +163,11 @@ struct rb_mjit_unit {
void *handle;
const rb_iseq_t *iseq;
#ifndef _MSC_VER
- /* This is lazily deleted so that it can be used again to create a large so file. */
+ /* This value is always set for `compact_all_jit_code`. Also used for lazy deletion. */
char *o_file;
#endif
#ifdef _WIN32
- /* DLL cannot be removed while loaded on Windows */
+ /* DLL cannot be removed while loaded on Windows. If this is set, it'll be lazily deleted. */
char *so_file;
#endif
/* Only used by unload_units. Flag to check this unit is currently on stack or not. */
@@ -537,7 +537,10 @@ clean_object_files(struct rb_mjit_unit *unit)
char *o_file = unit->o_file;
unit->o_file = NULL;
- remove_file(o_file);
+ /* For compaction, unit->o_file is always set when compilation succeeds.
+ So save_temps needs to be checked here. */
+ if (!mjit_opts.save_temps)
+ remove_file(o_file);
free(o_file);
}
#endif
@@ -547,6 +550,7 @@ clean_object_files(struct rb_mjit_unit *unit)
char *so_file = unit->so_file;
unit->so_file = NULL;
+ /* unit->so_file is set only when mjit_opts.save_temps is FALSE. */
remove_file(so_file);
free(so_file);
}
@@ -1136,8 +1140,8 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
const char *o_files[] = { o_file, NULL };
success = link_o_to_so(o_files, so_file);
- if (!mjit_opts.save_temps)
- unit->o_file = strdup(o_file); /* lazily delete on `clean_object_files()` */
+ /* Alwasy set o_file for compaction. The value is also used for lazy deletion. */
+ unit->o_file = strdup(o_file);
}
#endif
end_time = real_ms_time();