diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2022-09-08 23:19:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-09 15:19:23 +0900 |
commit | 56e5210cdeda685b5948148b7ea5c72eac0b5e06 (patch) | |
tree | de53e69950b97549c73b10aa2bcc5070e60178c8 /lib/mjit | |
parent | be560332484c8893bec004f1250e48edcd4720e0 (diff) | |
download | ruby-56e5210cdeda685b5948148b7ea5c72eac0b5e06.tar.gz |
More robust macro parser (#6343)
I want to use more complicated macros with MJIT. For example:
```
# define SHAPE_MASK (((unsigned int)1 << SHAPE_BITS) - 1)
```
This commit adds a simple recursive descent parser that produces an AST
and a small visitor that converts the AST to Ruby.
Diffstat (limited to 'lib/mjit')
-rw-r--r-- | lib/mjit/c_32.rb | 6 | ||||
-rw-r--r-- | lib/mjit/c_64.rb | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/mjit/c_32.rb b/lib/mjit/c_32.rb index c628e60967..a369a3e852 100644 --- a/lib/mjit/c_32.rb +++ b/lib/mjit/c_32.rb @@ -3,15 +3,15 @@ require_relative 'c_type' module RubyVM::MJIT C = Object.new - def C.NOT_COMPILED_STACK_SIZE = - 1 + def C.NOT_COMPILED_STACK_SIZE = -1 def C.USE_LAZY_LOAD = false def C.USE_RVARGC = true - def C.VM_CALL_KW_SPLAT = ( 0x01 << self.VM_CALL_KW_SPLAT_bit ) + def C.VM_CALL_KW_SPLAT = (0x01 << self.VM_CALL_KW_SPLAT_bit) - def C.VM_CALL_TAILCALL = ( 0x01 << self.VM_CALL_TAILCALL_bit ) + def C.VM_CALL_TAILCALL = (0x01 << self.VM_CALL_TAILCALL_bit) def C.VM_METHOD_TYPE_CFUNC = 1 diff --git a/lib/mjit/c_64.rb b/lib/mjit/c_64.rb index 864cb32b64..e3989a12e2 100644 --- a/lib/mjit/c_64.rb +++ b/lib/mjit/c_64.rb @@ -3,15 +3,15 @@ require_relative 'c_type' module RubyVM::MJIT C = Object.new - def C.NOT_COMPILED_STACK_SIZE = - 1 + def C.NOT_COMPILED_STACK_SIZE = -1 def C.USE_LAZY_LOAD = false def C.USE_RVARGC = true - def C.VM_CALL_KW_SPLAT = ( 0x01 << self.VM_CALL_KW_SPLAT_bit ) + def C.VM_CALL_KW_SPLAT = (0x01 << self.VM_CALL_KW_SPLAT_bit) - def C.VM_CALL_TAILCALL = ( 0x01 << self.VM_CALL_TAILCALL_bit ) + def C.VM_CALL_TAILCALL = (0x01 << self.VM_CALL_TAILCALL_bit) def C.VM_METHOD_TYPE_CFUNC = 1 |