Skip to content

Commit 30a12a3

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
Revert "Re-land "[vm] Aggressive write-barrier elimination.""
This reverts commit eff1a9f. Reason for revert: Causes flaky hits of RELEASE_ASSERT in marker.cc, see b/151131634. Original change's description: > Re-land "[vm] Aggressive write-barrier elimination." > > The original revision is in Patchset 3. > > Four bugs were fixed: > > 1. JoinEntryInstr::SuccessorCount() is not the correct way to get the > number of successor blocks from the Join block; > JoinEntryInstr::last_instruction()->SuccessorCount() must be used > instead. > > 2. BitVector::Equals() was non-deterministically returning 'false' > for equal vectors. > > 3. All blocks need to be processed at least once during the Analysis > phase (not only in the SaveResults phase). > > 4. We were not removing write barriers from StoreIndexed instructions, > even though we had support for it. > > This reverts commit 7fd8ad5. > > Fixes #40780 > > Change-Id: I9650ec2c547ec49cf88ca0524e14f6c245621f6a > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138086 > Commit-Queue: Samir Jindel <[email protected]> > Reviewed-by: Martin Kustermann <[email protected]> > Reviewed-by: Ryan Macnak <[email protected]> [email protected],[email protected],[email protected] Change-Id: If9afd84465175fad2431405a97e9293c8bd5e476 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138808 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Martin Kustermann <[email protected]>
1 parent 8337863 commit 30a12a3

28 files changed

+95
-922
lines changed

runtime/vm/bit_vector.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
#include "vm/bit_vector.h"
6-
#include "vm/log.h"
6+
77
#include "vm/os.h"
88

99
namespace dart {
@@ -40,7 +40,7 @@ bool BitVector::Equals(const BitVector& other) const {
4040
}
4141
if (i < data_length_) {
4242
// Don't compare bits beyond length_.
43-
const intptr_t shift_size = kBitsPerWord - (length_ % kBitsPerWord);
43+
const intptr_t shift_size = (kBitsPerWord - length_) & (kBitsPerWord - 1);
4444
const uword mask = static_cast<uword>(-1) >> shift_size;
4545
if ((data_[i] & mask) != (other.data_[i] & mask)) return false;
4646
}
@@ -105,11 +105,11 @@ bool BitVector::IsEmpty() const {
105105
}
106106

107107
void BitVector::Print() const {
108-
THR_Print("[");
108+
OS::PrintErr("[");
109109
for (intptr_t i = 0; i < length_; i++) {
110-
THR_Print(Contains(i) ? "1" : "0");
110+
OS::PrintErr(Contains(i) ? "1" : "0");
111111
}
112-
THR_Print("]");
112+
OS::PrintErr("]");
113113
}
114114

115115
} // namespace dart

runtime/vm/bit_vector.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class BitVector : public ZoneAllocated {
7070
data_[i / kBitsPerWord] &= ~(static_cast<uword>(1) << (i % kBitsPerWord));
7171
}
7272

73-
void Set(intptr_t i, bool value) { value ? Add(i) : Remove(i); }
74-
7573
bool Equals(const BitVector& other) const;
7674

7775
// Add all elements that are in the bitvector from.
@@ -94,14 +92,6 @@ class BitVector : public ZoneAllocated {
9492
return (block & (static_cast<uword>(1) << (i % kBitsPerWord))) != 0;
9593
}
9694

