| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This patch forcibly enable Cmm switch planning for wasm32, since
otherwise the switch tables we generate may exceed the br_table
maximum allowed size.
|
|
|
|
|
| |
This patch passes -Wa,--no-type-check for wasm32 when compiling
assembly. See the added note for more detailed explanation.
|
|
|
|
|
| |
This patch enables Cmm big arithmetic on wasm32, since 64-bit
arithmetic can be efficiently lowered to wasm32 opcodes.
|
|
|
|
|
|
| |
The driver used to pass -Wl,--no-as-needed for LLD linking. This is
actually only supported for ELF targets, and must be avoided when
linking for wasm32.
|
|
|
|
|
|
| |
This patch adds addToUFM_L (backed by insertLookupWithKey),
addToUniqMap_L and intersectUniqMap_C. These UniqFM/UniqMap util
functions are used by the wasm32 NCG.
|
|
|
|
|
| |
This patch fixes the bindist autoconf logic to properly set
CrossCompiling=YES when it's a cross GHC bindist.
|
|
|
|
|
| |
This base patch avoids using unsupported posix functionality on
wasm32.
|
|
|
|
|
|
| |
This patch adds more autoconf checks to base, since those functions
and headers may exist on other POSIX systems but don't exist on
wasm32.
|
|
|
|
|
| |
On wasm32, we have to fall back to using monotonic clock to emulate
cputime, since there's no native support for cputime as a clock id.
|
|
|
|
| |
This patch adds the rest of wasm32 specific logic in rts.
|
|
|
|
|
| |
This patch adds register mapping logic for wasm32. See Note [Register
mapping on WebAssembly] in wasm32 NCG for more description.
|
|
|
|
|
|
|
| |
This patch defines stub Condition/Mutex/OSThreadId/ThreadLocalKey
types for wasm32, just enough to unblock compiling RTS. Any
threading-related functionality has been patched to be disabled on
wasm32.
|
|
|
|
|
|
|
|
| |
wasm32
This patch prevents resetTerminalSettings and freeThreadingResources
to be called on wasm32, since there is no TTY or threading on wasm32
at all.
|
|
|
|
|
| |
This patch makes flushExec a no-op on wasm32, since there's no such
thing as executable memory on wasm32 in the first place.
|
|
|
|
|
|
| |
This patch makes the storage manager not return any memory on wasm32.
The detailed reason is described in Note [Megablock allocator on
wasm].
|
|
|
|
|
|
|
| |
libffi-wasm32 only supports non-standard libffi closure api via
ffi_alloc_prep_closure(). This patch implements
ffi_alloc_prep_closure() via standard libffi closure api on other
targets, and uses it to implement adjustor functionality.
|
|
|
|
|
| |
On wasm32 there isn't a process model at all, so no
FORKPROCESS_PRIMOP_SUPPORTED.
|
|
|
|
| |
The default RTS_POSIX_ONLY_SYMBOLS doesn't make sense on wasm32.
|
|
|
|
|
|
|
| |
Due to the lack of threads, on wasm32 there can't be a background
timer that periodically resets the context switch flag. This patch
disables timer for wasm32, and also makes the scheduler default to -C0
on wasm32 to avoid starving threads.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a wasm32-specific behavior to RtsStartup logic. When
the PWD environment variable is present, we chdir() to it first.
The point is to workaround an issue in wasi-libc: it's currently not
possible to specify the initial working directory, it always defaults
to / (in the virtual filesystem mapped from some host directory). For
some use cases this is sufficient, but there are some other cases
(e.g. in the testsuite) where the program needs to access files
outside.
|
|
|
|
|
|
| |
This patch adds minimal placeholder linker logic for wasm32, just
enough to unblock compiling rts on wasm32. RTS linker functionality is
not properly implemented yet for wasm32.
|
|
|
|
|
| |
When getuid() is not present, don't do checkSuid since it doesn't make
sense anyway on that target.
|
|
|
|
|
| |
We check existence of raise() in autoconf, and here, if not
HAVE_RAISE, we should use exit() instead in genericRaise.
|
|
|
|
|
| |
This patch adds the missing THREADED_RTS CPP guard to mutex logic in
IPE.c.
|
|
|
|
|
|
|
| |
We've previously added detection of getpid() in autoconf. This patch
uses HAVE_GETPID to guard some subprocess related logic in the RTS.
This is required for certain targets like wasm32-wasi, where there
isn't a process model at all.
|
|
|
|
|
|
|
|
| |
In the rts, we have a RTS_USER_SIGNALS macro, and most signal-related
logic is guarded with RTS_USER_SIGNALS. This patch extends the range
of code guarded with RTS_USER_SIGNALS, and define RTS_USER_SIGNALS iff
signal.h is actually detected by autoconf. This is required for
wasm32-wasi to work, which lacks signals.
|
|
|
|
|
|
|
|
| |
This patch uses ffi_type_void instead of FFI_TYPE_VOID in the
interpreter code, since the FFI_TYPE_* macros are not available in
libffi-wasm32 yet. The libffi public documentation also only mentions
the lower-case ffi_type_* symbols, so we should prefer the lower-case
API here.
|
|
|
|
|
| |
In libc, sleep() returns an integer. The ccall type signature should
match the libc definition, otherwise it causes linker error on wasm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unlike other targets, wasm requires the function signature of the call
site and callee to strictly match. So in Cmm, when we call a C
function that actually returns a value, we need to add an _unused
local variable to receive it, otherwise type error awaits.
An even bigger problem is calling variadic functions like barf() and
such. Cmm doesn't support CAPI calling convention yet, so calls to
variadic functions just happen to work in some cases with some
target's ABI. But again, it doesn't work with wasm. Fortunately, the
wasm C ABI lowers varargs to a stack pointer argument, and it can be
passed NULL when no other arguments are expected to be passed. So we
also add the additional unused NULL arguments to those functions, so
to fix wasm, while not affecting behavior on other targets.
|
|
|
|
|
|
|
| |
This patch makes deriveConstants emit and parse an .ll file when
targeting wasm. It's a necessary workaround for broken llvm-nm on
wasm, which isn't capable of reporting correct constant values when
parsing an object.
|
|
|
|
|
|
| |
This patch adds the wasm32-wasi tuple support to various places in the
tree: autoconf, hadrian, ghc-boot and also the compiler. The codegen
logic will come in subsequent commits.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Martin Erwig's FGL (Functional Graph Library) provides an "inductive"
representation of graphs. A general graph has labeled nodes and
labeled edges. The key operation on a graph is to decompose it by
removing one node, together with the edges that connect the node to
the rest of the graph. There is also an inverse composition
operation.
The decomposition and composition operations make this representation
of graphs exceptionally well suited to implement graph algorithms in
which the graph is continually changing, as alluded to in #21259.
This commit adds `GHC.Data.Graph.Inductive.Graph`, which defines the
interface, and `GHC.Data.Graph.Inductive.PatriciaTree`, which provides
an implementation. Both modules are taken from `fgl-5.7.0.3` on
Hackage, with these changes:
- Copyright and license text have been copied into the files
themselves, not stored separately.
- Some calls to `error` have been replaced with calls to `panic`.
- Conditional-compilation support for older versions of GHC,
`containers`, and `base` has been removed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds a targetSupportsThreadedRts flag to indicate whether
the target supports the threaded rts at all, different from existing
targetSupportsSMP that checks whether -N is supported by the RTS. All
existing flavours have also been updated accordingly to respect this
flags.
Some targets (e.g. wasm32-wasi) does not support the threaded rts,
therefore this flag is needed for the default flavours to work. It
makes more sense to have proper autoconf logic to check for threading
support, but for the time being, we just set the flag to False iff the
target is wasm32.
|
| |
|
|
|
|
|
| |
This patch adds checks for getpid, getuid and raise in autoconf. These
functions are absent in wasm32-wasi and thus needs to be checked.
|
|
|
|
|
|
|
| |
Now Budget roughly tracks the combined width of all arguments after unarisation.
See the changes to `Note [Worker argument budgets]`.
Fixes #21737.
|
|
|
|
|
|
| |
See Note [Unboxing through unboxed tuples].
Fixes #22388.
|
|
|
|
|
| |
The error message for DsUselessSpecialiseForClassMethodSelector
was just wrong (a typo in some earlier work); trivial fix
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem here is described at some length in
Note [Boxity for bottoming functions] and
Note [Reboxed crud for bottoming calls] in GHC.Core.Opt.DmdAnal.
This patch adds a SPECIALISE pragma for indexError, which
makes it much less vulnerable to the problem described in
these Notes.
(This came up in another line of work, where a small change made
indexError do reboxing (in nofib/spectral/simple/table_sort)
that didn't happen before my change. I've opened #22404
to document the fagility.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Specialiser has, for some time, fires class-op RULES in the
specialiser itself: see
Note [Specialisation modulo dictionary selectors]
This MR beefs it up a bit, so that it fires /all/ RULES in the
specialiser, not just class-op rules. See
Note [Fire rules in the specialiser]
The result is a bit more specialisation; see test
simplCore/should_compile/T21851_2
This pushed me into a bit of refactoring. I made a new data types
GHC.Core.Rules.RuleEnv, which combines
- the several source of rules (local, home-package, external)
- the orphan-module dependencies
in a single record for `getRules` to consult. That drove a bunch of
follow-on refactoring, including allowing me to remove
cr_visible_orphan_mods from the CoreReader data type.
I moved some of the RuleBase/RuleEnv stuff into GHC.Core.Rule.
The reorganisation in the Simplifier improve compile times a bit
(geom mean -0.1%), but T9961 is an outlier
Metric Decrease:
T9961
|
|
|
|
| |
see #19884
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following `TcRnDiagnostic` messages have been introduced:
TcRnWarnUnsatisfiedMinimalDefinition
TcRnMisplacedInstSig
TcRnBadBootFamInstDeclErr
TcRnIllegalFamilyInstance
TcRnAssocInClassErr
TcRnBadFamInstDecl
TcRnNotOpenFamily
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There were two bugs here:
1. Treating type-level constructors as PromotedDataCon doesn't always
work, in particular because constructors promoted via DataKinds are
called both T and 'T. (Tests T22332a, T22332b, T22315a, T22315b)
Fix: guard these cases with isDataKindsPromotedDataCon.
2. Type-level constructors were sent to the code generator, producing
things like constructor wrappers. (Tests T22332a, T22332b)
Fix: test for them in isDataTyCon.
Other changes:
* changed the marking of "type data" DataCon's as suggested by SPJ.
* added a test TDGADT for a type-level GADT.
* comment tweaks
* change tcIfaceTyCon to ignore IfaceTyConInfo, so that IfaceTyConInfo
is used only for pretty printing, not for typechecking. (SPJ)
|
|
|
|
|
|
|
|
| |
Also add perf test for infinite list fusion.
In particular, in `GHC.Core`, often we deal with infinite lists of roles. Also in a few locations we deal with infinite lists of names.
Thanks to simonpj for helping to write the Note [Fusion for `Infinite` lists].
|
| |
|