Commit 187cb0d
committed
ZJIT: Exit with the block arg on the stack from SendDirect args
When a direct send drops a profiled-nil `&block` argument, it lays out
the callee frame from a snapshot with the block arg stripped from the VM
stack. emit_send_direct_args() also used that snapshot for instructions
that materialize the callee's arguments before the call, such as the rest
array of a `*args` callee. Those can side-exit, e.g. at the NoNewObjHook
patch point of the inline allocation once a NEWOBJ hook is enabled, and the
exit re-executes the send in the interpreter at the same PC. With the block
arg missing from the stack, the interpreter took the last positional
argument as the block:
TypeError: no implicit conversion of Net::HTTP::Post into Proc
This happened in Shopify's Sonic test suite after a test enabled
ObjectSpace.trace_object_allocations: Net::HTTP#request passes `&block` to
Semian's `transport_request(*)`, and `request` had reached the version
limit, so its invalidated code kept exiting there.
Use the send's original frame state for those instructions.1 parent 6b563b8 commit 187cb0d
2 files changed
Lines changed: 41 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3984 | 3984 | | |
3985 | 3985 | | |
3986 | 3986 | | |
3987 | | - | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
| 3991 | + | |
| 3992 | + | |
3988 | 3993 | | |
3989 | 3994 | | |
3990 | 3995 | | |
3991 | | - | |
| 3996 | + | |
3992 | 3997 | | |
3993 | 3998 | | |
3994 | 3999 | | |
| |||
4882 | 4887 | | |
4883 | 4888 | | |
4884 | 4889 | | |
4885 | | - | |
| 4890 | + | |
4886 | 4891 | | |
4887 | 4892 | | |
4888 | 4893 | | |
| |||
4923 | 4928 | | |
4924 | 4929 | | |
4925 | 4930 | | |
4926 | | - | |
| 4931 | + | |
4927 | 4932 | | |
4928 | 4933 | | |
4929 | 4934 | | |
| |||
5456 | 5461 | | |
5457 | 5462 | | |
5458 | 5463 | | |
5459 | | - | |
| 5464 | + | |
5460 | 5465 | | |
5461 | 5466 | | |
5462 | 5467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
29 | 60 | | |
30 | 61 | | |
31 | 62 | | |
| |||
0 commit comments