Need reviewer for forward port of 6815768 (File.getXXXSpace) and 6815768 (String.hashCode)

Ulf Zibis Ulf.Zibis at gmx.de
Fri Feb 26 17:11:46 UTC 2010


Am 26.02.2010 17:10, schrieb Ulf Zibis:
> Additionally we can save double incrementing of int i and off:
>
> public int hashCode() {
>   int h = hash;
>   if (h == 0) {
>     int len = count;
>     if (len>  0) {
>       char[] val = value;
> //      for (int i = offset, len += i; i<  len; ) // would be nice 
> syntax ->  RFE to project coin
>       for (int i = offset, limit = len += i; i < len; i++)
>         h = 31*h + val[i];
>       hash = h;
>     }
>   }
>   return h;
> }
>

And in hotspot/src/share/vm/classfile/symbolTable.cpp :

int StringTable::hash_string(jchar* s, int len) {
   unsigned h = 0;
   for (len = s + len*sizeof(jchar); s < len; s++)
     h = 31*h + (unsigned) *s;
   return h;
}


-Ulf





More information about the core-libs-dev mailing list