[Git][ghc/ghc][wip/ipe-section] compiler: Place IPE information in separate section
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Mon Jul 3 13:38:50 UTC 2023
Ben Gamari pushed to branch wip/ipe-section at Glasgow Haskell Compiler / GHC
Commits:
973bc9aa by Ben Gamari at 2023-07-03T09:38:43-04:00
compiler: Place IPE information in separate section
Previously IPE information would end up in the `.data` section. Not only
does this make it difficult to measure the size of the IPE metadata, but
by placing it in its own section we reduce the probability of the
(generally rather large) IPE metadata inducing large displacements at link-time.
Moreover, we can now in principle allow the data to be stripped
post-build; we would merely need to sort out how to make the
could
- - - - -
4 changed files:
- compiler/GHC/Cmm.hs
- compiler/GHC/CmmToAsm/Ppr.hs
- compiler/GHC/StgToCmm/InfoTableProv.hs
- compiler/GHC/StgToCmm/Utils.hs
Changes:
=====================================
compiler/GHC/Cmm.hs
=====================================
@@ -249,6 +249,7 @@ data SectionType
| ReadOnlyData
| RelocatableReadOnlyData
| UninitialisedData
+ | InfoProvData
-- See Note [Initializers and finalizers in Cmm] in GHC.Cmm.InitFini
| InitArray -- .init_array on ELF, .ctor on Windows
| FiniArray -- .fini_array on ELF, .dtor on Windows
@@ -268,6 +269,7 @@ sectionProtection (Section t _) = case t of
Text -> ReadOnlySection
ReadOnlyData -> ReadOnlySection
RelocatableReadOnlyData -> WriteProtectedSection
+ InfoProvData -> ReadWriteSection
InitArray -> ReadOnlySection
FiniArray -> ReadOnlySection
CString -> ReadOnlySection
=====================================
compiler/GHC/CmmToAsm/Ppr.hs
=====================================
@@ -230,6 +230,7 @@ pprGNUSectionHeader config t suffix =
-> text ".rdata$rel.ro"
| otherwise -> text ".data.rel.ro"
UninitialisedData -> text ".bss"
+ InfoProvData -> text ".data$ipe"
InitArray
| OSMinGW32 <- platformOS platform
-> text ".ctors"
@@ -272,6 +273,7 @@ pprDarwinSectionHeader t = case t of
Text -> text ".text"
Data -> text ".data"
ReadOnlyData -> text ".const"
+ InfoProvData -> text ".data"
RelocatableReadOnlyData -> text ".const_data"
UninitialisedData -> text ".data"
InitArray -> text ".section\t__DATA,__mod_init_func,mod_init_funcs"
=====================================
compiler/GHC/StgToCmm/InfoTableProv.hs
=====================================
@@ -140,22 +140,22 @@ emitIpeBufferListNode this_mod ents = do
-- Emit the list of info table pointers
emitDecl $ CmmData
- (Section Data tables_lbl)
+ (Section InfoProvData tables_lbl)
(CmmStaticsRaw tables_lbl tables)
-- Emit the strings table
emitDecl $ CmmData
- (Section Data strings_lbl)
+ (Section InfoProvData strings_lbl)
(CmmStaticsRaw strings_lbl strings)
-- Emit the list of IPE buffer entries
emitDecl $ CmmData
- (Section Data entries_lbl)
+ (Section InfoProvData entries_lbl)
(CmmStaticsRaw entries_lbl entries)
-- Emit the IPE buffer list node
emitDecl $ CmmData
- (Section Data ipe_buffer_lbl)
+ (Section InfoProvData ipe_buffer_lbl)
(CmmStaticsRaw ipe_buffer_lbl ipe_buffer_node)
-- | Emit the fields of an IpeBufferEntry struct for each entry in a given list.
=====================================
compiler/GHC/StgToCmm/Utils.hs
=====================================
@@ -10,6 +10,7 @@
module GHC.StgToCmm.Utils (
emitDataLits, emitRODataLits,
+ emitInfoProvDataLits,
emitDataCon,
emitRtsCall, emitRtsCallWithResult, emitRtsCallGen,
emitBarf,
@@ -262,6 +263,9 @@ callerRestoreGlobalReg platform reg
emitDataLits :: CLabel -> [CmmLit] -> FCode ()
emitDataLits lbl lits = emitDecl (mkDataLits (Section Data lbl) lbl lits)
+emitInfoProvDataLits :: CLabel -> [CmmLit] -> FCode ()
+emitInfoProvDataLits lbl lits = emitDecl (mkDataLits (Section InfoProvData lbl) lbl lits)
+
-- | Emit a read-only data block
emitRODataLits :: CLabel -> [CmmLit] -> FCode ()
emitRODataLits lbl lits = emitDecl (mkRODataLits lbl lits)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/973bc9aac04d39f0472d9c12570c9b5dd2e3c8f0
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/973bc9aac04d39f0472d9c12570c9b5dd2e3c8f0
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230703/6b83753f/attachment-0001.html>
More information about the ghc-commits
mailing list