Use binary search to speedup checkUnload

We are iterating through all object code for each heap objects when
checking whether object code can be unloaded. For large projects in
GHCi, this can be very expensive due to the large number of object code
that needs to be loaded/unloaded. To speed it up, this arrangess all
mapped sections of unloaded object code in a sorted array and use binary
search to check if an address location fall on them.

(cherry picked from commit f81f3964)
18 jobs for !1153 with wip/backport-MR706 in 486 minutes and 55 seconds (queued for 6 seconds)
detached
Status Job ID Name Coverage
  Lint
passed #100636
lint
ghc-linters

00:00:13

passed #100637
lint
lint-submods-mr

00:00:13

 
  Build
failed #100640
x86_64-linux allowed to fail
release-x86_64-linux-deb9-dwarf

00:00:52

passed #100638
x86_64-linux
validate-x86_64-linux-deb8-hadrian

02:58:57

passed #100639
x86_64-linux
validate-x86_64-linux-deb9-debug

01:19:57

 
  Full Build
failed #100642
aarch64-linux allowed to fail
validate-aarch64-linux-deb9

01:00:23

passed #100643
x86_64-linux
validate-i386-linux-deb9

01:43:13

passed #100641
x86_64-darwin
validate-x86_64-darwin

00:57:45

passed #100644
x86_64-linux
validate-x86_64-linux-deb9

01:45:54

failed #100646
x86_64-linux allowed to fail
validate-x86_64-linux-deb9-integer-simple

00:38:06

failed #100645
x86_64-linux allowed to fail
validate-x86_64-linux-deb9-llvm

03:05:54

passed #100647
x86_64-linux
validate-x86_64-linux-deb9-unreg

03:16:30

passed #100648
x86_64-linux
validate-x86_64-linux-fedora27

01:43:02

failed #100650
x86_64-windows allowed to fail
validate-x86_64-windows

failed #100649
x86_64-windows allowed to fail
validate-x86_64-windows-hadrian

 
  Cleanup
passed #100652
x86_64-darwin
cleanup-darwin

00:00:06

passed #100651
x86_64-windows
cleanup-windows

00:00:53

 
  Hackage
manual #100653
x86_64-linux allowed to fail manual
hackage
 
Name Stage Failure
failed
validate-aarch64-linux-deb9 Full Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows-hadrian Full Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
release-x86_64-linux-deb9-dwarf Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
WARNING: ghc-*.tar.xz: no matching files
WARNING: junit.xml: no matching files
ERROR: No files to upload
Uploading artifacts...
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
failed
validate-x86_64-windows Full Build There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job log
failed
validate-x86_64-linux-deb9-llvm Full Build
make[1]: Leaving directory '/builds/ghc/ghc/testsuite/tests'
make: *** [test] Error 2
Makefile:224: recipe for target 'test' failed
Running after script...
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
junit.xml: found 1 matching files
Uploading artifacts to coordinator... ok
id=100645 responseStatus=201 Created token=_SNvESKo
ERROR: Job failed: exit code 1
failed
validate-x86_64-linux-deb9-integer-simple Full Build
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Makefile:123: recipe for target 'all' failed
Running after script...
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
WARNING: junit.xml: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1