Mercurial > hg > graal-jvmci-8
annotate src/cpu/x86/vm/sharedRuntime_x86.cpp @ 24154:c2e117633778
use openjdk prefix if bootstrap jdk is an openjdk
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Jul 2017 14:56:32 +0200 |
parents | e804aec381cd |
children |
rev | line source |
---|---|
23788
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 * |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 */ |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 #include "precompiled.hpp" |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 #include "asm/macroAssembler.hpp" |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 #include "runtime/sharedRuntime.hpp" |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 #include "vmreg_x86.inline.hpp" |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 #ifdef COMPILER1 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 #include "c1/c1_Runtime1.hpp" |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 #endif //COMPILER1 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 #define __ masm-> |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 #ifdef COMPILER1 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 // --------------------------------------------------------------------------- |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 // Object.hashCode, System.identityHashCode can pull the hashCode from the |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 // header word instead of doing a full VM transition once it's been computed. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 // Since hashCode is usually polymorphic at call sites we can't do this |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 // optimization at the call site without a lot of work. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm, |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 methodHandle method, |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 Register obj_reg, |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 Register result) { |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 Label slowCase; |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 // Unlike for Object.hashCode, System.identityHashCode is static method and |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 // gets object as argument instead of the receiver. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) { |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 Label Continue; |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 // return 0 for null reference input |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 __ cmpptr(obj_reg, (int32_t)NULL_WORD); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 __ jcc(Assembler::notEqual, Continue); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 __ xorptr(result, result); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 __ ret(0); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 __ bind(Continue); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
57 } |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
58 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
59 __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes())); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
60 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
61 // check if locked |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
62 __ testptr(result, markOopDesc::unlocked_value); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
63 __ jcc(Assembler::zero, slowCase); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
64 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
65 if (UseBiasedLocking) { |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
66 // Check if biased and fall through to runtime if so |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
67 __ testptr(result, markOopDesc::biased_lock_bit_in_place); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
68 __ jcc(Assembler::notZero, slowCase); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
69 } |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
70 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
71 // get hash |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
72 #ifdef _LP64 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
73 // Read the header and build a mask to get its hash field. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
74 // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
75 // because it could be larger than 32 bits in a 64-bit vm. See markOop.hpp. |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
76 __ shrptr(result, markOopDesc::hash_shift); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
77 __ andptr(result, markOopDesc::hash_mask); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
78 #else |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
79 __ andptr(result, markOopDesc::hash_mask_in_place); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
80 #endif //_LP64 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
81 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 // test if hashCode exists |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
83 __ jcc(Assembler::zero, slowCase); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
84 #ifndef _LP64 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
85 __ shrptr(result, markOopDesc::hash_shift); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
86 #endif |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
87 __ ret(0); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
88 __ bind(slowCase); |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
89 } |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
90 #endif //COMPILER1 |
e804aec381cd
Performance problem with System.identityHashCode in client compiler (JDK-6378526)
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
91 |