-
Notifications
You must be signed in to change notification settings - Fork 5.4k
ZJIT: Use rb_vm_env_write() when writing locals in higher scopes #13977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Similarly to YJIT, could we skip the call when the Feel free to merge this first and leave it for another PR though. |
tbh we don't need a flag in the instruction -- we can make the decision at HIR->LIR codegen time with the type of |
@st0012 does this (with the class.h fix) fix the problems you see and enable more tests? |
"with the type of |
4a5bca6
to
ad84032
Compare
We weren't firing write barriers before when writing to imemo/env objects. Wbcheck caught this with test/ruby/test_refinement.rb: ruby -v: ruby 3.5.0dev (2025-07-22T17:05:58Z wbcheck 2569a80954) +ZJIT dev +PRISM +GC[wbcheck] [x86_64-linux] WBCHECK ERROR: Missed write barrier detected! Parent object: 0x558de9f4e6e0 (wb_protected: true) rb_obj_info_dump: 0x0000558de9f4e6e0 T_IMEMO/<env> Reference counts - snapshot: 3, writebarrier: 0, current: 4, missed: 1 Missing reference to: 0x558decf37c30 rb_obj_info_dump: 0x0000558decf37c30 method/UnboundMethod method WBCHECK SUMMARY: Found 1 objects with missed write barriers (1 total violations)
I figure things like GuardType on a constant should be handled by optimizer, so HIR->LIR translation should have the same visibility on whether something is constant. |
I mean that in HIR->LIR you can do |
That gives (much) more information than looking at the exact value, which we might not know. It would handle if it's any kind of Fixnum, for example |
I'm not sure if I follow. |
Ah, I guess |
We weren't firing write barriers before when writing to imemo/env
objects. Wbcheck caught this with test/ruby/test_refinement.rb: