aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-09-05 08:23:53 -0700
committerTakashi Kokubun <takashikkbn@gmail.com>2022-09-05 08:26:34 -0700
commit27eb7158ee2f51902f4585a20cfbc9705c6b332d (patch)
treed45e6150031797a402eaa26854f80d53fbb1e315 /mjit_compiler.rb
parent6bc6c8d03184e29cc72df42d6487e39817d2ed1b (diff)
downloadruby-27eb7158ee2f51902f4585a20cfbc9705c6b332d.tar.gz
Workaround unused variable warning by builtin
``` <internal:mjit_compiler>:43: warning: assigned but unused variable - iseq_addr <internal:mjit_compiler>:48: warning: assigned but unused variable - ci_addr <internal:mjit_compiler>:53: warning: assigned but unused variable - ci_addr <internal:mjit_compiler>:58: warning: assigned but unused variable - ci_addr <internal:mjit_compiler>:63: warning: assigned but unused variable - ci_addr <internal:mjit_compiler>:64: warning: assigned but unused variable - cc_addr <internal:mjit_compiler>:65: warning: assigned but unused variable - iseq_addr <internal:mjit_compiler>:75: warning: assigned but unused variable - operands_addr <internal:mjit_compiler>:80: warning: assigned but unused variable - compiled_body_addr <internal:mjit_compiler>:81: warning: assigned but unused variable - captured_body_addr <internal:mjit_compiler>:87: warning: assigned but unused variable - body_addr <internal:mjit_compiler>:88: warning: assigned but unused variable - is_entries_addr <internal:mjit_compiler>:100: warning: assigned but unused variable - opes_addr <internal:mjit_compiler>:110: warning: assigned but unused variable - cc_entries_addr ``` It's clearly a false positive. Until we fix builtin itself, I'd like to suppress this.
Diffstat (limited to 'mjit_compiler.rb')
-rw-r--r--mjit_compiler.rb58
1 files changed, 28 insertions, 30 deletions
diff --git a/mjit_compiler.rb b/mjit_compiler.rb
index 148b200200..6785e2ffab 100644
--- a/mjit_compiler.rb
+++ b/mjit_compiler.rb
@@ -24,46 +24,44 @@ if RubyVM::MJIT.enabled?
end
def builtin_compiler(f, bf, index, stack_size, builtin_inline_p)
- bf_addr = bf.to_i
- Primitive.builtin_compile(f, bf_addr, index, stack_size, builtin_inline_p)
+ Primitive.builtin_compile(f, bf.to_i, index, stack_size, builtin_inline_p)
end
def has_cache_for_send(cc, insn)
- cc_addr = cc.to_i
- Primitive.has_cache_for_send(cc_addr, insn)
+ Primitive.has_cache_for_send(cc.to_i, insn)
end
def rb_iseq_check(iseq)
- iseq_addr = iseq.to_i
- iseq_addr = Primitive.cexpr! 'PTR2NUM((VALUE)rb_iseq_check((rb_iseq_t *)NUM2PTR(iseq_addr)))'
+ _iseq_addr = iseq.to_i
+ iseq_addr = Primitive.cexpr! 'PTR2NUM((VALUE)rb_iseq_check((rb_iseq_t *)NUM2PTR(_iseq_addr)))'
rb_iseq_t.new(iseq_addr)
end
def rb_iseq_path(iseq)
- iseq_addr = iseq.to_i
- Primitive.cexpr! 'rb_iseq_path((rb_iseq_t *)NUM2PTR(iseq_addr))'
+ _iseq_addr = iseq.to_i
+ Primitive.cexpr! 'rb_iseq_path((rb_iseq_t *)NUM2PTR(_iseq_addr))'
end
def vm_ci_argc(ci)
- ci_addr = ci.to_i
- Primitive.cexpr! 'UINT2NUM(vm_ci_argc((CALL_INFO)NUM2PTR(ci_addr)))'
+ _ci_addr = ci.to_i
+ Primitive.cexpr! 'UINT2NUM(vm_ci_argc((CALL_INFO)NUM2PTR(_ci_addr)))'
end
def vm_ci_flag(ci)
- ci_addr = ci.to_i
- Primitive.cexpr! 'UINT2NUM(vm_ci_flag((CALL_INFO)NUM2PTR(ci_addr)))'
+ _ci_addr = ci.to_i
+ Primitive.cexpr! 'UINT2NUM(vm_ci_flag((CALL_INFO)NUM2PTR(_ci_addr)))'
end
def rb_splat_or_kwargs_p(ci)
- ci_addr = ci.to_i
- Primitive.cexpr! 'RBOOL(rb_splat_or_kwargs_p((CALL_INFO)NUM2PTR(ci_addr)))'
+ _ci_addr = ci.to_i
+ Primitive.cexpr! 'RBOOL(rb_splat_or_kwargs_p((CALL_INFO)NUM2PTR(_ci_addr)))'
end
def fastpath_applied_iseq_p(ci, cc, iseq)
- ci_addr = ci.to_i
- cc_addr = cc.to_i
- iseq_addr = iseq.to_i
- Primitive.cexpr! 'RBOOL(fastpath_applied_iseq_p((CALL_INFO)NUM2PTR(ci_addr), (CALL_CACHE)NUM2PTR(cc_addr), (rb_iseq_t *)NUM2PTR(iseq_addr)))'
+ _ci_addr = ci.to_i
+ _cc_addr = cc.to_i
+ _iseq_addr = iseq.to_i
+ Primitive.cexpr! 'RBOOL(fastpath_applied_iseq_p((CALL_INFO)NUM2PTR(_ci_addr), (CALL_CACHE)NUM2PTR(_cc_addr), (rb_iseq_t *)NUM2PTR(_iseq_addr)))'
end
def mjit_opts
@@ -72,22 +70,22 @@ if RubyVM::MJIT.enabled?
end
def mjit_call_attribute_sp_inc(insn, operands)
- operands_addr = operands.to_i
- Primitive.cexpr! 'LONG2NUM(mjit_call_attribute_sp_inc(NUM2INT(insn), (VALUE *)NUM2PTR(operands_addr)))'
+ _operands_addr = operands.to_i
+ Primitive.cexpr! 'LONG2NUM(mjit_call_attribute_sp_inc(NUM2INT(insn), (VALUE *)NUM2PTR(_operands_addr)))'
end
def mjit_capture_cc_entries(compiled_body, captured_body)
- compiled_body_addr = compiled_body.to_i
- captured_body_addr = captured_body.to_i
- Primitive.cexpr! 'INT2NUM(mjit_capture_cc_entries((struct rb_iseq_constant_body *)NUM2PTR(compiled_body_addr), (struct rb_iseq_constant_body *)NUM2PTR(captured_body_addr)))'
+ _compiled_body_addr = compiled_body.to_i
+ _captured_body_addr = captured_body.to_i
+ Primitive.cexpr! 'INT2NUM(mjit_capture_cc_entries((struct rb_iseq_constant_body *)NUM2PTR(_compiled_body_addr), (struct rb_iseq_constant_body *)NUM2PTR(_captured_body_addr)))'
end
#const struct rb_iseq_constant_body *body, union iseq_inline_storage_entry *is_entries
def mjit_capture_is_entries(body, is_entries)
- body_addr = body.to_i
- is_entries_addr = is_entries.to_i
+ _body_addr = body.to_i
+ _is_entries_addr = is_entries.to_i
Primitive.cstmt! %{
- mjit_capture_is_entries((struct rb_iseq_constant_body *)NUM2PTR(body_addr), (union iseq_inline_storage_entry *)NUM2PTR(is_entries_addr));
+ mjit_capture_is_entries((struct rb_iseq_constant_body *)NUM2PTR(_body_addr), (union iseq_inline_storage_entry *)NUM2PTR(_is_entries_addr));
return Qnil;
}
end
@@ -97,8 +95,8 @@ if RubyVM::MJIT.enabled?
end
def insn_may_depend_on_sp_or_pc(insn, opes)
- opes_addr = opes.to_i
- Primitive.cexpr! 'RBOOL(insn_may_depend_on_sp_or_pc(NUM2INT(insn), (VALUE *)NUM2PTR(opes_addr)))'
+ _opes_addr = opes.to_i
+ Primitive.cexpr! 'RBOOL(insn_may_depend_on_sp_or_pc(NUM2INT(insn), (VALUE *)NUM2PTR(_opes_addr)))'
end
# Convert Integer VALUE to an actual Ruby object
@@ -107,9 +105,9 @@ if RubyVM::MJIT.enabled?
end
def debug(status)
- cc_entries_addr = status.compiled_iseq.jit_unit.cc_entries.instance_variable_get(:@addr)
+ _cc_entries_addr = status.compiled_iseq.jit_unit.cc_entries.instance_variable_get(:@addr)
Primitive.cstmt! %{
- const struct rb_callcache **cc_entries = (const struct rb_callcache **)NUM2PTR(cc_entries_addr);
+ const struct rb_callcache **cc_entries = (const struct rb_callcache **)NUM2PTR(_cc_entries_addr);
fprintf(stderr, "debug: %p\n", cc_entries[0]);
return Qnil;
}