зеркало из https://github.com/github/ruby.git
Prepare rb_mjit_compile hook
This commit is contained in:
Родитель
3c093fe391
Коммит
251f976235
6
mjit.c
6
mjit.c
|
@ -370,6 +370,12 @@ mjit_compile(FILE *f, const rb_iseq_t *iseq, const char *funcname, int id)
|
||||||
// New stuff from here
|
// New stuff from here
|
||||||
//
|
//
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_mjit_compile(const rb_iseq_t *iseq)
|
||||||
|
{
|
||||||
|
// TODO: implement
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mjit_init(const struct mjit_options *opts)
|
mjit_init(const struct mjit_options *opts)
|
||||||
{
|
{
|
||||||
|
|
2
mjit.h
2
mjit.h
|
@ -85,7 +85,7 @@ RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
RUBY_EXTERN struct mjit_options mjit_opts;
|
RUBY_EXTERN struct mjit_options mjit_opts;
|
||||||
RUBY_EXTERN bool mjit_call_p;
|
RUBY_EXTERN bool mjit_call_p;
|
||||||
|
|
||||||
extern void rb_mjit_add_iseq_to_process(const rb_iseq_t *iseq);
|
extern void rb_mjit_compile(const rb_iseq_t *iseq);
|
||||||
extern struct rb_mjit_compile_info* rb_mjit_iseq_compile_info(const struct rb_iseq_constant_body *body);
|
extern struct rb_mjit_compile_info* rb_mjit_iseq_compile_info(const struct rb_iseq_constant_body *body);
|
||||||
extern void rb_mjit_recompile_send(const rb_iseq_t *iseq);
|
extern void rb_mjit_recompile_send(const rb_iseq_t *iseq);
|
||||||
extern void rb_mjit_recompile_ivar(const rb_iseq_t *iseq);
|
extern void rb_mjit_recompile_ivar(const rb_iseq_t *iseq);
|
||||||
|
|
11
vm.c
11
vm.c
|
@ -395,7 +395,7 @@ mjit_check_iseq(rb_execution_context_t *ec, const rb_iseq_t *iseq, struct rb_ise
|
||||||
switch ((enum rb_mjit_func_state)mjit_state) {
|
switch ((enum rb_mjit_func_state)mjit_state) {
|
||||||
case MJIT_FUNC_NOT_COMPILED:
|
case MJIT_FUNC_NOT_COMPILED:
|
||||||
if (body->total_calls == mjit_opts.call_threshold) {
|
if (body->total_calls == mjit_opts.call_threshold) {
|
||||||
rb_mjit_add_iseq_to_process(iseq);
|
rb_mjit_compile(iseq);
|
||||||
if (UNLIKELY(mjit_opts.wait && !MJIT_FUNC_STATE_P(body->jit_func))) {
|
if (UNLIKELY(mjit_opts.wait && !MJIT_FUNC_STATE_P(body->jit_func))) {
|
||||||
return body->jit_func(ec, ec->cfp);
|
return body->jit_func(ec, ec->cfp);
|
||||||
}
|
}
|
||||||
|
@ -441,8 +441,13 @@ jit_exec(rb_execution_context_t *ec)
|
||||||
return Qundef;
|
return Qundef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (UNLIKELY(MJIT_FUNC_STATE_P(func = body->jit_func))) {
|
else { // mjit_call_p
|
||||||
return mjit_check_iseq(ec, iseq, body);
|
if (body->total_calls == mjit_opts.call_threshold) {
|
||||||
|
rb_mjit_compile(iseq);
|
||||||
|
}
|
||||||
|
if ((func = body->jit_func) == 0) {
|
||||||
|
return Qundef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the JIT code
|
// Call the JIT code
|
||||||
|
|
Загрузка…
Ссылка в новой задаче