< prev index next >

src/hotspot/share/classfile/javaClasses.hpp

Print this page


  97   static int coder_offset;
  98 
  99   static bool initialized;
 100 
 101   static Handle basic_create(int length, bool byte_arr, TRAPS);
 102 
 103   static inline void set_coder(oop string, jbyte coder);
 104 
 105  public:
 106 
 107   // Coders
 108   enum Coder {
 109     CODER_LATIN1 =  0,
 110     CODER_UTF16  =  1
 111   };
 112 
 113   static void compute_offsets();
 114   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 115 
 116   // Instance creation
 117   static Handle create_from_unicode(jchar* unicode, int len, TRAPS);
 118   static oop    create_oop_from_unicode(jchar* unicode, int len, TRAPS);
 119   static Handle create_from_str(const char* utf8_str, TRAPS);
 120   static oop    create_oop_from_str(const char* utf8_str, TRAPS);
 121   static Handle create_from_symbol(Symbol* symbol, TRAPS);
 122   static Handle create_from_platform_dependent_str(const char* str, TRAPS);
 123   static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
 124 
 125   static void set_compact_strings(bool value);
 126 
 127   static int value_offset_in_bytes()  {
 128     assert(initialized && (value_offset > 0), "Must be initialized");
 129     return value_offset;
 130   }
 131   static int hash_offset_in_bytes()   {
 132     assert(initialized && (hash_offset > 0), "Must be initialized");
 133     return hash_offset;
 134   }
 135   static int coder_offset_in_bytes()   {
 136     assert(initialized && (coder_offset > 0), "Must be initialized");
 137     return coder_offset;
 138   }


 172   static unsigned int hash_code(const jchar* s, int len) {
 173     unsigned int h = 0;
 174     while (len-- > 0) {
 175       h = 31*h + (unsigned int) *s;
 176       s++;
 177     }
 178     return h;
 179   }
 180 
 181   static unsigned int hash_code(const jbyte* s, int len) {
 182     unsigned int h = 0;
 183     while (len-- > 0) {
 184       h = 31*h + (((unsigned int) *s) & 0xFF);
 185       s++;
 186     }
 187     return h;
 188   }
 189 
 190   static unsigned int hash_code(oop java_string);
 191 
 192   static bool equals(oop java_string, jchar* chars, int len);
 193   static bool equals(oop str1, oop str2);
 194 
 195   // Conversion between '.' and '/' formats
 196   static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
 197   static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); }
 198 
 199   // Conversion
 200   static Symbol* as_symbol(oop java_string, TRAPS);
 201   static Symbol* as_symbol_or_null(oop java_string);
 202 
 203   // Testers
 204   static bool is_instance(oop obj);
 205   static inline bool is_instance_inlined(oop obj);
 206 
 207   // Debugging
 208   static void print(oop java_string, outputStream* st);
 209   friend class JavaClasses;
 210   friend class StringTable;
 211 };
 212 




  97   static int coder_offset;
  98 
  99   static bool initialized;
 100 
 101   static Handle basic_create(int length, bool byte_arr, TRAPS);
 102 
 103   static inline void set_coder(oop string, jbyte coder);
 104 
 105  public:
 106 
 107   // Coders
 108   enum Coder {
 109     CODER_LATIN1 =  0,
 110     CODER_UTF16  =  1
 111   };
 112 
 113   static void compute_offsets();
 114   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 115 
 116   // Instance creation
 117   static Handle create_from_unicode(const jchar* unicode, int len, TRAPS);
 118   static oop    create_oop_from_unicode(const jchar* unicode, int len, TRAPS);
 119   static Handle create_from_str(const char* utf8_str, TRAPS);
 120   static oop    create_oop_from_str(const char* utf8_str, TRAPS);
 121   static Handle create_from_symbol(Symbol* symbol, TRAPS);
 122   static Handle create_from_platform_dependent_str(const char* str, TRAPS);
 123   static Handle char_converter(Handle java_string, jchar from_char, jchar to_char, TRAPS);
 124 
 125   static void set_compact_strings(bool value);
 126 
 127   static int value_offset_in_bytes()  {
 128     assert(initialized && (value_offset > 0), "Must be initialized");
 129     return value_offset;
 130   }
 131   static int hash_offset_in_bytes()   {
 132     assert(initialized && (hash_offset > 0), "Must be initialized");
 133     return hash_offset;
 134   }
 135   static int coder_offset_in_bytes()   {
 136     assert(initialized && (coder_offset > 0), "Must be initialized");
 137     return coder_offset;
 138   }


 172   static unsigned int hash_code(const jchar* s, int len) {
 173     unsigned int h = 0;
 174     while (len-- > 0) {
 175       h = 31*h + (unsigned int) *s;
 176       s++;
 177     }
 178     return h;
 179   }
 180 
 181   static unsigned int hash_code(const jbyte* s, int len) {
 182     unsigned int h = 0;
 183     while (len-- > 0) {
 184       h = 31*h + (((unsigned int) *s) & 0xFF);
 185       s++;
 186     }
 187     return h;
 188   }
 189 
 190   static unsigned int hash_code(oop java_string);
 191 
 192   static bool equals(oop java_string, const jchar* chars, int len);
 193   static bool equals(oop str1, oop str2);
 194 
 195   // Conversion between '.' and '/' formats
 196   static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
 197   static Handle internalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '.', '/', THREAD); }
 198 
 199   // Conversion
 200   static Symbol* as_symbol(oop java_string, TRAPS);
 201   static Symbol* as_symbol_or_null(oop java_string);
 202 
 203   // Testers
 204   static bool is_instance(oop obj);
 205   static inline bool is_instance_inlined(oop obj);
 206 
 207   // Debugging
 208   static void print(oop java_string, outputStream* st);
 209   friend class JavaClasses;
 210   friend class StringTable;
 211 };
 212 


< prev index next >