diff options
author | Simon Marlow <marlowsd@gmail.com> | 2015-11-07 09:39:05 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2015-11-07 09:39:05 +0000 |
commit | ce1f1607ed7f8fedd2f63c8610cafefd59baaf32 (patch) | |
tree | 718641160c3d93a2ca974deec1e228cb09e1a97e /testsuite/tests/annotations/should_compile | |
parent | a58eeb7febd67c93dab82de7049ef1dcdecd34e9 (diff) | |
download | haskell-ce1f1607ed7f8fedd2f63c8610cafefd59baaf32.tar.gz |
Make GHCi & TH work when the compiler is built with -prof
Summary:
Amazingly, there were zero changes to the byte code generator and very
few changes to the interpreter - mainly because we've used good
abstractions that hide the differences between profiling and
non-profiling. So that bit was pleasantly straightforward, but there
were a pile of other wibbles to get the whole test suite through.
Note that a compiler built with -prof is now like one built with
-dynamic, in that to use TH you have to build the code the same way.
For dynamic, we automatically enable -dynamic-too when TH is required,
but we don't have anything equivalent for profiling, so you have to
explicitly use -prof when building code that uses TH with a profiled
compiler. For this reason Cabal won't work with TH. We don't expect
to ship a profiled compiler, so I think that's OK.
Test Plan: validate with GhcProfiled=YES in validate.mk
Reviewers: goldfire, bgamari, rwbarton, austin, hvr, erikd, ezyang
Reviewed By: ezyang
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1407
GHC Trac Issues: #4837, #545
Diffstat (limited to 'testsuite/tests/annotations/should_compile')
4 files changed, 7 insertions, 10 deletions
diff --git a/testsuite/tests/annotations/should_compile/all.T b/testsuite/tests/annotations/should_compile/all.T index 1c6690b2b8..57efc2634c 100644 --- a/testsuite/tests/annotations/should_compile/all.T +++ b/testsuite/tests/annotations/should_compile/all.T @@ -1,6 +1,3 @@ - -setTestOpts(when(compiler_profiled(), skip)) - # Annotations, like Template Haskell, require runtime evaluation. In # order for this to work with profiling, we would have to build the # program twice and use -osuf p_o (see the TH_splitE5_prof test). For diff --git a/testsuite/tests/annotations/should_compile/th/Makefile b/testsuite/tests/annotations/should_compile/th/Makefile index 4159eeeda1..b10fc725db 100644 --- a/testsuite/tests/annotations/should_compile/th/Makefile +++ b/testsuite/tests/annotations/should_compile/th/Makefile @@ -5,7 +5,7 @@ include $(TOP)/mk/test.mk annth_make: $(MAKE) clean_annth_make mkdir build_make - '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make \ + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -v0 --make \ -odir build_make -hidir build_make -o build_make/annth annth.hs clean_annth_make: @@ -14,16 +14,16 @@ clean_annth_make: annth_compunits: $(MAKE) clean_annth_compunits mkdir build_compunits - '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -dynamic-too \ + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -v0 \ -odir build_compunits -hidir build_compunits \ -c AnnHelper.hs - '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -dynamic-too \ + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -v0 \ -odir build_compunits -hidir build_compunits \ -c TestModule.hs - '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -dynamic-too \ + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -v0 \ -odir build_compunits -hidir build_compunits \ -c TestModuleTH.hs - '$(TEST_HC)' $(TEST_HC_OPTS) -v0 -ibuild_compunits \ + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -v0 -ibuild_compunits \ -odir build_compunits -hidir build_compunits \ -c annth.hs diff --git a/testsuite/tests/annotations/should_compile/th/all.T b/testsuite/tests/annotations/should_compile/th/all.T index b44a0d594f..a1681cfe0b 100644 --- a/testsuite/tests/annotations/should_compile/th/all.T +++ b/testsuite/tests/annotations/should_compile/th/all.T @@ -1,5 +1,3 @@ -setTestOpts(when(compiler_profiled(), skip)) - # Annotations and Template Haskell, require runtime evaluation. In # order for this to work with profiling, we would have to build the # program twice and use -osuf p_o (see the TH_splitE5_prof test). For diff --git a/testsuite/tests/annotations/should_compile/th/annth.hs b/testsuite/tests/annotations/should_compile/th/annth.hs index de5d4d32a8..8cc3a242ff 100644 --- a/testsuite/tests/annotations/should_compile/th/annth.hs +++ b/testsuite/tests/annotations/should_compile/th/annth.hs @@ -6,6 +6,7 @@ import Language.Haskell.TH.Syntax import AnnHelper import TestModule import TestModuleTH +import System.IO main = do $(do @@ -24,3 +25,4 @@ main = do anns <- reifyAnnotations (AnnLookupName 'TestTypeTH) runIO $ print (anns :: [String]) [| return () |] ) + hFlush stdout |