[commit: ghc] master: Merge sections in profiling .a to .p_o and use it whenever it exists (de56a67)
git at git.haskell.org
git at git.haskell.org
Mon Dec 17 04:33:15 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/de56a67acf39098dd94693c6e265dfaade867d2f/ghc
>---------------------------------------------------------------
commit de56a67acf39098dd94693c6e265dfaade867d2f
Author: Zejun Wu <watashi at fb.com>
Date: Mon Dec 17 00:27:18 2018 +0000
Merge sections in profiling .a to .p_o and use it whenever it exists
Summary:
We do this for vanilla way already.
Let's also merge sections for profiling way and use it instead of the .a
library when it exists.
Test Plan:
```
$ inplace/bin/ghc-stage2 --interactive -prof -fexternal-interpreter
GHCi, version 8.7.20180921: http://www.haskell.org/ghc/ :? for help
Prelude> pid <- System.Posix.Process.getProcessID
Prelude> maps <- readFile $ "/proc/" ++ show pid ++ "/maps"
Prelude> pid
3807346
Prelude> putStrLn $ unlines $ take 20 $ lines maps
00400000-02103000 r-xp 00000000 00:1a 199277344
/data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
02104000-02106000 r--p 01d03000 00:1a 199277344
/data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
02106000-02417000 rw-p 01d05000 00:1a 199277344
/data/users/watashi/ghc/inplace/lib/bin/ghc-iserv-prof
02417000-0280a000 rw-p 00000000 00:00 0
[heap]
40098000-400b0000 rwxp 000d2000 00:1a 199276023
/data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
400b7000-400d8000 rwxp 00000000 00:00 0
401d1000-401d2000 rwxp 000e9000 00:1a 199276023
/data/users/watashi/ghc/libraries/bytestring/dist-install/build/HSbytestring-0.10.8.2.p_o
40415000-40419000 rwxp 0000b000 00:1a 199275165
/data/users/watashi/ghc/libraries/deepseq/dist-install/build/HSdeepseq-1.4.4.0.p_o
404f8000-40526000 rwxp 000af000 00:1a 199274234
/data/users/watashi/ghc/libraries/ghc-prim/dist-install/build/HSghc-prim-0.5.3.p_o
```
Reviewers: simonmar, bgamari, austin, hvr
Reviewed By: simonmar
Subscribers: rwbarton, carter
Differential Revision: https://phabricator.haskell.org/D5169
>---------------------------------------------------------------
de56a67acf39098dd94693c6e265dfaade867d2f
compiler/ghci/Linker.hs | 11 ++++-------
rules/build-package-way.mk | 4 ++--
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/compiler/ghci/Linker.hs b/compiler/ghci/Linker.hs
index 32bf270..3f4264c 100644
--- a/compiler/ghci/Linker.hs
+++ b/compiler/ghci/Linker.hs
@@ -1469,13 +1469,8 @@ locateLib hsc_env is_hs lib_dirs gcc_dirs lib
findDynObject `orElse`
assumeDll
- | loading_profiled_hs_libs -- only a libHSfoo_p.a archive will do.
- = findArchive `orElse`
- assumeDll
-
| otherwise
- -- HSfoo.o is the best, but only works for the normal way
- -- libHSfoo.a is the backup option.
+ -- use HSfoo.{o,p_o} if it exists, otherwise fallback to libHSfoo{,_p}.a
= findObject `orElse`
findArchive `orElse`
assumeDll
@@ -1486,7 +1481,9 @@ locateLib hsc_env is_hs lib_dirs gcc_dirs lib
gcc = False
user = True
- obj_file = lib <.> "o"
+ obj_file
+ | is_hs && loading_profiled_hs_libs = lib <.> "p_o"
+ | otherwise = lib <.> "o"
dyn_obj_file = lib <.> "dyn_o"
arch_files = [ "lib" ++ lib ++ lib_tag <.> "a"
, lib <.> "a" -- native code has no lib_tag
diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
index 8d14b7a..0a762d3 100644
--- a/rules/build-package-way.mk
+++ b/rules/build-package-way.mk
@@ -112,7 +112,7 @@ endif
endif
# Build the GHCi library
-ifeq "$3" "v"
+ifneq "$(filter $3, v p)" ""
$1_$2_GHCI_LIB = $1/$2/build/HS$$($1_$2_COMPONENT_ID).$$($3_osuf)
ifeq "$$($1_$2_BUILD_GHCI_LIB)" "YES"
# Don't put bootstrapping packages in the bindist
@@ -132,7 +132,7 @@ ifneq "$4" "0"
$(call all-target,$1_$2,$$($1_$2_GHCI_LIB))
endif
endif # "$$($1_$2_BUILD_GHCI_LIB)" "YES"
-endif # "$3" "v"
+endif # "$(filter $3, v p)" ""
$(call profEnd, build-package-way($1,$2,$3))
endef # build-package-way
More information about the ghc-commits
mailing list