Commit c928cc2
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 93a9712 commit c928cc2
2 files changed
Lines changed: 103 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8846 | 8846 | | |
8847 | 8847 | | |
8848 | 8848 | | |
| 8849 | + | |
| 8850 | + | |
| 8851 | + | |
| 8852 | + | |
| 8853 | + | |
| 8854 | + | |
| 8855 | + | |
| 8856 | + | |
| 8857 | + | |
| 8858 | + | |
| 8859 | + | |
| 8860 | + | |
| 8861 | + | |
| 8862 | + | |
| 8863 | + | |
| 8864 | + | |
| 8865 | + | |
| 8866 | + | |
| 8867 | + | |
| 8868 | + | |
| 8869 | + | |
| 8870 | + | |
| 8871 | + | |
| 8872 | + | |
| 8873 | + | |
| 8874 | + | |
| 8875 | + | |
| 8876 | + | |
| 8877 | + | |
| 8878 | + | |
| 8879 | + | |
| 8880 | + | |
| 8881 | + | |
| 8882 | + | |
| 8883 | + | |
| 8884 | + | |
| 8885 | + | |
| 8886 | + | |
| 8887 | + | |
| 8888 | + | |
| 8889 | + | |
| 8890 | + | |
| 8891 | + | |
| 8892 | + | |
| 8893 | + | |
| 8894 | + | |
| 8895 | + | |
| 8896 | + | |
| 8897 | + | |
| 8898 | + | |
| 8899 | + | |
| 8900 | + | |
| 8901 | + | |
| 8902 | + | |
| 8903 | + | |
| 8904 | + | |
| 8905 | + | |
| 8906 | + | |
| 8907 | + | |
| 8908 | + | |
| 8909 | + | |
| 8910 | + | |
| 8911 | + | |
| 8912 | + | |
| 8913 | + | |
| 8914 | + | |
| 8915 | + | |
| 8916 | + | |
| 8917 | + | |
| 8918 | + | |
| 8919 | + | |
| 8920 | + | |
| 8921 | + | |
| 8922 | + | |
| 8923 | + | |
| 8924 | + | |
| 8925 | + | |
| 8926 | + | |
| 8927 | + | |
| 8928 | + | |
| 8929 | + | |
| 8930 | + | |
| 8931 | + | |
| 8932 | + | |
| 8933 | + | |
| 8934 | + | |
| 8935 | + | |
| 8936 | + | |
| 8937 | + | |
| 8938 | + | |
| 8939 | + | |
| 8940 | + | |
| 8941 | + | |
| 8942 | + | |
| 8943 | + | |
| 8944 | + | |
| 8945 | + | |
| 8946 | + | |
8849 | 8947 | | |
8850 | 8948 | | |
8851 | 8949 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3918 | 3918 | | |
3919 | 3919 | | |
3920 | 3920 | | |
3921 | | - | |
3922 | | - | |
3923 | | - | |
3924 | | - | |
3925 | | - | |
3926 | | - | |
3927 | | - | |
3928 | | - | |
3929 | | - | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
3930 | 3926 | | |
3931 | 3927 | | |
3932 | 3928 | | |
| |||
0 commit comments