Skip to content

Compact code object marshaled form and pre-quicken bytecode when unmarshaling #462

@markshannon

Description

@markshannon

Currently we go through a two stage process to get to the adaptive form of instructions.
The explanation below uses CALL, but it applies to all specializable instructions.

  1. When unmarshaling the code object we create the bytecode CALL, oparg, 0, 0, 0 ... where the zeros are the cache.
  2. When executing, check a counter and quicken when that counter reaches zero.
  3. When quickening, replace all CALLs with CALL_ADAPTIVEs.

Instead we should quicken when unmarshaling, so that we create:

(CALL_ADAPTIVE oparg)
7 # uint16_t not byte pair
...

instead of

(CALL oparg)
(0 0)

The marshaled form only needs one byte for instructions without an oparg and two for other instructions. No space is needed for the cache.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions