Commit 1f40922
committed
ZJIT: Dispatch a
`direct_invoke_block_adapt()` refused any block containing a `throw`
other than a plain non-local `return`, so every `yield` to a block with
a `break` in it called `rb_vm_invokeblock()` for the life of the
process. The refusal was there because `break` came out as an orphan
("break from proc-closure") or a segfault, which the previous commit
traces to `vm_throw_start()` reading the raw `cfp->_iseq` of a frame
ZJIT pushed. With that read going through `CFP_ISEQ()`, the throw
unwinds out of a JIT-pushed block frame the same way it unwinds out of
one the interpreter pushed: `rb_zjit_throw()` longjmps past every JIT
native frame to the enclosing `vm_exec()`, which resumes at the catch
entry the throw resolved to.
`Kernel#loop` and `Integer#downto` are the two sites this matters for on
lobsters, and both are monomorphic in their block, so they were already
one gate away from the direct dispatch.
lobsters, 15 iterations:
rb_vm_invokeblock 1,350,799 -> 1,223,051 (-9.5%)
invokeblock_may_throw 127,811 -> 0
Two master snapshots renumbered: optimize_send_with_block and
optimize_send_to_aliased_cfunc now inline Array#map, because inlining it is what
unlocks the direct yield inside it.yield to a block that can break directly1 parent b84190e commit 1f40922
2 files changed
Lines changed: 103 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8090 | 8090 | | |
8091 | 8091 | | |
8092 | 8092 | | |
| 8093 | + | |
| 8094 | + | |
| 8095 | + | |
| 8096 | + | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
| 8100 | + | |
| 8101 | + | |
| 8102 | + | |
| 8103 | + | |
| 8104 | + | |
| 8105 | + | |
| 8106 | + | |
| 8107 | + | |
| 8108 | + | |
| 8109 | + | |
| 8110 | + | |
| 8111 | + | |
| 8112 | + | |
| 8113 | + | |
| 8114 | + | |
| 8115 | + | |
| 8116 | + | |
| 8117 | + | |
| 8118 | + | |
| 8119 | + | |
| 8120 | + | |
| 8121 | + | |
| 8122 | + | |
| 8123 | + | |
| 8124 | + | |
| 8125 | + | |
| 8126 | + | |
| 8127 | + | |
| 8128 | + | |
| 8129 | + | |
| 8130 | + | |
| 8131 | + | |
| 8132 | + | |
| 8133 | + | |
| 8134 | + | |
| 8135 | + | |
| 8136 | + | |
| 8137 | + | |
| 8138 | + | |
| 8139 | + | |
| 8140 | + | |
| 8141 | + | |
| 8142 | + | |
| 8143 | + | |
| 8144 | + | |
| 8145 | + | |
| 8146 | + | |
| 8147 | + | |
| 8148 | + | |
| 8149 | + | |
| 8150 | + | |
| 8151 | + | |
| 8152 | + | |
| 8153 | + | |
| 8154 | + | |
| 8155 | + | |
| 8156 | + | |
| 8157 | + | |
| 8158 | + | |
| 8159 | + | |
| 8160 | + | |
| 8161 | + | |
| 8162 | + | |
| 8163 | + | |
| 8164 | + | |
| 8165 | + | |
| 8166 | + | |
| 8167 | + | |
| 8168 | + | |
| 8169 | + | |
| 8170 | + | |
| 8171 | + | |
| 8172 | + | |
| 8173 | + | |
| 8174 | + | |
| 8175 | + | |
| 8176 | + | |
| 8177 | + | |
| 8178 | + | |
| 8179 | + | |
| 8180 | + | |
| 8181 | + | |
| 8182 | + | |
| 8183 | + | |
| 8184 | + | |
| 8185 | + | |
| 8186 | + | |
| 8187 | + | |
| 8188 | + | |
| 8189 | + | |
| 8190 | + | |
8093 | 8191 | | |
8094 | 8192 | | |
8095 | 8193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3640 | 3640 | | |
3641 | 3641 | | |
3642 | 3642 | | |
3643 | | - | |
3644 | | - | |
3645 | | - | |
3646 | | - | |
3647 | | - | |
3648 | | - | |
3649 | | - | |
3650 | | - | |
3651 | | - | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
3652 | 3648 | | |
3653 | 3649 | | |
3654 | 3650 | | |
| |||
0 commit comments