pzskc383 · GitHub

found as a bug in mruby-hashie and bisected to commit  09336c5  which adds
OP_(GET|SET)IDX. OP_SETIDX seeps to default to dispatch as of now.
if it's aliased, goto default dispatch, otherwise use mrb_hash_set

@pzskc383

gemini-code-assist[bot]

@pzskc383

matz added a commit that referenced this pull request

Dec 25, 2025
Apply the same pattern as the Hash fix: the OP_GETIDX optimization
now only applies to instances of the Array class itself. Subclasses
fall back to method dispatch, allowing them to override the [] method.
Co-authored-by: Claude <noreply@anthropic.com>

matz added a commit that referenced this pull request

Dec 25, 2025
Apply the same pattern as the Array/Hash fix: the OP_GETIDX optimization
now only applies to instances of the String class itself. Subclasses
fall back to method dispatch, allowing them to override the [] method.
Co-authored-by: Claude <noreply@anthropic.com>

matz added a commit that referenced this pull request

Dec 25, 2025
Add inline optimizations for Array#[]= and Hash#[]= in OP_SETIDX,
matching the pattern established for OP_GETIDX:
- Array class: use mrb_ary_set() directly (integer index only)
- Hash class: use mrb_hash_set() directly
- Subclasses: fall back to method dispatch (can override []=)
- String: unchanged (complex 2-3 argument signature)
Co-authored-by: Claude <noreply@anthropic.com>

Read the original on github.com ↗