Class ConstructIrManifest

java.lang.Object
org.ek9lang.compiler.backend.ConstructIrManifest

public final class ConstructIrManifest extends Object
ONE file mapping every generated construct to a hash of the IR it was generated from.

This is the record an incremental build reads to decide what to regenerate. Hashing the IR rather than the source is the point: in EK9 a change in file A can alter file B's bytecode while B's source is untouched - dispatch tables are built from concrete subtypes, the COMPUTE_FRAMES hierarchy map depends on supertypes, and _fieldSetStatus encodes field positions as bit indices. Every one of those is encoded in the IR, so an IR hash catches them automatically and the codegen half of incremental needs no invalidation graph - which is where such schemes usually fail.

IRConstruct.toString() is the serialisation used, because it is already the one the @IR directive golden files are byte-compared against across the whole test corpus. It is therefore known-stable rather than assumed-stable.

ONE file, not one per construct - a manifest per output would add 254,724 files to remove 254,724 files.

⚠️ Deliberately NOT java.util.Properties. EK9 fully-qualified names contain ::, and : is a Properties key/value separator, so scale.billing.domain::Customer=deadbeef loads as key scale.billing.domain with value :Customer=deadbeef. Every key silently collapses to one entry per MODULE instead of one per construct - a plausible-looking file with the wrong contents. Tab-separated instead; EK9 identifiers cannot contain a tab.

See SPEC-incremental-builds.md S5b.

  • Constructor Details

    • ConstructIrManifest

      public ConstructIrManifest()
  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Whether this manifest is being built. When false nothing is recorded and no file is written.
      Returns:
      true if manifest construction is enabled.
    • record

      public void record(String fullyQualifiedName, Supplier<String> irText)
      Record the IR hash for one construct.
      Parameters:
      fullyQualifiedName - the construct's EK9 FQN - the key an incremental build looks up.
      irText - supplies the construct's IR serialisation, called only when enabled.
    • size

      public int size()
    • writeTo

      public void writeTo(File target, String buildFingerPrint)
      Write the manifest.
      Parameters:
      target - where to write it.
      buildFingerPrint - identifies the configuration that produced these hashes - target architecture, optimisation level, debug flag, compiler version. A reader whose fingerprint differs MUST full-build: hashes from an optimised build say nothing about an unoptimised one, and a chance match would ship a mismatched artefact.