[vm/concurrency] Use relaxed load/store to update Field::static_type_exactness.

Use of relaxed atomic updates is fine because changes in field's type_exactness state should not update compilation result.

Fixes https://github.com/dart-lang/sdk/issues/46492.

TEST=IsolateSpawn on tsan

Change-Id: Icfda1c788d931f594b32b78d690e26b6a7df9f35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205246
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
Alexander Aprelev
2021-06-29 23:13:29 +00:00
committed by commit-bot@chromium.org
parent de5bd75238
commit 87a4f54b91
3 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -1437,7 +1437,7 @@ class FieldDeserializationCluster : public DeserializationCluster {
field.set_guarded_list_length_unsafe(Field::kNoFixedLength);
field.set_guarded_list_length_in_object_offset_unsafe(
Field::kUnknownLengthOffset);
field.set_static_type_exactness_state(
field.set_static_type_exactness_state_unsafe(
StaticTypeExactnessState::NotTracking());
}
} else {
+1 -1
View File
@@ -10635,7 +10635,7 @@ void Field::InitializeNew(const Field& result,
result.set_initializer_changed_after_initialization(false);
NOT_IN_PRECOMPILED(result.set_kernel_offset(0));
result.set_has_pragma(false);
result.set_static_type_exactness_state(
result.set_static_type_exactness_state_unsafe(
StaticTypeExactnessState::NotTracking());
auto isolate_group = IsolateGroup::Current();
+11 -2
View File
@@ -4145,11 +4145,20 @@ class Field : public Object {
StaticTypeExactnessState static_type_exactness_state() const {
return StaticTypeExactnessState::Decode(
untag()->static_type_exactness_state_);
LoadNonPointer<int8_t, std::memory_order_relaxed>(
&untag()->static_type_exactness_state_));
}
void set_static_type_exactness_state(StaticTypeExactnessState state) const {
StoreNonPointer(&untag()->static_type_exactness_state_, state.Encode());
DEBUG_ASSERT(
IsolateGroup::Current()->program_lock()->IsCurrentThreadWriter());
set_static_type_exactness_state_unsafe(state);
}
void set_static_type_exactness_state_unsafe(
StaticTypeExactnessState state) const {
StoreNonPointer<int8_t, int8_t, std::memory_order_relaxed>(
&untag()->static_type_exactness_state_, state.Encode());
}
static intptr_t static_type_exactness_state_offset() {