summaryrefslogtreecommitdiff
path: root/mjit_c.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 00:21:27 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-11-29 00:23:51 -0800
commit27f34eeb5a95263f8669e6998247d83606c3763f (patch)
tree4162b11a5f4dafc75369712412f9c19b2b0a26cb /mjit_c.rb
parent8a0acbea4cf7be4bfaf329d077b2b4c9a2ad425b (diff)
MJIT: Self-contain extern declarations
I'm trying to get rid of mjit_compiler.c, and this helps that migration.
Diffstat (limited to 'mjit_c.rb')
-rw-r--r--mjit_c.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/mjit_c.rb b/mjit_c.rb
index f3a77e26fd..ae1c9a802f 100644
--- a/mjit_c.rb
+++ b/mjit_c.rb
@@ -51,7 +51,10 @@ module RubyVM::MJIT
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)))'
+ Primitive.cstmt! %{
+ extern bool rb_splat_or_kwargs_p(const struct rb_callinfo *restrict ci);
+ return RBOOL(rb_splat_or_kwargs_p((CALL_INFO)NUM2PTR(_ci_addr)));
+ }
end
def fastpath_applied_iseq_p(ci, cc, iseq)
@@ -74,7 +77,10 @@ module RubyVM::MJIT
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)))'
+ Primitive.cstmt! %{
+ extern int mjit_capture_cc_entries(const struct rb_iseq_constant_body *compiled_iseq, const struct rb_iseq_constant_body *captured_iseq);
+ return INT2NUM(mjit_capture_cc_entries((struct rb_iseq_constant_body *)NUM2PTR(_compiled_body_addr), (struct rb_iseq_constant_body *)NUM2PTR(_captured_body_addr)));
+ }
end
# Convert encoded VM pointers to insn BINs.