[前][次][番号順一覧][スレッド一覧]

ruby-changes:52079

From: k0kubun <ko1@a...>
Date: Sat, 11 Aug 2018 17:07:18 +0900 (JST)
Subject: [ruby-changes:52079] k0kubun:r64287 (trunk): mjit_worker.c: prefix mjit_ to pch_status

k0kubun	2018-08-11 17:07:13 +0900 (Sat, 11 Aug 2018)

  New Revision: 64287

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64287

  Log:
    mjit_worker.c: prefix mjit_ to pch_status
    
    which was just forgotten.
    
    mjit.c: ditto
    
    mjit_internal.h: moved some macros only used by mjit_worker.c to it.

  Modified files:
    trunk/mjit.c
    trunk/mjit_internal.h
    trunk/mjit_worker.c
Index: mjit_worker.c
===================================================================
--- mjit_worker.c	(revision 64286)
+++ mjit_worker.c	(revision 64287)
@@ -101,6 +101,14 @@ https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L101
 #include "dln.h"
 #include "mjit_internal.h"
 
+#ifdef _WIN32
+#define waitpid(pid,stat_loc,options) (WaitForSingleObject((HANDLE)(pid), INFINITE), GetExitCodeProcess((HANDLE)(pid), (LPDWORD)(stat_loc)), (pid))
+#define WIFEXITED(S) ((S) != STILL_ACTIVE)
+#define WEXITSTATUS(S) (S)
+#define WIFSIGNALED(S) (0)
+typedef intptr_t pid_t;
+#endif
+
 /* process.c */
 rb_pid_t ruby_waitpid_locked(rb_vm_t *, rb_pid_t, int *status, int options,
                           rb_nativethread_cond_t *cond);
