hotspot/src/share/vm/classfile/javaClasses.hpp
changeset 8885 eed0ba1d011b
parent 8725 8c1e3dd5fe1b
child 9321 c29711c6ae35
equal deleted inserted replaced
8883:5569135acca3 8885:eed0ba1d011b
   106   static char*  as_utf8_string(oop java_string);
   106   static char*  as_utf8_string(oop java_string);
   107   static char*  as_utf8_string(oop java_string, char* buf, int buflen);
   107   static char*  as_utf8_string(oop java_string, char* buf, int buflen);
   108   static char*  as_utf8_string(oop java_string, int start, int len);
   108   static char*  as_utf8_string(oop java_string, int start, int len);
   109   static char*  as_platform_dependent_str(Handle java_string, TRAPS);
   109   static char*  as_platform_dependent_str(Handle java_string, TRAPS);
   110   static jchar* as_unicode_string(oop java_string, int& length);
   110   static jchar* as_unicode_string(oop java_string, int& length);
       
   111 
       
   112   // Compute the hash value for a java.lang.String object which would
       
   113   // contain the characters passed in. This hash value is used for at
       
   114   // least two purposes.
       
   115   //
       
   116   // (a) As the hash value used by the StringTable for bucket selection
       
   117   //     and comparison (stored in the HashtableEntry structures).  This
       
   118   //     is used in the String.intern() method.
       
   119   //
       
   120   // (b) As the hash value used by the String object itself, in
       
   121   //     String.hashCode().  This value is normally calculate in Java code
       
   122   //     in the String.hashCode method(), but is precomputed for String
       
   123   //     objects in the shared archive file.
       
   124   //
       
   125   //     For this reason, THIS ALGORITHM MUST MATCH String.hashCode().
       
   126   static unsigned int hash_string(jchar* s, int len) {
       
   127     unsigned int h = 0;
       
   128     while (len-- > 0) {
       
   129       h = 31*h + (unsigned int) *s;
       
   130       s++;
       
   131     }
       
   132     return h;
       
   133   }
       
   134   static unsigned int hash_string(oop java_string);
   111 
   135 
   112   static bool equals(oop java_string, jchar* chars, int len);
   136   static bool equals(oop java_string, jchar* chars, int len);
   113 
   137 
   114   // Conversion between '.' and '/' formats
   138   // Conversion between '.' and '/' formats
   115   static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }
   139   static Handle externalize_classname(Handle java_string, TRAPS) { return char_converter(java_string, '/', '.', THREAD); }