Skip to content

Improve the compile times of macaw-aarch32 #480

@RyanGlScott

Description

@RyanGlScott

The compile times for the macaw-aarch32 are particularly severe. On my machine, it can easily take 10+ minutes to build macaw-aarch32 alone, and it requires several gigabytes of RAM to do so.

There are likely a couple of ways that we could improve things. To paraphrase a previous discussion with @danmatichuk:

  1. The bulk of the compilation time is spent compiling the Template Haskell–generated code in Data.Macaw.ARM.Semantics.{ARMSemantics,ThumbSemantics}, which are monolithic modules that contain the semantics of every single ARM/Thumb instruction in the AArch32 ISA. GHC's compilation times are known to suffer when compiling extremely large modules, so it is likely that we would observe improvements by splitting these up into smaller modules.
  2. Some of AArch32's instructions are polymorphic in the bit widths of certain arguments, but macaw-aarch32 will generate a copy of the semantics for each monomorphic instantiation of a particular instruction. This results in a rather excessive amount of code duplication in the Template Haskell–generated code. Finding a way to reduce this code duplication would likely improve the compile times quite a bit.
  3. Similarly, macaw-aarch32 duplicates several instructions simply because they’re defined as separate instructions in dismantle, so you might end up with five or six copies of instructions even though asl-translator only defines the instruction once. We should look more into this to see if this can be altered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch:aarch32AArch32 (32 bit ARM) issuestech-debtTechnical debt that would be nice to clean up

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions