[Git][ghc/ghc][wip/js-staging] Implement get/set thread label prims
Josh Meredith (@JoshMeredith)
gitlab at gitlab.haskell.org
Wed Oct 5 10:37:05 UTC 2022
Josh Meredith pushed to branch wip/js-staging at Glasgow Haskell Compiler / GHC
Commits:
33600658 by Josh Meredith at 2022-10-05T10:36:56+00:00
Implement get/set thread label prims
- - - - -
2 changed files:
- compiler/GHC/StgToJS/Prim.hs
- rts/js/mem.js
Changes:
=====================================
compiler/GHC/StgToJS/Prim.hs
=====================================
@@ -1227,8 +1227,8 @@ genPrim prof ty op = case op of
WhereFromOp -> unhandledPrimop op -- should be easily implementable with o.f.n
SetThreadAllocationCounter -> unhandledPrimop op
- GetThreadLabelOp -> unhandledPrimop op
- LabelThreadOp -> unhandledPrimop op -- \[] [t,la,lo] -> PrimInline $ t .^ "label" |= ValExpr (JList [la, lo])
+ GetThreadLabelOp -> \[r1, r2] [t] -> PrimInline $ appT [r1, r2] "h$getThreadLabel" [t]
+ LabelThreadOp -> \[] [t,l] -> PrimInline $ t .^ "label" |= l
------------------------------- Vector -----------------------------------------
-- For now, vectors are unsupported on the JS backend. Simply put, they do not
=====================================
rts/js/mem.js
=====================================
@@ -1436,3 +1436,11 @@ function h$pext64(src_b, src_a, mask_b, mask_a) {
}
RETURN_UBX_TUP2(dst_b, dst_a);
}
+
+function h$getThreadLabel(t) {
+ if (t.label) {
+ RETURN_UBX_TUP2(1, t.label);
+ } else {
+ RETURN_UBX_TUP2(0, 0);
+ }
+}
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33600658f33b3633a14bf6bbd0f2ac3dc97844f0
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/33600658f33b3633a14bf6bbd0f2ac3dc97844f0
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/20221005/77ee4a66/attachment-0001.html>
More information about the ghc-commits
mailing list