summaryrefslogtreecommitdiff
path: root/includes/stg
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2017-04-24 09:41:35 -0400
committerBen Gamari <ben@smart-cactus.org>2017-04-24 12:53:43 -0400
commitb68697e579d38ca29c2b84377dc2affa04659a28 (patch)
tree3d7a9f8c888baad175c81863d5519fb42e817770 /includes/stg
parentd5cb4d2b7fab89ea1c3fc74da2317f86e75816ea (diff)
downloadhaskell-b68697e579d38ca29c2b84377dc2affa04659a28.tar.gz
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@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
Diffstat (limited to 'includes/stg')
-rw-r--r--includes/stg/MiscClosures.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index 1181abcca4..725323b395 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -20,10 +20,10 @@
#pragma once
#if IN_STG_CODE
-# define RTS_RET_INFO(i) extern W_(i)[]
-# define RTS_FUN_INFO(i) extern W_(i)[]
-# define RTS_THUNK_INFO(i) extern W_(i)[]
-# define RTS_INFO(i) extern W_(i)[]
+# define RTS_RET_INFO(i) extern const W_(i)[]
+# define RTS_FUN_INFO(i) extern const W_(i)[]
+# define RTS_THUNK_INFO(i) extern const W_(i)[]
+# define RTS_INFO(i) extern const W_(i)[]
# define RTS_CLOSURE(i) extern W_(i)[]
# define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
#else
@@ -488,9 +488,9 @@ extern StgWord RTS_VAR(sched_mutex);
// Apply.cmm
// canned bitmap for each arg type
-extern StgWord stg_arg_bitmaps[];
-extern StgWord stg_ap_stack_entries[];
-extern StgWord stg_stack_save_entries[];
+extern const StgWord stg_arg_bitmaps[];
+extern const StgWord stg_ap_stack_entries[];
+extern const StgWord stg_stack_save_entries[];
// Storage.c
extern unsigned int RTS_VAR(g0);