@@ -198,7 +206,7 @@ static const char *const CC_LIBS[] = { https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L206
 
 /* Status of the precompiled header creation.  The status is
    shared by the workers and the pch thread.  */
-enum pch_status_t pch_status;
+enum pch_status_t mjit_pch_status;
 
 /* Return the best unit from list.  The best is the first
    high priority unit or the unit whose iseq has the biggest number
@@ -461,7 +469,7 @@ make_pch(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L469
         if (mjit_opts.warnings || mjit_opts.verbose)
             fprintf(stderr, "MJIT warning: making precompiled header failed on forming args\n");
         CRITICAL_SECTION_START(3, "in make_pch");
-        pch_status = PCH_FAILED;
+        mjit_pch_status = PCH_FAILED;
         CRITICAL_SECTION_FINISH(3, "in make_pch");
         return;
     }
@@ -471,11 +479,11 @@ make_pch(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L479
 
     CRITICAL_SECTION_START(3, "in make_pch");
     if (exit_code == 0) {
-        pch_status = PCH_SUCCESS;
+        mjit_pch_status = PCH_SUCCESS;
     } else {
         if (mjit_opts.warnings || mjit_opts.verbose)
             fprintf(stderr, "MJIT warning: Making precompiled header failed on compilation. Stopping MJIT worker...\n");
-        pch_status = PCH_FAILED;
+        mjit_pch_status = PCH_FAILED;
     }
     /* wakeup `mjit_finish` */
     rb_native_cond_broadcast(&mjit_pch_wakeup);
@@ -843,11 +851,11 @@ void https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L851
 mjit_worker(void)
 {
 #ifndef _MSC_VER
-    if (pch_status == PCH_NOT_READY) {
+    if (mjit_pch_status == PCH_NOT_READY) {
         make_pch();
     }
 #endif
-    if (pch_status == PCH_FAILED) {
+    if (mjit_pch_status == PCH_FAILED) {
         mjit_enabled = FALSE;
         CRITICAL_SECTION_START(3, "in worker to update mjit_worker_stopped");
         mjit_worker_stopped = TRUE;
Index: mjit.c
===================================================================
--- mjit.c	(revision 64286)
+++ mjit.c	(revision 64287)
@@ -192,7 +192,7 @@ free_list(struct rb_mjit_unit_list *list https://github.com/ruby/ruby/blob/trunk/mjit.c#L192
     }
 }
 
-extern enum pch_status_t pch_status;
+extern enum pch_status_t mjit_pch_status;
 extern int mjit_stop_worker_p;
 extern int mjit_worker_stopped;
 
@@ -368,7 +368,7 @@ mjit_add_iseq_to_process(const rb_iseq_t https://github.com/ruby/ruby/blob/trunk/mjit.c#L368
 {
     struct rb_mjit_unit_node *node;
 
-    if (!mjit_enabled || pch_status == PCH_FAILED)
+    if (!mjit_enabled || mjit_pch_status == PCH_FAILED)
         return;
 
     iseq->body->jit_func = (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC;
@@ -402,7 +402,7 @@ mjit_get_iseq_func(struct rb_iseq_consta https://github.com/ruby/ruby/blob/trunk/mjit.c#L402
     tv.tv_usec = 1000;
     while (body->jit_func == (mjit_func_t)NOT_READY_JIT_ISEQ_FUNC) {
         tries++;
-        if (tries / 1000 > MJIT_WAIT_TIMEOUT_SECONDS || pch_status == PCH_FAILED) {
+        if (tries / 1000 > MJIT_WAIT_TIMEOUT_SECONDS || mjit_pch_status == PCH_FAILED) {
             CRITICAL_SECTION_START(3, "in mjit_get_iseq_func to set jit_func");
             body->jit_func = (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC; /* JIT worker seems dead. Give up. */
             CRITICAL_SECTION_FINISH(3, "in mjit_get_iseq_func to set jit_func");
@@ -661,9 +661,9 @@ mjit_init(struct mjit_options *opts) https://github.com/ruby/ruby/blob/trunk/mjit.c#L661
 
     /* Initialize variables for compilation */
 #ifdef _MSC_VER
-    pch_status = PCH_SUCCESS; /* has prebuilt precompiled header */
+    mjit_pch_status = PCH_SUCCESS; /* has prebuilt precompiled header */
 #else
-    pch_status = PCH_NOT_READY;
+    mjit_pch_status = PCH_NOT_READY;
 #endif
     mjit_cc_path = CC_PATH;
 
@@ -779,7 +779,7 @@ mjit_finish(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L779
        threads can produce temp files.  And even if the temp files are
        removed, the used C compiler still complaint about their
        absence.  So wait for a clean finish of the threads.  */
-    while (pch_status == PCH_NOT_READY) {
+    while (mjit_pch_status == PCH_NOT_READY) {
         verbose(3, "Waiting wakeup from make_pch");
         rb_native_cond_wait(&mjit_pch_wakeup, &mjit_engine_mutex);
     }
Index: mjit_internal.h
===================================================================
--- mjit_internal.h	(revision 64286)
+++ mjit_internal.h	(revision 64287)
@@ -19,20 +19,12 @@ https://github.com/ruby/ruby/blob/trunk/mjit_internal.h#L19
 #  define MAXPATHLEN 1024
 #endif
 
-#define RB_CONDATTR_CLOCK_MONOTONIC 1
-
 #ifdef _WIN32
 #define dlopen(name,flag) ((void*)LoadLibrary(name))
 #define dlerror() strerror(rb_w32_map_errno(GetLastError()))
 #define dlsym(handle,name) ((void*)GetProcAddress((handle),(name)))
 #define dlclose(handle) (FreeLibrary(handle))
 #define RTLD_NOW  -1
-
-#define waitpid(pid,stat_loc,options) (WaitForSingleObject((HANDLE)(pid), INFINITE), GetExitCodeProcess((HANDLE)(pid), (LPDWORD)(stat_loc)), (pid))
-#define WIFEXITED(S) ((S) != STILL_ACTIVE)
-#define WEXITSTATUS(S) (S)
-#define WIFSIGNALED(S) (0)
-typedef intptr_t pid_t;
 #endif
 
 #define MJIT_TMP_PREFIX "_ruby_mjit_"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]