• huangs's avatar
    [Courgette] Using LabelManager to reduce Courgette-apply peak RAM by 25%. · c803763b
    huangs authored
    AssemblyProgram previously allocates new Label instances as it parses
    an executable and emits instructions. This CL replaces the flow by using
    LabelManager to precompute Labels in one array. This allows us to reduce
    Courgette-apply peak RAM by 25%, measured by "choke RAM until failure"
    method. Details:
    - We precompute Labels in AssemblyProgram::PrecomputeLabels(), which
      relies on RvaVisitor inherited classes for architecture-specific
      extraction of abs32 and rel32 targets.
    - TrimLabel()'s complex post-processing flow is simplified using
      PrecomputeLabels(), which runs before main file parse.
      - This requires RemoveUnusedRel32Locations() to update rel32.
      - Deprecating C_TRIM_FAILED error message.
    - Moving more common functionality to Disassembler, but duplicating
      some code for win32-x86 and win32-x64 to follow existing pattern.
    Review-Url: https://codereview.chromium.org/1935203002
    Cr-Commit-Position: refs/heads/master@{#394815}
image_utils.h 6.05 KB