From 5d40f182181488eb39ccd19ffd306bb1fb9740c9 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Mon, 26 Sep 2011 22:29:18 -0700 Subject: Fixes for "null instanceof" and class initialization First issue was that the codegen seemed to expect r0 to contain 0 for a false result in the null object case. This is a quick fix to make that true. Given that the code is doing the work of a null check and pulling out the object's class, the code should probably just pass the class to the helper function, making this a case of IsAssignableFrom, not instanceof. Second issues were related to missing EnsureInitialized calls in two different code paths, one coming from reflection, one coming from managed code. New Class::AllocObject assert should help keep us out of trouble in the future in this area, although perhaps Heap::AllocObject should have a check as well. Change-Id: Ib7975b6457481c1ac85135d38f42c6061e6443a0 --- src/compiler/codegen/arm/Thumb2/Gen.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'src/compiler/codegen') diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc index c9d1bb9a6f..e3893d37a1 100644 --- a/src/compiler/codegen/arm/Thumb2/Gen.cc +++ b/src/compiler/codegen/arm/Thumb2/Gen.cc @@ -707,6 +707,7 @@ STATIC void genInstanceof(CompilationUnit* cUnit, MIR* mir, RegLocation rlDest, // At this point, r2 has class loadValueDirectFixed(cUnit, rlSrc, r3); /* Ref */ /* When taken r0 has NULL which can be used for store directly */ + loadConstant(cUnit, r0, 0); /* Assume false */ ArmLIR* branch1 = genCmpImmBranch(cUnit, kArmCondEq, r3, 0); /* load object->clazz */ DCHECK_EQ(Object::ClassOffset().Int32Value(), 0); -- cgit v1.2.3-59-g8ed1b