[Git][ghc/ghc][wip/js-staging] JS.Prim: Prefetch PrimOps are noOps

doyougnu (@doyougnu) gitlab at gitlab.haskell.org
Tue Sep 13 09:08:17 UTC 2022



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


Commits:
a67f9d94 by doyougnu at 2022-09-13T05:07:42-04:00
JS.Prim: Prefetch PrimOps are noOps

- - - - -


1 changed file:

- compiler/GHC/StgToJS/Prim.hs


Changes:

=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -1207,22 +1207,22 @@ genPrim prof ty op = case op of
   VecReadScalarOffAddrOp _ _ _      -> unhandledPrimop op
   VecWriteScalarOffAddrOp _ _ _     -> unhandledPrimop op
 
-  PrefetchByteArrayOp3              -> unhandledPrimop op
-  PrefetchMutableByteArrayOp3       -> unhandledPrimop op
-  PrefetchAddrOp3                   -> unhandledPrimop op
-  PrefetchValueOp3                  -> unhandledPrimop op
-  PrefetchByteArrayOp2              -> unhandledPrimop op
-  PrefetchMutableByteArrayOp2       -> unhandledPrimop op
-  PrefetchAddrOp2                   -> unhandledPrimop op
-  PrefetchValueOp2                  -> unhandledPrimop op
-  PrefetchByteArrayOp1              -> unhandledPrimop op
-  PrefetchMutableByteArrayOp1       -> unhandledPrimop op
-  PrefetchAddrOp1                   -> unhandledPrimop op
-  PrefetchValueOp1                  -> unhandledPrimop op
-  PrefetchByteArrayOp0              -> unhandledPrimop op
-  PrefetchMutableByteArrayOp0       -> unhandledPrimop op
-  PrefetchAddrOp0                   -> unhandledPrimop op
-  PrefetchValueOp0                  -> unhandledPrimop op
+  PrefetchByteArrayOp3              -> noOp
+  PrefetchMutableByteArrayOp3       -> noOp
+  PrefetchAddrOp3                   -> noOp
+  PrefetchValueOp3                  -> noOp
+  PrefetchByteArrayOp2              -> noOp
+  PrefetchMutableByteArrayOp2       -> noOp
+  PrefetchAddrOp2                   -> noOp
+  PrefetchValueOp2                  -> noOp
+  PrefetchByteArrayOp1              -> noOp
+  PrefetchMutableByteArrayOp1       -> noOp
+  PrefetchAddrOp1                   -> noOp
+  PrefetchValueOp1                  -> noOp
+  PrefetchByteArrayOp0              -> noOp
+  PrefetchMutableByteArrayOp0       -> noOp
+  PrefetchAddrOp0                   -> noOp
+  PrefetchValueOp0                  -> noOp
 
 unhandledPrimop :: PrimOp -> [JExpr] -> [JExpr] -> PrimRes
 unhandledPrimop op rs as = PrimInline $ mconcat
@@ -1237,6 +1237,12 @@ unhandledPrimop op rs as = PrimInline $ mconcat
   , mconcat $ zipWith (\r reg -> r |= toJExpr reg) rs (enumFrom Ret1)
   ]
 
+-- | A No Op, used for primops the JS platform cannot or do not support. For
+-- example, the prefetching primops do not make sense on the JS platform because
+-- we do not have enough control over memory to provide any kind of prefetching
+-- mechanism. Hence, these are NoOps.
+noOp :: Foldable f => f a -> f a -> PrimRes
+noOp = const . const $ PrimInline mempty
 
 -- tuple returns
 appT :: [JExpr] -> FastString -> [JExpr] -> JStat



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

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


More information about the ghc-commits mailing list