Path: blob/master/runtime/gc_structs/ClassStaticsDeclarationOrderIterator.hpp
5985 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/**23* @file24* @ingroup GC_Structs25*/2627#if !defined(CLASSSTATICSDECLARATIONORDERITERATOR_HPP_)28#define CLASSSTATICSDECLARATIONORDERITERATOR_HPP_2930#include "j9.h"31#include "j9cfg.h"32#include "modron.h"33#include "locknursery.h"3435#include "GCExtensions.hpp"3637/**38* Iterate over all static slots in a class which contain an object reference.39* @note This iterator relies on a VM iterator which is not out of process safe, and consequently40* it is also not out of process safe.41* @ingroup GC_Structs42*/43class GC_ClassStaticsDeclarationOrderIterator44{45J9ROMFullTraversalFieldOffsetWalkState _walkState;46J9ROMFieldShape *_fieldShape;47J9JavaVM *_javaVM;48J9Class *_clazz;49IDATA _index;5051public:52GC_ClassStaticsDeclarationOrderIterator(J9JavaVM *jvm, J9Class *clazz, bool shouldPreindexInterfaceFields)53: _javaVM(jvm)54, _clazz(clazz)55, _index(-1)56{57U_32 flags = J9VM_FIELD_OFFSET_WALK_INCLUDE_STATIC | J9VM_FIELD_OFFSET_WALK_ONLY_OBJECT_SLOTS;58if (shouldPreindexInterfaceFields) {59flags |= J9VM_FIELD_OFFSET_WALK_PREINDEX_INTERFACE_FIELDS;60}6162_fieldShape = _javaVM->internalVMFunctions->fullTraversalFieldOffsetsStartDo(_javaVM, _clazz, &_walkState, flags);63};6465j9object_t *nextSlot();6667/**68* Gets the current static slot index.69* The current static slot index is based of the last static slot index of the superclass.70* @return static slot index of the entry returned by the last call of nextSlot.71* @return -1 if nextSlot has yet to be called.72*/73MMINLINE IDATA getIndex() {74return _index;75}76};7778#endif /* CLASSSTATICSDECLARATIONORDERITERATOR_HPP_ */79808182