#2840: Top level string literals
---------------------------------------+------------------------------------
Reporter: simonpj | Owner:
Type: run-time performance bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.10.1
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
---------------------------------------+------------------------------------
At the moment GHC's internal language does not allow any top-level
definitions of unlifted type, and for the most part rightly so. But
consider this:
{{{
f :: Int -> String
f n = let a::Addr# = "foo"
in let g y = ...a...g...
in g n
}}}
Here we'd like to float the definitions out thus:
{{{
a::Addr# = "foo"
g y = ...a...g...
f n = g n
}}}
This is much better. Usually this happens, but not here, because we don't
allow a top-level binding for an `Addr#`. But really perhaps we should
allow an exception for ''literals'', which can safely be bound at top
level.
For literals other than strings, this doesn't make any difference, because
we inline them freely. But for literal strings we don't want to make lots
of copies of them; on the contrary we'd like to CSE identical strings. So
it'd help to be able to bind them at top level.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2840>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs