Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java @ 14283:baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
Reviewed-by: sla, dsamersoff
author | kevinw |
---|---|
date | Fri, 17 Jan 2014 18:39:22 +0000 |
parents | b9a9ed0f8eeb |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14281:00c48a8ca160 | 14283:baa7d4400c62 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2014, 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. |
59 // VM's Hashtable::hash_symbol | 59 // VM's Hashtable::hash_symbol |
60 protected static long hashSymbol(byte[] buf) { | 60 protected static long hashSymbol(byte[] buf) { |
61 long h = 0; | 61 long h = 0; |
62 int s = 0; | 62 int s = 0; |
63 int len = buf.length; | 63 int len = buf.length; |
64 // Emulate the unsigned int in java_lang_String::hash_code | |
64 while (len-- > 0) { | 65 while (len-- > 0) { |
65 h = 31*h + (0xFFL & buf[s]); | 66 h = 31*h + (0xFFFFFFFFL & buf[s]); |
66 s++; | 67 s++; |
67 } | 68 } |
68 return h & 0xFFFFFFFFL; | 69 return h & 0xFFFFFFFFL; |
69 } | 70 } |
70 } | 71 } |