< prev index next >

src/hotspot/share/classfile/classFileParser.hpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

@@ -73,10 +73,12 @@
    OopMapBlocksBuilder* oop_map_blocks;
    int _instance_size;
    int _nonstatic_field_size;
    int _static_field_size;
    bool  _has_nonstatic_fields;
+   bool  _is_naturally_atomic;
+   bool _has_inline_fields;
  };
  
  // Parser for for .class files
  //
  // The bytes describing the class file structure is read from a Stream object

@@ -126,11 +128,13 @@
    Array<Method*>* _methods;
    Array<u2>* _inner_classes;
    Array<u2>* _nest_members;
    u2 _nest_host;
    Array<u2>* _permitted_subclasses;
+   Array<u2>* _preload_classes;
    Array<RecordComponent*>* _record_components;
+   GrowableArray<InstanceKlass*>* _temp_local_interfaces;
    Array<InstanceKlass*>* _local_interfaces;
    Array<InstanceKlass*>* _transitive_interfaces;
    Annotations* _combined_annotations;
    AnnotationArray* _class_annotations;
    AnnotationArray* _class_type_annotations;

@@ -140,10 +144,11 @@
    InstanceKlass* _klass_to_deallocate; // an InstanceKlass* to be destroyed
  
    ClassAnnotationCollector* _parsed_annotations;
    FieldAllocationCount* _fac;
    FieldLayoutInfo* _field_info;
+   Array<InlineKlass*>* _inline_type_field_klasses;
    const intArray* _method_ordering;
    GrowableArray<Method*>* _all_mirandas;
  
    enum { fixed_buffer_size = 128 };
    u_char _linenumbertable_buffer[fixed_buffer_size];

@@ -152,10 +157,14 @@
    int _vtable_size;
    int _itable_size;
  
    int _num_miranda_methods;
  
+   int _alignment;
+   int _first_field_offset;
+   int _exact_size_in_bytes;
+ 
    ReferenceType _rt;
    Handle _protection_domain;
    AccessFlags _access_flags;
  
    // for tracing and notifications

@@ -190,10 +199,18 @@
    bool _has_nonstatic_concrete_methods;
    bool _declares_nonstatic_concrete_methods;
    bool _has_final_method;
    bool _has_contended_fields;
  
+   bool _has_inline_type_fields;
+   bool _has_nonstatic_fields;
+   bool _is_empty_inline_type;
+   bool _is_naturally_atomic;
+   bool _is_declared_atomic;
+   bool _invalid_inline_super;   // if true, invalid super type for an inline type.
+   bool _invalid_identity_super; // if true, invalid super type for an identity type.
+ 
    // precomputed flags
    bool _has_finalizer;
    bool _has_empty_finalizer;
    bool _has_vanilla_constructor;
    int _max_bootstrap_specifier_index;  // detects BSS values

@@ -237,10 +254,11 @@
    // Interface parsing
    void parse_interfaces(const ClassFileStream* const stream,
                          const int itfs_len,
                          ConstantPool* const cp,
                          bool* has_nonstatic_concrete_methods,
+                         bool* is_declared_atomic,
                          TRAPS);
  
    const InstanceKlass* parse_super_class(ConstantPool* const cp,
                                           const int super_class_index,
                                           const bool need_verify,

@@ -257,25 +275,31 @@
                                FieldAnnotationCollector* parsed_annotations,
                                TRAPS);
  
    void parse_fields(const ClassFileStream* const cfs,
                      bool is_interface,
+                     bool is_inline_type,
+                     bool is_permits_value_class,
                      FieldAllocationCount* const fac,
                      ConstantPool* cp,
                      const int cp_size,
                      u2* const java_fields_count_ptr,
                      TRAPS);
  
    // Method parsing
    Method* parse_method(const ClassFileStream* const cfs,
                         bool is_interface,
+                        bool is_inline_type,
+                        bool is_abstract_type,
                         const ConstantPool* cp,
                         AccessFlags* const promoted_flags,
                         TRAPS);
  
    void parse_methods(const ClassFileStream* const cfs,
                       bool is_interface,
+                      bool is_inline_type,
+                      bool is_abstract_type,
                       AccessFlags* const promoted_flags,
                       bool* const has_final_method,
                       bool* const declares_nonstatic_concrete_methods,
                       TRAPS);
  

