mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Shrink the blocking region for compile_compact_jit_code
Isn't setting `in_compact = true` enough to avoid a race condition between JIT compaction and unload_units? Now I think it is. This change will make it easier to spend more time on compile_compact_jit_code. For now it seems to take only 0.0723ms though.
This commit is contained in:
parent
3f8c60cf09
commit
ed8e552d4d
1 changed files with 3 additions and 4 deletions
|
@ -934,7 +934,6 @@ compact_all_jit_code(void)
|
||||||
{
|
{
|
||||||
# if USE_HEADER_TRANSFORMATION
|
# if USE_HEADER_TRANSFORMATION
|
||||||
struct rb_mjit_unit *unit, *cur = 0;
|
struct rb_mjit_unit *unit, *cur = 0;
|
||||||
double start_time, end_time;
|
|
||||||
static const char c_ext[] = ".c";
|
static const char c_ext[] = ".c";
|
||||||
static const char so_ext[] = DLEXT;
|
static const char so_ext[] = DLEXT;
|
||||||
char c_file[MAXPATHLEN], so_file[MAXPATHLEN];
|
char c_file[MAXPATHLEN], so_file[MAXPATHLEN];
|
||||||
|
@ -947,17 +946,17 @@ compact_all_jit_code(void)
|
||||||
|
|
||||||
sprint_uniq_filename(c_file, (int)sizeof(c_file), unit->id, MJIT_TMP_PREFIX, c_ext);
|
sprint_uniq_filename(c_file, (int)sizeof(c_file), unit->id, MJIT_TMP_PREFIX, c_ext);
|
||||||
CRITICAL_SECTION_START(3, "in compact_all_jit_code to guard .c files from unload_units");
|
CRITICAL_SECTION_START(3, "in compact_all_jit_code to guard .c files from unload_units");
|
||||||
bool success = compile_compact_jit_code(c_file);
|
|
||||||
in_compact = true;
|
in_compact = true;
|
||||||
CRITICAL_SECTION_FINISH(3, "in compact_all_jit_code to guard .c files from unload_units");
|
CRITICAL_SECTION_FINISH(3, "in compact_all_jit_code to guard .c files from unload_units");
|
||||||
|
|
||||||
start_time = real_ms_time();
|
bool success = compile_compact_jit_code(c_file);
|
||||||
|
double start_time = real_ms_time();
|
||||||
if (success) {
|
if (success) {
|
||||||
success = compile_c_to_so(c_file, so_file);
|
success = compile_c_to_so(c_file, so_file);
|
||||||
if (!mjit_opts.save_temps)
|
if (!mjit_opts.save_temps)
|
||||||
remove_file(c_file);
|
remove_file(c_file);
|
||||||
}
|
}
|
||||||
end_time = real_ms_time();
|
double end_time = real_ms_time();
|
||||||
|
|
||||||
CRITICAL_SECTION_START(3, "in compact_all_jit_code to release .c files");
|
CRITICAL_SECTION_START(3, "in compact_all_jit_code to release .c files");
|
||||||
in_compact = false;
|
in_compact = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue