X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=docs%2Fusers_guide%2Fglasgow_exts.xml;h=319104e108a4937e7f1520f7c43b35a61348c5e6;hb=d4f8ccee287199f4ac34321f0fad64316950fc25;hp=8a213683e4edfdd881f2acdb97b9ddfbebdac50b;hpb=6f5d77444aec9d84d9af59315c6c7885de33ed55;p=ghc-hetmet.git diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 8a21368..319104e 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -4236,7 +4236,46 @@ Hello + + +Using Template Haskell with Profiling +profilingwith Template Haskell +Template Haskell relies on GHC's built-in bytecode compiler and +interpreter to run the splice expressions. The bytecode interpreter +runs the compiled expression on top of the same runtime on which GHC +itself is running; this means that the compiled code referred to by +the interpreted expression must be compatible with this runtime, and +in particular this means that object code that is compiled for +profiling cannot be loaded and used by a splice +expression, because profiled object code is only compatible with the +profiling version of the runtime. + +This causes difficulties if you have a multi-module program +containing Template Haskell code and you need to compile it for +profiling, because GHC cannot load the profiled object code and use it +when executing the splices. Fortunately GHC provides a workaround. +The basic idea is to compile the program twice: + + + + Compile the program or library first the normal way, without + . + + + Then compile it again with , and + additionally use + to name the object files differentliy (you can choose any suffix + that isn't the normal object suffix here). GHC will automatically + load the object files built in the first step when executing splice + expressions. If you omit the flag when + building with and Template Haskell is used, + GHC will emit an error message. + + + +