Skip to content

Commit

Permalink
[gardening] Always tag class_id register on arm64 in subtype test cac…
Browse files Browse the repository at this point in the history
…he stub

LoadClassById no longer tags class_id register as side-effect. This change
was missing for arm64 in ef9d699.

Change-Id: I92278b01ec2211dc9be860c1a5386ecd4253fb0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116526
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
  • Loading branch information
mkustermann authored and commit-bot@chromium.org committed Sep 10, 2019
1 parent 6717bfe commit 300c333
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion runtime/vm/compiler/asm_intrinsifier_arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ void AsmIntrinsifier::ObjectRuntimeType(Assembler* assembler,
__ Ret();

__ Bind(&use_declaration_type);
__ LoadClassById(R2, R1); // Overwrites R1.
__ LoadClassById(R2, R1);
__ ldrh(R3, FieldAddress(R2, target::Class::num_type_arguments_offset()));
__ CompareImmediate(R3, 0);
__ b(normal_ir_body, NE);
Expand Down
4 changes: 2 additions & 2 deletions runtime/vm/compiler/asm_intrinsifier_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ void AsmIntrinsifier::ObjectRuntimeType(Assembler* assembler,
__ ret();

__ Bind(&use_declaration_type);
__ LoadClassById(R2, R1); // Overwrites R1.
__ LoadClassById(R2, R1);
__ ldr(R3, FieldAddress(R2, target::Class::num_type_arguments_offset()),
kHalfword);
__ CompareImmediate(R3, 0);
Expand Down Expand Up @@ -1704,7 +1704,7 @@ void AsmIntrinsifier::ObjectHaveSameRuntimeType(Assembler* assembler,
// Objects have the same class and neither is a closure.
// Check if there are no type arguments. In this case we can return true.
// Otherwise fall through into the runtime to handle comparison.
__ LoadClassById(R3, R1); // Overwrites R1.
__ LoadClassById(R3, R1);
__ ldr(R3, FieldAddress(R3, target::Class::num_type_arguments_offset()),
kHalfword);
__ CompareImmediate(R3, 0);
Expand Down
1 change: 0 additions & 1 deletion runtime/vm/compiler/assembler/assembler_arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,7 +1526,6 @@ class Assembler : public AssemblerBase {
void CompareObject(Register reg, const Object& object);

void LoadClassId(Register result, Register object);
// Overwrites class_id register (it will be tagged afterwards).
void LoadClassById(Register result, Register class_id);
void CompareClassId(Register object,
intptr_t class_id,
Expand Down
1 change: 0 additions & 1 deletion runtime/vm/compiler/assembler/assembler_x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,6 @@ class Assembler : public AssemblerBase {

// Loading and comparing classes of objects.
void LoadClassId(Register result, Register object);

void LoadClassById(Register result, Register class_id);

void CompareClassId(Register object,
Expand Down
7 changes: 2 additions & 5 deletions runtime/vm/compiler/stub_code_compiler_arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2796,12 +2796,8 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
// Non-Closure handling.
{
__ Bind(&not_closure);
if (n == 1) {
__ SmiTag(kInstanceCidOrFunction);
} else {
ASSERT(n >= 2);
if (n >= 2) {
Label has_no_type_arguments;
// [LoadClassById] also tags [kInstanceCidOrFunction] as a side-effect.
__ LoadClassById(R5, kInstanceCidOrFunction);
__ mov(kInstanceInstantiatorTypeArgumentsReg, kNullReg);
__ LoadFieldFromOffset(
Expand All @@ -2818,6 +2814,7 @@ static void GenerateSubtypeNTestCacheStub(Assembler* assembler, int n) {
__ mov(kInstanceDelayedFunctionTypeArgumentsReg, kNullReg);
}
}
__ SmiTag(kInstanceCidOrFunction);
}

Label found, not_found, next_iteration;
Expand Down

0 comments on commit 300c333

Please sign in to comment.