ruby/lib/ruby_vm/mjit
Aaron Patterson 06b62cbbdd Add `offsetof` so we can get the offset of members
I want to get the offset of fields inside structs, but I don't want to
instantiate the struct.  I need to embed the offsets inside machine
code, and I can't get the offsets without calling `new` on the struct.

This commit adds an `offset` method so you can get the offset of a
member without instantiating anything.  You can do:

```ruby
C.rb_control_frame_t.offsetof(:sp) #=> 8
```

I don't think this implementation is perfect, you can only get immediate
fields.  But it is better than nothing!
2023-01-20 14:11:05 -08:00
..
c_pointer.rb Add `offsetof` so we can get the offset of members 2023-01-20 14:11:05 -08:00
c_type.rb
compiler.rb MJIT: Fix JIT code for multiple values in a single case 2022-12-25 22:48:36 -08:00
hooks.rb MJIT: Cancel all on disastrous situations (#7019) 2022-12-24 01:13:40 -08:00