From 522e2241f5b5f331d0aa2f8508f4c97973f7f012 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Tue, 17 Mar 2015 18:48:28 +0000 Subject: ART: Fix condition for StoreNeedsWriteBarrier Codegen's StoreNeedsWriteBarrier assumed nulls are represented as integer constants and generated a barrier when not needed. This patch fixes the bug. Change-Id: I79247f1009b1fe6f24dba0d57e846ecc55806d4d --- compiler/optimizing/code_generator.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'compiler/optimizing/code_generator.h') diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h index 667f686059..ecaa6f0123 100644 --- a/compiler/optimizing/code_generator.h +++ b/compiler/optimizing/code_generator.h @@ -246,12 +246,9 @@ class CodeGenerator { void EmitParallelMoves(Location from1, Location to1, Location from2, Location to2); static bool StoreNeedsWriteBarrier(Primitive::Type type, HInstruction* value) { - if (kIsDebugBuild) { - if (type == Primitive::kPrimNot && value->IsIntConstant()) { - CHECK_EQ(value->AsIntConstant()->GetValue(), 0); - } - } - return type == Primitive::kPrimNot && !value->IsIntConstant(); + // Check that null value is not represented as an integer constant. + DCHECK(type != Primitive::kPrimNot || !value->IsIntConstant()); + return type == Primitive::kPrimNot && !value->IsNullConstant(); } void AddAllocatedRegister(Location location) { -- cgit v1.2.3-59-g8ed1b