diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc index a67ace8dee9..42df2954a5e 100644 --- a/runtime/vm/clustered_snapshot.cc +++ b/runtime/vm/clustered_snapshot.cc @@ -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 { diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index ea59e19cac1..99c29570f42 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -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(); diff --git a/runtime/vm/object.h b/runtime/vm/object.h index 786fcb643a7..f2e14f43322 100644 --- a/runtime/vm/object.h +++ b/runtime/vm/object.h @@ -4145,11 +4145,20 @@ class Field : public Object { StaticTypeExactnessState static_type_exactness_state() const { return StaticTypeExactnessState::Decode( - untag()->static_type_exactness_state_); + LoadNonPointer( + &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( + &untag()->static_type_exactness_state_, state.Encode()); } static intptr_t static_type_exactness_state_offset() {