[Git][ghc/ghc][wip/expansions-appdo] 6 commits: JS: handle stored null StablePtr

Apoorv Ingle (@ani) gitlab at gitlab.haskell.org
Mon Feb 12 21:00:00 UTC 2024



Apoorv Ingle pushed to branch wip/expansions-appdo at Glasgow Haskell Compiler / GHC


Commits:
df9fd9f7 by Sylvain Henry at 2024-02-12T12:18:42-05:00
JS: handle stored null StablePtr

Some Haskell codes unsafely cast StablePtr into ptr to compare against
NULL. E.g. in direct-sqlite:

  if castStablePtrToPtr aggStPtr /= nullPtr then

where `aggStPtr` is read (`peek`) from zeroed memory initially.

We fix this by giving these StablePtr the same representation as other
null pointers. It's safe because StablePtr at offset 0 is unused (for
this exact reason).

- - - - -
55346ede by Sylvain Henry at 2024-02-12T12:18:42-05:00
JS: disable MergeObjsMode test

This isn't implemented for JS backend objects.

- - - - -
aef587f6 by Sylvain Henry at 2024-02-12T12:18:42-05:00
JS: add support for linking C sources

Support linking C sources with JS output of the JavaScript backend.
See the added documentation in the users guide.

The implementation simply extends the JS linker to use the objects (.o)
that were already produced by the emcc compiler and which were filtered
out previously. I've also added some options to control the link with C
functions (see the documentation about pragmas).

With this change I've successfully compiled the direct-sqlite package
which embeds the sqlite.c database code. Some wrappers are still
required (see the documentation about wrappers) but everything generic
enough to be reused for other libraries have been integrated into
rts/js/mem.js.

- - - - -
b71b392f by Sylvain Henry at 2024-02-12T12:18:42-05:00
JS: avoid EMCC logging spurious failure

emcc would sometime output messages like:

  cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds)
  cache:INFO:  - ok

Cf https://github.com/emscripten-core/emscripten/issues/18607

This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0

- - - - -
ff2c0cc9 by Simon Peyton Jones at 2024-02-12T12:19:17-05:00
Remove a dead comment

Just remove an out of date block of commented-out code, and tidy up
the relevant Notes.  See #8317.

- - - - -
4ff58d73 by Apoorv Ingle at 2024-02-12T20:59:58+00:00
make applicative do work with expansions, possibly badly

Fixes: #24406

- - - - -


30 changed files:

- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Driver/Config/StgToJS.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Runtime/Interpreter/JS.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/StgToJS/Linker/Linker.hs
- compiler/GHC/StgToJS/Linker/Types.hs
- compiler/GHC/StgToJS/Linker/Utils.hs
- compiler/GHC/StgToJS/Object.hs
- compiler/GHC/StgToJS/Prim.hs
- compiler/GHC/StgToJS/Types.hs
- compiler/GHC/Tc/Gen/Do.hs
- compiler/GHC/Utils/Binary.hs
- docs/users_guide/9.10.1-notes.rst
- docs/users_guide/debugging.rst
- docs/users_guide/javascript.rst
- rts/js/mem.js
- rts/js/rts.js
- rts/js/stableptr.js
- testsuite/driver/runtests.py
- testsuite/driver/testlib.py
- testsuite/tests/driver/MergeObjsMode/A.hs
- testsuite/tests/driver/MergeObjsMode/B.hs
- testsuite/tests/driver/MergeObjsMode/all.T
- testsuite/tests/driver/all.T
- testsuite/tests/driver/recomp011/all.T
- + testsuite/tests/javascript/js-c-sources/js-c-sources01.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4c1c5f7552f8f7b2c97cb895a6339d702a0a106a...4ff58d735c6432aee87bc504cf50ebcbacb7f39f

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4c1c5f7552f8f7b2c97cb895a6339d702a0a106a...4ff58d735c6432aee87bc504cf50ebcbacb7f39f
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/20240212/8188f5b0/attachment.html>


More information about the ghc-commits mailing list