9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 "asm/macroAssembler.hpp"
27 #include "runtime/interfaceSupport.inline.hpp"
28 #include "runtime/sharedRuntime.hpp"
29 #include "vmreg_x86.inline.hpp"
30 #ifdef COMPILER1
31 #include "c1/c1_Runtime1.hpp"
32 #endif //COMPILER1
33
34 #define __ masm->
35
36 #ifdef COMPILER1
37 // ---------------------------------------------------------------------------
38 // Object.hashCode, System.identityHashCode can pull the hashCode from the
39 // header word instead of doing a full VM transition once it's been computed.
40 // Since hashCode is usually polymorphic at call sites we can't do this
41 // optimization at the call site without a lot of work.
42 void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm,
43 const methodHandle& method,
44 Register obj_reg,
45 Register result) {
46 Label slowCase;
47
48 // Unlike for Object.hashCode, System.identityHashCode is static method and
49 // gets object as argument instead of the receiver.
50 if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
51 Label Continue;
52 // return 0 for null reference input
53 __ cmpptr(obj_reg, NULL_WORD);
54 __ jcc(Assembler::notEqual, Continue);
55 __ xorptr(result, result);
56 __ ret(0);
57 __ bind(Continue);
58 }
59
60 __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
61
62 // check if locked
63 __ testptr(result, markWord::unlocked_value);
64 __ jcc(Assembler::zero, slowCase);
65
66 // get hash
67 #ifdef _LP64
68 // Read the header and build a mask to get its hash field.
69 // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
70 // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
71 __ shrptr(result, markWord::hash_shift);
72 __ andptr(result, markWord::hash_mask);
73 #else
74 __ andptr(result, markWord::hash_mask_in_place);
75 #endif //_LP64
76
77 // test if hashCode exists
78 __ jcc(Assembler::zero, slowCase);
79 #ifndef _LP64
80 __ shrptr(result, markWord::hash_shift);
81 #endif
82 __ ret(0);
83 __ bind(slowCase);
84 }
85 #endif //COMPILER1
86
87 #if defined(TARGET_COMPILER_gcc) && !defined(_WIN64)
88 JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y))
89 jfloat retval;
90 asm ("\
91 1: \n\
92 fprem \n\
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 "asm/macroAssembler.hpp"
27 #include "runtime/interfaceSupport.inline.hpp"
28 #include "runtime/sharedRuntime.hpp"
29 #include "utilities/globalDefinitions.hpp"
30 #include "vmreg_x86.inline.hpp"
31 #ifdef COMPILER1
32 #include "c1/c1_Runtime1.hpp"
33 #endif //COMPILER1
34
35 #define __ masm->
36
37 #ifdef COMPILER1
38 // ---------------------------------------------------------------------------
39 // Object.hashCode, System.identityHashCode can pull the hashCode from the
40 // header word instead of doing a full VM transition once it's been computed.
41 // Since hashCode is usually polymorphic at call sites we can't do this
42 // optimization at the call site without a lot of work.
43 void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* masm,
44 const methodHandle& method,
45 Register obj_reg,
46 Register result) {
47 Label slowCase;
48
49 // Unlike for Object.hashCode, System.identityHashCode is static method and
50 // gets object as argument instead of the receiver.
51 if (method->intrinsic_id() == vmIntrinsics::_identityHashCode) {
52 Label Continue;
53 // return 0 for null reference input
54 __ cmpptr(obj_reg, NULL_WORD);
55 __ jcc(Assembler::notEqual, Continue);
56 __ xorptr(result, result);
57 __ ret(0);
58 __ bind(Continue);
59 }
60
61 __ movptr(result, Address(obj_reg, oopDesc::mark_offset_in_bytes()));
62
63
64 if (LockingMode == LM_LIGHTWEIGHT) {
65 // check if monitor
66 __ testptr(result, markWord::monitor_value);
67 __ jcc(Assembler::notZero, slowCase);
68 } else {
69 // check if locked
70 __ testptr(result, markWord::unlocked_value);
71 __ jcc(Assembler::zero, slowCase);
72 }
73
74 // get hash
75 #ifdef _LP64
76 // Read the header and build a mask to get its hash field.
77 // Depend on hash_mask being at most 32 bits and avoid the use of hash_mask_in_place
78 // because it could be larger than 32 bits in a 64-bit vm. See markWord.hpp.
79 if (UseCompactObjectHeaders) {
80 __ shrptr(result, markWord::hash_shift_compact);
81 __ andptr(result, markWord::hash_mask_compact);
82 } else {
83 __ shrptr(result, markWord::hash_shift);
84 __ andptr(result, markWord::hash_mask);
85 }
86 #else
87 __ andptr(result, markWord::hash_mask_in_place);
88 #endif //_LP64
89
90 // test if hashCode exists
91 __ jcc(Assembler::zero, slowCase);
92 #ifndef _LP64
93 __ shrptr(result, markWord::hash_shift);
94 #endif
95 __ ret(0);
96 __ bind(slowCase);
97 }
98 #endif //COMPILER1
99
100 #if defined(TARGET_COMPILER_gcc) && !defined(_WIN64)
101 JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y))
102 jfloat retval;
103 asm ("\
104 1: \n\
105 fprem \n\
|