src/share/vm/classfile/altHashing.hpp

Wed, 13 Mar 2013 15:15:56 -0400

author
coleenp
date
Wed, 13 Mar 2013 15:15:56 -0400
changeset 4718
0ede345ec7c9
parent 3865
e9140bf80b4a
child 6351
f9e35a9dc8c7
permissions
-rw-r--r--

8009829: CDS: JDK JPRT test fails crash in Symbol::equals()
Summary: -Xshare:dump was creating a Symbol in C_heap. There's an assert there that jdk jprt wasn't hitting because it was only done in product
Reviewed-by: dholmes, hseigel, iklam

coleenp@3865 1 /*
coleenp@3865 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
coleenp@3865 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
coleenp@3865 4 *
coleenp@3865 5 * This code is free software; you can redistribute it and/or modify it
coleenp@3865 6 * under the terms of the GNU General Public License version 2 only, as
coleenp@3865 7 * published by the Free Software Foundation.
coleenp@3865 8 *
coleenp@3865 9 * This code is distributed in the hope that it will be useful, but WITHOUT
coleenp@3865 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
coleenp@3865 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
coleenp@3865 12 * version 2 for more details (a copy is included in the LICENSE file that
coleenp@3865 13 * accompanied this code).
coleenp@3865 14 *
coleenp@3865 15 * You should have received a copy of the GNU General Public License version
coleenp@3865 16 * 2 along with this work; if not, write to the Free Software Foundation,
coleenp@3865 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
coleenp@3865 18 *
coleenp@3865 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
coleenp@3865 20 * or visit www.oracle.com if you need additional information or have any
coleenp@3865 21 * questions.
coleenp@3865 22 *
coleenp@3865 23 */
coleenp@3865 24
coleenp@3865 25 #ifndef SHARE_VM_CLASSFILE_ALTHASHING_HPP
coleenp@3865 26 #define SHARE_VM_CLASSFILE_ALTHASHING_HPP
coleenp@3865 27
coleenp@3865 28 #include "prims/jni.h"
coleenp@3865 29 #include "classfile/symbolTable.hpp"
coleenp@3865 30
coleenp@3865 31 /**
coleenp@3865 32 * Hashing utilities.
coleenp@3865 33 *
coleenp@3865 34 * Implementation of Murmur3 hashing.
coleenp@3865 35 * This code was translated from src/share/classes/sun/misc/Hashing.java
coleenp@3865 36 * code in the JDK.
coleenp@3865 37 */
coleenp@3865 38
coleenp@3865 39 class AltHashing : AllStatic {
coleenp@3865 40
coleenp@3865 41 // utility function copied from java/lang/Integer
coleenp@3865 42 static jint Integer_rotateLeft(jint i, int distance) {
coleenp@3865 43 return (i << distance) | (((juint)i) >> (32-distance));
coleenp@3865 44 }
coleenp@3865 45 static jint murmur3_32(const int* data, int len);
coleenp@3865 46 static jint murmur3_32(jint seed, const int* data, int len);
coleenp@3865 47
coleenp@3865 48 #ifndef PRODUCT
coleenp@3865 49 // Hashing functions used for internal testing
coleenp@3865 50 static jint murmur3_32(const jbyte* data, int len);
coleenp@3865 51 static jint murmur3_32(const jchar* data, int len);
coleenp@3865 52 static void testMurmur3_32_ByteArray();
coleenp@3865 53 static void testEquivalentHashes();
coleenp@3865 54 #endif // PRODUCT
coleenp@3865 55
coleenp@3865 56 public:
coleenp@3865 57 static jint compute_seed();
coleenp@3865 58 static jint murmur3_32(jint seed, const jbyte* data, int len);
coleenp@3865 59 static jint murmur3_32(jint seed, const jchar* data, int len);
coleenp@3865 60 NOT_PRODUCT(static void test_alt_hash();)
coleenp@3865 61 };
coleenp@3865 62 #endif // SHARE_VM_CLASSFILE_ALTHASHING_HPP

mercurial