Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Enumerations | Functions | Variables
mjit_worker.c File Reference
`#include "vm_core.h"`
`#include "mjit.h"`
`#include "gc.h"`
`#include "ruby_assert.h"`
`#include "ruby/debug.h"`
`#include "ruby/thread.h"`
`#include <sys/wait.h>`
`#include <sys/time.h>`
`#include <dlfcn.h>`
`#include <errno.h>`
`#include "dln.h"`
`#include "ruby/util.h"`
`#include "mjit_config.h"`

Go to the source code of this file.

## Data Structures
struct | rb_mjit_unit
struct | rb_mjit_unit_list
struct | mjit_copy_job_t

## Macros
#define | MAXPATHLEN 1024
#define | MJIT_ATOMIC_SET(var, val) (void)ATOMIC_PTR_EXCHANGE(var, val)
#define | MJIT_TMP_PREFIX "_ruby_mjit_"
#define | GCC_PIC_FLAGS /* empty */
#define | MJIT_CFLAGS_PIPE 0
#define | GCC_NOSTDLIB_FLAGS
#define | CC_CODEFLAG_ARGS (mjit_opts.debug ? CC_DEBUG_ARGS : CC_OPTIMIZE_ARGS)
#define | append_str2(p, str, len) ((char *)memcpy((p), str, (len))+(len))
#define | append_str(p, str) append_str2(p, str, sizeof(str)-1)
#define | append_lit(p, str) append_str2(p, str, rb_strlen_lit(str))

## Enumerations
enum | { PCH_NOT_READY, PCH_FAILED, PCH_SUCCESS }

## Functions
void | rb_native_mutex_lock (rb_nativethread_lock_t *lock)
void | rb_native_mutex_unlock (rb_nativethread_lock_t *lock)
void | rb_native_mutex_initialize (rb_nativethread_lock_t *lock)
void | rb_native_mutex_destroy (rb_nativethread_lock_t *lock)
void | rb_native_cond_initialize (rb_nativethread_cond_t *cond)
void | rb_native_cond_destroy (rb_nativethread_cond_t *cond)
void | rb_native_cond_signal (rb_nativethread_cond_t *cond)
void | rb_native_cond_broadcast (rb_nativethread_cond_t *cond)
void | rb_native_cond_wait (rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex)
rb_pid_t | ruby_waitpid_locked (rb_vm_t *, rb_pid_t, int *status, int options, rb_nativethread_cond_t *cond)
| verbose (int level, const char *format,...)
| mjit_warning (const char *format,...)
bool | mjit_valid_class_serial_p (rb_serial_t class_serial)
int | rb_workqueue_register (unsigned flags, rb_postponed_job_func_t, void *)
bool | mjit_copy_cache_from_main_thread (const rb_iseq_t *iseq, struct rb_call_cache *cc_entries, union iseq_inline_storage_entry *is_entries)
void | mjit_worker (void)

## Variables
struct mjit_options | mjit_opts
bool | mjit_enabled = false
bool | mjit_call_p = false

## Macro Definition Documentation

## ◆ append_lit

#define append_lit | ( |  | p,
|  |  | str
| ) |  | append_str2(p, str, rb_strlen_lit(str))

Definition at line 672 of file mjit_worker.c.

## ◆ append_str

#define append_str | ( |  | p,
|  |  | str
| ) |  | append_str2(p, str, sizeof(str)-1)

Definition at line 671 of file mjit_worker.c.

## ◆ append_str2

#define append_str2 | ( |  | p,
|  |  | str,
|  |  | len
| ) |  | ((char *)memcpy((p), str, (len))+(len))

Definition at line 670 of file mjit_worker.c.

## ◆ CC_CODEFLAG_ARGS

#define CC_CODEFLAG_ARGS (mjit_opts.debug ? CC_DEBUG_ARGS : CC_OPTIMIZE_ARGS)

Definition at line 298 of file mjit_worker.c.

## ◆ GCC_NOSTDLIB_FLAGS

#define GCC_NOSTDLIB_FLAGS

Definition at line 261 of file mjit_worker.c.

## ◆ GCC_PIC_FLAGS

#define GCC_PIC_FLAGS /* empty */

Definition at line 252 of file mjit_worker.c.

## ◆ MAXPATHLEN

#define MAXPATHLEN 1024

Definition at line 103 of file mjit_worker.c.

## ◆ MJIT_ATOMIC_SET

#define MJIT_ATOMIC_SET | ( |  | var,
|  |  | val
| ) |  | (void)ATOMIC_PTR_EXCHANGE(var, val)

Definition at line 121 of file mjit_worker.c.

## ◆ MJIT_CFLAGS_PIPE

