author | coleenp |
Sat, 05 Dec 2015 10:40:22 -0500 | |
changeset 34651 | 07b1cc0f6040 |
parent 33161 | hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp@81170a43bb2a |
child 35214 | d86005e0b4c2 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
31790 | 2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5419
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
13728
diff
changeset
|
26 |
#include "asm/macroAssembler.hpp" |
7397 | 27 |
#include "interpreter/interpreter.hpp" |
28 |
#include "interpreter/interpreterGenerator.hpp" |
|
29 |
#include "runtime/arguments.hpp" |
|
1 | 30 |
|
31 |
#define __ _masm-> |
|
32 |
||
33 |
||
34 |
#ifndef CC_INTERP |
|
9176
42d9d1010f38
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
8315
diff
changeset
|
35 |
|
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
36 |
/** |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
37 |
* Method entry for static native methods: |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
38 |
* int java.util.zip.CRC32.update(int crc, int b) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
39 |
*/ |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
40 |
address InterpreterGenerator::generate_CRC32_update_entry() { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
41 |
if (UseCRC32Intrinsics) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
42 |
address entry = __ pc(); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
43 |
|
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
44 |
// rbx: Method* |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
45 |
// rsi: senderSP must preserved for slow path, set SP to it on fast path |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
46 |
// rdx: scratch |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
47 |
// rdi: scratch |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
48 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
49 |
Label slow_path; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
50 |
// If we need a safepoint check, generate full interpreter entry. |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
51 |
ExternalAddress state(SafepointSynchronize::address_of_state()); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
52 |
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
53 |
SafepointSynchronize::_not_synchronized); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
54 |
__ jcc(Assembler::notEqual, slow_path); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
55 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
56 |
// We don't generate local frame and don't align stack because |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
57 |
// we call stub code and there is no safepoint on this path. |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
58 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
59 |
// Load parameters |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
60 |
const Register crc = rax; // crc |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
61 |
const Register val = rdx; // source java byte value |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
62 |
const Register tbl = rdi; // scratch |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
63 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
64 |
// Arguments are reversed on java expression stack |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
65 |
__ movl(val, Address(rsp, wordSize)); // byte value |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
66 |
__ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
67 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
68 |
__ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr())); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
69 |
__ notl(crc); // ~crc |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
70 |
__ update_byte_crc32(crc, val, tbl); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
71 |
__ notl(crc); // ~crc |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
72 |
// result in rax |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
73 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
74 |
// _areturn |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
75 |
__ pop(rdi); // get return address |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
76 |
__ mov(rsp, rsi); // set sp to sender sp |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
77 |
__ jmp(rdi); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
78 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
79 |
// generate a vanilla native entry as the slow path |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
80 |
__ bind(slow_path); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
81 |
__ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native)); |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
82 |
return entry; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
83 |
} |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
84 |
return NULL; |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
85 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
86 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
87 |
/** |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
88 |
* Method entry for static native methods: |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
89 |
* int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
90 |
* int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
91 |
*/ |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
92 |
address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
93 |
if (UseCRC32Intrinsics) { |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
94 |
address entry = __ pc(); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
95 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
96 |
// rbx,: Method* |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
97 |
// rsi: senderSP must preserved for slow path, set SP to it on fast path |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
98 |
// rdx: scratch |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
99 |
// rdi: scratch |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
100 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
101 |
Label slow_path; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
102 |
// If we need a safepoint check, generate full interpreter entry. |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
103 |
ExternalAddress state(SafepointSynchronize::address_of_state()); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
104 |
__ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
105 |
SafepointSynchronize::_not_synchronized); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
106 |
__ jcc(Assembler::notEqual, slow_path); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
107 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
108 |
// We don't generate local frame and don't align stack because |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
109 |
// we call stub code and there is no safepoint on this path. |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
110 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
111 |
// Load parameters |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
112 |
const Register crc = rax; // crc |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
113 |
const Register buf = rdx; // source java byte array address |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
114 |
const Register len = rdi; // length |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
115 |
|
33066 | 116 |
// value x86_32 |
117 |
// interp. arg ptr ESP + 4 |
|
118 |
// int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) |
|
119 |
// 3 2 1 0 |
|
120 |
// int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) |
|
121 |
// 4 2,3 1 0 |
|
122 |
||
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
123 |
// Arguments are reversed on java expression stack |
33066 | 124 |
__ movl(len, Address(rsp, 4 + 0)); // Length |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
125 |
// Calculate address of start element |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
126 |
if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { |
33066 | 127 |
__ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long buf |
128 |
__ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset |
|
129 |
__ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC |
|
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
130 |
} else { |
33066 | 131 |
__ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
132 |
__ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size |
33066 | 133 |
__ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset |
134 |
__ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC |
|
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
135 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
136 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
137 |
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
138 |
// result in rax |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
139 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
140 |
// _areturn |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
141 |
__ pop(rdi); // get return address |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
142 |
__ mov(rsp, rsi); // set sp to sender sp |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
143 |
__ jmp(rdi); |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
144 |
|
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
145 |
// generate a vanilla native entry as the slow path |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
146 |
__ bind(slow_path); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
147 |
__ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native)); |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
148 |
return entry; |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
149 |
} |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
150 |
return NULL; |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
151 |
} |
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17875
diff
changeset
|
152 |
|
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
153 |
/** |
33066 | 154 |
* Method entry for static native methods: |
155 |
* int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int end) |
|
156 |
* int java.util.zip.CRC32C.updateByteBuffer(int crc, long address, int off, int end) |
|
157 |
*/ |
|
158 |
address InterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
|
159 |
if (UseCRC32CIntrinsics) { |
|
160 |
address entry = __ pc(); |
|
161 |
// Load parameters |
|
162 |
const Register crc = rax; // crc |
|
163 |
const Register buf = rcx; // source java byte array address |
|
164 |
const Register len = rdx; // length |
|
165 |
const Register end = len; |
|
166 |
||
167 |
// value x86_32 |
|
168 |
// interp. arg ptr ESP + 4 |
|
169 |
// int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int end) |
|
170 |
// 3 2 1 0 |
|
171 |
// int java.util.zip.CRC32.updateByteBuffer(int crc, long address, int off, int end) |
|
172 |
// 4 2,3 1 0 |
|
173 |
||
174 |
// Arguments are reversed on java expression stack |
|
175 |
__ movl(end, Address(rsp, 4 + 0)); // end |
|
176 |
__ subl(len, Address(rsp, 4 + 1 * wordSize)); // end - offset == length |
|
177 |
// Calculate address of start element |
|
33087
5945b51448e9
8139094: Tier1 test java/util/zip/TestCRC32C.java fails due to fixes for JDK-8134553
iveresov
parents:
33070
diff
changeset
|
178 |
if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { |
33066 | 179 |
__ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // long address |
180 |
__ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset |
|
181 |
__ movl(crc, Address(rsp, 4 + 4 * wordSize)); // Initial CRC |
|
182 |
} else { |
|
183 |
__ movptr(buf, Address(rsp, 4 + 2 * wordSize)); // byte[] array |
|
184 |
__ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size |
|
185 |
__ addptr(buf, Address(rsp, 4 + 1 * wordSize)); // + offset |
|
186 |
__ movl(crc, Address(rsp, 4 + 3 * wordSize)); // Initial CRC |
|
187 |
} |
|
188 |
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32C()), crc, buf, len); |
|
189 |
// result in rax |
|
190 |
// _areturn |
|
191 |
__ pop(rdi); // get return address |
|
192 |
__ mov(rsp, rsi); // set sp to sender sp |
|
193 |
__ jmp(rdi); |
|
194 |
||
195 |
return entry; |
|
196 |
} |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
197 |
return NULL; |
33066 | 198 |
} |
199 |
||
200 |
/** |
|
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
201 |
* Method entry for static native method: |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
202 |
* java.lang.Float.intBitsToFloat(int bits) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
203 |
*/ |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
204 |
address InterpreterGenerator::generate_Float_intBitsToFloat_entry() { |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
205 |
if (UseSSE >= 1) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
206 |
address entry = __ pc(); |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
207 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
208 |
// rsi: the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
209 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
210 |
// Skip safepoint check (compiler intrinsic versions of this method |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
211 |
// do not perform safepoint checks either). |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
212 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
213 |
// Load 'bits' into xmm0 (interpreter returns results in xmm0) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
214 |
__ movflt(xmm0, Address(rsp, wordSize)); |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
215 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
216 |
// Return |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
217 |
__ pop(rdi); // get return address |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
218 |
__ mov(rsp, rsi); // set rsp to the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
219 |
__ jmp(rdi); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
220 |
return entry; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
221 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
222 |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
223 |
return NULL; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
224 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
225 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
226 |
/** |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
227 |
* Method entry for static native method: |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
228 |
* java.lang.Float.floatToRawIntBits(float value) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
229 |
*/ |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
230 |
address InterpreterGenerator::generate_Float_floatToRawIntBits_entry() { |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
231 |
if (UseSSE >= 1) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
232 |
address entry = __ pc(); |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
233 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
234 |
// rsi: the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
235 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
236 |
// Skip safepoint check (compiler intrinsic versions of this method |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
237 |
// do not perform safepoint checks either). |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
238 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
239 |
// Load the parameter (a floating-point value) into rax. |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
240 |
__ movl(rax, Address(rsp, wordSize)); |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
241 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
242 |
// Return |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
243 |
__ pop(rdi); // get return address |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
244 |
__ mov(rsp, rsi); // set rsp to the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
245 |
__ jmp(rdi); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
246 |
return entry; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
247 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
248 |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
249 |
return NULL; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
250 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
251 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
252 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
253 |
/** |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
254 |
* Method entry for static native method: |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
255 |
* java.lang.Double.longBitsToDouble(long bits) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
256 |
*/ |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
257 |
address InterpreterGenerator::generate_Double_longBitsToDouble_entry() { |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
258 |
if (UseSSE >= 2) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
259 |
address entry = __ pc(); |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
260 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
261 |
// rsi: the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
262 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
263 |
// Skip safepoint check (compiler intrinsic versions of this method |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
264 |
// do not perform safepoint checks either). |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
265 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
266 |
// Load 'bits' into xmm0 (interpreter returns results in xmm0) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
267 |
__ movdbl(xmm0, Address(rsp, wordSize)); |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
268 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
269 |
// Return |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
270 |
__ pop(rdi); // get return address |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
271 |
__ mov(rsp, rsi); // set rsp to the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
272 |
__ jmp(rdi); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
273 |
return entry; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
274 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
275 |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
276 |
return NULL; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
277 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
278 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
279 |
/** |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
280 |
* Method entry for static native method: |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
281 |
* java.lang.Double.doubleToRawLongBits(double value) |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
282 |
*/ |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
283 |
address InterpreterGenerator::generate_Double_doubleToRawLongBits_entry() { |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
284 |
if (UseSSE >= 2) { |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
285 |
address entry = __ pc(); |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
286 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
287 |
// rsi: the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
288 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
289 |
// Skip safepoint check (compiler intrinsic versions of this method |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
290 |
// do not perform safepoint checks either). |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
291 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
292 |
// Load the parameter (a floating-point value) into rax. |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
293 |
__ movl(rdx, Address(rsp, 2*wordSize)); |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
294 |
__ movl(rax, Address(rsp, wordSize)); |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
295 |
|
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
296 |
// Return |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
297 |
__ pop(rdi); // get return address |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
298 |
__ mov(rsp, rsi); // set rsp to the sender's SP |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
299 |
__ jmp(rdi); |
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
300 |
return entry; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
301 |
} |
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
302 |
|
33070
54f3f085b165
8136525: Generate interpreter entries only once and avoid unnecessary jump to jump
mdoerr
parents:
33066
diff
changeset
|
303 |
return NULL; |
32391
01e2f5e916c7
8076373: In 32-bit VM interpreter and compiled code process NaN values differently
zmajo
parents:
31790
diff
changeset
|
304 |
} |
1 | 305 |
#endif // CC_INTERP |