summaryrefslogtreecommitdiff
path: root/runtime/entrypoints/entrypoint_utils-inl.h
diff options
context:
space:
mode:
author Nicolas Geoffray <ngeoffray@google.com> 2023-01-06 16:44:38 +0000
committer Nicolas Geoffray <ngeoffray@google.com> 2023-01-17 09:20:34 +0000
commit9e3761d6b98e090cff2e30e0f5e9714f434dd0f2 (patch)
tree9fba285742b0658a623dd42c14f9241cceb7ba18 /runtime/entrypoints/entrypoint_utils-inl.h
parent9ab12375de1b61ebfa924a6fbff7428e3b54d1f1 (diff)
Remove one template argument to the switch interpreter.
Dynamically check for SkipAccessChecks instead. arm64 apex goes from 49545216 bytes to 49324032, ~200KB savings. Test: test.py Change-Id: Iaa64f56485b15c0e3c0eaa31e469a2795035debe
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils-inl.h')
-rw-r--r--runtime/entrypoints/entrypoint_utils-inl.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index cbe754337c..4a1dfba786 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -289,7 +289,6 @@ inline ObjPtr<mirror::Object> AllocObjectFromCodeInitialized(ObjPtr<mirror::Clas
}
-template <bool kAccessCheck>
ALWAYS_INLINE
inline ObjPtr<mirror::Class> CheckArrayAlloc(dex::TypeIndex type_idx,
int32_t component_count,
@@ -311,7 +310,7 @@ inline ObjPtr<mirror::Class> CheckArrayAlloc(dex::TypeIndex type_idx,
}
CHECK(klass->IsArrayClass()) << klass->PrettyClass();
}
- if (kAccessCheck) {
+ if (!method->SkipAccessChecks()) {
ObjPtr<mirror::Class> referrer = method->GetDeclaringClass();
if (UNLIKELY(!referrer->CanAccess(klass))) {
ThrowIllegalAccessErrorClass(referrer, klass);
@@ -326,7 +325,7 @@ inline ObjPtr<mirror::Class> CheckArrayAlloc(dex::TypeIndex type_idx,
// it cannot be resolved, throw an error. If it can, use it to create an array.
// When verification/compiler hasn't been able to verify access, optionally perform an access
// check.
-template <bool kAccessCheck, bool kInstrumented>
+template <bool kInstrumented>
ALWAYS_INLINE
inline ObjPtr<mirror::Array> AllocArrayFromCode(dex::TypeIndex type_idx,
int32_t component_count,
@@ -334,8 +333,7 @@ inline ObjPtr<mirror::Array> AllocArrayFromCode(dex::TypeIndex type_idx,
Thread* self,
gc::AllocatorType allocator_type) {
bool slow_path = false;
- ObjPtr<mirror::Class> klass =
- CheckArrayAlloc<kAccessCheck>(type_idx, component_count, method, &slow_path);
+ ObjPtr<mirror::Class> klass = CheckArrayAlloc(type_idx, component_count, method, &slow_path);
if (UNLIKELY(slow_path)) {
if (klass == nullptr) {
return nullptr;