Skip to content

ZJIT: Specialize polymorphic invokeblock #1013

Description

@k0kubun

ruby#17653 specializes only one ISEQ per callsite, but we should be able to specialize polymorphic invokeblock.

On lobsters, invokeblock still does a lot of fallbacks:

Top-20 send fallback reasons (99.9% of total 4,747,881):
                             invokeblock_not_specialized: 1,790,399 (37.7%)
                            one_or_more_complex_arg_pass:   916,595 (19.3%)
                          send_without_block_polymorphic:   489,908 (10.3%)
                          send_without_block_megamorphic:   356,682 ( 7.5%)
                                        send_polymorphic:   282,492 ( 5.9%)

and polymorphic seems like the most common reason:

Top-5 invokeblock handler (100.0% of total 1,980,719):
        polymorphic: 1,323,210 (66.8%)
  monomorphic_other:   439,539 (22.2%)
   monomorphic_iseq:   180,526 ( 9.1%)
  monomorphic_ifunc:    34,898 ( 1.8%)
        megamorphic:     2,546 ( 0.1%)

We should probably consider letting the inliner monomorphize such callsites in general, but since it shows up on benchmarks with the inliner enabled, we should consider specializing them as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions