summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2018-02-18 11:09:19 -0500
committerBen Gamari <ben@smart-cactus.org>2018-02-18 11:57:45 -0500
commitc05529c2219d12ee950eb8972e1aca135cd8e032 (patch)
tree557d1615f569d8448da5f3c0f96434d45e064a09 /compiler/codeGen
parentccda4862102104e080a200e4d9c2ca8f42eb5b70 (diff)
downloadhaskell-c05529c2219d12ee950eb8972e1aca135cd8e032.tar.gz
myThreadId# is trivial; make it an inline primop
The pattern `threadCapability =<< myThreadId` is used a lot in code that uses `hs_try_putmvar`, I want to make it cheaper. Test Plan: validate Reviewers: bgamari, erikd Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4381
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmPrim.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/codeGen/StgCmmPrim.hs b/compiler/codeGen/StgCmmPrim.hs
index 7661e9f8fb..b5cd267c6b 100644
--- a/compiler/codeGen/StgCmmPrim.hs
+++ b/compiler/codeGen/StgCmmPrim.hs
@@ -306,6 +306,9 @@ emitPrimOp dflags [res] GetCCSOfOp [arg]
emitPrimOp _ [res] GetCurrentCCSOp [_dummy_arg]
= emitAssign (CmmLocal res) cccsExpr
+emitPrimOp _ [res] MyThreadIdOp []
+ = emitAssign (CmmLocal res) currentTSOExpr
+
emitPrimOp dflags [res] ReadMutVarOp [mutv]
= emitAssign (CmmLocal res) (cmmLoadIndexW dflags mutv (fixedHdrSizeW dflags) (gcWord dflags))