Skip to content

Commit

Permalink
Revert "Update references to tsan state (#42440)"
Browse files Browse the repository at this point in the history
This reverts commit 15772ba.
  • Loading branch information
Keno authored and vtjnash committed Oct 3, 2021
1 parent a9a1d80 commit 5b42a34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/gc-stacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ void sweep_stack_pools(void)
_jl_free_stack(ptls2, stkbuf, bufsz);
}
#ifdef _COMPILER_TSAN_ENABLED_
if (t->tsan_state) {
__tsan_destroy_fiber(t->tsan_state);
t->tsan_state = NULL;
if (t->ctx.tsan_state) {
__tsan_destroy_fiber(t->ctx.tsan_state);
t->ctx.tsan_state = NULL;
}
#endif
}
Expand Down
12 changes: 6 additions & 6 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ static inline void sanitizer_finish_switch_fiber(void) {}
#endif

#if defined(_COMPILER_TSAN_ENABLED_)
static inline void tsan_destroy_ctx(jl_ptls_t ptls, void **state) {
if (state != &ptls->root_task->tsan_state) {
__tsan_destroy_fiber(*state);
static inline void tsan_destroy_ctx(jl_ptls_t ptls, void *state) {
if (state != &ptls->root_task->state) {
__tsan_destroy_fiber(ctx->state);
}
*state = NULL;
ctx->state = NULL;
}
static inline void tsan_switch_to_ctx(void *state) {
__tsan_switch_to_fiber(state, 0);
Expand Down Expand Up @@ -336,7 +336,7 @@ static void ctx_switch(jl_task_t *lastt)
assert(ptls->locks.len == 0);

#ifdef _COMPILER_TSAN_ENABLED_
if (lastt->tsan_state != __tsan_get_current_fiber()) {
if (lastt->ctx.tsan_state != __tsan_get_current_fiber()) {
// Something went really wrong - don't even assume that we can
// use assert/abort which involve lots of signal handling that
// looks at the tsan state.
Expand Down Expand Up @@ -402,7 +402,7 @@ static void ctx_switch(jl_task_t *lastt)
jl_set_pgcstack(&t->gcstack);

#if defined(_COMPILER_TSAN_ENABLED_)
tsan_switch_to_ctx(t->tsan_state);
tsan_switch_to_ctx(&t->tsan_state);
if (killed)
tsan_destroy_ctx(ptls, &lastt->tsan_state);
#endif
Expand Down

0 comments on commit 5b42a34

Please sign in to comment.