Skip to content

Commit e699588

Browse files
committed
perf: split GHC.Hs.Instances for parallel compilation (#18254)
Split the monolithic GHC.Hs.Instances module (344 Data instances, 14MB object file) into 5 parallel-compilable sub-modules: - GHC.Hs.Instances.Common - phase-independent instances - GHC.Hs.Instances.Transitions - LR types spanning multiple phases - GHC.Hs.Instances.Parsed - GhcPs instances only - GHC.Hs.Instances.Renamed - GhcRn instances only - GHC.Hs.Instances.Typechecked - GhcTc instances only The wrapper module GHC.Hs.Instances re-exports all sub-modules for backward compatibility. Additionally, all Instance modules are now excluded from stage1 builds (via -interpreter flag) since Data instances are only needed at runtime for Template Haskell and GHCi, not for compilation. Benefits: - Stage1: Saves ~14MB object file + compile time - Stage2: 5 modules can compile in parallel instead of 1 serial See #9557 for why these use -O0, #18254 for the parallelism issue.
1 parent c12adc1 commit e699588

File tree

8 files changed

+727
-609
lines changed

8 files changed

+727
-609
lines changed

compiler/GHC/Hs.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ therefore, is almost nothing but re-exporting.
1010
-}
1111

1212
{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable
13+
{-# LANGUAGE CPP #-}
1314
{-# LANGUAGE DeriveDataTypeable #-}
1415
{-# LANGUAGE StandaloneDeriving #-}
1516
{-# LANGUAGE FlexibleContexts #-}
@@ -54,7 +55,10 @@ import GHC.Hs.Pat
5455
import GHC.Hs.Type
5556
import GHC.Hs.Utils
5657
import GHC.Hs.Doc
58+
59+
#if defined(HAVE_INTERPRETER)
5760
import GHC.Hs.Instances () -- For Data instances
61+
#endif
5862

5963
-- others:
6064
import GHC.Utils.Outputable

0 commit comments

Comments
 (0)