Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tobias Decking
GHC
Commits
75947bb6
Commit
75947bb6
authored
Jun 15, 2013
by
ian@well-typed.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimise lockClosure when n_capabilities == 1; fixes #693
Based on a patch from Yuras Shumovich.
parent
9a8c20d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
11 deletions
+47
-11
includes/Rts.h
includes/Rts.h
+1
-1
includes/rts/storage/SMPClosureOps.h
includes/rts/storage/SMPClosureOps.h
+22
-6
rts/PrimOps.cmm
rts/PrimOps.cmm
+24
-4
No files found.
includes/Rts.h
View file @
75947bb6
...
...
@@ -203,6 +203,7 @@ INLINE_HEADER Time fsecondsToTime (double t)
#include "rts/SpinLock.h"
#include "rts/Messages.h"
#include "rts/Threads.h"
/* Storage format definitions */
#include "rts/storage/FunTypes.h"
...
...
@@ -230,7 +231,6 @@ INLINE_HEADER Time fsecondsToTime (double t)
#include "rts/Globals.h"
#include "rts/IOManager.h"
#include "rts/Linker.h"
#include "rts/Threads.h"
#include "rts/Ticky.h"
#include "rts/Timer.h"
#include "rts/Stable.h"
...
...
includes/rts/storage/SMPClosureOps.h
View file @
75947bb6
...
...
@@ -18,6 +18,7 @@
#else
EXTERN_INLINE
StgInfoTable
*
lockClosure
(
StgClosure
*
p
);
EXTERN_INLINE
StgInfoTable
*
reallyLockClosure
(
StgClosure
*
p
);
EXTERN_INLINE
StgInfoTable
*
tryLockClosure
(
StgClosure
*
p
);
EXTERN_INLINE
void
unlockClosure
(
StgClosure
*
p
,
const
StgInfoTable
*
info
);
...
...
@@ -31,7 +32,7 @@ EXTERN_INLINE void unlockClosure(StgClosure *p, const StgInfoTable *info);
// We want a callable copy of lockClosure() so that we can refer to it
// from .cmm files compiled using the native codegen.
EXTERN_INLINE
StgInfoTable
*
l
ockClosure
(
StgClosure
*
p
)
EXTERN_INLINE
StgInfoTable
*
reallyL
ockClosure
(
StgClosure
*
p
)
{
StgWord
info
;
do
{
...
...
@@ -44,14 +45,29 @@ EXTERN_INLINE StgInfoTable *lockClosure(StgClosure *p)
}
while
(
1
);
}
EXTERN_INLINE
StgInfoTable
*
lockClosure
(
StgClosure
*
p
)
{
if
(
n_capabilities
==
1
)
{
return
(
StgInfoTable
*
)
p
->
header
.
info
;
}
else
{
return
reallyLockClosure
(
p
);
}
}
EXTERN_INLINE
StgInfoTable
*
tryLockClosure
(
StgClosure
*
p
)
{
StgWord
info
;
info
=
xchg
((
P_
)(
void
*
)
&
p
->
header
.
info
,
(
W_
)
&
stg_WHITEHOLE_info
);
if
(
info
!=
(
W_
)
&
stg_WHITEHOLE_info
)
{
return
(
StgInfoTable
*
)
info
;
}
else
{
return
NULL
;
if
(
n_capabilities
==
1
)
{
return
(
StgInfoTable
*
)
p
->
header
.
info
;
}
else
{
info
=
xchg
((
P_
)(
void
*
)
&
p
->
header
.
info
,
(
W_
)
&
stg_WHITEHOLE_info
);
if
(
info
!=
(
W_
)
&
stg_WHITEHOLE_info
)
{
return
(
StgInfoTable
*
)
info
;
}
else
{
return
NULL
;
}
}
}
...
...
rts/PrimOps.cmm
View file @
75947bb6
...
...
@@ -1193,7 +1193,12 @@ stg_takeMVarzh ( P_ mvar /* :: MVar a */ )
W_
val
,
info
,
tso
,
q
;
#if
defined
(
THREADED_RTS
)
(
"
ptr
"
info
)
=
ccall
lockClosure
(
mvar
"
ptr
"
);
if
(
CInt
[
n_capabilities
]
==
1
::
CInt
)
{
info
=
GET_INFO
(
mvar
);
}
else
{
(
"
ptr
"
info
)
=
ccall
reallyLockClosure
(
mvar
"
ptr
"
);
}
#else
info
=
GET_INFO
(
mvar
);
#endif
...
...
@@ -1290,7 +1295,12 @@ stg_tryTakeMVarzh ( P_ mvar /* :: MVar a */ )
W_
val
,
info
,
tso
,
q
;
#if
defined
(
THREADED_RTS
)
(
"
ptr
"
info
)
=
ccall
lockClosure
(
mvar
"
ptr
"
);
if
(
CInt
[
n_capabilities
]
==
1
::
CInt
)
{
info
=
GET_INFO
(
mvar
);
}
else
{
(
"
ptr
"
info
)
=
ccall
reallyLockClosure
(
mvar
"
ptr
"
);
}
#else
info
=
GET_INFO
(
mvar
);
#endif
...
...
@@ -1361,7 +1371,12 @@ stg_putMVarzh ( P_ mvar, /* :: MVar a */
W_
info
,
tso
,
q
;
#if
defined
(
THREADED_RTS
)
(
"
ptr
"
info
)
=
ccall
lockClosure
(
mvar
"
ptr
"
);
if
(
CInt
[
n_capabilities
]
==
1
::
CInt
)
{
info
=
GET_INFO
(
mvar
);
}
else
{
(
"
ptr
"
info
)
=
ccall
reallyLockClosure
(
mvar
"
ptr
"
);
}
#else
info
=
GET_INFO
(
mvar
);
#endif
...
...
@@ -1454,7 +1469,12 @@ stg_tryPutMVarzh ( P_ mvar, /* :: MVar a */
W_
info
,
tso
,
q
;
#if
defined
(
THREADED_RTS
)
(
"
ptr
"
info
)
=
ccall
lockClosure
(
mvar
"
ptr
"
);
if
(
CInt
[
n_capabilities
]
==
1
::
CInt
)
{
info
=
GET_INFO
(
mvar
);
}
else
{
(
"
ptr
"
info
)
=
ccall
reallyLockClosure
(
mvar
"
ptr
"
);
}
#else
info
=
GET_INFO
(
mvar
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment