hotspot/src/share/vm/classfile/altHashing.cpp
changeset 33105 294e48b4f704
parent 22757 b2cbb3680b4f
child 35529 39376b4613b5
equal deleted inserted replaced
33104:a7c0f60a1294 33105:294e48b4f704
   260 
   260 
   261   // hash to get const result.
   261   // hash to get const result.
   262   juint final_hash = murmur3_32(hashes, 4*256);
   262   juint final_hash = murmur3_32(hashes, 4*256);
   263 
   263 
   264   assert (MURMUR3_32_X86_CHECK_VALUE == final_hash,
   264   assert (MURMUR3_32_X86_CHECK_VALUE == final_hash,
   265     err_msg(
   265           "Calculated hash result not as expected. Expected %08X got %08X\n",
   266         "Calculated hash result not as expected. Expected %08X got %08X\n",
   266           MURMUR3_32_X86_CHECK_VALUE,
   267         MURMUR3_32_X86_CHECK_VALUE,
   267           final_hash);
   268         final_hash));
       
   269 }
   268 }
   270 
   269 
   271 void AltHashing::testEquivalentHashes() {
   270 void AltHashing::testEquivalentHashes() {
   272   juint jbytes, jchars, ints;
   271   juint jbytes, jchars, ints;
   273 
   272 
   274   // printf("testEquivalentHashes\n");
   273   // printf("testEquivalentHashes\n");
   275 
   274 
   276   jbytes = murmur3_32(TWO_BYTE, 2);
   275   jbytes = murmur3_32(TWO_BYTE, 2);
   277   jchars = murmur3_32(ONE_CHAR, 1);
   276   jchars = murmur3_32(ONE_CHAR, 1);
   278   assert (jbytes == jchars,
   277   assert (jbytes == jchars,
   279     err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars));
   278           "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars);
   280 
   279 
   281   jbytes = murmur3_32(FOUR_BYTE, 4);
   280   jbytes = murmur3_32(FOUR_BYTE, 4);
   282   jchars = murmur3_32(TWO_CHAR, 2);
   281   jchars = murmur3_32(TWO_CHAR, 2);
   283   ints = murmur3_32(ONE_INT, 1);
   282   ints = murmur3_32(ONE_INT, 1);
   284   assert ((jbytes == jchars) && (jbytes == ints),
   283   assert ((jbytes == jchars) && (jbytes == ints),
   285     err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints));
   284           "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints);
   286 
   285 
   287   jbytes = murmur3_32(SIX_BYTE, 6);
   286   jbytes = murmur3_32(SIX_BYTE, 6);
   288   jchars = murmur3_32(THREE_CHAR, 3);
   287   jchars = murmur3_32(THREE_CHAR, 3);
   289   assert (jbytes == jchars,
   288   assert (jbytes == jchars,
   290     err_msg("Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars));
   289          "Hashes did not match. b:%08x != c:%08x\n", jbytes, jchars);
   291 
   290 
   292   jbytes = murmur3_32(EIGHT_BYTE, 8);
   291   jbytes = murmur3_32(EIGHT_BYTE, 8);
   293   jchars = murmur3_32(FOUR_CHAR, 4);
   292   jchars = murmur3_32(FOUR_CHAR, 4);
   294   ints = murmur3_32(TWO_INT, 2);
   293   ints = murmur3_32(TWO_INT, 2);
   295   assert ((jbytes == jchars) && (jbytes == ints),
   294   assert ((jbytes == jchars) && (jbytes == ints),
   296     err_msg("Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints));
   295           "Hashes did not match. b:%08x != c:%08x != i:%08x\n", jbytes, jchars, ints);
   297 }
   296 }
   298 
   297 
   299 // Returns true if the alternate hashcode is correct
   298 // Returns true if the alternate hashcode is correct
   300 void AltHashing::test_alt_hash() {
   299 void AltHashing::test_alt_hash() {
   301   testMurmur3_32_ByteArray();
   300   testMurmur3_32_ByteArray();