Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
5ba7445b
Commit
5ba7445b
authored
Mar 20, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #535 from ken-tilera/master
Optimize atomics implementaiton for the Tile architecture
parents
39214b3e
3286bf5a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
0 deletions
+19
-0
AUTHORS
AUTHORS
+1
-0
atomic_counter.hpp
src/atomic_counter.hpp
+10
-0
atomic_ptr.hpp
src/atomic_ptr.hpp
+8
-0
No files found.
AUTHORS
View file @
5ba7445b
...
...
@@ -41,6 +41,7 @@ Jacob Rideout <jacob.rideout@returnpath.net>
Joe Thornber <joe.thornber@gmail.com>
Jon Dyte <jon@totient.co.uk>
Kamil Shakirov <kamils80@gmail.com>
Ken Steele <ken@tilera.com>
Marc Rossi <mrossi19@gmail.com>
Martin Hurton <hurtonm@gmail.com>
Martin Lucina <martin@lucina.net>
...
...
src/atomic_counter.hpp
View file @
5ba7445b
...
...
@@ -33,6 +33,8 @@
#define ZMQ_ATOMIC_COUNTER_WINDOWS
#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
#define ZMQ_ATOMIC_COUNTER_ATOMIC_H
#elif defined __tile__
#define ZMQ_ATOMIC_COUNTER_TILE
#else
#define ZMQ_ATOMIC_COUNTER_MUTEX
#endif
...
...
@@ -43,6 +45,8 @@
#include "windows.hpp"
#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
#include <atomic.h>
#elif defined ZMQ_ATOMIC_COUNTER_TILE
#include <arch/atomic.h>
#endif
namespace
zmq
...
...
@@ -82,6 +86,8 @@ namespace zmq
#elif defined ZMQ_ATOMIC_COUNTER_ATOMIC_H
integer_t
new_value
=
atomic_add_32_nv
(
&
value
,
increment_
);
old_value
=
new_value
-
increment_
;
#elif defined ZMQ_ATOMIC_COUNTER_TILE
old_value
=
arch_atomic_add
(
&
value
,
increment_
);
#elif defined ZMQ_ATOMIC_COUNTER_X86
__asm__
volatile
(
"lock; xadd %0, %1
\n\t
"
...
...
@@ -123,6 +129,10 @@ namespace zmq
int32_t
delta
=
-
((
int32_t
)
decrement
);
integer_t
nv
=
atomic_add_32_nv
(
&
value
,
delta
);
return
nv
!=
0
;
#elif defined ZMQ_ATOMIC_COUNTER_TILE
int32_t
delta
=
-
((
int32_t
)
decrement
);
integer_t
nv
=
arch_atomic_add
(
&
value
,
delta
);
return
nv
!=
0
;
#elif defined ZMQ_ATOMIC_COUNTER_X86
integer_t
oldval
=
-
decrement
;
volatile
integer_t
*
val
=
&
value
;
...
...
src/atomic_ptr.hpp
View file @
5ba7445b
...
...
@@ -28,6 +28,8 @@
#define ZMQ_ATOMIC_PTR_X86
#elif defined __ARM_ARCH_7A__ && defined __GNUC__
#define ZMQ_ATOMIC_PTR_ARM
#elif defined __tile__
#define ZMQ_ATOMIC_PTR_TILE
#elif defined ZMQ_HAVE_WINDOWS
#define ZMQ_ATOMIC_PTR_WINDOWS
#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD)
...
...
@@ -42,6 +44,8 @@
#include "windows.hpp"
#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
#include <atomic.h>
#elif defined ZMQ_ATOMIC_PTR_TILE
#include <arch/atomic.h>
#endif
namespace
zmq
...
...
@@ -80,6 +84,8 @@ namespace zmq
return
(
T
*
)
InterlockedExchangePointer
((
PVOID
*
)
&
ptr
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
return
(
T
*
)
atomic_swap_ptr
(
&
ptr
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_TILE
return
(
T
*
)
arch_atomic_exchange
(
&
ptr
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_X86
T
*
old
;
__asm__
volatile
(
...
...
@@ -123,6 +129,8 @@ namespace zmq
(
volatile
PVOID
*
)
&
ptr
,
val_
,
cmp_
);
#elif defined ZMQ_ATOMIC_PTR_ATOMIC_H
return
(
T
*
)
atomic_cas_ptr
(
&
ptr
,
cmp_
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_TILE
return
(
T
*
)
arch_atomic_val_compare_and_exchange
(
&
ptr
,
cmp_
,
val_
);
#elif defined ZMQ_ATOMIC_PTR_X86
T
*
old
;
__asm__
volatile
(
...
...
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