[Git][ghc/ghc][wip/js-staging] 181 commits: hadrian: Don't attempt to install documentation if doc/ doesn't exist

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Mon Aug 22 15:36:57 UTC 2022



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


Commits:
7cabea7c by Ben Gamari at 2022-08-10T15:37:58-04:00
hadrian: Don't attempt to install documentation if doc/ doesn't exist

Previously we would attempt to install documentation even if the `doc`
directory doesn't exist (e.g. due to `--docs=none`). This would result
in the surprising side-effect of the entire contents of the bindist
being installed in the destination documentation directory. Fix this.

Fixes #21976.

- - - - -
67575f20 by normalcoder at 2022-08-10T15:38:34-04:00
ncg/aarch64: Don't use x18 register on AArch64/Darwin

Apple's ABI documentation [1] says: "The platforms reserve register x18.
Don’t use this register." While this wasn't problematic in previous
Darwin releases, macOS 13 appears to start zeroing this register
periodically. See #21964.

[1] https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms

- - - - -
45eb4cbe by Andreas Klebinger at 2022-08-10T22:41:12-04:00
Note [Trimming auto-rules]: State that this improves compiler perf.

- - - - -
5c24b1b3 by Bodigrim at 2022-08-10T22:41:50-04:00
Document that threadDelay / timeout are susceptible to overflows on 32-bit machines

- - - - -
ff67c79e by Alan Zimmerman at 2022-08-11T16:19:57-04:00
EPA: DotFieldOcc does not have exact print annotations

For the code

    {-# LANGUAGE OverloadedRecordUpdate #-}

    operatorUpdate f = f{(+) = 1}

There are no exact print annotations for the parens around the +
symbol, nor does normal ppr print them.

This MR fixes that.

Closes #21805

Updates haddock submodule

- - - - -
dca43a04 by Matthew Pickering at 2022-08-11T16:20:33-04:00
Revert "gitlab-ci: Add release job for aarch64/debian 11"

This reverts commit 5765e13370634979eb6a0d9f67aa9afa797bee46.

The job was not tested before being merged and fails CI
(https://gitlab.haskell.org/ghc/ghc/-/jobs/1139392)

Ticket #22005

- - - - -
ffc9116e by Eric Lindblad at 2022-08-16T09:01:26-04:00
typo
- - - - -
cd6f5bfd by Ben Gamari at 2022-08-16T09:02:02-04:00
CmmToLlvm: Don't aliasify builtin LLVM variables

Our aliasification logic would previously turn builtin LLVM variables
into aliases, which apparently confuses LLVM. This manifested in
initializers failing to be emitted, resulting in many profiling failures
with the LLVM backend.

Fixes #22019.

- - - - -
dc7da356 by Bryan Richter at 2022-08-16T09:02:38-04:00
run_ci: remove monoidal-containers

Fixes #21492

MonoidalMap is inlined and used to implement Variables, as before.

The top-level value "jobs" is reimplemented as a regular Map, since it
doesn't use the monoidal union anyway.

- - - - -
64110544 by Cheng Shao at 2022-08-16T09:03:15-04:00
CmmToAsm/AArch64: correct a typo

- - - - -
f6a5524a by Andreas Klebinger at 2022-08-16T14:34:11-04:00
Fix #21979 - compact-share failing with -O

I don't have good reason to believe the optimization level should affect
if sharing works or not here. So limit the test to the normal way.

- - - - -
68154a9d by Ben Gamari at 2022-08-16T14:34:47-04:00
users-guide: Fix reference to dead llvm-version substitution

Fixes #22052.

- - - - -
28c60d26 by Ben Gamari at 2022-08-16T14:34:47-04:00
users-guide: Fix incorrect reference to `:extension: role

- - - - -
71102c8f by Ben Gamari at 2022-08-16T14:34:47-04:00
users-guide: Add :ghc-flag: reference

- - - - -
385f420b by Ben Gamari at 2022-08-16T14:34:47-04:00
hadrian: Place manpage in docroot

This relocates it from docs/ to doc/

- - - - -
84598f2e by Ben Gamari at 2022-08-16T14:34:47-04:00
Bump haddock submodule

Includes merge of `main` into `ghc-head` as well as some Haddock users
guide fixes.

- - - - -
59ce787c by Ben Gamari at 2022-08-16T14:34:47-04:00
base: Add changelog entries from ghc-9.2

Closes #21922.

- - - - -
a14e6ae3 by Ben Gamari at 2022-08-16T14:34:47-04:00
relnotes: Add "included libraries" section

As noted in #21988, some users rely on this.

- - - - -
a4212edc by Ben Gamari at 2022-08-16T14:34:47-04:00
users-guide: Rephrase the rewrite rule documentation

Previously the wording was a tad unclear. Fix this.

Closes #21114.

- - - - -
3e493dfd by Peter Becich at 2022-08-17T08:43:21+01:00
Implement Response File support for HPC

This is an improvement to HPC authored by Richard Wallace
(https://github.com/purefn) and myself. I have received permission from
him to attempt to upstream it. This improvement was originally
implemented as a patch to HPC via input-output-hk/haskell.nix:
https://github.com/input-output-hk/haskell.nix/pull/1464

Paraphrasing Richard, HPC currently requires all inputs as command line arguments.
With large projects this can result in an argument list too long error.
I have only seen this error in Nix, but I assume it can occur is a plain Unix environment.

This MR adds the standard response file syntax support to HPC. For
example you can now pass a file to the command line which contains the
arguments.

```
hpc @response_file_1 @response_file_2 ...

The contents of a Response File must have this format:
COMMAND ...

example:
report my_library.tix --include=ModuleA --include=ModuleB
```

Updates hpc submodule

Co-authored-by:  Richard Wallace <rwallace at thewallacepack.net>

Fixes #22050

- - - - -
436867d6 by Matthew Pickering at 2022-08-18T09:24:08-04:00
ghc-heap: Fix decoding of TSO closures

An extra field was added to the TSO structure in 6d1700b6 but the
decoding logic in ghc-heap was not updated for this new field.

Fixes #22046

- - - - -
a740a4c5 by Matthew Pickering at 2022-08-18T09:24:44-04:00
driver: Honour -x option

The -x option is used to manually specify which phase a file should be
started to be compiled from (even if it lacks the correct extension). I
just failed to implement this when refactoring the driver.

In particular Cabal calls GHC with `-E -cpp -x hs Foo.cpphs` to
preprocess source files using GHC.

I added a test to exercise this case.

Fixes #22044

- - - - -
e293029d by Simon Peyton Jones at 2022-08-18T09:25:19-04:00
Be more careful in chooseInferredQuantifiers

This fixes #22065. We were failing to retain a quantifier that
was mentioned in the kind of another retained quantifier.

Easy to fix.

- - - - -
714c936f by Bryan Richter at 2022-08-18T18:37:21-04:00
testsuite: Add test for #21583

- - - - -
989b844d by Ben Gamari at 2022-08-18T18:37:57-04:00
compiler: Drop --build-id=none hack

Since 2011 the object-joining implementation has had a hack to pass
`--build-id=none` to `ld` when supported, seemingly to work around a
linker bug. This hack is now unnecessary and may break downstream users
who expect objects to have valid build-ids. Remove it.

Closes #22060.

- - - - -
519c712e by Matthew Pickering at 2022-08-19T00:09:11-04:00
Make ru_fn field strict to avoid retaining Ids

It's better to perform this projection from Id to Name strictly so we
don't retain an old Id (hence IdInfo, hence Unfolding, hence everything
etc)

- - - - -
7dda04b0 by Matthew Pickering at 2022-08-19T00:09:11-04:00
Force `getOccFS bndr` to avoid retaining reference to Bndr.

This is another symptom of #19619

- - - - -
4303acba by Matthew Pickering at 2022-08-19T00:09:11-04:00
Force unfoldings when they are cleaned-up in Tidy and CorePrep

If these thunks are not forced then the entire unfolding for the binding
is live throughout the whole of CodeGen despite the fact it should have
been discarded.

Fixes #22071

- - - - -
2361b3bc by Matthew Pickering at 2022-08-19T00:09:47-04:00
haddock docs: Fix links from identifiers to dependent packages

When implementing the base_url changes I made the pretty bad mistake of
zipping together two lists which were in different orders. The simpler
thing to do is just modify `haddockDependencies` to also return the
package identifier so that everything stays in sync.

Fixes #22001

- - - - -
9a7e2ea1 by Matthew Pickering at 2022-08-19T00:10:23-04:00
Revert "Refactor SpecConstr to use treat bindings uniformly"

This reverts commit 415468fef8a3e9181b7eca86de0e05c0cce31729.

This refactoring introduced quite a severe residency regression (900MB
live from 650MB live when compiling mmark), see #21993 for a reproducer
and more discussion.

Ticket #21993

- - - - -
9789e845 by Zachary Wood at 2022-08-19T14:17:28-04:00
tc: warn about lazy annotations on unlifted arguments (fixes #21951)

- - - - -
e5567289 by Andreas Klebinger at 2022-08-19T14:18:03-04:00
Fix #22048 where we failed to drop rules for -fomit-interface-pragmas.

Now we also filter the local rules (again) which fixes the issue.

- - - - -
ed2a7527 by Josh Meredith at 2022-08-19T14:39:59-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

- - - - -
1e877f96 by doyougnu at 2022-08-19T14:40:02-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

- - - - -
2b9be3b1 by doyougnu at 2022-08-19T14:40:02-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

- - - - -
e4f0874b by Sylvain Henry at 2022-08-19T14:40:03-04:00
Doc has been moved into GHC.StgToJs top-level module

- - - - -
dd224da1 by Sylvain Henry at 2022-08-19T14:40:03-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

- - - - -
fbb3834f by Sylvain Henry at 2022-08-19T14:40:03-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...

- - - - -
24fa76a4 by Sylvain Henry at 2022-08-19T14:40:03-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)

- - - - -
9990270f by Sylvain Henry at 2022-08-19T14:40:03-04:00
Configure: preliminary support for triple js-unknown-ghcjs

- - - - -
2686798b by Sylvain Henry at 2022-08-19T14:40:03-04:00
Driver: enable JS backend by default for JS arch

- - - - -
0a9295ab by doyougnu at 2022-08-19T14:40:04-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

- - - - -
97062013 by Sylvain Henry at 2022-08-19T14:40:04-04:00
Minor panic fix

- - - - -
7aca1493 by Sylvain Henry at 2022-08-19T14:40:04-04:00
Linker: fix stage2 build

- - - - -
d42f6c19 by Sylvain Henry at 2022-08-19T14:40:04-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...

- - - - -
bc67ae68 by doyougnu at 2022-08-19T14:40:04-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

- - - - -
1368877b by Sylvain Henry at 2022-08-19T14:40:04-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

- - - - -
ee07aaa8 by Sylvain Henry at 2022-08-19T14:40:05-04:00
Force creation of rts library with dummy file

- - - - -
6f26eca2 by Sylvain Henry at 2022-08-19T14:40:05-04:00
ghc-prim: avoid building C files

- - - - -
1856ea2e by Sylvain Henry at 2022-08-19T14:40:05-04:00
Hadrian: disable -fllvm

- - - - -
c1548e76 by Sylvain Henry at 2022-08-19T14:40:05-04:00
JS: fix caches

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

- - - - -
8afd04ee by Sylvain Henry at 2022-08-19T14:40:05-04:00
codegen: enhance genCon debug message

- - - - -
9cbb03e5 by Sylvain Henry at 2022-08-19T14:40:05-04:00
RTS: fix stupid comment

- - - - -
bb19a368 by Sylvain Henry at 2022-08-19T14:40:05-04:00
RTS: embed headers

- - - - -
ca2a9bf7 by Sylvain Henry at 2022-08-19T14:40:06-04:00
JS.StgToJS: add documentation header for JS Types

- - - - -
b3918b71 by Sylvain Henry at 2022-08-19T14:40:06-04:00
CodeGen: refactor ExprCtx code

- - - - -
2239a453 by Sylvain Henry at 2022-08-19T14:40:06-04:00
CodeGen: cache LNE frame size

- - - - -
a27e41e5 by doyougnu at 2022-08-19T14:40:06-04:00
JS.Types: Add Outputable for TypedExpr

- - - - -
33dc493c by doyougnu at 2022-08-19T14:40:06-04:00
JS.CoreUtils: handle IOPort case

- - - - -
0de46411 by doyougnu at 2022-08-19T14:40:06-04:00
JS.Expr: Fix unhandled datacon for RuntimeRep

- - - - -
26cf273d by doyougnu at 2022-08-19T14:40:06-04:00
JS.Literals: Adapt genLit to new Literal domain

- - - - -
b738b182 by Sylvain Henry at 2022-08-19T14:40:07-04:00
RTS: expose more headers (required to build base)

- - - - -
efa2516d by Sylvain Henry at 2022-08-19T14:40:07-04:00
Base: don't build C and Cmm sources with ghcjs

- - - - -
279b9d16 by Sylvain Henry at 2022-08-19T14:40:07-04:00
Tentatively set NO_REGS for JS platforms

- - - - -
b8becfc1 by Sylvain Henry at 2022-08-19T14:40:07-04:00
CodeGen: output LitRubbish as null JS values

- - - - -
c75b51a9 by Sylvain Henry at 2022-08-19T14:40:07-04:00
base: disable forkOS and bound thread machinery

- - - - -
5ef992ff by Sylvain Henry at 2022-08-19T14:40:07-04:00
CodeGen: support StackSnapshot# in primTypeVt

- - - - -
2af83d6a by Sylvain Henry at 2022-08-19T14:40:08-04:00
CodeGen: better debug message for assignCoerce1

- - - - -
33a8801c by Sylvain Henry at 2022-08-19T14:40:08-04:00
Misc: enable HasDebugCallStack for zipWithEqual*

- - - - -
65b9a872 by Sylvain Henry at 2022-08-19T14:40:08-04:00
CodeGen: remove useless imports

- - - - -
6eab57b7 by Sylvain Henry at 2022-08-19T14:40:08-04:00
Stg: expose pprStgAlt

- - - - -
9d4fdae7 by Sylvain Henry at 2022-08-19T14:40:08-04:00
CodeGen: restore assignAll (instead of assignAllEqual)

- - - - -
d0aa2d67 by Sylvain Henry at 2022-08-19T14:40:08-04:00
CodeGen: handle proxy#

- - - - -
545e820e by doyougnu at 2022-08-19T14:40:08-04:00
ghc-heap: Don't compile Cmm file for JS-Backend

- - - - -
abeabc36 by doyougnu at 2022-08-19T14:40:09-04:00
Driver.Main: minor refactor do_code_gen

To clearly separate the JS-Backend from any other backend

- - - - -
0cb652af by Sylvain Henry at 2022-08-19T14:40:09-04:00
Configure: fix echo on Mac, add ghcjs target OS

- - - - -
591fba0d by Sylvain Henry at 2022-08-19T14:40:09-04:00
Configure: fix previous commit

- - - - -
ca9609d0 by Luite Stegeman at 2022-08-19T14:40:09-04:00
fix package name in module name field of system dependencies

- - - - -
edd37ddf by Luite Stegeman at 2022-08-19T14:40:09-04:00
fix duplicate module name in symbols

- - - - -
7ebd4274 by doyougnu at 2022-08-19T14:40:09-04:00
GHCi.FFI: ignore ffi.h and friends for js-backend

- - - - -
86eca523 by Sylvain Henry at 2022-08-19T14:40:10-04:00
RTS: fix build of native rts

- - - - -
fe2771d5 by Sylvain Henry at 2022-08-19T14:40:10-04:00
Remove temporary -fjavascript flag

- - - - -
e9fc4bb9 by Sylvain Henry at 2022-08-19T14:40:10-04:00
Codegen: fix symbol names ppr

- - - - -
277dbd5c by Sylvain Henry at 2022-08-19T14:40:10-04:00
Outputable: add ShortText instance

- - - - -
6473ef7b by Sylvain Henry at 2022-08-19T14:40:10-04:00
Linker: enhance debugging message

- - - - -
51ae4df5 by Sylvain Henry at 2022-08-19T14:40:10-04:00
Remove unused ghcjs unit related code

- - - - -
95dc70cf by Sylvain Henry at 2022-08-19T14:40:10-04:00
ghci: Avoid unused-xyz warnings

- - - - -
5f28fcb6 by Sylvain Henry at 2022-08-19T14:40:11-04:00
Linker: remove wiring of ghcjs-prim and ghcjs-th

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

- - - - -
8d2d6319 by Sylvain Henry at 2022-08-19T14:40:11-04:00
Add outputable instance for Deps

- - - - -
b2eb6089 by doyougnu at 2022-08-19T14:40:11-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

- - - - -
e15d2cc5 by Sylvain Henry at 2022-08-19T14:40:11-04:00
Rename u_env into unit_env (more common)

- - - - -
8747b778 by Sylvain Henry at 2022-08-19T14:40:11-04:00
Linker: deduplication + fixes

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

- - - - -
745458d8 by Sylvain Henry at 2022-08-19T14:40:11-04:00
Linker: reenable packStrings (not yet implemented though)

- - - - -
d8b36e93 by Sylvain Henry at 2022-08-19T14:40:11-04:00
ShortText: add singleton

- - - - -
6c5d5f46 by Sylvain Henry at 2022-08-19T14:40:12-04:00
Linker: force less efficient (but working) static encoding

- - - - -
35c4c625 by Luite Stegeman at 2022-08-19T14:40:12-04:00
add GHCJS modules to base package

- - - - -
41083e4d by Sylvain Henry at 2022-08-19T14:40:12-04:00
Linker: remove JS Shims,tiny GHC.Linker refactor

- - - - -
7b11750f by doyougnu at 2022-08-19T14:40:12-04:00
Hadrian: QuickJS ways [] --> Set

- - - - -
8ac34ae2 by doyougnu at 2022-08-19T14:40:12-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.

- - - - -
33ad67f1 by doyougnu at 2022-08-19T14:40:12-04:00
JS: silence haddock warnings

JS Backend: remove misc. warnings

- - - - -
55691c71 by doyougnu at 2022-08-19T14:40:13-04:00
JS Backend: ghcjs_HOST_OS --> js_HOST_ARCH

- - - - -
94fd858a by Sylvain Henry at 2022-08-19T14:40:13-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

- - - - -
79f69019 by Sylvain Henry at 2022-08-19T14:40:13-04:00
CPP: disable line markers

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

- - - - -
b8d128c0 by Sylvain Henry at 2022-08-19T14:40:13-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

- - - - -
f0f7392a by Sylvain Henry at 2022-08-19T14:40:13-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)

- - - - -
0783a3ea by Sylvain Henry at 2022-08-19T14:40:13-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

- - - - -
2c39321f by doyougnu at 2022-08-19T14:40:14-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.

- - - - -
1f583ff4 by Sylvain Henry at 2022-08-19T14:40:14-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

- - - - -
33a4f0e2 by Sylvain Henry at 2022-08-19T14:40:14-04:00
Add primops

Add primop

- - - - -
dc2e8714 by doyougnu at 2022-08-19T14:40:14-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

- - - - -
f9c7e01b by doyougnu at 2022-08-19T14:40:14-04:00
Base: Adapt primitives to JS backend, add base.js

- - - - -
b53f3029 by doyougnu at 2022-08-19T14:40:14-04:00
Base: Remove binding forms in JS ffi

- - - - -
1bd65ee6 by Josh Meredith at 2022-08-19T14:40:14-04:00
Replace GHCJS Objectable with GHC Binary

- - - - -
259ac2a7 by Sylvain Henry at 2022-08-19T14:40:15-04:00
Binary: remove unused Map instance

- - - - -
344e1e3a by Sylvain Henry at 2022-08-19T14:40:15-04:00
CodeGen: Add export list

- - - - -
32d6d215 by Sylvain Henry at 2022-08-19T14:40:15-04:00
Primops: add some Int64/Word64 primops

- - - - -
8eb2c18f by Sylvain Henry at 2022-08-19T14:40:15-04:00
base: fix one ffi import

- - - - -
2ade3063 by doyougnu at 2022-08-19T14:40:15-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.

- - - - -
d4c8b10f by doyougnu at 2022-08-19T14:40:15-04:00
fixup: remove redundant struct.js.pp in js_base

- - - - -
12bc8256 by doyougnu at 2022-08-19T14:40:16-04:00
JS.Linker: enable linker RTS symbols

- - - - -
ec857684 by doyougnu at 2022-08-19T14:40:16-04:00
base.GHCJS: adapt Prim to direct call FFI format

- - - - -
d49017dc by doyougnu at 2022-08-19T14:40:16-04:00
Linker: Load JSVal from base not ghc-prim

- - - - -
948a9bbc by doyougnu at 2022-08-19T14:40:16-04:00
fixup: caught one more reference to JSVal in prim

- - - - -
5feb246d by Sylvain Henry at 2022-08-19T14:40:16-04:00
base: match on js arch , not ghcjs os

- - - - -
d06c1e66 by Sylvain Henry at 2022-08-19T14:40:16-04:00
Fix MK_JSVAL

- - - - -
a10c0817 by doyougnu at 2022-08-19T14:40:16-04:00
Prim: cleanup comments

- - - - -
38f0f1ce by doyougnu at 2022-08-19T14:40:17-04:00
JS.Prim: add Int64 PrimOps

- - - - -
45733599 by Sylvain Henry at 2022-08-19T14:40:17-04:00
Vendor MD5 lib

- - - - -
37f69ab7 by Sylvain Henry at 2022-08-19T14:40:17-04:00
More 64-bit primops

- - - - -
e0cf00c2 by Sylvain Henry at 2022-08-19T14:40:17-04:00
CodeGen: use if10 helper

- - - - -
d10e68f9 by Sylvain Henry at 2022-08-19T14:40:17-04:00
Ppr: fix selector to avoid adding a newline

- - - - -
7cffcefd by doyougnu at 2022-08-19T14:40:17-04:00
base: GHCJS.Prim make ffi imports use anon funcs

- - - - -
e4b728c9 by Sylvain Henry at 2022-08-19T14:40:17-04:00
Linker: disable invalid constructors again

- - - - -
706b60f7 by Sylvain Henry at 2022-08-19T14:40:18-04:00
More 64-bits primops

- - - - -
2e39045c by Sylvain Henry at 2022-08-19T14:40:18-04:00
Fix base_write function

- - - - -
db9eaa34 by Sylvain Henry at 2022-08-19T14:40:18-04:00
Fix base_write for 32-bit size_t

- - - - -
f0408cff by Sylvain Henry at 2022-08-19T14:40:18-04:00
Configure: fix detection of the target toolchain

- - - - -
29065faa by Sylvain Henry at 2022-08-19T14:40:18-04:00
Remove js_base directory

- - - - -
fc67159e by Sylvain Henry at 2022-08-19T14:40:18-04:00
Kill Node when the main loop reports an unhandled exception

- - - - -
95103014 by Sylvain Henry at 2022-08-19T14:40:19-04:00
CodeGen: preparation to make match on primops complete

- - - - -
e3651658 by Sylvain Henry at 2022-08-19T14:40:19-04:00
Primops: fix Compact primops

- - - - -
9d3ad4e8 by Sylvain Henry at 2022-08-19T14:40:19-04:00
Ignore result arity for some exception primops

- - - - -
d592fd05 by Sylvain Henry at 2022-08-19T14:40:19-04:00
Fix more primops. Bump array submodule!

- - - - -
d2c11256 by Sylvain Henry at 2022-08-19T14:40:19-04:00
Compact: fix return of 3 values

- - - - -
5d51cd7c by Sylvain Henry at 2022-08-19T14:40:19-04:00
Configure: switch to absolute path

- - - - -
ed9afe4c by Sylvain Henry at 2022-08-19T14:40:19-04:00
Add a few primops

- - - - -
fa510ac3 by Sylvain Henry at 2022-08-19T14:40:20-04:00
Primop: implement WordAdd2

- - - - -
7fd42370 by Luite Stegeman at 2022-08-19T14:40:20-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

- - - - -
df0f3405 by Josh Meredith at 2022-08-19T14:40:20-04:00
Replace ShortText with (Lexical)FastString in GHCJS backend

- - - - -
e5ea96cd by Sylvain Henry at 2022-08-19T14:46:30-04:00
Primops: add arithmetic ops

Primops: add decodeDoubleInt64 back

Primop: added timesInt2#

Primop: add mulWord32 and mul2Word32

- - - - -
195a6ef5 by Sylvain Henry at 2022-08-19T14:46:44-04:00
Reduce dependency on goog

- - - - -
272b629a by Sylvain Henry at 2022-08-19T14:46:44-04:00
Primop: implement quotWord32, remWord32, and quotRemWord32

- - - - -
735e9b63 by Sylvain Henry at 2022-08-19T14:46:45-04:00
Primop: Implement quotRem2Word32, misc fixes

Primop: implement quotRem2Word32

Primop: fix timesInt2#

Primop: fix some shifting primops

- - - - -
eaeb5d11 by Sylvain Henry at 2022-08-19T14:47:04-04:00
Fix bug in upd_frame

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

- - - - -
72a4dd5c by Sylvain Henry at 2022-08-19T14:47:04-04:00
Primop: throw an exception for unimplemented primops

- - - - -
af1b8397 by Sylvain Henry at 2022-08-19T14:47:04-04:00
Primop: fix remWord32

- - - - -
cdbf4a93 by Josh Meredith at 2022-08-19T14:47:05-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

- - - - -
0119f00b by Sylvain Henry at 2022-08-19T14:47:32-04:00
resultSize: correctly handle Void#

- - - - -
4e279942 by Sylvain Henry at 2022-08-19T14:47:32-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!

- - - - -
91f216c3 by Sylvain Henry at 2022-08-19T14:48:01-04:00
StgToJS.Apply: Docs

Doc

Doc

- - - - -
26405af1 by Josh Meredith at 2022-08-19T14:48:19-04:00
Fix EMSDK configure condition

- - - - -
0f0850cb by doyougnu at 2022-08-19T14:48:19-04:00
StgToJS.Arg: Unboxable Literal Optimization note

- - - - -
54205725 by Sylvain Henry at 2022-08-19T14:48:19-04:00
Fix Outputable instances for JExpr/JVal

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

- - - - -
b06be719 by doyougnu at 2022-08-19T14:48:19-04:00
configure: avoid CXX stdlib check for js backend

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

- - - - -
5e545be1 by doyougnu at 2022-08-19T14:48:19-04:00
fixup: misc. fixes post rebase

- - - - -
4e43b816 by Sylvain Henry at 2022-08-19T14:48:19-04:00
PrimOps: add more 64-bit primops

PrimOp: implement more 64-bit primops + PM fix

Ensure that we cover every primop explicitly

- - - - -
448a9e1e by Sylvain Henry at 2022-08-19T14:48:20-04:00
PrimOp: correclty (un)handle new thread related primops

- - - - -
9c15a18e by Sylvain Henry at 2022-08-19T14:48:20-04:00
PrimOp: disable LabelThreadOp for now

- - - - -
b2f0752b by Sylvain Henry at 2022-08-19T14:48:20-04:00
Minor doc/cleanup

Fix more redundant imports

- - - - -
a0df3161 by doyougnu at 2022-08-19T14:48:20-04:00
base: GHCJS.Prim directory --> GHC.JS.Prim

- - - - -
bbba07a8 by Luite Stegeman at 2022-08-19T14:48:20-04:00
implement KeepAlive primop

- - - - -
17061650 by Sylvain Henry at 2022-08-19T14:48:20-04:00
Remove orphan instance for StaticArg

- - - - -
4f436afd by Sylvain Henry at 2022-08-19T14:48:20-04:00
Remove redundant jsIdIdent' function

- - - - -
24be596e by Sylvain Henry at 2022-08-19T14:48:21-04:00
Split StgToJS.Monad into StgToJS.{Monad,Ids,Stack}

- - - - -
cc5c19b9 by Sylvain Henry at 2022-08-19T14:48:21-04:00
Apply: remove commented case (wasn't optimized either in latest ghcjs)

- - - - -
c0708eb9 by Sylvain Henry at 2022-08-19T14:48:21-04:00
Doc: Apply

Apply: doc and refactoring

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

- - - - -
53264fae by Sylvain Henry at 2022-08-19T14:48:21-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

- - - - -
408c44c7 by doyougnu at 2022-08-19T14:48:21-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

- - - - -
003bce79 by Sylvain Henry at 2022-08-19T14:48:21-04:00
GHCJS.Prim leftovers

- - - - -
f9dc097e by Sylvain Henry at 2022-08-19T14:48:21-04:00
Linker: fix linking issue for tuples

- - - - -
08c3c478 by Sylvain Henry at 2022-08-19T14:48:22-04:00
FFI: remove narrowing

Fix tests such as cgrun015 (Core lint error)

- - - - -


30 changed files:

- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- compiler/CodeGen.Platform.h
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/CmmToAsm/AArch64.hs
- compiler/GHC/CmmToLlvm/Base.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/PatSyn.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/Graph/Directed.hs
- compiler/GHC/Driver/Backend.hs
- compiler/GHC/Driver/Backend/Internal.hs
- compiler/GHC/Driver/CodeOutput.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/Pipeline.hs
- compiler/GHC/Driver/Pipeline/Execute.hs
- compiler/GHC/Driver/Pipeline/Monad.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/HsToCore/Foreign/C.hs
- compiler/GHC/HsToCore/Foreign/Decl.hs
- + compiler/GHC/HsToCore/Foreign/JavaScript.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Syntax.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3936af4da705a5f99b3713e04578e177fb610b66...08c3c4783c72d3173d79ccda2ac282e2d3e04e34

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/3936af4da705a5f99b3713e04578e177fb610b66...08c3c4783c72d3173d79ccda2ac282e2d3e04e34
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/20220822/0af9d8b1/attachment-0001.html>


More information about the ghc-commits mailing list