summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-11-04 12:03:39 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:26 -0400
commit50d8c3d4430cc8726b0d2745440e9de01eb4dfb9 (patch)
tree08f3d0620c928287d02efbfd62d2e9bb7e9b228d
parentba92d40d9bc48ab57bec7afbf7e900c1f211b4b6 (diff)
MicroJIT: Count number of compiled instructions better
-rw-r--r--ujit_compile.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ujit_compile.c b/ujit_compile.c
index 6a2863c1c8..e6b3864cd9 100644
--- a/ujit_compile.c
+++ b/ujit_compile.c
@@ -402,8 +402,8 @@ ujit_compile_insn(const rb_iseq_t *iseq, unsigned int insn_idx, unsigned int *ne
ctx.replacement_idx = insn_idx;
// For each instruction to compile
- unsigned num_instrs;
- for (num_instrs = 0;; ++num_instrs) {
+ unsigned num_instrs = 0;
+ for (;;) {
// Set the current PC
ctx.pc = &encoded[insn_idx];
@@ -434,6 +434,7 @@ ujit_compile_insn(const rb_iseq_t *iseq, unsigned int insn_idx, unsigned int *ne
// Move to the next instruction
insn_idx += insn_len(opcode);
+ num_instrs++;
// Ensure we only have one send per region. Our code invalidation mechanism can't
// invalidate running code and one send could invalidate the other if we had