comparison src/share/vm/classfile/altHashing.hpp @ 14909:4ca6dc0799b6

Backout jdk9 merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 01 Apr 2014 13:57:07 +0200
parents cd6b3f1a94ff
children 52b4284cb496
comparison
equal deleted inserted replaced
14908:8db6e76cb658 14909:4ca6dc0799b6
1 /* 1 /*
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
37 */ 37 */
38 38
39 class AltHashing : AllStatic { 39 class AltHashing : AllStatic {
40 40
41 // utility function copied from java/lang/Integer 41 // utility function copied from java/lang/Integer
42 static juint Integer_rotateLeft(juint i, int distance) { 42 static jint Integer_rotateLeft(jint i, int distance) {
43 return (i << distance) | (i >> (32-distance)); 43 return (i << distance) | (((juint)i) >> (32-distance));
44 } 44 }
45 static juint murmur3_32(const int* data, int len); 45 static jint murmur3_32(const int* data, int len);
46 static juint murmur3_32(juint seed, const int* data, int len); 46 static jint murmur3_32(jint seed, const int* data, int len);
47 47
48 #ifndef PRODUCT 48 #ifndef PRODUCT
49 // Hashing functions used for internal testing 49 // Hashing functions used for internal testing
50 static juint murmur3_32(const jbyte* data, int len); 50 static jint murmur3_32(const jbyte* data, int len);
51 static juint murmur3_32(const jchar* data, int len); 51 static jint murmur3_32(const jchar* data, int len);
52 static void testMurmur3_32_ByteArray(); 52 static void testMurmur3_32_ByteArray();
53 static void testEquivalentHashes(); 53 static void testEquivalentHashes();
54 #endif // PRODUCT 54 #endif // PRODUCT
55 55
56 public: 56 public:
57 static juint compute_seed(); 57 static jint compute_seed();
58 static juint murmur3_32(juint seed, const jbyte* data, int len); 58 static jint murmur3_32(jint seed, const jbyte* data, int len);
59 static juint murmur3_32(juint seed, const jchar* data, int len); 59 static jint murmur3_32(jint seed, const jchar* data, int len);
60 NOT_PRODUCT(static void test_alt_hash();) 60 NOT_PRODUCT(static void test_alt_hash();)
61 }; 61 };
62 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP 62 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP