Skip to content

iss: Optimize TB chaining and exiting #865

@BadGraphixD

Description

@BadGraphixD

During the translation of the guest instructions to TCG operations, it is sometimes necessary to end the translation block and generate certain TCG instructions. The following operations may be generated and require a translation block end:

  • direct jump
    • end the TB, PC changes
    • here we can chain the TBs together with jumpslots
  • indirect jump
    • end the TB, PC changes
    • here we need to generate a TB lookup, because the next PC is not known during translation
  • write to a register that changes the TB-state (static)
    • end the TB, because the TB-state changes
    • the next pc and TB-state is known during translation, so we can chain and use jumpslots
  • write to a register that changes the TB-state (dynamic)
    • end the TB, because the TB-state changes
    • here we need to generate a TB lookup, because the next TB-state is not known during translation

During a single instruction, any combination of these things may happen. Whether they happen may or may not be known during translation since the condition can depend on purely statically known things (constants and registers that are part of the TB-state). Eg if an indirect jump only happens under a condition that is known to be false during translation, then the TB does not need to end.

Currently our solution is very conservative (TBs are often unnecessarily ended and chaining is not always used).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestissThis is ISS relatedoptimizationThis is an optimization of an existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions