summaryrefslogtreecommitdiff
path: root/rts/Adjustor.c
Commit message (Collapse)AuthorAgeFilesLines
* rts: Break up adjustor logicBen Gamari2021-07-271-1290/+14
|
* rts: Move libffi interfaces all to AdjustorBen Gamari2021-07-271-7/+49
| | | | | | | Previously the libffi Adjustor implementation would use allocateExec to create executable mappings. However, allocateExec is also used elsewhere in GHC to allocate things other than ffi_closure, which is a use-case which libffi does not support.
* rts: Document CPP guardsBen Gamari2021-07-271-10/+10
|
* rts: Remove trailing whitespace from Adjustor.cMatthew Pickering2021-05-111-32/+32
|
* AArch64/arm64 adjustmentsMoritz Angermann2020-11-151-1/+1
| | | | | | | | This addes the necessary logic to support aarch64 on elf, as well as aarch64 on mach-o, which Apple calls arm64. We change architecture name to AArch64, which is the official arm naming scheme.
* PPC NCG: Remove Darwin supportPeter Trommler2019-01-011-28/+4
| | | | | | | Support for Mac OS X on PowerPC has been dropped by Apple years ago. We follow suit and remove PowerPC support for Darwin. Fixes #16106.
* Finish stable splitDavid Feuer2018-08-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Long ago, the stable name table and stable pointer tables were one. Now, they are separate, and have significantly different implementations. I believe the time has come to finish the split that began in #7674. * Divide `rts/Stable` into `rts/StableName` and `rts/StablePtr`. * Give each table its own mutex. * Add FFI functions `hs_lock_stable_ptr_table` and `hs_unlock_stable_ptr_table` and document them. These are intended to replace the previously undocumented `hs_lock_stable_tables` and `hs_lock_stable_tables`, which are now documented as deprecated synonyms. * Make `eqStableName#` use pointer equality instead of unnecessarily comparing stable name table indices. Reviewers: simonmar, bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, carter GHC Trac Issues: #15555 Differential Revision: https://phabricator.haskell.org/D5084
* Fix 32 bit windows buildTamar Christina2018-05-281-0/+1
| | | | | | | | | | | | | | | | Summary: Fix a number of issues that have broken the 32 bit build. This makes it build again. Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4691
* Prefer #if defined to #ifdefBen Gamari2017-04-281-3/+3
| | | | Our new CPP linter enforces this.
* Typos in manual and comments [ci skip]Gabor Greif2017-03-171-1/+1
|
* Spelling in comments [ci skip]Gabor Greif2017-02-101-1/+1
|
* rts: Replace `nat` with `uint32_t`Erik de Castro Lopo2016-05-051-2/+2
| | | | | | | | | | | | The `nat` type was an alias for `unsigned int` with a comment saying it was at least 32 bits. We keep the typedef in case client code is using it but mark it as deprecated. Test Plan: Validated on Linux, OS X and Windows Reviewers: simonmar, austin, thomie, hvr, bgamari, hsyl20 Differential Revision: https://phabricator.haskell.org/D2166
* s/StgArrWords/StgArrBytes/Siddhanathan Shanmugam2015-09-111-3/+3
| | | | | | | | | | Rename StgArrWords to StgArrBytes (see Trac #8552) Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D1233 GHC Trac Issues: #8552
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix freeHaskellFunPtr crash on iOS.Austin Seipp2013-09-151-1/+42
| | | | | Authored-by: Stephen Blackheath <...@blacksapphire.com> Signed-off-by: Austin Seipp <austin@well-typed.com>
* Fix build on Win64Ian Lynagh2013-07-021-11/+7
| | | | | | gcc thought that fourthFloating could be used without being defined. In actual fact it couldn't, but I've refactored the code so that it can now see this.
* Initialize ptr to NULL to silence Clang warning.Austin Seipp2013-06-201-1/+1
| | | | Signed-off-by: Austin Seipp <aseipp@pobox.com>
* Update error message text; spotted bu Sergei TrofimovichIan Lynagh2013-04-211-1/+1
|
* Use ffi_prep_closure_loc rather than ffi_prep_closureIan Lynagh2013-04-211-1/+1
| | | | The latter is deprecated. Part of #7718.
* Fix segfaults on SELinux machines; fixes #7629Ian Lynagh2013-04-091-1/+1
| | | | | | | | | | Patch from wgmitchener. From the ticket: The two addresses (adjustorStub and code) contain the same memory (double-mapped), but one is writable while the other is executable. This is how libffi works around the SELinux restrictions. On non-SELinux systems the code and data addresses are probably the same.
* More Win64 adjustor fixesIan Lynagh2012-05-181-33/+51
|
* Fix the way the adjustor puts things on the stack on Win64Ian Lynagh2012-05-181-43/+47
|
* Fix freeHaskellFunctionPtr on Win64Ian Lynagh2012-05-171-2/+14
|
* Implement the Adjustor for Win64Ian Lynagh2012-03-211-1/+128
|
* Only support stdcall in Adjustor.c on i386Ian Lynagh2012-03-211-1/+1
|
* Detab Adjustor.cIan Lynagh2012-03-211-156/+156
|
* remove some dead codeSimon Marlow2011-07-201-15/+2
|
* update freeHaskellFuncationPtr following changes to x86 adjustorsSimon Marlow2011-07-011-12/+4
| | | | | | (fixes various ffi test failures on x86. This change was supposed to be part of 9f61598ce7b0cb3448e8f0c3d627c0ca47b7f55f, but somehow it got lost).
* Use the x86/Darwin implementation of Adjustors on all x86 platforms,Simon Marlow2011-06-291-49/+9
| | | | as it maintains 16-byte alignment of the stack pointer (see #5250)
* Change some TARGET tests to HOST tests in the RTSIan Lynagh2010-07-131-1/+1
| | | | Which was being used seemed to be random
* SET_ARR_HDR's last argument is now a number of bytes, rather than wordsIan Lynagh2010-06-191-1/+1
| | | | This avoids unnecessary work and potential loss of information
* Replace an (incorrect) bytes-to-words calculation with ROUNDUP_BYTES_TO_WDSIan Lynagh2010-06-191-1/+1
|
* Fix the build on OS XIan Lynagh2009-08-071-8/+11
|
* x86_64 warning fixesSimon Marlow2009-08-031-25/+28
|
* RTS tidyup sweep, first phaseSimon Marlow2009-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first phase of this tidyup is focussed on the header files, and in particular making sure we are exposinng publicly exactly what we need to, and no more. - Rts.h now includes everything that the RTS exposes publicly, rather than a random subset of it. - Most of the public header files have moved into subdirectories, and many of them have been renamed. But clients should not need to include any of the other headers directly, just #include the main public headers: Rts.h, HsFFI.h, RtsAPI.h. - All the headers needed for via-C compilation have moved into the stg subdirectory, which is self-contained. Most of the headers for the rest of the RTS APIs have moved into the rts subdirectory. - I left MachDeps.h where it is, because it is so widely used in Haskell code. - I left a deprecated stub for RtsFlags.h in place. The flag structures are now exposed by Rts.h. - Various internal APIs are no longer exposed by public header files. - Various bits of dead code and declarations have been removed - More gcc warnings are turned on, and the RTS code is more warning-clean. - More source files #include "PosixSource.h", and hence only use standard POSIX (1003.1c-1995) interfaces. There is a lot more tidying up still to do, this is just the first pass. I also intend to standardise the names for external RTS APIs (e.g use the rts_ prefix consistently), and declare the internal APIs as hidden for shared libraries.
* OS X / amd64 fixesIan Lynagh2009-05-201-1/+1
|
* On Linux use libffi for allocating executable memory (fixed #738)Simon Marlow2008-09-191-14/+19
|
* Fix a typo in powerpc/Linux-only code; spotted by Jeroen PullesIan Lynagh2008-07-291-1/+1
|
* Import libffi-3.0.4, and use it to provide FFI support in GHCiSimon Marlow2008-04-081-3/+3
| | | | | | | | | | | | | | | | | | | | This replaces the hand-rolled architecture-specific FFI support in GHCi with the standard libffi as used in GCJ, Python and other projects. I've bundled the complete libffi-3.0.4 tarball in the source tree in the same way as we do for GMP, the difference being that we always build and install our own libffi regardless of whether there's one on the system (it's small, and we don't want dependency/versioning headaches). In particular this means that unregisterised builds will now have a fully working GHCi including FFI out of the box, provided libffi supports the platform. There is also code in the RTS to use libffi in place of rts/Adjustor.c, but it is currently not enabled if we already have support in Adjustor.c for the current platform. We need to assess the performance impact before using libffi here too (in GHCi we don't care too much about performance).
* Use the correct libffi type for pointersSimon Marlow2008-01-041-0/+1
|
* Optionally use libffi to implement 'foreign import "wrapper"' (#793)Simon Marlow2008-01-031-14/+100
| | | | | | | | | | | | | | To enable this, set UseLibFFI=YES in mk/build.mk. The main advantage here is that this reduces the porting effort for new platforms: libffi works on more architectures than our current adjustor code, and it is probably more heavily tested. We could potentially replace our existing code, but since it is probably faster than libffi (just a guess, I'll measure later) and is already working, it doesn't seem worthwhile. Right now, you must have libffi installed on your system. I used the one supplied by Debian/Ubuntu.
* Fix freeHaskellFunctionPtr for Darwin/i386Aaron Tomb2007-10-291-1/+1
|
* remove an incorrect assertionSimon Marlow2007-10-161-5/+0
|
* remove OpenBSD-specific initAdjustor() code that shouldn't be required nowSimon Marlow2007-06-011-26/+0
| | | | Submitted by: Matthias Kilian <kili@outback.escape.de>
* fix adjustor generation on ia64 (test case ffi009)red5_2@hotmail.com2007-04-011-4/+14
| | | | | | | | | | | Some fixes to adjustor functions. The 8-byte address returned by the allocator is adjusted to be aligned to 16-byte boundaries. Fixed a typo in inserting an immediate address into an instruction. This fixes the calls to 5-argument and 6-argument functions in ffi009. Some functions still break. I suspect it's related to passing arguments on the stack.
* remove unused includes, now that Storage.h & Stable.h are included by Rts.hSimon Marlow2006-11-151-3/+0
|
* Split GC.c, and move storage manager into sm/ directorySimon Marlow2006-10-241-0/+1
| | | | | | | | | | | | | | | | | In preparation for parallel GC, split up the monolithic GC.c file into smaller parts. Also in this patch (and difficult to separate, unfortunatley): - Don't include Stable.h in Rts.h, instead just include it where necessary. - consistently use STATIC_INLINE in source files, and INLINE_HEADER in header files. STATIC_INLINE is now turned off when DEBUG is on, to make debugging easier. - The GC no longer takes the get_roots function as an argument. We weren't making use of this generalisation.
* replace stgMallocBytesRWX() with our own allocatorSimon Marlow2006-05-301-11/+12
| | | | | | | | | | | | | | | | | | | | See bug #738 Allocating executable memory is getting more difficult these days. In particular, the default SELinux policy on Fedora Core 5 disallows making the heap (i.e. malloc()'d memory) executable, although it does apparently allow mmap()'ing anonymous executable memory by default. Previously, stgMallocBytesRWX() used malloc() underneath, and then tried to make the page holding the memory executable. This was rather hacky and fails with Fedora Core 5. This patch adds a mini-allocator for executable memory, based on the block allocator. We grab page-sized blocks and make them executable, then allocate small objects from the page. There's a simple free function, that will free whole pages back to the system when they are empty.
* fix a _TARGET_ARCH that should be _HOST_ARCHSimon Marlow2006-05-241-1/+1
|