Path: blob/master/runtime/gc_modron_standard/RootScannerReadBarrierVerifier.cpp
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2019 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 "ReadBarrierVerifier.hpp"2324#include "ObjectAccessBarrier.hpp"25#include "RootScannerReadBarrierVerifier.hpp"2627#if defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS)2829void30MM_RootScannerReadBarrierVerifier::doMonitorReference(J9ObjectMonitor *objectMonitor, GC_HashTableIterator *monitorReferenceIterator)31{32J9ThreadAbstractMonitor * monitor = (J9ThreadAbstractMonitor*)objectMonitor->monitor;33if (_poison) {34((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), (omrobjectptr_t *)&monitor->userData);35} else {36((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), (omrobjectptr_t *)&monitor->userData);37}38}3940void41MM_RootScannerReadBarrierVerifier::doJNIWeakGlobalReference(omrobjectptr_t *slotPtr)42{43if (_poison) {44((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), slotPtr);45} else {46((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), slotPtr);47}48}4950void51MM_RootScannerReadBarrierVerifier::scanClass(MM_EnvironmentBase *env)52{53OMR_VMThread *omrVMThread = env->getOmrVMThread();54GC_SegmentIterator segmentIterator(static_cast<J9JavaVM*>(omrVMThread->_vm->_language_vm)->classMemorySegments, MEMORY_TYPE_RAM_CLASS);5556while (J9MemorySegment *segment = segmentIterator.nextSegment()) {57GC_ClassHeapIterator classHeapIterator(static_cast<J9JavaVM*>(omrVMThread->_vm->_language_vm), segment);58J9Class *clazz = NULL;5960while (NULL != (clazz = classHeapIterator.nextClass())) {6162volatile omrobjectptr_t *slotPtr = NULL;63GC_ClassIterator classIterator(env, clazz);64while (NULL != (slotPtr = (omrobjectptr_t*)classIterator.nextSlot())) {65doClassVerify((omrobjectptr_t *)slotPtr);66}67}68}69}7071void72MM_RootScannerReadBarrierVerifier::doClassVerify(omrobjectptr_t *slotPtr)73{74if (_poison) {75((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->poisonSlot(_env->getExtensions(), slotPtr);76} else {77((MM_ReadBarrierVerifier*)_extensions->accessBarrier)->healSlot(_env->getExtensions(), slotPtr);78}79}80#endif /* defined(OMR_ENV_DATA64) && defined(OMR_GC_FULL_POINTERS) */818283