From 083b4bb65500376e6c5b9fdf9b7901d5ce4e421a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 21 Sep 2022 08:58:19 -0700 Subject: [PATCH] add rb_control_frame_t --- lib/mjit/c_32.rb | 14 ++++++++++++++ lib/mjit/c_64.rb | 14 ++++++++++++++ tool/mjit/bindgen.rb | 1 + 3 files changed, 29 insertions(+) diff --git a/lib/mjit/c_32.rb b/lib/mjit/c_32.rb index a369a3e852..e966cc2919 100644 --- a/lib/mjit/c_32.rb +++ b/lib/mjit/c_32.rb @@ -191,6 +191,20 @@ module RubyVM::MJIT ) end + def C.rb_control_frame_t + @rb_control_frame_t ||= CType::Struct.new( + "rb_control_frame_struct", 32, + pc: [0, CType::Pointer.new { self.VALUE }], + sp: [32, CType::Pointer.new { self.VALUE }], + iseq: [64, CType::Pointer.new { self.rb_iseq_t }], + self: [96, self.VALUE], + ep: [128, CType::Pointer.new { self.VALUE }], + block_code: [160, CType::Pointer.new { CType::Immediate.new(0) }], + __bp__: [192, CType::Pointer.new { self.VALUE }], + jit_return: [224, CType::Pointer.new { CType::Immediate.new(0) }], + ) + end + def C.rb_cref_t @rb_cref_t ||= CType::Struct.new( "rb_cref_struct", 20, diff --git a/lib/mjit/c_64.rb b/lib/mjit/c_64.rb index e3989a12e2..ad2cfa74c6 100644 --- a/lib/mjit/c_64.rb +++ b/lib/mjit/c_64.rb @@ -191,6 +191,20 @@ module RubyVM::MJIT ) end + def C.rb_control_frame_t + @rb_control_frame_t ||= CType::Struct.new( + "rb_control_frame_struct", 64, + pc: [0, CType::Pointer.new { self.VALUE }], + sp: [64, CType::Pointer.new { self.VALUE }], + iseq: [128, CType::Pointer.new { self.rb_iseq_t }], + self: [192, self.VALUE], + ep: [256, CType::Pointer.new { self.VALUE }], + block_code: [320, CType::Pointer.new { CType::Immediate.new(0) }], + __bp__: [384, CType::Pointer.new { self.VALUE }], + jit_return: [448, CType::Pointer.new { CType::Immediate.new(0) }], + ) + end + def C.rb_cref_t @rb_cref_t ||= CType::Struct.new( "rb_cref_struct", 40, diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb index 8bee57de7d..9839baa8d2 100755 --- a/tool/mjit/bindgen.rb +++ b/tool/mjit/bindgen.rb @@ -565,6 +565,7 @@ generator = BindingGenerator.new( rb_callcache rb_callinfo rb_cref_t + rb_control_frame_t rb_iseq_constant_body rb_iseq_location_t rb_iseq_struct