Skip to content

The tier 2 optimizer specification contains too much boilerplate #118910

Closed
@markshannon

Description

@markshannon

The tier 2 optimizer specification (optimizer_bytecodes.c) contains lots of boilerplate for handling contradictions and running out of space in the optimizer's data structures.
These can be handled but setting flags on the optimizer context and checking those in the abstract interpreter loop.

For example
OUT_OF_SPACE_IF_NULL(res = sym_new_unknown(ctx)); can be replaced with res = sym_new_unknown(ctx)
and

if (!sym_set_type(right, &PyUnicode_Type)) {
    goto hit_bottom;
}

can be replaced with sym_set_type(left, &PyUnicode_Type);

Hopefully this will make the optimizer a bit more approachable and maintainable

Linked PRs

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions