[Git][ghc/ghc][wip/js-staging] 393 commits: Add a newline before since pragma in Data.Array.Byte

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Sun Oct 16 23:28:56 UTC 2022



doyougnu pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC


Commits:
945e8e49 by Bodigrim at 2022-10-10T17:13:31-04:00
Add a newline before since pragma in Data.Array.Byte

- - - - -
44fcdb04 by Vladislav Zavialov at 2022-10-10T17:14:06-04:00
Parser/PostProcess: rename failOp* functions

There are three functions named failOp* in the parser:
	failOpNotEnabledImportQualifiedPost
	failOpImportQualifiedTwice
	failOpFewArgs
Only the last one has anything to do with operators. The other two
were named this way either by mistake or due to a misunderstanding of
what "op" stands for. This small patch corrects this.

- - - - -
96d32ff2 by Simon Peyton Jones at 2022-10-10T22:30:21+01:00
Make rewrite rules "win" over inlining

If a rewrite rule and a rewrite rule compete in the simplifier, this
patch makes sure that the rewrite rule "win".  That is, in general
a bit fragile, but it's a huge help when making specialisation work
reliably, as #21851 and #22097 showed.

The change is fairly straightforwad, and documented in
   Note [Rewrite rules and inlining]
in GHC.Core.Opt.Simplify.Iteration.

Compile-times change, up and down a bit -- in some cases because
we get better specialisation.  But the payoff (more reliable
specialisation) is large.

Metrics: compile_time/bytes allocated
-----------------------------------------------
    T10421(normal)   +3.7% BAD
   T10421a(normal)   +5.5%
    T13253(normal)   +1.3%
      T14052(ghci)   +1.8%
    T15304(normal)   -1.4%
    T16577(normal)   +3.1% BAD
    T17516(normal)   +2.3%
    T17836(normal)   -1.9%
    T18223(normal)   -1.8%
     T8095(normal)   -1.3%
     T9961(normal)   +2.5% BAD

         geo. mean   +0.0%
         minimum     -1.9%
         maximum     +5.5%

Nofib results are (bytes allocated)

+-------------------------------++----------+
|                               ||tsv (rel) |
+===============================++==========+
|           imaginary/paraffins ||   +0.27% |
|                imaginary/rfib ||   -0.04% |
|                     real/anna ||   +0.02% |
|                      real/fem ||   -0.04% |
|                    real/fluid ||   +1.68% |
|                   real/gamteb ||   -0.34% |
|                       real/gg ||   +1.54% |
|                   real/hidden ||   -0.01% |
|                      real/hpg ||   -0.03% |
|                    real/infer ||   -0.03% |
|                   real/prolog ||   +0.02% |
|                  real/veritas ||   -0.47% |
|       shootout/fannkuch-redux ||   -0.03% |
|         shootout/k-nucleotide ||   -0.02% |
|               shootout/n-body ||   -0.06% |
|        shootout/spectral-norm ||   -0.01% |
|         spectral/cryptarithm2 ||   +1.25% |
|             spectral/fibheaps ||  +18.33% |
|           spectral/last-piece ||   -0.34% |
+===============================++==========+
|                     geom mean ||   +0.17% |

There are extensive notes in !8897 about the regressions.
Briefly

* fibheaps: there was a very delicately balanced inlining that
  tipped over the wrong way after this change.

* cryptarithm2 and paraffins are caused by #22274, which is
  a separate issue really.  (I.e. the right fix is *not* to
  make inlining "win" over rules.)

So I'm accepting these changes

Metric Increase:
    T10421
    T16577
    T9961

- - - - -
ed4b5885 by Joachim Breitner at 2022-10-10T23:16:11-04:00
Utils.JSON: do not escapeJsonString in ToJson String instance

as `escapeJsonString` is used in `renderJSON`, so the `JSString`
constructor is meant to carry the unescaped string.

- - - - -
fbb88740 by Matthew Pickering at 2022-10-11T12:48:45-04:00
Tidy implicit binds

We want to put implicit binds into fat interface files, so the easiest
thing to do seems to be to treat them uniformly with other binders.

- - - - -
e058b138 by Matthew Pickering at 2022-10-11T12:48:45-04:00
Interface Files with Core Definitions

This commit adds three new flags

* -fwrite-if-simplified-core: Writes the whole core program into an interface
  file
* -fbyte-code-and-object-code: Generate both byte code and object code
  when compiling a file
* -fprefer-byte-code: Prefer to use byte-code if it's available when
  running TH splices.

The goal for including the core bindings in an interface file is to be able to restart the compiler pipeline
at the point just after simplification and before code generation. Once compilation is
restarted then code can be created for the byte code backend.
This can significantly speed up
start-times for projects in GHCi. HLS already implements its own version of these extended interface
files for this reason.