@@ -326,10 +350,14 @@
  
    u2 parse_classfile_permitted_subclasses_attribute(const ClassFileStream* const cfs,
                                                      const u1* const permitted_subclasses_attribute_start,
                                                      TRAPS);
  
+   u2 parse_classfile_preload_attribute(const ClassFileStream* const cfs,
+                                                     const u1* const preload_attribute_start,
+                                                     TRAPS);
+ 
    u2 parse_classfile_record_attribute(const ClassFileStream* const cfs,
                                        const ConstantPool* cp,
                                        const u1* const record_attribute_start,
                                        TRAPS);
  

@@ -444,10 +472,15 @@
    void throwIllegalSignature(const char* type,
                               const Symbol* name,
                               const Symbol* sig,
                               TRAPS) const;
  
+   void throwInlineTypeLimitation(THREAD_AND_LOCATION_DECL,
+                                  const char* msg,
+                                  const Symbol* name = NULL,
+                                  const Symbol* sig  = NULL) const;
+ 
    void verify_constantvalue(const ConstantPool* const cp,
                              int constantvalue_index,
                              int signature_index,
                              TRAPS) const;
  

@@ -467,13 +500,19 @@
                                          TRAPS) const;
  
    void verify_class_version(u2 major, u2 minor, Symbol* class_name, TRAPS);
  
    void verify_legal_class_modifiers(jint flags, TRAPS) const;
-   void verify_legal_field_modifiers(jint flags, bool is_interface, TRAPS) const;
+   void verify_legal_field_modifiers(jint flags,
+                                     bool is_interface,
+                                     bool is_inline_type,
+                                     bool is_permits_value_class,
+                                     TRAPS) const;
    void verify_legal_method_modifiers(jint flags,
                                       bool is_interface,
+                                      bool is_inline_type,
+                                      bool is_abstract_type,
                                       const Symbol* name,
                                       TRAPS) const;
  
    void check_super_class_access(const InstanceKlass* this_klass,
                                  TRAPS);

@@ -527,10 +566,13 @@
                                 int annotation_default_length,
                                 TRAPS);
  
    void update_class_name(Symbol* new_name);
  
+   // Check if the class file supports inline types
+   bool supports_inline_types() const;
+ 
   public:
    ClassFileParser(ClassFileStream* stream,
                    Symbol* name,
                    ClassLoaderData* loader_data,
                    const ClassLoadInfo* cl_info,

@@ -554,10 +596,23 @@
  
    u2 this_class_index() const { return _this_class_index; }
  
    bool is_hidden() const { return _is_hidden; }
    bool is_interface() const { return _access_flags.is_interface(); }
+   bool is_inline_type() const { return _access_flags.is_value_class(); }
+   bool is_abstract_type() const { return _access_flags.is_abstract(); }
+   bool is_permits_value_class() const { return _access_flags.is_permits_value_class(); }
+   bool is_identity_class() const { return _access_flags.is_identity_class(); }
+   bool is_value_capable_class() const;
+   bool has_inline_fields() const { return _has_inline_type_fields; }
+   bool invalid_inline_super() const { return _invalid_inline_super; }
+   void set_invalid_inline_super() { _invalid_inline_super = true; }
+   bool invalid_identity_super() const { return _invalid_identity_super; }
+   void set_invalid_identity_super() { _invalid_identity_super = true; }
+   bool is_invalid_super_for_inline_type();
+ 
+   u2 java_fields_count() const { return _java_fields_count; }
  
    ClassLoaderData* loader_data() const { return _loader_data; }
    const Symbol* class_name() const { return _class_name; }
    const InstanceKlass* super_klass() const { return _super_klass; }
  
< prev index next >