[commit: ghc] master: compiler/cmm/PprC.hs: constify labels in .rodata (b68697e)
git at git.haskell.org
git at git.haskell.org
Mon Apr 24 16:54:01 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b68697e579d38ca29c2b84377dc2affa04659a28/ghc
>---------------------------------------------------------------
commit b68697e579d38ca29c2b84377dc2affa04659a28
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date: Mon Apr 24 09:41:35 2017 -0400
compiler/cmm/PprC.hs: constify labels in .rodata
Consider one-line module
module B (v) where v = "hello"
in -fvia-C mode it generates code like
static char gibberish_str[] = "hello";
It resides in data section (precious resource on ia64!).
The patch switches genrator to emit:
static const char gibberish_str[] = "hello";
Other types if symbols that gained 'const' qualifier are:
- info tables (from haskell and CMM)
- static reference tables (from haskell and CMM)
Cleanups along the way:
- fixed info tables defined in .cmm to reside in .rodata
- split out closure declaration into 'IC_' / 'EC_'
- added label declaration (based on label type) right before
each label definition (based on section type) so that C
compiler could check if declaration and definition matches
at definition site.
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
Test Plan: ran testsuite on unregisterised x86_64 compiler
Reviewers: simonmar, ezyang, austin, bgamari, erikd
Reviewed By: bgamari, erikd
Subscribers: rwbarton, thomie
GHC Trac Issues: #8996
Differential Revision: https://phabricator.haskell.org/D3481
>---------------------------------------------------------------
b68697e579d38ca29c2b84377dc2affa04659a28
compiler/cmm/CLabel.hs | 24 ++++++++++++++
compiler/cmm/Cmm.hs | 13 ++++++++
compiler/cmm/CmmInfo.hs | 2 +-
compiler/cmm/PprC.hs | 62 +++++++++++++++++++++++-------------
compiler/llvmGen/LlvmCodeGen/Data.hs | 12 -------
includes/Stg.h | 22 +++++++++----
includes/rts/storage/InfoTables.h | 2 +-
includes/stg/MiscClosures.h | 14 ++++----
8 files changed, 102 insertions(+), 49 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc b68697e579d38ca29c2b84377dc2affa04659a28
More information about the ghc-commits
mailing list