From 4a79b17f374df876803e34edb60476fe33ab1671 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 18 Apr 2024 13:21:15 +0000 Subject: Optimizing: Treat app image objects as non-movable. Treat app image objects similar to boot image objects and avoid unnecessary read barriers for app image `HLoadClass` and `HInstanceOf` checks with app image `HLoadClass` input. Extend other optimizations to treat app image classes the same way as boot image classes even though this remains mostly dormant because we currently do not initialize app image classes with class initializers; the experimental flag `--initialize-app-image-classes` is false by default. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing --speed-profile Bug: 38313278 Change-Id: I359dd8897f6d128213602f5731d40edace298ab8 --- compiler/optimizing/code_generator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 4a6a229098..970da76c43 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -467,10 +467,10 @@ class CodeGenerator : public DeletableArenaObject { instance_of->GetTypeCheckKind() == TypeCheckKind::kClassHierarchyCheck || instance_of->GetTypeCheckKind() == TypeCheckKind::kArrayObjectCheck) << instance_of->GetTypeCheckKind(); - // If the target class is in the boot image, it's non-moveable and it doesn't matter + // If the target class is in the boot or app image, it's non-moveable and it doesn't matter // if we compare it with a from-space or to-space reference, the result is the same. // It's OK to traverse a class hierarchy jumping between from-space and to-space. - return EmitReadBarrier() && !instance_of->GetTargetClass()->IsInBootImage(); + return EmitReadBarrier() && !instance_of->GetTargetClass()->IsInImage(); } ReadBarrierOption ReadBarrierOptionForInstanceOf(HInstanceOf* instance_of) { @@ -485,7 +485,7 @@ class CodeGenerator : public DeletableArenaObject { case TypeCheckKind::kArrayObjectCheck: case TypeCheckKind::kInterfaceCheck: { bool needs_read_barrier = - EmitReadBarrier() && !check_cast->GetTargetClass()->IsInBootImage(); + EmitReadBarrier() && !check_cast->GetTargetClass()->IsInImage(); // We do not emit read barriers for HCheckCast, so we can get false negatives // and the slow path shall re-check and simply return if the cast is actually OK. return !needs_read_barrier; -- cgit v1.2.3-59-g8ed1b