diff options
author | Takashi Kokubun <[email protected]> | 2022-11-14 00:24:08 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2022-11-14 00:24:08 -0800 |
commit | 80bab6c8eddbb225c88155f2eb456a4d937294c7 (patch) | |
tree | 6ce6dae48c63bb34aabd6399d0f851925d9798da | |
parent | e4e2ff76a8415e4d2db88c1f2b0c4742cb6184c1 (diff) |
Import class constants with mjit-bindgen
-rw-r--r-- | mjit_c.rb | 33 | ||||
-rwxr-xr-x | tool/mjit/bindgen.rb | 8 |
2 files changed, 34 insertions, 7 deletions
@@ -4,6 +4,8 @@ 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. class << C def SHAPE_BITS Primitive.cexpr! 'UINT2NUM(SHAPE_BITS)' @@ -156,13 +158,6 @@ module RubyVM::MJIT return Qnil; } end - - def rb_cFalseClass; Primitive.cexpr! 'PTR2NUM(rb_cFalseClass)' end - def rb_cNilClass; Primitive.cexpr! 'PTR2NUM(rb_cNilClass)' end - def rb_cTrueClass; Primitive.cexpr! 'PTR2NUM(rb_cTrueClass)' end - def rb_cInteger; Primitive.cexpr! 'PTR2NUM(rb_cInteger)' end - def rb_cSymbol; Primitive.cexpr! 'PTR2NUM(rb_cSymbol)' end - def rb_cFloat; Primitive.cexpr! 'PTR2NUM(rb_cFloat)' end end ### MJIT bindgen begin ### @@ -211,6 +206,30 @@ module RubyVM::MJIT Primitive.cexpr! %q{ ULONG2NUM(SHAPE_MASK) } end + def C.rb_cFalseClass + Primitive.cexpr! %q{ PTR2NUM(rb_cFalseClass) } + end + + def C.rb_cFloat + Primitive.cexpr! %q{ PTR2NUM(rb_cFloat) } + end + + def C.rb_cInteger + Primitive.cexpr! %q{ PTR2NUM(rb_cInteger) } + end + + def C.rb_cNilClass + Primitive.cexpr! %q{ PTR2NUM(rb_cNilClass) } + end + + def C.rb_cSymbol + Primitive.cexpr! %q{ PTR2NUM(rb_cSymbol) } + end + + def C.rb_cTrueClass + Primitive.cexpr! %q{ PTR2NUM(rb_cTrueClass) } + end + def C.CALL_DATA @CALL_DATA ||= self.rb_call_data end diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb index 4d79b32bc2..70800b7dcb 100755 --- a/tool/mjit/bindgen.rb +++ b/tool/mjit/bindgen.rb @@ -345,6 +345,14 @@ generator = BindingGenerator.new( INVALID_SHAPE_ID SHAPE_MASK ], + PTR: %w[ + rb_cFalseClass + rb_cFloat + rb_cInteger + rb_cNilClass + rb_cSymbol + rb_cTrueClass + ], }, types: %w[ CALL_DATA |