[Git][ghc/ghc][wip/js-staging] 2 commits: StaticPtr: don't generate CStubs for the JS backend
Sylvain Henry (@hsyl20)
gitlab at gitlab.haskell.org
Mon Aug 29 12:45:08 UTC 2022
Sylvain Henry pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
a1f586ea by Sylvain Henry at 2022-08-29T14:48:01+02:00
StaticPtr: don't generate CStubs for the JS backend
- - - - -
5cdbdbc9 by Sylvain Henry at 2022-08-29T14:48:01+02:00
StaticPtr: fix hs_spt_lookup after upstream change
- - - - -
2 changed files:
- compiler/GHC/Iface/Tidy/StaticPtrTable.hs
- js/staticpointer.js.pp
Changes:
=====================================
compiler/GHC/Iface/Tidy/StaticPtrTable.hs
=====================================
@@ -239,8 +239,13 @@ sptCreateStaticBinds opts this_mod binds = do
-- @fps@ is a list associating each binding corresponding to a static entry with
-- its fingerprint.
sptModuleInitCode :: Platform -> Module -> [SptEntry] -> CStub
-sptModuleInitCode _ _ [] = mempty
-sptModuleInitCode platform this_mod entries =
+sptModuleInitCode platform this_mod entries
+ -- no CStub if there is no entry
+ | [] <- entries = mempty
+ -- no CStub for the JS backend: it deals with it directly during JS code
+ -- generation
+ | ArchJavaScript <- platformArch platform = mempty
+ | otherwise =
initializerCStub platform init_fn_nm empty init_fn_body `mappend`
finalizerCStub platform fini_fn_nm empty fini_fn_body
where
=====================================
js/staticpointer.js.pp
=====================================
@@ -36,9 +36,15 @@ function h$hs_spt_keys(tgt_d, tgt_o, n) {
return Math.min(n,ks.length);
}
-function h$hs_spt_lookup(key1,key2,key3,key4) {
- // var i3 = key_d.i3, o = key_o >> 2;
- // h$log("hs_spt_lookup");
+function h$hs_spt_lookup(key_v,key_o) {
+ // We know that the array is freshly allocated so we don't have to care
+ // about the offset (should be 0).
+ //
+ // note that the order of the keys is weird due to endianness
+ var key2 = key_v.i3[0] >>> 0;
+ var key1 = key_v.i3[1] >>> 0;
+ var key4 = key_v.i3[2] >>> 0;
+ var key3 = key_v.i3[3] >>> 0;
RETURN_UBX_TUP2(h$hs_spt_lookup_key(key1,key2,key3,key4), 0);
}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8428b5d9358bc94d89b084128fbe9cdce65771af...5cdbdbc9d6e5e097638f54de1f08a06de9bf3286
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8428b5d9358bc94d89b084128fbe9cdce65771af...5cdbdbc9d6e5e097638f54de1f08a06de9bf3286
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/20220829/cb1fb91a/attachment-0001.html>
More information about the ghc-commits
mailing list