[GHC] #8996: mark more things as const in C codegen
GHC
ghc-devs at haskell.org
Wed Apr 16 09:59:31 UTC 2014
#8996: mark more things as const in C codegen
---------------------------------------+-----------------------------------
Reporter: slyfox | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (CodeGen) | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
---------------------------------------+-----------------------------------
Changes (by slyfox):
* difficulty: Easy (less than 1 hour) => Unknown
Comment:
This patch attempts to mark everything ghc knows as RODATA,
what raises a couple of questions:
Patch can be tested as './configure --enable-unregisterised' in amd64.
Example of build failure:
{{{
HC [stage 1] libraries/ghc-prim/dist-install/build/GHC/Types.o
In file included from /tmp/ghc26762_0/ghc26762_1.hc:3:0:
/tmp/ghc26762_0/ghc26762_1.hc:295:6:
error: conflicting types for 'ghczmprim_GHCziTypes_False_closure'
CEI_(ghczmprim_GHCziTypes_False_closure);
^
/home/slyfox/dev/git/ghc/includes/Stg.h:213:52:
note: in definition of macro 'CEI_'
#define CEI_(X) extern const StgWordArray (X)
GNU_ATTRIBUTE(aligned (8))
^
/tmp/ghc26762_0/ghc26762_1.hc:27:9:
note: previous definition of 'ghczmprim_GHCziTypes_False_closure' was
here
StgWord ghczmprim_GHCziTypes_False_closure[] = {
^
}}}
GHC thinks that extern points to rodata, but actually place or to .data
(rwdata).
I think it's due to '''rts/StgMiscClosures.cmm''':
{{{
/* put these in the *data* section, since the garbage collector relies
* on the fact that static closures live in the data section.
*/
#if !(defined(COMPILING_WINDOWS_DLL))
section "data" {
stg_CHARLIKE_closure:
CHARLIKE_HDR(0)
CHARLIKE_HDR(1)
CHARLIKE_HDR(2)
CHARLIKE_HDR(3)
...
}}}
Is it an absolute need to use mutable data section for it?
Could GC be tuned to scan for certain rodata block?
Or if it's not an option,
fix ghc to know that those closure externs
are really in "data" section.
Thanks!
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8996#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list