10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/altHashing.hpp"
27 #include "classfile/symbolTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "oops/markOop.hpp"
30 #include "runtime/thread.hpp"
31
32 // Get the hash code of the classes mirror if it exists, otherwise just
33 // return a random number, which is one of the possible hash code used for
34 // objects. We don't want to call the synchronizer hash code to install
35 // this value because it may safepoint.
36 static intptr_t object_hash(Klass* k) {
37 intptr_t hc = k->java_mirror()->mark()->hash();
38 return hc != markOopDesc::no_hash ? hc : os::random();
39 }
40
41 // Seed value used for each alternative hash calculated.
42 juint AltHashing::compute_seed() {
43 jlong nanos = os::javaTimeNanos();
44 jlong now = os::javaTimeMillis();
45 jint SEED_MATERIAL[8] = {
46 (jint) object_hash(SystemDictionary::String_klass()),
47 (jint) object_hash(SystemDictionary::System_klass()),
48 (jint) os::random(), // current thread isn't a java thread
49 (jint) (((julong)nanos) >> 32),
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "classfile/altHashing.hpp"
27 #include "classfile/symbolTable.hpp"
28 #include "classfile/systemDictionary.hpp"
29 #include "oops/markOop.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "runtime/thread.hpp"
32
33 // Get the hash code of the classes mirror if it exists, otherwise just
34 // return a random number, which is one of the possible hash code used for
35 // objects. We don't want to call the synchronizer hash code to install
36 // this value because it may safepoint.
37 static intptr_t object_hash(Klass* k) {
38 intptr_t hc = k->java_mirror()->mark()->hash();
39 return hc != markOopDesc::no_hash ? hc : os::random();
40 }
41
42 // Seed value used for each alternative hash calculated.
43 juint AltHashing::compute_seed() {
44 jlong nanos = os::javaTimeNanos();
45 jlong now = os::javaTimeMillis();
46 jint SEED_MATERIAL[8] = {
47 (jint) object_hash(SystemDictionary::String_klass()),
48 (jint) object_hash(SystemDictionary::System_klass()),
49 (jint) os::random(), // current thread isn't a java thread
50 (jint) (((julong)nanos) >> 32),
|