[Git][ghc/ghc][wip/ghc-fat-interface] 2 commits: fix tests
Matthew Pickering (@mpickering)
gitlab at gitlab.haskell.org
Wed Aug 10 16:05:23 UTC 2022
Matthew Pickering pushed to branch wip/ghc-fat-interface at Glasgow Haskell Compiler / GHC
Commits:
0a64c894 by Matthew Pickering at 2022-08-10T16:08:44+01:00
fix tests
- - - - -
12313f9e by Matthew Pickering at 2022-08-10T17:04:04+01:00
tweaks
- - - - -
9 changed files:
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Session.hs
- docs/users_guide/phases.rst
- testsuite/tests/driver/fat-iface/Makefile
- testsuite/tests/driver/fat-iface/all.T
- testsuite/tests/ghci/T16670/Makefile
- testsuite/tests/ghci/scripts/ghci024.stdout
- testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
Changes:
=====================================
compiler/GHC/Driver/Main.hs
=====================================
@@ -857,12 +857,12 @@ hscRecompStatus
let just_bc = justBytecode <$> bc_linkable
just_o = justObjects <$> obj_linkable
- maybe_both_os = case (bc_linkable, obj_linkable) of
+ _maybe_both_os = case (bc_linkable, obj_linkable) of
(UpToDateItem bc, UpToDateItem o) -> UpToDateItem (bytecodeAndObjects bc o)
-- If missing object code, just say we need to recompile because of object code.
(_, OutOfDateItem reason _) -> OutOfDateItem reason Nothing
-- If just missing byte code, just use the object code
- -- so you should use -fprefer-bytecode with -fwrite-fat-interface or you'll
+ -- so you should use -fprefer-byte-code with -fwrite-fat-interface or you'll
-- end up using bytecode on recompilation
(_, UpToDateItem {} ) -> just_o
@@ -871,7 +871,7 @@ hscRecompStatus
-- If missing object code, just say we need to recompile because of object code.
(_, OutOfDateItem reason _) -> OutOfDateItem reason Nothing
-- If just missing byte code, just use the object code
- -- so you should use -fprefer-bytecode with -fwrite-fat-interface or you'll
+ -- so you should use -fprefer-byte-code with -fwrite-fat-interface or you'll
-- end up using bytecode on recompilation
(OutOfDateItem reason _, _ ) -> OutOfDateItem reason Nothing
@@ -891,9 +891,9 @@ hscRecompStatus
if gopt Opt_ByteCodeAndObjectCode lcl_dflags
-- We say we are going to write both, so recompile unless we have both
then definitely_both_os
- -- Well, we need the object file so definitely need that but load bytecode
- -- as well if we have it, a module later might "prefer" it.
- else maybe_both_os
+ -- Only load the object file unless we are saying we need to produce both.
+ -- Unless we do this then you can end up using byte-code for a module you specify -fobject-code for.
+ else just_o
| otherwise -> pprPanic "hscRecompStatus" (text $ show $ backend lcl_dflags)
case recomp_linkable_result of
UpToDateItem linkable -> do
@@ -946,7 +946,6 @@ checkByteCode iface mod_sum mb_old_linkable =
-> return $ (UpToDateItem old_linkable)
_ -> loadByteCode iface mod_sum
--- TODO: MP TODO Fat Iface is just in normal IFace
loadByteCode :: ModIface -> ModSummary -> IO (MaybeValidated Linkable)
loadByteCode iface mod_sum = do
let
=====================================
compiler/GHC/Driver/Make.hs
=====================================
@@ -1742,7 +1742,7 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
, (ml_obj_file ms_location, ml_dyn_obj_file ms_location))
else (,) <$> (new_temp_file (hiSuf_ dflags) (dynHiSuf_ dflags))
<*> (new_temp_file (objectSuf_ dflags) (dynObjectSuf_ dflags))
- -- Setting --interactive sets -fprefer-bytecode so we use interpreterBackend
+ -- Setting --interactive sets -fprefer-byte-code so we use interpreterBackend
-- when using -fno-code with --interactive
let new_backend = if gopt Opt_UseBytecodeRatherThanObjects dflags
then interpreterBackend
@@ -1758,7 +1758,7 @@ enableCodeGenWhen logger tmpfs staticLife dynLife unit_env mod_graph =
-- Recursive call to catch the other cases
enable_code_gen (ModuleNode deps ms')
- -- If -fprefer-bytecode then satisfy dependency by enabling bytecode (if normal object not enough)
+ -- If -fprefer-byte-code then satisfy dependency by enabling bytecode (if normal object not enough)
-- we only get to this case if the default backend is already generating object files, but we need dynamic
-- objects
| bytecode_and_enable ms -> do
=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -3486,8 +3486,8 @@ fFlagsDeps = [
flagSpec "keep-cafs" Opt_KeepCAFs,
flagSpec "link-rts" Opt_LinkRts,
flagSpec "byte-code-and-object-code" Opt_ByteCodeAndObjectCode,
- flagSpec "prefer-bytecode" Opt_UseBytecodeRatherThanObjects,
- flagSpec' "compact-unwind" Opt_CompactUnwind
+ flagSpec "prefer-byte-code" Opt_UseBytecodeRatherThanObjects,
+ flagSpec' "compact-unwind" Opt_CompactUnwind
(\turn_on -> updM (\dflags -> do
unless (platformOS (targetPlatform dflags) == OSDarwin && turn_on)
(addWarn "-compact-unwind is only implemented by the darwin platform. Ignoring.")
=====================================
docs/users_guide/phases.rst
=====================================
@@ -670,7 +670,7 @@ Options affecting code generation
:category: codegen
Generate object code and byte code. This is useful with the flags
- :ghc-flag:`-fprefer-bytecode` and :ghc-flag:`-fwrite-fat-interface`.
+ :ghc-flag:`-fprefer-byte-code` and :ghc-flag:`-fwrite-fat-interface`.
:ghc-flag:`-fbyte-code` and :ghc-flag:`-fobject-code` disable this flag as
they specify that GHC should *only* write object code or byte-code respectively.
@@ -771,7 +771,7 @@ Options affecting code generation
file sizes at the expense of debuggability.
-.. ghc-flag:: -fprefer-bytecode
+.. ghc-flag:: -fprefer-byte-code
:shortdesc: Use bytecode if it is available to run TH splices
:type: dynamic
:category: codegen
=====================================
testsuite/tests/driver/fat-iface/Makefile
=====================================
@@ -32,10 +32,10 @@ fat006: clean
test ! -f Fat.o
fat008: clean
- "$(TEST_HC)" $(TEST_HC_OPTS) FatTH.hs -fwrite-fat-interface -fprefer-bytecode
+ "$(TEST_HC)" $(TEST_HC_OPTS) FatTH.hs -fwrite-fat-interface -fprefer-byte-code
echo >> "FatTH.hs"
# Observe that FatQuote.hs is not recompiled and the fat interface is used.
- "$(TEST_HC)" $(TEST_HC_OPTS) FatTH.hs -fwrite-fat-interface -fprefer-bytecode
+ "$(TEST_HC)" $(TEST_HC_OPTS) FatTH.hs -fwrite-fat-interface -fprefer-byte-code
# Same as fat008 but with ghci, broken due to recompilation checking wibbles
@@ -45,9 +45,9 @@ fat009: clean
echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) FatTH.hs -fwrite-fat-interface
fat010: clean
- "$(TEST_HC)" $(TEST_HC_OPTS) THC.hs -fhide-source-paths -fwrite-fat-interface -fprefer-bytecode
+ "$(TEST_HC)" $(TEST_HC_OPTS) THC.hs -fhide-source-paths -fwrite-fat-interface -fprefer-byte-code
echo >> "THB.hs"
- "$(TEST_HC)" $(TEST_HC_OPTS) THC.hs -fhide-source-paths -fwrite-fat-interface -fprefer-bytecode
+ "$(TEST_HC)" $(TEST_HC_OPTS) THC.hs -fhide-source-paths -fwrite-fat-interface -fprefer-byte-code
fat014: clean
echo ":q" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) -v0 -fno-code < fat014.script
=====================================
testsuite/tests/driver/fat-iface/all.T
=====================================
@@ -2,15 +2,15 @@ test('fat001', [extra_files(['Fat.hs'])], makefile_test, ['fat001'])
test('fat005', [extra_files(['Fat.hs']), filter_stdout_lines(r'= Proto-BCOs')], makefile_test, ['fat005'])
test('fat007', [extra_files(['Fat.hs'])], makefile_test, ['fat007'])
test('fat006', [extra_files(['Fat.hs'])], makefile_test, ['fat006'])
-test('fat008', [extra_files(['FatTH.hs', 'FatQuote.hs']), copy_files], makefile_test, ['fat008'])
+test('fat008', [unless(ghc_dynamic(), skip), extra_files(['FatTH.hs', 'FatQuote.hs']), copy_files], makefile_test, ['fat008'])
test('fat009', [extra_files(['FatTH.hs', 'FatQuote.hs']), copy_files], makefile_test, ['fat009'])
test('fat010', [extra_files(['THA.hs', 'THB.hs', 'THC.hs']), copy_files], makefile_test, ['fat010'])
# Check linking works when using -fbyte-code-and-object-code
-test('fat011', [extra_files(['FatMain.hs', 'FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatMain', '-fbyte-code-and-object-code -fprefer-bytecode'])
+test('fat011', [extra_files(['FatMain.hs', 'FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatMain', '-fbyte-code-and-object-code -fprefer-byte-code'])
# Check that we use interpreter rather than enable dynamic-too if needed for TH
-test('fat012', [extra_files(['FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatTH', '-fprefer-bytecode'])
-# Check that no objects are generated if using -fno-code and -fprefer-bytecode
-test('fat013', [extra_files(['FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatTH', '-fno-code -fprefer-bytecode'])
+test('fat012', [unless(ghc_dynamic(), skip), extra_files(['FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatTH', '-fprefer-byte-code'])
+# Check that no objects are generated if using -fno-code and -fprefer-byte-code
+test('fat013', [extra_files(['FatTH.hs', 'FatQuote.hs'])], multimod_compile, ['FatTH', '-fno-code -fprefer-byte-code'])
# When using interpreter should not produce objects
test('fat014', [extra_files(['FatTH.hs', 'FatQuote.hs'])], makefile_test, ['fat014'])
=====================================
testsuite/tests/ghci/T16670/Makefile
=====================================
@@ -19,6 +19,6 @@ T16670_th:
$(MAKE) -s --no-print-directory clean
mkdir my-odir
echo ":load T16670_th.hs" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) \
- -v0 -fno-code -fno-prefer-bytecode -fwrite-interface -odir my-odir
+ -v0 -fno-code -fno-prefer-byte-code -fwrite-interface -odir my-odir
find . -name T16670_th.o
test -f my-odir/T16670_th.o
=====================================
testsuite/tests/ghci/scripts/ghci024.stdout
=====================================
@@ -13,7 +13,7 @@ other dynamic, non-language, flag settings:
-fimplicit-import-qualified
-fkeep-going
-fshow-warning-groups
- -fprefer-bytecode
+ -fprefer-byte-code
warning settings:
-Wsemigroup
-Wstar-is-type
=====================================
testsuite/tests/ghci/scripts/ghci024.stdout-mingw32
=====================================
@@ -12,6 +12,7 @@ other dynamic, non-language, flag settings:
-fimplicit-import-qualified
-fkeep-going
-fshow-warning-groups
+ -fprefer-byte-code
warning settings:
-Wsemigroup
-Wstar-is-type
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2680ed9cda3637400a45984e19c515f5e1b0ede6...12313f9ebccfff32c5d4f276ec9d9a67a84e00a8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/2680ed9cda3637400a45984e19c515f5e1b0ede6...12313f9ebccfff32c5d4f276ec9d9a67a84e00a8
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220810/3ffe6d59/attachment-0001.html>
More information about the ghc-commits
mailing list