38 while (
state != target_state) {
49 EXPECT_EQ(expected_state,
state);
53 EXPECT_NE(expected_state,
state);
55 bool IsIn(intptr_t expected_state) {
57 return expected_state ==
state;
71 const bool kBypassSafepoint =
false;
143 SafepointOperation_SafepointOpWhileDeoptSafepointOpBlocked) {
144 auto isolate_group = thread->isolate_group();
146 std::shared_ptr<DeoptTask::Data> deopt(
new DeoptTask::Data(isolate_group));
147 std::shared_ptr<GcWithoutDeoptTask::Data>
gc(
150 thread->EnterSafepoint();
191 thread->ExitSafepoint();
244 SafepointOperation_SafepointOpBlockedWhileDeoptSafepointOp) {
245 auto isolate_group = thread->isolate_group();
247 std::shared_ptr<LongDeoptTask::Data> deopt(
251 thread->EnterSafepoint();
290 thread->ExitSafepoint();
370 if ((now - last_sync) > 1000) {
395 auto isolate_group = thread->isolate_group();
397 const intptr_t kTaskCount = 6;
398 std::atomic<intptr_t> gc_only_checkins[kTaskCount];
399 std::atomic<intptr_t> deopt_checkins[kTaskCount];
400 std::atomic<intptr_t> reload_checkins[kTaskCount];
401 std::atomic<intptr_t> timeout_checkins[kTaskCount];
402 for (intptr_t
i = 0;
i < kTaskCount; ++
i) {
403 gc_only_checkins[
i] = 0;
404 deopt_checkins[
i] = 0;
405 reload_checkins[
i] = 0;
406 timeout_checkins[
i] = 0;
425 auto wait_for_sync = [&](intptr_t syncs) {
428 for (intptr_t
i = 0;
i < kTaskCount; ++
i) {
429 const intptr_t
all = gc_only_checkins[
i] + deopt_checkins[
i] +
430 reload_checkins[
i] + timeout_checkins[
i];
443 std::vector<std::shared_ptr<CheckinTask::Data>> threads;
444 for (intptr_t
i = 0;
i < kTaskCount; ++
i) {
445 const auto level = task_to_level(
i);
447 isolate_group,
level, &gc_only_checkins[
i], &deopt_checkins[
i],
448 &reload_checkins[
i], &timeout_checkins[
i]));
449 threads.push_back(std::move(
data));
456 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
459 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
462 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
490 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
493 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
496 for (intptr_t
i = 0;
i < kTaskCount; ++
i) {
497 switch (task_to_level(
i)) {
499 EXPECT_EQ(2, gc_only_checkins[
i]);
500 EXPECT_EQ(0, deopt_checkins[
i]);
501 EXPECT_EQ(0, reload_checkins[
i]);
502 EXPECT_EQ(4, timeout_checkins[
i]);
505 EXPECT_EQ(0, gc_only_checkins[
i]);
506 EXPECT_EQ(4, deopt_checkins[
i]);
507 EXPECT_EQ(0, reload_checkins[
i]);
508 EXPECT_EQ(2, timeout_checkins[
i]);
511 EXPECT_EQ(0, gc_only_checkins[
i]);
512 EXPECT_EQ(0, deopt_checkins[
i]);
513 EXPECT_EQ(6, reload_checkins[
i]);
514 EXPECT_EQ(0, timeout_checkins[
i]);
554 const bool kBypassSafepoint =
false;
580 auto isolate_group = thread->isolate_group();
582 const intptr_t kTaskCount = 5;
584 std::vector<std::shared_ptr<StressTask::Data>> threads;
585 for (intptr_t
i = 0;
i < kTaskCount; ++
i) {
587 threads.push_back(std::move(
data));
590 thread->EnterSafepoint();
595 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
598 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
601 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
605 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
608 for (intptr_t
i = 0;
i < kTaskCount;
i++) {
612 thread->ExitSafepoint();
616 auto safepoint_handler = thread->isolate_group()->safepoint_handler();
619 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
622 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
625 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
628 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
633 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
636 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
641 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
644 EXPECT(safepoint_handler->InnermostSafepointOperation(thread) ==
650 SafepointOperation_NonDeoptAndDeoptNesting,
719 auto isolate = thread->isolate();
720 auto messages = isolate->message_handler();
728 ASSERT(!thread->IsAtSafepoint());
731 thread->EnterSafepoint();
735 std::shared_ptr<ReloadTask::Data> task(
742 thread->ExitSafepoint();
744 EXPECT(!messages->HasOOBMessages());
750 std::unique_ptr<Message>
message) {
757 const auto& array = Array::Cast(msg);
758 EXPECT(array.Length() == 3);
765 auto isolate = thread->isolate();
766 auto messages = isolate->message_handler();
770 std::shared_ptr<ReloadTask::Data> task(
785 ASSERT(!thread->IsAtSafepoint());
786 while (!messages->HasOOBMessages()) {
792 std::unique_ptr<Message>
message = messages->StealOOBMessage();
798 thread->BlockForSafepoint();
806 auto isolate = thread->isolate();
807 auto messages = isolate->message_handler();
814 std::shared_ptr<ReloadTask::Data> task(
823 ASSERT(!thread->IsAtSafepoint());
826 thread->EnterSafepoint();
829 ASSERT(thread->IsAtSafepoint());
830 while (!messages->HasOOBMessages()) {
834 std::unique_ptr<Message>
message = messages->StealOOBMessage();
837 thread->ExitSafepoint();
839 EXPECT(!messages->HasOOBMessages());
845 EXPECT(messages->HasOOBMessages());
846 std::unique_ptr<Message>
message = messages->StealOOBMessage();
852 thread->BlockForSafepoint();
CheckinTask(std::shared_ptr< Data > data)
bool SafepointIfRequested(Thread *thread, std::atomic< intptr_t > *checkins)
virtual void RunInternal()
DeoptTask(std::shared_ptr< Data > data)
@ kFinishedDeoptOperation
virtual void RunInternal()
GcWithoutDeoptTask(std::shared_ptr< Data > data)
virtual void RunInternal()
@ kStartSafepointOperation
Dart_Port main_port() const
virtual void RunInternal()
LongDeoptTask(std::shared_ptr< Data > data)
@ kFinishedDeoptOperation
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
static void SleepMicros(int64_t micros)
static int64_t GetCurrentTimeMillis()
static void Sleep(int64_t millis)
static ObjectPtr RawCast(ObjectPtr obj)
virtual void RunInternal()
ReloadTask(std::shared_ptr< Data > data)
StateMachineTask(std::shared_ptr< Data > data)
virtual void RunInternal()=0
std::shared_ptr< Data > data_
StressTask(std::shared_ptr< Data > data)
virtual void RunInternal()
static Thread * Current()
bool IsSafepointRequested() const
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
IsolateGroup * isolate_group() const
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
virtual void RunInternal()
WaiterTask(std::shared_ptr< Data > data)
struct _Dart_Isolate * Dart_Isolate
#define RELOAD_OPERATION_SCOPE(thread_expr)
ObjectPtr ReadMessage(Thread *thread, Message *message)
ISOLATE_UNIT_TEST_CASE_WITH_EXPECTATION(SafepointOperation_NonDeoptAndDeoptNesting, "Crash")
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
static void EnsureValidOOBMessage(Thread *thread, Isolate *isolate, std::unique_ptr< Message > message)
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction)
DART_EXPORT void Dart_ExitIsolate()
static int8_t data[kExtLength]
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial gc
struct PathData * Data(SkPath *path)
SIT bool all(const Vec< 1, T > &x)
std::atomic< intptr_t > * timeout_checkin
Data(IsolateGroup *isolate_group, SafepointLevel level, std::atomic< intptr_t > *gc_only_checkins, std::atomic< intptr_t > *deopt_checkin, std::atomic< intptr_t > *reload_checkin, std::atomic< intptr_t > *timeout_checkin)
std::atomic< intptr_t > * deopt_checkin
std::atomic< intptr_t > * gc_only_checkins
std::atomic< intptr_t > * reload_checkin
void AssertIsNotIn(intptr_t expected_state)
void AssertIsIn(intptr_t expected_state)
void MarkAndNotify(intptr_t target_state)
void WaitUntil(intptr_t target_state)
bool IsIn(intptr_t expected_state)
Data(IsolateGroup *isolate_group)
IsolateGroup * isolate_group_