/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_OOPS_FIELDSTREAMS_HPP
#define SHARE_VM_OOPS_FIELDSTREAMS_HPP
#include "oops/instanceKlass.hpp"
#include "oops/fieldInfo.hpp"
// The is the base class for iteration over the fields array
// describing the declared fields in the class. Several subclasses
// are provided depending on the kind of iteration required. The
// JavaFieldStream is for iterating over regular Java fields and it
// generally the preferred iterator. InternalFieldStream only
// iterates over fields that have been injected by the JVM.
// AllFieldStream exposes all fields and should only be used in rare
// cases.
protected:
int _index;
int _limit;
int num_fields = 0;
int skipped_generic_signature_slots = 0;
/* Scan from 0 to the current _index. Count the number of generic
signature slots for field[0] to field[_index - 1]. */
for (int i = 0; i < _index; i++) {
if (flags.field_has_generic_signature()) {
length --;
}
}
/* Scan from the current _index. */
if (flags.field_has_generic_signature()) {
length --;
}
num_fields ++;
}
return num_fields;
}
_limit = num_fields;
} else {
}
}
_index = 0;
}
public:
_index = 0;
}
_index = 0;
}
// accessors
void next() {
if (access_flags().field_has_generic_signature()) {
}
_index += 1;
}
// Accessors for current field
return flags;
}
}
}
}
}
if (access_flags().field_has_generic_signature()) {
} else {
return NULL;
}
}
int offset() const {
}
}
};
// Iterate over only the internal fields
public:
JavaFieldStream(instanceKlass* k): FieldStreamBase(k->fields(), k->constants(), 0, k->java_fields_count()) {}
JavaFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), 0, k->java_fields_count()) {}
int name_index() const {
return field()->name_index();
}
}
int signature_index() const {
return field()->signature_index();
}
}
int generic_signature_index() const {
if (access_flags().field_has_generic_signature()) {
} else {
return 0;
}
}
if (access_flags().field_has_generic_signature()) {
}
}
int initval_index() const {
return field()->initval_index();
}
}
};
// Iterate over only the internal fields
public:
InternalFieldStream(instanceKlass* k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {}
InternalFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants(), k->java_fields_count(), 0) {}
};
public:
AllFieldStream(typeArrayHandle fields, constantPoolHandle constants): FieldStreamBase(fields, constants) {}
};
#endif // SHARE_VM_OOPS_FIELDSTREAMS_HPP