Path: blob/master/runtime/compiler/env/J9VMEnv.hpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 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#ifndef J9_VMENV_INCL23#define J9_VMENV_INCL2425/*26* The following #define and typedef must appear before any #includes in this file27*/28#ifndef J9_VMENV_CONNECTOR29#define J9_VMENV_CONNECTOR30namespace J9 { class VMEnv; }31namespace J9 { typedef J9::VMEnv VMEnvConnector; }32#endif3334#include "env/OMRVMEnv.hpp"35#include "env/jittypes.h"36#include "infra/Annotations.hpp"37#include "j9.h"3839struct OMR_VMThread;40class TR_J9VMBase;41class TR_FrontEnd;42namespace TR { class Compilation; }4344namespace J945{4647class OMR_EXTENSIBLE VMEnv : public OMR::VMEnvConnector48{49public:5051int64_t maxHeapSizeInBytes();5253uintptr_t thisThreadGetPendingExceptionOffset();5455bool hasResumableTrapHandler(TR::Compilation *comp);56bool hasResumableTrapHandler(OMR_VMThread *omrVMThread);5758using OMR::VMEnvConnector::getUSecClock;59uint64_t getUSecClock(TR::Compilation *comp);60uint64_t getUSecClock(OMR_VMThread *omrVMThread);6162uint64_t getHighResClock(TR::Compilation *comp);63uint64_t getHighResClock(OMR_VMThread *omrVMThread);6465uint64_t getHighResClockResolution(TR::Compilation *comp);66uint64_t getHighResClockResolution(OMR_VMThread *omrVMThread);67static uint64_t getHighResClockResolution(TR_FrontEnd *fej9);68uint64_t getHighResClockResolution();6970bool hasAccess(OMR_VMThread *omrVMThread);71bool hasAccess(J9VMThread *j9VMThread);72bool hasAccess(TR::Compilation *comp);7374bool acquireVMAccessIfNeeded(OMR_VMThread *omrVMThread);75bool acquireVMAccessIfNeeded(TR_J9VMBase *fej9);76bool acquireVMAccessIfNeeded(TR::Compilation *comp);7778bool tryToAcquireAccess(TR::Compilation *, bool *);79bool tryToAcquireAccess(OMR_VMThread *, bool *);8081void releaseVMAccessIfNeeded(TR::Compilation *comp, bool haveAcquiredVMAccess);82void releaseVMAccessIfNeeded(OMR_VMThread *, bool haveAcquiredVMAccess);83void releaseVMAccessIfNeeded(TR_J9VMBase *, bool haveAcquiredVMAccess);8485void releaseAccess(TR::Compilation *comp);86void releaseAccess(OMR_VMThread *omrVMThread);87void releaseAccess(TR_J9VMBase *fej9);8889J9VMThread *J9VMThreadFromOMRVMThread(OMR_VMThread *omrVMThread)90{91return (J9VMThread *)omrVMThread->_language_vmthread;92}9394bool canMethodEnterEventBeHooked(TR::Compilation *comp);95bool canMethodExitEventBeHooked(TR::Compilation *comp);96bool isSelectiveMethodEnterExitEnabled(TR::Compilation *comp);9798uintptr_t getOverflowSafeAllocSize(TR::Compilation *comp);99100int64_t cpuTimeSpentInCompilationThread(TR::Compilation *comp);101102// On-stack replacement103//104uintptr_t OSRFrameHeaderSizeInBytes(TR::Compilation *comp);105uintptr_t OSRFrameSizeInBytes(TR::Compilation *comp, TR_OpaqueMethodBlock* method);106bool ensureOSRBufferSize(TR::Compilation *comp, uintptr_t osrFrameSizeInBytes, uintptr_t osrScratchBufferSizeInBytes, uintptr_t osrStackFrameSizeInBytes);107uintptr_t thisThreadGetOSRReturnAddressOffset(TR::Compilation *comp);108109uintptr_t thisThreadGetGSIntermediateResultOffset(TR::Compilation *comp);110uintptr_t thisThreadGetConcurrentScavengeActiveByteAddressOffset(TR::Compilation *comp);111uintptr_t thisThreadGetEvacuateBaseAddressOffset(TR::Compilation *comp);112uintptr_t thisThreadGetEvacuateTopAddressOffset(TR::Compilation *comp);113uintptr_t thisThreadGetGSOperandAddressOffset(TR::Compilation *comp);114uintptr_t thisThreadGetGSHandlerAddressOffset(TR::Compilation *comp);115size_t getInterpreterVTableOffset();116117bool isVMInStartupPhase(J9JITConfig *jitConfig);118};119120}121122#endif123124125