Add interface fast path to art_quick_check_cast for X86_64
X86_64 CC ritzperf results from perf:
art_quick_check_cast: 0.44% -> 0.76%
artIsAssignableFromCode: 1.78% -> 0.11%
Added stub test.
Bug: 32577579
Test: test-art-host
Change-Id: I5ed5675c4674fac8eed8826eb50527f4876e5f07
diff --git a/runtime/arch/stub_test.cc b/runtime/arch/stub_test.cc
index 4638c3f..c151f00 100644
--- a/runtime/arch/stub_test.cc
+++ b/runtime/arch/stub_test.cc
@@ -819,34 +819,60 @@
ScopedObjectAccess soa(self);
// garbage is created during ClassLinker::Init
- StackHandleScope<2> hs(soa.Self());
+ StackHandleScope<4> hs(soa.Self());
Handle<mirror::Class> c(
hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/Object;")));
Handle<mirror::Class> c2(
hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/lang/String;")));
+ Handle<mirror::Class> list(
+ hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/util/List;")));
+ Handle<mirror::Class> array_list(
+ hs.NewHandle(class_linker_->FindSystemClass(soa.Self(), "[Ljava/util/ArrayList;")));
EXPECT_FALSE(self->IsExceptionPending());
- Invoke3(reinterpret_cast<size_t>(c.Get()), reinterpret_cast<size_t>(c.Get()), 0U,
- art_quick_check_cast, self);
-
+ Invoke3(reinterpret_cast<size_t>(c.Get()),
+ reinterpret_cast<size_t>(c.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
EXPECT_FALSE(self->IsExceptionPending());
- Invoke3(reinterpret_cast<size_t>(c2.Get()), reinterpret_cast<size_t>(c2.Get()), 0U,
- art_quick_check_cast, self);
-
+ Invoke3(reinterpret_cast<size_t>(c2.Get()),
+ reinterpret_cast<size_t>(c2.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
EXPECT_FALSE(self->IsExceptionPending());
- Invoke3(reinterpret_cast<size_t>(c.Get()), reinterpret_cast<size_t>(c2.Get()), 0U,
- art_quick_check_cast, self);
-
+ Invoke3(reinterpret_cast<size_t>(c.Get()),
+ reinterpret_cast<size_t>(c2.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
EXPECT_FALSE(self->IsExceptionPending());
+ Invoke3(reinterpret_cast<size_t>(list.Get()),
+ reinterpret_cast<size_t>(array_list.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
+ EXPECT_FALSE(self->IsExceptionPending());
+
+ Invoke3(reinterpret_cast<size_t>(list.Get()),
+ reinterpret_cast<size_t>(c2.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
+ EXPECT_TRUE(self->IsExceptionPending());
+ self->ClearException();
+
// TODO: Make the following work. But that would require correct managed frames.
-
- Invoke3(reinterpret_cast<size_t>(c2.Get()), reinterpret_cast<size_t>(c.Get()), 0U,
- art_quick_check_cast, self);
-
+ Invoke3(reinterpret_cast<size_t>(c2.Get()),
+ reinterpret_cast<size_t>(c.Get()),
+ 0U,
+ art_quick_check_cast,
+ self);
EXPECT_TRUE(self->IsExceptionPending());
self->ClearException();