From 0b1afb7c63d99c88f90f17770ad94ccb0b0c57d3 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 7 Jan 2020 22:51:03 +0000 Subject: Revert "Remove finalizable restriction on structural redefinition" This reverts commit 55d6fa4c352a1fadbd21b8d8e0929833e547b9e5. Bug: 134162467 Test: None, pure revert. Reason for revert: Flaky segvs across multiple configurations. Change-Id: Iaa8ec6cbd2eee141e271cd3a56a1b6be8bbb3a7c --- runtime/mirror/class-alloc-inl.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'runtime/mirror/class-alloc-inl.h') diff --git a/runtime/mirror/class-alloc-inl.h b/runtime/mirror/class-alloc-inl.h index 5627b4956e..28612443be 100644 --- a/runtime/mirror/class-alloc-inl.h +++ b/runtime/mirror/class-alloc-inl.h @@ -46,19 +46,13 @@ inline void Class::CheckObjectAlloc() { DCHECK_GE(this->object_size_, sizeof(Object)); } -template +template inline ObjPtr Class::Alloc(Thread* self, gc::AllocatorType allocator_type) { CheckObjectAlloc(); gc::Heap* heap = Runtime::Current()->GetHeap(); - bool add_finalizer; - switch (kAddFinalizer) { - case Class::AddFinalizer::kUseClassTag: - add_finalizer = IsFinalizable(); - break; - case Class::AddFinalizer::kNoAddFinalizer: - add_finalizer = false; - DCHECK(!kCheckAddFinalizer || !IsFinalizable()); - break; + const bool add_finalizer = kCheckAddFinalizer && IsFinalizable(); + if (!kCheckAddFinalizer) { + DCHECK(!IsFinalizable()); } // Note that the `this` pointer may be invalidated after the allocation. ObjPtr obj = -- cgit v1.2.3-59-g8ed1b