diff options
| author | Tobias Lütke <tobi@shopify.com> | 2025-12-10 16:18:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-10 16:18:08 -0500 |
| commit | c8909030974772b4f19742bac55875e32674d27f (patch) | |
| tree | 1ea61ef4d337b998a29114428175fdb772cccbb8 /test/ruby/test_lambda.rb | |
| parent | ccfd31162a8455ac2502ebaf90873b966a866216 (diff) | |
ZJIT: Fold LoadField on frozen objects to constants (#15483)
* ZJIT: Fold LoadField on frozen objects to constants
When accessing instance variables from frozen objects via attr_reader/
attr_accessor, fold the LoadField instruction to a constant at compile
time. This enables further optimizations like constant propagation.
- Add fold_getinstancevariable_frozen optimization in Function::optimize
- Check if receiver type has a known ruby_object() that is frozen
- Read the field value at compile time and replace with Const instruction
- Add 10 unit tests covering various value types (fixnum, string, symbol,
nil, true/false) and negative cases (unfrozen, dynamic receiver)
* Run zjit-test-update
* Add a test that we don't fold non-BasicObject
* Small cleanups
---------
Co-authored-by: Max Bernstein <ruby@bernsteinbear.com>
Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Diffstat (limited to 'test/ruby/test_lambda.rb')
0 files changed, 0 insertions, 0 deletions
