src/hotspot/share/classfile/classFileParser.hpp
author coleenp
Thu, 10 Jan 2019 15:13:51 -0500
changeset 53244 9807daeb47c4
parent 51444 3e5d28e6de32
child 53705 757e9407bafc
permissions -rw-r--r--
8216167: Update include guards to reflect correct directories Summary: Use script and some manual fixup to fix directores names in include guards. Reviewed-by: lfoltan, eosterlund, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51444
diff changeset
     2
 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3821
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3821
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3821
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51444
diff changeset
    25
#ifndef SHARE_CLASSFILE_CLASSFILEPARSER_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51444
diff changeset
    26
#define SHARE_CLASSFILE_CLASSFILEPARSER_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    27
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    28
#include "memory/referenceType.hpp"
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49364
diff changeset
    29
#include "oops/annotations.hpp"
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
    30
#include "oops/constantPool.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    31
#include "oops/typeArrayOop.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    32
#include "utilities/accessFlags.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
    33
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    34
class Annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    35
template <typename T>
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    36
class Array;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    37
class ClassFileStream;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    38
class ClassLoaderData;
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
    39
class CompressedLineNumberWriteStream;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    40
class ConstMethod;
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
    41
class FieldInfo;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    42
template <typename T>
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    43
class GrowableArray;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    44
class InstanceKlass;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    45
class Symbol;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    46
class TempNewSymbol;
10546
e79347eebbc5 7086585: make Java field injection more flexible
never
parents: 8883
diff changeset
    47
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
// Parser for for .class files
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
// The bytes describing the class file structure is read from a Stream object
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
49364
601146c66cad 8173070: Remove ValueObj class for allocation subclassing for runtime code
coleenp
parents: 47216
diff changeset
    52
