ruby-changes:73674
From: Aaron <ko1@a...>
Date: Thu, 22 Sep 2022 14:20:57 +0900 (JST)
Subject: [ruby-changes:73674] ec93d09c94 (master): add rb_execution_context
https://git.ruby-lang.org/ruby.git/commit/?id=ec93d09c94 From ec93d09c94401af94bcbf5100a9853540d620f16 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Wed, 21 Sep 2022 12:27:59 -0700 Subject: add rb_execution_context --- lib/mjit/c_32.rb | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-- lib/mjit/c_64.rb | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++-- tool/mjit/bindgen.rb | 2 ++ 3 files changed, 104 insertions(+), 4 deletions(-) diff --git a/lib/mjit/c_32.rb b/lib/mjit/c_32.rb index e966cc2919..9931088271 100644 --- a/lib/mjit/c_32.rb +++ b/lib/mjit/c_32.rb @@ -216,6 +216,43 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_32.rb#L216 ) end + def C.rb_execution_context_struct + @rb_execution_context_struct ||= CType::Struct.new( + "rb_execution_context_struct", 244, + vm_stack: [0, CType::Pointer.new { self.VALUE }], + vm_stack_size: [32, CType::Immediate.new(-4)], + cfp: [64, CType::Pointer.new { self.rb_control_frame_t }], + tag: [96, CType::Pointer.new { self.rb_vm_tag }], + interrupt_flag: [128, self.rb_atomic_t], + interrupt_mask: [160, self.rb_atomic_t], + fiber_ptr: [192, CType::Pointer.new { self.rb_fiber_t }], + thread_ptr: [224, CType::Pointer.new { self.rb_thread_struct }], + local_storage: [256, CType::Pointer.new { self.rb_id_table }], + local_storage_recursive_hash: [288, self.VALUE], + local_storage_recursive_hash_for_trace: [320, self.VALUE], + root_lep: [352, CType::Pointer.new { self.VALUE }], + root_svar: [384, self.VALUE], + ensure_list: [416, CType::Pointer.new { self.rb_ensure_list_t }], + trace_arg: [448, CType::Pointer.new { self.rb_trace_arg_struct }], + errinfo: [480, self.VALUE], + passed_block_handler: [512, self.VALUE], + raised_flag: [544, CType::Immediate.new(-2)], + method_missing_reason: [552, self.method_missing_reason], + private_const_reference: [576, self.VALUE], + machine: [608, CType::Struct.new( + "", 168, + stack_start: [0, CType::Pointer.new { self.VALUE }], + stack_end: [32, CType::Pointer.new { self.VALUE }], + stack_maxsize: [64, CType::Immediate.new(-4)], + regs: [96, self.jmp_buf], + )], + ) + end + + def C.rb_execution_context_t + @rb_execution_context_t ||= self.rb_execution_context_struct + end + def C.rb_iseq_constant_body @rb_iseq_constant_body ||= CType::Struct.new( "rb_iseq_constant_body", 204, @@ -414,6 +451,20 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_32.rb#L451 def C.rb_scope_visibility_t = CType::Stub.new(:rb_scope_visibility_t) + def C.rb_vm_tag = CType::Stub.new(:rb_vm_tag) + + def C.rb_atomic_t = CType::Stub.new(:rb_atomic_t) + + def C.rb_fiber_t = CType::Stub.new(:rb_fiber_t) + + def C.rb_id_table = CType::Stub.new(:rb_id_table) + + def C.rb_ensure_list_t = CType::Stub.new(:rb_ensure_list_t) + + def C.rb_trace_arg_struct = CType::Stub.new(:rb_trace_arg_struct) + + def C.jmp_buf = CType::Stub.new(:jmp_buf) + def C.rb_iseq_type = CType::Stub.new(:rb_iseq_type) def C.rb_iseq_param_keyword = CType::Stub.new(:rb_iseq_param_keyword) @@ -426,8 +477,6 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_32.rb#L477 def C.iseq_bits_t = CType::Stub.new(:iseq_bits_t) - def C.rb_id_table = CType::Stub.new(:rb_id_table) - def C.rb_code_location_t = CType::Stub.new(:rb_code_location_t) def C.iseq_compile_data = CType::Stub.new(:iseq_compile_data) diff --git a/lib/mjit/c_64.rb b/lib/mjit/c_64.rb index ad2cfa74c6..2746ed13a0 100644 --- a/lib/mjit/c_64.rb +++ b/lib/mjit/c_64.rb @@ -216,6 +216,43 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_64.rb#L216 ) end + def C.rb_execution_context_struct + @rb_execution_context_struct ||= CType::Struct.new( + "rb_execution_context_struct", 368, + vm_stack: [0, CType::Pointer.new { self.VALUE }], + vm_stack_size: [64, CType::Immediate.new(-5)], + cfp: [128, CType::Pointer.new { self.rb_control_frame_t }], + tag: [192, CType::Pointer.new { self.rb_vm_tag }], + interrupt_flag: [256, self.rb_atomic_t], + interrupt_mask: [288, self.rb_atomic_t], + fiber_ptr: [320, CType::Pointer.new { self.rb_fiber_t }], + thread_ptr: [384, CType::Pointer.new { self.rb_thread_struct }], + local_storage: [448, CType::Pointer.new { self.rb_id_table }], + local_storage_recursive_hash: [512, self.VALUE], + local_storage_recursive_hash_for_trace: [576, self.VALUE], + root_lep: [640, CType::Pointer.new { self.VALUE }], + root_svar: [704, self.VALUE], + ensure_list: [768, CType::Pointer.new { self.rb_ensure_list_t }], + trace_arg: [832, CType::Pointer.new { self.rb_trace_arg_struct }], + errinfo: [896, self.VALUE], + passed_block_handler: [960, self.VALUE], + raised_flag: [1024, CType::Immediate.new(-2)], + method_missing_reason: [1032, self.method_missing_reason], + private_const_reference: [1088, self.VALUE], + machine: [1152, CType::Struct.new( + "", 224, + stack_start: [0, CType::Pointer.new { self.VALUE }], + stack_end: [64, CType::Pointer.new { self.VALUE }], + stack_maxsize: [128, CType::Immediate.new(-5)], + regs: [192, self.jmp_buf], + )], + ) + end + + def C.rb_execution_context_t + @rb_execution_context_t ||= self.rb_execution_context_struct + end + def C.rb_iseq_constant_body @rb_iseq_constant_body ||= CType::Struct.new( "rb_iseq_constant_body", 336, @@ -415,6 +452,20 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_64.rb#L452 def C.rb_scope_visibility_t = CType::Stub.new(:rb_scope_visibility_t) + def C.rb_vm_tag = CType::Stub.new(:rb_vm_tag) + + def C.rb_atomic_t = CType::Stub.new(:rb_atomic_t) + + def C.rb_fiber_t = CType::Stub.new(:rb_fiber_t) + + def C.rb_id_table = CType::Stub.new(:rb_id_table) + + def C.rb_ensure_list_t = CType::Stub.new(:rb_ensure_list_t) + + def C.rb_trace_arg_struct = CType::Stub.new(:rb_trace_arg_struct) + + def C.jmp_buf = CType::Stub.new(:jmp_buf) + def C.rb_iseq_type = CType::Stub.new(:rb_iseq_type) def C.rb_iseq_param_keyword = CType::Stub.new(:rb_iseq_param_keyword) @@ -427,8 +478,6 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/lib/mjit/c_64.rb#L478 def C.iseq_bits_t = CType::Stub.new(:iseq_bits_t) - def C.rb_id_table = CType::Stub.new(:rb_id_table) - def C.rb_code_location_t = CType::Stub.new(:rb_code_location_t) def C.iseq_compile_data = CType::Stub.new(:iseq_compile_data) diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb index 9839baa8d2..80bdd36c6f 100755 --- a/tool/mjit/bindgen.rb +++ b/tool/mjit/bindgen.rb @@ -566,6 +566,8 @@ generator = BindingGenerator.new( https://github.com/ruby/ruby/blob/trunk/tool/mjit/bindgen.rb#L566 rb_callinfo rb_cref_t rb_control_frame_t + rb_execution_context_t + rb_execution_context_struct rb_iseq_constant_body rb_iseq_location_t rb_iseq_struct -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/