97-
bool SubsetOf(const BitVector& other) {
98-
ASSERT(length_ == other.length_);
99-
for (intptr_t i = 0; i < data_length_; ++i) {
100-
if ((data_[i] & other.data_[i]) != data_[i]) return false;
101-
}
102-
return true;
103-
}
104-
10595
void Clear() {
10696
for (intptr_t i = 0; i < data_length_; i++) {
10797
data_[i] = 0;

runtime/vm/compiler/backend/flow_graph_compiler.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,7 @@ void FlowGraphCompiler::VisitBlocks() {
615615
EmitInstructionPrologue(instr);
616616
ASSERT(pending_deoptimization_env_ == NULL);
617617
pending_deoptimization_env_ = instr->env();
618-
DEBUG_ONLY(current_instruction_ = instr);
619618
instr->EmitNativeCode(this);
620-
DEBUG_ONLY(current_instruction_ = nullptr);
621619
pending_deoptimization_env_ = NULL;
622620
if (IsPeephole(instr)) {
623621
ASSERT(top_of_stack_ == nullptr);
@@ -710,9 +708,7 @@ void FlowGraphCompiler::GenerateDeferredCode() {
710708
set_current_instruction(slow_path->instruction());
711709
SpecialStatsBegin(stats_tag);
712710
BeginCodeSourceRange();
713-
DEBUG_ONLY(current_instruction_ = slow_path->instruction());
714711
slow_path->GenerateCode(this);
715-
DEBUG_ONLY(current_instruction_ = nullptr);
716712
EndCodeSourceRange(slow_path->instruction()->token_pos());
717713
SpecialStatsEnd(stats_tag);
718714
set_current_instruction(nullptr);

runtime/vm/compiler/backend/flow_graph_compiler.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,15 +1121,6 @@ class FlowGraphCompiler : public ValueObject {
11211121
// is amenable to a peephole optimization.
11221122
bool IsPeephole(Instruction* instr) const;
11231123

1124-
#if defined(DEBUG)
1125-
bool CanCallDart() const {
1126-
return current_instruction_ == nullptr ||
1127-
current_instruction_->CanCallDart();
1128-
}
1129-
#else
1130-
bool CanCallDart() const { return true; }
1131-
#endif
1132-
11331124
// This struct contains either function or code, the other one being NULL.
11341125
class StaticCallsStruct : public ZoneAllocated {
11351126
public:

runtime/vm/compiler/backend/flow_graph_compiler_arm.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
995995
RawPcDescriptors::Kind kind,
996996
LocationSummary* locs,
997997
Code::EntryKind entry_kind) {
998-
ASSERT(CanCallDart());
999998
__ BranchLinkPatchable(stub, entry_kind);
1000999
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
10011000
}
@@ -1006,7 +1005,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
10061005
LocationSummary* locs,
10071006
const Function& target,
10081007
Code::EntryKind entry_kind) {
1009-
ASSERT(CanCallDart());
10101008
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
10111009
__ GenerateUnRelocatedPcRelativeCall();
10121010
AddPcRelativeCallTarget(target, entry_kind);
@@ -1063,7 +1061,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10631061
TokenPosition token_pos,
10641062
LocationSummary* locs,
10651063
Code::EntryKind entry_kind) {
1066-
ASSERT(CanCallDart());
10671064
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10681065
// Each ICData propagated from unoptimized to optimized code contains the
10691066
// function that corresponds to the Dart function of that IC call. Due
@@ -1087,7 +1084,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10871084
TokenPosition token_pos,
10881085
LocationSummary* locs,
10891086
Code::EntryKind entry_kind) {
1090-
ASSERT(CanCallDart());
10911087
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10921088
entry_kind == Code::EntryKind::kUnchecked);
10931089
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1113,7 +1109,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
11131109
LocationSummary* locs,
11141110
intptr_t try_index,
11151111
intptr_t slow_path_argument_count) {
1116-
ASSERT(CanCallDart());
11171112
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
11181113
const ArgumentsDescriptor args_desc(arguments_descriptor);
11191114
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1161,7 +1156,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11611156
LocationSummary* locs,
11621157
Code::EntryKind entry_kind,
11631158
bool receiver_can_be_smi) {
1164-
ASSERT(CanCallDart());
11651159
ASSERT(entry_kind == Code::EntryKind::kNormal ||
11661160
entry_kind == Code::EntryKind::kUnchecked);
11671161
ASSERT(ic_data.NumArgsTested() == 1);
@@ -1206,7 +1200,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t size_with_type_args,
12061200
LocationSummary* locs,
12071201
const ICData& ic_data,
12081202
Code::EntryKind entry_kind) {
1209-
ASSERT(CanCallDart());
12101203
const Code& stub =
12111204
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
12121205
__ LoadObject(R9, ic_data);
@@ -1223,7 +1216,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
12231216
TokenPosition token_pos,
12241217
LocationSummary* locs,
12251218
Code::EntryKind entry_kind) {
1226-
ASSERT(CanCallDart());
12271219
ASSERT(!function.IsClosureFunction());
12281220
if (function.HasOptionalParameters() || function.IsGeneric()) {
12291221
__ LoadObject(R4, arguments_descriptor);
@@ -1243,7 +1235,6 @@ void FlowGraphCompiler::EmitDispatchTableCall(
12431235
Register cid_reg,
12441236
int32_t selector_offset,
12451237
const Array& arguments_descriptor) {
1246-
ASSERT(CanCallDart());
12471238
ASSERT(cid_reg != ARGS_DESC_REG);
12481239
if (!arguments_descriptor.IsNull()) {
12491240
__ LoadObject(ARGS_DESC_REG, arguments_descriptor);

runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
966966
RawPcDescriptors::Kind kind,
967967
LocationSummary* locs,
968968
Code::EntryKind entry_kind) {
969-
ASSERT(CanCallDart());
970969
__ BranchLinkPatchable(stub, entry_kind);
971970
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
972971
}
@@ -977,7 +976,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
977976
LocationSummary* locs,
978977
const Function& target,
979978
Code::EntryKind entry_kind) {
980-
ASSERT(CanCallDart());
981979
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
982980
__ GenerateUnRelocatedPcRelativeCall();
983981
AddPcRelativeCallTarget(target, entry_kind);
@@ -1025,7 +1023,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10251023
TokenPosition token_pos,
10261024
LocationSummary* locs,
10271025
Code::EntryKind entry_kind) {
1028-
ASSERT(CanCallDart());
10291026
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10301027
// Each ICData propagated from unoptimized to optimized code contains the
10311028
// function that corresponds to the Dart function of that IC call. Due
@@ -1048,7 +1045,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10481045
TokenPosition token_pos,
10491046
LocationSummary* locs,
10501047
Code::EntryKind entry_kind) {
1051-
ASSERT(CanCallDart());
10521048
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10531049
entry_kind == Code::EntryKind::kUnchecked);
10541050
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1080,7 +1076,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
10801076
LocationSummary* locs,
10811077
intptr_t try_index,
10821078
intptr_t slow_path_argument_count) {
1083-
ASSERT(CanCallDart());
10841079
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
10851080
const ArgumentsDescriptor args_desc(arguments_descriptor);
10861081
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1125,7 +1120,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11251120
LocationSummary* locs,
11261121
Code::EntryKind entry_kind,
11271122
bool receiver_can_be_smi) {
1128-
ASSERT(CanCallDart());
11291123
ASSERT(ic_data.NumArgsTested() == 1);
11301124
const Code& initial_stub = StubCode::UnlinkedCall();
11311125
const char* switchable_call_mode = "smiable";
@@ -1176,7 +1170,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t size_with_type_args,
11761170
LocationSummary* locs,
11771171
const ICData& ic_data,
11781172
Code::EntryKind entry_kind) {
1179-
ASSERT(CanCallDart());
11801173
const Code& stub =
11811174
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
11821175
__ LoadObject(R5, ic_data);
@@ -1193,7 +1186,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
11931186
TokenPosition token_pos,
11941187
LocationSummary* locs,
11951188
Code::EntryKind entry_kind) {
1196-
ASSERT(CanCallDart());
11971189
ASSERT(!function.IsClosureFunction());
11981190
if (function.HasOptionalParameters() || function.IsGeneric()) {
11991191
__ LoadObject(R4, arguments_descriptor);
@@ -1213,7 +1205,6 @@ void FlowGraphCompiler::EmitDispatchTableCall(
12131205
Register cid_reg,
12141206
int32_t selector_offset,
12151207
const Array& arguments_descriptor) {
1216-
ASSERT(CanCallDart());
12171208
ASSERT(cid_reg != ARGS_DESC_REG);
12181209
if (!arguments_descriptor.IsNull()) {
12191210
__ LoadObject(ARGS_DESC_REG, arguments_descriptor);

runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
861861
RawPcDescriptors::Kind kind,
862862
LocationSummary* locs,
863863
Code::EntryKind entry_kind) {
864-
ASSERT(CanCallDart());
865864
__ Call(stub, /*moveable_target=*/false, entry_kind);
866865
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
867866
}
@@ -872,7 +871,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
872871
LocationSummary* locs,
873872
const Function& target,
874873
Code::EntryKind entry_kind) {
875-
ASSERT(CanCallDart());
876874
const auto& stub = StubCode::CallStaticFunction();
877875
__ Call(stub, /*movable_target=*/true, entry_kind);
878876
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
@@ -894,7 +892,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t size_with_type_args,
894892
LocationSummary* locs,
895893
const ICData& ic_data,
896894
Code::EntryKind entry_kind) {
897-
ASSERT(CanCallDart());
898895
const Code& stub =
899896
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
900897
__ LoadObject(ECX, ic_data);
@@ -922,7 +919,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
922919
TokenPosition token_pos,
923920
LocationSummary* locs,
924921
Code::EntryKind entry_kind) {
925-
ASSERT(CanCallDart());
926922
ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
927923
// Each ICData propagated from unoptimized to optimized code contains the
928924
// function that corresponds to the Dart function of that IC call. Due
@@ -946,7 +942,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
946942
TokenPosition token_pos,
947943
LocationSummary* locs,
948944
Code::EntryKind entry_kind) {
949-
ASSERT(CanCallDart());
950945
ASSERT(entry_kind == Code::EntryKind::kNormal ||
951946
entry_kind == Code::EntryKind::kUnchecked);
952947
ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
@@ -972,7 +967,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
972967
LocationSummary* locs,
973968
intptr_t try_index,
974969
intptr_t slow_path_argument_count) {
975-
ASSERT(CanCallDart());
976970
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
977971
const ArgumentsDescriptor args_desc(arguments_descriptor);
978972
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1020,7 +1014,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
10201014
TokenPosition token_pos,
10211015
LocationSummary* locs,
10221016
Code::EntryKind entry_kind) {
1023-
ASSERT(CanCallDart());
10241017
if (function.HasOptionalParameters() || function.IsGeneric()) {
10251018
__ LoadObject(EDX, arguments_descriptor);
10261019
} else {

runtime/vm/compiler/backend/flow_graph_compiler_x64.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
977977
RawPcDescriptors::Kind kind,
978978
LocationSummary* locs,
979979
Code::EntryKind entry_kind) {
980-
ASSERT(CanCallDart());
981980
__ CallPatchable(stub, entry_kind);
982981
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
983982
}
@@ -988,7 +987,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
988987
LocationSummary* locs,
989988
const Function& target,
990989
Code::EntryKind entry_kind) {
991-
ASSERT(CanCallDart());
992990
ASSERT(is_optimizing());
993991
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
994992
__ GenerateUnRelocatedPcRelativeCall();
@@ -1021,7 +1019,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t size_with_type_args,
10211019
LocationSummary* locs,
10221020
const ICData& ic_data,
10231021
Code::EntryKind entry_kind) {
1024-
ASSERT(CanCallDart());
10251022
const Code& stub =
10261023
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
10271024
__ LoadObject(RBX, ic_data);
@@ -1050,7 +1047,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10501047
TokenPosition token_pos,
10511048
LocationSummary* locs,
10521049
Code::EntryKind entry_kind) {
1053-
ASSERT(CanCallDart());
10541050
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10551051
// Each ICData propagated from unoptimized to optimized code contains the
10561052
// function that corresponds to the Dart function of that IC call. Due
@@ -1074,7 +1070,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10741070
TokenPosition token_pos,
10751071
LocationSummary* locs,
10761072
Code::EntryKind entry_kind) {
1077-
ASSERT(CanCallDart());
10781073
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10791074
entry_kind == Code::EntryKind::kUnchecked);
10801075
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1100,7 +1095,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
11001095
LocationSummary* locs,
11011096
intptr_t try_index,
11021097
intptr_t slow_path_argument_count) {
1103-
ASSERT(CanCallDart());
11041098
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
11051099
const ArgumentsDescriptor args_desc(arguments_descriptor);
11061100
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1142,7 +1136,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11421136
LocationSummary* locs,
11431137
Code::EntryKind entry_kind,
11441138
bool receiver_can_be_smi) {
1145-
ASSERT(CanCallDart());
11461139
ASSERT(entry_kind == Code::EntryKind::kNormal ||
11471140
entry_kind == Code::EntryKind::kUnchecked);
11481141
ASSERT(ic_data.NumArgsTested() == 1);
@@ -1185,7 +1178,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
11851178
TokenPosition token_pos,
11861179
LocationSummary* locs,
11871180
Code::EntryKind entry_kind) {
1188-
ASSERT(CanCallDart());
11891181
ASSERT(!function.IsClosureFunction());
11901182
if (function.HasOptionalParameters() || function.IsGeneric()) {
11911183
__ LoadObject(R10, arguments_descriptor);
@@ -1205,7 +1197,6 @@ void FlowGraphCompiler::EmitDispatchTableCall(
12051197
Register cid_reg,
12061198
int32_t selector_offset,
12071199
const Array& arguments_descriptor) {
1208-
ASSERT(CanCallDart());
12091200
const Register table_reg = RAX;
12101201
ASSERT(cid_reg != table_reg);
12111202
ASSERT(cid_reg != ARGS_DESC_REG);

0 commit comments

Comments
 (0)