Path: blob/master/runtime/compiler/env/J9KnownObjectTable.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_KNOWN_OBJECT_TABLE_INCL23#define J9_KNOWN_OBJECT_TABLE_INCL2425/*26* The following #define and typedef must appear before any #includes in this file27*/28#ifndef J9_KNOWN_OBJECT_TABLE_CONNECTOR29#define J9_KNOWN_OBJECT_TABLE_CONNECTOR30namespace J9 { class KnownObjectTable; }31namespace J9 { typedef J9::KnownObjectTable KnownObjectTableConnector; }32#endif3334#include "env/OMRKnownObjectTable.hpp"35#include "infra/Annotations.hpp"36#include "infra/Array.hpp"37#include "infra/BitVector.hpp"38#if defined(J9VM_OPT_JITSERVER)39#include <tuple>40#include <vector>41#endif /* defined(J9VM_OPT_JITSERVER) */4243namespace J9 { class Compilation; }44namespace TR { class Compilation; }45class TR_J9VMBase;46namespace J9 { class ObjectModel; }47class TR_VMFieldsInfo;48class TR_BitVector;4950#if defined(J9VM_OPT_JITSERVER)51struct52TR_KnownObjectTableDumpInfoStruct53{54uintptr_t *ref;55uintptr_t objectPointer;56int32_t hashCode;5758TR_KnownObjectTableDumpInfoStruct(uintptr_t *objRef, uintptr_t objPtr, int32_t code) :59ref(objRef),60objectPointer(objPtr),61hashCode(code) {}62};6364// <TR_KnownObjectTableDumpInfoStruct, std::string classNameStr>65using TR_KnownObjectTableDumpInfo = std::tuple<TR_KnownObjectTableDumpInfoStruct, std::string>;66#endif /* defined(J9VM_OPT_JITSERVER) */676869namespace J970{7172class OMR_EXTENSIBLE KnownObjectTable : public OMR::KnownObjectTableConnector73{74friend class ::TR_J9VMBase;75friend class Compilation;76TR_Array<uintptr_t*> _references;77TR_Array<int32_t> _stableArrayRanks;787980public:81TR_ALLOC(TR_Memory::FrontEnd);8283KnownObjectTable(TR::Compilation *comp);8485TR::KnownObjectTable *self();8687Index getEndIndex();88Index getOrCreateIndex(uintptr_t objectPointer);89Index getOrCreateIndex(uintptr_t objectPointer, bool isArrayWithConstantElements);90uintptr_t *getPointerLocation(Index index);91bool isNull(Index index);9293void dumpTo(TR::FILE *file, TR::Compilation *comp);9495Index getOrCreateIndexAt(uintptr_t *objectReferenceLocation);96Index getOrCreateIndexAt(uintptr_t *objectReferenceLocation, bool isArrayWithConstantElements);97Index getExistingIndexAt(uintptr_t *objectReferenceLocation);9899uintptr_t getPointer(Index index);100101#if defined(J9VM_OPT_JITSERVER)102void updateKnownObjectTableAtServer(Index index, uintptr_t *objectReferenceLocationClient);103void getKnownObjectTableDumpInfo(std::vector<TR_KnownObjectTableDumpInfo> &knotDumpInfoList);104#endif /* defined(J9VM_OPT_JITSERVER) */105106void addStableArray(Index index, int32_t stableArrayRank);107bool isArrayWithStableElements(Index index);108109private:110111void dumpObjectTo(TR::FILE *file, Index i, const char *fieldName, const char *sep, TR::Compilation *comp, TR_BitVector &visited, TR_VMFieldsInfo **fieldsInfoByIndex, int32_t depth);112};113114}115116#endif117118119