Commit c05529c2 authored by Simon Marlow's avatar Simon Marlow Committed by Ben Gamari
Browse files

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
parent ccda4862
...@@ -306,6 +306,9 @@ emitPrimOp dflags [res] GetCCSOfOp [arg] ...@@ -306,6 +306,9 @@ emitPrimOp dflags [res] GetCCSOfOp [arg]
emitPrimOp _ [res] GetCurrentCCSOp [_dummy_arg] emitPrimOp _ [res] GetCurrentCCSOp [_dummy_arg]
= emitAssign (CmmLocal res) cccsExpr = emitAssign (CmmLocal res) cccsExpr
emitPrimOp _ [res] MyThreadIdOp []
= emitAssign (CmmLocal res) currentTSOExpr
emitPrimOp dflags [res] ReadMutVarOp [mutv] emitPrimOp dflags [res] ReadMutVarOp [mutv]
= emitAssign (CmmLocal res) (cmmLoadIndexW dflags mutv (fixedHdrSizeW dflags) (gcWord dflags)) = emitAssign (CmmLocal res) (cmmLoadIndexW dflags mutv (fixedHdrSizeW dflags) (gcWord dflags))
......
...@@ -2403,7 +2403,6 @@ primop YieldOp "yield#" GenPrimOp ...@@ -2403,7 +2403,6 @@ primop YieldOp "yield#" GenPrimOp
primop MyThreadIdOp "myThreadId#" GenPrimOp primop MyThreadIdOp "myThreadId#" GenPrimOp
State# RealWorld -> (# State# RealWorld, ThreadId# #) State# RealWorld -> (# State# RealWorld, ThreadId# #)
with with
out_of_line = True
has_side_effects = True has_side_effects = True
primop LabelThreadOp "labelThread#" GenPrimOp primop LabelThreadOp "labelThread#" GenPrimOp
......
...@@ -943,11 +943,6 @@ stg_yieldzh () ...@@ -943,11 +943,6 @@ stg_yieldzh ()
jump stg_yield_noregs(); jump stg_yield_noregs();
} }
stg_myThreadIdzh ()
{
return (CurrentTSO);
}
stg_labelThreadzh ( gcptr threadid, W_ addr ) stg_labelThreadzh ( gcptr threadid, W_ addr )
{ {
#if defined(DEBUG) || defined(TRACING) || defined(DTRACE) #if defined(DEBUG) || defined(TRACING) || defined(DTRACE)
......
...@@ -641,7 +641,6 @@ ...@@ -641,7 +641,6 @@
SymI_HasProto(lookupSymbol) \ SymI_HasProto(lookupSymbol) \
SymI_HasProto(stg_makeStablePtrzh) \ SymI_HasProto(stg_makeStablePtrzh) \
SymI_HasProto(stg_mkApUpd0zh) \ SymI_HasProto(stg_mkApUpd0zh) \
SymI_HasProto(stg_myThreadIdzh) \
SymI_HasProto(stg_labelThreadzh) \ SymI_HasProto(stg_labelThreadzh) \
SymI_HasProto(stg_newArrayzh) \ SymI_HasProto(stg_newArrayzh) \
SymI_HasProto(stg_copyArrayzh) \ SymI_HasProto(stg_copyArrayzh) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment