| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
See documentation for details.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Found by clang:
rts_dist_HC rts/dist/build/RetainerProfile.p_o
rts/RetainerProfile.c:1779:5:
error: implicit declaration of function 'markStableTables' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
markStableTables(retainRoot, NULL);
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
| |
This should have manifested earlier, but for some reason it only seemed
to trigger on Mavericks.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
| |
passed explicitely
Issue #8748
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
UNREG mode has quite nasty invariant to maintain:
capabilities[0] == &MainCapability
and it's a non-heap memory, while other
capabilities are dynamically allocated.
Issue #8748
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
| |
Following 298a25bdf and #8722 as Peter mentioned, this probably isn't
needed anymore.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
| |
Our old function for searching for sections could only deal
with section names that were eight bytes or shorter; this
patch adds support for long section names.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
| |
As Luke Iannini reported, the Clang iOS cross compiler apparently
doesn't support __thread for some bizarre reason, so unfortunately they
too must fall back to pthread_{get,set}specific.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This basically cleans a lot of GCTDecl up - I found it quite hard to
read and a bit confusing. The changes are mostly cosmetic: better
delineation between the alternative cases and light touchups, and tries
to make every branch as consistent as possible.
However, this patch does have one significant effect: it will ensure
that any LLVM-based compilers will use __thread if they support it.
Before, they would simply always use pthread_getspecific and
pthread_setspecific, which are almost surely even *more* inefficient.
The details are a bit too long and boring to go into here; see #7602.
After talking with Simon, we decided to play it safe - __thread can at
least be optimized by future clang releases even further on OS X if they
choose, and it's safer until we can investigate the pthread
implementation further on Mavericks.
For Linux, the story isn't so bleak if you use Clang (for whatever
reason) - Linux directly writes to `%fs` for __thread slots (while OS X
will perform a load followed by an indirect call.) So it should still be
fairly competitive, speed-wise.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
| |
This fixes #7134
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We occasionally need to reserve some temporary memory in a primop for
passing to a foreign function. We've been using the stack for this,
but when we moved to high-level Cmm it became quite fragile because
primops are in high-level Cmm and the stack is supposed to be under
the control of the Cmm pipeline.
So this change puts things on a firmer footing by adding a new Cmm
construct 'reserve'. e.g. in decodeFloat_Int#:
reserve 2 = tmp {
mp_tmp1 = tmp + WDS(1);
mp_tmp_w = tmp;
/* Perform the operation */
ccall __decodeFloat_Int(mp_tmp1 "ptr", mp_tmp_w "ptr", arg);
r1 = W_[mp_tmp1];
r2 = W_[mp_tmp_w];
}
reserve is described in CmmParse.y.
Unfortunately the argument to reserve must be a compile-time constant.
We might have to extend the parser to allow expressions with
arithmetic operators if this is too restrictive.
Note also that the return instruction for the procedure must be
outside the scope of the reserved stack area, so we have to extract
the values from the reserved area before we close the scope. This
means some more local variables (r1, r2 in the example above). The
generated code is more or less identical to what we had before though.
|
|
|
|
|
|
|
|
| |
When printing an update frame in printClosure(), it will not print
the unspecific UPDATE_FRAME, instead it prints BH_UPDATE_FRAME,
NORMAL_UPDATE_FRAME or MARKED_UPDATE_FRAME.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
| |
Gold apparently doesn't recognize `-z origin`, only `-zorigin` it seems.
Authored-by: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
|
|
|
|
|
|
|
| |
On win64 sizeof(long) != sizeof(void*), so debugTrace was casting a
value of incorrect size causing a validate failure.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
| |
An earlier patch fixes a bug in flushExec on linux only. This
patch uses the fixed code on all operating systems.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
We now do the allocation of the blackhole indirection closure inside the
RTS procedure 'newCAF' instead of generating the allocation code inline
in the closure body of each CAF. This slightly decreases code size in
modules with a lot of CAFs.
As a result of this change, for example, the size of DynFlags.o drops by
~60KB and HsExpr.o by ~100KB.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Instead, just don't do anything on x86/amd64, and on !x86, use either A)
__clear_cache from libgcc, or B) sys_icache_invalidate for OS X (and
iOS.)
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
| |
Authored-by: Authored-by: Luke Iannini <lukexi@me.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
| |
Signed-off-by: Arash Rouhani <rarash@student.chalmers.se>
Reviewed-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds code for jumping to given addresses for ARM, written by Ben
Gamari.
However, when allocating new infotables for bytecode (which is where
this jump code occurs), we need to be sure to flush the cache on the
execute pointer returned from allocateExec() - on systems like ARM, the
processor won't reliably read back code or automatically cache flush,
where x86 will.
So we add a new flushExec primitive to call out to GCC's
__builtin___clear_cache primitive, which will properly generate the
correct code (nothing on x86, and a call to libgcc's __clear_cache on
ARM) and make sure we use it after writing the code out.
Authored-by: Ben Gamari <bgamari.foss@gmail.com>
Authored-by: Austin Seipp <austin@well-typed.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
This creates a new C API:
initLinker_ (int retain_cafs)
The old initLinker() was left as-is for backwards compatibility. See
documentation in Linker.h.
|
|
|
|
| |
Retained CAFs must keep an object file alive.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This resurrects some old code and makes it work again. The idea is
that we want to get an error message if we ever enter a CAF that has
been GC'd, rather than following its indirection which will likely
cause a segfault. Without this patch, these bugs are hard to track
down in gdb, because the IND_STATIC code overwrites R1 (the pointer to
the CAF) with its indirectee before jumping into bad memory, so we've
lost the address of the CAF that got GC'd.
Some associated refactoring while I was here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the RTS part of a patch to base's topHandler to handle exiting
by a signal.
The intended behaviour is that on Unix, throwing ExitFailure (-sig)
results in the process terminating with that signal. Previously
shutdownHaskellAndSignal was only used for exiting with SIGINT due to
the UserInterrupt exception.
Improve shutdownHaskellAndSignal to do the signal part more carefully.
In particular, it (should) now reliably terminates the process one way
or another. Previusly if the signal was blocked, ignored or handled then
shutdownHaskellAndSignal would actually return!
Also, the topHandler code has two paths a careful shutdown and a "fast
exit" where it does not give finalisers a chance to run. We want to
support that mode also when we want to exit by signal. So rather than
the base code directly calling stg_exit as it did before, we have a
fastExit bool paramater for both shutdownHaskellAnd{Exit,Signal}.
|
|
|
|
| |
It wasn't actually broken, but it wasn't obviously right either.
|
| |
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a fun one.
In the RTS, `cas` expects a pointer to StgWord which will translate to
unsigned long (8 bytes under LP64.) But we had previously declared
token_locked as *StgBool* - which evaluates to 'int' (4 bytes under
LP64.) That means we fail to provide enough storage for the cas
primitive, causing it to corrupt memory on a 64bit platform.
Hilariously, this somehow did not affect little-endian platforms (ARM,
x86, etc) before. That's because to clear our lock token, we would say:
token_locked = 0;
But because token_locked is 32bits technically, this only writes to
half of the 64bit quantity. On a Big-Endian machine, this won't do
anything. That is, token_locked starts as 0:
/ token_locked
|
v
0x00000000
and the first cas modifies the memory to:
/ valid / corrupted
| |
v v
0x00000000 0x00000001
We then clear token_locked, but this doesn't change the corrupted 4
bytes of memory. And then we try to lock the token again, spinning until
it is released - clearly a deadlock.
Related: Windows (amd64) doesn't follow LP64, but LLP64, where both
int and long are 4 bytes, so this shouldn't change anything on these
platforms.
Thanks to Reid Barton for helping the diagnosis. Also, thanks to Jens
Peterson who confirmed this also fixes building GHC on Fedora/ppc64 and
Fedora/s390x.
Authored-by: Gustavo Luiz Duarte <gustavold@linux.vnet.ibm.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
|
| |
GlobalMemoryStatusEx actually requires _WIN32_WINNT to be defined as
0x0501 (Windows XP) for availability.
For completeness, I bumped WIN32_WINNT in Ticker and OSThreads as well.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
| |
Darwin doesn't support _SC_PHYS_PAGES, but we can get the exact number
of bytes of physical memory via 'hw.memsize', so we use that instead.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
|
|
| |
It needs freeStablePtr, which tripped my validate build, due to an
implicit declaration warning. I'm quite surprised this somehow did not
trip the build before.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|