/* * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
class Annotations; template <typename T> class Array; class ClassFileStream; class ClassLoaderData; class ClassLoadInfo; class ClassInstanceInfo; class CompressedLineNumberWriteStream; class ConstMethod; class FieldInfo; template <typename T> class GrowableArray; class InstanceKlass; class RecordComponent; class Symbol; class FieldLayoutBuilder;
// Utility to collect and compact oop maps during layout class OopMapBlocksBuilder : public ResourceObj { public:
OopMapBlock* _nonstatic_oop_maps; unsignedint _nonstatic_oop_map_count; unsignedint _max_nonstatic_oop_maps;
// Values needed for oopmap and InstanceKlass creation class FieldLayoutInfo : public ResourceObj { public:
OopMapBlocksBuilder* oop_map_blocks; int _instance_size; int _nonstatic_field_size; int _static_field_size; bool _has_nonstatic_fields;
};
// Parser for for .class files // // The bytes describing the class file structure is read from a Stream object
class ClassFileParser { friendclass FieldLayoutBuilder; friendclass FieldLayout;
class ClassAnnotationCollector; class FieldAllocationCount; class FieldAnnotationCollector;
public: // The ClassFileParser has an associated "publicity" level // It is used to control which subsystems (if any) // will observe the parsing (logging, events, tracing). // Default level is "BROADCAST", which is equivalent to // a "public" parsing attempt. // // "INTERNAL" level should be entirely private to the // caller - this allows for internal reuse of ClassFileParser // enum Publicity {
INTERNAL,
BROADCAST
};
enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
private: // Potentially unaligned pointer to various 16-bit entries in the class file typedefvoid unsafe_u2;
const ClassFileStream* _stream; // Actual input stream
Symbol* _class_name; mutable ClassLoaderData* _loader_data; constbool _is_hidden; constbool _can_access_vm_annotations; int _orig_cp_size;
// Metadata created before the instance klass is created. Must be deallocated // if not transferred to the InstanceKlass upon successful class loading // in which case these pointers have been set to NULL. const InstanceKlass* _super_klass;
ConstantPool* _cp;
Array<u2>* _fields;
Array<Method*>* _methods;
Array<u2>* _inner_classes;
Array<u2>* _nest_members;
u2 _nest_host;
Array<u2>* _permitted_subclasses;
Array<RecordComponent*>* _record_components;
Array<InstanceKlass*>* _local_interfaces;
Array<InstanceKlass*>* _transitive_interfaces;
Annotations* _combined_annotations;
AnnotationArray* _class_annotations;
AnnotationArray* _class_type_annotations;
Array<AnnotationArray*>* _fields_annotations;
Array<AnnotationArray*>* _fields_type_annotations;
InstanceKlass* _klass; // InstanceKlass* once created.
InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
// for tracing and notifications
Publicity _pub_level;
// Used to keep track of whether a constant pool item 19 or 20 is found. These // correspond to CONSTANT_Module and CONSTANT_Package tags and are not allowed // in regular class files. For class file version >= 53, a CFE cannot be thrown // immediately when these are seen because a NCDFE must be thrown if the class's // access_flags have ACC_MODULE set. But, the access_flags haven't been looked // at yet. So, the bad constant pool item is cached here. A value of zero // means that no constant pool item 19 or 20 was found. short _bad_constant_seen;
// class attributes parsed before the instance klass is created: bool _synthetic_flag; int _sde_length; constchar* _sde_buffer;
u2 _sourcefile_index;
u2 _generic_signature_index;
u2 _major_version;
u2 _minor_version;
u2 _this_class_index;
u2 _super_class_index;
u2 _itfs_len;
u2 _java_fields_count;
// Wrapper for constantTag.is_klass_[or_]reference. // In older versions of the VM, Klass*s cannot sneak into early phases of // constant pool construction, but in later versions they can. // %%% Let's phase out the old is_klass_reference. bool valid_klass_reference_at(int index) const { return _cp->is_within_bounds(index) &&
_cp->tag_at(index).is_klass_or_reference();
}
// Checks that the cpool index is in range and is a utf8 bool valid_symbol_at(int cpool_index) const { return _cp->is_within_bounds(cpool_index) &&
_cp->tag_at(cpool_index).is_utf8();
}
void copy_localvariable_table(const ConstMethod* cm, int lvt_cnt,
u2* const localvariable_table_length, const unsafe_u2** const localvariable_table_start, int lvtt_cnt,
u2* const localvariable_type_table_length, const unsafe_u2** const localvariable_type_table_start,
TRAPS);
void copy_method_annotations(ConstMethod* cm, const u1* runtime_visible_annotations, int runtime_visible_annotations_length, const u1* runtime_invisible_annotations, int runtime_invisible_annotations_length, const u1* runtime_visible_parameter_annotations, int runtime_visible_parameter_annotations_length, const u1* runtime_invisible_parameter_annotations, int runtime_invisible_parameter_annotations_length, const u1* runtime_visible_type_annotations, int runtime_visible_type_annotations_length, const u1* runtime_invisible_type_annotations, int runtime_invisible_type_annotations_length, const u1* annotation_default, int annotation_default_length,
TRAPS);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.