#define MJIT_CFLAGS_PIPE 0

Definition at line 253 of file mjit_worker.c.

## ◆ MJIT_TMP_PREFIX

#define MJIT_TMP_PREFIX "_ruby_mjit_"

Definition at line 123 of file mjit_worker.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
PCH_NOT_READY |
PCH_FAILED |
PCH_SUCCESS |

Definition at line 232 of file mjit_worker.c.

## Function Documentation

## ◆ mjit_copy_cache_from_main_thread()

bool mjit_copy_cache_from_main_thread | ( | const rb_iseq_t * | iseq,
|  | struct rb_call_cache * | cc_entries,
|  | union iseq_inline_storage_entry * | is_entries
| ) |  |

Definition at line 1141 of file mjit_worker.c.

## ◆ mjit_valid_class_serial_p()

bool mjit_valid_class_serial_p | ( | rb_serial_t | class_serial | ) |

Definition at line 475 of file mjit_worker.c.

## ◆ mjit_warning()

mjit_warning | ( | const char * | format,
|  |  | ...
| ) |  |

Definition at line 322 of file mjit_worker.c.

References fprintf(), mjit_opts, stderr, va_end, va_start, mjit_options::verbose, vfprintf(), and mjit_options::warnings.

## ◆ mjit_worker()

void mjit_worker | ( | void |  | ) |

Definition at line 1194 of file mjit_worker.c.

## ◆ rb_native_cond_broadcast()

void rb_native_cond_broadcast | ( | rb_nativethread_cond_t * | cond | ) |

## ◆ rb_native_cond_destroy()

void rb_native_cond_destroy | ( | rb_nativethread_cond_t * | cond | ) |

## ◆ rb_native_cond_initialize()

void rb_native_cond_initialize | ( | rb_nativethread_cond_t * | cond | ) |

## ◆ rb_native_cond_signal()

void rb_native_cond_signal | ( | rb_nativethread_cond_t * | cond | ) |

## ◆ rb_native_cond_wait()

void rb_native_cond_wait | ( | rb_nativethread_cond_t * | cond,
|  | rb_nativethread_lock_t * | mutex
| ) |  |

## ◆ rb_native_mutex_destroy()

void rb_native_mutex_destroy | ( | rb_nativethread_lock_t * | lock | ) |

Referenced by rb_nativethread_lock_destroy(), and rb_vm_gvl_destroy().

## ◆ rb_native_mutex_initialize()

void rb_native_mutex_initialize | ( | rb_nativethread_lock_t * | lock | ) |

Referenced by rb_nativethread_lock_initialize().

## ◆ rb_native_mutex_lock()

void rb_native_mutex_lock | ( | rb_nativethread_lock_t * | lock | ) |

Referenced by rb_nativethread_lock_lock().

## ◆ rb_native_mutex_unlock()

void rb_native_mutex_unlock | ( | rb_nativethread_lock_t * | lock | ) |

Referenced by rb_nativethread_lock_unlock().

## ◆ rb_workqueue_register()

int rb_workqueue_register | ( | unsigned | flags,
|  | rb_postponed_job_func_t | ,
|  | void * |
| ) |  |

Definition at line 1637 of file vm_trace.c.

References rb_postponed_job_struct::data, FALSE, rb_postponed_job_struct::func, GET_EC, GET_VM, rb_workqueue_job::jnode, rb_workqueue_job::job, list_add_tail, malloc(), rb_nativethread_lock_lock(), rb_nativethread_lock_unlock(), RUBY_VM_SET_POSTPONED_JOB_INTERRUPT, TRUE, rb_vm_struct::workqueue, and rb_vm_struct::workqueue_lock.

## ◆ ruby_waitpid_locked()

rb_pid_t ruby_waitpid_locked | ( | rb_vm_t * | ,
|  | rb_pid_t | ,
|  | int * | status,
|  | int | options,
|  | rb_nativethread_cond_t * | cond
| ) |  |

Definition at line 1069 of file process.c.

## ◆ verbose()

verbose | ( | int | level,
|  | const char * | format,
|  |  | ...
| ) |  |

Definition at line 303 of file mjit_worker.c.

References alloca, len, memcpy(), mjit_opts, stderr, strlen(), va_end, va_start, mjit_options::verbose, and vfprintf().

## Variable Documentation

## ◆ mjit_call_p

bool mjit_call_p = false

Definition at line 180 of file mjit_worker.c.

## ◆ mjit_enabled

bool mjit_enabled = false

Definition at line 177 of file mjit_worker.c.

## ◆ mjit_opts

struct mjit_options mjit_opts

Definition at line 174 of file mjit_worker.c.

Referenced by mjit_warning(), and verbose().