From 8d5b8b295930aaa43255c4f0b74ece3ee8b43a47 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 24 Mar 2015 10:51:52 +0000 Subject: ART: Force constants into the entry block Optimizations such as GVN and BCE make the assumption that all constants are located in the entry block of the CFG, but not all passes adhere to this rule. This patch makes constructors of constants private and only accessible to friend classes - HGraph for int/long constants and SsaBuilder for float/double - which ensure that they are placed correctly and not duplicated. Note that the ArenaAllocatorAdapter was modified to not increment the ArenaAllocator's internal reference counter in order to allow for use of ArenaSafeMap inside an arena-allocated objects. Because their destructor is not called, the counter does not get decremented. Change-Id: I36a4fa29ae34fb905cdefd482ccbf386cff14166 --- compiler/optimizing/ssa_builder.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/optimizing/ssa_builder.cc') diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index ae6bf16..fcc4e69 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -353,7 +353,7 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { * is used for floating point operations. We create a floating-point equivalent * constant to make the operations correctly typed. */ -static HFloatConstant* GetFloatEquivalent(HIntConstant* constant) { +HFloatConstant* SsaBuilder::GetFloatEquivalent(HIntConstant* constant) { // We place the floating point constant next to this constant. HFloatConstant* result = constant->GetNext()->AsFloatConstant(); if (result == nullptr) { @@ -375,7 +375,7 @@ static HFloatConstant* GetFloatEquivalent(HIntConstant* constant) { * is used for floating point operations. We create a floating-point equivalent * constant to make the operations correctly typed. */ -static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) { +HDoubleConstant* SsaBuilder::GetDoubleEquivalent(HLongConstant* constant) { // We place the floating point constant next to this constant. HDoubleConstant* result = constant->GetNext()->AsDoubleConstant(); if (result == nullptr) { @@ -398,7 +398,7 @@ static HDoubleConstant* GetDoubleEquivalent(HLongConstant* constant) { * floating point registers and core registers), we need to create a copy of the * phi with a floating point / reference type. */ -static HPhi* GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type) { +HPhi* SsaBuilder::GetFloatDoubleOrReferenceEquivalentOfPhi(HPhi* phi, Primitive::Type type) { // We place the floating point /reference phi next to this phi. HInstruction* next = phi->GetNext(); if (next != nullptr -- cgit v1.1