Fix assume_this_non_null.
If we modify "this" register, we can't assume this will not be null.
Change-Id: Ic4715d892af948e2c0f73de5be9159454ab661d6
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 6c1e194..754f3ba 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -4397,10 +4397,14 @@
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 @@
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;