1.1 --- a/src/share/vm/classfile/altHashing.cpp Wed Mar 05 11:28:33 2014 -0800 1.2 +++ b/src/share/vm/classfile/altHashing.cpp Mon Feb 10 21:29:14 2014 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -39,18 +39,18 @@ 1.11 } 1.12 1.13 // Seed value used for each alternative hash calculated. 1.14 -jint AltHashing::compute_seed() { 1.15 +juint AltHashing::compute_seed() { 1.16 jlong nanos = os::javaTimeNanos(); 1.17 jlong now = os::javaTimeMillis(); 1.18 - jint SEED_MATERIAL[8] = { 1.19 - (jint) object_hash(SystemDictionary::String_klass()), 1.20 - (jint) object_hash(SystemDictionary::System_klass()), 1.21 - (jint) os::random(), // current thread isn't a java thread 1.22 - (jint) (((julong)nanos) >> 32), 1.23 - (jint) nanos, 1.24 - (jint) (((julong)now) >> 32), 1.25 - (jint) now, 1.26 - (jint) (os::javaTimeNanos() >> 2) 1.27 + int SEED_MATERIAL[8] = { 1.28 + (int) object_hash(SystemDictionary::String_klass()), 1.29 + (int) object_hash(SystemDictionary::System_klass()), 1.30 + (int) os::random(), // current thread isn't a java thread 1.31 + (int) (((julong)nanos) >> 32), 1.32 + (int) nanos, 1.33 + (int) (((julong)now) >> 32), 1.34 + (int) now, 1.35 + (int) (os::javaTimeNanos() >> 2) 1.36 }; 1.37 1.38 return murmur3_32(SEED_MATERIAL, 8); 1.39 @@ -58,14 +58,14 @@ 1.40 1.41 1.42 // Murmur3 hashing for Symbol 1.43 -jint AltHashing::murmur3_32(jint seed, const jbyte* data, int len) { 1.44 - jint h1 = seed; 1.45 +juint AltHashing::murmur3_32(juint seed, const jbyte* data, int len) { 1.46 + juint h1 = seed; 1.47 int count = len; 1.48 int offset = 0; 1.49 1.50 // body 1.51 while (count >= 4) { 1.52 - jint k1 = (data[offset] & 0x0FF) 1.53 + juint k1 = (data[offset] & 0x0FF) 1.54 | (data[offset + 1] & 0x0FF) << 8 1.55 | (data[offset + 2] & 0x0FF) << 16 1.56 | data[offset + 3] << 24; 1.57 @@ -85,7 +85,7 @@ 1.58 // tail 1.59 1.60 if (count > 0) { 1.61 - jint k1 = 0; 1.62 + juint k1 = 0; 1.63 1.64 switch (count) { 1.65 case 3: 1.66 @@ -109,18 +109,18 @@ 1.67 h1 ^= len; 1.68 1.69 // finalization mix force all bits of a hash block to avalanche 1.70 - h1 ^= ((unsigned int)h1) >> 16; 1.71 + h1 ^= h1 >> 16; 1.72 h1 *= 0x85ebca6b; 1.73 - h1 ^= ((unsigned int)h1) >> 13; 1.74 + h1 ^= h1 >> 13; 1.75 h1 *= 0xc2b2ae35; 1.76 - h1 ^= ((unsigned int)h1) >> 16; 1.77 + h1 ^= h1 >> 16; 1.78 1.79 return h1; 1.80 } 1.81 1.82 // Murmur3 hashing for Strings 1.83 -jint AltHashing::murmur3_32(jint seed, const jchar* data, int len) { 1.84 - jint h1 = seed; 1.85 +juint AltHashing::murmur3_32(juint seed, const jchar* data, int len) { 1.86 + juint h1 = seed; 1.87 1.88 int off = 0; 1.89 int count = len; 1.90 @@ -129,7 +129,7 @@ 1.91 while (count >= 2) { 1.92 jchar d1 = data[off++] & 0xFFFF; 1.93 jchar d2 = data[off++]; 1.94 - jint k1 = (d1 | d2 << 16); 1.95 + juint k1 = (d1 | d2 << 16); 1.96 1.97 count -= 2; 1.98 1.99 @@ -145,7 +145,7 @@ 1.100 // tail 1.101 1.102 if (count > 0) { 1.103 - int k1 = data[off]; 1.104 + juint k1 = (juint)data[off]; 1.105 1.106 k1 *= 0xcc9e2d51; 1.107 k1 = Integer_rotateLeft(k1, 15); 1.108 @@ -157,25 +157,25 @@ 1.109 h1 ^= len * 2; // (Character.SIZE / Byte.SIZE); 1.110 1.111 // finalization mix force all bits of a hash block to avalanche 1.112 - h1 ^= ((unsigned int)h1) >> 16; 1.113 + h1 ^= h1 >> 16; 1.114 h1 *= 0x85ebca6b; 1.115 - h1 ^= ((unsigned int)h1) >> 13; 1.116 + h1 ^= h1 >> 13; 1.117 h1 *= 0xc2b2ae35; 1.118 - h1 ^= ((unsigned int)h1) >> 16; 1.119 + h1 ^= h1 >> 16; 1.120 1.121 return h1; 1.122 } 1.123 1.124 // Hash used for the seed. 1.125 -jint AltHashing::murmur3_32(jint seed, const int* data, int len) { 1.126 - jint h1 = seed; 1.127 +juint AltHashing::murmur3_32(juint seed, const int* data, int len) { 1.128 + juint h1 = seed; 1.129 1.130 int off = 0; 1.131 int end = len; 1.132 1.133 // body 1.134 while (off < end) { 1.135 - jint k1 = data[off++]; 1.136 + juint k1 = (juint)data[off++]; 1.137 1.138 k1 *= 0xcc9e2d51; 1.139 k1 = Integer_rotateLeft(k1, 15); 1.140 @@ -193,26 +193,26 @@ 1.141 h1 ^= len * 4; // (Integer.SIZE / Byte.SIZE); 1.142 1.143 // finalization mix force all bits of a hash block to avalanche 1.144 - h1 ^= ((juint)h1) >> 16; 1.145 + h1 ^= h1 >> 16; 1.146 h1 *= 0x85ebca6b; 1.147 - h1 ^= ((juint)h1) >> 13; 1.148 + h1 ^= h1 >> 13; 1.149 h1 *= 0xc2b2ae35; 1.150 - h1 ^= ((juint)h1) >> 16; 1.151 + h1 ^= h1 >> 16; 1.152 1.153 return h1; 1.154 } 1.155 1.156 -jint AltHashing::murmur3_32(const int* data, int len) { 1.157 +juint AltHashing::murmur3_32(const int* data, int len) { 1.158 return murmur3_32(0, data, len); 1.159 } 1.160 1.161 #ifndef PRODUCT 1.162 // Overloaded versions for internal test. 1.163 -jint AltHashing::murmur3_32(const jbyte* data, int len) { 1.164 +juint AltHashing::murmur3_32(const jbyte* data, int len) { 1.165 return murmur3_32(0, data, len); 1.166 } 1.167 1.168 -jint AltHashing::murmur3_32(const jchar* data, int len) { 1.169 +juint AltHashing::murmur3_32(const jchar* data, int len) { 1.170 return murmur3_32(0, data, len); 1.171 } 1.172 1.173 @@ -251,11 +251,11 @@ 1.174 1.175 // Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255} 1.176 for (int i = 0; i < 256; i++) { 1.177 - jint hash = murmur3_32(256 - i, vector, i); 1.178 + juint hash = murmur3_32(256 - i, vector, i); 1.179 hashes[i * 4] = (jbyte) hash; 1.180 - hashes[i * 4 + 1] = (jbyte) (((juint)hash) >> 8); 1.181 - hashes[i * 4 + 2] = (jbyte) (((juint)hash) >> 16); 1.182 - hashes[i * 4 + 3] = (jbyte) (((juint)hash) >> 24); 1.183 + hashes[i * 4 + 1] = (jbyte)(hash >> 8); 1.184 + hashes[i * 4 + 2] = (jbyte)(hash >> 16); 1.185 + hashes[i * 4 + 3] = (jbyte)(hash >> 24); 1.186 } 1.187 1.188 // hash to get const result. 1.189 @@ -269,7 +269,7 @@ 1.190 } 1.191 1.192 void AltHashing::testEquivalentHashes() { 1.193 - jint jbytes, jchars, ints; 1.194 + juint jbytes, jchars, ints; 1.195 1.196 // printf("testEquivalentHashes\n"); 1.197