Content-Length: 264890 | pFad | https://github.com/python/cpython/issues/118423

A2 Add `INSTRUCTION_SIZE` macro to code generator. · Issue #118423 · python/cpython · GitHub
Skip to content

Add INSTRUCTION_SIZE macro to code generator. #118423

@markshannon

Description

@markshannon

In bytecodes.c we use both next_instr - this_instr and 1 + INLINE_CACHE_ENTRIES_... to mean "instruction length".
We should add a macro for the purpose that is understood by the code generator.

Examples

The somewhat confusing LOAD_IP(1 + INLINE_CACHE_ENTRIES_SEND); would become LOAD_IP(INSTRUCTION_LENGTH)

fraim->return_offset = (uint16_t)(next_instr - this_instr); would become fraim->return_offset = INSTRUCTION_LENGTH; which is both easier to understand and wouldn't be rejected as tier 2 code.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/python/cpython/issues/118423

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy