Path: blob/master/runtime/gc_vlhgc/EnvironmentVLHGC.cpp
5986 views
/*******************************************************************************1* Copyright (c) 1991, 2021 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 "j9.h"23#include "j9cfg.h"2425#include "EnvironmentVLHGC.hpp"26#include "GCExtensions.hpp"27#include "HeapRegionManager.hpp"28#include "InterRegionRememberedSet.hpp"29#include "RememberedSetCardBucket.hpp"3031MM_EnvironmentVLHGC::MM_EnvironmentVLHGC(OMR_VMThread *omrVMThread)32: MM_EnvironmentBase(omrVMThread)33,_survivorCopyScanCache(NULL)34,_scanCache(NULL)35,_deferredScanCache(NULL)36, _copyForwardCompactGroups(NULL)37, _previousConcurrentYieldCheckBytesScanned(0)38, _rsclBufferControlBlockHead(NULL)39, _rsclBufferControlBlockTail(NULL)40, _rsclBufferControlBlockCount(0)41, _rememberedSetCardBucketPool(NULL)42, _lastOverflowedRsclWithReleasedBuffers(NULL)43{44_typeId = __FUNCTION__;45}4647/**48* Create an Environment object.49*/50MM_EnvironmentVLHGC::MM_EnvironmentVLHGC(J9JavaVM *javaVM)51: MM_EnvironmentBase(javaVM->omrVM)52,_survivorCopyScanCache(NULL)53,_scanCache(NULL)54,_deferredScanCache(NULL)55, _copyForwardCompactGroups(NULL)56, _previousConcurrentYieldCheckBytesScanned(0)57, _rsclBufferControlBlockHead(NULL)58, _rsclBufferControlBlockTail(NULL)59, _rsclBufferControlBlockCount(0)60, _rememberedSetCardBucketPool(NULL)61, _lastOverflowedRsclWithReleasedBuffers(NULL)62{63_typeId = __FUNCTION__;64}6566MM_EnvironmentVLHGC *67MM_EnvironmentVLHGC::newInstance(MM_GCExtensionsBase *extensions, OMR_VMThread *vmThread)68{69MM_EnvironmentVLHGC *env = NULL;7071void* envPtr = (void *)pool_newElement(extensions->environments);72if(NULL != envPtr) {73env = new(envPtr) MM_EnvironmentVLHGC(vmThread);74if (!env->initialize(extensions)) {75env->kill();76env = NULL;77}78}7980return env;81}8283void84MM_EnvironmentVLHGC::kill()85{86MM_EnvironmentBase::kill();87}8889bool90MM_EnvironmentVLHGC::initialize(MM_GCExtensionsBase *extensions )91{92/* initialize base class */93return MM_EnvironmentBase::initialize(extensions);94}9596void97MM_EnvironmentVLHGC::initializeGCThread()98{99Assert_MM_true(NULL == _rememberedSetCardBucketPool);100MM_GCExtensions *extensions = MM_GCExtensions::getExtensions(this);101uintptr_t threadPoolSize = extensions->getHeap()->getHeapRegionManager()->getTableRegionCount();102/* Make this thread aware of its RSCL buckets for all regions */103_rememberedSetCardBucketPool = &extensions->rememberedSetCardBucketPool[getWorkerID() * threadPoolSize];104/* Associate buckets with appropriate RSCL (each RSCL maintains a list of its own buckets) */105extensions->interRegionRememberedSet->threadLocalInitialize(this);106}107108void109MM_EnvironmentVLHGC::tearDown(MM_GCExtensionsBase *extensions)110{111/* tearDown base class */112MM_EnvironmentBase::tearDown(extensions);113}114115116