| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
There's a race condition like this:
# A foreign pointer gets promoted to the last generation
# It has its finalizer called manually
# We start shutting down the runtime in `hs_exit_` from the main
thread
# A minor GC starts running (`scheduleDoGC`) on one of the threads
# The minor GC notices that we're in `SCHED_INTERRUPTING` state and
advances to `SCHED_SHUTTING_DOWN`
# The main thread tries to do major GC (with `scheduleDoGC`), but it
exits early because we're in `SCHED_SHUTTING_DOWN` state
# We end up with a `DEAD_WEAK` left on the list of weak pointers of
the last generation, because it relied on major GC removing it from
that list
This change:
* Ignores DEAD_WEAK finalizers when shutting down
* Makes the major GC on shutdown more likely
* Fixes a bogus assert
Test Plan:
before this diff https://ghc.haskell.org/trac/ghc/ticket/7170#comment:5
reproduced and after it doesn't
Reviewers: ezyang, austin, simonmar
Reviewed By: simonmar
Subscribers: bgamari, thomie
Differential Revision: https://phabricator.haskell.org/D921
GHC Trac Issues: #7170
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Depends on D767
Setting this flag prevents RTS from giving RTS suggestions like "Use
`+RTS -Ksize -RTS' to increase it."
According to the comment @rwbarton made in #9579, sometimes "+RTS"
suggestions don't make sense (e.g. when the program is precompiled and
installed through package managers), we can encourage people to
distribute binaries with either "-no-rtsopts-suggestions" or "-rtsopts".
Reviewed By: erikd, austin
Differential Revision: https://phabricator.haskell.org/D809
GHC Trac Issues: #9579
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch provides user with a better hint when most RTS options
are not available (not compiled with `-rtsopts`).
A new field "rtsOptsEnabled" is added into RtsFlags.MiscFlags to
tell the availablity of RTS options.
Some concerns:
* Unlike other flag fields in "libraries/base/GHC/RTS/Flags.hsc",
"RtsOptsEnabled" is defined in "includes/RtsAPI.h" and lacks
constant macros. Therefore In "GHC.RTS", "RtsOptsEnabled" simply
derives Enum instance and reads as of type "CInt".
* There are other ways to change RTS options (e.g. `-with-rtsopts`),
but it might be too verbose to mention.
Test Plan: validate
Reviewers: austin, hvr, thomie, simonmar
Reviewed By: thomie
Subscribers: thomie, rwbarton
Differential Revision: https://phabricator.haskell.org/D767
GHC Trac Issues: #9579
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The patch is a last major piece to make unregisterised GHC build
under GCC's link-time optimizer.
Before the patch we imported everything external as functions.
Now we distinct between global variables and functions.
The difference is crucial on ia64 and a complement to fixes:
> d82f592522eb8e063276a8a8c87ab93e18353c6b
> CMM: add a mechanism to import C .data labels
> e18525fae273f4c1ad8d6cbe1dea4fc074cac721
> pprC: declare extern cmm primitives as functions, not data
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D797
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Hooks rely on static linking semantics, and are broken by -Bsymbolic
which we need when using dynamic linking.
Test Plan: Built it
Reviewers: austin, hvr, tibbe
Differential Revision: https://phabricator.haskell.org/D8
|
|
|
|
|
|
| |
Reviewed By: thomie
Differential Revision: https://phabricator.haskell.org/D779
|
|
|
|
|
|
| |
This fixes more testsuite failures on Windows.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There were some flags of the RTS that when given an argument (which they
don't have) were not firing an error.
e.g -Targument when the flag -T has no argument.
Now this is an error and affects the following flags:
-B -w -T -Z -P -Pa -c -t
Signed-off-by: Carlos Tomé <carlostome1990@gmail.com>
Reviewed By: austin, thomie, hvr
Differential Revision: https://phabricator.haskell.org/D748
GHC Trac Issues: #9839
|
|
|
|
|
|
|
|
| |
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D749
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In #9261, there was some confusion about the meaning of the taskCount
stats variable in the rts.
It turns out that taskCount is not decremented when a worker task is
stopped (i.e. from workerTaskStop), but only when freeMyTask is called,
which frees the task bound to the current thread. So taskCount is the
current number of bound tasks + the total number of worker tasks.
This makes the calculation of the current number of bound tasks in
rts/Stats.c correct _as is_.
[skip ci]
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D746
|
|
|
|
|
|
|
|
|
| |
The GranSim code was removed in dd56e9ab and 297b05a9 in 2009, and perhaps
other commits I couldn't find.
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D737
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Whenever the RTS has been inactive for idleGCDelayTime, the idle timer
fires and calls wakeUpRts(), which in turn calls ioManagerWakeup(),
which in turn writes a byte (or a few) to a file descriptor (stored in
the io_manager_wakeup_fd variable) registered by the TimerManager and
on which the TimerManager will wait. (Note that the write will only
occur if the file descriptor is non-negative.) When the RTS shuts
down, it shuts down the TimerManager, and in this process the file
descriptor stored in io_manager_wakeup_fd is closed. In the error
case, the idle timer fires after the close of the file occurs, and
then the write() call in ioManagerWakeup() fails and the
aforementioned error message gets printed.
This patch solves the problem by (1) having the TimerManager (via
Control) write -1 to io_manager_wakeup_fd just before closing the file
descriptor written in io_manager_wakeup_fd, and (2) having
ioManagerWakeup() ignore an error returned by write() in the case that
the write returned -1 and the io_manager_wakeup_fd is -1.
Reviewers: austin, simonmar, hvr, thomie
Reviewed By: thomie
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D722
GHC Trac Issues: #9722
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Something in Excn.h's include chain is loading _mingw.h which is defining a macro that
PosixSource.h is going to define.
_mingw.h's version properly checks if it has already been defined and skips it, so fixing the warning can be done
by just including Excn.h later (moved it to before last include).
Test Plan: ./validate
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D698
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
x86 and x64
Summary:
On Windows, the default action for things like division by zero and
segfaults is to pop up a Dr. Watson error reporting dialog if the exception
is unhandled by the user code.
This is a pain when we are SSHed into a Windows machine, or when we
want to debug a problem with gdb (gdb will get a first and second chance to
handle the exception, but if it doesn't the pop-up will show).
veh_excn provides two macros, `BEGIN_CATCH` and `END_CATCH`, which
will catch such exceptions in the entire process and die by
printing a message and calling `stg_exit(1)`.
Previously this code was handled using SEH (Structured Exception Handlers)
however each compiler and platform have different ways of dealing with SEH.
`MSVC` compilers have the keywords `__try`, `__catch` and `__except` to have the
compiler generate the appropriate SEH handler code for you.
`MinGW` compilers have no such keywords and require you to manually set the
SEH Handlers, however because SEH is implemented differently in x86 and x64
the methods to use them in GCC differs.
`x86`: SEH is based on the stack, the SEH handlers are available at `FS[0]`.
On startup one would only need to add a new handler there. This has
a number of issues such as hard to share handlers and it can be exploited.
`x64`: In order to fix the issues with the way SEH worked in x86, on x64 SEH handlers
are statically compiled and added to the .pdata section by the compiler.
Instead of being thread global they can now be Image global since you have to
specify the `RVA` of the region of code that the handlers govern.
You can on x64 Dynamically allocate SEH handlers, but it seems that (based on
experimentation and it's very under-documented) that the dynamic calls cannot override
static SEH handlers in the .pdata section.
Because of this and because GHC no longer needs to support < windows XP, the better
alternative for handling errors would be using the in XP introduced VEH.
The bonus is because VEH (Vectored Exception Handler) are a runtime construct the API
is the same for both x86 and x64 (note that the Context object does contain CPU specific
structures) and the calls are the same cross compilers. Which means this file can be
simplified quite a bit.
Using VEH also means we don't have to worry about the dynamic code generated by GHCi.
Test Plan:
Prior to this diff the tests for `derefnull` and `divbyzero` seem to have been disabled for windows.
To reproduce the issue on x64:
1) open ghci
2) import GHC.Base
3) run: 1 `divInt` 0
which should lead to ghci crashing an a watson error box displaying.
After applying the patch, run:
make TEST="derefnull divbyzero"
on both x64 and x86 builds of ghc to verify fix.
Reviewers: simonmar, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D691
GHC Trac Issues: #6079
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: simonmar, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D679
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Currently the linker tries to see if it understands/knows every section in the PE file before it continues. If it encounters a section it doesn't know about it errors out. Every time there's a change in MinGW compiler that adds a new section to the PE file this will break the ghc linker. The new sections don't need to be understood by `ghc` to continue so instead of erroring out the section is just ignored. When running with `-debug` the sections that are ignored will be printed.
Test Plan:
See the file `ghcilinkerbug.zip` in #9907.
1) unzip file content.
2) open examplecpp.cabal and change base <4.8 to <4.9.
3) execute cabal file with cabal repl.
Applying the patch makes `cabal repl` in step 3) work.
Note that the file will fail on a `___mingw_vprintf` not being found. This is because of the `cc-options` specifying `-std=c++0x`, which will also require `libmingwex.a` to be linked in but wasn't specified in the cabal file. To fix this, remove the `cc-options` which defaults to c99.
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D671
GHC Trac Issues: #9907, #7103, #10051, #7056, #8546
|
|
|
|
|
|
|
|
|
|
| |
#10043)
Reviewers: austin, simonmar
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D657
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Don't call postLogMsg to post a user msg, because it truncates messages to
512 bytes.
Rename traceCap_stderr and trace_stderr to vtraceCap_stderr and trace_stderr,
to signal that they take a va_list (similar to vdebugBelch vs debugBelch).
See #3874 for the original reason behind traceFormatUserMsg.
See the commit msg in #9395 (d360d440) for a discussion about using
null-terminated strings vs strings with an explicit length.
Test Plan:
Run `cabal install ghc-events` and inspect the result of `ghc-events show` on
an eventlog file created with `ghc -eventlog Test.hs` and `./Test +RTS -l`,
where Test.hs contains:
```
import Debug.Trace
main = traceEvent (replicate 510 'a' ++ "bcd") $ return ()
```
Depends on D655.
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D656
GHC Trac Issues: #8309
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: See also ab9711d8.
Reviewers: austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D655
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In the threaded RTS, a signal is delivered from the RTS to Haskell
user code by writing to file that one of the IO managers watches (via
an instance of GHC.Event.Control.Control). When the IO manager
receives the signal, it calls GHC.Conc.Signal.runHandlers to invoke
Haskell signal handler. In the move from a single IO manager to one IO
manager per capability, the behavior was (wrongly) extended so that a
signal is delivered to every event manager (see #9423), each of which
invoke Haskell signal handlers, leading to multiple invocations of
Haskell signal handlers for a single signal. This change fixes this
problem by having the RTS (in generic_handler()) notify only the
Control instance used by the TimerManager, rather than all the
per-capability IO managers.
Reviewers: austin, hvr, simonmar, Mikolaj
Reviewed By: simonmar, Mikolaj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D641
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The GCC assembler doesn't seem to recognise the 'fp' and 'lr' register
names which are aliases for 'x29' and 'x30' respectively.
Depends on D598.
Test Plan: validate
Reviewers: lukexi, bgamari, austin
Reviewed By: austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D599
GHC Trac Issues: #9935
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This introduces new .cmm syntax for import:
'import' 'CLOSURE' <identifier>;
Currently cmm syntax allows importing only function labels:
import pthread_mutex_lock;
but sometimes ghc needs to import global gariables
or haskell closures:
import ghczmprim_GHCziTypes_True_closure;
import base_ControlziExceptionziBase_nestedAtomically_closure;
import ghczmprim_GHCziTypes_False_closure;
import sm_mutex;
It breaks on ia64 where there is a difference in
pointers to data and pointer to functions.
Patch fixes threaded runtime on ia64 where
dereference of 'sm_mutex' from CMM led to
incurrect location.
Exact breakage machanics are the same as in e18525fae273f4c1ad8d6cbe1dea4fc074cac721
Merge into the 7.10 branch
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
Test Plan: passes ./validate, makes ghci work on ghc-7.8.4
Reviewers: simonmar, simonpj, austin
Reviewed By: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D622
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Event log had inconcistent support for increacing capabilies
number, as header were not inserted in capability buffer. It
resulted in a ghc-events crash (see #9384). This commit
fixes this issue by inserting required header when number
of capabilies grows.
Reviewers: simonmar, Mikolaj, trofi, austin
Reviewed By: Mikolaj, trofi, austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D592
GHC Trac Issues: #9384
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
The entries of the static pointers table are expected to exist as
object code. Thus we have ghci complain with an intelligible error
message if the static form is used in interpreted mode.
It also includes a fix to keysHashTable in Hash.c which could cause a
crash. The iteration of the hashtable internals was incorrect. This
patch has the function keysHashTable imitate the iteration in
freeHashTable.
Finally, we submit here some minor edits to comments and
GHC.StaticPtr.StaticPtrInfo field names.
Authored-by: Alexander Vershilov <alexander.vershilov@tweag.
Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io>
Test Plan: ./validate
Reviewers: simonpj, hvr, austin
Reviewed By: austin
Subscribers: carter, thomie, qnikst, mboes
Differential Revision: https://phabricator.haskell.org/D586
GHC Trac Issues: #9878
|
|
|
|
|
|
|
|
|
|
|
| |
Very large modules can sometimes contain very large SRT bitmaps (this
is a separate problem that I need to look into). The large bitmaps
often contain a lot of zeros, so this patch skips over empty words in
the bitmap.
It makes a dramatic difference in the particular example that I saw,
where an old gen GC was taking 0.5s before this change and 0.07s after
it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
A mutex is used to protect the SPT.
unsafeLookupStaticPtr and staticPtrKeys in GHC.StaticPtr are made
monadic.
SPT entries are removed in a destructor function of modules.
Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io>
Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io>
Test Plan: ./validate
Reviewers: austin, simonpj, hvr
Subscribers: carter, thomie, qnikst, mboes
Differential Revision: https://phabricator.haskell.org/D587
GHC Trac Issues: #9878
|
|
|
|
|
|
| |
Reviewed By: austin
Differential Revision: https://phabricator.haskell.org/D575
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unwind information allows the debugger to discover more information
about a program state, by allowing it to "reconstruct" other states of
the program. In practice, this means that we explain to the debugger
how to unravel stack frames, which comes down mostly to explaining how
to find their Sp and Ip register values.
* We declare yet another new constructor for CmmNode - and this time
there's actually little choice, as unwind information can and will
change mid-block. We don't actually make use of these capabilities,
and back-end support would be tricky (generate new labels?), but it
feels like the right way to do it.
* Even though we only use it for Sp so far, we allow CmmUnwind to specify
unwind information for any register. This is pretty cheap and could
come in useful in future.
* We allow full CmmExpr expressions for specifying unwind values. The
advantage here is that we don't have to make up new syntax, and can e.g.
use the WDS macro directly. On the other hand, the back-end will now
have to simplify the expression until it can sensibly be converted
into DWARF byte code - a process which might fail, yielding NCG panics.
On the other hand, when you're writing Cmm by hand you really ought to
know what you're doing.
(From Phabricator D169)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
When we call runHandlers, we must pass it a ForeignPtr. To ensure that
this happens, we introduce a wrapper that receives a plain Ptr and
converts it into a ForeignPtr. Then we adjust startSignalHandlers in
rts/posix/Signals.c to call the wrapper instead of calling runHandlers
directly.
Reviewers: hvr, austin, rwbarton, simonmar
Reviewed By: austin, simonmar
Subscribers: simonmar, thomie, carter
Differential Revision: https://phabricator.haskell.org/D515
GHC Trac Issues: #9817
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
For compatibility with ARM machines from pre v6, the RTS provides
implementations of certain atomic operations. Previously, these
were only included in the threaded RTS.
But ghc (the library) contains the code in compiler/cbits/genSym.c, which
uses these operations if there is more than one capability. But there is only
one libHSghc, so the linker wants to resolve these symbols in every case.
By providing these operations in all RTSs, the linker is happy. The only
downside is a small amount of dead code in the non-threaded RTS on old ARM
machines.
Test Plan: It helped here.
Reviewers: bgamari, austin
Reviewed By: bgamari, austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D564
GHC Trac Issues: #8951
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
As proposed in [1], this extension introduces a new syntactic form
`static e`, where `e :: a` can be any closed expression. The static form
produces a value of type `StaticPtr a`, which works as a reference that
programs can "dereference" to get the value of `e` back. References are
like `Ptr`s, except that they are stable across invocations of a
program.
The relevant wiki pages are [2, 3], which describe the motivation/ideas
and implementation plan respectively.
[1] Jeff Epstein, Andrew P. Black, and Simon Peyton-Jones. Towards
Haskell in the cloud. SIGPLAN Not., 46(12):118–129, September 2011. ISSN
0362-1340.
[2] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers
[3] https://ghc.haskell.org/trac/ghc/wiki/StaticPointers/ImplementationPlan
Authored-by: Facundo Domínguez <facundo.dominguez@tweag.io>
Authored-by: Mathieu Boespflug <m@tweag.io>
Authored-by: Alexander Vershilov <alexander.vershilov@tweag.io>
Test Plan: `./validate`
Reviewers: hvr, simonmar, simonpj, austin
Reviewed By: simonpj, austin
Subscribers: qnikst, bgamari, mboes, carter, thomie, goldfire
Differential Revision: https://phabricator.haskell.org/D550
GHC Trac Issues: #7015
|
|
|
|
|
|
| |
object""
This reverts commit 7932b2adaecac6c86038176d909c20ad1b1f9604.
|
|
|
|
|
|
|
| |
Also includes a fix for the segfaults on Windows caused by the original
version of this patch.
This reverts commit 4b51194df4090d984f02c12128e868077660fb8b.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit b5e8b3b162b3ff15ae6caf1afc659565365f54a8.
I reverted it because one of these two patches
9e6e4796437a7fc23e83605a45db9b2663570123 Add purgeObj()
b5e8b3b162b3ff15ae6caf1afc659565365f54a8 Make the linker API thread-safe
causes a seg-fault on Windows. The seg-fault happens immediately
the linker is invoked, in ghci or in Template Haskell.
I believe that it is the "linker API thread-safe" commit that causes
the seg-fault; it happens even if the "purgeObj" commit alone is
reverted. But since the two patches mess with the same code, to
revert the "linker API" patch I had revert both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 9e6e4796437a7fc23e83605a45db9b2663570123.
I reverted it because one of these two patches
9e6e4796437a7fc23e83605a45db9b2663570123 Add purgeObj()
b5e8b3b162b3ff15ae6caf1afc659565365f54a8 Make the linker API thread-safe
causes a seg-fault on Windows. The seg-fault happens immediately
the linker is invoked, in ghci or in Template Haskell.
I believe that it is the "linker API thread-safe" commit that causes
the seg-fault; it happens even if the "purgeObj" commit alone is
reverted. But since the two patches mess with the same code, to
revert the "linker API" patch I had revert both.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In a statically linked GHCi symbol `environ` resolves to NULL when
called from a Haskell script.
When resolving symbols in a Haskell script we need to search the
executable program and its dependent (DT_NEEDED) shared libraries
first and then search the loaded libraries.
We want to be able to override functions in loaded libraries later.
Libraries must be opened with local scope (RTLD_LOCAL) and not global.
The latter adds all symbols to the executable program's symbols where
they are then searched in loading order. We want reverse loading order.
When libraries are loaded with local scope the dynamic linker
cannot use symbols in that library when resolving the dependencies
in another shared library. This changes the way files compiled to
object code must be linked into temporary shared libraries. We link
with the last temporary shared library created so far if it exists.
Since each temporary shared library is linked to the previous temporary
shared library the dynamic linker finds the latest definition of a
symbol by following the dependency chain.
See also Note [RTLD_LOCAL] for a summary of the problem and solution.
Cherry-picked commit 2f8b4c
Changed linker argument ordering
On some ELF systems GNU ld (and others?) default to
--as-needed and the order of libraries in the link
matters.
The last temporary shared library, must appear
before all other libraries. Switching the position
of extra_ld_inputs and lib_path_objs does that.
Fixes #8935 and #9186
Reviewers: austin, hvr, rwbarton, simonmar
Reviewed By: simonmar
Subscribers: thomie, carter, simonmar
Differential Revision: https://phabricator.haskell.org/D349
GHC Trac Issues: #8935, #9186, #9480
|
|
|
|
|
|
|
|
| |
This allows us to replace an object without actually unloading the old
object, which is necessary when we know we have references to the old
object so it can't be completely unloaded. Using unloadObj() would
cause the GC (CheckUnload) to repeatedly and fruitlessly try to unload
the old object.
|
|
|
|
|
|
| |
We used to be able to rely on the client to use the API in a
single-threaded way, but now that the GC calls into the linker to
unload objects this isn't a safe assumption.
|
|
|
|
| |
See the documentation for details.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
clearNursery resets all the bd->free pointers of nursery blocks to
make the blocks empty. In profiles we've seen clearNursery taking
significant amounts of time particularly with large -N and -A values.
This patch moves the work of clearNursery to the point at which we
actually need the new block, thereby introducing an invariant that
blocks to the right of the CurrentNursery pointer still need their
bd->free pointer reset. This should make things faster overall,
because we don't need to clear blocks that we don't use.
Test Plan: validate
Reviewers: AndreasVoellmy, ezyang, austin
Subscribers: thomie, carter, ezyang, simonmar
Differential Revision: https://phabricator.haskell.org/D318
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
| |
Authored-by: jrp
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`integer-gmp2` uses the new 64bit-based IEEE deconstructing primop
introduced in b62bd5ecf3be421778e4835010b6b334e95c5a56.
However, the returned values differ for exceptional IEEE values:
Previous (expected) semantics:
> decodeFloat (-1/0)
(-4503599627370496,972)
> decodeFloat (1/0)
(4503599627370496,972)
> decodeFloat (0/0)
(-6755399441055744,972)
Currently (broken) semantics:
> decodeFloat (-1/0 :: Double)
(-9223372036854775808,-53)
> decodeFloat (1/0 :: Double)
(-9223372036854775808,-53)
> decodeFloat (0/0 :: Double)
(-9223372036854775808,-53)
This patch reverts to the old expected semantics.
I plan to revisit the implementation during GHC 7.11 development.
This should address #9810
Reviewed By: austin, ekmett, luite
Differential Revision: https://phabricator.haskell.org/D486
|