ruby-changes:51387
From: k0kubun <ko1@a...>
Date: Wed, 6 Jun 2018 23:37:02 +0900 (JST)
Subject: [ruby-changes:51387] k0kubun:r63593 (trunk): mjit.c: unify wording between comments and variables
k0kubun 2018-06-06 23:36:56 +0900 (Wed, 06 Jun 2018) New Revision: 63593 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63593 Log: mjit.c: unify wording between comments and variables Some comments say "stop", others say "finish". I'm going to add code which dynamically stops MJIT worker, rather than finishing it forever. So I'm thinking `stop` is more appropreate for it. Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 63592) +++ mjit.c (revision 63593) @@ -913,10 +913,10 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L913 return (mjit_func_t)func; } -/* Set to TRUE to finish worker. */ -static int finish_worker_p; -/* Set to TRUE if worker is finished. */ -static int worker_finished; +/* Set to TRUE to stop worker. */ +static int stop_worker_p; +/* Set to TRUE if worker is stopped. */ +static int worker_stopped; /* The function implementing a worker. It is executed in a separate thread by rb_thread_create_mjit_thread. It compiles precompiled header @@ -927,21 +927,21 @@ worker(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L927 make_pch(); if (pch_status == PCH_FAILED) { mjit_init_p = FALSE; - CRITICAL_SECTION_START(3, "in worker to update worker_finished"); - worker_finished = TRUE; + CRITICAL_SECTION_START(3, "in worker to update worker_stopped"); + worker_stopped = TRUE; verbose(3, "Sending wakeup signal to client in a mjit-worker"); rb_native_cond_signal(&mjit_client_wakeup); - CRITICAL_SECTION_FINISH(3, "in worker to update worker_finished"); + CRITICAL_SECTION_FINISH(3, "in worker to update worker_stopped"); return; /* TODO: do the same thing in the latter half of mjit_finish */ } /* main worker loop */ - while (!finish_worker_p) { + while (!stop_worker_p) { struct rb_mjit_unit_node *node; /* wait until unit is available */ CRITICAL_SECTION_START(3, "in worker dequeue"); - while ((unit_queue.head == NULL || active_units.length > mjit_opts.max_cache_size) && !finish_worker_p) { + while ((unit_queue.head == NULL || active_units.length > mjit_opts.max_cache_size) && !stop_worker_p) { rb_native_cond_wait(&mjit_worker_wakeup, &mjit_engine_mutex); verbose(3, "Getting wakeup from client"); } @@ -962,7 +962,7 @@ worker(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L962 } /* To keep mutex unlocked when it is destroyed by mjit_finish, don't wrap CRITICAL_SECTION here. */ - worker_finished = TRUE; + worker_stopped = TRUE; } /* MJIT info related to an existing continutaion. */ @@ -1421,8 +1421,8 @@ mjit_init(struct mjit_options *opts) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1421 rb_define_global_const("RUBY_DESCRIPTION", rb_obj_freeze(rb_description)); /* Initialize worker thread */ - finish_worker_p = FALSE; - worker_finished = FALSE; + stop_worker_p = FALSE; + worker_stopped = FALSE; if (!rb_thread_create_mjit_thread(child_after_fork, worker)) { mjit_init_p = FALSE; rb_native_mutex_destroy(&mjit_engine_mutex); @@ -1458,8 +1458,8 @@ mjit_finish(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1458 CRITICAL_SECTION_FINISH(3, "in mjit_finish to wakeup from pch"); /* Stop worker */ - finish_worker_p = TRUE; - while (!worker_finished) { + stop_worker_p = TRUE; + while (!worker_stopped) { verbose(3, "Sending cancel signal to workers"); CRITICAL_SECTION_START(3, "in mjit_finish"); rb_native_cond_broadcast(&mjit_worker_wakeup); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/