From 66d691de219e840b3f84385d8bd1b7001562b0e5 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Fri, 7 Apr 2017 17:53:39 +0100 Subject: ARM64: Link-time generated thunks for ArrayGet Baker CC read barrier. Test: Added a test to relative_patcher_arm64 Test: m test-art-target-gtest on Nexus 6P. Test: Nexus 6P boots. Test: testrunner.py --target on Nexus 6P. Test: Nexus 6P boots with heap poisoning. Test: testrunner.py --target on Nexus 6P with heap poisoning. Bug: 29516974 Bug: 30126666 Bug: 36141117 Change-Id: Id0f23089c55cbb53b84305c11bb4b03718561ade --- compiler/optimizing/nodes.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 6be237e612..f9eb3435da 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -5376,10 +5376,16 @@ class HArrayGet FINAL : public HExpression<2> { } bool CanDoImplicitNullCheckOn(HInstruction* obj ATTRIBUTE_UNUSED) const OVERRIDE { // TODO: We can be smarter here. - // Currently, the array access is always preceded by an ArrayLength or a NullCheck - // which generates the implicit null check. There are cases when these can be removed - // to produce better code. If we ever add optimizations to do so we should allow an - // implicit check here (as long as the address falls in the first page). + // Currently, unless the array is the result of NewArray, the array access is always + // preceded by some form of null NullCheck necessary for the bounds check, usually + // implicit null check on the ArrayLength input to BoundsCheck or Deoptimize for + // dynamic BCE. There are cases when these could be removed to produce better code. + // If we ever add optimizations to do so we should allow an implicit check here + // (as long as the address falls in the first page). + // + // As an example of such fancy optimization, we could eliminate BoundsCheck for + // a = cond ? new int[1] : null; + // a[0]; // The Phi does not need bounds check for either input. return false; } -- cgit v1.2.3-59-g8ed1b