File tree Expand file tree Collapse file tree 5 files changed +49
-11
lines changed
runtime/vm/compiler/backend Expand file tree Collapse file tree 5 files changed +49
-11
lines changed Original file line number Diff line number Diff line change @@ -4547,8 +4547,21 @@ void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
45474547 : compiler::target::Thread::field_table_values_offset ();
45484548 const intptr_t field_offset = compiler::target::FieldTable::OffsetOf (field ());
45494549
4550- __ LoadMemoryValue (result, THR, static_cast <int32_t >(field_table_offset));
4551- __ LoadMemoryValue (result, result, static_cast <int32_t >(field_offset));
4550+ if (field ().is_shared ()) {
4551+ #if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
4552+ const auto field_table_offset_reg = TMP;
4553+ #else
4554+ const auto field_table_offset_reg = result;
4555+ #endif
4556+ __ LoadMemoryValue (field_table_offset_reg, THR,
4557+ static_cast <int32_t >(field_table_offset));
4558+ __ LoadAcquire (result,
4559+ compiler::Address (field_table_offset_reg,
4560+ static_cast <int32_t >(field_offset)));
4561+ } else {
4562+ __ LoadMemoryValue (result, THR, static_cast <int32_t >(field_table_offset));
4563+ __ LoadMemoryValue (result, result, static_cast <int32_t >(field_offset));
4564+ }
45524565
45534566 if (does_throw_access_error_or_call_initializer ()) {
45544567 if (calls_initializer () && throw_exception_on_initialization ()) {
Original file line number Diff line number Diff line change @@ -2523,8 +2523,14 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
25232523 ? compiler::target::Thread::shared_field_table_values_offset ()
25242524 : compiler::target::Thread::field_table_values_offset ());
25252525 // Note: static fields ids won't be changed by hot-reload.
2526- __ StoreToOffset (value, temp,
2527- compiler::target::FieldTable::OffsetOf (field ()));
2526+ if (field ().is_shared ()) {
2527+ __ StoreRelease (value,
2528+ compiler::Address (
2529+ temp, compiler::target::FieldTable::OffsetOf (field ())));
2530+ } else {
2531+ __ StoreToOffset (value, temp,
2532+ compiler::target::FieldTable::OffsetOf (field ()));
2533+ }
25282534}
25292535
25302536LocationSummary* InstanceOfInstr::MakeLocationSummary (Zone* zone,
Original file line number Diff line number Diff line change @@ -2168,9 +2168,15 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
21682168 ? compiler::target::Thread::shared_field_table_values_offset ()
21692169 : compiler::target::Thread::field_table_values_offset ()));
21702170 // Note: static fields ids won't be changed by hot-reload.
2171- __ movl (
2172- compiler::Address (temp, compiler::target::FieldTable::OffsetOf (field ())),
2173- in);
2171+ if (field ().is_shared ()) {
2172+ __ StoreRelease (
2173+ in, compiler::Address (temp,
2174+ compiler::target::FieldTable::OffsetOf (field ())));
2175+ } else {
2176+ __ movl (compiler::Address (temp,
2177+ compiler::target::FieldTable::OffsetOf (field ())),
2178+ in);
2179+ }
21742180}
21752181
21762182LocationSummary* InstanceOfInstr::MakeLocationSummary (Zone* zone,
Original file line number Diff line number Diff line change @@ -2716,7 +2716,14 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
27162716 ? compiler::target::Thread::shared_field_table_values_offset ()
27172717 : compiler::target::Thread::field_table_values_offset ());
27182718 // Note: static fields ids won't be changed by hot-reload.
2719- __ StoreToOffset (value, TMP, compiler::target::FieldTable::OffsetOf (field ()));
2719+ if (field ().is_shared ()) {
2720+ __ StoreRelease (value,
2721+ compiler::Address (
2722+ TMP, compiler::target::FieldTable::OffsetOf (field ())));
2723+ } else {
2724+ __ StoreToOffset (value, TMP,
2725+ compiler::target::FieldTable::OffsetOf (field ()));
2726+ }
27202727}
27212728
27222729LocationSummary* InstanceOfInstr::MakeLocationSummary (Zone* zone,
Original file line number Diff line number Diff line change @@ -2499,9 +2499,15 @@ void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
24992499 ? compiler::target::Thread::shared_field_table_values_offset ()
25002500 : compiler::target::Thread::field_table_values_offset ()));
25012501 // Note: static fields ids won't be changed by hot-reload.
2502- __ movq (
2503- compiler::Address (temp, compiler::target::FieldTable::OffsetOf (field ())),
2504- value);
2502+ if (field ().is_shared ()) {
2503+ __ movq (compiler::Address (temp,
2504+ compiler::target::FieldTable::OffsetOf (field ())),
2505+ value);
2506+ } else {
2507+ __ StoreRelease (value,
2508+ compiler::Address (
2509+ temp, compiler::target::FieldTable::OffsetOf (field ())));
2510+ }
25052511}
25062512
25072513LocationSummary* InstanceOfInstr::MakeLocationSummary (Zone* zone,
You can’t perform that action at this time.
0 commit comments