Repository navigation
Closed
ruby/ruby
#13882Description
Script to reproduce:
def test(*arr, &b)
arr.first
yield
end
testCommand:
./build/miniruby --zjit --zjit-dump-hir --zjit-call-threshold=1 --zjit-num-profiles=1 test.rb
Crash Report:
../vm_core.h:1439: Assertion Failed: VM_ENV_FLAGS:FIXNUM_P(flags)
ruby 3.5.0dev (2025-07-05T16:57:55Z zjit-test-against-.. 9ac0040139) +ZJIT dev +PRISM [arm64-darwin24]
-- Crash Report log information --------------------------------------------
See Crash Report log file in one of the following locations:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
../vm_core.h:1439: Assertion Failed: VM_ENV_FLAGS:FIXNUM_P(flags)
ruby 3.5.0dev (2025-07-05T16:57:55Z zjit-test-against-.. 9ac0040139) +ZJIT dev +PRISM [arm64-darwin24]
-- Crash Report log information --------------------------------------------
See Crash Report log file in one of the following locations:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
Crashed while printing bug report
[IMPORTANT]
Don't forget to include the Crash Report log file under
DiagnosticReports directory in bug reports.
[1] 4834 abort ./build/miniruby --zjit --zjit-dump-hir --zjit-call-threshold=1 test.rb
HIR:
HIR:
fn <main>:
bb0(v0:BasicObject):
SideExit UnknownOpcode(definemethod)
HIR:
fn test:
bb0(v0:BasicObject, v1:ArrayExact, v2:BasicObject):
PatchPoint MethodRedefined(Array@0x101bd0a90, first@0x16f1)
v9:BasicObject = SendWithoutBlockDirect v1, :first (0x16f330ff8)
SideExit UnknownOpcode(invokeblock)
HIR:
fn first:
bb0(v0:BasicObject):
v3:BasicObject = InvokeBuiltin _bi132, v0
Return v3
Activity
st0012 commentedon Jul 7, 2025
Backtrace (from lldb)
tekknolagi commentedon Jul 7, 2025
Nice small repro--great stuff
st0012 commentedon Jul 10, 2025
I did some investigation with Claude and this seem to be what happened:
yieldgen_push_frame()creates frame with:ep[-2]: CME (method entry)ep[-1]:VM_BLOCK_HANDLER_NONE(always)ep[0]: Flags (raw u32, not FIXNUM)invokeblockinvokeblockreadsep[-1], findsVM_BLOCK_HANDLER_NONELocalJumpErrorVM_ENV_FLAGS(ep, flag)We can fix this by having proper block yielding support, which I can't do by myself but will happy to learn.
st0012 commentedon Jul 14, 2025
Some stuff from the debugging session:
Another script that also fails:
Insn dump:
LLDB debugging output:
Details
tekknolagi commentedon Jul 14, 2025
Any insight from the meeting into why this is happening?
k0kubun commentedon Jul 14, 2025
As per Alan's finding after pairing, here's a PR that fixes the repro ruby#13882.