< prev index next >

src/hotspot/share/runtime/signature.hpp

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
   * Copyright (c) 2021, Azul Systems, Inc. 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

@@ -24,10 +24,11 @@
   */
  
  #ifndef SHARE_RUNTIME_SIGNATURE_HPP
  #define SHARE_RUNTIME_SIGNATURE_HPP
  
+ #include "classfile/symbolTable.hpp"
  #include "memory/allocation.hpp"
  #include "oops/method.hpp"
  
  // Static routines and parsing loops for processing field and method
  // descriptors.  In the HotSpot sources we call them "signatures".

@@ -561,13 +562,49 @@
    }
  
    // free-standing lookups (bring your own CL/PD pair)
    enum FailureMode { ReturnNull, NCDFError, CachedOrNull };
    Klass* as_klass(Handle class_loader, FailureMode failure_mode, TRAPS);
+   InlineKlass* as_inline_klass(InstanceKlass* holder);
    oop as_java_mirror(Handle class_loader, FailureMode failure_mode, TRAPS);
  };
  
+ class SigEntry;
+ class SigEntryFilter;
+ typedef GrowableArrayFilterIterator<SigEntry, SigEntryFilter> ExtendedSignature;
+ 
+ // Used for adapter generation. One SigEntry is used per element of
+ // the signature of the method. Inline type arguments are treated
+ // specially. See comment for InlineKlass::collect_fields().
+ class SigEntry {
+  public:
+   BasicType _bt;      // Basic type of the argument
+   int _offset;        // Offset of the field in its value class holder for scalarized arguments (-1 otherwise). Used for packing and unpacking.
+   Symbol* _name;      // Symbol for printing
+   bool _null_marker;  // Is it a null marker? For printing
+   bool _vt_oop;       // Is it a possibly null buffer
+ 
+   SigEntry()
+     : _bt(T_ILLEGAL), _offset(-1), _name(nullptr), _null_marker(false), _vt_oop(false) {}
+ 
+   SigEntry(BasicType bt, int offset, Symbol* name, bool null_marker, bool vt_oop)
+     : _bt(bt), _offset(offset), _name(name), _null_marker(null_marker), _vt_oop(vt_oop) {}
+ 
+   static void add_entry(GrowableArray<SigEntry>* sig, BasicType bt, Symbol* name = nullptr, int offset = -1, bool null_marker = false, bool vt_oop = false);
+   static void add_null_marker(GrowableArray<SigEntry>* sig, Symbol* name, int offset);
+   static bool skip_value_delimiters(const GrowableArray<SigEntry>* sig, int i);
+   static int fill_sig_bt(const GrowableArray<SigEntry>* sig, BasicType* sig_bt);
+   static TempNewSymbol create_symbol(const GrowableArray<SigEntry>* sig);
+ 
+   void print_on(outputStream* st) const;
+ };
+ 
+ class SigEntryFilter {
+ public:
+   bool operator()(const SigEntry& entry) { return entry._bt != T_METADATA && entry._bt != T_VOID; }
+ };
+ 
  // Specialized SignatureStream: used for invoking SystemDictionary to either find
  //                              or resolve the underlying type when iterating over a
  //                              Java descriptor (or parts of it).
  class ResolvingSignatureStream : public SignatureStream {
    Klass*       _load_origin;

@@ -626,15 +663,15 @@
        callback->do_type(type);
      }
    }
  }
  
-  #ifdef ASSERT
+ #ifdef ASSERT
   class SignatureVerifier : public StackObj {
    public:
-     static bool is_valid_method_signature(Symbol* sig);
-     static bool is_valid_type_signature(Symbol* sig);
+     static bool is_valid_method_signature(const Symbol* sig);
+     static bool is_valid_type_signature(const Symbol* sig);
    private:
      static ssize_t is_valid_type(const char*, ssize_t);
  };
  #endif
  #endif // SHARE_RUNTIME_SIGNATURE_HPP
< prev index next >