annotate src/share/vm/classfile/classFileParser.hpp @ 4431:16885e702c88

7198429: need checked categorization of caller-sensitive methods in the JDK Reviewed-by: kvn, jrose
author twisti
date Mon, 25 Mar 2013 17:13:26 -0700
parents c8b31b461e1a
children 9befe2fce567
rev   line source
duke@0 1 /*
coleenp@4137 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
duke@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 *
duke@0 5 * This code is free software; you can redistribute it and/or modify it
duke@0 6 * under the terms of the GNU General Public License version 2 only, as
duke@0 7 * published by the Free Software Foundation.
duke@0 8 *
duke@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 * accompanied this code).
duke@0 14 *
duke@0 15 * You should have received a copy of the GNU General Public License version
duke@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 *
trims@1472 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 * or visit www.oracle.com if you need additional information or have any
trims@1472 21 * questions.
duke@0 22 *
duke@0 23 */
duke@0 24
stefank@1879 25 #ifndef SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
stefank@1879 26 #define SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP
stefank@1879 27
stefank@1879 28 #include "classfile/classFileStream.hpp"
stefank@1879 29 #include "memory/resourceArea.hpp"
stefank@1879 30 #include "oops/oop.inline.hpp"
stefank@1879 31 #include "oops/typeArrayOop.hpp"
stefank@1879 32 #include "runtime/handles.inline.hpp"
stefank@1879 33 #include "utilities/accessFlags.hpp"
jrose@3491 34 #include "classfile/symbolTable.hpp"
stefank@1879 35
never@2702 36 class FieldAllocationCount;
coleenp@4284 37 class FieldLayoutInfo;
never@2702 38
never@2702 39
duke@0 40 // Parser for for .class files
duke@0 41 //
duke@0 42 // The bytes describing the class file structure is read from a Stream object
duke@0 43
duke@0 44 class ClassFileParser VALUE_OBJ_CLASS_SPEC {
duke@0 45 private:
duke@0 46 bool _need_verify;
duke@0 47 bool _relax_verify;
duke@0 48 u2 _major_version;
duke@0 49 u2 _minor_version;
coleenp@2062 50 Symbol* _class_name;
coleenp@4284 51 ClassLoaderData* _loader_data;
jrose@710 52 KlassHandle _host_klass;
jrose@431 53 GrowableArray<Handle>* _cp_patches; // overrides for CP entries
duke@0 54
jrose@3491 55 // precomputed flags
duke@0 56 bool _has_finalizer;
duke@0 57 bool _has_empty_finalizer;
duke@0 58 bool _has_vanilla_constructor;
jrose@3491 59 int _max_bootstrap_specifier_index; // detects BSS values
duke@0 60
jrose@3491 61 // class attributes parsed before the instance klass is created:
jrose@3491 62 bool _synthetic_flag;
coleenp@4284 63 int _sde_length;
coleenp@4284 64 char* _sde_buffer;
jrose@3491 65 Symbol* _sourcefile;
jrose@3491 66 Symbol* _generic_signature;
coleenp@4284 67
coleenp@4284 68 // Metadata created before the instance klass is created. Must be deallocated
coleenp@4284 69 // if not transferred to the InstanceKlass upon successful class loading
coleenp@4284 70 // in which case these pointers have been set to NULL.
coleenp@4284 71 instanceKlassHandle _super_klass;
coleenp@4284 72 ConstantPool* _cp;
coleenp@4284 73 Array<u2>* _fields;
coleenp@4284 74 Array<Method*>* _methods;
coleenp@4284 75 Array<u2>* _inner_classes;
coleenp@4284 76 Array<Klass*>* _local_interfaces;
coleenp@4284 77 Array<Klass*>* _transitive_interfaces;
coleenp@3602 78 AnnotationArray* _annotations;
stefank@3958 79 AnnotationArray* _type_annotations;
coleenp@4284 80 Array<AnnotationArray*>* _fields_annotations;
coleenp@4284 81 Array<AnnotationArray*>* _fields_type_annotations;
coleenp@4284 82 InstanceKlass* _klass; // InstanceKlass once created.
jrose@3491 83
jrose@3491 84 void set_class_synthetic_flag(bool x) { _synthetic_flag = x; }
jrose@3491 85 void set_class_sourcefile(Symbol* x) { _sourcefile = x; }
jrose@3491 86 void set_class_generic_signature(Symbol* x) { _generic_signature = x; }
kvn@3495 87 void set_class_sde_buffer(char* x, int len) { _sde_buffer = x; _sde_length = len; }
coleenp@4284 88
coleenp@4284 89 void init_parsed_class_attributes(ClassLoaderData* loader_data) {
coleenp@4284 90 _loader_data = loader_data;
jrose@3491 91 _synthetic_flag = false;
jrose@3491 92 _sourcefile = NULL;
jrose@3491 93 _generic_signature = NULL;
kvn@3495 94 _sde_buffer = NULL;
kvn@3495 95 _sde_length = 0;
jrose@3491 96 // initialize the other flags too:
jrose@3491 97 _has_finalizer = _has_empty_finalizer = _has_vanilla_constructor = false;
jrose@3491 98 _max_bootstrap_specifier_index = -1;
coleenp@4284 99 clear_class_metadata();
coleenp@4284 100 _klass = NULL;
jrose@3491 101 }
jrose@3491 102 void apply_parsed_class_attributes(instanceKlassHandle k); // update k
coleenp@4284 103 void apply_parsed_class_metadata(instanceKlassHandle k, int fields_count, TRAPS);
coleenp@4284 104 void clear_class_metadata() {
coleenp@4284 105 // metadata created before the instance klass is created. Must be
coleenp@4284 106 // deallocated if classfile parsing returns an error.
coleenp@4284 107 _cp = NULL;
coleenp@4284 108 _fields = NULL;
coleenp@4284 109 _methods = NULL;
coleenp@4284 110 _inner_classes = NULL;
coleenp@4284 111 _local_interfaces = NULL;
coleenp@4284 112 _transitive_interfaces = NULL;
coleenp@4284 113 _annotations = _type_annotations = NULL;
coleenp@4284 114 _fields_annotations = _fields_type_annotations = NULL;
coleenp@4284 115 }
jrose@3491 116
jrose@3491 117 class AnnotationCollector {
jrose@3491 118 public:
jrose@3491 119 enum Location { _in_field, _in_method, _in_class };
jrose@3491 120 enum ID {
jrose@3491 121 _unknown = 0,
twisti@4431 122 _method_CallerSensitive,
jrose@3491 123 _method_ForceInline,
twisti@3534 124 _method_DontInline,
twisti@3534 125 _method_LambdaForm_Compiled,
twisti@3534 126 _method_LambdaForm_Hidden,
jwilhelm@3995 127 _sun_misc_Contended,
jrose@3491 128 _annotation_LIMIT
jrose@3491 129 };
jrose@3491 130 const Location _location;
jrose@3491 131 int _annotations_present;
jwilhelm@3995 132 u2 _contended_group;
jwilhelm@3995 133
jrose@3491 134 AnnotationCollector(Location location)
jrose@3491 135 : _location(location), _annotations_present(0)
jrose@3491 136 {
jrose@3491 137 assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, "");
jrose@3491 138 }
jrose@3491 139 // If this annotation name has an ID, report it (or _none).
jwilhelm@3995 140 ID annotation_index(ClassLoaderData* loader_data, Symbol* name);
jrose@3491 141 // Set the annotation name:
jrose@3491 142 void set_annotation(ID id) {
jrose@3491 143 assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob");
jrose@3491 144 _annotations_present |= nth_bit((int)id);
jrose@3491 145 }
jrose@3491 146 // Report if the annotation is present.
jrose@3491 147 bool has_any_annotations() { return _annotations_present != 0; }
jrose@3491 148 bool has_annotation(ID id) { return (nth_bit((int)id) & _annotations_present) != 0; }
jwilhelm@3995 149
jwilhelm@3995 150 void set_contended_group(u2 group) { _contended_group = group; }
jwilhelm@3995 151 u2 contended_group() { return _contended_group; }
jwilhelm@3995 152
jwilhelm@3995 153 void set_contended(bool contended) { set_annotation(_sun_misc_Contended); }
jwilhelm@3995 154 bool is_contended() { return has_annotation(_sun_misc_Contended); }
jrose@3491 155 };
coleenp@4284 156
coleenp@4284 157 // This class also doubles as a holder for metadata cleanup.
jrose@3491 158 class FieldAnnotationCollector: public AnnotationCollector {
coleenp@4284 159 ClassLoaderData* _loader_data;
coleenp@4284 160 AnnotationArray* _field_annotations;
coleenp@4284 161 AnnotationArray* _field_type_annotations;
jrose@3491 162 public:
coleenp@4284 163 FieldAnnotationCollector(ClassLoaderData* loader_data) :
coleenp@4284 164 AnnotationCollector(_in_field),
coleenp@4284 165 _loader_data(loader_data),
coleenp@4284 166 _field_annotations(NULL),
coleenp@4284 167 _field_type_annotations(NULL) {}
jrose@3491 168 void apply_to(FieldInfo* f);
coleenp@4284 169 ~FieldAnnotationCollector();
coleenp@4284 170 AnnotationArray* field_annotations() { return _field_annotations; }
coleenp@4284 171 AnnotationArray* field_type_annotations() { return _field_type_annotations; }
coleenp@4284 172
coleenp@4284 173 void set_field_annotations(AnnotationArray* a) { _field_annotations = a; }
coleenp@4284 174 void set_field_type_annotations(AnnotationArray* a) { _field_type_annotations = a; }
jrose@3491 175 };
coleenp@4284 176
jrose@3491 177 class MethodAnnotationCollector: public AnnotationCollector {
jrose@3491 178 public:
jrose@3491 179 MethodAnnotationCollector() : AnnotationCollector(_in_method) { }
jrose@3491 180 void apply_to(methodHandle m);
jrose@3491 181 };
jrose@3491 182 class ClassAnnotationCollector: public AnnotationCollector {
jrose@3491 183 public:
jrose@3491 184 ClassAnnotationCollector() : AnnotationCollector(_in_class) { }
jrose@3491 185 void apply_to(instanceKlassHandle k);
jrose@3491 186 };
jrose@1918 187
duke@0 188 enum { fixed_buffer_size = 128 };
duke@0 189 u_char linenumbertable_buffer[fixed_buffer_size];
duke@0 190
duke@0 191 ClassFileStream* _stream; // Actual input stream
duke@0 192
duke@0 193 enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
duke@0 194
duke@0 195 // Accessors
duke@0 196 ClassFileStream* stream() { return _stream; }
duke@0 197 void set_stream(ClassFileStream* st) { _stream = st; }
duke@0 198
duke@0 199 // Constant pool parsing
coleenp@4284 200 void parse_constant_pool_entries(int length, TRAPS);
duke@0 201
coleenp@4284 202 constantPoolHandle parse_constant_pool(TRAPS);
duke@0 203
duke@0 204 // Interface parsing
coleenp@4284 205 Array<Klass*>* parse_interfaces(int length,
duke@0 206 Handle protection_domain,
coleenp@2062 207 Symbol* class_name,
kamg@3810 208 bool* has_default_methods,
duke@0 209 TRAPS);
coleenp@3602 210 void record_defined_class_dependencies(instanceKlassHandle defined_klass, TRAPS);
duke@0 211
coleenp@4284 212 instanceKlassHandle parse_super_class(int super_class_index, TRAPS);
duke@0 213 // Field parsing
coleenp@4284 214 void parse_field_attributes(u2 attributes_count,
duke@0 215 bool is_static, u2 signature_index,
duke@0 216 u2* constantvalue_index_addr,
duke@0 217 bool* is_synthetic_addr,
duke@0 218 u2* generic_signature_index_addr,
jrose@3491 219 FieldAnnotationCollector* parsed_annotations,
jrose@3491 220 TRAPS);
coleenp@4284 221 Array<u2>* parse_fields(Symbol* class_name,
coleenp@4284 222 bool is_interface,
coleenp@3707 223 FieldAllocationCount *fac,
coleenp@3707 224 u2* java_fields_count_ptr, TRAPS);
duke@0 225
jwilhelm@3995 226 void print_field_layout(Symbol* name,
jwilhelm@3995 227 Array<u2>* fields,
jwilhelm@3995 228 constantPoolHandle cp,
jwilhelm@3995 229 int instance_size,
jwilhelm@3995 230 int instance_fields_start,
jwilhelm@3995 231 int instance_fields_end,
jwilhelm@3995 232 int static_fields_end);
jwilhelm@3995 233
duke@0 234 // Method parsing
coleenp@4284 235 methodHandle parse_method(bool is_interface,
duke@0 236 AccessFlags* promoted_flags,
duke@0 237 TRAPS);
coleenp@4284 238 Array<Method*>* parse_methods(bool is_interface,
duke@0 239 AccessFlags* promoted_flags,
duke@0 240 bool* has_final_method,
kamg@3810 241 bool* has_default_method,
duke@0 242 TRAPS);
coleenp@4284 243 intArray* sort_methods(Array<Method*>* methods);
coleenp@4284 244
coleenp@4284 245 u2* parse_exception_table(u4 code_length, u4 exception_table_length,
coleenp@4284 246 TRAPS);
duke@0 247 void parse_linenumber_table(
duke@0 248 u4 code_attribute_length, u4 code_length,
duke@0 249 CompressedLineNumberWriteStream** write_stream, TRAPS);
duke@0 250 u2* parse_localvariable_table(u4 code_length, u2 max_locals, u4 code_attribute_length,
coleenp@4284 251 u2* localvariable_table_length,
duke@0 252 bool isLVTT, TRAPS);
duke@0 253 u2* parse_checked_exceptions(u2* checked_exceptions_length, u4 method_attribute_length,
coleenp@4284 254 TRAPS);
duke@0 255 void parse_type_array(u2 array_length, u4 code_length, u4* u1_index, u4* u2_index,
coleenp@4284 256 u1* u1_array, u2* u2_array, TRAPS);
coleenp@4284 257 u1* parse_stackmap_table(u4 code_attribute_length, TRAPS);
duke@0 258
duke@0 259 // Classfile attribute parsing
coleenp@4284 260 void parse_classfile_sourcefile_attribute(TRAPS);
coleenp@4284 261 void parse_classfile_source_debug_extension_attribute(int length, TRAPS);
coleenp@4284 262 u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,
jiangli@3235 263 bool parsed_enclosingmethod_attribute,
jiangli@3235 264 u2 enclosing_method_class_index,
jiangli@3235 265 u2 enclosing_method_method_index,
jrose@3491 266 TRAPS);
coleenp@4284 267 void parse_classfile_attributes(ClassAnnotationCollector* parsed_annotations,
jrose@3491 268 TRAPS);
coleenp@4284 269 void parse_classfile_synthetic_attribute(TRAPS);
coleenp@4284 270 void parse_classfile_signature_attribute(TRAPS);
coleenp@4284 271 void parse_classfile_bootstrap_methods_attribute(u4 attribute_length, TRAPS);
duke@0 272
duke@0 273 // Annotations handling
coleenp@4284 274 AnnotationArray* assemble_annotations(u1* runtime_visible_annotations,
coleenp@3707 275 int runtime_visible_annotations_length,
coleenp@3707 276 u1* runtime_invisible_annotations,
coleenp@3707 277 int runtime_invisible_annotations_length, TRAPS);
jrose@3491 278 int skip_annotation(u1* buffer, int limit, int index);
jrose@3491 279 int skip_annotation_value(u1* buffer, int limit, int index);
coleenp@4284 280 void parse_annotations(u1* buffer, int limit,
jrose@3491 281 /* Results (currently, only one result is supported): */
jrose@3491 282 AnnotationCollector* result,
jrose@3491 283 TRAPS);
duke@0 284
duke@0 285 // Final setup
jcoomes@939 286 unsigned int compute_oop_map_count(instanceKlassHandle super,
jcoomes@939 287 unsigned int nonstatic_oop_count,
jcoomes@939 288 int first_nonstatic_oop_offset);
jcoomes@939 289 void fill_oop_maps(instanceKlassHandle k,
jcoomes@939 290 unsigned int nonstatic_oop_map_count,
jcoomes@939 291 int* nonstatic_oop_offsets,
jcoomes@939 292 unsigned int* nonstatic_oop_counts);
duke@0 293 void set_precomputed_flags(instanceKlassHandle k);
coleenp@4284 294 Array<Klass*>* compute_transitive_interfaces(instanceKlassHandle super,
coleenp@3707 295 Array<Klass*>* local_ifs, TRAPS);
duke@0 296
duke@0 297 // Format checker methods
duke@0 298 void classfile_parse_error(const char* msg, TRAPS);
duke@0 299 void classfile_parse_error(const char* msg, int index, TRAPS);
duke@0 300 void classfile_parse_error(const char* msg, const char *name, TRAPS);
duke@0 301 void classfile_parse_error(const char* msg, int index, const char *name, TRAPS);
duke@0 302 inline void guarantee_property(bool b, const char* msg, TRAPS) {
duke@0 303 if (!b) { classfile_parse_error(msg, CHECK); }
duke@0 304 }
duke@0 305
duke@0 306 inline void assert_property(bool b, const char* msg, TRAPS) {
duke@0 307 #ifdef ASSERT
duke@0 308 if (!b) { fatal(msg); }
duke@0 309 #endif
duke@0 310 }
duke@0 311
duke@0 312 inline void check_property(bool property, const char* msg, int index, TRAPS) {
duke@0 313 if (_need_verify) {
duke@0 314 guarantee_property(property, msg, index, CHECK);
duke@0 315 } else {
duke@0 316 assert_property(property, msg, CHECK);
duke@0 317 }
duke@0 318 }
duke@0 319
duke@0 320 inline void check_property(bool property, const char* msg, TRAPS) {
duke@0 321 if (_need_verify) {
duke@0 322 guarantee_property(property, msg, CHECK);
duke@0 323 } else {
duke@0 324 assert_property(property, msg, CHECK);
duke@0 325 }
duke@0 326 }
duke@0 327
duke@0 328 inline void guarantee_property(bool b, const char* msg, int index, TRAPS) {
duke@0 329 if (!b) { classfile_parse_error(msg, index, CHECK); }
duke@0 330 }
duke@0 331 inline void guarantee_property(bool b, const char* msg, const char *name, TRAPS) {
duke@0 332 if (!b) { classfile_parse_error(msg, name, CHECK); }
duke@0 333 }
duke@0 334 inline void guarantee_property(bool b, const char* msg, int index, const char *name, TRAPS) {
duke@0 335 if (!b) { classfile_parse_error(msg, index, name, CHECK); }
duke@0 336 }
duke@0 337
kamg@1506 338 void throwIllegalSignature(
coleenp@2062 339 const char* type, Symbol* name, Symbol* sig, TRAPS);
kamg@1506 340
duke@0 341 bool is_supported_version(u2 major, u2 minor);
duke@0 342 bool has_illegal_visibility(jint flags);
duke@0 343
coleenp@4284 344 void verify_constantvalue(int constantvalue_index, int signature_index, TRAPS);
duke@0 345 void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS);
coleenp@2062 346 void verify_legal_class_name(Symbol* name, TRAPS);
coleenp@2062 347 void verify_legal_field_name(Symbol* name, TRAPS);
coleenp@2062 348 void verify_legal_method_name(Symbol* name, TRAPS);
coleenp@2062 349 void verify_legal_field_signature(Symbol* fieldname, Symbol* signature, TRAPS);
coleenp@2062 350 int verify_legal_method_signature(Symbol* methodname, Symbol* signature, TRAPS);
duke@0 351 void verify_legal_class_modifiers(jint flags, TRAPS);
duke@0 352 void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS);
coleenp@2062 353 void verify_legal_method_modifiers(jint flags, bool is_interface, Symbol* name, TRAPS);
duke@0 354 bool verify_unqualified_name(char* name, unsigned int length, int type);
duke@0 355 char* skip_over_field_name(char* name, bool slash_ok, unsigned int length);
duke@0 356 char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
duke@0 357
jrose@710 358 bool is_anonymous() {
twisti@2263 359 assert(EnableInvokeDynamic || _host_klass.is_null(), "");
jrose@710 360 return _host_klass.not_null();
jrose@710 361 }
jrose@431 362 bool has_cp_patch_at(int index) {
twisti@2263 363 assert(EnableInvokeDynamic, "");
jrose@431 364 assert(index >= 0, "oob");
jrose@431 365 return (_cp_patches != NULL
jrose@431 366 && index < _cp_patches->length()
jrose@431 367 && _cp_patches->adr_at(index)->not_null());
jrose@431 368 }
jrose@431 369 Handle cp_patch_at(int index) {
jrose@431 370 assert(has_cp_patch_at(index), "oob");
jrose@431 371 return _cp_patches->at(index);
jrose@431 372 }
jrose@431 373 Handle clear_cp_patch_at(int index) {
jrose@431 374 Handle patch = cp_patch_at(index);
jrose@431 375 _cp_patches->at_put(index, Handle());
jrose@431 376 assert(!has_cp_patch_at(index), "");
jrose@431 377 return patch;
jrose@431 378 }
jrose@431 379 void patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS);
jrose@431 380
jrose@431 381 // Wrapper for constantTag.is_klass_[or_]reference.
coleenp@3602 382 // In older versions of the VM, Klass*s cannot sneak into early phases of
jrose@431 383 // constant pool construction, but in later versions they can.
jrose@431 384 // %%% Let's phase out the old is_klass_reference.
coleenp@4284 385 bool valid_klass_reference_at(int index) {
coleenp@4284 386 return _cp->is_within_bounds(index) &&
coleenp@4284 387 (EnableInvokeDynamic
coleenp@4284 388 ? _cp->tag_at(index).is_klass_or_reference()
coleenp@4284 389 : _cp->tag_at(index).is_klass_reference());
coleenp@4284 390 }
coleenp@4284 391
coleenp@4284 392 // Checks that the cpool index is in range and is a utf8
coleenp@4284 393 bool valid_symbol_at(int cpool_index) {
coleenp@4284 394 return (_cp->is_within_bounds(cpool_index) &&
coleenp@4284 395 _cp->tag_at(cpool_index).is_utf8());
jrose@431 396 }
jrose@431 397
coleenp@4137 398 void copy_localvariable_table(ConstMethod* cm, int lvt_cnt,
coleenp@4137 399 u2* localvariable_table_length,
coleenp@4137 400 u2** localvariable_table_start,
coleenp@4137 401 int lvtt_cnt,
coleenp@4137 402 u2* localvariable_type_table_length,
coleenp@4137 403 u2** localvariable_type_table_start,
coleenp@4137 404 TRAPS);
coleenp@4137 405
coleenp@4284 406 void copy_method_annotations(ConstMethod* cm,
coleenp@4137 407 u1* runtime_visible_annotations,
coleenp@4137 408 int runtime_visible_annotations_length,
coleenp@4137 409 u1* runtime_invisible_annotations,
coleenp@4137 410 int runtime_invisible_annotations_length,
coleenp@4137 411 u1* runtime_visible_parameter_annotations,
coleenp@4137 412 int runtime_visible_parameter_annotations_length,
coleenp@4137 413 u1* runtime_invisible_parameter_annotations,
coleenp@4137 414 int runtime_invisible_parameter_annotations_length,
coleenp@4137 415 u1* runtime_visible_type_annotations,
coleenp@4137 416 int runtime_visible_type_annotations_length,
coleenp@4137 417 u1* runtime_invisible_type_annotations,
coleenp@4137 418 int runtime_invisible_type_annotations_length,
coleenp@4137 419 u1* annotation_default,
coleenp@4137 420 int annotation_default_length,
coleenp@4137 421 TRAPS);
coleenp@4137 422
coleenp@4284 423 // lays out fields in class and returns the total oopmap count
coleenp@4284 424 void layout_fields(Handle class_loader, FieldAllocationCount* fac,
coleenp@4284 425 ClassAnnotationCollector* parsed_annotations,
coleenp@4284 426 FieldLayoutInfo* info, TRAPS);
coleenp@4284 427
duke@0 428 public:
duke@0 429 // Constructor
duke@0 430 ClassFileParser(ClassFileStream* st) { set_stream(st); }
coleenp@4284 431 ~ClassFileParser();
duke@0 432
coleenp@3602 433 // Parse .class file and return new Klass*. The Klass* is not hooked up
duke@0 434 // to the system dictionary or any other structures, so a .class file can
duke@0 435 // be loaded several times if desired.
duke@0 436 // The system dictionary hookup is done by the caller.
duke@0 437 //
duke@0 438 // "parsed_name" is updated by this method, and is the name found
duke@0 439 // while parsing the stream.
coleenp@2062 440 instanceKlassHandle parseClassFile(Symbol* name,
coleenp@3869 441 ClassLoaderData* loader_data,
duke@0 442 Handle protection_domain,
coleenp@2062 443 TempNewSymbol& parsed_name,
acorn@973 444 bool verify,
jrose@431 445 TRAPS) {
jrose@710 446 KlassHandle no_host_klass;
coleenp@3869 447 return parseClassFile(name, loader_data, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD);
jrose@431 448 }
coleenp@2062 449 instanceKlassHandle parseClassFile(Symbol* name,
coleenp@3869 450 ClassLoaderData* loader_data,
jrose@431 451 Handle protection_domain,
jrose@710 452 KlassHandle host_klass,
jrose@431 453 GrowableArray<Handle>* cp_patches,
coleenp@2062 454 TempNewSymbol& parsed_name,
acorn@973 455 bool verify,
duke@0 456 TRAPS);
duke@0 457
duke@0 458 // Verifier checks
duke@0 459 static void check_super_class_access(instanceKlassHandle this_klass, TRAPS);
duke@0 460 static void check_super_interface_access(instanceKlassHandle this_klass, TRAPS);
duke@0 461 static void check_final_method_override(instanceKlassHandle this_klass, TRAPS);
duke@0 462 static void check_illegal_static_method(instanceKlassHandle this_klass, TRAPS);
duke@0 463 };
stefank@1879 464
stefank@1879 465 #endif // SHARE_VM_CLASSFILE_CLASSFILEPARSER_HPP