Skip to content

Type capture mechanism #33

@maximecb

Description

@maximecb

It would be nice to have a type capture mechanism so that we can specialized based on potentially unknown types while generating code. This could be used to request the type of the Nth operand on the stack, with 0 being the topmost.

type ctx_capture_top_type(ctx_t* ctx)

If the type is unknown, a branch and code patching will be used to extract the type. Compilation can then be halted based on a special return value.

The mechanism can be generalized to capture things like object classes, method identity. It can also be used to speculate based on how a property is to be read on an object (field on object vs extended table). Any kind of query, with the benefit that we can reduce code size. Though we should probably start by implementing a less general mechanism that only does type capture for stack values.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions