summaryrefslogtreecommitdiff
path: root/rjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-12-21 17:12:40 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2023-12-21 17:12:40 -0800
commit009968a700209336eb592ccb83bddcf7b2c17984 (patch)
tree27ee9546335f5592e38116eddd411ba540b8b568 /rjit.c
parent3c182776292ecd2a28fea4f7de87a89e64459f9c (diff)
RJIT: Avoid incrementing vm_insns_count
during compilation
Diffstat (limited to 'rjit.c')
-rw-r--r--rjit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/rjit.c b/rjit.c
index a2ce825588..93f372673d 100644
--- a/rjit.c
+++ b/rjit.c
@@ -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()); \
@@ -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; \