Preferring to use byte-code means that we can avoid some potentially
expensive code generation steps (see #21700)

* Producing object code is much slower than producing bytecode, and normally you
  need to compile with `-dynamic-too` to produce code in the static and dynamic way, the
  dynamic way just for Template Haskell execution when using a dynamically linked compiler.

* Linking many large object files, which happens once per splice, can be quite
  expensive compared to linking bytecode.

And you can get GHC to compile the necessary byte code so
`-fprefer-byte-code` has access to it by using
`-fbyte-code-and-object-code`.

Fixes #21067

- - - - -
9789ea8e by Matthew Pickering at 2022-10-11T12:48:45-04:00
Teach -fno-code about -fprefer-byte-code

This patch teachs the code generation logic of -fno-code about
-fprefer-byte-code, so that if we need to generate code for a module
which prefers byte code, then we generate byte code rather than object
code.

We keep track separately which modules need object code and which byte
code and then enable the relevant code generation for each. Typically
the option will be enabled globally so one of these sets should be empty
and we will just turn on byte code or object code generation.

We also fix the bug where we would generate code for a module which
enables Template Haskell despite the fact it was unecessary.

Fixes #22016

- - - - -
caced757 by Simon Peyton Jones at 2022-10-11T12:49:21-04:00
Don't keep exit join points so much

We were religiously keeping exit join points throughout, which
had some bad effects (#21148, #22084).

This MR does two things:

* Arranges that exit join points are inhibited from inlining
  only in /one/ Simplifier pass (right after Exitification).

  See Note [Be selective about not-inlining exit join points]
  in GHC.Core.Opt.Exitify

  It's not a big deal, but it shaves 0.1% off compile times.

* Inline used-once non-recursive join points very aggressively
  Given join j x = rhs in
        joinrec k y = ....j x....

  where this is the only occurrence of `j`, we want to inline `j`.
  (Unless sm_keep_exits is on.)

  See Note [Inline used-once non-recursive join points] in
  GHC.Core.Opt.Simplify.Utils

  This is just a tidy-up really.  It doesn't change allocation, but
  getting rid of a binding is always good.

Very effect on nofib -- some up and down.

- - - - -
284cf387 by Simon Peyton Jones at 2022-10-11T12:49:21-04:00
Make SpecConstr bale out less often

When doing performance debugging on #22084 / !8901, I found that the
algorithm in SpecConstr.decreaseSpecCount was so aggressive that if
there were /more/ specialisations available for an outer function,
that could more or less kill off specialisation for an /inner/
function.  (An example was in nofib/spectral/fibheaps.)

This patch makes it a bit more aggressive, by dividing by 2, rather
than by the number of outer specialisations.

This makes the program bigger, temporarily:

   T19695(normal) ghc/alloc   +11.3% BAD

because we get more specialisation.  But lots of other programs
compile a bit faster and the geometric mean in perf/compiler
is 0.0%.

Metric Increase:
    T19695

- - - - -
66af1399 by Cheng Shao at 2022-10-11T12:49:59-04:00
CmmToC: emit explicit tail calls when the C compiler supports it

Clang 13+ supports annotating a return statement using the musttail
attribute, which guarantees that it lowers to a tail call if compilation
succeeds.

This patch takes advantage of that feature for the unregisterised code
generator. The configure script tests availability of the musttail
attribute, if it's available, the Cmm tail calls will become C tail
calls that avoids the mini interpreter trampoline overhead. Nothing is
affected if the musttail attribute is not supported.

Clang documentation:
https://clang.llvm.org/docs/AttributeReference.html#musttail

- - - - -
7f0decd5 by Matthew Pickering at 2022-10-11T12:50:40-04:00
Don't include BufPos in interface files

Ticket #22162 pointed out that the build directory was leaking into the
ABI hash of a module because the BufPos depended on the location of the
build tree.

BufPos is only used in GHC.Parser.PostProcess.Haddock, and the
information doesn't need to be propagated outside the context of a
module.

Fixes #22162

- - - - -
dce9f320 by Cheng Shao at 2022-10-11T12:51:19-04:00
CLabel: fix isInfoTableLabel

isInfoTableLabel does not take Cmm info table into account. This patch is required for data section layout of wasm32 NCG to work.

- - - - -
da679f2e by Bodigrim at 2022-10-11T18:02:59-04:00
Extend documentation for Data.List, mostly wrt infinite lists

- - - - -
9c099387 by jwaldmann at 2022-10-11T18:02:59-04:00
Expand comment for Data.List.permutations
- - - - -
d3863cb7 by Bodigrim at 2022-10-11T18:03:37-04:00
ByteArray# is unlifted, not unboxed

- - - - -
f6260e8b by Ben Gamari at 2022-10-11T23:45:10-04:00
rts: Add missing declaration of stg_noDuplicate

- - - - -
69ccec2c by Ben Gamari at 2022-10-11T23:45:10-04:00
base: Move CString, CStringLen to GHC.Foreign

- - - - -
f6e8feb4 by Ben Gamari at 2022-10-11T23:45:10-04:00
base: Move IPE helpers to GHC.InfoProv

- - - - -
866c736e by Ben Gamari at 2022-10-11T23:45:10-04:00
rts: Refactor IPE tracing support

- - - - -
6b0d2022 by Ben Gamari at 2022-10-11T23:45:10-04:00
Refactor IPE initialization

Here we refactor the representation of info table provenance information
in object code to significantly reduce its size and link-time impact.
Specifically, we deduplicate strings and represent them as 32-bit
offsets into a common string table.

In addition, we rework the registration logic to eliminate allocation
from the registration path, which is run from a static initializer where
things like allocation are technically undefined behavior (although it
did previously seem to work). For similar reasons we eliminate lock
usage from registration path, instead relying on atomic CAS.

Closes #22077.

- - - - -
9b572d54 by Ben Gamari at 2022-10-11T23:45:10-04:00
Separate IPE source file from span

The source file name can very often be shared across many IPE entries
whereas the source coordinates are generally unique. Separate the two to
exploit sharing of the former.

- - - - -
27978ceb by Krzysztof Gogolewski at 2022-10-11T23:45:46-04:00
Make Cmm Lint messages use dump style

Lint errors indicate an internal error in GHC, so it makes sense to use
it instead of the user style. This is consistent with Core Lint and STG Lint:

https://gitlab.haskell.org/ghc/ghc/-/blob/22096652/compiler/GHC/Core/Lint.hs#L429

https://gitlab.haskell.org/ghc/ghc/-/blob/22096652/compiler/GHC/Stg/Lint.hs#L144

Fixes #22218.

- - - - -
64a390d9 by Bryan Richter at 2022-10-12T09:52:51+03:00
Mark T7919 as fragile

On x86_64-linux, T7919 timed out ~30 times during July 2022.

And again ~30 times in September 2022.

- - - - -
481467a5 by Ben Gamari at 2022-10-12T08:08:37-04:00
rts: Don't hint inlining of appendToRunQueue

These hints have resulted in compile-time warnings due to failed
inlinings for quite some time. Moreover, it's quite unlikely that
inlining them is all that beneficial given that they are rather sizeable
functions.

Resolves #22280.

- - - - -
81915089 by Curran McConnell at 2022-10-12T16:32:26-04:00
remove name shadowing

- - - - -
626652f7 by Tamar Christina at 2022-10-12T16:33:13-04:00
winio: do not re-translate input when handle is uncooked

- - - - -
5172789a by Charles Taylor at 2022-10-12T16:33:57-04:00
Unrestricted OverloadedLabels (#11671)

Implements GHC proposal:
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst

- - - - -
ce293908 by Andreas Klebinger at 2022-10-13T05:58:19-04:00
Add a perf test for the generics code pattern from #21839.

This code showed a strong shift between compile time (got worse) and
run time (got a lot better) recently which is perfectly acceptable.

However it wasn't clear why the compile time regression was happening
initially so I'm adding this test to make it easier to track such changes
in the future.

- - - - -
78ab7afe by Ben Gamari at 2022-10-13T05:58:56-04:00
rts/linker: Consolidate initializer/finalizer handling

Here we extend our treatment of initializer/finalizer priorities to
include ELF and in so doing refactor things to share the implementation
with PEi386. As well, I fix a subtle misconception of the ordering
behavior for `.ctors`.

Fixes #21847.

- - - - -
44692713 by Ben Gamari at 2022-10-13T05:58:56-04:00
rts/linker: Add support for .fini sections

- - - - -
beebf546 by Simon Hengel at 2022-10-13T05:59:37-04:00
Update phases.rst

(the name of the original source file is $1, not $2)
- - - - -
eda6c05e by Finley McIlwaine at 2022-10-13T06:00:17-04:00
Clearer error msg for newtype GADTs with defaulted kind

When a newtype introduces GADT eq_specs due to a defaulted
RuntimeRep, we detect this and print the error message with
explicit kinds.

This also refactors newtype type checking to use the new
diagnostic infra.

Fixes #21447

- - - - -
43ab435a by Pierre Le Marre at 2022-10-14T07:45:43-04:00
Add standard Unicode case predicates isUpperCase and isLowerCase.

These predicates use the standard Unicode case properties and are more intuitive than isUpper and isLower.

Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/90#issuecomment-1276649403.

Fixes #14589

- - - - -
aec5a443 by Bodigrim at 2022-10-14T07:46:21-04:00
Add type signatures in where-clause of Data.List.permutations

The type of interleave' is very much revealing, otherwise it's extremely tough to decipher.

- - - - -
ee0deb80 by Ben Gamari at 2022-10-14T18:29:20-04:00
rts: Use pthread_setname_np correctly on Darwin

As noted in #22206, pthread_setname_np on Darwin only supports
setting the name of the calling thread. Consequently we must introduce
a trampoline which first sets the thread name before entering the thread
entrypoint.
- - - - -
8eff62a4 by Ben Gamari at 2022-10-14T18:29:57-04:00
testsuite: Add test for #22282

This will complement mpickering's more general port of foundation's
numerical testsuite, providing a test for the specific case found
in #22282.

- - - - -
62a55001 by Ben Gamari at 2022-10-14T18:29:57-04:00
ncg/aarch64: Fix sub-word sign extension yet again

In adc7f108141a973b6dcb02a7836eed65d61230e8 we fixed a number of issues
to do with sign extension in the AArch64 NCG found by ghc/test-primops>.
However, this patch made a critical error, assuming that getSomeReg
would allocate a fresh register for the result of its evaluation.
However, this is not the case as `getSomeReg (CmmReg r) == r`.
Consequently, any mutation of the register returned by `getSomeReg` may
have unwanted side-effects on other expressions also mentioning `r`. In
the fix listed above, this manifested as the registers containing the
operands of binary arithmetic operations being incorrectly
sign-extended. This resulted in #22282.

Sadly, the rather simple structure of the tests generated
by `test-primops` meant that this particular case was not exercised.
Even more surprisingly, none of our testsuite caught this case.

Here we fix this by ensuring that intermediate sign extension is
performed in a fresh register.

Fixes #22282.

- - - - -
0af7d815 by Josh Meredith at 2022-10-16T18:18:44-04:00
Add ghcjs changes to deriveConstants:

- change String targetOS option in deriveConstants to an enum
- separate out getWantedGHSJS, removing generated c file in this path

- - - - -
9e06fc3d by doyougnu at 2022-10-16T18:18:44-04:00
Add JavaScript code generator

Adapt code generator of GHCJS to GHC head. Currently it is only enabled
with the hidden -fjavascript flag. It produces .o files that can't be
used yet except by GHCJS's linker.

Codegen: doc

Codegen: correctly return linkable object

Now we can build a static library (-staticlib)

Codegen: doc genLit

Codegen: use assignAll

Codegen: introduce TypedExpr

Refactor assignAll et al, add documentation

Codegen: minor changes

Doc

- - - - -
515adcd6 by doyougnu at 2022-10-16T18:18:45-04:00
Add JS.Rts

JS.Rts: compiles

reword: progress on RtsTypes

StgToJS.Config: add SDoc Context

JSRts: move ppr, workaround def type

JSRts.Types: compiles

JS.Rts: closer to compiling

JS.Rts: move jsIdIdent' to StgToJS.Monad

JS.Rts: remove unused predicates

JS: cleanup, comment sections, math funcs to Make

JS.Rts.Types: compiles

StgToJS.Expr: fix compilation errors

StgToJS.DataCon: move initClosure

JS.Rts: remove Alloc module

JS.Rts: initalize Rts module, remove redundant fs

JS: init Rts.Alloc move initClosure

JS.Apply: unwinding combinators in progress

JS: add helpers and fixmes

JS.Rts.Apply: no more e's, add closure, reg helper

StgToJS: add ToStat instance ClosureInfo

JS.Rts.Apply: closer to compiling

JS.Rts.Apply: more removal of #

JS.Rts.Apply: (#) removed

JS.Rts.Apply: compiles

JS.Rts.Rts: just pretty printing left

JS.Rts: Add Notes

JS.Rts: add file headers and notes

JS.Rts.Rts: fixing stringy issues

JS.Rts.Rts: compiles

JS.Rts.Rts: fix non-exhaustive patterns warnings

- - - - -
676c613c by Sylvain Henry at 2022-10-16T18:18:45-04:00
Doc has been moved into GHC.StgToJs top-level module

- - - - -
2daeff7f by Sylvain Henry at 2022-10-16T18:18:45-04:00
JS.Rts; refactoring and move to StgToJS

* add closure manipulation helpers and use them in Apply
* add cache (Array) for pre-generated PAP names
* reduce line length:
  * use BlockArguments instead of parens
  * remove implicit mconcat in jVar's body

Rts: more refactorings

Rts: move into StgToJS hierarchy

- - - - -
3a8b0bde by Sylvain Henry at 2022-10-16T18:18:45-04:00
JS: cleanup, renaming, better module layout

Various degrees of cleanup adapting GHCJS to GHC. We move several
functions to CoreUtils, remove duplication between the JS.Rts.Apply and
Apply module and factor out closure related code into a Closure module
for cohesion.

Deduplicate code between Rts.Apply and Apply

Move might_be_a_function into CoreUtils

Factorize closure stuff into Closure module

Rename closureExtra into closureField

Minor renamings, comments...

- - - - -
0dcda6ea by Sylvain Henry at 2022-10-16T18:18:45-04:00
JS.Backend: add FFI code but don't implement yet

FFI: don't crash on JavaScript foreign imports

Note that they are still not desugared properly!!

But the following cmd doesn't crash anymore:

  ghc -fjavascript Test.hs -fforce-recomp -ddump-tc -fno-code -ddump-ds

FFI: adapt GHCJS desugarer

FFI: support direct application

The following example:

  foo :: Int# -> Int#
  foo = add 50000#

  foreign import javascript
    "(function(x,y) { return (x + y) })"
    add :: Int# -> Int# -> Int#

is compiled into an application like this:

  var h$mainZCMzifoozur2_e;
  h$mainZCMzifoozur2_e = (function()
                            {
                            var h$mainZCMziaddzur1;
                            h$mainZCMziaddzur1 = h$r1.d1;
                            var h$$mainZCMzietazuB0_8KXnScrCjF5;
                            h$$mainZCMzietazuB0_8KXnScrCjF5 = h$r2;
                            h$r3 = h$$mainZCMzietazuB0_8KXnScrCjF5;
                            h$r2 = 50000;
                            h$r1 = h$mainZCMziaddzur1;
                            return h$ap_2_2_fast();
                            return h$rs();
                          });
  var h$mainZCMziaddzur1_e;
  h$mainZCMziaddzur1_e = (function()
                            {
                            var h$$mainZCMzidszusAk_236l8r0P8S9;
                            h$$mainZCMzidszusAk_236l8r0P8S9 = h$r2;
                            var h$$mainZCMzids1zusAl_336l8r0P8S9;
                            h$$mainZCMzids1zusAl_336l8r0P8S9 = h$r3;
                            var h$$mainZCM_2;
                            var h$$mainZCMziwildzusAn_536l8r0P8S9;
                            try
                              {
                              h$$mainZCMziwildzusAn_536l8r0P8S9 = (function(x,y) { return (x + y) })(h$$mainZCMzidszusAk_236l8r0P8S9, h$$mainZCMzids1zusAl_336l8r0P8S9)
                            }
                            catch(except)
                              {
                              return h$throwJSException(except)
                            };
                            var h$$mainZCMzids3zusAp_736l8r0P8S9;
                            h$$mainZCMzids3zusAp_736l8r0P8S9 = h$$mainZCMziwildzusAn_536l8r0P8S9;
                            h$r1 = h$$mainZCMzids3zusAp_736l8r0P8S9;
                            return h$rs();
                          });

FFI: correctly dispatch for foreign exports too

FFI: move C FFI desugaring into its own module

FFI: avoid DynFlags in toJsName (copy of toCName)

- - - - -
a663c436 by Sylvain Henry at 2022-10-16T18:18:45-04:00
Configure: preliminary support for triple js-unknown-ghcjs

- - - - -
5e229331 by Sylvain Henry at 2022-10-16T18:18:46-04:00
Driver: enable JS backend by default for JS arch

- - - - -
a6de7c87 by doyougnu at 2022-10-16T18:18:46-04:00
JS.Backend: Add JS specific Linker

JS: initialize Linker, DynamicLinking

JS.Printer: adapted to GHC Head

JS.Printer: some cleanup and init Printer

StgToJS.Printer: Compiles

JS.Linker: Add types, expose JS keywords

JS.Syntax: add Binary instance on Ident's

JS.Linker: Migrate more Types to Data.Binary

JS.Linker.Types: compiles and adapted to GHC Head

JS.Linker.Types: compiles

JS.Linker.Types: add UseBase type

JS.Linker: Comments and Cleanup

JS.Linker.Types: add TH types, Env type, DepsLoc

JS.Linker: more FIXMEs numerous Linker fixes

JS.Linker: removed Text references

JS.UnitUtils: add package related helper functions

JS.Linker: more DynFlags removal

JS.Linker: Time for semantic errors

JS.Linker: DynFlags finally removed

JS.Linker: 107 compile errors to go

JS.Linker.Utils: initialized, adapted to GHC Head

JS.Linker.Utils: initialize Utils module

JS.Linker.Utils: more utils

JS.Rts: move rtsText to Rts

JS.Linker: linkerStats implemented

JS.Compactor: compiles, adapted to GHC Head

JS.Compactor: have to retrofit compact for linker

JS.Linker.Compactor: unwinding lenses

JS.Linker.Compactor: comments over addItem

JS.Linker.Compactor: Lenses removed

JS.Linker.Compactor: SHA256 removed

JS.Linker.Compactor: only missing instances left

JS.Linker.Compactor: compiles

JS.Linker: compiles, adapted to ghc Head

JS.Linker: More progress

JS.Linker: link in memory compiles

JS.Linker: just shims left

JS.Linker.DynamicLinking compiles: adapted to head

JS.Linker.DynamicLinking: initialization

JS.Linker.DynamicLinking: compiles up to Variants

JS.Variants: initialize

JS.Linker: numerous and various fixes

JS.Linker.DynamicLinking: only small errors left

JS.Linker.Archive: compiles, adapted to GHC Head

JS.Linker: initialize Archive compat module

JS.Linker.Archive: minor fixes

JS.Linker.DynamicLinking: compiles

JS.Linker: cleanup, remove Variants, add comments

fixup: more cleanup

JS.Linker: more cleanup and comments

- - - - -
4e236651 by Sylvain Henry at 2022-10-16T18:18:46-04:00
Minor panic fix

- - - - -
83ddb29d by Sylvain Henry at 2022-10-16T18:18:46-04:00
Linker: fix stage2 build

- - - - -
d31d68f0 by Sylvain Henry at 2022-10-16T18:18:47-04:00
Configure: Add support fo JS as unregistered ABI

Configure: detect emscripten tools

e.g. on ArchLinux:

  EMSDK=/usr/lib/emscripten EMSDK_LLVM=/opt/emscripten-llvm ./configure --target=js-unknown-ghcjs

Configure: detect nm tool too, required by Hadrian

Configure: make StgToJS use non-unregisterised ABI

It should probably be a third kind of ABI...

- - - - -
d182986c by doyougnu at 2022-10-16T18:18:47-04:00
JS.Linker: Hook up to GHC.Driver.Pipeline

JS.Linker.Types: Add newGhcjsEnv function

JS.UnitUtils: fix encodeModule api

JS.Linker: more removal of HscEnv

JS.Linker: hooked into GHC.Driver.Pipeline

- - - - -
6715f6f2 by Sylvain Henry at 2022-10-16T18:20:13-04:00
VERY WIP Hadrian/rts fixes

export EMSDK_LLVM=/opt/emscripten-llvm
export EMSDK=/usr/lib/emscripten
export PATH=./inplace/ghcjs_toolchain/bin:$PATH

./configure --target=js-unknown-ghcjs
./hadrian/build --flavour=quick-js -j --bignum=native --docs=none -V

- - - - -
f08f0f32 by Sylvain Henry at 2022-10-16T18:21:17-04:00
Force creation of rts library with dummy file

- - - - -
34db2722 by Sylvain Henry at 2022-10-16T18:21:21-04:00
ghc-prim: avoid building C files

- - - - -
eb8e0f62 by Sylvain Henry at 2022-10-16T18:21:21-04:00
Hadrian: disable -fllvm

- - - - -
f0c87f73 by Sylvain Henry at 2022-10-16T18:21:21-04:00
JS: fix caches

Note that the fact that we need index 0 may hide another issue...

- - - - -
86943537 by Sylvain Henry at 2022-10-16T18:21:21-04:00
codegen: enhance genCon debug message

- - - - -
8478a31c by Sylvain Henry at 2022-10-16T18:21:22-04:00
RTS: fix stupid comment

- - - - -
149f74d6 by Sylvain Henry at 2022-10-16T18:21:22-04:00
RTS: embed headers

- - - - -
3d3dee8f by Sylvain Henry at 2022-10-16T18:21:22-04:00
JS.StgToJS: add documentation header for JS Types

- - - - -
dfdaa446 by Sylvain Henry at 2022-10-16T18:21:22-04:00
CodeGen: refactor ExprCtx code

- - - - -
17b920ba by Sylvain Henry at 2022-10-16T18:21:22-04:00
CodeGen: cache LNE frame size

- - - - -
4161b4a1 by doyougnu at 2022-10-16T18:21:22-04:00
JS.Types: Add Outputable for TypedExpr

- - - - -
c1aa4ce2 by doyougnu at 2022-10-16T18:21:23-04:00
JS.CoreUtils: handle IOPort case

- - - - -
2502af33 by doyougnu at 2022-10-16T18:21:23-04:00
JS.Expr: Fix unhandled datacon for RuntimeRep

- - - - -
ef25292f by doyougnu at 2022-10-16T18:21:23-04:00
JS.Literals: Adapt genLit to new Literal domain

- - - - -
ab95e5fc by Sylvain Henry at 2022-10-16T18:21:23-04:00
RTS: expose more headers (required to build base)

- - - - -
b71213ba by Sylvain Henry at 2022-10-16T18:21:23-04:00
Base: don't build C and Cmm sources with ghcjs

- - - - -
a5736e2c by Sylvain Henry at 2022-10-16T18:21:24-04:00
Tentatively set NO_REGS for JS platforms

- - - - -
d9437c3c by Sylvain Henry at 2022-10-16T18:21:24-04:00
CodeGen: output LitRubbish as null JS values

- - - - -
d401333a by Sylvain Henry at 2022-10-16T18:21:24-04:00
base: disable forkOS and bound thread machinery

- - - - -
43d0410f by Sylvain Henry at 2022-10-16T18:21:24-04:00
CodeGen: support StackSnapshot# in primTypeVt

- - - - -
e3422df5 by Sylvain Henry at 2022-10-16T18:21:24-04:00
CodeGen: better debug message for assignCoerce1

- - - - -
a8bd6d23 by Sylvain Henry at 2022-10-16T18:21:25-04:00
Misc: enable HasDebugCallStack for zipWithEqual*

- - - - -
11254f30 by Sylvain Henry at 2022-10-16T18:21:25-04:00
CodeGen: remove useless imports

- - - - -
7df18064 by Sylvain Henry at 2022-10-16T18:21:25-04:00
Stg: expose pprStgAlt

- - - - -
e83f5be3 by Sylvain Henry at 2022-10-16T18:21:25-04:00
CodeGen: restore assignAll (instead of assignAllEqual)

- - - - -
3330d418 by Sylvain Henry at 2022-10-16T18:21:25-04:00
CodeGen: handle proxy#

- - - - -
e5a917e7 by doyougnu at 2022-10-16T18:21:26-04:00
ghc-heap: Don't compile Cmm file for JS-Backend

- - - - -
46fdd7d0 by doyougnu at 2022-10-16T18:21:26-04:00
Driver.Main: minor refactor do_code_gen

To clearly separate the JS-Backend from any other backend

- - - - -
48a84962 by Sylvain Henry at 2022-10-16T18:21:26-04:00
Configure: fix echo on Mac, add ghcjs target OS

- - - - -
245bde6e by Sylvain Henry at 2022-10-16T18:21:26-04:00
Configure: fix previous commit

- - - - -
661abd69 by Luite Stegeman at 2022-10-16T18:21:26-04:00
fix package name in module name field of system dependencies

- - - - -
376b551e by Luite Stegeman at 2022-10-16T18:21:27-04:00
fix duplicate module name in symbols

- - - - -
5a03af16 by doyougnu at 2022-10-16T18:21:27-04:00
GHCi.FFI: ignore ffi.h and friends for js-backend

- - - - -
ddca965a by Sylvain Henry at 2022-10-16T18:21:27-04:00
RTS: fix build of native rts

- - - - -
d14a6e3d by Sylvain Henry at 2022-10-16T18:21:27-04:00
Remove temporary -fjavascript flag

- - - - -
b264e797 by Sylvain Henry at 2022-10-16T18:21:27-04:00
Codegen: fix symbol names ppr

- - - - -
1dd46a7c by Sylvain Henry at 2022-10-16T18:21:28-04:00
Outputable: add ShortText instance

- - - - -
28d4e376 by Sylvain Henry at 2022-10-16T18:21:28-04:00
Linker: enhance debugging message

- - - - -
328a74db by Sylvain Henry at 2022-10-16T18:21:28-04:00
Remove unused ghcjs unit related code

- - - - -
d94b3c97 by Sylvain Henry at 2022-10-16T18:21:28-04:00
ghci: Avoid unused-xyz warnings

- - - - -
f76102f0 by Sylvain Henry at 2022-10-16T18:21:28-04:00
Linker: remove wiring of ghcjs-prim and ghcjs-th

They will be replaced by ghc-prim, base, template-haskell, etc.

- - - - -
89a66d1a by Sylvain Henry at 2022-10-16T18:21:29-04:00
Add outputable instance for Deps

- - - - -
5a26bff4 by doyougnu at 2022-10-16T18:21:29-04:00
Docs: JS.Syntax, JS.Make docs done

JS-backend: Add documentation headers

Docs: JS.Syntax done

Docs: JS.Make done

Docs: JS.Make JS.Syntax refined a bit

- - - - -
807ad2d9 by Sylvain Henry at 2022-10-16T18:21:29-04:00
Rename u_env into unit_env (more common)

- - - - -
6b1a9533 by Sylvain Henry at 2022-10-16T18:21:29-04:00
Linker: deduplication + fixes

- deduplicate code that was copied from old GHC
- explicitly add preloadUnits to the link
- avoid calling getShims

- - - - -
437a6b37 by Sylvain Henry at 2022-10-16T18:21:29-04:00
Linker: reenable packStrings (not yet implemented though)

- - - - -
032c2992 by Sylvain Henry at 2022-10-16T18:21:30-04:00
ShortText: add singleton

- - - - -
8bf562e6 by Sylvain Henry at 2022-10-16T18:21:30-04:00
Linker: force less efficient (but working) static encoding

- - - - -
10f5b427 by Luite Stegeman at 2022-10-16T18:21:30-04:00
add GHCJS modules to base package

- - - - -
ed2d3588 by Sylvain Henry at 2022-10-16T18:21:30-04:00
Linker: remove JS Shims,tiny GHC.Linker refactor

- - - - -
43674ddb by doyougnu at 2022-10-16T18:21:30-04:00
Hadrian: QuickJS ways [] --> Set

- - - - -
a9140f89 by doyougnu at 2022-10-16T18:21:31-04:00
JS-Backend: rebased to master 468f919b

First rebase of the JS-Backend. This rebase includes the JS backend
combined with !7442 (new backend design). Unfortunately we have to short
circuit the new backend design because the JS backend takes over after
STG and not after StgToCmm.

What's working:
  - hadrian builds JS backend
  - JS backend outputs .js files and "links" them

What still has to be done:
   - JS backend is missing core js libraries as we add these we
   discover bugs in the linker and js rts.

- - - - -
ce312121 by doyougnu at 2022-10-16T18:21:31-04:00
JS: silence haddock warnings

JS Backend: remove misc. warnings

- - - - -
febcfef4 by doyougnu at 2022-10-16T18:21:31-04:00
JS Backend: ghcjs_HOST_OS --> js_HOST_ARCH

- - - - -
406c1264 by Sylvain Henry at 2022-10-16T18:21:31-04:00
JS.Linker: add shims

GHCJS uses JS files for primitive things like the GC and RTS. We call
these JS files "shims". This sequence of commits adds shims from JS and
includes them for linking. In addition the shim directory is controlled
via an evironment variable JS_RTS_PATH...at least for now.

Linker: implement tryReadShimFile

Linker: link with shims provided via an env variable

Use JS_RTS_PATH to provide a directory into which .js and .js.pp files
will be linked into rts.js

JS.Linker: add js dir at root, fix js cpp includes

JS.gc.pp: remove variadic macro

JS.RTS: add rts JS shims files, remove shim CPP

RTS: remove the need for rts.h and add rts JS files

rts.h only contained a few constants duplicated in the codegen. Let's
use the Haskell version as the single source of truth and pass defined
values explicitly to cpp command line ("-DXYZ=abc" arguments).

Also switch from "raw" (use_cpp_and_not_cc_dash_E = True) to the
opposite: in both case we call "cc -E" (meh), but with False the
preprocessor doesn't choke one varargs in macros.

RTS: remove integer.js.pp

We use the native ghc-bignum backend, so we don't need the GMP
compatible JS code.

In addition, this code was failing to run as it requires the JSBN
(https://www.npmjs.com/package/jsbn) "Javascript big number" library,
which we don't necessarily have installed.

RTS: fix typo in field name

RTS: generate CPP macros in Haskell

RTS: share common CPP def into CAFs

- - - - -
62117a4e by Sylvain Henry at 2022-10-16T18:21:32-04:00
CPP: disable line markers

CPP: move option before input filename (to be squashed)

- - - - -
bedc8c1a by Sylvain Henry at 2022-10-16T18:21:32-04:00
Linker: add more types

Some cleanup

Enhance and fix LinkerStats

Document and refactor renderLinker

Split collectDeps

Fix collectDeps

Fix linker stats rendering

Remove unused seqListSpine

It isn't used in ghcjs either

- - - - -
84302e8b by Sylvain Henry at 2022-10-16T18:21:32-04:00
Add some missing primops (Word32,Int32)

Also fix the rendering of missing primops (they must be z-encoded to
avoid having a "#" in their JS name)

- - - - -
8715c452 by Sylvain Henry at 2022-10-16T18:21:32-04:00
FFI: desugar every foreign import/export in JS with JS backend

It means we also desugar CApi calls into JS.

It's probably wrong but instead of generating invalid JS we will only
get the failure at runtime when we will use the function.

fixup

- - - - -
3256d467 by doyougnu at 2022-10-16T18:21:32-04:00
JS.Linker: remove dflags includePath workaround.

We implemented a workaround for shims that modified the dynflags
includePaths so that the JS backend would find the rts.h file during CPP
of shims. Since aebcca98 this is no longer required because we've
removed the need for rts.h completely. Thus, this commit reverts that
modification.

- - - - -
1514c6a8 by Sylvain Henry at 2022-10-16T18:21:33-04:00
Temporarily wire-in base's shim

Use JS_BASE_PATH env var to set base's shim directory (js_base for now)

Also minor other changes

base: fix encoding for JS arch

- - - - -
9bca70f5 by Sylvain Henry at 2022-10-16T18:21:33-04:00
Add primops

Add primop

- - - - -
876ed64b by doyougnu at 2022-10-16T18:21:33-04:00
Make Shims type, refactor JS Linker

This commit:
 - Adds a proper Shim type and associated utilities. These utitlies are
 purposefully limited to ensure the ShimLbl tag is preserved thus
 guarenteeing shim ordering at link time.
 - Refactors the JS backend linker to use this ordering and Shim API.
 The ordering is not correct (yet!) but with this API its much easier to
 triage, experiment and diagnose link time issues.

Refactor linker to compile time shim ordering

- - - - -
832a5f70 by doyougnu at 2022-10-16T18:21:33-04:00
Base: Adapt primitives to JS backend, add base.js

- - - - -
3e8abd83 by doyougnu at 2022-10-16T18:21:33-04:00
Base: Remove binding forms in JS ffi

- - - - -
af93720c by Josh Meredith at 2022-10-16T18:21:34-04:00
Replace GHCJS Objectable with GHC Binary

- - - - -
2e1b7fa0 by Sylvain Henry at 2022-10-16T18:21:34-04:00
Binary: remove unused Map instance

- - - - -
74971521 by Sylvain Henry at 2022-10-16T18:21:34-04:00
CodeGen: Add export list

- - - - -
b78a657d by Sylvain Henry at 2022-10-16T18:21:34-04:00
Primops: add some Int64/Word64 primops

- - - - -
74fbd756 by Sylvain Henry at 2022-10-16T18:21:35-04:00
base: fix one ffi import

- - - - -
dcba1a41 by doyougnu at 2022-10-16T18:21:35-04:00
base: CPP for JS-backend, adapt write in base shim

This commit ports over each CPP directive from GHCJS to base. In
addition, it adds struct.js.pp to Base shim directory and modifies
h$base_write to always take 6 arguments. Thereby avoiding errors such as
"c(bytesWritten) is not a function". The missing parameter was the file
descriptor object, fdo, which was looked up in the function itself and
is now passed through to comport with the FFI expectations.

- - - - -
9470a026 by doyougnu at 2022-10-16T18:21:35-04:00
fixup: remove redundant struct.js.pp in js_base

- - - - -
c60a9588 by doyougnu at 2022-10-16T18:21:35-04:00
JS.Linker: enable linker RTS symbols

- - - - -
6c15dd3e by doyougnu at 2022-10-16T18:21:35-04:00
base.GHCJS: adapt Prim to direct call FFI format

- - - - -
dfcf1b03 by doyougnu at 2022-10-16T18:21:36-04:00
Linker: Load JSVal from base not ghc-prim

- - - - -
779ae1dc by doyougnu at 2022-10-16T18:21:36-04:00
fixup: caught one more reference to JSVal in prim

- - - - -
952bd629 by Sylvain Henry at 2022-10-16T18:21:36-04:00
base: match on js arch , not ghcjs os

- - - - -
40829546 by Sylvain Henry at 2022-10-16T18:21:36-04:00
Fix MK_JSVAL

- - - - -
ec0e53dd by doyougnu at 2022-10-16T18:21:36-04:00
Prim: cleanup comments

- - - - -
777be65c by doyougnu at 2022-10-16T18:21:36-04:00
JS.Prim: add Int64 PrimOps

- - - - -
cfeb6859 by Sylvain Henry at 2022-10-16T18:21:37-04:00
Vendor MD5 lib

- - - - -
8cdd8d78 by Sylvain Henry at 2022-10-16T18:21:37-04:00
More 64-bit primops

- - - - -
24241365 by Sylvain Henry at 2022-10-16T18:21:37-04:00
CodeGen: use if10 helper

- - - - -
6ee095d5 by Sylvain Henry at 2022-10-16T18:21:37-04:00
Ppr: fix selector to avoid adding a newline

- - - - -
1ccf32e9 by doyougnu at 2022-10-16T18:21:37-04:00
base: GHCJS.Prim make ffi imports use anon funcs

- - - - -
a65f243e by Sylvain Henry at 2022-10-16T18:21:38-04:00
Linker: disable invalid constructors again

- - - - -
ce3b3cbf by Sylvain Henry at 2022-10-16T18:21:38-04:00
More 64-bits primops

- - - - -
6860b03e by Sylvain Henry at 2022-10-16T18:21:38-04:00
Fix base_write function

- - - - -
8607afd0 by Sylvain Henry at 2022-10-16T18:21:38-04:00
Fix base_write for 32-bit size_t

- - - - -
e87f2a3c by Sylvain Henry at 2022-10-16T18:21:38-04:00
Configure: fix detection of the target toolchain

- - - - -
cd89532a by Sylvain Henry at 2022-10-16T18:21:39-04:00
Remove js_base directory

- - - - -
b72f9498 by Sylvain Henry at 2022-10-16T18:21:39-04:00
Kill Node when the main loop reports an unhandled exception

- - - - -
9e412804 by Sylvain Henry at 2022-10-16T18:21:39-04:00
CodeGen: preparation to make match on primops complete

- - - - -
5414fe7d by Sylvain Henry at 2022-10-16T18:21:39-04:00
Primops: fix Compact primops

- - - - -
476b1adb by Sylvain Henry at 2022-10-16T18:21:39-04:00
Ignore result arity for some exception primops

- - - - -
a30c0776 by Sylvain Henry at 2022-10-16T18:21:40-04:00
Fix more primops. Bump array submodule!

- - - - -
7bf62853 by Sylvain Henry at 2022-10-16T18:21:40-04:00
Compact: fix return of 3 values

- - - - -
35a179b8 by Sylvain Henry at 2022-10-16T18:21:40-04:00
Configure: switch to absolute path

- - - - -
29b504bf by Sylvain Henry at 2022-10-16T18:21:40-04:00
Add a few primops

- - - - -
7af450bc by Sylvain Henry at 2022-10-16T18:21:40-04:00
Primop: implement WordAdd2

- - - - -
9bdc0735 by Luite Stegeman at 2022-10-16T18:21:40-04:00
quick fix for uTypeVt and typePrimRep panics

this may cause other panics, a full fix will require a bit
more rework and probably removal of VarType

- - - - -
b36d7df3 by Josh Meredith at 2022-10-16T18:21:41-04:00
Replace ShortText with (Lexical)FastString in GHCJS backend

- - - - -
59e648ee by Sylvain Henry at 2022-10-16T18:21:41-04:00
Primops: add arithmetic ops

Primops: add decodeDoubleInt64 back

Primop: added timesInt2#

Primop: add mulWord32 and mul2Word32

- - - - -
4983b5d5 by Sylvain Henry at 2022-10-16T18:21:41-04:00
Reduce dependency on goog

- - - - -
6b4ca19d by Sylvain Henry at 2022-10-16T18:21:41-04:00
Primop: implement quotWord32, remWord32, and quotRemWord32

- - - - -
e83117f4 by Sylvain Henry at 2022-10-16T18:21:42-04:00
Primop: Implement quotRem2Word32, misc fixes

Primop: implement quotRem2Word32

Primop: fix timesInt2#

Primop: fix some shifting primops

- - - - -
bb1c1c29 by Sylvain Henry at 2022-10-16T18:21:42-04:00
Fix bug in upd_frame

I've introduced this bug when I've refactored the code to use helpers to
assign closures.

- - - - -
7a4f1de9 by Sylvain Henry at 2022-10-16T18:21:42-04:00
Primop: throw an exception for unimplemented primops

- - - - -
abe014a9 by Sylvain Henry at 2022-10-16T18:21:42-04:00
Primop: fix remWord32

- - - - -
d572ca98 by Josh Meredith at 2022-10-16T18:21:42-04:00
Configure: add EMSDK_BIN, match emsdk expectations

Change EMSDK vars to match emscripten/emsdk_env.sh definitions

Add EMSDK_BIN environment variable to configure

- - - - -
930ea3f8 by Sylvain Henry at 2022-10-16T18:21:43-04:00
resultSize: correctly handle Void#

- - - - -
aec6ae42 by Sylvain Henry at 2022-10-16T18:21:43-04:00
Primop: fix Sized test, more shifting fixes

Primop: ensure that we return u32 values for word primops

Also a refactoring from i3 to i32 for clarity.

Primop: add/fix more shifting primops

Primops: fix Sized test!

- - - - -
02d9bbaa by Sylvain Henry at 2022-10-16T18:21:43-04:00
StgToJS.Apply: Docs

Doc

Doc

- - - - -
ee48010b by Josh Meredith at 2022-10-16T18:21:43-04:00
Fix EMSDK configure condition

- - - - -
bd74db6f by doyougnu at 2022-10-16T18:21:43-04:00
StgToJS.Arg: Unboxable Literal Optimization note

- - - - -
b3f739f9 by Sylvain Henry at 2022-10-16T18:21:44-04:00
Fix Outputable instances for JExpr/JVal

- Put orphan instances in JS.Ppr
- Also fix some redundant imports

- - - - -
58d39cd4 by doyougnu at 2022-10-16T18:21:44-04:00
configure: avoid CXX stdlib check for js backend

and some cleanup for a previously mis-applied commit during rebasing

- - - - -
3f0f7567 by doyougnu at 2022-10-16T18:21:44-04:00
fixup: misc. fixes post rebase

- - - - -
401a8dc8 by Sylvain Henry at 2022-10-16T18:21:44-04:00
PrimOps: add more 64-bit primops

PrimOp: implement more 64-bit primops + PM fix

Ensure that we cover every primop explicitly

- - - - -
e7f69bc8 by Sylvain Henry at 2022-10-16T18:21:44-04:00
PrimOp: correclty (un)handle new thread related primops

- - - - -
c297c3a1 by Sylvain Henry at 2022-10-16T18:21:45-04:00
PrimOp: disable LabelThreadOp for now

- - - - -
8848b86d by Sylvain Henry at 2022-10-16T18:21:45-04:00
Minor doc/cleanup

Fix more redundant imports

- - - - -
58cd2b3c by doyougnu at 2022-10-16T18:21:45-04:00
base: GHCJS.Prim directory --> GHC.JS.Prim

- - - - -
b18154be by Luite Stegeman at 2022-10-16T18:21:45-04:00
implement KeepAlive primop

- - - - -
c937ff33 by Sylvain Henry at 2022-10-16T18:21:45-04:00
Remove orphan instance for StaticArg

- - - - -
0ea44ad8 by Sylvain Henry at 2022-10-16T18:21:46-04:00
Remove redundant jsIdIdent' function

- - - - -
e41d597d by Sylvain Henry at 2022-10-16T18:21:46-04:00
Split StgToJS.Monad into StgToJS.{Monad,Ids,Stack}

- - - - -
af8df178 by Sylvain Henry at 2022-10-16T18:21:46-04:00
Apply: remove commented case (wasn't optimized either in latest ghcjs)

- - - - -
8ba39cbe by Sylvain Henry at 2022-10-16T18:21:46-04:00
Doc: Apply

Apply: doc and refactoring

- use new types instead of Bool/Int
- factorize some code

- - - - -
bc47ba4d by Sylvain Henry at 2022-10-16T18:21:47-04:00
Primop: arith fixes

Primop: fix 64-bit shifting primops + add some traces

Primop: fix quotRem2Word32

Primop: fix timesInt2. Progress towards passing arith003

PrimOp: fix timesInt32

PrimOp: use mulWord32 when appropriate

- - - - -
09e3bf6f by doyougnu at 2022-10-16T18:21:47-04:00
Configure: remove EMSDK hacks and wrapper scripts

configure JS: remove wrapper scripts

Configure: remove EMSDK hacks. Use emconfigure instead

emconfigure ./configure --target=js-unknown-ghcjs

- - - - -
fb7bfb07 by Sylvain Henry at 2022-10-16T18:21:47-04:00
GHCJS.Prim leftovers

- - - - -
0177103e by Sylvain Henry at 2022-10-16T18:21:47-04:00
Linker: fix linking issue for tuples

- - - - -
9c3f7e61 by Sylvain Henry at 2022-10-16T18:21:47-04:00
FFI: remove narrowing

Fix tests such as cgrun015 (Core lint error)

- - - - -
6b2fc8b2 by Sylvain Henry at 2022-10-16T18:21:48-04:00
Linker: disable logs with default verbosity

- - - - -
6c7f2cc5 by Sylvain Henry at 2022-10-16T18:21:48-04:00
Append program name in top-level exception handler

- - - - -
47bd8795 by doyougnu at 2022-10-16T18:21:48-04:00
GHC.JS: Remove FIXMEs

JS.Syntax: Remove FIXMEs

JS.Make: remove FIXMEs

JS.Ppr/Transform: Remove FIXMEs

- - - - -
39df9a34 by Sylvain Henry at 2022-10-16T18:21:48-04:00
Primop: fix timesInt2#

Pass arith003 test

- - - - -
f20b1166 by doyougnu at 2022-10-16T18:21:48-04:00
JS.Linker.Linker: remove FIXMEs, clean dead code

- - - - -
c4718510 by Sylvain Henry at 2022-10-16T18:21:49-04:00
Linker: link platform shim before the others

- - - - -
78f6417a by Sylvain Henry at 2022-10-16T18:21:49-04:00
Primops: rework 64-bit and Word32 primops

- Use BigInt instead of complex and buggy bit twiddling. We'll assess
  performance later. Let's use a correct and simple implementation for
  now.

- Implement previously missing 64-bit quot and rem

- Refactor logical operators and Prim module more generally

- - - - -
82f2231a by Sylvain Henry at 2022-10-16T18:21:49-04:00
PrimOp: fixup previous commit...

- - - - -
d4816913 by Sylvain Henry at 2022-10-16T18:21:49-04:00
Primop: fixup previous commit

- - - - -
f4473a2f by Sylvain Henry at 2022-10-16T18:21:49-04:00
Doc: minor changes

- - - - -
8eca93c7 by Sylvain Henry at 2022-10-16T18:21:50-04:00
Add debug option to watch for insertion of undefined/null in the stack

- - - - -
75ae445b by Sylvain Henry at 2022-10-16T18:21:50-04:00
Apply: fix tag generation

- - - - -
16c4d125 by Sylvain Henry at 2022-10-16T18:21:50-04:00
Remove redundant import

- - - - -
bf9eaa90 by Sylvain Henry at 2022-10-16T18:21:50-04:00
Testsuite: disable Cmm tests with the JS backend

- - - - -
352d5c04 by Sylvain Henry at 2022-10-16T18:21:50-04:00
Base: fix c_interruptible_open

- - - - -
ff60c1d2 by Sylvain Henry at 2022-10-16T18:21:50-04:00
Base: fix typo in long_from_number

- - - - -
e3329bd0 by Sylvain Henry at 2022-10-16T18:21:51-04:00
Env: only add program name to errors, not to traces

- - - - -
dedfa5fa by Sylvain Henry at 2022-10-16T18:21:51-04:00
Testsuite: disable more Cmm tests

- - - - -
ef04a471 by doyougnu at 2022-10-16T18:21:51-04:00
JS.Linker: removes FIXMEs

JS.Linker.Linker: remove FIXMEs, clean dead code

StgToJS.Linker.Utils: remove FIXMEs

Compactor: Remove FIXMEs

StgToJS.Linker.Types: Remove FIXMEs

JS.Linker.Archive/Dynamic: remove FIXMEs

StgToJS.Linker.Shims: remove FIXMEs

- - - - -
986b299e by doyougnu at 2022-10-16T18:21:51-04:00
JS RTS: remove FIXMEs

StgToJS.Rts.Types: Remove FIXMEs

- - - - -
5b28e80d by Sylvain Henry at 2022-10-16T18:21:52-04:00
Primop: fix bswap32/64 (cf cgrun072)

- - - - -
06e69e51 by Sylvain Henry at 2022-10-16T18:21:52-04:00
Testsuite: normalise ghc program name

- - - - -
dd114d04 by doyougnu at 2022-10-16T18:21:52-04:00
JS Backend: Remove FIXMEs

StgToJS.Apply: Remove FIXMEs

StgToJS.FFI: remove FIXMEs

StgToJS.Expr: remove FIXMEs

StgToJS: Remove FIXMEs

- - - - -
aa05fd97 by Sylvain Henry at 2022-10-16T18:21:52-04:00
Enable RTS args filtering (cf cgrun025)

- - - - -
f0e27ead by Sylvain Henry at 2022-10-16T18:21:52-04:00
Remove trailing whitespaces (whitespace test)

- - - - -
dc912771 by Sylvain Henry at 2022-10-16T18:21:53-04:00
Testsuite: remove platform prefix for unlit tool

- - - - -
c0e1a0f0 by Sylvain Henry at 2022-10-16T18:21:53-04:00
Primop: fix Int64 conversion/negate (integerConversions test)

- - - - -
cd641da8 by Sylvain Henry at 2022-10-16T18:21:53-04:00
Linker: remove message with default verbosity

- - - - -
769aace4 by Sylvain Henry at 2022-10-16T18:21:53-04:00
Testsuite: normalise .jsexe suffix

- - - - -
ebdf068c by Sylvain Henry at 2022-10-16T18:21:53-04:00
Remove warning about orphan instance

- - - - -
6180e20b by Sylvain Henry at 2022-10-16T18:21:54-04:00
Compactor: disable dead code

- - - - -
b7b99ae9 by Sylvain Henry at 2022-10-16T18:21:54-04:00
Exception: implement raiseUnderflow etc. as primops

- - - - -
24530d44 by Sylvain Henry at 2022-10-16T18:21:54-04:00
Primop: fix Int8/18 quot/rem

- - - - -
0d66bf2b by Sylvain Henry at 2022-10-16T18:21:54-04:00
Linker: refactor wired-in deps

- - - - -
0bd95fc1 by Sylvain Henry at 2022-10-16T18:21:54-04:00
Ppr: remove useless left padding for functions in JS dumps

- - - - -
0a1e1cdf by Josh Meredith at 2022-10-16T18:21:55-04:00
Disable llvm ways and ghci for JS backend testsuite

- - - - -
7de0ccf2 by Sylvain Henry at 2022-10-16T18:21:55-04:00
StaticPtr: don't generate CStubs for the JS backend

- - - - -
daaa27a4 by Sylvain Henry at 2022-10-16T18:21:55-04:00
StaticPtr: fix hs_spt_lookup after upstream change

- - - - -
14437b98 by Sylvain Henry at 2022-10-16T18:21:55-04:00
Testsuite: fix normalisation for unlit

T8430 shows:
  `js-unknown-ghcjs-unlit' failed in phase `Literate pre-processor'. (Exit code: 1)

Notice the quote around the program name. So I've made the regex match
more cases (i.e. not only lines starting with the program name).

- - - - -
8a53ab48 by Sylvain Henry at 2022-10-16T18:21:55-04:00
Codegen: fix codegen of string literals

Due to FastString change:
 Before: Text.pack . BSC.unpack
 After:  mkFastString . BSC.unpack

It seems that Text handles buggy multi-byte codepoints split into
several String Chars.

- - - - -
a62bdbaa by Sylvain Henry at 2022-10-16T18:21:56-04:00
CPP: fix LINE markers. Only disable them for JS

- - - - -
fc900ce1 by Luite Stegeman at 2022-10-16T18:21:56-04:00
add JavaScript files listed in js-sources to package archives

- - - - -
eac08f5b by Luite Stegeman at 2022-10-16T18:21:56-04:00
update rts js files to include recent fixes

- - - - -
96d54574 by Luite Stegeman at 2022-10-16T18:21:56-04:00
fix definitions in js/rts.h

- - - - -
ad6615d3 by Josh Meredith at 2022-10-16T18:21:57-04:00
stopgap fix for missing ghc-pkg in cross-compiler tests

- - - - -
22f50303 by Sylvain Henry at 2022-10-16T18:21:57-04:00
Testsuite: better fix for finding prefixed tools

- - - - -
71135267 by Sylvain Henry at 2022-10-16T18:21:57-04:00
Ppr: add hangBrace helper

- - - - -
45be6c87 by Sylvain Henry at 2022-10-16T18:21:57-04:00
Only declare ccs var in profiling mode

- - - - -
baa11726 by Sylvain Henry at 2022-10-16T18:21:57-04:00
Don't consider recursive bindings as inline nor as evaluated

Fix mdo001

- - - - -
66a6f780 by Sylvain Henry at 2022-10-16T18:21:57-04:00
Hadrian: disable shared libs for JS target

- - - - -
07a7a66f by Sylvain Henry at 2022-10-16T18:21:58-04:00
Support -ddump-stg-final with the JS backend

- - - - -
201d4e27 by Sylvain Henry at 2022-10-16T18:21:58-04:00
Add ticky_ghc0 flavour transformer to ticky stage1

- - - - -
b2176a2e by Sylvain Henry at 2022-10-16T18:21:58-04:00
Don't read object file when -ddump-js isn't passed

- - - - -
48cde7e6 by Sylvain Henry at 2022-10-16T18:21:58-04:00
Object: remove dead code + renaming

- - - - -
f0bdbfed by Sylvain Henry at 2022-10-16T18:21:58-04:00
Object: replace SymbolTableR with Dictionary

- - - - -
32929f9b by Sylvain Henry at 2022-10-16T18:21:59-04:00
Object: refactoring

- - - - -
c21ea283 by Sylvain Henry at 2022-10-16T18:21:59-04:00
RTS: link platform.js before the others!

- - - - -
477fe776 by Sylvain Henry at 2022-10-16T18:21:59-04:00
Hadrian: treat JS objects similarly to other objects

- - - - -
9c28e74d by Luite Stegeman at 2022-10-16T18:21:59-04:00
fix javascript FFI calls for read and write

- - - - -
2b818fcb by doyougnu at 2022-10-16T18:21:59-04:00
propagate ppr code changes to JS backend

- - - - -
f7c5f4b7 by Sylvain Henry at 2022-10-16T18:22:00-04:00
Switch from Data.Binary and ByteString to BinHandle

- - - - -
3d8b5d9b by Sylvain Henry at 2022-10-16T18:22:00-04:00
Perf: use Ppr's LeftMode to output JS

- - - - -
7525313b by doyougnu at 2022-10-16T18:22:00-04:00
Primops: Add {Index,Write,Read}ByteArrayAs ops

Still need to check for correctness based on T4442.

minor doc fixes

fixup: add some Index..As primops

fixup missed type signature

Primops: Add WriteByteArrayOp_Word8AsFoo ops

Primops: {Index,Read,Write}FooAsBar done except Addr's

Primops: add {Index,Read,Write}ByteArrayAsAddr ops

These will need to be tested for correctness with T4442.hs

- - - - -
ef6ced26 by Sylvain Henry at 2022-10-16T18:22:00-04:00
Move platform.js to base (it must be linked first)

- - - - -
674af34e by Sylvain Henry at 2022-10-16T18:22:00-04:00
Remove old shim directory

- - - - -
3ca531a3 by doyougnu at 2022-10-16T18:22:01-04:00
JS.Prim: more PrimOps {IndexByteArrayAs, CAS}

Primop: WriteByteArrayOp_Word8AsChar use setInt8

Primops: remove dv_s_u8

This function is non-sensical. Due to the infelicities of JS as a
platform we must use Int8 and friends to write, then coerce to a word,
thus dv_s_iN are the only legal calls for a write, and dv_s_uN legal for
Index and Reads.

Primops: set dv_u8 to correct method call

should be getUint8, not getUInt8, of course the naming convention
changes ever so slightly for Words.

Primops: T4442 finishes ByteArrayAs still fails

JS.Prim: More IndexByteAAs primops

JS.Prim: Prefetch PrimOps are noOps

JS.Primops: Doc explaining lack of vector support

JS.Prim: add CAS and Fetch Ops

- - - - -
805e9ac7 by doyougnu at 2022-10-16T18:22:01-04:00
GHC.Utils.Binary: BinDictionary -> FSTable

Rename to avoid naming conflict with haddock.

- - - - -
ef720bf6 by Josh Meredith at 2022-10-16T18:22:01-04:00
Adjust derefnull test exit code for ghcjs

- - - - -
7de30bd4 by doyougnu at 2022-10-16T18:22:01-04:00
Fix Driver missing type signature warnings

- - - - -
aec9044b by doyougnu at 2022-10-16T18:22:01-04:00
PipeLine.Execute: silence warnings on JS backend

- - - - -
e0fb8da6 by doyougnu at 2022-10-16T18:22:02-04:00
JS.Primops: Add Bit reverse ops

- - - - -
6ffe6c29 by doyougnu at 2022-10-16T18:22:02-04:00
SysTools.Tasks: quiet non-totality warnings

- - - - -
74c47475 by doyougnu at 2022-10-16T18:22:02-04:00
JS.Primops: Add InterlockedExchange Addr Word

- - - - -
260119c2 by Sylvain Henry at 2022-10-16T18:22:02-04:00
base: conditional js-sources

- - - - -
bc7c028a by Sylvain Henry at 2022-10-16T18:22:02-04:00
TH: add support for JS files

- - - - -
877b163e by Sylvain Henry at 2022-10-16T18:22:03-04:00
Linker: fix creation of directories in output paths

- - - - -
c9aeee21 by Sylvain Henry at 2022-10-16T18:22:03-04:00
Backpack: fix empty stubs

- - - - -
aa8c9b92 by Sylvain Henry at 2022-10-16T18:22:03-04:00
Add encodeDouble/Float RTS functions

- - - - -
f9d27885 by Sylvain Henry at 2022-10-16T18:22:03-04:00
encodeDouble: correctly handle 0 base

- - - - -
4a6a69a8 by doyougnu at 2022-10-16T18:22:03-04:00
JS.Primops: Add listThreads op

- - - - -
46782b3f by doyougnu at 2022-10-16T18:22:04-04:00
JS.Primops: Add Read/WriteAddrOp ops

- - - - -
f1faa5df by doyougnu at 2022-10-16T18:22:04-04:00
JS: Linker and Compactor: cleanup and docs

Compactor: Cleanup: Remove dead comments

JS.Linker.Types: cleanup and document module

- - - - -
bbc80342 by doyougnu at 2022-10-16T18:22:04-04:00
StgToJS.Linker: Add docs to utility modules

StgToJS.Linker.Utils: more docs

StgToJS.Linker.Archive: more docs

- - - - -
85eab631 by doyougnu at 2022-10-16T18:22:04-04:00
StgToJS.Object: Add documentation

- - - - -
3d44bfc8 by Sylvain Henry at 2022-10-16T18:22:04-04:00
Refactor Expr

- - - - -
6eab0a16 by Sylvain Henry at 2022-10-16T18:22:05-04:00
Object: reduce pinned allocation. And don't forget to hClose invalid objects

- - - - -
31386e6d by Sylvain Henry at 2022-10-16T18:22:05-04:00
Fix pdep (cgrun075)

- - - - -
b8303439 by Sylvain Henry at 2022-10-16T18:22:05-04:00
Fix error message (don't mention emscripten)

- - - - -
74c69a21 by Sylvain Henry at 2022-10-16T18:22:05-04:00
Add Float/Word casts

- - - - -
2133424d by Sylvain Henry at 2022-10-16T18:22:05-04:00
Disable HPC tests with JS backend

- - - - -
a243f8b7 by Sylvain Henry at 2022-10-16T18:22:06-04:00
Fix encodeDouble/Float

- - - - -
dcd26797 by Sylvain Henry at 2022-10-16T18:22:06-04:00
Implement putchar (fix cgrun015)

- - - - -
850d558b by Sylvain Henry at 2022-10-16T18:22:06-04:00
Fix decoding of denormalized floats

- - - - -
83399730 by Sylvain Henry at 2022-10-16T18:22:06-04:00
Fix isFloatDenormalized function

- - - - -
ba3b200c by Sylvain Henry at 2022-10-16T18:22:06-04:00
Reuse convert buffer

- - - - -
8f6cd127 by Sylvain Henry at 2022-10-16T18:22:07-04:00
Reuse convert buffer bis

- - - - -
e597c475 by Sylvain Henry at 2022-10-16T18:22:07-04:00
Skip some tests that require the dynamic linker

- - - - -
69d676d0 by Josh Meredith at 2022-10-16T18:22:07-04:00
JavaScript ShrinkSmallMutableArrayOp_Char & GetSizeofSmallMutableArrayOp

- - - - -
7eb8de07 by Sylvain Henry at 2022-10-16T18:22:07-04:00
Disable more linker tests

- - - - -
db0ac187 by Sylvain Henry at 2022-10-16T18:22:07-04:00
Testsuite: better normalisation for ghc and ghc-pkg

Allow normalisation for ghc and ghc-pkg anywhere in the output, not just
at the beginning of the line.

Fix T1750 and ghcpkg05 for example

- - - - -
95381257 by Sylvain Henry at 2022-10-16T18:22:08-04:00
Skip T14373 because it requires Cmm

- - - - -
4ad47321 by Sylvain Henry at 2022-10-16T18:22:08-04:00
Disable cg010 with JS backend

- - - - -
c0606904 by Sylvain Henry at 2022-10-16T18:22:08-04:00
Testsuite: better normalisation of .jsexe extension

- - - - -
c33fc565 by doyougnu at 2022-10-16T18:22:08-04:00
JS: Linker,Rts docs and cleanup

JS.Linker: Cleanup: remove unused functions/types

JS.Rts.Types: remove dead code, docs

StgToJS.RTS: cleanup and more docs

- - - - -
386fca79 by Sylvain Henry at 2022-10-16T18:22:08-04:00
Disable recomp015

- - - - -
b07157f3 by Sylvain Henry at 2022-10-16T18:22:09-04:00
Minor refactoring

- - - - -
52d5d857 by Sylvain Henry at 2022-10-16T18:22:09-04:00
Temporary fix the testsuite bug

- - - - -
a82e2003 by doyougnu at 2022-10-16T18:22:09-04:00
JS.StgToJS.Types: Docs and cleanup

- - - - -
08cf300a by Josh Meredith at 2022-10-16T18:22:09-04:00
change JS.Transform.Idents* to use UniqDSet from Set

- - - - -
5909304b by Sylvain Henry at 2022-10-16T18:22:09-04:00
Minor Linker cleanup

Minor cleanup

- - - - -
8e98f7ef by Sylvain Henry at 2022-10-16T18:22:10-04:00
Linker: load all the dependent units transitively

- - - - -
0fc0688d by doyougnu at 2022-10-16T18:22:10-04:00
JS: Add Docs and cleanup StgToJS.{Arg,Ids}

JS.Arg: docs and cleanup

StgToJS.Arg: add minimal docs

StgToJS.Ids: Add header

- - - - -
6fc6866d by Sylvain Henry at 2022-10-16T18:22:10-04:00
Implement h$sleep (T5611)

- - - - -
696a0f79 by Sylvain Henry at 2022-10-16T18:22:10-04:00
Linker: don't link the same unit twice

- - - - -
ca9c5e97 by doyougnu at 2022-10-16T18:22:10-04:00
JS:  docs, cleanup, StgToJS.{Expr,DataCon,Stack}

StgToJS.Deps/Expr: add docs

StgToJS.DataCon: add minor docs

StgToJS.Stack: Docs and cleanup

In particular:

-- Removing some single use functions
-- Some minor refactors related to these removals

StgToJS: comments on static args and optimizeFree

- - - - -
0c35aa4d by Sylvain Henry at 2022-10-16T18:22:11-04:00
Disable compact tests

- - - - -
c170d2a6 by Sylvain Henry at 2022-10-16T18:22:11-04:00
Add support for JS files passed on the command line

- - - - -
8e9ea0db by Sylvain Henry at 2022-10-16T18:22:11-04:00
Minor cleanup in compactor

- - - - -
ffb33fd4 by Sylvain Henry at 2022-10-16T18:22:11-04:00
Fix encoding of unboxed strings (don't pass through FastString/h$str)

- - - - -
c5257bb7 by doyougnu at 2022-10-16T18:22:11-04:00
JS: Misc fixes post Del-Cont rebase

- - - - -
22c98b1a by Sylvain Henry at 2022-10-16T18:22:12-04:00
Minor cleanup

- - - - -
4a700d87 by Sylvain Henry at 2022-10-16T18:22:12-04:00
Add log1p and expm1 (fix cgrun078)

- - - - -
ae835a0b by Sylvain Henry at 2022-10-16T18:22:12-04:00
Assume existence of Math.fround and use it in Float's primops

- - - - -
ae5ea656 by Sylvain Henry at 2022-10-16T18:22:12-04:00
Disable "debug" test

- - - - -
a0619797 by Sylvain Henry at 2022-10-16T18:22:12-04:00
Implement copyMutableArray with overlap support

- - - - -
86d841c0 by Sylvain Henry at 2022-10-16T18:22:13-04:00
Skip CmmSwitchTests

- - - - -
a99ca296 by Sylvain Henry at 2022-10-16T18:22:13-04:00
Fix WordToDouble/WordToFloat (Word2Float32 test)

- - - - -
c3beb69e by Sylvain Henry at 2022-10-16T18:22:13-04:00
Skip one more test

- - - - -
f9f6c23f by Sylvain Henry at 2022-10-16T18:22:13-04:00
Fix after GHC.Tuple to GHC.Tuple.Prim

- - - - -
1d0656fb by Sylvain Henry at 2022-10-16T18:22:13-04:00
Fix InterlockedExchange primops (cgrun080)

- - - - -
847ddd69 by Sylvain Henry at 2022-10-16T18:22:14-04:00
Disable T12059

- - - - -
70839cbc by Sylvain Henry at 2022-10-16T18:22:14-04:00
Implement sqrt/sqrtf (fix T14619)

- - - - -
67ec5f28 by Sylvain Henry at 2022-10-16T18:22:14-04:00
Skip more tests

- - - - -
340fbe87 by Sylvain Henry at 2022-10-16T18:22:14-04:00
Disable conc012

- - - - -
d65c4ebb by Sylvain Henry at 2022-10-16T18:22:14-04:00
Disable more Cmm tests

- - - - -
98d884f9 by Sylvain Henry at 2022-10-16T18:22:15-04:00
Fix AtomicPrimops test. Some refactoring in Prim too

- - - - -
dc57858f by Sylvain Henry at 2022-10-16T18:22:15-04:00
Use GHCJS's signExtend/narrow

- - - - -
899f51af by Josh Meredith at 2022-10-16T18:22:15-04:00
Implement get/set thread label prims

- - - - -
72048483 by doyougnu at 2022-10-16T18:22:15-04:00
JS: remove Linker.Archive module

- - - - -
ddaf4f8d by Sylvain Henry at 2022-10-16T18:22:15-04:00
Start disabling tests that use TH/interpreter

- - - - -
cf789c31 by Josh Meredith at 2022-10-16T18:22:16-04:00
Add flagged bounds checking to JS primops

- - - - -
7f3b8e73 by Sylvain Henry at 2022-10-16T18:27:26-04:00
Disable more tests

- - - - -
254dee56 by Sylvain Henry at 2022-10-16T18:27:29-04:00
Disable T1791

- - - - -
e6f424d5 by Sylvain Henry at 2022-10-16T18:27:29-04:00
Raise NonTermination as an async exception

- - - - -
de5bc565 by Sylvain Henry at 2022-10-16T18:27:30-04:00
Expect IOPort test to be broken

- - - - -
b35a93b3 by Sylvain Henry at 2022-10-16T18:27:30-04:00
Implement rts_isThreaded (fix jules_xref2)

- - - - -
caaa1851 by Sylvain Henry at 2022-10-16T18:27:30-04:00
Disable outofmem2 test

- - - - -
d7b9f7df by Sylvain Henry at 2022-10-16T18:27:30-04:00
Disable tests using C files

- - - - -
43d206ab by Sylvain Henry at 2022-10-16T18:27:30-04:00
Disable delimited continuation tests

- - - - -
a69ced57 by Sylvain Henry at 2022-10-16T18:27:31-04:00
Disable native RTS flag tests

- - - - -
4a2ec8a7 by Sylvain Henry at 2022-10-16T18:27:31-04:00
Disable more tests

- - - - -
a11da0c6 by Sylvain Henry at 2022-10-16T18:27:31-04:00
Disable more tests

- - - - -
4e0f259b by Sylvain Henry at 2022-10-16T18:27:31-04:00
Annotation tests require an interpreter

- - - - -
fe07e1ca by Sylvain Henry at 2022-10-16T18:27:31-04:00
Skip more tests

- - - - -
5877574b by Sylvain Henry at 2022-10-16T18:27:32-04:00
Disable try_putmvar tests that use C files

- - - - -
9f33cd31 by Sylvain Henry at 2022-10-16T18:27:32-04:00
Disable even more tests

- - - - -
348ab202 by Sylvain Henry at 2022-10-16T18:27:32-04:00
Disable test using Cmm

- - - - -
7c01ae4b by Sylvain Henry at 2022-10-16T18:27:32-04:00
Linker: remove dead code (base, compactor)

- - - - -
9c9aad7a by Sylvain Henry at 2022-10-16T18:27:32-04:00
Better shims linking

- - - - -
4792a781 by Sylvain Henry at 2022-10-16T18:27:32-04:00
Make isJsFile a bit faster by only reading the header

- - - - -
3c39400d by Sylvain Henry at 2022-10-16T18:27:33-04:00
Linker: write directly into output file

- - - - -
a569bbff by Sylvain Henry at 2022-10-16T18:27:33-04:00
Linker: more refactoring

- - - - -
49c235ce by Sylvain Henry at 2022-10-16T18:27:33-04:00
Lazy loading of JStat in object code

- - - - -
539de1dc by Sylvain Henry at 2022-10-16T18:27:33-04:00
Use Ppr hack to render directly into a file

- - - - -
04f36477 by Sylvain Henry at 2022-10-16T18:27:33-04:00
Fix backpack dependencies

- - - - -
eaa19192 by doyougnu at 2022-10-16T18:27:34-04:00
testsuite: add js_skip_csources function

Used to indicate a test that fails in the JS backend because the JS
Backend does not yet support c-sources in cabal files.

- - - - -
3940618e by doyougnu at 2022-10-16T18:27:34-04:00
testsuite: JS: skip tests which use c-sources

Skip because these tests use c-sources and the JS backend does not yet
support including c-sources

testsuite: JS backend: skip backpack tests

testsuite: JS: skip c-sources ffi tests

testsuite: JS: skip multipleHomeUnits_odir

testsuite: JS: disable more backpack tests

testsuite: JS: disable c-sources rts tests

testsuite: JS: skip c-sources codeGen tests

testsuite: JS: skip c-sources generics test

- - - - -
49f6ffb3 by Josh Meredith at 2022-10-16T18:27:34-04:00
use exit code 134 for JS prim bounds checks

- - - - -
24a28e6b by Sylvain Henry at 2022-10-16T18:27:34-04:00
Remove panic in getObject

- - - - -
3f6f2735 by Sylvain Henry at 2022-10-16T18:27:34-04:00
Add debug and Outputable instances

- - - - -
35399b81 by Sylvain Henry at 2022-10-16T18:27:35-04:00
Remove backup file

- - - - -
f67870f6 by Sylvain Henry at 2022-10-16T18:27:35-04:00
Skip overflow tests

- - - - -
a14761dd by Sylvain Henry at 2022-10-16T18:27:35-04:00
Fix RTS includes for native build

- - - - -
a95b6e28 by Sylvain Henry at 2022-10-16T18:27:35-04:00
Doc

- - - - -
496bab91 by Sylvain Henry at 2022-10-16T18:27:35-04:00
Add perf-js Hadrian flavour

- - - - -
e9584805 by doyougnu at 2022-10-16T18:27:36-04:00
JS.Syntax: fix doc wording

- - - - -
11956b43 by doyougnu at 2022-10-16T18:27:36-04:00
Driver: JS: tweak error message

- - - - -
7c94c8d8 by Josh Meredith at 2022-10-16T18:27:36-04:00
Factor JS platform constants and h$programArgs/h$rtsArgs into functions with init

- - - - -
13c113f6 by Josh Meredith at 2022-10-16T18:27:36-04:00
Fix function name from h$shrinkMutableArray to h$shrinkMutableCharArray

- - - - -
b83ee612 by Luite Stegeman at 2022-10-16T18:27:36-04:00
allow async exceptions to be thrown from outside a haskell thread

- - - - -
523bc8a4 by Sylvain Henry at 2022-10-16T18:27:37-04:00
Remove shims and refactor Cpp

I've removed the use of js/rts.h and js/constants.h again. We generate
their contents at cpp time. Instead of wiring z-encoded strings into
these macros, we should derive them from wired-in Names so that they
stay correct in the future. Using wired-in Names as single source of
truth.

- - - - -
33d50776 by Sylvain Henry at 2022-10-16T18:27:37-04:00
Support RTS globals (used by GHC) and EISDIR

Did this while trying to fix CallArity1 (still failing)

- - - - -
88c78f1c by Sylvain Henry at 2022-10-16T18:27:37-04:00
Remove JS keywords

1. The list is incomplete
2. We prefix locals with "h$$" so there is no risk of conflict with JS
   keywords

- - - - -
6f5768eb by Sylvain Henry at 2022-10-16T18:27:37-04:00
Remove dead code

- - - - -
29b9e582 by Sylvain Henry at 2022-10-16T18:27:37-04:00
Make ident supply strict (no need to make it lazy, list already is)

- - - - -
8bdb8928 by Sylvain Henry at 2022-10-16T18:27:38-04:00
Add optional assign to DeclStat and remove dead code

- - - - -
7914300c by doyougnu at 2022-10-16T18:27:38-04:00
JS: Note on JS .o file order, fix .o files

To be specific:

1. add Note [JS Backend .o file procedure]
2. ensure that .o files are touch'd in JS backend postHsc phase. This
  fixes "missing object file" errors produced by
  'GHC.Driver.Main.checkObjects'.

- - - - -
27ad47f4 by Luite Stegeman at 2022-10-16T18:27:38-04:00
start a subtransaction in a catchStm block

- - - - -
bf2ba4e2 by Sylvain Henry at 2022-10-16T18:27:38-04:00
Use FastMutInt in G for uniques

- - - - -
f6c89283 by Sylvain Henry at 2022-10-16T18:27:38-04:00
Compactor: remove dead code

- - - - -
12b3f54b by Sylvain Henry at 2022-10-16T18:27:39-04:00
Compactor: remove more dead code

- - - - -
065dbf6d by Sylvain Henry at 2022-10-16T18:27:39-04:00
Compactor: remove unused debug code

- - - - -
958b77ac by Sylvain Henry at 2022-10-16T18:27:39-04:00
Compactor: remove unimplemented packStrings

- - - - -
c2ef1dd3 by Sylvain Henry at 2022-10-16T18:27:39-04:00
RTS: fix query/replace error

- - - - -
b87c9c60 by Luite Stegeman at 2022-10-16T18:27:39-04:00
remove unused STM check invariants

- - - - -
dd61795f by Josh Meredith at 2022-10-16T18:27:40-04:00
Refactor renaming functions from Compactor module into the Linker

- - - - -
c637c2c2 by Sylvain Henry at 2022-10-16T18:27:40-04:00
Linker: refactor and cleanup after compactor removal

- - - - -
d6ee1d06 by Sylvain Henry at 2022-10-16T18:27:40-04:00
Filter empty exports to avoid printing a lot of useless newlines

- - - - -
8e0f4348 by Sylvain Henry at 2022-10-16T18:27:40-04:00
RTS: remove dangling semicolons

- - - - -
7f6882a2 by Sylvain Henry at 2022-10-16T18:27:40-04:00
RTS: remove more dangling semicolons

- - - - -
0dd42855 by Sylvain Henry at 2022-10-16T18:27:41-04:00
RTS: less semicolons

- - - - -
aecfe497 by Sylvain Henry at 2022-10-16T18:27:41-04:00
Only initialize statics once!

- - - - -
5f0bfa97 by Sylvain Henry at 2022-10-16T18:27:41-04:00
Minor refactoring: avoid unpacking ShortText too soon

- - - - -
53e6c8bd by Sylvain Henry at 2022-10-16T18:27:41-04:00
Remove unused derived instances

- - - - -
3df71141 by Sylvain Henry at 2022-10-16T18:27:41-04:00
Use Ident in ClosureInfo instead of FastString

- - - - -
1a673201 by Sylvain Henry at 2022-10-16T18:27:42-04:00
Add identFS helper

- - - - -
d049e360 by Sylvain Henry at 2022-10-16T18:27:42-04:00
Fix liftToGlobal

identsS wasn't correctly ported: it has to return all the Ident
occurences, not only one. Fixed this and simplified liftToGlobal
implementation.

Used UniqFM instead of Map forn the global ident cache.

- - - - -


27 changed files:

- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Ppr.hs
- compiler/GHC/CmmToAsm/X86/Ppr.hs
- compiler/GHC/Core/Opt/Exitify.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/Graph/Directed.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Backend/Internal.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- + compiler/GHC/Driver/Config/StgToJS.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Phases.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/01e0ca4f31e6eccb0420a8763b9064cd1e99172d...d049e360c124ab632408637e0d30e291b99aa20f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/01e0ca4f31e6eccb0420a8763b9064cd1e99172d...d049e360c124ab632408637e0d30e291b99aa20f
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20221016/be93b712/attachment-0001.html>


More information about the ghc-commits mailing list