class ClassFileParser {
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    53
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    54
 class ClassAnnotationCollector;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    55
 class FieldAllocationCount;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    56
 class FieldAnnotationCollector;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    57
 class FieldLayoutInfo;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    58
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    59
 public:
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    60
  // The ClassFileParser has an associated "publicity" level
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    61
  // It is used to control which subsystems (if any)
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    62
  // will observe the parsing (logging, events, tracing).
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    63
  // Default level is "BROADCAST", which is equivalent to
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    64
  // a "public" parsing attempt.
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    65
  //
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    66
  // "INTERNAL" level should be entirely private to the
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    67
  // caller - this allows for internal reuse of ClassFileParser
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    68
  //
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    69
  enum Publicity {
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    70
    INTERNAL,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    71
    BROADCAST,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    72
    NOF_PUBLICITY_LEVELS
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    73
  };
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    74
42630
ae91fbc4b59f 8170987: Module system implementation refresh (12/2016)
alanb
parents: 41669
diff changeset
    75
  enum { LegalClass, LegalField, LegalMethod }; // used to verify unqualified names
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 34666
diff changeset
    76
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
 private:
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
    78
  // Potentially unaligned pointer to various 16-bit entries in the class file
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
    79
  typedef void unsafe_u2;
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
    80
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    81
  const ClassFileStream* _stream; // Actual input stream
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    82
  const Symbol* _requested_name;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    83
  Symbol* _class_name;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    84
  mutable ClassLoaderData* _loader_data;
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
    85
  const InstanceKlass* _unsafe_anonymous_host;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    86
  GrowableArray<Handle>* _cp_patches; // overrides for CP entries
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46352
diff changeset
    87
  int _num_patched_klasses;
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46352
diff changeset
    88
  int _max_num_patched_klasses;
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46352
diff changeset
    89
  int _orig_cp_size;
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46352
diff changeset
    90
  int _first_patched_klass_resolved_index;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    91
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    92
  // Metadata created before the instance klass is created.  Must be deallocated
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    93
  // if not transferred to the InstanceKlass upon successful class loading
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    94
  // in which case these pointers have been set to NULL.
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    95
  const InstanceKlass* _super_klass;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    96
  ConstantPool* _cp;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    97
  Array<u2>* _fields;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    98
  Array<Method*>* _methods;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
    99
  Array<u2>* _inner_classes;
50735
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   100
  Array<u2>* _nest_members;
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   101
  u2 _nest_host;
51329
9c68699bebe5 8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents: 50735
diff changeset
   102
  Array<InstanceKlass*>* _local_interfaces;
9c68699bebe5 8208999: Some use of Klass* should be replaced by InstanceKlass*
iklam
parents: 50735
diff changeset
   103
  Array<InstanceKlass*>* _transitive_interfaces;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   104
  Annotations* _combined_annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   105
  AnnotationArray* _annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   106
  AnnotationArray* _type_annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   107
  Array<AnnotationArray*>* _fields_annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   108
  Array<AnnotationArray*>* _fields_type_annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   109
  InstanceKlass* _klass;  // InstanceKlass* once created.
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   110
  InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   111
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   112
  ClassAnnotationCollector* _parsed_annotations;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   113
  FieldAllocationCount* _fac;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   114
  FieldLayoutInfo* _field_info;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   115
  const intArray* _method_ordering;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   116
  GrowableArray<Method*>* _all_mirandas;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   117
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   118
  enum { fixed_buffer_size = 128 };
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   119
  u_char _linenumbertable_buffer[fixed_buffer_size];
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   120
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   121
  // Size of Java vtable (in words)
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   122
  int _vtable_size;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   123
  int _itable_size;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   124
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   125
  int _num_miranda_methods;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   126
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   127
  ReferenceType _rt;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   128
  Handle _protection_domain;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   129
  AccessFlags _access_flags;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   130
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   131
  // for tracing and notifications
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   132
  Publicity _pub_level;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   133
44239
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   134
  // Used to keep track of whether a constant pool item 19 or 20 is found.  These
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   135
  // correspond to CONSTANT_Module and CONSTANT_Package tags and are not allowed
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   136
  // in regular class files.  For class file version >= 53, a CFE cannot be thrown
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   137
  // immediately when these are seen because a NCDFE must be thrown if the class's
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   138
  // access_flags have ACC_MODULE set.  But, the access_flags haven't been looked
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   139
  // at yet.  So, the bad constant pool item is cached here.  A value of zero
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   140
  // means that no constant pool item 19 or 20 was found.
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   141
  short _bad_constant_seen;
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   142
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   143
  // class attributes parsed before the instance klass is created:
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   144
  bool _synthetic_flag;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   145
  int _sde_length;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   146
  const char* _sde_buffer;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   147
  u2 _sourcefile_index;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   148
  u2 _generic_signature_index;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   149
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   150
  u2 _major_version;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   151
  u2 _minor_version;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   152
  u2 _this_class_index;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   153
  u2 _super_class_index;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   154
  u2 _itfs_len;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   155
  u2 _java_fields_count;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   156
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  bool _need_verify;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  bool _relax_verify;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   159
41669
2091069b6851 8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents: 40923
diff changeset
   160
  bool _has_nonstatic_concrete_methods;
2091069b6851 8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents: 40923
diff changeset
   161
  bool _declares_nonstatic_concrete_methods;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   162
  bool _has_final_method;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   164
  // precomputed flags
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  bool _has_finalizer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  bool _has_empty_finalizer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  bool _has_vanilla_constructor;
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   168
  int _max_bootstrap_specifier_index;  // detects BSS values
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   170
  void parse_stream(const ClassFileStream* const stream, TRAPS);
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   171
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   172
  void post_process_parsed_stream(const ClassFileStream* const stream,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   173
                                  ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   174
                                  TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   175
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
   176
  void prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host, TRAPS);
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
   177
  void fix_unsafe_anonymous_class_name(TRAPS);
40923
10fe1c28b9f6 8058575: IllegalAccessError trying to access package-private class from VM anonymous class
hseigel
parents: 40016
diff changeset
   178
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 34666
diff changeset
   179
  void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH, TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   180
  void set_klass(InstanceKlass* instance);
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   181
44239
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   182
  void set_class_bad_constant_seen(short bad_constant);
fdd97dc2367b 8175383: JVM should throw NCDFE if ACC_MODULE and CONSTANT_Module/Package are set
hseigel
parents: 42630
diff changeset
   183
  short class_bad_constant_seen() { return  _bad_constant_seen; }
19326
14cb6cf26a96 8021948: Change InstanceKlass::_source_file_name and _generic_signature from Symbol* to constant pool indexes.
jiangli
parents: 17073
diff changeset
   184
  void set_class_synthetic_flag(bool x)        { _synthetic_flag = x; }
14cb6cf26a96 8021948: Change InstanceKlass::_source_file_name and _generic_signature from Symbol* to constant pool indexes.
jiangli
parents: 17073
diff changeset
   185
  void set_class_sourcefile_index(u2 x)        { _sourcefile_index = x; }
14cb6cf26a96 8021948: Change InstanceKlass::_source_file_name and _generic_signature from Symbol* to constant pool indexes.
jiangli
parents: 17073
diff changeset
   186
  void set_class_generic_signature_index(u2 x) { _generic_signature_index = x; }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   187
  void set_class_sde_buffer(const char* x, int len)  { _sde_buffer = x; _sde_length = len; }
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   188
28027
c63d0bb0101c 8065634: Crash in InstanceKlass::clean_method_data when _method is NULL
stefank
parents: 27402
diff changeset
   189
  void create_combined_annotations(TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   190
  void apply_parsed_class_attributes(InstanceKlass* k);  // update k
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   191
  void apply_parsed_class_metadata(InstanceKlass* k, int fields_count, TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   192
  void clear_class_metadata();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  // Constant pool parsing
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   195
  void parse_constant_pool_entries(const ClassFileStream* const stream,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   196
                                   ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   197
                                   const int length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   198
                                   TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   200
  void parse_constant_pool(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   201
                           ConstantPool* const cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   202
                           const int length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   203
                           TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // Interface parsing
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   206
  void parse_interfaces(const ClassFileStream* const stream,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   207
                        const int itfs_len,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   208
                        ConstantPool* const cp,
41669
2091069b6851 8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents: 40923
diff changeset
   209
                        bool* has_nonstatic_concrete_methods,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   210
                        TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   212
  const InstanceKlass* parse_super_class(ConstantPool* const cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   213
                                         const int super_class_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   214
                                         const bool need_verify,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   215
                                         TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   216
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  // Field parsing
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   218
  void parse_field_attributes(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   219
                              u2 attributes_count,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   220
                              bool is_static,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   221
                              u2 signature_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   222
                              u2* const constantvalue_index_addr,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   223
                              bool* const is_synthetic_addr,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   224
                              u2* const generic_signature_index_addr,
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   225
                              FieldAnnotationCollector* parsed_annotations,
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   226
                              TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   228
  void parse_fields(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   229
                    bool is_interface,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   230
                    FieldAllocationCount* const fac,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   231
                    ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   232
                    const int cp_size,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   233
                    u2* const java_fields_count_ptr,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   234
                    TRAPS);
15193
8e6b5694267f 8003985: Support @Contended Annotation - JEP 142
jwilhelm
parents: 15097
diff changeset
   235
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  // Method parsing
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   237
  Method* parse_method(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   238
                       bool is_interface,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   239
                       const ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   240
                       AccessFlags* const promoted_flags,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   241
                       TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   242
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   243
  void parse_methods(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   244
                     bool is_interface,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   245
                     AccessFlags* const promoted_flags,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   246
                     bool* const has_final_method,
41669
2091069b6851 8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents: 40923
diff changeset
   247
                     bool* const declares_nonstatic_concrete_methods,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   248
                     TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   249
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   250
  const unsafe_u2* parse_exception_table(const ClassFileStream* const stream,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   251
                                         u4 code_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   252
                                         u4 exception_table_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   253
                                         TRAPS);
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   254
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   255
  void parse_linenumber_table(u4 code_attribute_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   256
                              u4 code_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   257
                              CompressedLineNumberWriteStream**const write_stream,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   258
                              TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   259
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   260
  const unsafe_u2* parse_localvariable_table(const ClassFileStream* const cfs,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   261
                                             u4 code_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   262
                                             u2 max_locals,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   263
                                             u4 code_attribute_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   264
                                             u2* const localvariable_table_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   265
                                             bool isLVTT,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   266
                                             TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   267
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   268
  const unsafe_u2* parse_checked_exceptions(const ClassFileStream* const cfs,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   269
                                            u2* const checked_exceptions_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   270
                                            u4 method_attribute_length,
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   271
                                            TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   272
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   273
  void parse_type_array(u2 array_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   274
                        u4 code_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   275
                        u4* const u1_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   276
                        u4* const u2_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   277
                        u1* const u1_array,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   278
                        u2* const u2_array,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   279
                        TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  // Classfile attribute parsing
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   282
  u2 parse_generic_signature_attribute(const ClassFileStream* const cfs, TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   283
  void parse_classfile_sourcefile_attribute(const ClassFileStream* const cfs, TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   284
  void parse_classfile_source_debug_extension_attribute(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   285
                                                        int length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   286
                                                        TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   287
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   288
  u2   parse_classfile_inner_classes_attribute(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   289
                                               const u1* const inner_classes_attribute_start,
12231
6a9cfc59a18a 7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents: 11412
diff changeset
   290
                                               bool parsed_enclosingmethod_attribute,
6a9cfc59a18a 7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents: 11412
diff changeset
   291
                                               u2 enclosing_method_class_index,
6a9cfc59a18a 7109878: The instanceKlass EnclosingMethhod attribute fields can be folded into the _inner_class field.
jiangli
parents: 11412
diff changeset
   292
                                               u2 enclosing_method_method_index,
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   293
                                               TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   294
50735
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   295
  u2 parse_classfile_nest_members_attribute(const ClassFileStream* const cfs,
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   296
                                            const u1* const nest_members_attribute_start,
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   297
                                            TRAPS);
2f2af62dfac7 8010319: Implementation of JEP 181: Nest-Based Access Control
dholmes
parents: 49480
diff changeset
   298
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   299
  void parse_classfile_attributes(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   300
                                  ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   301
                                  ClassAnnotationCollector* parsed_annotations,
13291
9de3b1387cb8 6711908: JVM needs direct access to some annotations
jrose
parents: 12267
diff changeset
   302
                                  TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   303
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   304
  void parse_classfile_synthetic_attribute(TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   305
  void parse_classfile_signature_attribute(const ClassFileStream* const cfs, TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   306
  void parse_classfile_bootstrap_methods_attribute(const ClassFileStream* const cfs,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   307
                                                   ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   308
                                                   u4 attribute_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   309
                                                   TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  // Annotations handling
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   312
  AnnotationArray* assemble_annotations(const u1* const runtime_visible_annotations,
13952
e3cf184080bc 8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents: 13728
diff changeset
   313
                                        int runtime_visible_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   314
                                        const u1* const runtime_invisible_annotations,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   315
                                        int runtime_invisible_annotations_length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   316
                                        TRAPS);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   318
  void set_precomputed_flags(InstanceKlass* k);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  // Format checker methods
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   321
  void classfile_parse_error(const char* msg, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   322
  void classfile_parse_error(const char* msg, int index, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   323
  void classfile_parse_error(const char* msg, const char *name, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   324
  void classfile_parse_error(const char* msg,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   325
                             int index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   326
                             const char *name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   327
                             TRAPS) const;
46301
57f01b1bd33c 8171194: Exception "Duplicate field name&signature in class file" should report the name and signature of the field
shshahma
parents: 42630
diff changeset
   328
  void classfile_parse_error(const char* msg,
57f01b1bd33c 8171194: Exception "Duplicate field name&signature in class file" should report the name and signature of the field
shshahma
parents: 42630
diff changeset
   329
                             const char* name,
57f01b1bd33c 8171194: Exception "Duplicate field name&signature in class file" should report the name and signature of the field
shshahma
parents: 42630
diff changeset
   330
                             const char* signature,
57f01b1bd33c 8171194: Exception "Duplicate field name&signature in class file" should report the name and signature of the field
shshahma
parents: 42630
diff changeset
   331
                             TRAPS) const;
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   332
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   333
  inline void guarantee_property(bool b, const char* msg, TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    if (!b) { classfile_parse_error(msg, CHECK); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   337
  void report_assert_property_failure(const char* msg, TRAPS) const PRODUCT_RETURN;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   338
  void report_assert_property_failure(const char* msg, int index, TRAPS) const PRODUCT_RETURN;
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
   339
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   340
  inline void assert_property(bool b, const char* msg, TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
#ifdef ASSERT
17073
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   342
    if (!b) {
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
   343
      report_assert_property_failure(msg, THREAD);
17073
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   344
    }
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   345
#endif
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   346
  }
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   347
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   348
  inline void assert_property(bool b, const char* msg, int index, TRAPS) const {
17073
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   349
#ifdef ASSERT
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   350
    if (!b) {
29201
fee2bbb2ec1d 8073389: Remove the include of resourceArea.hpp from classFileParser.hpp
stefank
parents: 29081
diff changeset
   351
      report_assert_property_failure(msg, index, THREAD);
17073
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   352
    }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   356
  inline void check_property(bool property,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   357
                             const char* msg,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   358
                             int index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   359
                             TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
    if (_need_verify) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
      guarantee_property(property, msg, index, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    } else {
17073
99baa410e207 8012695: Assertion message displays %u and %s text instead of actual values
hseigel
parents: 16692
diff changeset
   363
      assert_property(property, msg, index, CHECK);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   367
  inline void check_property(bool property, const char* msg, TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
    if (_need_verify) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
      guarantee_property(property, msg, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
      assert_property(property, msg, CHECK);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   375
  inline void guarantee_property(bool b,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   376
                                 const char* msg,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   377
                                 int index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   378
                                 TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    if (!b) { classfile_parse_error(msg, index, CHECK); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   381
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   382
  inline void guarantee_property(bool b,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   383
                                 const char* msg,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   384
                                 const char *name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   385
                                 TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    if (!b) { classfile_parse_error(msg, name, CHECK); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   388
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   389
  inline void guarantee_property(bool b,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   390
                                 const char* msg,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   391
                                 int index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   392
                                 const char *name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   393
                                 TRAPS) const {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    if (!b) { classfile_parse_error(msg, index, name, CHECK); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   397
  void throwIllegalSignature(const char* type,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   398
                             const Symbol* name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   399
                             const Symbol* sig,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   400
                             TRAPS) const;
5709
3b5307e27c1d 6930553: classfile format checker allows invalid method descriptor in CONSTANT_NameAndType_info in some cases
kamg
parents: 3821
diff changeset
   401
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   402
  void verify_constantvalue(const ConstantPool* const cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   403
                            int constantvalue_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   404
                            int signature_index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   405
                            TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   406
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   407
  void verify_legal_utf8(const unsigned char* buffer, int length, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   408
  void verify_legal_class_name(const Symbol* name, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   409
  void verify_legal_field_name(const Symbol* name, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   410
  void verify_legal_method_name(const Symbol* name, TRAPS) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   412
  void verify_legal_field_signature(const Symbol* fieldname,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   413
                                    const Symbol* signature,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   414
                                    TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   415
  int  verify_legal_method_signature(const Symbol* methodname,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   416
                                     const Symbol* signature,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   417
                                     TRAPS) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   419
  void verify_legal_class_modifiers(jint flags, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   420
  void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   421
  void verify_legal_method_modifiers(jint flags,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   422
                                     bool is_interface,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   423
                                     const Symbol* name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   424
                                     TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   425
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   426
  const char* skip_over_field_signature(const char* signature,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   427
                                        bool void_ok,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   428
                                        unsigned int length,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   429
                                        TRAPS) const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   430
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   431
  bool has_cp_patch_at(int index) const {
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   432
    assert(index >= 0, "oob");
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   433
    return (_cp_patches != NULL
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   434
            && index < _cp_patches->length()
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   435
            && _cp_patches->adr_at(index)->not_null());
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   436
  }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   437
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   438
  Handle cp_patch_at(int index) const {
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   439
    assert(has_cp_patch_at(index), "oob");
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   440
    return _cp_patches->at(index);
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   441
  }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   442
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49364
diff changeset
   443
  Handle clear_cp_patch_at(int index);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   444
46427
54713555867e 8171392: Move Klass pointers outside of ConstantPool entries so ConstantPool can be read-only
iklam
parents: 46352
diff changeset
   445
  void patch_class(ConstantPool* cp, int class_index, Klass* k, Symbol* name);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   446
  void patch_constant_pool(ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   447
                           int index,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   448
                           Handle patch,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   449
                           TRAPS);
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   450
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   451
  // Wrapper for constantTag.is_klass_[or_]reference.
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   452
  // In older versions of the VM, Klass*s cannot sneak into early phases of
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   453
  // constant pool construction, but in later versions they can.
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   454
  // %%% Let's phase out the old is_klass_reference.
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   455
  bool valid_klass_reference_at(int index) const {
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   456
    return _cp->is_within_bounds(index) &&
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   457
             _cp->tag_at(index).is_klass_or_reference();
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   458
  }
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   459
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   460
  // Checks that the cpool index is in range and is a utf8
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   461
  bool valid_symbol_at(int cpool_index) const {
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   462
    return _cp->is_within_bounds(cpool_index) &&
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   463
             _cp->tag_at(cpool_index).is_utf8();
1550
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   464
  }
be2fc37a817f 6653858: dynamic languages need to be able to load anonymous classes
jrose
parents: 1
diff changeset
   465
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   466
  void copy_localvariable_table(const ConstMethod* cm,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   467
                                int lvt_cnt,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   468
                                u2* const localvariable_table_length,
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   469
                                const unsafe_u2** const localvariable_table_start,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   470
                                int lvtt_cnt,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   471
                                u2* const localvariable_type_table_length,
46513
c61eea516a0a 8181377: Capture underlying type for unsafe/unaligned pointers in ClassFileParser
mikael
parents: 46504
diff changeset
   472
                                const unsafe_u2** const localvariable_type_table_start,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   473
                                TRAPS);
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   474
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   475
  void copy_method_annotations(ConstMethod* cm,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   476
                               const u1* runtime_visible_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   477
                               int runtime_visible_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   478
                               const u1* runtime_invisible_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   479
                               int runtime_invisible_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   480
                               const u1* runtime_visible_parameter_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   481
                               int runtime_visible_parameter_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   482
                               const u1* runtime_invisible_parameter_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   483
                               int runtime_invisible_parameter_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   484
                               const u1* runtime_visible_type_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   485
                               int runtime_visible_type_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   486
                               const u1* runtime_invisible_type_annotations,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   487
                               int runtime_invisible_type_annotations_length,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   488
                               const u1* annotation_default,
15601
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   489
                               int annotation_default_length,
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   490
                               TRAPS);
df8faef6efaf 8007320: NPG: move method annotations
coleenp
parents: 15193
diff changeset
   491
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   492
  // lays out fields in class and returns the total oopmap count
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   493
  void layout_fields(ConstantPool* cp,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   494
                     const FieldAllocationCount* fac,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   495
                     const ClassAnnotationCollector* parsed_annotations,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   496
                     FieldLayoutInfo* info,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   497
                     TRAPS);
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   498
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
 public:
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   500
  ClassFileParser(ClassFileStream* stream,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   501
                  Symbol* name,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   502
                  ClassLoaderData* loader_data,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   503
                  Handle protection_domain,
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
   504
                  const InstanceKlass* unsafe_anonymous_host,
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   505
                  GrowableArray<Handle>* cp_patches,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   506
                  Publicity pub_level,
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   507
                  TRAPS);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   508
15935
50da9e5eb858 8003419: NPG: Clean up metadata created during class loading if failure
coleenp
parents: 15601
diff changeset
   509
  ~ClassFileParser();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 34666
diff changeset
   511
  InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, TRAPS);
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   512
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   513
  const ClassFileStream* clone_stream() const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   514
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   515
  void set_klass_to_deallocate(InstanceKlass* klass);
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   516
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   517
  int static_field_size() const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   518
  int total_oop_map_count() const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   519
  jint layout_size() const;
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   520
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   521
  int vtable_size() const { return _vtable_size; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   522
  int itable_size() const { return _itable_size; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   524
  u2 this_class_index() const { return _this_class_index; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   525
  u2 super_class_index() const { return _super_class_index; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   526
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
   527
  bool is_unsafe_anonymous() const { return _unsafe_anonymous_host != NULL; }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   528
  bool is_interface() const { return _access_flags.is_interface(); }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   529
51444
3e5d28e6de32 8209301: JVM rename is_anonymous, host_klass to unsafe specific terminology ahead of Unsafe.defineAnonymousClass deprecation
lfoltan
parents: 51329
diff changeset
   530
  const InstanceKlass* unsafe_anonymous_host() const { return _unsafe_anonymous_host; }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   531
  const GrowableArray<Handle>* cp_patches() const { return _cp_patches; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   532
  ClassLoaderData* loader_data() const { return _loader_data; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   533
  const Symbol* class_name() const { return _class_name; }
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49364
diff changeset
   534
  const InstanceKlass* super_klass() const { return _super_klass; }
34666
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   535
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   536
  ReferenceType reference_type() const { return _rt; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   537
  AccessFlags access_flags() const { return _access_flags; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   538
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   539
  bool is_internal() const { return INTERNAL == _pub_level; }
1c7168ea0034 8140485: Class load and creation cleanup
mgronlun
parents: 34272
diff changeset
   540
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 34666
diff changeset
   541
  static bool verify_unqualified_name(const char* name, unsigned int length, int type);
40016
bf6fcd467a7b 8162340: Better class stream parsing
acorn
parents: 38031
diff changeset
   542
bf6fcd467a7b 8162340: Better class stream parsing
acorn
parents: 38031
diff changeset
   543
#ifdef ASSERT
bf6fcd467a7b 8162340: Better class stream parsing
acorn
parents: 38031
diff changeset
   544
  static bool is_internal_format(Symbol* class_name);
bf6fcd467a7b 8162340: Better class stream parsing
acorn
parents: 38031
diff changeset
   545
#endif
bf6fcd467a7b 8162340: Better class stream parsing
acorn
parents: 38031
diff changeset
   546
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 7114
diff changeset
   548
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 51444
diff changeset
   549
#endif // SHARE_CLASSFILE_CLASSFILEPARSER_HPP