Skip to content

Commit

Permalink
[Wisp] solve assertion failure related to BarrierSet
Browse files Browse the repository at this point in the history
Summary:
The main thread is created before a barrier set is available. The call to
BarrierSet::on_thread_create() for the main thread is therefore deferred
until it calls BarrierSet::set_barrier_set(). For WispThread in main
thread, we should do the same.

Test Plan:
runtime/coroutine/PremainWithWispMonitorTest.java
runtime/coroutine/logCompilationTest.sh

Reviewers: 梁希,三红

Issue: https://aone.alibaba-inc.com/task/21343603

CR: https://code.aone.alibaba-inc.com/xcode/jdk11/codereview/1533730
  • Loading branch information
shiyue.xw authored and Sere-Fu committed Aug 19, 2021
1 parent b8473d8 commit f37c1e6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/hotspot/share/gc/shared/barrierSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
#include "runtime/thread.hpp"
#include "runtime/coroutine.hpp"
#include "utilities/macros.hpp"

BarrierSet* BarrierSet::_barrier_set = NULL;
Expand All @@ -37,7 +38,12 @@ void BarrierSet::set_barrier_set(BarrierSet* barrier_set) {
// The barrier set was not initialized when the this thread (the main thread)
// was created, so the call to BarrierSet::on_thread_create() had to be deferred
// until we have a barrier set. Now we have a barrier set, so we make the call.
_barrier_set->on_thread_create(Thread::current());
Thread *thread = Thread::current();
_barrier_set->on_thread_create(thread);
if (UseWispMonitor) {
WispThread* wisp_thread = WispThread::current(thread);
_barrier_set->on_thread_create(wisp_thread);
}
}

// Called from init.cpp
Expand Down

0 comments on commit f37c1e6

Please sign in to comment.