ruby-changes:74488
From: Takashi <ko1@a...>
Date: Mon, 14 Nov 2022 17:29:54 +0900 (JST)
Subject: [ruby-changes:74488] a8537aa6a5 (master): Import shape constants with mjit-bindgen
https://git.ruby-lang.org/ruby.git/commit/?id=a8537aa6a5 From a8537aa6a5ec6da5261e727943ba267bc422e594 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 14 Nov 2022 00:29:28 -0800 Subject: Import shape constants with mjit-bindgen --- mjit_c.rb | 68 ++++++++++++++++++++++++++-------------------------- tool/mjit/bindgen.rb | 10 ++++++++ 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/mjit_c.rb b/mjit_c.rb index 41f22f5682..16c73fc220 100644 --- a/mjit_c.rb +++ b/mjit_c.rb @@ -4,41 +4,9 @@ https://github.com/ruby/ruby/blob/trunk/mjit_c.rb#L4 module RubyVM::MJIT C = Object.new - # This `class << C` section is for calling C functions. - # For variables/macros, please consider using tool/mjit/bindgen.rb instead. + # This `class << C` section is for calling C functions. For importing variables + # or macros as is, please consider using tool/mjit/bindgen.rb instead. class << C - def SHAPE_BITS - Primitive.cexpr! 'UINT2NUM(SHAPE_BITS)' - end - - def SHAPE_FLAG_SHIFT - Primitive.cexpr! 'UINT2NUM(SHAPE_FLAG_SHIFT)' - end - - def SHAPE_ROOT - Primitive.cexpr! 'UINT2NUM(SHAPE_ROOT)' - end - - def SHAPE_IVAR - Primitive.cexpr! 'UINT2NUM(SHAPE_IVAR)' - end - - def SHAPE_FROZEN - Primitive.cexpr! 'UINT2NUM(SHAPE_FROZEN)' - end - - def SHAPE_CAPACITY_CHANGE - Primitive.cexpr! 'UINT2NUM(SHAPE_CAPACITY_CHANGE)' - end - - def SHAPE_IVAR_UNDEF - Primitive.cexpr! 'UINT2NUM(SHAPE_IVAR_UNDEF)' - end - - def SHAPE_INITIAL_CAPACITY - Primitive.cexpr! 'UINT2NUM(SHAPE_INITIAL_CAPACITY)' - end - def ROBJECT_EMBED_LEN_MAX Primitive.cexpr! 'INT2NUM(RBIMPL_EMBED_LEN_MAX_OF(VALUE))' end @@ -198,6 +166,38 @@ module RubyVM::MJIT https://github.com/ruby/ruby/blob/trunk/mjit_c.rb#L166 Primitive.cexpr! %q{ INT2NUM(VM_METHOD_TYPE_ISEQ) } end + def C.SHAPE_BITS + Primitive.cexpr! %q{ UINT2NUM(SHAPE_BITS) } + end + + def C.SHAPE_CAPACITY_CHANGE + Primitive.cexpr! %q{ UINT2NUM(SHAPE_CAPACITY_CHANGE) } + end + + def C.SHAPE_FLAG_SHIFT + Primitive.cexpr! %q{ UINT2NUM(SHAPE_FLAG_SHIFT) } + end + + def C.SHAPE_FROZEN + Primitive.cexpr! %q{ UINT2NUM(SHAPE_FROZEN) } + end + + def C.SHAPE_INITIAL_CAPACITY + Primitive.cexpr! %q{ UINT2NUM(SHAPE_INITIAL_CAPACITY) } + end + + def C.SHAPE_IVAR + Primitive.cexpr! %q{ UINT2NUM(SHAPE_IVAR) } + end + + def C.SHAPE_IVAR_UNDEF + Primitive.cexpr! %q{ UINT2NUM(SHAPE_IVAR_UNDEF) } + end + + def C.SHAPE_ROOT + Primitive.cexpr! %q{ UINT2NUM(SHAPE_ROOT) } + end + def C.INVALID_SHAPE_ID Primitive.cexpr! %q{ ULONG2NUM(INVALID_SHAPE_ID) } end diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb index 70800b7dcb..64ac3eb7d2 100755 --- a/tool/mjit/bindgen.rb +++ b/tool/mjit/bindgen.rb @@ -341,6 +341,16 @@ generator = BindingGenerator.new( https://github.com/ruby/ruby/blob/trunk/tool/mjit/bindgen.rb#L341 VM_METHOD_TYPE_CFUNC VM_METHOD_TYPE_ISEQ ], + UINT: %w[ + SHAPE_BITS + SHAPE_CAPACITY_CHANGE + SHAPE_FLAG_SHIFT + SHAPE_FROZEN + SHAPE_INITIAL_CAPACITY + SHAPE_IVAR + SHAPE_IVAR_UNDEF + SHAPE_ROOT + ], ULONG: %w[ INVALID_SHAPE_ID SHAPE_MASK -- cgit v1.2.3 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/