Skip to content

Commit 7fd8ad5

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
Revert "[vm] Re-land aggressive write-barrier elimination."
This reverts commit c7d7552. Reason for revert: #40780 Original change's description: > [vm] Re-land aggressive write-barrier elimination. > > It incorrectly assumed that all stores in Dart code write to Instances. > There is actually one exception, Contexts, which do not inherit from Instance. > > I've added asserts to ensure this kind of bug cannot resurface. > > The original change is in patchset 4. > > Change-Id: Ic2d8d05e70a4de738eb9fb5980487b4f27111b8c > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/136221 > Commit-Queue: Samir Jindel <[email protected]> > Reviewed-by: Martin Kustermann <[email protected]> > Reviewed-by: Ryan Macnak <[email protected]> [email protected],[email protected],[email protected] # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I1891677b21560c7fc5a54a8eb800ef5850654402 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137290 Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent fca91e4 commit 7fd8ad5

23 files changed

+85
-615
lines changed

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
@@ -612,9 +612,7 @@ void FlowGraphCompiler::VisitBlocks() {
612612
EmitInstructionPrologue(instr);
613613
ASSERT(pending_deoptimization_env_ == NULL);
614614
pending_deoptimization_env_ = instr->env();
615-
DEBUG_ONLY(current_instruction_ = instr);
616615
instr->EmitNativeCode(this);
617-
DEBUG_ONLY(current_instruction_ = nullptr);
618616
pending_deoptimization_env_ = NULL;
619617
if (IsPeephole(instr)) {
620618
ASSERT(top_of_stack_ == nullptr);
@@ -705,9 +703,7 @@ void FlowGraphCompiler::GenerateDeferredCode() {
705703
slow_path->instruction()->tag());
706704
SpecialStatsBegin(stats_tag);
707705
BeginCodeSourceRange();
708-
DEBUG_ONLY(current_instruction_ = slow_path->instruction());
709706
slow_path->GenerateCode(this);
710-
DEBUG_ONLY(current_instruction_ = nullptr);
711707
EndCodeSourceRange(slow_path->instruction()->token_pos());
712708
SpecialStatsEnd(stats_tag);
713709
}

runtime/vm/compiler/backend/flow_graph_compiler.h

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

1120-
#if defined(DEBUG)
1121-
bool CanCallDart() const {
1122-
return current_instruction_ == nullptr ||
1123-
current_instruction_->CanCallDart();
1124-
}
1125-
#else
1126-
bool CanCallDart() const { return true; }
1127-
#endif
1128-
11291120
// This struct contains either function or code, the other one being NULL.
11301121
class StaticCallsStruct : public ZoneAllocated {
11311122
public:
@@ -1219,10 +1210,6 @@ class FlowGraphCompiler : public ValueObject {
12191210
ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data_;
12201211
Array& edge_counters_array_;
12211212

1222-
// Instruction currently running EmitNativeCode(). Useful for asserts.
1223-
// Does not include Phis and BlockEntrys.
1224-
DEBUG_ONLY(Instruction* current_instruction_ = nullptr);
1225-
12261213
DISALLOW_COPY_AND_ASSIGN(FlowGraphCompiler);
12271214
};
12281215

runtime/vm/compiler/backend/flow_graph_compiler_arm.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
10001000
RawPcDescriptors::Kind kind,
10011001
LocationSummary* locs,
10021002
Code::EntryKind entry_kind) {
1003-
ASSERT(CanCallDart());
10041003
__ BranchLinkPatchable(stub, entry_kind);
10051004
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
10061005
}
@@ -1011,7 +1010,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
10111010
LocationSummary* locs,
10121011
const Function& target,
10131012
Code::EntryKind entry_kind) {
1014-
ASSERT(CanCallDart());
10151013
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
10161014
__ GenerateUnRelocatedPcRelativeCall();
10171015
AddPcRelativeCallTarget(target, entry_kind);
@@ -1068,7 +1066,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10681066
TokenPosition token_pos,
10691067
LocationSummary* locs,
10701068
Code::EntryKind entry_kind) {
1071-
ASSERT(CanCallDart());
10721069
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10731070
// Each ICData propagated from unoptimized to optimized code contains the
10741071
// function that corresponds to the Dart function of that IC call. Due
@@ -1092,7 +1089,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10921089
TokenPosition token_pos,
10931090
LocationSummary* locs,
10941091
Code::EntryKind entry_kind) {
1095-
ASSERT(CanCallDart());
10961092
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10971093
entry_kind == Code::EntryKind::kUnchecked);
10981094
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1118,7 +1114,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
11181114
LocationSummary* locs,
11191115
intptr_t try_index,
11201116
intptr_t slow_path_argument_count) {
1121-
ASSERT(CanCallDart());
11221117
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
11231118
const ArgumentsDescriptor args_desc(arguments_descriptor);
11241119
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1166,7 +1161,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11661161
LocationSummary* locs,
11671162
Code::EntryKind entry_kind,
11681163
bool receiver_can_be_smi) {
1169-
ASSERT(CanCallDart());
11701164
ASSERT(entry_kind == Code::EntryKind::kNormal ||
11711165
entry_kind == Code::EntryKind::kUnchecked);
11721166
ASSERT(ic_data.NumArgsTested() == 1);
@@ -1211,7 +1205,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t count_with_type_args,
12111205
LocationSummary* locs,
12121206
const ICData& ic_data,
12131207
Code::EntryKind entry_kind) {
1214-
ASSERT(CanCallDart());
12151208
const Code& stub =
12161209
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
12171210
__ LoadObject(R9, ic_data);
@@ -1228,7 +1221,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
12281221
TokenPosition token_pos,
12291222
LocationSummary* locs,
12301223
Code::EntryKind entry_kind) {
1231-
ASSERT(CanCallDart());
12321224
ASSERT(!function.IsClosureFunction());
12331225
if (function.HasOptionalParameters() || function.IsGeneric()) {
12341226
__ LoadObject(R4, arguments_descriptor);
@@ -1248,7 +1240,6 @@ void FlowGraphCompiler::EmitDispatchTableCall(
12481240
Register cid_reg,
12491241
int32_t selector_offset,
12501242
const Array& arguments_descriptor) {
1251-
ASSERT(CanCallDart());
12521243
ASSERT(cid_reg != ARGS_DESC_REG);
12531244
if (!arguments_descriptor.IsNull()) {
12541245
__ 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
@@ -971,7 +971,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
971971
RawPcDescriptors::Kind kind,
972972
LocationSummary* locs,
973973
Code::EntryKind entry_kind) {
974-
ASSERT(CanCallDart());
975974
__ BranchLinkPatchable(stub, entry_kind);
976975
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
977976
}
@@ -982,7 +981,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
982981
LocationSummary* locs,
983982
const Function& target,
984983
Code::EntryKind entry_kind) {
985-
ASSERT(CanCallDart());
986984
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
987985
__ GenerateUnRelocatedPcRelativeCall();
988986
AddPcRelativeCallTarget(target, entry_kind);
@@ -1030,7 +1028,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10301028
TokenPosition token_pos,
10311029
LocationSummary* locs,
10321030
Code::EntryKind entry_kind) {
1033-
ASSERT(CanCallDart());
10341031
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10351032
// Each ICData propagated from unoptimized to optimized code contains the
10361033
// function that corresponds to the Dart function of that IC call. Due
@@ -1053,7 +1050,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10531050
TokenPosition token_pos,
10541051
LocationSummary* locs,
10551052
Code::EntryKind entry_kind) {
1056-
ASSERT(CanCallDart());
10571053
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10581054
entry_kind == Code::EntryKind::kUnchecked);
10591055
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1085,7 +1081,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
10851081
LocationSummary* locs,
10861082
intptr_t try_index,
10871083
intptr_t slow_path_argument_count) {
1088-
ASSERT(CanCallDart());
10891084
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
10901085
const ArgumentsDescriptor args_desc(arguments_descriptor);
10911086
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1130,7 +1125,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11301125
LocationSummary* locs,
11311126
Code::EntryKind entry_kind,
11321127
bool receiver_can_be_smi) {
1133-
ASSERT(CanCallDart());
11341128
ASSERT(ic_data.NumArgsTested() == 1);
11351129
const Code& initial_stub = StubCode::UnlinkedCall();
11361130
const char* switchable_call_mode = "smiable";
@@ -1181,7 +1175,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t count_with_type_args,
11811175
LocationSummary* locs,
11821176
const ICData& ic_data,
11831177
Code::EntryKind entry_kind) {
1184-
ASSERT(CanCallDart());
11851178
const Code& stub =
11861179
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
11871180
__ LoadObject(R5, ic_data);
@@ -1198,7 +1191,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
11981191
TokenPosition token_pos,
11991192
LocationSummary* locs,
12001193
Code::EntryKind entry_kind) {
1201-
ASSERT(CanCallDart());
12021194
ASSERT(!function.IsClosureFunction());
12031195
if (function.HasOptionalParameters() || function.IsGeneric()) {
12041196
__ LoadObject(R4, arguments_descriptor);
@@ -1218,7 +1210,6 @@ void FlowGraphCompiler::EmitDispatchTableCall(
12181210
Register cid_reg,
12191211
int32_t selector_offset,
12201212
const Array& arguments_descriptor) {
1221-
ASSERT(CanCallDart());
12221213
ASSERT(cid_reg != ARGS_DESC_REG);
12231214
if (!arguments_descriptor.IsNull()) {
12241215
__ 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
@@ -866,7 +866,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
866866
RawPcDescriptors::Kind kind,
867867
LocationSummary* locs,
868868
Code::EntryKind entry_kind) {
869-
ASSERT(CanCallDart());
870869
__ Call(stub, /*moveable_target=*/false, entry_kind);
871870
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
872871
}
@@ -877,7 +876,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
877876
LocationSummary* locs,
878877
const Function& target,
879878
Code::EntryKind entry_kind) {
880-
ASSERT(CanCallDart());
881879
const auto& stub = StubCode::CallStaticFunction();
882880
__ Call(stub, /*movable_target=*/true, entry_kind);
883881
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
@@ -899,7 +897,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t count_with_type_args,
899897
LocationSummary* locs,
900898
const ICData& ic_data,
901899
Code::EntryKind entry_kind) {
902-
ASSERT(CanCallDart());
903900
const Code& stub =
904901
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
905902
__ LoadObject(ECX, ic_data);
@@ -927,7 +924,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
927924
TokenPosition token_pos,
928925
LocationSummary* locs,
929926
Code::EntryKind entry_kind) {
930-
ASSERT(CanCallDart());
931927
ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
932928
// Each ICData propagated from unoptimized to optimized code contains the
933929
// function that corresponds to the Dart function of that IC call. Due
@@ -951,7 +947,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
951947
TokenPosition token_pos,
952948
LocationSummary* locs,
953949
Code::EntryKind entry_kind) {
954-
ASSERT(CanCallDart());
955950
ASSERT(entry_kind == Code::EntryKind::kNormal ||
956951
entry_kind == Code::EntryKind::kUnchecked);
957952
ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
@@ -977,7 +972,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
977972
LocationSummary* locs,
978973
intptr_t try_index,
979974
intptr_t slow_path_argument_count) {
980-
ASSERT(CanCallDart());
981975
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
982976
const ArgumentsDescriptor args_desc(arguments_descriptor);
983977
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1025,7 +1019,6 @@ void FlowGraphCompiler::EmitOptimizedStaticCall(
10251019
TokenPosition token_pos,
10261020
LocationSummary* locs,
10271021
Code::EntryKind entry_kind) {
1028-
ASSERT(CanCallDart());
10291022
if (function.HasOptionalParameters() || function.IsGeneric()) {
10301023
__ LoadObject(EDX, arguments_descriptor);
10311024
} else {

runtime/vm/compiler/backend/flow_graph_compiler_x64.cc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,6 @@ void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
985985
RawPcDescriptors::Kind kind,
986986
LocationSummary* locs,
987987
Code::EntryKind entry_kind) {
988-
ASSERT(CanCallDart());
989988
__ CallPatchable(stub, entry_kind);
990989
EmitCallsiteMetadata(token_pos, deopt_id, kind, locs);
991990
}
@@ -996,7 +995,6 @@ void FlowGraphCompiler::GenerateStaticDartCall(intptr_t deopt_id,
996995
LocationSummary* locs,
997996
const Function& target,
998997
Code::EntryKind entry_kind) {
999-
ASSERT(CanCallDart());
1000998
ASSERT(is_optimizing());
1001999
if (FLAG_precompiled_mode && FLAG_use_bare_instructions) {
10021000
__ GenerateUnRelocatedPcRelativeCall();
@@ -1029,7 +1027,6 @@ void FlowGraphCompiler::EmitUnoptimizedStaticCall(intptr_t count_with_type_args,
10291027
LocationSummary* locs,
10301028
const ICData& ic_data,
10311029
Code::EntryKind entry_kind) {
1032-
ASSERT(CanCallDart());
10331030
const Code& stub =
10341031
StubCode::UnoptimizedStaticCallEntry(ic_data.NumArgsTested());
10351032
__ LoadObject(RBX, ic_data);
@@ -1058,7 +1055,6 @@ void FlowGraphCompiler::EmitOptimizedInstanceCall(const Code& stub,
10581055
TokenPosition token_pos,
10591056
LocationSummary* locs,
10601057
Code::EntryKind entry_kind) {
1061-
ASSERT(CanCallDart());
10621058
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
10631059
// Each ICData propagated from unoptimized to optimized code contains the
10641060
// function that corresponds to the Dart function of that IC call. Due
@@ -1082,7 +1078,6 @@ void FlowGraphCompiler::EmitInstanceCallJIT(const Code& stub,
10821078
TokenPosition token_pos,
10831079
LocationSummary* locs,
10841080
Code::EntryKind entry_kind) {
1085-
ASSERT(CanCallDart());
10861081
ASSERT(entry_kind == Code::EntryKind::kNormal ||
10871082
entry_kind == Code::EntryKind::kUnchecked);
10881083
ASSERT(Array::Handle(zone(), ic_data.arguments_descriptor()).Length() > 0);
@@ -1108,7 +1103,6 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
11081103
LocationSummary* locs,
11091104
intptr_t try_index,
11101105
intptr_t slow_path_argument_count) {
1111-
ASSERT(CanCallDart());
11121106
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
11131107
const ArgumentsDescriptor args_desc(arguments_descriptor);
11141108
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
@@ -1150,7 +1144,6 @@ void FlowGraphCompiler::EmitInstanceCallAOT(const ICData& ic_data,
11501144
LocationSummary* locs,
11511145
Code::EntryKind entry_kind,
11521146
bool receiver_can_be_smi) {
1153-
ASSERT(CanCallDart());
11541147
ASSERT(entry_kind == Code::EntryKind::kNormal ||
11551148
entry_kind == Code::EntryKind::kUnchecked);
11561149
ASSERT(ic_data.NumArgsTested() == 1);
@@ -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(R10, 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
const Register table_reg = RAX;
12181209
ASSERT(cid_reg != table_reg);
12191210
ASSERT(cid_reg != ARGS_DESC_REG);

0 commit comments

Comments
 (0)