Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c96c0f94
Commit
c96c0f94
authored
8 years ago
by
Vijay Pai
Browse files
Options
Downloads
Patches
Plain Diff
Remove DEBUG code that is itself buggy (integer overflow)
parent
feaee850
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/lib/support/stack_lockfree.c
+0
-33
0 additions, 33 deletions
src/core/lib/support/stack_lockfree.c
with
0 additions
and
33 deletions
src/core/lib/support/stack_lockfree.c
+
0
−
33
View file @
c96c0f94
...
@@ -72,11 +72,6 @@ typedef union lockfree_node {
...
@@ -72,11 +72,6 @@ typedef union lockfree_node {
struct
gpr_stack_lockfree
{
struct
gpr_stack_lockfree
{
lockfree_node
*
entries
;
lockfree_node
*
entries
;
lockfree_node
head
;
/* An atomic entry describing curr head */
lockfree_node
head
;
/* An atomic entry describing curr head */
#ifndef NDEBUG
/* Bitmap of pushed entries to check for double-push or pop */
gpr_atm
pushed
[(
INVALID_ENTRY_INDEX
+
1
)
/
(
8
*
sizeof
(
gpr_atm
))];
#endif
};
};
gpr_stack_lockfree
*
gpr_stack_lockfree_create
(
size_t
entries
)
{
gpr_stack_lockfree
*
gpr_stack_lockfree_create
(
size_t
entries
)
{
...
@@ -91,9 +86,6 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) {
...
@@ -91,9 +86,6 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) {
/* Clear out all entries */
/* Clear out all entries */
memset
(
stack
->
entries
,
0
,
entries
*
sizeof
(
stack
->
entries
[
0
]));
memset
(
stack
->
entries
,
0
,
entries
*
sizeof
(
stack
->
entries
[
0
]));
memset
(
&
stack
->
head
,
0
,
sizeof
(
stack
->
head
));
memset
(
&
stack
->
head
,
0
,
sizeof
(
stack
->
head
));
#ifndef NDEBUG
memset
(
&
stack
->
pushed
,
0
,
sizeof
(
stack
->
pushed
));
#endif
GPR_ASSERT
(
sizeof
(
stack
->
entries
->
atm
)
==
sizeof
(
stack
->
entries
->
contents
));
GPR_ASSERT
(
sizeof
(
stack
->
entries
->
atm
)
==
sizeof
(
stack
->
entries
->
contents
));
...
@@ -130,19 +122,6 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) {
...
@@ -130,19 +122,6 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *stack, int entry) {
newhead
.
contents
.
aba_ctr
=
++
curent
.
contents
.
aba_ctr
;
newhead
.
contents
.
aba_ctr
=
++
curent
.
contents
.
aba_ctr
;
gpr_atm_no_barrier_store
(
&
stack
->
entries
[
entry
].
atm
,
curent
.
atm
);
gpr_atm_no_barrier_store
(
&
stack
->
entries
[
entry
].
atm
,
curent
.
atm
);
#ifndef NDEBUG
/* Check for double push */
{
int
pushed_index
=
entry
/
(
int
)(
8
*
sizeof
(
gpr_atm
));
int
pushed_bit
=
entry
%
(
int
)(
8
*
sizeof
(
gpr_atm
));
gpr_atm
old_val
;
old_val
=
gpr_atm_no_barrier_fetch_add
(
&
stack
->
pushed
[
pushed_index
],
((
gpr_atm
)
1
<<
pushed_bit
));
GPR_ASSERT
((
old_val
&
(((
gpr_atm
)
1
)
<<
pushed_bit
))
==
0
);
}
#endif
do
{
do
{
/* Atomically get the existing head value for use */
/* Atomically get the existing head value for use */
head
.
atm
=
gpr_atm_no_barrier_load
(
&
(
stack
->
head
.
atm
));
head
.
atm
=
gpr_atm_no_barrier_load
(
&
(
stack
->
head
.
atm
));
...
@@ -168,18 +147,6 @@ int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) {
...
@@ -168,18 +147,6 @@ int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack) {
gpr_atm_no_barrier_load
(
&
(
stack
->
entries
[
head
.
contents
.
index
].
atm
));
gpr_atm_no_barrier_load
(
&
(
stack
->
entries
[
head
.
contents
.
index
].
atm
));
}
while
(
!
gpr_atm_no_barrier_cas
(
&
(
stack
->
head
.
atm
),
head
.
atm
,
newhead
.
atm
));
}
while
(
!
gpr_atm_no_barrier_cas
(
&
(
stack
->
head
.
atm
),
head
.
atm
,
newhead
.
atm
));
#ifndef NDEBUG
/* Check for valid pop */
{
int
pushed_index
=
head
.
contents
.
index
/
(
8
*
sizeof
(
gpr_atm
));
int
pushed_bit
=
head
.
contents
.
index
%
(
8
*
sizeof
(
gpr_atm
));
gpr_atm
old_val
;
old_val
=
gpr_atm_no_barrier_fetch_add
(
&
stack
->
pushed
[
pushed_index
],
-
((
gpr_atm
)
1
<<
pushed_bit
));
GPR_ASSERT
((
old_val
&
(((
gpr_atm
)
1
)
<<
pushed_bit
))
!=
0
);
}
#endif
return
head
.
contents
.
index
;
return
head
.
contents
.
index
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment