Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
llvm-epi-0.8
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor 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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Roger Ferrer
llvm-epi-0.8
Commits
c23b2185
Commit
c23b2185
authored
12 years ago
by
Dmitry Vyukov
Browse files
Options
Downloads
Patches
Plain Diff
tsan: add java rwlock test
llvm-svn: 170894
parent
c55ed2f5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler-rt/lib/tsan/lit_tests/java_rwlock.cc
+32
-0
32 additions, 0 deletions
compiler-rt/lib/tsan/lit_tests/java_rwlock.cc
with
32 additions
and
0 deletions
compiler-rt/lib/tsan/lit_tests/java_rwlock.cc
0 → 100644
+
32
−
0
View file @
c23b2185
// RUN: %clangxx_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
#include
"java.h"
jptr
varaddr
;
jptr
lockaddr
;
void
*
Thread
(
void
*
p
)
{
__tsan_java_mutex_read_lock
(
lockaddr
);
*
(
int
*
)
varaddr
=
42
;
__tsan_java_mutex_read_unlock
(
lockaddr
);
return
0
;
}
int
main
()
{
int
const
kHeapSize
=
1024
*
1024
;
void
*
jheap
=
malloc
(
kHeapSize
);
__tsan_java_init
((
jptr
)
jheap
,
kHeapSize
);
const
int
kBlockSize
=
16
;
__tsan_java_alloc
((
jptr
)
jheap
,
kBlockSize
);
varaddr
=
(
jptr
)
jheap
;
lockaddr
=
(
jptr
)
jheap
+
8
;
pthread_t
th
;
pthread_create
(
&
th
,
0
,
Thread
,
0
);
__tsan_java_mutex_lock
(
lockaddr
);
*
(
int
*
)
varaddr
=
43
;
__tsan_java_mutex_unlock
(
lockaddr
);
pthread_join
(
th
,
0
);
__tsan_java_free
((
jptr
)
jheap
,
kBlockSize
);
return
__tsan_java_fini
();
}
// CHECK-NOT: WARNING: ThreadSanitizer: data race
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