Path: blob/master/runtime/gc_check/CheckUnfinalizedList.cpp
5985 views
/*******************************************************************************1* Copyright (c) 1991, 2014 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#include "CheckEngine.hpp"23#include "CheckUnfinalizedList.hpp"24#include "ModronTypes.hpp"25#include "ObjectAccessBarrier.hpp"26#include "ScanFormatter.hpp"27#include "UnfinalizedObjectList.hpp"2829#if defined(J9VM_GC_FINALIZATION)3031GC_Check *32GC_CheckUnfinalizedList::newInstance(J9JavaVM *javaVM, GC_CheckEngine *engine)33{34MM_Forge *forge = MM_GCExtensions::getExtensions(javaVM)->getForge();3536GC_CheckUnfinalizedList *check = (GC_CheckUnfinalizedList *) forge->allocate(sizeof(GC_CheckUnfinalizedList), MM_AllocationCategory::DIAGNOSTIC, J9_GET_CALLSITE());37if(check) {38new(check) GC_CheckUnfinalizedList(javaVM, engine);39}40return check;41}4243void44GC_CheckUnfinalizedList::kill()45{46MM_Forge *forge = MM_GCExtensions::getExtensions(_javaVM)->getForge();47forge->free(this);48}4950void51GC_CheckUnfinalizedList::check()52{53MM_ObjectAccessBarrier *barrier = _extensions->accessBarrier;54MM_UnfinalizedObjectList *unfinalizedObjectList = _extensions->unfinalizedObjectLists;5556while(NULL != unfinalizedObjectList) {57J9Object *objectPtr = unfinalizedObjectList->getHeadOfList();58while (NULL != objectPtr) {59if (_engine->checkSlotUnfinalizedList(_javaVM, &objectPtr, unfinalizedObjectList) != J9MODRON_SLOT_ITERATOR_OK ){60return;61}62objectPtr = barrier->getFinalizeLink(objectPtr);63}64unfinalizedObjectList = unfinalizedObjectList->getNextList();65}66}6768void69GC_CheckUnfinalizedList::print()70{71MM_ObjectAccessBarrier *barrier = _extensions->accessBarrier;72MM_UnfinalizedObjectList *unfinalizedObjectList = _extensions->unfinalizedObjectLists;7374GC_ScanFormatter formatter(_portLibrary, "unfinalizedObjectList");75while(NULL != unfinalizedObjectList) {76formatter.section("list", (void *) unfinalizedObjectList);77J9Object *objectPtr = unfinalizedObjectList->getHeadOfList();78while (NULL != objectPtr) {79formatter.entry((void *) objectPtr);80objectPtr = barrier->getFinalizeLink(objectPtr);81}82formatter.endSection();83unfinalizedObjectList = unfinalizedObjectList->getNextList();84}85formatter.end("unfinalizedObjectList");86}8788#endif /* J9VM_GC_FINALIZATION */899091