[vm] Remove dead megamorphic call resetting code.
AOT no longer emit call sites that immediately use the megamorphic dispatch stub. Such call sites are now generated as unlinked switchable call sites that may eventually transition to megamorphic. TEST=ci Change-Id: Iec342a2b3bc8fe27612bfa14b516e3c0512c1134 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331087 Commit-Queue: Ryan Macnak <rmacnak@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
This commit is contained in:
committed by
Commit Queue
parent
602d54ec7b
commit
197ceef612
@@ -3210,11 +3210,6 @@ class ObjectPoolSerializationCluster : public SerializationCluster {
|
||||
bits = ObjectPool::EncodeBits(
|
||||
type, ObjectPool::Patchability::kPatchable,
|
||||
ObjectPool::SnapshotBehavior::kSnapshotable);
|
||||
} else if (entry.raw_obj_ == StubCode::MegamorphicCall().ptr()) {
|
||||
type = ObjectPool::EntryType::kMegamorphicCallEntryPoint;
|
||||
bits = ObjectPool::EncodeBits(
|
||||
type, ObjectPool::Patchability::kPatchable,
|
||||
ObjectPool::SnapshotBehavior::kSnapshotable);
|
||||
}
|
||||
}
|
||||
s->Write<uint8_t>(bits);
|
||||
@@ -3242,7 +3237,6 @@ class ObjectPoolSerializationCluster : public SerializationCluster {
|
||||
break;
|
||||
}
|
||||
case ObjectPool::EntryType::kSwitchableCallMissEntryPoint:
|
||||
case ObjectPool::EntryType::kMegamorphicCallEntryPoint:
|
||||
// Write nothing. Entry point is initialized during
|
||||
// snapshot deserialization.
|
||||
break;
|
||||
@@ -3282,12 +3276,8 @@ class ObjectPoolDeserializationCluster : public DeserializationCluster {
|
||||
const uint8_t immediate_bits = ObjectPool::EncodeBits(
|
||||
ObjectPool::EntryType::kImmediate, ObjectPool::Patchability::kPatchable,
|
||||
ObjectPool::SnapshotBehavior::kSnapshotable);
|
||||
uword switchable_call_miss_entry_point = 0;
|
||||
uword megamorphic_call_entry_point = 0;
|
||||
switchable_call_miss_entry_point =
|
||||
uword switchable_call_miss_entry_point =
|
||||
StubCode::SwitchableCallMiss().MonomorphicEntryPoint();
|
||||
megamorphic_call_entry_point =
|
||||
StubCode::MegamorphicCall().MonomorphicEntryPoint();
|
||||
#endif // defined(DART_PRECOMPILED_RUNTIME)
|
||||
|
||||
for (intptr_t id = start_index_, n = stop_index_; id < n; id++) {
|
||||
@@ -3334,11 +3324,6 @@ class ObjectPoolDeserializationCluster : public DeserializationCluster {
|
||||
entry.raw_value_ =
|
||||
static_cast<intptr_t>(switchable_call_miss_entry_point);
|
||||
break;
|
||||
case ObjectPool::EntryType::kMegamorphicCallEntryPoint:
|
||||
pool->untag()->entry_bits()[j] = immediate_bits;
|
||||
entry.raw_value_ =
|
||||
static_cast<intptr_t>(megamorphic_call_entry_point);
|
||||
break;
|
||||
#endif // defined(DART_PRECOMPILED_RUNTIME)
|
||||
default:
|
||||
UNREACHABLE();
|
||||
|
||||
@@ -353,7 +353,6 @@ uword ObjIndexPair::Hash(Key key) {
|
||||
case ObjectPoolBuilderEntry::kImmediate:
|
||||
case ObjectPoolBuilderEntry::kNativeFunction:
|
||||
case ObjectPoolBuilderEntry::kSwitchableCallMissEntryPoint:
|
||||
case ObjectPoolBuilderEntry::kMegamorphicCallEntryPoint:
|
||||
return key.imm_;
|
||||
case ObjectPoolBuilderEntry::kTaggedObject:
|
||||
return ObjectHash(*key.obj_);
|
||||
|
||||
@@ -43,10 +43,8 @@ struct ObjectPoolBuilderEntry {
|
||||
// Used only during AOT snapshot serialization/deserialization.
|
||||
// Denotes kImmediate entry with
|
||||
// - StubCode::SwitchableCallMiss().MonomorphicEntryPoint()
|
||||
// - StubCode::MegamorphicCall().MonomorphicEntryPoint()
|
||||
// values which become known only at run time.
|
||||
kSwitchableCallMissEntryPoint,
|
||||
kMegamorphicCallEntryPoint,
|
||||
|
||||
// Used only during object pool building to find duplicates. Become multiple
|
||||
// kImmediate in the final pool.
|
||||
|
||||
@@ -540,6 +540,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
LocationSummary* locs) {
|
||||
ASSERT(CanCallDart());
|
||||
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
|
||||
ASSERT(!FLAG_precompiled_mode);
|
||||
const ArgumentsDescriptor args_desc(arguments_descriptor);
|
||||
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
|
||||
zone(),
|
||||
@@ -550,31 +551,20 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadFromOffset(R0, SP,
|
||||
(args_desc.Count() - 1) * compiler::target::kWordSize);
|
||||
// Use same code pattern as instance call so it can be parsed by code patcher.
|
||||
if (FLAG_precompiled_mode) {
|
||||
// The AOT runtime will replace the slot in the object pool with the
|
||||
// entrypoint address - see app_snapshot.cc.
|
||||
CLOBBERS_LR(__ LoadUniqueObject(LR, StubCode::MegamorphicCall()));
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
CLOBBERS_LR(__ blx(LR));
|
||||
} else {
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ Call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
}
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ Call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
|
||||
RecordSafepoint(locs);
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kOther, DeoptId::kNone, source);
|
||||
if (!FLAG_precompiled_mode) {
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after,
|
||||
source);
|
||||
}
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after, source);
|
||||
}
|
||||
RecordCatchEntryMoves(pending_deoptimization_env_);
|
||||
EmitDropArguments(args_desc.SizeWithTypeArgs());
|
||||
|
||||
@@ -529,6 +529,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
LocationSummary* locs) {
|
||||
ASSERT(CanCallDart());
|
||||
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
|
||||
ASSERT(!FLAG_precompiled_mode);
|
||||
const ArgumentsDescriptor args_desc(arguments_descriptor);
|
||||
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
|
||||
zone(),
|
||||
@@ -545,30 +546,21 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
const intptr_t stub_index = op.AddObject(
|
||||
StubCode::MegamorphicCall(), ObjectPool::Patchability::kPatchable);
|
||||
ASSERT((data_index + 1) == stub_index);
|
||||
if (FLAG_precompiled_mode) {
|
||||
// The AOT runtime will replace the slot in the object pool with the
|
||||
// entrypoint address - see app_snapshot.cc.
|
||||
CLOBBERS_LR(__ LoadDoubleWordFromPoolIndex(IC_DATA_REG, LR, data_index));
|
||||
} else {
|
||||
__ LoadDoubleWordFromPoolIndex(IC_DATA_REG, CODE_REG, data_index);
|
||||
CLOBBERS_LR(__ ldr(LR, compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(
|
||||
Code::EntryKind::kMonomorphic))));
|
||||
}
|
||||
__ LoadDoubleWordFromPoolIndex(IC_DATA_REG, CODE_REG, data_index);
|
||||
CLOBBERS_LR(__ ldr(LR, compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(
|
||||
Code::EntryKind::kMonomorphic))));
|
||||
CLOBBERS_LR(__ blr(LR));
|
||||
|
||||
RecordSafepoint(locs);
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kOther, DeoptId::kNone, source);
|
||||
if (!FLAG_precompiled_mode) {
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after,
|
||||
source);
|
||||
}
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after, source);
|
||||
}
|
||||
RecordCatchEntryMoves(pending_deoptimization_env_);
|
||||
EmitDropArguments(args_desc.SizeWithTypeArgs());
|
||||
|
||||
@@ -570,6 +570,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
LocationSummary* locs) {
|
||||
ASSERT(CanCallDart());
|
||||
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
|
||||
ASSERT(!FLAG_precompiled_mode);
|
||||
const ArgumentsDescriptor args_desc(arguments_descriptor);
|
||||
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
|
||||
zone(),
|
||||
|
||||
@@ -519,6 +519,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
LocationSummary* locs) {
|
||||
ASSERT(CanCallDart());
|
||||
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
|
||||
ASSERT(!FLAG_precompiled_mode);
|
||||
const ArgumentsDescriptor args_desc(arguments_descriptor);
|
||||
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
|
||||
zone(),
|
||||
@@ -529,27 +530,20 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ LoadFromOffset(A0, SP,
|
||||
(args_desc.Count() - 1) * compiler::target::kWordSize);
|
||||
// Use same code pattern as instance call so it can be parsed by code patcher.
|
||||
if (FLAG_precompiled_mode) {
|
||||
UNIMPLEMENTED();
|
||||
} else {
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ Call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
}
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ Call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
|
||||
RecordSafepoint(locs);
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kOther, DeoptId::kNone, source);
|
||||
if (!FLAG_precompiled_mode) {
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after,
|
||||
source);
|
||||
}
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after, source);
|
||||
}
|
||||
RecordCatchEntryMoves(pending_deoptimization_env_);
|
||||
EmitDropArguments(args_desc.SizeWithTypeArgs());
|
||||
|
||||
@@ -541,6 +541,7 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
LocationSummary* locs) {
|
||||
ASSERT(CanCallDart());
|
||||
ASSERT(!arguments_descriptor.IsNull() && (arguments_descriptor.Length() > 0));
|
||||
ASSERT(!FLAG_precompiled_mode);
|
||||
const ArgumentsDescriptor args_desc(arguments_descriptor);
|
||||
const MegamorphicCache& cache = MegamorphicCache::ZoneHandle(
|
||||
zone(),
|
||||
@@ -550,31 +551,20 @@ void FlowGraphCompiler::EmitMegamorphicInstanceCall(
|
||||
__ movq(RDX, compiler::Address(RSP, (args_desc.Count() - 1) * kWordSize));
|
||||
|
||||
// Use same code pattern as instance call so it can be parsed by code patcher.
|
||||
if (FLAG_precompiled_mode) {
|
||||
// The AOT runtime will replace the slot in the object pool with the
|
||||
// entrypoint address - see app_snapshot.cc.
|
||||
__ LoadUniqueObject(RCX, StubCode::MegamorphicCall());
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ call(RCX);
|
||||
} else {
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
}
|
||||
__ LoadUniqueObject(IC_DATA_REG, cache);
|
||||
__ LoadUniqueObject(CODE_REG, StubCode::MegamorphicCall());
|
||||
__ call(compiler::FieldAddress(
|
||||
CODE_REG, Code::entry_point_offset(Code::EntryKind::kMonomorphic)));
|
||||
|
||||
RecordSafepoint(locs);
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kOther, DeoptId::kNone, source);
|
||||
if (!FLAG_precompiled_mode) {
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after,
|
||||
source);
|
||||
}
|
||||
const intptr_t deopt_id_after = DeoptId::ToDeoptAfter(deopt_id);
|
||||
if (is_optimizing()) {
|
||||
AddDeoptIndexAtCall(deopt_id_after, pending_deoptimization_env_);
|
||||
} else {
|
||||
// Add deoptimization continuation point after the call and before the
|
||||
// arguments are removed.
|
||||
AddCurrentDescriptor(UntaggedPcDescriptors::kDeopt, deopt_id_after, source);
|
||||
}
|
||||
RecordCatchEntryMoves(pending_deoptimization_env_);
|
||||
EmitDropArguments(args_desc.SizeWithTypeArgs());
|
||||
|
||||
Reference in New Issue
Block a user