Skip to content

YJIT: avoid using deferred compilation if context already has the type info we need #462

@maximecb

Description

@maximecb

At the moment, we often use deferred compilation to peek at a value on the stack, or to peek at self (see jit_peek_at_stack and jit_peek_at_self). The downside of that is that it breaks blocks into smaller parts. That adds overhead, increases JIT memory usage, and also potentially takes away some optimization opportunities, because our backend is looking at smaller blocks with less opportunities to do peephole optimizations.

I was thinking that in some cases, the context may already have the type information we're looking for. We might already know the type of the value we want to peek at. If that's true, then we could avoid doing deferred compilation in order to peek at value type(s). If we can improve our type tracking (see #460 for example) the need to do deferred compilation might decrease over time as well.

A good first step may be to check how often we actually know all the types we need and may be able to avoid doing deferred compilation. If we choose to go forward, this can also be broken into multiple PRs if it's easier.

Aaron has expressed interest in taking this first issue. I was thinking it might make sense for him to pair with the amazing @jhawthorn if he's available, since John has already made multiple improvements to the type information tracking in the context.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions