[Git][ghc/ghc][wip/js-staging] 2 commits: JS.Primops: Add listThreads op

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Fri Sep 23 10:10:14 UTC 2022



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


Commits:
3854b21f by doyougnu at 2022-09-23T06:09:44-04:00
JS.Primops: Add listThreads op

- - - - -
6b188264 by doyougnu at 2022-09-23T06:09:48-04:00
JS.Primops: Add Read/WriteAddrOp ops

- - - - -


1 changed file:

- compiler/GHC/StgToJS/Prim.hs


Changes:

=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -928,6 +928,7 @@ genPrim prof ty op = case op of
   IsCurrentThreadBoundOp -> \[r] [] -> PrimInline $ r |= one_
   NoDuplicateOp -> \[] [] -> PrimInline mempty -- don't need to do anything as long as we have eager blackholing
   ThreadStatusOp -> \[stat,cap,locked] [tid] -> PrimInline $ appT [stat, cap, locked] "h$threadStatus" [tid]
+  ListThreadsOp  -> \[r] [] -> PrimInline $ r |= var "h$threads"
 
 ------------------------------- Weak Pointers -----------------------------------
 
@@ -1199,12 +1200,6 @@ genPrim prof ty op = case op of
   FetchOrAddrOp_Word                -> \[r] [a,o,v] -> PrimInline $ fetchOpAddr BOr   r a o v
   FetchXorAddrOp_Word               -> \[r] [a,o,v] -> PrimInline $ fetchOpAddr BXor  r a o v
 
-
------------------------------- Unhandled primops -------------------
-
-  ShrinkSmallMutableArrayOp_Char    -> unhandledPrimop op
-  GetSizeofSmallMutableArrayOp      -> unhandledPrimop op
-
   InterlockedExchange_Addr          -> \[r_a,r_o] [a1,o1,a2,o2] -> PrimInline $
                                                              mconcat [ r_a |= a1
                                                                      , r_o |= o1
@@ -1217,8 +1212,14 @@ genPrim prof ty op = case op of
                                                                ]
 
 
-  AtomicReadAddrOp_Word             -> unhandledPrimop op
-  AtomicWriteAddrOp_Word            -> unhandledPrimop op
+------------------------------ Unhandled primops -------------------
+
+  ShrinkSmallMutableArrayOp_Char    -> unhandledPrimop op
+  GetSizeofSmallMutableArrayOp      -> unhandledPrimop op
+
+
+  AtomicReadAddrOp_Word             -> \[r] [a,o]   -> PrimInline $ r |= dv_u32 a o
+  AtomicWriteAddrOp_Word            -> \[]  [a,o,w] -> PrimInline $ dv_s_u32 a o w
 
   NewIOPortOp                       -> unhandledPrimop op
   ReadIOPortOp                      -> unhandledPrimop op
@@ -1235,7 +1236,6 @@ genPrim prof ty op = case op of
 
   SetThreadAllocationCounter        -> unhandledPrimop op
   GetThreadLabelOp                  -> unhandledPrimop op
-  ListThreadsOp                     -> unhandledPrimop op
   LabelThreadOp                     -> unhandledPrimop op -- \[] [t,la,lo] -> PrimInline $ t .^ "label" |= ValExpr (JList [la, lo])
 
 ------------------------------- Vector -----------------------------------------



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/765da2901c14e7eae70a2996fc60c71aff3566a8...6b188264d4000c0698d73219ba0016edd27c2dbb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/765da2901c14e7eae70a2996fc60c71aff3566a8...6b188264d4000c0698d73219ba0016edd27c2dbb
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/20220923/ad9bdb55/attachment-0001.html>


More information about the ghc-commits mailing list