/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/altHashing.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "oops/markOop.hpp"
#include "runtime/thread.hpp"
// Get the hash code of the classes mirror if it exists, otherwise just
// return a random number, which is one of the possible hash code used for
// objects. We don't want to call the synchronizer hash code to install
// this value because it may safepoint.
}
// Seed value used for each alternative hash calculated.
};
}
// Murmur3 hashing for Symbol
int offset = 0;
// body
while (count >= 4) {
count -= 4;
offset += 4;
k1 *= 0xcc9e2d51;
k1 *= 0x1b873593;
}
// tail
if (count > 0) {
switch (count) {
case 3:
// fall through
case 2:
// fall through
case 1:
// fall through
default:
k1 *= 0xcc9e2d51;
k1 *= 0x1b873593;
}
}
// finalization
// finalization mix force all bits of a hash block to avalanche
h1 *= 0x85ebca6b;
h1 *= 0xc2b2ae35;
return h1;
}
// Murmur3 hashing for Strings
int off = 0;
// body
while (count >= 2) {
count -= 2;
k1 *= 0xcc9e2d51;
k1 *= 0x1b873593;
}
// tail
if (count > 0) {
k1 *= 0xcc9e2d51;
k1 *= 0x1b873593;
}
// finalization
// finalization mix force all bits of a hash block to avalanche
h1 *= 0x85ebca6b;
h1 *= 0xc2b2ae35;
return h1;
}
// Hash used for the seed.
int off = 0;
// body
k1 *= 0xcc9e2d51;
k1 *= 0x1b873593;
}
// tail (always empty, as body is always 32-bit chunks)
// finalization
// finalization mix force all bits of a hash block to avalanche
h1 *= 0x85ebca6b;
h1 *= 0xc2b2ae35;
return h1;
}
}
#ifndef PRODUCT
// Overloaded versions for internal test.
}
}
// Internal test for alternate hashing. Translated from JDK version
// test/sun/misc/Hashing.java
static const jbyte SIX_BYTE[] = { (jbyte) 0x80, (jbyte) 0x81, (jbyte) 0x82, (jbyte) 0x83, (jbyte) 0x84, (jbyte) 0x85};
// printf("testMurmur3_32_ByteArray\n");
for (int i = 0; i < 256; i++) {
}
// Hash subranges {}, {0}, {0,1}, {0,1,2}, ..., {0,...,255}
for (int i = 0; i < 256; i++) {
}
// hash to get const result.
"Calculated hash result not as expected. Expected %08X got %08X\n",
final_hash));
}
// printf("testEquivalentHashes\n");
}
// Returns true if the alternate hashcode is correct
}
#endif // PRODUCT