зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
58de76846b
Коммит
b2e0d54024
12
mjit.c
12
mjit.c
|
@ -192,7 +192,7 @@ free_list(struct rb_mjit_unit_list *list)
|
|||
}
|
||||
}
|
||||
|
||||
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 *iseq)
|
|||
{
|
||||
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_constant_body *body)
|
|||
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)
|
|||
|
||||
/* 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)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -19,20 +19,12 @@
|
|||
# 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_"
|
||||
|
|
|
@ -101,6 +101,14 @@
|
|||
#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[] = {
|
|||
|
||||
/* 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)
|
|||
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)
|
|||
|
||||
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
|
|||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче