summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-23 14:11:19 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-06-23 14:11:19 +0000
commite1be448840da9ac2db4eeeed5d07ae8a765bacce ()
tree0d2ffded9f46497fa10af1a2bc7193750fba49ec
parenta62a776d575ada3cb3a8ae2beb8a2908a27648a1 (diff)
mjit.c: disable calling JIT-ed code
when TracePoint is enabled. We're cancelling JIT-ed code execution AFTER each instruction, but there is no guard before the first insn of method. To prevent spoiling performance, I don't want to modify the JIT-ed code to fix this. So this commit replaces `mjit_enabled` check with `mjit_call_p` check. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--iseq.c2
-rw-r--r--mjit.c5
-rw-r--r--mjit.h5
-rw-r--r--vm_trace.c4
4 files changed, 14 insertions, 2 deletions
@@ -2899,6 +2899,8 @@ rb_iseq_trace_set_all(rb_event_flag_t turnon_events)
rb_objspace_each_objects(trace_set_i, &turnon_events);
}
void
rb_iseq_trace_on_all(void)
{
@@ -171,6 +171,9 @@ struct rb_mjit_unit_list {
/* TRUE if MJIT is enabled. */
int mjit_enabled = FALSE;
/* Priority queue of iseqs waiting for JIT compilation.
This variable is a pointer to head unit of the queue. */
@@ -1410,6 +1413,7 @@ mjit_init(struct mjit_options *opts)
mjit_opts = *opts;
mjit_enabled = TRUE;
/* Normalize options */
if (mjit_opts.min_calls == 0)
@@ -1549,6 +1553,7 @@ mjit_finish(void)
xfree(pch_file); pch_file = NULL;
xfree(header_file); header_file = NULL;
free_list(&unit_queue);
free_list(&active_units);
finish_conts();
@@ -51,9 +51,10 @@ struct mjit_options {
typedef VALUE (*mjit_func_t)(rb_execution_context_t *, rb_control_frame_t *);
RUBY_SYMBOL_EXPORT_BEGIN
extern struct mjit_options mjit_opts;
-extern int mjit_enabled;
extern void mjit_add_iseq_to_process(const rb_iseq_t *iseq);
extern mjit_func_t mjit_get_iseq_func(struct rb_iseq_constant_body *body);
@@ -94,7 +95,7 @@ mjit_exec(rb_execution_context_t *ec)
long unsigned total_calls;
mjit_func_t func;
- if (!mjit_enabled)
return Qundef;
iseq = ec->cfp->iseq;
@@ -25,6 +25,7 @@
#include "ruby/debug.h"
#include "vm_core.h"
#include "iseq.h"
#include "eval_intern.h"
@@ -68,6 +69,9 @@ update_global_event_hook(rb_event_flag_t vm_events)
rb_event_flag_t enabled_iseq_events = ruby_vm_event_enabled_flags & ISEQ_TRACE_EVENTS;
if (new_iseq_events & ~enabled_iseq_events) {
/* write all ISeqs iff new events are added */
rb_iseq_trace_set_all(new_iseq_events | enabled_iseq_events);
}