diff options
author | 2024-04-18 13:21:15 +0000 | |
---|---|---|
committer | 2024-04-22 07:28:48 +0000 | |
commit | 4a79b17f374df876803e34edb60476fe33ab1671 (patch) | |
tree | 12c07faf384d12d7ae535300f8218527628144b1 /compiler/optimizing/code_generator.h | |
parent | 55e99bd1c5a403c4bddc023403593c9199af56f2 (diff) |
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
Diffstat (limited to 'compiler/optimizing/code_generator.h')
-rw-r--r-- | compiler/optimizing/code_generator.h | 6 |
1 files changed, 3 insertions, 3 deletions
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<kArenaAllocCodeGenerator> { 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<kArenaAllocCodeGenerator> { 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; |