From 2f4942879da18c9789800878b0e5eb87fbedb7b0 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Tue, 7 Jan 2020 22:53:09 +0000 Subject: Revert^2 "Remove finalizable restriction on structural redefinition" This reverts commit 0b1afb7c63d99c88f90f17770ad94ccb0b0c57d3. Daemon shutdown is known to be somewhat flaky. That seems to be the cause of this failure. Reason for revert: Removed Daemon threads from tests 2006 & 2007. Bug: 134162467 Test: % ./art/test/run-test --create-runner --host --prebuild --compact-dex-level fast --jit --no-relocate --runtime-option -Xcheck:jni --debuggable --runtime-option -Xopaque-jni-ids:true --64 2007 ... Runnable test script written to /tmp/allight/test-230585/runit.sh ... % ./art/tools/parallel_run.py -j80 /tmp/allight/test-230585/runit.sh --out failure.txt Test: ./art/test/run-test --create-runner --host --prebuild --compact-dex-level fast --jit --no-relocate --runtime-option -Xcheck:jni --debuggable --runtime-option -Xopaque-jni-ids:true --64 2006 Change-Id: I392a2936995dd05b08feea36f11b616c1548ae46 --- runtime/mirror/class-alloc-inl.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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 28612443be..5627b4956e 100644 --- a/runtime/mirror/class-alloc-inl.h +++ b/runtime/mirror/class-alloc-inl.h @@ -46,13 +46,19 @@ 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(); - const bool add_finalizer = kCheckAddFinalizer && IsFinalizable(); - if (!kCheckAddFinalizer) { - DCHECK(!IsFinalizable()); + bool add_finalizer; + switch (kAddFinalizer) { + case Class::AddFinalizer::kUseClassTag: + add_finalizer = IsFinalizable(); + break; + case Class::AddFinalizer::kNoAddFinalizer: + add_finalizer = false; + DCHECK(!kCheckAddFinalizer || !IsFinalizable()); + break; } // Note that the `this` pointer may be invalidated after the allocation. ObjPtr obj = -- cgit v1.2.3-59-g8ed1b