< prev index next >

src/hotspot/share/runtime/signature.hpp

Print this page
*** 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"
  #include "sanitizers/ub.hpp"
  
  

*** 560,14 ***
--- 561,67 ---
      return skip_whole_array_prefix();
    }
  
    // free-standing lookups (bring your own CL/PD pair)
    enum FailureMode { ReturnNull, NCDFError, CachedOrNull };
+ 
    Klass* as_klass(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
+   InlineKlass* as_inline_klass(InstanceKlass* holder);
    oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
  };
  
+ 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;
+   int _offset;
+   Symbol* _symbol;
+ 
+   SigEntry()
+     : _bt(T_ILLEGAL), _offset(-1), _symbol(NULL) {}
+ 
+   SigEntry(BasicType bt, int offset, Symbol* symbol)
+     : _bt(bt), _offset(offset), _symbol(symbol) {}
+ 
+   static int compare(SigEntry* e1, SigEntry* e2) {
+     if (e1->_offset != e2->_offset) {
+       return e1->_offset - e2->_offset;
+     }
+     assert((e1->_bt == T_LONG && (e2->_bt == T_LONG || e2->_bt == T_VOID)) ||
+            (e1->_bt == T_DOUBLE && (e2->_bt == T_DOUBLE || e2->_bt == T_VOID)) ||
+            e1->_bt == T_METADATA || e2->_bt == T_METADATA || e1->_bt == T_VOID || e2->_bt == T_VOID, "bad bt");
+     if (e1->_bt == e2->_bt) {
+       assert(e1->_bt == T_METADATA || e1->_bt == T_VOID, "only ones with duplicate offsets");
+       return 0;
+     }
+     if (e1->_bt == T_VOID ||
+         e2->_bt == T_METADATA) {
+       return 1;
+     }
+     if (e1->_bt == T_METADATA ||
+         e2->_bt == T_VOID) {
+       return -1;
+     }
+     ShouldNotReachHere();
+     return 0;
+   }
+   static void add_entry(GrowableArray<SigEntry>* sig, BasicType bt, Symbol* symbol, int offset = -1);
+   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);
+ };
+ 
+ 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;

*** 629,15 ***
        callback->do_type(type);
      }
    }
  }
  
!  #ifdef ASSERT
   class SignatureVerifier : public StackObj {
    public:
!     static bool is_valid_method_signature(Symbol* sig);
!     static bool is_valid_type_signature(Symbol* sig);
    private:
      static ssize_t is_valid_type(const char*, ssize_t);
  };
  #endif
  #endif // SHARE_RUNTIME_SIGNATURE_HPP
--- 683,15 ---
        callback->do_type(type);
      }
    }
  }
  
! #ifdef ASSERT
   class SignatureVerifier : public StackObj {
    public:
!     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 >