[Git][ghc/ghc][master] compiler/rts: fix wasm unreg regression

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Wed Feb 14 19:28:54 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d8d1333a by Cheng Shao at 2024-02-14T14:28:23-05:00
compiler/rts: fix wasm unreg regression

This commit fixes two wasm unreg regressions caught by a nightly
pipeline:

- Unknown stg_scheduler_loopzh symbol when compiling scheduler.cmm
- Invalid _hs_constructor(101) function name when handling ctor

- - - - -


2 changed files:

- compiler/GHC/CmmToC.hs
- rts/wasm/scheduler.cmm


Changes:

=====================================
compiler/GHC/CmmToC.hs
=====================================
@@ -1526,15 +1526,15 @@ pprHexVal platform w rep = parens ctype <> rawlit
 pprCtorArray :: Platform -> InitOrFini -> [CLabel] -> SDoc
 pprCtorArray platform initOrFini lbls =
        decls
-    <> text "static __attribute__((" <> attribute <> text "))"
-    <> text "void _hs_" <> attribute <> text "()"
+    <> text "static __attribute__((" <> text attribute <> text "))"
+    <> text "void _hs_" <> text suffix <> text "()"
     <> braces body
   where
     body = vcat [ pprCLabel platform lbl <> text " ();" | lbl <- lbls ]
     decls = vcat [ text "void" <+> pprCLabel platform lbl <> text " (void);" | lbl <- lbls ]
-    attribute = case initOrFini of
+    (attribute, suffix) = case initOrFini of
                   IsInitArray
                     -- See Note [JSFFI initialization] for details
-                    | ArchWasm32 <- platformArch platform -> text "constructor(101)"
-                    | otherwise -> text "constructor"
-                  IsFiniArray -> text "destructor"
+                    | ArchWasm32 <- platformArch platform -> ("constructor(101)", "constructor")
+                    | otherwise -> ("constructor", "constructor")
+                  IsFiniArray -> ("destructor", "destructor")


=====================================
rts/wasm/scheduler.cmm
=====================================
@@ -127,17 +127,6 @@ section "data" {
   stg_scheduler_loop_tid: I64 0 :: I64;
 }
 
-// After creating a new thread with only a stop frame on the stack,
-// push a stg_scheduler_loop frame to make it a scheduler thread. We
-// could omit this and use C FFI to export a Haskell function that
-// invokes the scheduler loop via a foreign import prim, but that is
-// of course less efficient.
-INFO_TABLE_RET (stg_scheduler_loop, RET_SMALL, W_ info_ptr)
-  return ()
-{
-  jump stg_scheduler_loopzh ();
-}
-
 // This always returns () in R1 at the end. If only run via a foreign
 // import prim, it's fine to not return anything, but when run via a
 // stg_scheduler_loop stack frame, then the stop frame expects a valid
@@ -193,3 +182,14 @@ cleanup:
   I64[stg_scheduler_loop_tid] = 0 :: I64;
   return (ghczmprim_GHCziTupleziPrim_Z0T_closure);
 }
+
+// After creating a new thread with only a stop frame on the stack,
+// push a stg_scheduler_loop frame to make it a scheduler thread. We
+// could omit this and use C FFI to export a Haskell function that
+// invokes the scheduler loop via a foreign import prim, but that is
+// of course less efficient.
+INFO_TABLE_RET (stg_scheduler_loop, RET_SMALL, W_ info_ptr)
+  return ()
+{
+  jump stg_scheduler_loopzh ();
+}



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d8d1333a52c325d1502e79533f2047c194280d23

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d8d1333a52c325d1502e79533f2047c194280d23
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/20240214/c5ade4b0/attachment-0001.html>


More information about the ghc-commits mailing list