From 77520bca97ec44e3758510cebd0f20e3bb4584ea Mon Sep 17 00:00:00 2001 From: Calin Juravle Date: Mon, 12 Jan 2015 18:45:46 +0000 Subject: Record implicit null checks at the actual invoke time. ImplicitNullChecks are recorded only for instructions directly (see NB below) preceeded by NullChecks in the graph. This way we avoid recording redundant safepoints and minimize the code size increase. NB: ParallalelMoves might be inserted by the register allocator between the NullChecks and their uses. These modify the environment and the correct action would be to reverse their modification. This will be addressed in a follow-up CL. Change-Id: Ie50006e5a4bd22932dcf11348f5a655d253cd898 --- compiler/optimizing/nodes.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'compiler/optimizing/nodes.cc') diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc index ade31380ec..39ec22bea1 100644 --- a/compiler/optimizing/nodes.cc +++ b/compiler/optimizing/nodes.cc @@ -15,6 +15,7 @@ */ #include "nodes.h" + #include "ssa_builder.h" #include "utils/growable_array.h" @@ -456,6 +457,22 @@ static void RemoveFromUseList(T* user, } } +HInstruction* HInstruction::GetNextDisregardingMoves() const { + HInstruction* next = GetNext(); + while (next != nullptr && next->IsParallelMove()) { + next = next->GetNext(); + } + return next; +} + +HInstruction* HInstruction::GetPreviousDisregardingMoves() const { + HInstruction* previous = GetPrevious(); + while (previous != nullptr && previous->IsParallelMove()) { + previous = previous->GetPrevious(); + } + return previous; +} + void HInstruction::RemoveUser(HInstruction* user, size_t input_index) { RemoveFromUseList(user, input_index, &uses_); } @@ -654,11 +671,7 @@ HConstant* HBinaryOperation::TryStaticEvaluation() const { } bool HCondition::IsBeforeWhenDisregardMoves(HIf* if_) const { - HInstruction* previous = if_->GetPrevious(); - while (previous != nullptr && previous->IsParallelMove()) { - previous = previous->GetPrevious(); - } - return previous == this; + return this == if_->GetPreviousDisregardingMoves(); } bool HInstruction::Equals(HInstruction* other) const { -- cgit v1.2.3-59-g8ed1b