Traditionally, profiling with optimizations on has been a problem in
GHC's history...   :-]    Here's a new one:

-- Foo.hs -------------------------------------------------------------
module Foo where
import Foreign
bar :: () -> IO ()
bar x = _scc_ "mycc2" (makeStablePtr x >>= deRefStablePtr)
-- Main.hs ------------------------------------------------------------
import Foo
main :: IO ()
main = _scc_ "mycc1" (bar ())
-----------------------------------------------------------------------

ghc-3.01 -O -prof -fglasgow-exts -c Foo.hs -o Foo.o
ghc-3.01: module version changed to 1; reason: no old .hi file
ghc-3.01 -O -prof -fglasgow-exts -c Main.hs -o Main.o
ghc-3.01: module version changed to 1; reason: no old .hi file
ghc-3.01 -o blah -O -prof -fglasgow-exts  Foo.o Main.o     
Main.o(.text+0xe9): undefined reference to `CC_FooZdmycc2ZdDUPD_struct'
Main.o(.text+0xef): undefined reference to `CC_FooZdmycc2ZdDUPD_struct'

Some remarks:

   * Sigbjorn's profiling patch from Feb 26th is already applied to our GHCs.

   * The Foreign stuff is not important, what seems to matter is the
     fact that makeStablePtr/deRefStablePtr are not inlined.

   * Everything works fine without -O.

   * Removing the _scc_s and using -auto-all doesn't work, either.

-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne

Reply via email to