From b2e940a5e5fe25ca4c779129652d836e3a6adc67 Mon Sep 17 00:00:00 2001 From: TDYa127 Date: Mon, 11 Jun 2012 17:56:10 -0700 Subject: Fix assume_this_non_null. If we modify "this" register, we can't assume this will not be null. Change-Id: Ic4715d892af948e2c0f73de5be9159454ab661d6 --- src/compiler_llvm/method_compiler.cc | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'src/compiler_llvm/method_compiler.cc') diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc index 6c1e194c62..754f3baccf 100644 --- a/src/compiler_llvm/method_compiler.cc +++ b/src/compiler_llvm/method_compiler.cc @@ -4397,10 +4397,14 @@ void MethodCompiler::ComputeMethodInfo() { field_idx, oat_compilation_unit_, field_offset, is_volatile, false); if (!is_fast_path) { may_throw_exception = true; - } else if (reg_idx != this_reg_idx) { - // NullPointerException - may_throw_exception = true; - assume_this_non_null = true; + } else { + // Fast-path, may throw NullPointerException + if (reg_idx == this_reg_idx) { + // We assume "this" will not be null at first. + assume_this_non_null = true; + } else { + may_throw_exception = true; + } } } break; @@ -4421,10 +4425,14 @@ void MethodCompiler::ComputeMethodInfo() { field_idx, oat_compilation_unit_, field_offset, is_volatile, true); if (!is_fast_path) { may_throw_exception = true; - } else if (reg_idx != this_reg_idx) { - // NullPointerException - may_throw_exception = true; - assume_this_non_null = true; + } else { + // Fast-path, may throw NullPointerException + if (reg_idx == this_reg_idx) { + // We assume "this" will not be null at first. + assume_this_non_null = true; + } else { + may_throw_exception = true; + } } } break; -- cgit v1.2.3-59-g8ed1b