Skip to content

Commit

Permalink
RJIT: Avoid incrementing vm_insns_count
Browse files Browse the repository at this point in the history
during compilation
  • Loading branch information
k0kubun committed Dec 22, 2023
1 parent 3c18277 commit 009968a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions rjit.c
Expand Up @@ -165,7 +165,9 @@ struct rb_rjit_runtime_counters rb_rjit_counters = { 0 };

extern VALUE rb_gc_enable(void);
extern VALUE rb_gc_disable(void);
extern uint64_t rb_vm_insns_count;

// Disable GC, TracePoint, and VM insns counter
#define WITH_RJIT_ISOLATED(stmt) do { \
VALUE was_disabled = rb_gc_disable(); \
rb_hook_list_t *global_hooks = rb_ec_ractor_hooks(GET_EC()); \
Expand All @@ -174,7 +176,9 @@ extern VALUE rb_gc_disable(void);
bool original_call_p = rb_rjit_call_p; \
rjit_stats_p = false; \
rb_rjit_call_p = false; \
uint64_t insns_count = rb_vm_insns_count; \
stmt; \
rb_vm_insns_count = insns_count; \
rb_rjit_call_p = (rjit_cancel_p ? false : original_call_p); \
rjit_stats_p = rb_rjit_opts.stats; \
global_hooks->events = rb_rjit_global_events; \
Expand Down

0 comments on commit 009968a

Please sign in to comment.