Skip to content

Commit f7e26c5

Browse files
sstricklCommit Queue
authored andcommitted
[vm] Add support for hash-based caches in SubtypeNTestCache stubs.
This also lowers the threshold for converting from a linear cache to a hash-based cache from 100 to 30 on non-IA32 architectures. (IA32 still goes to runtime if there's a hash-based cache.) For SubtypeTestCache benchmarks above this threshold, we see an improvement varying from ~50-100% to ~700-800% on all architectures, from lowest number of checks (50) to highest (1000). For SubtypeTestCache benchmarks below this threshold, no major changes are seen: generally <5% improvement or <5% regression per check at most. TEST=vm/cc/TTS Change-Id: I83aa7c085ab5a411e944ec660d6b8eba7a788ee0 Cq-Include-Trybots: luci.dart.try:vm-aot-linux-debug-simriscv64-try,vm-aot-linux-debug-x64-try,vm-aot-linux-release-x64-try,vm-aot-linux-product-x64-try,vm-aot-linux-release-simarm64-try,vm-aot-linux-release-simarm_x64-try,vm-aot-linux-debug-x64c-try,vm-aot-tsan-linux-release-x64-try,vm-aot-mac-release-arm64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-aot-dwarf-linux-product-x64-try,vm-linux-release-ia32-try,vm-linux-debug-x64c-try,vm-linux-debug-x64-try,vm-linux-debug-simriscv64-try,vm-linux-release-simarm64-try,vm-linux-release-simarm-try,vm-mac-release-arm64-try,vm-mac-release-x64-try,vm-tsan-linux-release-x64-try,vm-reload-rollback-linux-release-x64-try,vm-reload-linux-release-x64-try,vm-ffi-qemu-linux-release-arm-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308941 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Tess Strickland <[email protected]>
1 parent a92a1e5 commit f7e26c5

17 files changed

+701
-243
lines changed

runtime/vm/compiler/assembler/assembler_riscv.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,13 +3241,13 @@ void Assembler::LoadDFromOffset(FRegister dest, Register base, int32_t offset) {
32413241
}
32423242

32433243
void Assembler::LoadFromStack(Register dst, intptr_t depth) {
3244-
UNIMPLEMENTED();
3244+
LoadFromOffset(dst, SPREG, target::kWordSize * depth);
32453245
}
32463246
void Assembler::StoreToStack(Register src, intptr_t depth) {
3247-
UNIMPLEMENTED();
3247+
StoreToOffset(src, SPREG, target::kWordSize * depth);
32483248
}
32493249
void Assembler::CompareToStack(Register src, intptr_t depth) {
3250-
UNIMPLEMENTED();
3250+
CompareWithMemoryValue(src, Address(SPREG, target::kWordSize * depth));
32513251
}
32523252

32533253
void Assembler::StoreToOffset(Register src,

runtime/vm/compiler/assembler/assembler_x64.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,8 @@ void Assembler::StoreToStack(Register src, intptr_t depth) {
11301130
}
11311131

11321132
void Assembler::CompareToStack(Register src, intptr_t depth) {
1133-
cmpq(Address(SPREG, depth * target::kWordSize), src);
1133+
ASSERT(depth >= 0);
1134+
cmpq(src, Address(SPREG, depth * target::kWordSize));
11341135
}
11351136

11361137
void Assembler::ExtendValue(Register to, Register from, OperandSize sz) {

runtime/vm/compiler/backend/range_analysis.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,6 +2766,7 @@ void LoadFieldInstr::InferRange(RangeAnalysis* analysis, Range* range) {
27662766
*range = Range(RangeBoundary::FromConstant(0), RangeBoundary::MaxSmi());
27672767
break;
27682768

2769+
case Slot::Kind::kAbstractType_hash:
27692770
case Slot::Kind::kTypeArguments_hash:
27702771
*range = Range(RangeBoundary::MinSmi(), RangeBoundary::MaxSmi());
27712772
break;

runtime/vm/compiler/backend/slot.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ bool Slot::IsImmutableLengthSlot() const {
197197
case Slot::Kind::kSuspendState_then_callback:
198198
case Slot::Kind::kSuspendState_error_callback:
199199
case Slot::Kind::kTypeArgumentsIndex:
200+
case Slot::Kind::kAbstractType_hash:
200201
case Slot::Kind::kTypeParameters_names:
201202
case Slot::Kind::kTypeParameters_flags:
202203
case Slot::Kind::kTypeParameters_bounds:

runtime/vm/compiler/backend/slot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class ParsedFunction;
129129
V(Record, UntaggedRecord, shape, Smi, FINAL) \
130130
V(TypeArguments, UntaggedTypeArguments, hash, Smi, VAR) \
131131
V(TypeArguments, UntaggedTypeArguments, length, Smi, FINAL) \
132+
V(AbstractType, UntaggedTypeArguments, hash, Smi, VAR) \
132133
V(TypeParameters, UntaggedTypeParameters, names, Array, FINAL) \
133134
V(UnhandledException, UntaggedUnhandledException, exception, Dynamic, FINAL) \
134135
V(UnhandledException, UntaggedUnhandledException, stacktrace, Dynamic, FINAL)

0 commit comments

Comments
 (0)