diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-23 13:41:06 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-06-23 13:41:06 +0000 |
commit | 06f54f03039c225c5c0b5d1709865fb4fff02776 (patch) | |
tree | e75e84878da6dbf03e16af50c1c5529e86852660 /mjit.c | |
parent | 359dd59db2512d801bb983f98bede4fc598f139a (diff) | |
download | ruby-06f54f03039c225c5c0b5d1709865fb4fff02776.tar.gz |
mjit.c: unify the variable name with method name
`RubyVM::MJIT.enabled?`.
It's set to be TRUE even before initialization is finished.
So it was actually not "mjit initialized predicate".
This flag is also used to check whether JIT-ed code should be called
or not, but I'm going to split the responsibility to another flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -169,8 +169,8 @@ struct rb_mjit_unit_list { int length; /* the list length */ }; -/* TRUE if MJIT is initialized and will be used. */ -int mjit_init_p = FALSE; +/* TRUE if MJIT is enabled. */ +int mjit_enabled = FALSE; /* Priority queue of iseqs waiting for JIT compilation. This variable is a pointer to head unit of the queue. */ @@ -422,7 +422,7 @@ CRITICAL_SECTION_FINISH(int level, const char *msg) void mjit_gc_start_hook(void) { - if (!mjit_init_p) + if (!mjit_enabled) return; CRITICAL_SECTION_START(4, "mjit_gc_start_hook"); while (in_jit) { @@ -439,7 +439,7 @@ mjit_gc_start_hook(void) void mjit_gc_finish_hook(void) { - if (!mjit_init_p) + if (!mjit_enabled) return; CRITICAL_SECTION_START(4, "mjit_gc_finish_hook"); in_gc = FALSE; @@ -453,7 +453,7 @@ mjit_gc_finish_hook(void) void mjit_free_iseq(const rb_iseq_t *iseq) { - if (!mjit_init_p) + if (!mjit_enabled) return; CRITICAL_SECTION_START(4, "mjit_free_iseq"); if (iseq->body->jit_unit) { @@ -947,7 +947,7 @@ worker(void) make_pch(); } if (pch_status == PCH_FAILED) { - mjit_init_p = FALSE; + mjit_enabled = FALSE; CRITICAL_SECTION_START(3, "in worker to update worker_stopped"); worker_stopped = TRUE; verbose(3, "Sending wakeup signal to client in a mjit-worker"); @@ -1162,7 +1162,7 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq) { struct rb_mjit_unit_node *node; - if (!mjit_init_p || pch_status == PCH_FAILED) + if (!mjit_enabled || pch_status == PCH_FAILED) return; iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC; @@ -1274,7 +1274,7 @@ static void child_after_fork(void) { verbose(3, "Switching off MJIT in a forked child"); - mjit_init_p = FALSE; + mjit_enabled = FALSE; /* TODO: Should we initiate MJIT in the forked Ruby. */ } @@ -1388,7 +1388,7 @@ start_worker(void) worker_stopped = FALSE; if (!rb_thread_create_mjit_thread(child_after_fork, worker)) { - mjit_init_p = FALSE; + mjit_enabled = FALSE; rb_native_mutex_destroy(&mjit_engine_mutex); rb_native_cond_destroy(&mjit_pch_wakeup); rb_native_cond_destroy(&mjit_client_wakeup); @@ -1409,7 +1409,7 @@ mjit_init(struct mjit_options *opts) VALUE rb_description; mjit_opts = *opts; - mjit_init_p = TRUE; + mjit_enabled = TRUE; /* Normalize options */ if (mjit_opts.min_calls == 0) @@ -1431,7 +1431,7 @@ mjit_init(struct mjit_options *opts) init_header_filename(); pch_file = get_uniq_filename(0, MJIT_TMP_PREFIX "h", ".h.gch"); if (header_file == NULL || pch_file == NULL) { - mjit_init_p = FALSE; + mjit_enabled = FALSE; verbose(1, "Failure in MJIT header file name initialization\n"); return; } @@ -1481,7 +1481,7 @@ stop_worker(void) VALUE mjit_pause(void) { - if (!mjit_init_p) { + if (!mjit_enabled) { rb_raise(rb_eRuntimeError, "MJIT is not enabled"); } if (worker_stopped) { @@ -1496,7 +1496,7 @@ mjit_pause(void) VALUE mjit_resume(void) { - if (!mjit_init_p) { + if (!mjit_enabled) { rb_raise(rb_eRuntimeError, "MJIT is not enabled"); } if (!worker_stopped) { @@ -1515,7 +1515,7 @@ mjit_resume(void) void mjit_finish(void) { - if (!mjit_init_p) + if (!mjit_enabled) return; /* Wait for pch finish */ @@ -1553,7 +1553,7 @@ mjit_finish(void) free_list(&active_units); finish_conts(); - mjit_init_p = FALSE; + mjit_enabled = FALSE; verbose(1, "Successful MJIT finish"); } @@ -1561,7 +1561,7 @@ void mjit_mark(void) { struct rb_mjit_unit_node *node; - if (!mjit_init_p) + if (!mjit_enabled) return; RUBY_MARK_ENTER("mjit"); CRITICAL_SECTION_START(4, "mjit_mark"); @@ -1585,7 +1585,7 @@ mjit_mark(void) void mjit_add_class_serial(rb_serial_t class_serial) { - if (!mjit_init_p) + if (!mjit_enabled) return; /* Do not wrap CRITICAL_SECTION here. This function is only called in main thread @@ -1597,7 +1597,7 @@ mjit_add_class_serial(rb_serial_t class_serial) void mjit_remove_class_serial(rb_serial_t class_serial) { - if (!mjit_init_p) + if (!mjit_enabled) return; CRITICAL_SECTION_START(3, "in mjit_remove_class_serial"); |