author | coleenp |
Wed, 14 Aug 2019 10:07:00 -0400 | |
changeset 57745 | 789e967c2731 |
parent 55490 | 3f3dc00a69a5 |
child 58904 | 1f7981ef8779 |
permissions | -rw-r--r-- |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1 |
/* |
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3 |
* Copyright (c) 2012, 2019, SAP SE. All rights reserved. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
5 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
9 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
14 |
* accompanied this code). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
15 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
19 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
22 |
* questions. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
23 |
* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
24 |
*/ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
25 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
26 |
#include "precompiled.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
27 |
#include "asm/macroAssembler.inline.hpp" |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
28 |
#include "gc/shared/barrierSet.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
29 |
#include "gc/shared/barrierSetAssembler.hpp" |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
30 |
#include "interpreter/interpreter.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
31 |
#include "nativeInst_ppc.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
32 |
#include "oops/instanceOop.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
33 |
#include "oops/method.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
34 |
#include "oops/objArrayKlass.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
35 |
#include "oops/oop.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
36 |
#include "prims/methodHandles.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
37 |
#include "runtime/frame.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
38 |
#include "runtime/handles.inline.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
39 |
#include "runtime/sharedRuntime.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
40 |
#include "runtime/stubCodeGenerator.hpp" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
41 |
#include "runtime/stubRoutines.hpp" |
23221 | 42 |
#include "runtime/thread.inline.hpp" |
46625 | 43 |
#include "utilities/align.hpp" |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
44 |
|
48626
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
47608
diff
changeset
|
45 |
// Declaration and definition of StubGenerator (no .hpp file). |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
47608
diff
changeset
|
46 |
// For a more detailed description of the stub routine structure |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
47608
diff
changeset
|
47 |
// see the comment in stubRoutines.hpp. |
9f6f48d4f9a1
8194814: [ppc, s390] A row of minor fixes and cleanups
goetz
parents:
47608
diff
changeset
|
48 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
49 |
#define __ _masm-> |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
50 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
51 |
#ifdef PRODUCT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
52 |
#define BLOCK_COMMENT(str) // nothing |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
53 |
#else |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
54 |
#define BLOCK_COMMENT(str) __ block_comment(str) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
55 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
56 |
|
35085 | 57 |
#if defined(ABI_ELFv2) |
58 |
#define STUB_ENTRY(name) StubRoutines::name() |
|
59 |
#else |
|
60 |
#define STUB_ENTRY(name) ((FunctionDescriptor*)StubRoutines::name())->entry() |
|
61 |
#endif |
|
62 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
63 |
class StubGenerator: public StubCodeGenerator { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
64 |
private: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
65 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
66 |
// Call stubs are used to call Java from C |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
67 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
68 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
69 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
70 |
// R3 - call wrapper address : address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
71 |
// R4 - result : intptr_t* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
72 |
// R5 - result type : BasicType |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
73 |
// R6 - method : Method |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
74 |
// R7 - frame mgr entry point : address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
75 |
// R8 - parameter block : intptr_t* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
76 |
// R9 - parameter count in words : int |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
77 |
// R10 - thread : Thread* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
78 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
79 |
address generate_call_stub(address& return_address) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
80 |
// Setup a new c frame, copy java arguments, call frame manager or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
81 |
// native_entry, and process result. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
82 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
83 |
StubCodeMark mark(this, "StubRoutines", "call_stub"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
84 |
|
23211 | 85 |
address start = __ function_entry(); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
86 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
87 |
// some sanity checks |
23211 | 88 |
assert((sizeof(frame::abi_minframe) % 16) == 0, "unaligned"); |
89 |
assert((sizeof(frame::abi_reg_args) % 16) == 0, "unaligned"); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
90 |
assert((sizeof(frame::spill_nonvolatiles) % 16) == 0, "unaligned"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
91 |
assert((sizeof(frame::parent_ijava_frame_abi) % 16) == 0, "unaligned"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
92 |
assert((sizeof(frame::entry_frame_locals) % 16) == 0, "unaligned"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
93 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
94 |
Register r_arg_call_wrapper_addr = R3; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
95 |
Register r_arg_result_addr = R4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
96 |
Register r_arg_result_type = R5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
97 |
Register r_arg_method = R6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
98 |
Register r_arg_entry = R7; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
99 |
Register r_arg_thread = R10; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
100 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
101 |
Register r_temp = R24; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
102 |
Register r_top_of_arguments_addr = R25; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
103 |
Register r_entryframe_fp = R26; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
104 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
105 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
106 |
// Stack on entry to call_stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
107 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
108 |
// F1 [C_FRAME] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
109 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
110 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
111 |
Register r_arg_argument_addr = R8; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
112 |
Register r_arg_argument_count = R9; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
113 |
Register r_frame_alignment_in_bytes = R27; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
114 |
Register r_argument_addr = R28; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
115 |
Register r_argumentcopy_addr = R29; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
116 |
Register r_argument_size_in_bytes = R30; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
117 |
Register r_frame_size = R23; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
118 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
119 |
Label arguments_copied; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
120 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
121 |
// Save LR/CR to caller's C_FRAME. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
122 |
__ save_LR_CR(R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
123 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
124 |
// Zero extend arg_argument_count. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
125 |
__ clrldi(r_arg_argument_count, r_arg_argument_count, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
126 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
127 |
// Save non-volatiles GPRs to ENTRY_FRAME (not yet pushed, but it's safe). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
128 |
__ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
129 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
130 |
// Keep copy of our frame pointer (caller's SP). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
131 |
__ mr(r_entryframe_fp, R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
132 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
133 |
BLOCK_COMMENT("Push ENTRY_FRAME including arguments"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
134 |
// Push ENTRY_FRAME including arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
135 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
136 |
// F0 [TOP_IJAVA_FRAME_ABI] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
137 |
// alignment (optional) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
138 |
// [outgoing Java arguments] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
139 |
// [ENTRY_FRAME_LOCALS] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
140 |
// F1 [C_FRAME] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
141 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
142 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
143 |
// calculate frame size |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
144 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
145 |
// unaligned size of arguments |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
146 |
__ sldi(r_argument_size_in_bytes, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
147 |
r_arg_argument_count, Interpreter::logStackElementSize); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
148 |
// arguments alignment (max 1 slot) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
149 |
// FIXME: use round_to() here |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
150 |
__ andi_(r_frame_alignment_in_bytes, r_arg_argument_count, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
151 |
__ sldi(r_frame_alignment_in_bytes, |
22861 | 152 |
r_frame_alignment_in_bytes, Interpreter::logStackElementSize); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
153 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
154 |
// size = unaligned size of arguments + top abi's size |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
155 |
__ addi(r_frame_size, r_argument_size_in_bytes, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
156 |
frame::top_ijava_frame_abi_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
157 |
// size += arguments alignment |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
158 |
__ add(r_frame_size, |
22861 | 159 |
r_frame_size, r_frame_alignment_in_bytes); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
160 |
// size += size of call_stub locals |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
161 |
__ addi(r_frame_size, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
162 |
r_frame_size, frame::entry_frame_locals_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
163 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
164 |
// push ENTRY_FRAME |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
165 |
__ push_frame(r_frame_size, r_temp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
166 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
167 |
// initialize call_stub locals (step 1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
168 |
__ std(r_arg_call_wrapper_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
169 |
_entry_frame_locals_neg(call_wrapper_address), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
170 |
__ std(r_arg_result_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
171 |
_entry_frame_locals_neg(result_address), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
172 |
__ std(r_arg_result_type, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
173 |
_entry_frame_locals_neg(result_type), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
174 |
// we will save arguments_tos_address later |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
175 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
176 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
177 |
BLOCK_COMMENT("Copy Java arguments"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
178 |
// copy Java arguments |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
179 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
180 |
// Calculate top_of_arguments_addr which will be R17_tos (not prepushed) later. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
181 |
// FIXME: why not simply use SP+frame::top_ijava_frame_size? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
182 |
__ addi(r_top_of_arguments_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
183 |
R1_SP, frame::top_ijava_frame_abi_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
184 |
__ add(r_top_of_arguments_addr, |
22861 | 185 |
r_top_of_arguments_addr, r_frame_alignment_in_bytes); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
186 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
187 |
// any arguments to copy? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
188 |
__ cmpdi(CCR0, r_arg_argument_count, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
189 |
__ beq(CCR0, arguments_copied); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
190 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
191 |
// prepare loop and copy arguments in reverse order |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
192 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
193 |
// init CTR with arg_argument_count |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
194 |
__ mtctr(r_arg_argument_count); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
195 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
196 |
// let r_argumentcopy_addr point to last outgoing Java arguments P |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
197 |
__ mr(r_argumentcopy_addr, r_top_of_arguments_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
198 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
199 |
// let r_argument_addr point to last incoming java argument |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
200 |
__ add(r_argument_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
201 |
r_arg_argument_addr, r_argument_size_in_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
202 |
__ addi(r_argument_addr, r_argument_addr, -BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
203 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
204 |
// now loop while CTR > 0 and copy arguments |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
205 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
206 |
Label next_argument; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
207 |
__ bind(next_argument); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
208 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
209 |
__ ld(r_temp, 0, r_argument_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
210 |
// argument_addr--; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
211 |
__ addi(r_argument_addr, r_argument_addr, -BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
212 |
__ std(r_temp, 0, r_argumentcopy_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
213 |
// argumentcopy_addr++; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
214 |
__ addi(r_argumentcopy_addr, r_argumentcopy_addr, BytesPerWord); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
215 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
216 |
__ bdnz(next_argument); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
217 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
218 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
219 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
220 |
// Arguments copied, continue. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
221 |
__ bind(arguments_copied); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
222 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
223 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
224 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
225 |
BLOCK_COMMENT("Call frame manager or native entry."); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
226 |
// Call frame manager or native entry. |
27012 | 227 |
Register r_new_arg_entry = R14; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
228 |
assert_different_registers(r_new_arg_entry, r_top_of_arguments_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
229 |
r_arg_method, r_arg_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
230 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
231 |
__ mr(r_new_arg_entry, r_arg_entry); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
232 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
233 |
// Register state on entry to frame manager / native entry: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
234 |
// |
22861 | 235 |
// tos - intptr_t* sender tos (prepushed) Lesp = (SP) + copied_arguments_offset - 8 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
236 |
// R19_method - Method |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
237 |
// R16_thread - JavaThread* |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
238 |
|
22861 | 239 |
// Tos must point to last argument - element_size. |
23221 | 240 |
const Register tos = R15_esp; |
35166
23125410af16
8145117: PPC64: Remove cpp interpreter implementation
goetz
parents:
34148
diff
changeset
|
241 |
|
22861 | 242 |
__ addi(tos, r_top_of_arguments_addr, -Interpreter::stackElementSize); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
243 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
244 |
// initialize call_stub locals (step 2) |
22861 | 245 |
// now save tos as arguments_tos_address |
246 |
__ std(tos, _entry_frame_locals_neg(arguments_tos_address), r_entryframe_fp); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
247 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
248 |
// load argument registers for call |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
249 |
__ mr(R19_method, r_arg_method); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
250 |
__ mr(R16_thread, r_arg_thread); |
22861 | 251 |
assert(tos != r_arg_method, "trashed r_arg_method"); |
252 |
assert(tos != r_arg_thread && R19_method != r_arg_thread, "trashed r_arg_thread"); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
253 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
254 |
// Set R15_prev_state to 0 for simplifying checks in callee. |
23221 | 255 |
__ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
256 |
// Stack on entry to frame manager / native entry: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
257 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
258 |
// F0 [TOP_IJAVA_FRAME_ABI] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
259 |
// alignment (optional) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
260 |
// [outgoing Java arguments] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
261 |
// [ENTRY_FRAME_LOCALS] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
262 |
// F1 [C_FRAME] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
263 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
264 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
265 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
266 |
// global toc register |
35085 | 267 |
__ load_const_optimized(R29_TOC, MacroAssembler::global_toc(), R11_scratch1); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
268 |
// Remember the senderSP so we interpreter can pop c2i arguments off of the stack |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
269 |
// when called via a c2i. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
270 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
271 |
// Pass initial_caller_sp to framemanager. |
53281
672b629e1f72
8216376: [PPC64] Possibly unreliable stack frame resizing in template interpreter
mdoerr
parents:
51756
diff
changeset
|
272 |
__ mr(R21_sender_SP, R1_SP); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
273 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
274 |
// Do a light-weight C-call here, r_new_arg_entry holds the address |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
275 |
// of the interpreter entry point (frame manager or native entry) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
276 |
// and save runtime-value of LR in return_address. |
22861 | 277 |
assert(r_new_arg_entry != tos && r_new_arg_entry != R19_method && r_new_arg_entry != R16_thread, |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
278 |
"trashed r_new_arg_entry"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
279 |
return_address = __ call_stub(r_new_arg_entry); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
280 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
281 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
282 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
283 |
BLOCK_COMMENT("Returned from frame manager or native entry."); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
284 |
// Returned from frame manager or native entry. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
285 |
// Now pop frame, process result, and return to caller. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
286 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
287 |
// Stack on exit from frame manager / native entry: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
288 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
289 |
// F0 [ABI] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
290 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
291 |
// [ENTRY_FRAME_LOCALS] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
292 |
// F1 [C_FRAME] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
293 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
294 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
295 |
// Just pop the topmost frame ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
296 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
297 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
298 |
Label ret_is_object; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
299 |
Label ret_is_long; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
300 |
Label ret_is_float; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
301 |
Label ret_is_double; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
302 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
303 |
Register r_entryframe_fp = R30; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
304 |
Register r_lr = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
305 |
Register r_cr = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
306 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
307 |
// Reload some volatile registers which we've spilled before the call |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
308 |
// to frame manager / native entry. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
309 |
// Access all locals via frame pointer, because we know nothing about |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
310 |
// the topmost frame's size. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
311 |
__ ld(r_entryframe_fp, _abi(callers_sp), R1_SP); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
312 |
assert_different_registers(r_entryframe_fp, R3_RET, r_arg_result_addr, r_arg_result_type, r_cr, r_lr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
313 |
__ ld(r_arg_result_addr, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
314 |
_entry_frame_locals_neg(result_address), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
315 |
__ ld(r_arg_result_type, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
316 |
_entry_frame_locals_neg(result_type), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
317 |
__ ld(r_cr, _abi(cr), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
318 |
__ ld(r_lr, _abi(lr), r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
319 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
320 |
// pop frame and restore non-volatiles, LR and CR |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
321 |
__ mr(R1_SP, r_entryframe_fp); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
322 |
__ mtcr(r_cr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
323 |
__ mtlr(r_lr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
324 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
325 |
// Store result depending on type. Everything that is not |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
326 |
// T_OBJECT, T_LONG, T_FLOAT, or T_DOUBLE is treated as T_INT. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
327 |
__ cmpwi(CCR0, r_arg_result_type, T_OBJECT); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
328 |
__ cmpwi(CCR1, r_arg_result_type, T_LONG); |
22861 | 329 |
__ cmpwi(CCR5, r_arg_result_type, T_FLOAT); |
330 |
__ cmpwi(CCR6, r_arg_result_type, T_DOUBLE); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
331 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
332 |
// restore non-volatile registers |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
333 |
__ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
334 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
335 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
336 |
// Stack on exit from call_stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
337 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
338 |
// 0 [C_FRAME] |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
339 |
// ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
340 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
341 |
// no call_stub frames left. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
342 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
343 |
// All non-volatiles have been restored at this point!! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
344 |
assert(R3_RET == R3, "R3_RET should be R3"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
345 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
346 |
__ beq(CCR0, ret_is_object); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
347 |
__ beq(CCR1, ret_is_long); |
22861 | 348 |
__ beq(CCR5, ret_is_float); |
349 |
__ beq(CCR6, ret_is_double); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
350 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
351 |
// default: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
352 |
__ stw(R3_RET, 0, r_arg_result_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
353 |
__ blr(); // return to caller |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
354 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
355 |
// case T_OBJECT: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
356 |
__ bind(ret_is_object); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
357 |
__ std(R3_RET, 0, r_arg_result_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
358 |
__ blr(); // return to caller |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
359 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
360 |
// case T_LONG: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
361 |
__ bind(ret_is_long); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
362 |
__ std(R3_RET, 0, r_arg_result_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
363 |
__ blr(); // return to caller |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
364 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
365 |
// case T_FLOAT: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
366 |
__ bind(ret_is_float); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
367 |
__ stfs(F1_RET, 0, r_arg_result_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
368 |
__ blr(); // return to caller |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
369 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
370 |
// case T_DOUBLE: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
371 |
__ bind(ret_is_double); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
372 |
__ stfd(F1_RET, 0, r_arg_result_addr); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
373 |
__ blr(); // return to caller |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
374 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
375 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
376 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
377 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
378 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
379 |
// Return point for a Java call if there's an exception thrown in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
380 |
// Java code. The exception is caught and transformed into a |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
381 |
// pending exception stored in JavaThread that can be tested from |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
382 |
// within the VM. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
383 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
384 |
address generate_catch_exception() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
385 |
StubCodeMark mark(this, "StubRoutines", "catch_exception"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
386 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
387 |
address start = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
388 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
389 |
// Registers alive |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
390 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
391 |
// R16_thread |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
392 |
// R3_ARG1 - address of pending exception |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
393 |
// R4_ARG2 - return address in call stub |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
394 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
395 |
const Register exception_file = R21_tmp1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
396 |
const Register exception_line = R22_tmp2; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
397 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
398 |
__ load_const(exception_file, (void*)__FILE__); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
399 |
__ load_const(exception_line, (void*)__LINE__); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
400 |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
23221
diff
changeset
|
401 |
__ std(R3_ARG1, in_bytes(JavaThread::pending_exception_offset()), R16_thread); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
402 |
// store into `char *' |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
23221
diff
changeset
|
403 |
__ std(exception_file, in_bytes(JavaThread::exception_file_offset()), R16_thread); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
404 |
// store into `int' |
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
23221
diff
changeset
|
405 |
__ stw(exception_line, in_bytes(JavaThread::exception_line_offset()), R16_thread); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
406 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
407 |
// complete return to VM |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
408 |
assert(StubRoutines::_call_stub_return_address != NULL, "must have been generated before"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
409 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
410 |
__ mtlr(R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
411 |
// continue in call stub |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
412 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
413 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
414 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
415 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
416 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
417 |
// Continuation point for runtime calls returning with a pending |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
418 |
// exception. The pending exception check happened in the runtime |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
419 |
// or native call stub. The pending exception in Thread is |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
420 |
// converted into a Java-level exception. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
421 |
// |
30303 | 422 |
// Read: |
423 |
// |
|
424 |
// LR: The pc the runtime library callee wants to return to. |
|
425 |
// Since the exception occurred in the callee, the return pc |
|
426 |
// from the point of view of Java is the exception pc. |
|
427 |
// thread: Needed for method handles. |
|
428 |
// |
|
429 |
// Invalidate: |
|
430 |
// |
|
431 |
// volatile registers (except below). |
|
432 |
// |
|
433 |
// Update: |
|
434 |
// |
|
435 |
// R4_ARG2: exception |
|
436 |
// |
|
437 |
// (LR is unchanged and is live out). |
|
438 |
// |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
439 |
address generate_forward_exception() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
440 |
StubCodeMark mark(this, "StubRoutines", "forward_exception"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
441 |
address start = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
442 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
443 |
#if !defined(PRODUCT) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
444 |
if (VerifyOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
445 |
// Get pending exception oop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
446 |
__ ld(R3_ARG1, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
447 |
in_bytes(Thread::pending_exception_offset()), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
448 |
R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
449 |
// Make sure that this code is only executed if there is a pending exception. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
450 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
451 |
Label L; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
452 |
__ cmpdi(CCR0, R3_ARG1, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
453 |
__ bne(CCR0, L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
454 |
__ stop("StubRoutines::forward exception: no pending exception (1)"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
455 |
__ bind(L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
456 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
457 |
__ verify_oop(R3_ARG1, "StubRoutines::forward exception: not an oop"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
458 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
459 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
460 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
461 |
// Save LR/CR and copy exception pc (LR) into R4_ARG2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
462 |
__ save_LR_CR(R4_ARG2); |
23211 | 463 |
__ push_frame_reg_args(0, R0); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
464 |
// Find exception handler. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
465 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
466 |
SharedRuntime::exception_handler_for_return_address), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
467 |
R16_thread, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
468 |
R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
469 |
// Copy handler's address. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
470 |
__ mtctr(R3_RET); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
471 |
__ pop_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
472 |
__ restore_LR_CR(R0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
473 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
474 |
// Set up the arguments for the exception handler: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
475 |
// - R3_ARG1: exception oop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
476 |
// - R4_ARG2: exception pc. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
477 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
478 |
// Load pending exception oop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
479 |
__ ld(R3_ARG1, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
480 |
in_bytes(Thread::pending_exception_offset()), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
481 |
R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
482 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
483 |
// The exception pc is the return address in the caller. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
484 |
// Must load it into R4_ARG2. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
485 |
__ mflr(R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
486 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
487 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
488 |
// Make sure exception is set. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
489 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
490 |
Label L; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
491 |
__ cmpdi(CCR0, R3_ARG1, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
492 |
__ bne(CCR0, L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
493 |
__ stop("StubRoutines::forward exception: no pending exception (2)"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
494 |
__ bind(L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
495 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
496 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
497 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
498 |
// Clear the pending exception. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
499 |
__ li(R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
500 |
__ std(R0, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
501 |
in_bytes(Thread::pending_exception_offset()), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
502 |
R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
503 |
// Jump to exception handler. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
504 |
__ bctr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
505 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
506 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
507 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
508 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
509 |
#undef __ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
510 |
#define __ masm-> |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
511 |
// Continuation point for throwing of implicit exceptions that are |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
512 |
// not handled in the current activation. Fabricates an exception |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
513 |
// oop and initiates normal exception dispatching in this |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
514 |
// frame. Only callee-saved registers are preserved (through the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
515 |
// normal register window / RegisterMap handling). If the compiler |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
516 |
// needs all registers to be preserved between the fault point and |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
517 |
// the exception handler then it must assume responsibility for that |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
518 |
// in AbstractCompiler::continuation_for_implicit_null_exception or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
519 |
// continuation_for_implicit_division_by_zero_exception. All other |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
520 |
// implicit exceptions (e.g., NullPointerException or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
521 |
// AbstractMethodError on entry) are either at call sites or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
522 |
// otherwise assume that stack unwinding will be initiated, so |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
523 |
// caller saved registers were assumed volatile in the compiler. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
524 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
525 |
// Note that we generate only this stub into a RuntimeStub, because |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
526 |
// it needs to be properly traversed and ignored during GC, so we |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
527 |
// change the meaning of the "__" macro within this method. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
528 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
529 |
// Note: the routine set_pc_not_at_call_for_caller in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
530 |
// SharedRuntime.cpp requires that this code be generated into a |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
531 |
// RuntimeStub. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
532 |
address generate_throw_exception(const char* name, address runtime_entry, bool restore_saved_exception_pc, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
533 |
Register arg1 = noreg, Register arg2 = noreg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
534 |
CodeBuffer code(name, 1024 DEBUG_ONLY(+ 512), 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
535 |
MacroAssembler* masm = new MacroAssembler(&code); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
536 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
537 |
OopMapSet* oop_maps = new OopMapSet(); |
23211 | 538 |
int frame_size_in_bytes = frame::abi_reg_args_size; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
539 |
OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
540 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
541 |
address start = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
542 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
543 |
__ save_LR_CR(R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
544 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
545 |
// Push a frame. |
23211 | 546 |
__ push_frame_reg_args(0, R11_scratch1); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
547 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
548 |
address frame_complete_pc = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
549 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
550 |
if (restore_saved_exception_pc) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
551 |
__ unimplemented("StubGenerator::throw_exception with restore_saved_exception_pc", 74); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
552 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
553 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
554 |
// Note that we always have a runtime stub frame on the top of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
555 |
// stack by this point. Remember the offset of the instruction |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
556 |
// whose address will be moved to R11_scratch1. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
557 |
address gc_map_pc = __ get_PC_trash_LR(R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
558 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
559 |
__ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
560 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
561 |
__ mr(R3_ARG1, R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
562 |
if (arg1 != noreg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
563 |
__ mr(R4_ARG2, arg1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
564 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
565 |
if (arg2 != noreg) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
566 |
__ mr(R5_ARG3, arg2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
567 |
} |
23211 | 568 |
#if defined(ABI_ELFv2) |
569 |
__ call_c(runtime_entry, relocInfo::none); |
|
570 |
#else |
|
571 |
__ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, runtime_entry), relocInfo::none); |
|
572 |
#endif |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
573 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
574 |
// Set an oopmap for the call site. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
575 |
oop_maps->add_gc_map((int)(gc_map_pc - start), map); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
576 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
577 |
__ reset_last_Java_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
578 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
579 |
#ifdef ASSERT |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
580 |
// Make sure that this code is only executed if there is a pending |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
581 |
// exception. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
582 |
{ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
583 |
Label L; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
584 |
__ ld(R0, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
585 |
in_bytes(Thread::pending_exception_offset()), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
586 |
R16_thread); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
587 |
__ cmpdi(CCR0, R0, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
588 |
__ bne(CCR0, L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
589 |
__ stop("StubRoutines::throw_exception: no pending exception"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
590 |
__ bind(L); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
591 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
592 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
593 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
594 |
// Pop frame. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
595 |
__ pop_frame(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
596 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
597 |
__ restore_LR_CR(R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
598 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
599 |
__ load_const(R11_scratch1, StubRoutines::forward_exception_entry()); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
600 |
__ mtctr(R11_scratch1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
601 |
__ bctr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
602 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
603 |
// Create runtime stub with OopMap. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
604 |
RuntimeStub* stub = |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
605 |
RuntimeStub::new_runtime_stub(name, &code, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
606 |
/*frame_complete=*/ (int)(frame_complete_pc - start), |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
607 |
frame_size_in_bytes/wordSize, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
608 |
oop_maps, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
609 |
false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
610 |
return stub->entry_point(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
611 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
612 |
#undef __ |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
613 |
#define __ _masm-> |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
614 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
615 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
616 |
// Support for void zero_words_aligned8(HeapWord* to, size_t count) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
617 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
618 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
619 |
// to: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
620 |
// count: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
621 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
622 |
// Destroys: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
623 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
624 |
address generate_zero_words_aligned8() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
625 |
StubCodeMark mark(this, "StubRoutines", "zero_words_aligned8"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
626 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
627 |
// Implemented as in ClearArray. |
23211 | 628 |
address start = __ function_entry(); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
629 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
630 |
Register base_ptr_reg = R3_ARG1; // tohw (needs to be 8b aligned) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
631 |
Register cnt_dwords_reg = R4_ARG2; // count (in dwords) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
632 |
Register tmp1_reg = R5_ARG3; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
633 |
Register tmp2_reg = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
634 |
Register zero_reg = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
635 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
636 |
// Procedure for large arrays (uses data cache block zero instruction). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
637 |
Label dwloop, fast, fastloop, restloop, lastdword, done; |
35085 | 638 |
int cl_size = VM_Version::L1_data_cache_line_size(); |
639 |
int cl_dwords = cl_size >> 3; |
|
640 |
int cl_dwordaddr_bits = exact_log2(cl_dwords); |
|
641 |
int min_dcbz = 2; // Needs to be positive, apply dcbz only to at least min_dcbz cache lines. |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
642 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
643 |
// Clear up to 128byte boundary if long enough, dword_cnt=(16-(base>>3))%16. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
644 |
__ dcbtst(base_ptr_reg); // Indicate write access to first cache line ... |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
645 |
__ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if number of dwords is even. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
646 |
__ srdi_(tmp1_reg, cnt_dwords_reg, 1); // number of double dwords |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
647 |
__ load_const_optimized(zero_reg, 0L); // Use as zero register. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
648 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
649 |
__ cmpdi(CCR1, tmp2_reg, 0); // cnt_dwords even? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
650 |
__ beq(CCR0, lastdword); // size <= 1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
651 |
__ mtctr(tmp1_reg); // Speculatively preload counter for rest loop (>0). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
652 |
__ cmpdi(CCR0, cnt_dwords_reg, (min_dcbz+1)*cl_dwords-1); // Big enough to ensure >=min_dcbz cache lines are included? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
653 |
__ neg(tmp1_reg, base_ptr_reg); // bit 0..58: bogus, bit 57..60: (16-(base>>3))%16, bit 61..63: 000 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
654 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
655 |
__ blt(CCR0, restloop); // Too small. (<31=(2*cl_dwords)-1 is sufficient, but bigger performs better.) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
656 |
__ rldicl_(tmp1_reg, tmp1_reg, 64-3, 64-cl_dwordaddr_bits); // Extract number of dwords to 128byte boundary=(16-(base>>3))%16. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
657 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
658 |
__ beq(CCR0, fast); // already 128byte aligned |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
659 |
__ mtctr(tmp1_reg); // Set ctr to hit 128byte boundary (0<ctr<cnt). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
660 |
__ subf(cnt_dwords_reg, tmp1_reg, cnt_dwords_reg); // rest (>0 since size>=256-8) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
661 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
662 |
// Clear in first cache line dword-by-dword if not already 128byte aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
663 |
__ bind(dwloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
664 |
__ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
665 |
__ addi(base_ptr_reg, base_ptr_reg, 8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
666 |
__ bdnz(dwloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
667 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
668 |
// clear 128byte blocks |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
669 |
__ bind(fast); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
670 |
__ srdi(tmp1_reg, cnt_dwords_reg, cl_dwordaddr_bits); // loop count for 128byte loop (>0 since size>=256-8) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
671 |
__ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if rest even |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
672 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
673 |
__ mtctr(tmp1_reg); // load counter |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
674 |
__ cmpdi(CCR1, tmp2_reg, 0); // rest even? |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
675 |
__ rldicl_(tmp1_reg, cnt_dwords_reg, 63, 65-cl_dwordaddr_bits); // rest in double dwords |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
676 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
677 |
__ bind(fastloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
678 |
__ dcbz(base_ptr_reg); // Clear 128byte aligned block. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
679 |
__ addi(base_ptr_reg, base_ptr_reg, cl_size); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
680 |
__ bdnz(fastloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
681 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
682 |
//__ dcbtst(base_ptr_reg); // Indicate write access to last cache line. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
683 |
__ beq(CCR0, lastdword); // rest<=1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
684 |
__ mtctr(tmp1_reg); // load counter |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
685 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
686 |
// Clear rest. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
687 |
__ bind(restloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
688 |
__ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
689 |
__ std(zero_reg, 8, base_ptr_reg); // Clear 8byte aligned block. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
690 |
__ addi(base_ptr_reg, base_ptr_reg, 16); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
691 |
__ bdnz(restloop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
692 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
693 |
__ bind(lastdword); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
694 |
__ beq(CCR1, done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
695 |
__ std(zero_reg, 0, base_ptr_reg); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
696 |
__ bind(done); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
697 |
__ blr(); // return |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
698 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
699 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
700 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
701 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
702 |
#if !defined(PRODUCT) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
703 |
// Wrapper which calls oopDesc::is_oop_or_null() |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
704 |
// Only called by MacroAssembler::verify_oop |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
705 |
static void verify_oop_helper(const char* message, oop o) { |
46968
9119841280f4
8160399: is_oop_or_null involves undefined behavior
coleenp
parents:
46789
diff
changeset
|
706 |
if (!oopDesc::is_oop_or_null(o)) { |
33142
399fdb935d28
8138733: Fix build: gcc < 4.8 doesn't grok -Wno-format-zero-length added in 8080775
goetz
parents:
32596
diff
changeset
|
707 |
fatal("%s", message); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
708 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
709 |
++ StubRoutines::_verify_oop_count; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
710 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
711 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
712 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
713 |
// Return address of code to be called from code generated by |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
714 |
// MacroAssembler::verify_oop. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
715 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
716 |
// Don't generate, rather use C++ code. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
717 |
address generate_verify_oop() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
718 |
// this is actually a `FunctionDescriptor*'. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
719 |
address start = 0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
720 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
721 |
#if !defined(PRODUCT) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
722 |
start = CAST_FROM_FN_PTR(address, verify_oop_helper); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
723 |
#endif |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
724 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
725 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
726 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
727 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
728 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
729 |
// -XX:+OptimizeFill : convert fill/copy loops into intrinsic |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
730 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
731 |
// The code is implemented(ported from sparc) as we believe it benefits JVM98, however |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
732 |
// tracing(-XX:+TraceOptimizeFill) shows the intrinsic replacement doesn't happen at all! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
733 |
// |
22861 | 734 |
// Source code in function is_range_check_if() shows that OptimizeFill relaxed the condition |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
735 |
// for turning on loop predication optimization, and hence the behavior of "array range check" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
736 |
// and "loop invariant check" could be influenced, which potentially boosted JVM98. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
737 |
// |
22861 | 738 |
// Generate stub for disjoint short fill. If "aligned" is true, the |
739 |
// "to" address is assumed to be heapword aligned. |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
740 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
741 |
// Arguments for generated stub: |
22861 | 742 |
// to: R3_ARG1 |
743 |
// value: R4_ARG2 |
|
744 |
// count: R5_ARG3 treated as signed |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
745 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
746 |
address generate_fill(BasicType t, bool aligned, const char* name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
747 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 748 |
address start = __ function_entry(); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
749 |
|
22861 | 750 |
const Register to = R3_ARG1; // source array address |
751 |
const Register value = R4_ARG2; // fill value |
|
752 |
const Register count = R5_ARG3; // elements count |
|
753 |
const Register temp = R6_ARG4; // temp register |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
754 |
|
22861 | 755 |
//assert_clean_int(count, O3); // Make sure 'count' is clean int. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
756 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
757 |
Label L_exit, L_skip_align1, L_skip_align2, L_fill_byte; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
758 |
Label L_fill_2_bytes, L_fill_4_bytes, L_fill_elements, L_fill_32_bytes; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
759 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
760 |
int shift = -1; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
761 |
switch (t) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
762 |
case T_BYTE: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
763 |
shift = 2; |
22861 | 764 |
// Clone bytes (zero extend not needed because store instructions below ignore high order bytes). |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
765 |
__ rldimi(value, value, 8, 48); // 8 bit -> 16 bit |
22861 | 766 |
__ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
767 |
__ blt(CCR0, L_fill_elements); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
768 |
__ rldimi(value, value, 16, 32); // 16 bit -> 32 bit |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
769 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
770 |
case T_SHORT: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
771 |
shift = 1; |
22861 | 772 |
// Clone bytes (zero extend not needed because store instructions below ignore high order bytes). |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
773 |
__ rldimi(value, value, 16, 32); // 16 bit -> 32 bit |
22861 | 774 |
__ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
775 |
__ blt(CCR0, L_fill_elements); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
776 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
777 |
case T_INT: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
778 |
shift = 0; |
22861 | 779 |
__ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
780 |
__ blt(CCR0, L_fill_4_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
781 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
782 |
default: ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
783 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
784 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
785 |
if (!aligned && (t == T_BYTE || t == T_SHORT)) { |
22861 | 786 |
// Align source address at 4 bytes address boundary. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
787 |
if (t == T_BYTE) { |
22861 | 788 |
// One byte misalignment happens only for byte arrays. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
789 |
__ andi_(temp, to, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
790 |
__ beq(CCR0, L_skip_align1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
791 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
792 |
__ addi(to, to, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
793 |
__ addi(count, count, -1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
794 |
__ bind(L_skip_align1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
795 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
796 |
// Two bytes misalignment happens only for byte and short (char) arrays. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
797 |
__ andi_(temp, to, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
798 |
__ beq(CCR0, L_skip_align2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
799 |
__ sth(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
800 |
__ addi(to, to, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
801 |
__ addi(count, count, -(1 << (shift - 1))); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
802 |
__ bind(L_skip_align2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
803 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
804 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
805 |
if (!aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
806 |
// Align to 8 bytes, we know we are 4 byte aligned to start. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
807 |
__ andi_(temp, to, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
808 |
__ beq(CCR0, L_fill_32_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
809 |
__ stw(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
810 |
__ addi(to, to, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
811 |
__ addi(count, count, -(1 << shift)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
812 |
__ bind(L_fill_32_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
813 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
814 |
|
22861 | 815 |
__ li(temp, 8<<shift); // Prepare for 32 byte loop. |
816 |
// Clone bytes int->long as above. |
|
817 |
__ rldimi(value, value, 32, 0); // 32 bit -> 64 bit |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
818 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
819 |
Label L_check_fill_8_bytes; |
22861 | 820 |
// Fill 32-byte chunks. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
821 |
__ subf_(count, temp, count); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
822 |
__ blt(CCR0, L_check_fill_8_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
823 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
824 |
Label L_fill_32_bytes_loop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
825 |
__ align(32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
826 |
__ bind(L_fill_32_bytes_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
827 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
828 |
__ std(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
829 |
__ std(value, 8, to); |
22861 | 830 |
__ subf_(count, temp, count); // Update count. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
831 |
__ std(value, 16, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
832 |
__ std(value, 24, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
833 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
834 |
__ addi(to, to, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
835 |
__ bge(CCR0, L_fill_32_bytes_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
836 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
837 |
__ bind(L_check_fill_8_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
838 |
__ add_(count, temp, count); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
839 |
__ beq(CCR0, L_exit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
840 |
__ addic_(count, count, -(2 << shift)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
841 |
__ blt(CCR0, L_fill_4_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
842 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
843 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
844 |
// Length is too short, just fill 8 bytes at a time. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
845 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
846 |
Label L_fill_8_bytes_loop; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
847 |
__ bind(L_fill_8_bytes_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
848 |
__ std(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
849 |
__ addic_(count, count, -(2 << shift)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
850 |
__ addi(to, to, 8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
851 |
__ bge(CCR0, L_fill_8_bytes_loop); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
852 |
|
22861 | 853 |
// Fill trailing 4 bytes. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
854 |
__ bind(L_fill_4_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
855 |
__ andi_(temp, count, 1<<shift); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
856 |
__ beq(CCR0, L_fill_2_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
857 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
858 |
__ stw(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
859 |
if (t == T_BYTE || t == T_SHORT) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
860 |
__ addi(to, to, 4); |
22861 | 861 |
// Fill trailing 2 bytes. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
862 |
__ bind(L_fill_2_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
863 |
__ andi_(temp, count, 1<<(shift-1)); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
864 |
__ beq(CCR0, L_fill_byte); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
865 |
__ sth(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
866 |
if (t == T_BYTE) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
867 |
__ addi(to, to, 2); |
22861 | 868 |
// Fill trailing byte. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
869 |
__ bind(L_fill_byte); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
870 |
__ andi_(count, count, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
871 |
__ beq(CCR0, L_exit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
872 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
873 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
874 |
__ bind(L_fill_byte); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
875 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
876 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
877 |
__ bind(L_fill_2_bytes); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
878 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
879 |
__ bind(L_exit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
880 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
881 |
|
22861 | 882 |
// Handle copies less than 8 bytes. Int is handled elsewhere. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
883 |
if (t == T_BYTE) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
884 |
__ bind(L_fill_elements); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
885 |
Label L_fill_2, L_fill_4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
886 |
__ andi_(temp, count, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
887 |
__ beq(CCR0, L_fill_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
888 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
889 |
__ addi(to, to, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
890 |
__ bind(L_fill_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
891 |
__ andi_(temp, count, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
892 |
__ beq(CCR0, L_fill_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
893 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
894 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
895 |
__ addi(to, to, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
896 |
__ bind(L_fill_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
897 |
__ andi_(temp, count, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
898 |
__ beq(CCR0, L_exit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
899 |
__ stb(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
900 |
__ stb(value, 1, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
901 |
__ stb(value, 2, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
902 |
__ stb(value, 3, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
903 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
904 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
905 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
906 |
if (t == T_SHORT) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
907 |
Label L_fill_2; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
908 |
__ bind(L_fill_elements); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
909 |
__ andi_(temp, count, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
910 |
__ beq(CCR0, L_fill_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
911 |
__ sth(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
912 |
__ addi(to, to, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
913 |
__ bind(L_fill_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
914 |
__ andi_(temp, count, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
915 |
__ beq(CCR0, L_exit); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
916 |
__ sth(value, 0, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
917 |
__ sth(value, 2, to); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
918 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
919 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
920 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
921 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
922 |
|
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
923 |
inline void assert_positive_int(Register count) { |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
924 |
#ifdef ASSERT |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
925 |
__ srdi_(R0, count, 31); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
926 |
__ asm_assert_eq("missing zero extend", 0xAFFE); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
927 |
#endif |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
928 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
929 |
|
22861 | 930 |
// Generate overlap test for array copy stubs. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
931 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
932 |
// Input: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
933 |
// R3_ARG1 - from |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
934 |
// R4_ARG2 - to |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
935 |
// R5_ARG3 - element count |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
936 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
937 |
void array_overlap_test(address no_overlap_target, int log2_elem_size) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
938 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
939 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
940 |
|
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
941 |
assert_positive_int(R5_ARG3); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
942 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
943 |
__ subf(tmp1, R3_ARG1, R4_ARG2); // distance in bytes |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
944 |
__ sldi(tmp2, R5_ARG3, log2_elem_size); // size in bytes |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
945 |
__ cmpld(CCR0, R3_ARG1, R4_ARG2); // Use unsigned comparison! |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
946 |
__ cmpld(CCR1, tmp1, tmp2); |
35085 | 947 |
__ crnand(CCR0, Assembler::less, CCR1, Assembler::less); |
948 |
// Overlaps if Src before dst and distance smaller than size. |
|
949 |
// Branch to forward copy routine otherwise (within range of 32kB). |
|
950 |
__ bc(Assembler::bcondCRbiIs1, Assembler::bi0(CCR0, Assembler::less), no_overlap_target); |
|
951 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
952 |
// need to copy backwards |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
953 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
954 |
|
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
955 |
// This is common errorexit stub for UnsafeCopyMemory. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
956 |
address generate_unsafecopy_common_error_exit() { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
957 |
address start_pc = __ pc(); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
958 |
Register tmp1 = R6_ARG4; |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
959 |
// probably copy stub would have changed value reset it. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
960 |
if (VM_Version::has_mfdscr()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
961 |
__ load_const_optimized(tmp1, VM_Version::_dscr_val); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
962 |
__ mtdscr(tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
963 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
964 |
__ li(R3_RET, 0); // return 0 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
965 |
__ blr(); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
966 |
return start_pc; |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
967 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
968 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
969 |
// The guideline in the implementations of generate_disjoint_xxx_copy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
970 |
// (xxx=byte,short,int,long,oop) is to copy as many elements as possible with |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
971 |
// single instructions, but to avoid alignment interrupts (see subsequent |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
972 |
// comment). Furthermore, we try to minimize misaligned access, even |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
973 |
// though they cause no alignment interrupt. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
974 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
975 |
// In Big-Endian mode, the PowerPC architecture requires implementations to |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
976 |
// handle automatically misaligned integer halfword and word accesses, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
977 |
// word-aligned integer doubleword accesses, and word-aligned floating-point |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
978 |
// accesses. Other accesses may or may not generate an Alignment interrupt |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
979 |
// depending on the implementation. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
980 |
// Alignment interrupt handling may require on the order of hundreds of cycles, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
981 |
// so every effort should be made to avoid misaligned memory values. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
982 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
983 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
984 |
// Generate stub for disjoint byte copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
985 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
986 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
987 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
988 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
989 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
990 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
991 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
992 |
address generate_disjoint_byte_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
993 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 994 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
995 |
assert_positive_int(R5_ARG3); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
996 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
997 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
998 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
999 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1000 |
Register tmp4 = R9_ARG7; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1001 |
|
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1002 |
VectorSRegister tmp_vsr1 = VSR1; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1003 |
VectorSRegister tmp_vsr2 = VSR2; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1004 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1005 |
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9, l_10; |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1006 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1007 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1008 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1009 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1010 |
// Don't try anything fancy if arrays don't have many elements. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1011 |
__ li(tmp3, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1012 |
__ cmpwi(CCR0, R5_ARG3, 17); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1013 |
__ ble(CCR0, l_6); // copy 4 at a time |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1014 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1015 |
if (!aligned) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1016 |
__ xorr(tmp1, R3_ARG1, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1017 |
__ andi_(tmp1, tmp1, 3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1018 |
__ bne(CCR0, l_6); // If arrays don't have the same alignment mod 4, do 4 element copy. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1019 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1020 |
// Copy elements if necessary to align to 4 bytes. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1021 |
__ neg(tmp1, R3_ARG1); // Compute distance to alignment boundary. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1022 |
__ andi_(tmp1, tmp1, 3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1023 |
__ beq(CCR0, l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1024 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1025 |
__ subf(R5_ARG3, tmp1, R5_ARG3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1026 |
__ bind(l_9); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1027 |
__ lbz(tmp2, 0, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1028 |
__ addic_(tmp1, tmp1, -1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1029 |
__ stb(tmp2, 0, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1030 |
__ addi(R3_ARG1, R3_ARG1, 1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1031 |
__ addi(R4_ARG2, R4_ARG2, 1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1032 |
__ bne(CCR0, l_9); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1033 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1034 |
__ bind(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1035 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1036 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1037 |
// copy 8 elements at a time |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1038 |
__ xorr(tmp2, R3_ARG1, R4_ARG2); // skip if src & dest have differing alignment mod 8 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1039 |
__ andi_(tmp1, tmp2, 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1040 |
__ bne(CCR0, l_7); // not same alignment -> to or from is aligned -> copy 8 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1041 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1042 |
// copy a 2-element word if necessary to align to 8 bytes |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1043 |
__ andi_(R0, R3_ARG1, 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1044 |
__ beq(CCR0, l_7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1045 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1046 |
__ lwzx(tmp2, R3_ARG1, tmp3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1047 |
__ addi(R5_ARG3, R5_ARG3, -4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1048 |
__ stwx(tmp2, R4_ARG2, tmp3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1049 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1050 |
__ addi(R3_ARG1, R3_ARG1, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1051 |
__ addi(R4_ARG2, R4_ARG2, 4); |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1052 |
} |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1053 |
__ bind(l_7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1054 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1055 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1056 |
__ cmpwi(CCR0, R5_ARG3, 31); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1057 |
__ ble(CCR0, l_6); // copy 2 at a time if less than 32 elements remain |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1058 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1059 |
__ srdi(tmp1, R5_ARG3, 5); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1060 |
__ andi_(R5_ARG3, R5_ARG3, 31); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1061 |
__ mtctr(tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1062 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1063 |
if (!VM_Version::has_vsx()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1064 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1065 |
__ bind(l_8); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1066 |
// Use unrolled version for mass copying (copy 32 elements a time) |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1067 |
// Load feeding store gets zero latency on Power6, however not on Power5. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1068 |
// Therefore, the following sequence is made for the good of both. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1069 |
__ ld(tmp1, 0, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1070 |
__ ld(tmp2, 8, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1071 |
__ ld(tmp3, 16, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1072 |
__ ld(tmp4, 24, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1073 |
__ std(tmp1, 0, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1074 |
__ std(tmp2, 8, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1075 |
__ std(tmp3, 16, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1076 |
__ std(tmp4, 24, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1077 |
__ addi(R3_ARG1, R3_ARG1, 32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1078 |
__ addi(R4_ARG2, R4_ARG2, 32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1079 |
__ bdnz(l_8); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1080 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1081 |
} else { // Processor supports VSX, so use it to mass copy. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1082 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1083 |
// Prefetch the data into the L2 cache. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1084 |
__ dcbt(R3_ARG1, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1085 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1086 |
// If supported set DSCR pre-fetch to deepest. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1087 |
if (VM_Version::has_mfdscr()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1088 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1089 |
__ mtdscr(tmp2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1090 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1091 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1092 |
__ li(tmp1, 16); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1093 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1094 |
// Backbranch target aligned to 32-byte. Not 16-byte align as |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1095 |
// loop contains < 8 instructions that fit inside a single |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1096 |
// i-cache sector. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1097 |
__ align(32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1098 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1099 |
__ bind(l_10); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1100 |
// Use loop with VSX load/store instructions to |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1101 |
// copy 32 elements a time. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1102 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load src |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1103 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1104 |
__ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1105 |
__ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1106 |
__ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1107 |
__ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1108 |
__ bdnz(l_10); // Dec CTR and loop if not zero. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1109 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1110 |
// Restore DSCR pre-fetch value. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1111 |
if (VM_Version::has_mfdscr()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1112 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1113 |
__ mtdscr(tmp2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1114 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1115 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1116 |
} // VSX |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1117 |
} // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1118 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1119 |
__ bind(l_6); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1120 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1121 |
// copy 4 elements at a time |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1122 |
__ cmpwi(CCR0, R5_ARG3, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1123 |
__ blt(CCR0, l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1124 |
__ srdi(tmp1, R5_ARG3, 2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1125 |
__ mtctr(tmp1); // is > 0 |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1126 |
__ andi_(R5_ARG3, R5_ARG3, 3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1127 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1128 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1129 |
__ addi(R3_ARG1, R3_ARG1, -4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1130 |
__ addi(R4_ARG2, R4_ARG2, -4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1131 |
__ bind(l_3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1132 |
__ lwzu(tmp2, 4, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1133 |
__ stwu(tmp2, 4, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1134 |
__ bdnz(l_3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1135 |
__ addi(R3_ARG1, R3_ARG1, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1136 |
__ addi(R4_ARG2, R4_ARG2, 4); |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1137 |
} |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1138 |
|
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1139 |
// do single element copy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1140 |
__ bind(l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1141 |
__ cmpwi(CCR0, R5_ARG3, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1142 |
__ beq(CCR0, l_4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1143 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1144 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1145 |
__ mtctr(R5_ARG3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1146 |
__ addi(R3_ARG1, R3_ARG1, -1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1147 |
__ addi(R4_ARG2, R4_ARG2, -1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1148 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1149 |
__ bind(l_5); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1150 |
__ lbzu(tmp2, 1, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1151 |
__ stbu(tmp2, 1, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1152 |
__ bdnz(l_5); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1153 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1154 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1155 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1156 |
__ bind(l_4); |
35085 | 1157 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1158 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1159 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1160 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1161 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1162 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1163 |
// Generate stub for conjoint byte copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1164 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1165 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1166 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1167 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1168 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1169 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1170 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1171 |
address generate_conjoint_byte_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1172 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 1173 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1174 |
assert_positive_int(R5_ARG3); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1175 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1176 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1177 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1178 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1179 |
|
30303 | 1180 |
address nooverlap_target = aligned ? |
35085 | 1181 |
STUB_ENTRY(arrayof_jbyte_disjoint_arraycopy) : |
1182 |
STUB_ENTRY(jbyte_disjoint_arraycopy); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1183 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1184 |
array_overlap_test(nooverlap_target, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1185 |
// Do reverse copy. We assume the case of actual overlap is rare enough |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1186 |
// that we don't have to optimize it. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1187 |
Label l_1, l_2; |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1188 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1189 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1190 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1191 |
__ b(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1192 |
__ bind(l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1193 |
__ stbx(tmp1, R4_ARG2, R5_ARG3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1194 |
__ bind(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1195 |
__ addic_(R5_ARG3, R5_ARG3, -1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1196 |
__ lbzx(tmp1, R3_ARG1, R5_ARG3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1197 |
__ bge(CCR0, l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1198 |
} |
35085 | 1199 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1200 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1201 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1202 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1203 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1204 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1205 |
// Generate stub for disjoint short copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1206 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1207 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1208 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1209 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1210 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1211 |
// elm.count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1212 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1213 |
// Strategy for aligned==true: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1214 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1215 |
// If length <= 9: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1216 |
// 1. copy 2 elements at a time (l_6) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1217 |
// 2. copy last element if original element count was odd (l_1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1218 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1219 |
// If length > 9: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1220 |
// 1. copy 4 elements at a time until less than 4 elements are left (l_7) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1221 |
// 2. copy 2 elements at a time until less than 2 elements are left (l_6) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1222 |
// 3. copy last element if one was left in step 2. (l_1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1223 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1224 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1225 |
// Strategy for aligned==false: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1226 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1227 |
// If length <= 9: same as aligned==true case, but NOTE: load/stores |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1228 |
// can be unaligned (see comment below) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1229 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1230 |
// If length > 9: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1231 |
// 1. continue with step 6. if the alignment of from and to mod 4 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1232 |
// is different. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1233 |
// 2. align from and to to 4 bytes by copying 1 element if necessary |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1234 |
// 3. at l_2 from and to are 4 byte aligned; continue with |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1235 |
// 5. if they cannot be aligned to 8 bytes because they have |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1236 |
// got different alignment mod 8. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1237 |
// 4. at this point we know that both, from and to, have the same |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1238 |
// alignment mod 8, now copy one element if necessary to get |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1239 |
// 8 byte alignment of from and to. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1240 |
// 5. copy 4 elements at a time until less than 4 elements are |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1241 |
// left; depending on step 3. all load/stores are aligned or |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1242 |
// either all loads or all stores are unaligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1243 |
// 6. copy 2 elements at a time until less than 2 elements are |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1244 |
// left (l_6); arriving here from step 1., there is a chance |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1245 |
// that all accesses are unaligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1246 |
// 7. copy last element if one was left in step 6. (l_1) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1247 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1248 |
// There are unaligned data accesses using integer load/store |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1249 |
// instructions in this stub. POWER allows such accesses. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1250 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1251 |
// According to the manuals (PowerISA_V2.06_PUBLIC, Book II, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1252 |
// Chapter 2: Effect of Operand Placement on Performance) unaligned |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1253 |
// integer load/stores have good performance. Only unaligned |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1254 |
// floating point load/stores can have poor performance. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1255 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1256 |
// TODO: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1257 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1258 |
// 1. check if aligning the backbranch target of loops is beneficial |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1259 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1260 |
address generate_disjoint_short_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1261 |
StubCodeMark mark(this, "StubRoutines", name); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1262 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1263 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1264 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1265 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1266 |
Register tmp4 = R9_ARG7; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1267 |
|
39236
c9d756fa846e
8154156: PPC64: improve array copy stubs by using vector instructions
mdoerr
parents:
38209
diff
changeset
|
1268 |
VectorSRegister tmp_vsr1 = VSR1; |
c9d756fa846e
8154156: PPC64: improve array copy stubs by using vector instructions
mdoerr
parents:
38209
diff
changeset
|
1269 |
VectorSRegister tmp_vsr2 = VSR2; |
c9d756fa846e
8154156: PPC64: improve array copy stubs by using vector instructions
mdoerr
parents:
38209
diff
changeset
|
1270 |
|
23211 | 1271 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1272 |
assert_positive_int(R5_ARG3); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1273 |
|
39236
c9d756fa846e
8154156: PPC64: improve array copy stubs by using vector instructions
mdoerr
parents:
38209
diff
changeset
|
1274 |
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9; |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1275 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1276 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1277 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1278 |
// don't try anything fancy if arrays don't have many elements |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1279 |
__ li(tmp3, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1280 |
__ cmpwi(CCR0, R5_ARG3, 9); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1281 |
__ ble(CCR0, l_6); // copy 2 at a time |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1282 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1283 |
if (!aligned) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1284 |
__ xorr(tmp1, R3_ARG1, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1285 |
__ andi_(tmp1, tmp1, 3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1286 |
__ bne(CCR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1287 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1288 |
// At this point it is guaranteed that both, from and to have the same alignment mod 4. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1289 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1290 |
// Copy 1 element if necessary to align to 4 bytes. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1291 |
__ andi_(tmp1, R3_ARG1, 3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1292 |
__ beq(CCR0, l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1293 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1294 |
__ lhz(tmp2, 0, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1295 |
__ addi(R3_ARG1, R3_ARG1, 2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1296 |
__ sth(tmp2, 0, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1297 |
__ addi(R4_ARG2, R4_ARG2, 2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1298 |
__ addi(R5_ARG3, R5_ARG3, -1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1299 |
__ bind(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1300 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1301 |
// At this point the positions of both, from and to, are at least 4 byte aligned. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1302 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1303 |
// Copy 4 elements at a time. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1304 |
// Align to 8 bytes, but only if both, from and to, have same alignment mod 8. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1305 |
__ xorr(tmp2, R3_ARG1, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1306 |
__ andi_(tmp1, tmp2, 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1307 |
__ bne(CCR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1308 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1309 |
// Copy a 2-element word if necessary to align to 8 bytes. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1310 |
__ andi_(R0, R3_ARG1, 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1311 |
__ beq(CCR0, l_7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1312 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1313 |
__ lwzx(tmp2, R3_ARG1, tmp3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1314 |
__ addi(R5_ARG3, R5_ARG3, -2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1315 |
__ stwx(tmp2, R4_ARG2, tmp3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1316 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1317 |
__ addi(R3_ARG1, R3_ARG1, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1318 |
__ addi(R4_ARG2, R4_ARG2, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1319 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1320 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1321 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1322 |
__ bind(l_7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1323 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1324 |
// Copy 4 elements at a time; either the loads or the stores can |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1325 |
// be unaligned if aligned == false. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1326 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1327 |
{ // FasterArrayCopy |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1328 |
__ cmpwi(CCR0, R5_ARG3, 15); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1329 |
__ ble(CCR0, l_6); // copy 2 at a time if less than 16 elements remain |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1330 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1331 |
__ srdi(tmp1, R5_ARG3, 4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1332 |
__ andi_(R5_ARG3, R5_ARG3, 15); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1333 |
__ mtctr(tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1334 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1335 |
if (!VM_Version::has_vsx()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1336 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1337 |
__ bind(l_8); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1338 |
// Use unrolled version for mass copying (copy 16 elements a time). |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1339 |
// Load feeding store gets zero latency on Power6, however not on Power5. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1340 |
// Therefore, the following sequence is made for the good of both. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1341 |
__ ld(tmp1, 0, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1342 |
__ ld(tmp2, 8, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1343 |
__ ld(tmp3, 16, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1344 |
__ ld(tmp4, 24, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1345 |
__ std(tmp1, 0, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1346 |
__ std(tmp2, 8, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1347 |
__ std(tmp3, 16, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1348 |
__ std(tmp4, 24, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1349 |
__ addi(R3_ARG1, R3_ARG1, 32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1350 |
__ addi(R4_ARG2, R4_ARG2, 32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1351 |
__ bdnz(l_8); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1352 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1353 |
} else { // Processor supports VSX, so use it to mass copy. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1354 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1355 |
// Prefetch src data into L2 cache. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1356 |
__ dcbt(R3_ARG1, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1357 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1358 |
// If supported set DSCR pre-fetch to deepest. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1359 |
if (VM_Version::has_mfdscr()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1360 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1361 |
__ mtdscr(tmp2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1362 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1363 |
__ li(tmp1, 16); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1364 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1365 |
// Backbranch target aligned to 32-byte. It's not aligned 16-byte |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1366 |
// as loop contains < 8 instructions that fit inside a single |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1367 |
// i-cache sector. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1368 |
__ align(32); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1369 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1370 |
__ bind(l_9); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1371 |
// Use loop with VSX load/store instructions to |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1372 |
// copy 16 elements a time. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1373 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load from src. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1374 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1375 |
__ lxvd2x(tmp_vsr2, R3_ARG1, tmp1); // Load from src + 16. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1376 |
__ stxvd2x(tmp_vsr2, R4_ARG2, tmp1); // Store to dst + 16. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1377 |
__ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1378 |
__ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1379 |
__ bdnz(l_9); // Dec CTR and loop if not zero. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1380 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1381 |
// Restore DSCR pre-fetch value. |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1382 |
if (VM_Version::has_mfdscr()) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1383 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1384 |
__ mtdscr(tmp2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1385 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1386 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1387 |
} |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1388 |
} // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1389 |
__ bind(l_6); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1390 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1391 |
// copy 2 elements at a time |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1392 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1393 |
__ cmpwi(CCR0, R5_ARG3, 2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1394 |
__ blt(CCR0, l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1395 |
__ srdi(tmp1, R5_ARG3, 1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1396 |
__ andi_(R5_ARG3, R5_ARG3, 1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1397 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1398 |
__ addi(R3_ARG1, R3_ARG1, -4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1399 |
__ addi(R4_ARG2, R4_ARG2, -4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1400 |
__ mtctr(tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1401 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1402 |
__ bind(l_3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1403 |
__ lwzu(tmp2, 4, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1404 |
__ stwu(tmp2, 4, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1405 |
__ bdnz(l_3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1406 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1407 |
__ addi(R3_ARG1, R3_ARG1, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1408 |
__ addi(R4_ARG2, R4_ARG2, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1409 |
} |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1410 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1411 |
// do single element copy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1412 |
__ bind(l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1413 |
__ cmpwi(CCR0, R5_ARG3, 0); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1414 |
__ beq(CCR0, l_4); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1415 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1416 |
{ // FasterArrayCopy |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1417 |
__ mtctr(R5_ARG3); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1418 |
__ addi(R3_ARG1, R3_ARG1, -2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1419 |
__ addi(R4_ARG2, R4_ARG2, -2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1420 |
|
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1421 |
__ bind(l_5); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1422 |
__ lhzu(tmp2, 2, R3_ARG1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1423 |
__ sthu(tmp2, 2, R4_ARG2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1424 |
__ bdnz(l_5); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1425 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1426 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1427 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1428 |
__ bind(l_4); |
35085 | 1429 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1430 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1431 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1432 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1433 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1434 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1435 |
// Generate stub for conjoint short copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1436 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1437 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1438 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1439 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1440 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1441 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1442 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1443 |
address generate_conjoint_short_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1444 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 1445 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1446 |
assert_positive_int(R5_ARG3); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1447 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1448 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1449 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1450 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1451 |
|
23211 | 1452 |
address nooverlap_target = aligned ? |
35085 | 1453 |
STUB_ENTRY(arrayof_jshort_disjoint_arraycopy) : |
1454 |
STUB_ENTRY(jshort_disjoint_arraycopy); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1455 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1456 |
array_overlap_test(nooverlap_target, 1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1457 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1458 |
Label l_1, l_2; |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1459 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1460 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1461 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1462 |
__ sldi(tmp1, R5_ARG3, 1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1463 |
__ b(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1464 |
__ bind(l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1465 |
__ sthx(tmp2, R4_ARG2, tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1466 |
__ bind(l_2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1467 |
__ addic_(tmp1, tmp1, -2); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1468 |
__ lhzx(tmp2, R3_ARG1, tmp1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1469 |
__ bge(CCR0, l_1); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1470 |
} |
35085 | 1471 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1472 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1473 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1474 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1475 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1476 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1477 |
// Generate core code for disjoint int copy (and oop copy on 32-bit). If "aligned" |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1478 |
// is true, the "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1479 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1480 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1481 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1482 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1483 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1484 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1485 |
void generate_disjoint_int_copy_core(bool aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1486 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1487 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1488 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1489 |
Register tmp4 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1490 |
|
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1491 |
VectorSRegister tmp_vsr1 = VSR1; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1492 |
VectorSRegister tmp_vsr2 = VSR2; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1493 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1494 |
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7; |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1495 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1496 |
// for short arrays, just do single element copy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1497 |
__ li(tmp3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1498 |
__ cmpwi(CCR0, R5_ARG3, 5); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1499 |
__ ble(CCR0, l_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1500 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1501 |
if (!aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1502 |
// check if arrays have same alignment mod 8. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1503 |
__ xorr(tmp1, R3_ARG1, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1504 |
__ andi_(R0, tmp1, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1505 |
// Not the same alignment, but ld and std just need to be 4 byte aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1506 |
__ bne(CCR0, l_4); // to OR from is 8 byte aligned -> copy 2 at a time |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1507 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1508 |
// copy 1 element to align to and from on an 8 byte boundary |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1509 |
__ andi_(R0, R3_ARG1, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1510 |
__ beq(CCR0, l_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1511 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1512 |
__ lwzx(tmp2, R3_ARG1, tmp3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1513 |
__ addi(R5_ARG3, R5_ARG3, -1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1514 |
__ stwx(tmp2, R4_ARG2, tmp3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1515 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1516 |
__ addi(R3_ARG1, R3_ARG1, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1517 |
__ addi(R4_ARG2, R4_ARG2, 4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1518 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1519 |
__ bind(l_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1520 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1521 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1522 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1523 |
__ cmpwi(CCR0, R5_ARG3, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1524 |
__ ble(CCR0, l_2); // copy 1 at a time if less than 8 elements remain |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1525 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1526 |
__ srdi(tmp1, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1527 |
__ andi_(R5_ARG3, R5_ARG3, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1528 |
__ mtctr(tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1529 |
|
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1530 |
if (!VM_Version::has_vsx()) { |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1531 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1532 |
__ bind(l_6); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1533 |
// Use unrolled version for mass copying (copy 8 elements a time). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1534 |
// Load feeding store gets zero latency on power6, however not on power 5. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1535 |
// Therefore, the following sequence is made for the good of both. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1536 |
__ ld(tmp1, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1537 |
__ ld(tmp2, 8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1538 |
__ ld(tmp3, 16, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1539 |
__ ld(tmp4, 24, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1540 |
__ std(tmp1, 0, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1541 |
__ std(tmp2, 8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1542 |
__ std(tmp3, 16, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1543 |
__ std(tmp4, 24, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1544 |
__ addi(R3_ARG1, R3_ARG1, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1545 |
__ addi(R4_ARG2, R4_ARG2, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1546 |
__ bdnz(l_6); |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1547 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1548 |
} else { // Processor supports VSX, so use it to mass copy. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1549 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1550 |
// Prefetch the data into the L2 cache. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1551 |
__ dcbt(R3_ARG1, 0); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1552 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1553 |
// If supported set DSCR pre-fetch to deepest. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1554 |
if (VM_Version::has_mfdscr()) { |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1555 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1556 |
__ mtdscr(tmp2); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1557 |
} |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1558 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1559 |
__ li(tmp1, 16); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1560 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1561 |
// Backbranch target aligned to 32-byte. Not 16-byte align as |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1562 |
// loop contains < 8 instructions that fit inside a single |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1563 |
// i-cache sector. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1564 |
__ align(32); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1565 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1566 |
__ bind(l_7); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1567 |
// Use loop with VSX load/store instructions to |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1568 |
// copy 8 elements a time. |
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1569 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load src |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1570 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1571 |
__ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1572 |
__ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1573 |
__ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1574 |
__ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1575 |
__ bdnz(l_7); // Dec CTR and loop if not zero. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1576 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1577 |
// Restore DSCR pre-fetch value. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1578 |
if (VM_Version::has_mfdscr()) { |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1579 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1580 |
__ mtdscr(tmp2); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1581 |
} |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1582 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1583 |
} // VSX |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1584 |
} // FasterArrayCopy |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1585 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1586 |
// copy 1 element at a time |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1587 |
__ bind(l_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1588 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1589 |
__ beq(CCR0, l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1590 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1591 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1592 |
__ mtctr(R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1593 |
__ addi(R3_ARG1, R3_ARG1, -4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1594 |
__ addi(R4_ARG2, R4_ARG2, -4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1595 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1596 |
__ bind(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1597 |
__ lwzu(tmp2, 4, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1598 |
__ stwu(tmp2, 4, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1599 |
__ bdnz(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1600 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1601 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1602 |
__ bind(l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1603 |
return; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1604 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1605 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1606 |
// Generate stub for disjoint int copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1607 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1608 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1609 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1610 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1611 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1612 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1613 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1614 |
address generate_disjoint_int_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1615 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 1616 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1617 |
assert_positive_int(R5_ARG3); |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1618 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1619 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1620 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1621 |
generate_disjoint_int_copy_core(aligned); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1622 |
} |
35085 | 1623 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1624 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1625 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1626 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1627 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1628 |
// Generate core code for conjoint int copy (and oop copy on |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1629 |
// 32-bit). If "aligned" is true, the "from" and "to" addresses |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1630 |
// are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1631 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1632 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1633 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1634 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1635 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1636 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1637 |
void generate_conjoint_int_copy_core(bool aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1638 |
// Do reverse copy. We assume the case of actual overlap is rare enough |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1639 |
// that we don't have to optimize it. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1640 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1641 |
Label l_1, l_2, l_3, l_4, l_5, l_6, l_7; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1642 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1643 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1644 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1645 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1646 |
Register tmp4 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1647 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1648 |
VectorSRegister tmp_vsr1 = VSR1; |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1649 |
VectorSRegister tmp_vsr2 = VSR2; |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1650 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1651 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1652 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1653 |
__ beq(CCR0, l_6); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1654 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1655 |
__ sldi(R5_ARG3, R5_ARG3, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1656 |
__ add(R3_ARG1, R3_ARG1, R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1657 |
__ add(R4_ARG2, R4_ARG2, R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1658 |
__ srdi(R5_ARG3, R5_ARG3, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1659 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1660 |
if (!aligned) { |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1661 |
// check if arrays have same alignment mod 8. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1662 |
__ xorr(tmp1, R3_ARG1, R4_ARG2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1663 |
__ andi_(R0, tmp1, 7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1664 |
// Not the same alignment, but ld and std just need to be 4 byte aligned. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1665 |
__ bne(CCR0, l_7); // to OR from is 8 byte aligned -> copy 2 at a time |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1666 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1667 |
// copy 1 element to align to and from on an 8 byte boundary |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1668 |
__ andi_(R0, R3_ARG1, 7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1669 |
__ beq(CCR0, l_7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1670 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1671 |
__ addi(R3_ARG1, R3_ARG1, -4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1672 |
__ addi(R4_ARG2, R4_ARG2, -4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1673 |
__ addi(R5_ARG3, R5_ARG3, -1); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1674 |
__ lwzx(tmp2, R3_ARG1); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1675 |
__ stwx(tmp2, R4_ARG2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1676 |
__ bind(l_7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1677 |
} |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1678 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1679 |
__ cmpwi(CCR0, R5_ARG3, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1680 |
__ ble(CCR0, l_5); // copy 1 at a time if less than 8 elements remain |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1681 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1682 |
__ srdi(tmp1, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1683 |
__ andi(R5_ARG3, R5_ARG3, 7); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1684 |
__ mtctr(tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1685 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1686 |
if (!VM_Version::has_vsx()) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1687 |
__ bind(l_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1688 |
// Use unrolled version for mass copying (copy 4 elements a time). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1689 |
// Load feeding store gets zero latency on Power6, however not on Power5. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1690 |
// Therefore, the following sequence is made for the good of both. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1691 |
__ addi(R3_ARG1, R3_ARG1, -32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1692 |
__ addi(R4_ARG2, R4_ARG2, -32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1693 |
__ ld(tmp4, 24, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1694 |
__ ld(tmp3, 16, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1695 |
__ ld(tmp2, 8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1696 |
__ ld(tmp1, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1697 |
__ std(tmp4, 24, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1698 |
__ std(tmp3, 16, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1699 |
__ std(tmp2, 8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1700 |
__ std(tmp1, 0, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1701 |
__ bdnz(l_4); |
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1702 |
} else { // Processor supports VSX, so use it to mass copy. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1703 |
// Prefetch the data into the L2 cache. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1704 |
__ dcbt(R3_ARG1, 0); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1705 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1706 |
// If supported set DSCR pre-fetch to deepest. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1707 |
if (VM_Version::has_mfdscr()) { |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1708 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1709 |
__ mtdscr(tmp2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1710 |
} |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1711 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1712 |
__ li(tmp1, 16); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1713 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1714 |
// Backbranch target aligned to 32-byte. Not 16-byte align as |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1715 |
// loop contains < 8 instructions that fit inside a single |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1716 |
// i-cache sector. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1717 |
__ align(32); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1718 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1719 |
__ bind(l_4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1720 |
// Use loop with VSX load/store instructions to |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1721 |
// copy 8 elements a time. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1722 |
__ addi(R3_ARG1, R3_ARG1, -32); // Update src-=32 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1723 |
__ addi(R4_ARG2, R4_ARG2, -32); // Update dsc-=32 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1724 |
__ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src+16 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1725 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load src |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1726 |
__ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst+16 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1727 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1728 |
__ bdnz(l_4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1729 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1730 |
// Restore DSCR pre-fetch value. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1731 |
if (VM_Version::has_mfdscr()) { |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1732 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1733 |
__ mtdscr(tmp2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1734 |
} |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1735 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1736 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1737 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1738 |
__ beq(CCR0, l_6); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1739 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1740 |
__ bind(l_5); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1741 |
__ mtctr(R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1742 |
__ bind(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1743 |
__ lwz(R0, -4, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1744 |
__ stw(R0, -4, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1745 |
__ addi(R3_ARG1, R3_ARG1, -4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1746 |
__ addi(R4_ARG2, R4_ARG2, -4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1747 |
__ bdnz(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1748 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1749 |
__ bind(l_6); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1750 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1751 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1752 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1753 |
// Generate stub for conjoint int copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1754 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1755 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1756 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1757 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1758 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1759 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1760 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1761 |
address generate_conjoint_int_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1762 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 1763 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1764 |
assert_positive_int(R5_ARG3); |
23211 | 1765 |
address nooverlap_target = aligned ? |
35085 | 1766 |
STUB_ENTRY(arrayof_jint_disjoint_arraycopy) : |
1767 |
STUB_ENTRY(jint_disjoint_arraycopy); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1768 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1769 |
array_overlap_test(nooverlap_target, 2); |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1770 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1771 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1772 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1773 |
generate_conjoint_int_copy_core(aligned); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1774 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1775 |
|
35085 | 1776 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1777 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1778 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1779 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1780 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1781 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1782 |
// Generate core code for disjoint long copy (and oop copy on |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1783 |
// 64-bit). If "aligned" is true, the "from" and "to" addresses |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1784 |
// are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1785 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1786 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1787 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1788 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1789 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1790 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1791 |
void generate_disjoint_long_copy_core(bool aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1792 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1793 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1794 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1795 |
Register tmp4 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1796 |
|
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1797 |
Label l_1, l_2, l_3, l_4, l_5; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1798 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1799 |
VectorSRegister tmp_vsr1 = VSR1; |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1800 |
VectorSRegister tmp_vsr2 = VSR2; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1801 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1802 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1803 |
__ cmpwi(CCR0, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1804 |
__ ble(CCR0, l_3); // copy 1 at a time if less than 4 elements remain |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1805 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1806 |
__ srdi(tmp1, R5_ARG3, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1807 |
__ andi_(R5_ARG3, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1808 |
__ mtctr(tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1809 |
|
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1810 |
if (!VM_Version::has_vsx()) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1811 |
__ bind(l_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1812 |
// Use unrolled version for mass copying (copy 4 elements a time). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1813 |
// Load feeding store gets zero latency on Power6, however not on Power5. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1814 |
// Therefore, the following sequence is made for the good of both. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1815 |
__ ld(tmp1, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1816 |
__ ld(tmp2, 8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1817 |
__ ld(tmp3, 16, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1818 |
__ ld(tmp4, 24, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1819 |
__ std(tmp1, 0, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1820 |
__ std(tmp2, 8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1821 |
__ std(tmp3, 16, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1822 |
__ std(tmp4, 24, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1823 |
__ addi(R3_ARG1, R3_ARG1, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1824 |
__ addi(R4_ARG2, R4_ARG2, 32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1825 |
__ bdnz(l_4); |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1826 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1827 |
} else { // Processor supports VSX, so use it to mass copy. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1828 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1829 |
// Prefetch the data into the L2 cache. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1830 |
__ dcbt(R3_ARG1, 0); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1831 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1832 |
// If supported set DSCR pre-fetch to deepest. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1833 |
if (VM_Version::has_mfdscr()) { |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1834 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1835 |
__ mtdscr(tmp2); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1836 |
} |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1837 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1838 |
__ li(tmp1, 16); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1839 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1840 |
// Backbranch target aligned to 32-byte. Not 16-byte align as |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1841 |
// loop contains < 8 instructions that fit inside a single |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1842 |
// i-cache sector. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1843 |
__ align(32); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1844 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1845 |
__ bind(l_5); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1846 |
// Use loop with VSX load/store instructions to |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1847 |
// copy 4 elements a time. |
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1848 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load src |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1849 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst |
39420
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1850 |
__ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src + 16 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1851 |
__ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1852 |
__ addi(R3_ARG1, R3_ARG1, 32); // Update src+=32 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1853 |
__ addi(R4_ARG2, R4_ARG2, 32); // Update dsc+=32 |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1854 |
__ bdnz(l_5); // Dec CTR and loop if not zero. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1855 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1856 |
// Restore DSCR pre-fetch value. |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1857 |
if (VM_Version::has_mfdscr()) { |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1858 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1859 |
__ mtdscr(tmp2); |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1860 |
} |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1861 |
|
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1862 |
} // VSX |
987528901b83
8158232: PPC64: improve byte, int and long array copy stubs by using VSX instructions
mdoerr
parents:
39259
diff
changeset
|
1863 |
} // FasterArrayCopy |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1864 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1865 |
// copy 1 element at a time |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1866 |
__ bind(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1867 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1868 |
__ beq(CCR0, l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1869 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1870 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1871 |
__ mtctr(R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1872 |
__ addi(R3_ARG1, R3_ARG1, -8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1873 |
__ addi(R4_ARG2, R4_ARG2, -8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1874 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1875 |
__ bind(l_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1876 |
__ ldu(R0, 8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1877 |
__ stdu(R0, 8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1878 |
__ bdnz(l_2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1879 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1880 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1881 |
__ bind(l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1882 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1883 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1884 |
// Generate stub for disjoint long copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1885 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1886 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1887 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1888 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1889 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1890 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1891 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1892 |
address generate_disjoint_long_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1893 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 1894 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
1895 |
assert_positive_int(R5_ARG3); |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1896 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1897 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1898 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1899 |
generate_disjoint_long_copy_core(aligned); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1900 |
} |
35085 | 1901 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1902 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1903 |
|
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
1904 |
return start; |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1905 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1906 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1907 |
// Generate core code for conjoint long copy (and oop copy on |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1908 |
// 64-bit). If "aligned" is true, the "from" and "to" addresses |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1909 |
// are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1910 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1911 |
// Arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1912 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1913 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1914 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1915 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1916 |
void generate_conjoint_long_copy_core(bool aligned) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1917 |
Register tmp1 = R6_ARG4; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1918 |
Register tmp2 = R7_ARG5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1919 |
Register tmp3 = R8_ARG6; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1920 |
Register tmp4 = R0; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1921 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1922 |
VectorSRegister tmp_vsr1 = VSR1; |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1923 |
VectorSRegister tmp_vsr2 = VSR2; |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1924 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1925 |
Label l_1, l_2, l_3, l_4, l_5; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1926 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1927 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1928 |
__ beq(CCR0, l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1929 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1930 |
{ // FasterArrayCopy |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1931 |
__ sldi(R5_ARG3, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1932 |
__ add(R3_ARG1, R3_ARG1, R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1933 |
__ add(R4_ARG2, R4_ARG2, R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1934 |
__ srdi(R5_ARG3, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1935 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1936 |
__ cmpwi(CCR0, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1937 |
__ ble(CCR0, l_5); // copy 1 at a time if less than 4 elements remain |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1938 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1939 |
__ srdi(tmp1, R5_ARG3, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1940 |
__ andi(R5_ARG3, R5_ARG3, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1941 |
__ mtctr(tmp1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1942 |
|
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1943 |
if (!VM_Version::has_vsx()) { |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1944 |
__ bind(l_4); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1945 |
// Use unrolled version for mass copying (copy 4 elements a time). |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1946 |
// Load feeding store gets zero latency on Power6, however not on Power5. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1947 |
// Therefore, the following sequence is made for the good of both. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1948 |
__ addi(R3_ARG1, R3_ARG1, -32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1949 |
__ addi(R4_ARG2, R4_ARG2, -32); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1950 |
__ ld(tmp4, 24, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1951 |
__ ld(tmp3, 16, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1952 |
__ ld(tmp2, 8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1953 |
__ ld(tmp1, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1954 |
__ std(tmp4, 24, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1955 |
__ std(tmp3, 16, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1956 |
__ std(tmp2, 8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1957 |
__ std(tmp1, 0, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1958 |
__ bdnz(l_4); |
42034
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1959 |
} else { // Processor supports VSX, so use it to mass copy. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1960 |
// Prefetch the data into the L2 cache. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1961 |
__ dcbt(R3_ARG1, 0); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1962 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1963 |
// If supported set DSCR pre-fetch to deepest. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1964 |
if (VM_Version::has_mfdscr()) { |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1965 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val | 7); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1966 |
__ mtdscr(tmp2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1967 |
} |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1968 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1969 |
__ li(tmp1, 16); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1970 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1971 |
// Backbranch target aligned to 32-byte. Not 16-byte align as |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1972 |
// loop contains < 8 instructions that fit inside a single |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1973 |
// i-cache sector. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1974 |
__ align(32); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1975 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1976 |
__ bind(l_4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1977 |
// Use loop with VSX load/store instructions to |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1978 |
// copy 4 elements a time. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1979 |
__ addi(R3_ARG1, R3_ARG1, -32); // Update src-=32 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1980 |
__ addi(R4_ARG2, R4_ARG2, -32); // Update dsc-=32 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1981 |
__ lxvd2x(tmp_vsr2, tmp1, R3_ARG1); // Load src+16 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1982 |
__ lxvd2x(tmp_vsr1, R3_ARG1); // Load src |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1983 |
__ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst+16 |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1984 |
__ stxvd2x(tmp_vsr1, R4_ARG2); // Store to dst |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1985 |
__ bdnz(l_4); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1986 |
|
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1987 |
// Restore DSCR pre-fetch value. |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1988 |
if (VM_Version::has_mfdscr()) { |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1989 |
__ load_const_optimized(tmp2, VM_Version::_dscr_val); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1990 |
__ mtdscr(tmp2); |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1991 |
} |
f1e6a21095f5
8166684: PPC64: implement intrinsic code with vector instructions for Unsafe.copyMemory()
mdoerr
parents:
41334
diff
changeset
|
1992 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1993 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1994 |
__ cmpwi(CCR0, R5_ARG3, 0); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1995 |
__ beq(CCR0, l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1996 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1997 |
__ bind(l_5); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1998 |
__ mtctr(R5_ARG3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
1999 |
__ bind(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2000 |
__ ld(R0, -8, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2001 |
__ std(R0, -8, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2002 |
__ addi(R3_ARG1, R3_ARG1, -8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2003 |
__ addi(R4_ARG2, R4_ARG2, -8); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2004 |
__ bdnz(l_3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2005 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2006 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2007 |
__ bind(l_1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2008 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2009 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2010 |
// Generate stub for conjoint long copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2011 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2012 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2013 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2014 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2015 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2016 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2017 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2018 |
address generate_conjoint_long_copy(bool aligned, const char * name) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2019 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 2020 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2021 |
assert_positive_int(R5_ARG3); |
23211 | 2022 |
address nooverlap_target = aligned ? |
35085 | 2023 |
STUB_ENTRY(arrayof_jlong_disjoint_arraycopy) : |
2024 |
STUB_ENTRY(jlong_disjoint_arraycopy); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2025 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2026 |
array_overlap_test(nooverlap_target, 3); |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
2027 |
{ |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
2028 |
// UnsafeCopyMemory page error: continue at UnsafeCopyMemory common_error_exit |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
2029 |
UnsafeCopyMemoryMark ucmm(this, !aligned, false); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
2030 |
generate_conjoint_long_copy_core(aligned); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
2031 |
} |
35085 | 2032 |
__ li(R3_RET, 0); // return 0 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2033 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2034 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2035 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2036 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2037 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2038 |
// Generate stub for conjoint oop copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2039 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2040 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2041 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2042 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2043 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2044 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2045 |
// dest_uninitialized: G1 support |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2046 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2047 |
address generate_conjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2048 |
StubCodeMark mark(this, "StubRoutines", name); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2049 |
|
23211 | 2050 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2051 |
assert_positive_int(R5_ARG3); |
23211 | 2052 |
address nooverlap_target = aligned ? |
35085 | 2053 |
STUB_ENTRY(arrayof_oop_disjoint_arraycopy) : |
2054 |
STUB_ENTRY(oop_disjoint_arraycopy); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2055 |
|
50728 | 2056 |
DecoratorSet decorators = IN_HEAP | IS_ARRAY; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2057 |
if (dest_uninitialized) { |
50728 | 2058 |
decorators |= IS_DEST_UNINITIALIZED; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2059 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2060 |
if (aligned) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2061 |
decorators |= ARRAYCOPY_ALIGNED; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2062 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2063 |
|
49754 | 2064 |
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2065 |
bs->arraycopy_prologue(_masm, decorators, T_OBJECT, R3_ARG1, R4_ARG2, R5_ARG3, noreg, noreg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2066 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2067 |
if (UseCompressedOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2068 |
array_overlap_test(nooverlap_target, 2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2069 |
generate_conjoint_int_copy_core(aligned); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2070 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2071 |
array_overlap_test(nooverlap_target, 3); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2072 |
generate_conjoint_long_copy_core(aligned); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2073 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2074 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2075 |
bs->arraycopy_epilogue(_masm, decorators, T_OBJECT, R4_ARG2, R5_ARG3, noreg); |
35085 | 2076 |
__ li(R3_RET, 0); // return 0 |
2077 |
__ blr(); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2078 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2079 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2080 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2081 |
// Generate stub for disjoint oop copy. If "aligned" is true, the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2082 |
// "from" and "to" addresses are assumed to be heapword aligned. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2083 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2084 |
// Arguments for generated stub: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2085 |
// from: R3_ARG1 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2086 |
// to: R4_ARG2 |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2087 |
// count: R5_ARG3 treated as signed |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2088 |
// dest_uninitialized: G1 support |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2089 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2090 |
address generate_disjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2091 |
StubCodeMark mark(this, "StubRoutines", name); |
23211 | 2092 |
address start = __ function_entry(); |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2093 |
assert_positive_int(R5_ARG3); |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2094 |
|
50728 | 2095 |
DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2096 |
if (dest_uninitialized) { |
50728 | 2097 |
decorators |= IS_DEST_UNINITIALIZED; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2098 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2099 |
if (aligned) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2100 |
decorators |= ARRAYCOPY_ALIGNED; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2101 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2102 |
|
49754 | 2103 |
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2104 |
bs->arraycopy_prologue(_masm, decorators, T_OBJECT, R3_ARG1, R4_ARG2, R5_ARG3, noreg, noreg); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2105 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2106 |
if (UseCompressedOops) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2107 |
generate_disjoint_int_copy_core(aligned); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2108 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2109 |
generate_disjoint_long_copy_core(aligned); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2110 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2111 |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2112 |
bs->arraycopy_epilogue(_masm, decorators, T_OBJECT, R4_ARG2, R5_ARG3, noreg); |
35085 | 2113 |
__ li(R3_RET, 0); // return 0 |
2114 |
__ blr(); |
|
2115 |
||
2116 |
return start; |
|
2117 |
} |
|
2118 |
||
2119 |
||
2120 |
// Helper for generating a dynamic type check. |
|
2121 |
// Smashes only the given temp registers. |
|
2122 |
void generate_type_check(Register sub_klass, |
|
2123 |
Register super_check_offset, |
|
2124 |
Register super_klass, |
|
2125 |
Register temp, |
|
2126 |
Label& L_success) { |
|
2127 |
assert_different_registers(sub_klass, super_check_offset, super_klass); |
|
2128 |
||
2129 |
BLOCK_COMMENT("type_check:"); |
|
2130 |
||
2131 |
Label L_miss; |
|
2132 |
||
2133 |
__ check_klass_subtype_fast_path(sub_klass, super_klass, temp, R0, &L_success, &L_miss, NULL, |
|
2134 |
super_check_offset); |
|
2135 |
__ check_klass_subtype_slow_path(sub_klass, super_klass, temp, R0, &L_success, NULL); |
|
2136 |
||
2137 |
// Fall through on failure! |
|
2138 |
__ bind(L_miss); |
|
2139 |
} |
|
2140 |
||
2141 |
||
2142 |
// Generate stub for checked oop copy. |
|
2143 |
// |
|
2144 |
// Arguments for generated stub: |
|
2145 |
// from: R3 |
|
2146 |
// to: R4 |
|
2147 |
// count: R5 treated as signed |
|
2148 |
// ckoff: R6 (super_check_offset) |
|
2149 |
// ckval: R7 (super_klass) |
|
2150 |
// ret: R3 zero for success; (-1^K) where K is partial transfer count |
|
2151 |
// |
|
2152 |
address generate_checkcast_copy(const char *name, bool dest_uninitialized) { |
|
2153 |
||
2154 |
const Register R3_from = R3_ARG1; // source array address |
|
2155 |
const Register R4_to = R4_ARG2; // destination array address |
|
2156 |
const Register R5_count = R5_ARG3; // elements count |
|
2157 |
const Register R6_ckoff = R6_ARG4; // super_check_offset |
|
2158 |
const Register R7_ckval = R7_ARG5; // super_klass |
|
2159 |
||
2160 |
const Register R8_offset = R8_ARG6; // loop var, with stride wordSize |
|
2161 |
const Register R9_remain = R9_ARG7; // loop var, with stride -1 |
|
2162 |
const Register R10_oop = R10_ARG8; // actual oop copied |
|
2163 |
const Register R11_klass = R11_scratch1; // oop._klass |
|
2164 |
const Register R12_tmp = R12_scratch2; |
|
2165 |
||
2166 |
const Register R2_minus1 = R2; |
|
2167 |
||
2168 |
//__ align(CodeEntryAlignment); |
|
2169 |
StubCodeMark mark(this, "StubRoutines", name); |
|
2170 |
address start = __ function_entry(); |
|
2171 |
||
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2172 |
// Assert that int is 64 bit sign extended and arrays are not conjoint. |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2173 |
#ifdef ASSERT |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2174 |
{ |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2175 |
assert_positive_int(R5_ARG3); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2176 |
const Register tmp1 = R11_scratch1, tmp2 = R12_scratch2; |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2177 |
Label no_overlap; |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2178 |
__ subf(tmp1, R3_ARG1, R4_ARG2); // distance in bytes |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2179 |
__ sldi(tmp2, R5_ARG3, LogBytesPerHeapOop); // size in bytes |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2180 |
__ cmpld(CCR0, R3_ARG1, R4_ARG2); // Use unsigned comparison! |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2181 |
__ cmpld(CCR1, tmp1, tmp2); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2182 |
__ crnand(CCR0, Assembler::less, CCR1, Assembler::less); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2183 |
// Overlaps if Src before dst and distance smaller than size. |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2184 |
// Branch to forward copy routine otherwise. |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2185 |
__ blt(CCR0, no_overlap); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2186 |
__ stop("overlap in checkcast_copy", 0x9543); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2187 |
__ bind(no_overlap); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2188 |
} |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
2189 |
#endif |
35085 | 2190 |
|
50728 | 2191 |
DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_CHECKCAST; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2192 |
if (dest_uninitialized) { |
50728 | 2193 |
decorators |= IS_DEST_UNINITIALIZED; |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2194 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2195 |
|
49754 | 2196 |
BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2197 |
bs->arraycopy_prologue(_masm, decorators, T_OBJECT, R3_from, R4_to, R5_count, /* preserve: */ R6_ckoff, R7_ckval); |
35085 | 2198 |
|
2199 |
//inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr, R12_tmp, R3_RET); |
|
2200 |
||
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2201 |
Label load_element, store_element, store_null, success, do_epilogue; |
35085 | 2202 |
__ or_(R9_remain, R5_count, R5_count); // Initialize loop index, and test it. |
2203 |
__ li(R8_offset, 0); // Offset from start of arrays. |
|
2204 |
__ li(R2_minus1, -1); |
|
2205 |
__ bne(CCR0, load_element); |
|
2206 |
||
2207 |
// Empty array: Nothing to do. |
|
2208 |
__ li(R3_RET, 0); // Return 0 on (trivial) success. |
|
2209 |
__ blr(); |
|
2210 |
||
2211 |
// ======== begin loop ======== |
|
2212 |
// (Entry is load_element.) |
|
2213 |
__ align(OptoLoopAlignment); |
|
2214 |
__ bind(store_element); |
|
2215 |
if (UseCompressedOops) { |
|
2216 |
__ encode_heap_oop_not_null(R10_oop); |
|
2217 |
__ bind(store_null); |
|
2218 |
__ stw(R10_oop, R8_offset, R4_to); |
|
2219 |
} else { |
|
2220 |
__ bind(store_null); |
|
2221 |
__ std(R10_oop, R8_offset, R4_to); |
|
2222 |
} |
|
2223 |
||
2224 |
__ addi(R8_offset, R8_offset, heapOopSize); // Step to next offset. |
|
2225 |
__ add_(R9_remain, R2_minus1, R9_remain); // Decrement the count. |
|
2226 |
__ beq(CCR0, success); |
|
2227 |
||
2228 |
// ======== loop entry is here ======== |
|
2229 |
__ bind(load_element); |
|
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49754
diff
changeset
|
2230 |
__ load_heap_oop(R10_oop, R8_offset, R3_from, R12_tmp, noreg, false, AS_RAW, &store_null); |
35085 | 2231 |
|
2232 |
__ load_klass(R11_klass, R10_oop); // Query the object klass. |
|
2233 |
||
2234 |
generate_type_check(R11_klass, R6_ckoff, R7_ckval, R12_tmp, |
|
2235 |
// Branch to this on success: |
|
2236 |
store_element); |
|
2237 |
// ======== end loop ======== |
|
2238 |
||
2239 |
// It was a real error; we must depend on the caller to finish the job. |
|
2240 |
// Register R9_remain has number of *remaining* oops, R5_count number of *total* oops. |
|
2241 |
// Emit GC store barriers for the oops we have copied (R5_count minus R9_remain), |
|
2242 |
// and report their number to the caller. |
|
2243 |
__ subf_(R5_count, R9_remain, R5_count); |
|
2244 |
__ nand(R3_RET, R5_count, R5_count); // report (-1^K) to caller |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2245 |
__ bne(CCR0, do_epilogue); |
35085 | 2246 |
__ blr(); |
2247 |
||
2248 |
__ bind(success); |
|
2249 |
__ li(R3_RET, 0); |
|
2250 |
||
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2251 |
__ bind(do_epilogue); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2252 |
bs->arraycopy_epilogue(_masm, decorators, T_OBJECT, R4_to, R5_count, /* preserve */ R3_RET); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49455
diff
changeset
|
2253 |
|
35085 | 2254 |
__ blr(); |
2255 |
return start; |
|
2256 |
} |
|
2257 |
||
2258 |
||
2259 |
// Generate 'unsafe' array copy stub. |
|
2260 |
// Though just as safe as the other stubs, it takes an unscaled |
|
2261 |
// size_t argument instead of an element count. |
|
2262 |
// |
|
2263 |
// Arguments for generated stub: |
|
2264 |
// from: R3 |
|
2265 |
// to: R4 |
|
2266 |
// count: R5 byte count, treated as ssize_t, can be zero |
|
2267 |
// |
|
2268 |
// Examines the alignment of the operands and dispatches |
|
2269 |
// to a long, int, short, or byte copy loop. |
|
2270 |
// |
|
2271 |
address generate_unsafe_copy(const char* name, |
|
2272 |
address byte_copy_entry, |
|
2273 |
address short_copy_entry, |
|
2274 |
address int_copy_entry, |
|
2275 |
address long_copy_entry) { |
|
2276 |
||
2277 |
const Register R3_from = R3_ARG1; // source array address |
|
2278 |
const Register R4_to = R4_ARG2; // destination array address |
|
2279 |
const Register R5_count = R5_ARG3; // elements count (as long on PPC64) |
|
2280 |
||
2281 |
const Register R6_bits = R6_ARG4; // test copy of low bits |
|
2282 |
const Register R7_tmp = R7_ARG5; |
|
2283 |
||
2284 |
//__ align(CodeEntryAlignment); |
|
2285 |
StubCodeMark mark(this, "StubRoutines", name); |
|
2286 |
address start = __ function_entry(); |
|
2287 |
||
2288 |
// Bump this on entry, not on exit: |
|
2289 |
//inc_counter_np(SharedRuntime::_unsafe_array_copy_ctr, R6_bits, R7_tmp); |
|
2290 |
||
2291 |
Label short_copy, int_copy, long_copy; |
|
2292 |
||
2293 |
__ orr(R6_bits, R3_from, R4_to); |
|
2294 |
__ orr(R6_bits, R6_bits, R5_count); |
|
2295 |
__ andi_(R0, R6_bits, (BytesPerLong-1)); |
|
2296 |
__ beq(CCR0, long_copy); |
|
2297 |
||
2298 |
__ andi_(R0, R6_bits, (BytesPerInt-1)); |
|
2299 |
__ beq(CCR0, int_copy); |
|
2300 |
||
2301 |
__ andi_(R0, R6_bits, (BytesPerShort-1)); |
|
2302 |
__ beq(CCR0, short_copy); |
|
2303 |
||
2304 |
// byte_copy: |
|
2305 |
__ b(byte_copy_entry); |
|
2306 |
||
2307 |
__ bind(short_copy); |
|
2308 |
__ srwi(R5_count, R5_count, LogBytesPerShort); |
|
2309 |
__ b(short_copy_entry); |
|
2310 |
||
2311 |
__ bind(int_copy); |
|
2312 |
__ srwi(R5_count, R5_count, LogBytesPerInt); |
|
2313 |
__ b(int_copy_entry); |
|
2314 |
||
2315 |
__ bind(long_copy); |
|
2316 |
__ srwi(R5_count, R5_count, LogBytesPerLong); |
|
2317 |
__ b(long_copy_entry); |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2318 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2319 |
return start; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2320 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
2321 |
|
35085 | 2322 |
|
2323 |
// Perform range checks on the proposed arraycopy. |
|
2324 |
// Kills the two temps, but nothing else. |
|
2325 |
// Also, clean the sign bits of src_pos and dst_pos. |
|
2326 |
void arraycopy_range_checks(Register src, // source array oop |
|
2327 |
Register src_pos, // source position |
|
2328 |
Register dst, // destination array oop |
|
2329 |
Register dst_pos, // destination position |
|
2330 |
Register length, // length of copy |
|
2331 |
Register temp1, Register temp2, |
|
2332 |
Label& L_failed) { |
|
2333 |
BLOCK_COMMENT("arraycopy_range_checks:"); |
|
2334 |
||
2335 |
const Register array_length = temp1; // scratch |
|
2336 |
const Register end_pos = temp2; // scratch |
|
2337 |
||
2338 |
// if (src_pos + length > arrayOop(src)->length() ) FAIL; |
|
2339 |
__ lwa(array_length, arrayOopDesc::length_offset_in_bytes(), src); |
|
2340 |
__ add(end_pos, src_pos, length); // src_pos + length |
|
2341 |
__ cmpd(CCR0, end_pos, array_length); |
|
2342 |
__ bgt(CCR0, L_failed); |
|
2343 |
||
2344 |
// if (dst_pos + length > arrayOop(dst)->length() ) FAIL; |
|
2345 |
__ lwa(array_length, arrayOopDesc::length_offset_in_bytes(), dst); |
|
2346 |
__ add(end_pos, dst_pos, length); // src_pos + length |
|
2347 |
__ cmpd(CCR0, end_pos, array_length); |
|
2348 |
__ bgt(CCR0, L_failed); |
|
2349 |
||
2350 |
BLOCK_COMMENT("arraycopy_range_checks done"); |
|
2351 |
} |
|
2352 |
||
2353 |
||
2354 |
// |
|
2355 |
// Generate generic array copy stubs |
|
2356 |
// |
|
2357 |
// Input: |
|
2358 |
// R3 - src oop |
|
2359 |
// R4 - src_pos |
|
2360 |
// R5 - dst oop |
|
2361 |
// R6 - dst_pos |
|
2362 |
// R7 - element count |
|
2363 |
// |
|
2364 |
// Output: |
|
2365 |
// R3 == 0 - success |
|
2366 |
// R3 == -1 - need to call System.arraycopy |
|
2367 |
// |
|
2368 |
address generate_generic_copy(const char *name, |
|
2369 |
address entry_jbyte_arraycopy, |
|
2370 |
address entry_jshort_arraycopy, |
|
2371 |
address entry_jint_arraycopy, |
|
2372 |
address entry_oop_arraycopy, |
|
2373 |
address entry_disjoint_oop_arraycopy, |
|
2374 |
address entry_jlong_arraycopy, |
|
2375 |
address entry_checkcast_arraycopy) { |
|
2376 |
Label L_failed, L_objArray; |
|
2377 |
||
2378 |
// Input registers |
|
2379 |
const Register src = R3_ARG1; // source array oop |
|
2380 |
const Register src_pos = R4_ARG2; // source position |
|
2381 |
const Register dst = R5_ARG3; // destination array oop |
|
2382 |
const Register dst_pos = R6_ARG4; // destination position |
|
2383 |
const Register length = R7_ARG5; // elements count |
|
2384 |
||
2385 |
// registers used as temp |
|
2386 |
const Register src_klass = R8_ARG6; // source array klass |
|
2387 |
const Register dst_klass = R9_ARG7; // destination array klass |
|
2388 |
const Register lh = R10_ARG8; // layout handler |
|
2389 |
const Register temp = R2; |
|
2390 |
||
2391 |
//__ align(CodeEntryAlignment); |
|
2392 |
StubCodeMark mark(this, "StubRoutines", name); |
|
2393 |
address start = __ function_entry(); |
|
2394 |
||
2395 |
// Bump this on entry, not on exit: |
|
2396 |
//inc_counter_np(SharedRuntime::_generic_array_copy_ctr, lh, temp); |
|
2397 |
||
2398 |
// In principle, the int arguments could be dirty. |
|
2399 |
||
2400 |
//----------------------------------------------------------------------- |
|
2401 |
// Assembler stubs will be used for this call to arraycopy |
|
2402 |
// if the following conditions are met: |
|
2403 |
// |
|
2404 |
// (1) src and dst must not be null. |
|
2405 |
// (2) src_pos must not be negative. |
|
2406 |
// (3) dst_pos must not be negative. |
|
2407 |
// (4) length must not be negative. |
|
2408 |
// (5) src klass and dst klass should be the same and not NULL. |
|
2409 |
// (6) src and dst should be arrays. |
|
2410 |
// (7) src_pos + length must not exceed length of src. |
|
2411 |
// (8) dst_pos + length must not exceed length of dst. |
|
2412 |
BLOCK_COMMENT("arraycopy initial argument checks"); |
|
2413 |
||
2414 |
__ cmpdi(CCR1, src, 0); // if (src == NULL) return -1; |
|
2415 |
__ extsw_(src_pos, src_pos); // if (src_pos < 0) return -1; |
|
2416 |
__ cmpdi(CCR5, dst, 0); // if (dst == NULL) return -1; |
|
2417 |
__ cror(CCR1, Assembler::equal, CCR0, Assembler::less); |
|
2418 |
__ extsw_(dst_pos, dst_pos); // if (src_pos < 0) return -1; |
|
2419 |
__ cror(CCR5, Assembler::equal, CCR0, Assembler::less); |
|
2420 |
__ extsw_(length, length); // if (length < 0) return -1; |
|
2421 |
__ cror(CCR1, Assembler::equal, CCR5, Assembler::equal); |
|
2422 |
__ cror(CCR1, Assembler::equal, CCR0, Assembler::less); |
|
2423 |
__ beq(CCR1, L_failed); |
|
2424 |
||
2425 |
BLOCK_COMMENT("arraycopy argument klass checks"); |
|
2426 |
__ load_klass(src_klass, src); |
|
2427 |
__ load_klass(dst_klass, dst); |
|
2428 |
||
2429 |
// Load layout helper |
|
2430 |
// |
|
2431 |
// |array_tag| | header_size | element_type | |log2_element_size| |
|
2432 |
// 32 30 24 16 8 2 0 |
|
2433 |
// |
|
2434 |
// array_tag: typeArray = 0x3, objArray = 0x2, non-array = 0x0 |
|
2435 |
// |
|
2436 |
||
2437 |
int lh_offset = in_bytes(Klass::layout_helper_offset()); |
|
2438 |
||
2439 |
// Load 32-bits signed value. Use br() instruction with it to check icc. |
|
2440 |
__ lwz(lh, lh_offset, src_klass); |
|
2441 |
||
2442 |
// Handle objArrays completely differently... |
|
2443 |
jint objArray_lh = Klass::array_layout_helper(T_OBJECT); |
|
2444 |
__ load_const_optimized(temp, objArray_lh, R0); |
|
2445 |
__ cmpw(CCR0, lh, temp); |
|
2446 |
__ beq(CCR0, L_objArray); |
|
2447 |
||
2448 |
__ cmpd(CCR5, src_klass, dst_klass); // if (src->klass() != dst->klass()) return -1; |
|
2449 |
__ cmpwi(CCR6, lh, Klass::_lh_neutral_value); // if (!src->is_Array()) return -1; |
|
2450 |
||
2451 |
__ crnand(CCR5, Assembler::equal, CCR6, Assembler::less); |
|
2452 |
__ beq(CCR5, L_failed); |
|
2453 |
||
2454 |
// At this point, it is known to be a typeArray (array_tag 0x3). |
|
2455 |
#ifdef ASSERT |
|
2456 |
{ Label L; |
|
2457 |
jint lh_prim_tag_in_place = (Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift); |
|
2458 |
__ load_const_optimized(temp, lh_prim_tag_in_place, R0); |
|
2459 |
__ cmpw(CCR0, lh, temp); |
|
2460 |
__ bge(CCR0, L); |
|
2461 |
__ stop("must be a primitive array"); |
|
2462 |
__ bind(L); |
|
2463 |
} |
|
2464 |
#endif |
|
2465 |
||
2466 |
arraycopy_range_checks(src, src_pos, dst, dst_pos, length, |
|
2467 |
temp, dst_klass, L_failed); |
|
2468 |
||
2469 |
// TypeArrayKlass |
|
2470 |
// |
|
2471 |
// src_addr = (src + array_header_in_bytes()) + (src_pos << log2elemsize); |
|
2472 |
// dst_addr = (dst + array_header_in_bytes()) + (dst_pos << log2elemsize); |
|
2473 |
// |
|
2474 |
||
2475 |
const Register offset = dst_klass; // array offset |
|
2476 |
const Register elsize = src_klass; // log2 element size |
|
2477 |
||
2478 |
__ rldicl(offset, lh, 64 - Klass::_lh_header_size_shift, 64 - exact_log2(Klass::_lh_header_size_mask + 1)); |
|
2479 |
__ andi(elsize, lh, Klass::_lh_log2_element_size_mask); |
|
2480 |
__ add(src, offset, src); // src array offset |
|
2481 |
__ add(dst, offset, dst); // dst array offset |
|
2482 |
||
2483 |
// Next registers should be set before the jump to corresponding stub. |
|
2484 |
const Register from = R3_ARG1; // source array address |
|
2485 |
const Register to = R4_ARG2; // destination array address |
|
2486 |
const Register count = R5_ARG3; // elements count |
|
2487 |
||
2488 |
// 'from', 'to', 'count' registers should be set in this order |
|
2489 |
// since they are the same as 'src', 'src_pos', 'dst'. |
|
2490 |
||
2491 |
BLOCK_COMMENT("scale indexes to element size"); |
|
2492 |
__ sld(src_pos, src_pos, elsize); |
|
2493 |
__ sld(dst_pos, dst_pos, elsize); |
|
2494 |
__ add(from, src_pos, src); // src_addr |
|
2495 |
__ add(to, dst_pos, dst); // dst_addr |
|
2496 |
__ mr(count, length); // length |
|
2497 |
||
2498 |
BLOCK_COMMENT("choose copy loop based on element size"); |
|
2499 |
// Using conditional branches with range 32kB. |
|
2500 |
const int bo = Assembler::bcondCRbiIs1, bi = Assembler::bi0(CCR0, Assembler::equal); |
|
2501 |
__ cmpwi(CCR0, elsize, 0); |
|
2502 |
__ bc(bo, bi, entry_jbyte_arraycopy); |
|
2503 |
__ cmpwi(CCR0, elsize, LogBytesPerShort); |
|
2504 |
__ bc(bo, bi, entry_jshort_arraycopy); |
|
2505 |
__ cmpwi(CCR0, elsize, LogBytesPerInt); |
|
2506 |
__ bc(bo, bi, entry_jint_arraycopy); |
|
2507 |
#ifdef ASSERT |
|
2508 |
{ Label L; |
|
2509 |
__ cmpwi(CCR0, elsize, LogBytesPerLong); |
|
2510 |
__ beq(CCR0, L); |
|
2511 |
__ stop("must be long copy, but elsize is wrong"); |
|
2512 |
__ bind(L); |
|
2513 |
} |
|
2514 |
#endif |
|
2515 |
__ b(entry_jlong_arraycopy); |
|
2516 |
||
2517 |
// ObjArrayKlass |
|
2518 |
__ bind(L_objArray); |
|
2519 |
// live at this point: src_klass, dst_klass, src[_pos], dst[_pos], length |
|
2520 |
||
2521 |
Label L_disjoint_plain_copy, L_checkcast_copy; |
|
2522 |
// test array classes for subtyping |
|
2523 |
__ cmpd(CCR0, src_klass, dst_klass); // usual case is exact equality |
|
2524 |
__ bne(CCR0, L_checkcast_copy); |
|
2525 |
||
2526 |
// Identically typed arrays can be copied without element-wise checks. |
|
2527 |
arraycopy_range_checks(src, src_pos, dst, dst_pos, length, |
|
2528 |
temp, lh, L_failed); |
|
2529 |
||
2530 |
__ addi(src, src, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); //src offset |
|
2531 |
__ addi(dst, dst, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); //dst offset |
|
2532 |
__ sldi(src_pos, src_pos, LogBytesPerHeapOop); |
|
2533 |
__ sldi(dst_pos, dst_pos, LogBytesPerHeapOop); |
|
2534 |
__ add(from, src_pos, src); // src_addr |
|
2535 |
__ add(to, dst_pos, dst); // dst_addr |
|
2536 |
__ mr(count, length); // length |
|
2537 |
__ b(entry_oop_arraycopy); |
|
2538 |
||
2539 |
__ bind(L_checkcast_copy); |
|
2540 |
// live at this point: src_klass, dst_klass |
|
2541 |
{ |
|
2542 |
// Before looking at dst.length, make sure dst is also an objArray. |
|
2543 |
__ lwz(temp, lh_offset, dst_klass); |
|
2544 |
__ cmpw(CCR0, lh, temp); |
|
2545 |
__ bne(CCR0, L_failed); |
|
2546 |
||
2547 |
// It is safe to examine both src.length and dst.length. |
|
2548 |
arraycopy_range_checks(src, src_pos, dst, dst_pos, length, |
|
2549 |
temp, lh, L_failed); |
|
2550 |
||
2551 |
// Marshal the base address arguments now, freeing registers. |
|
2552 |
__ addi(src, src, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); //src offset |
|
2553 |
__ addi(dst, dst, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); //dst offset |
|
2554 |
__ sldi(src_pos, src_pos, LogBytesPerHeapOop); |
|
2555 |
__ sldi(dst_pos, dst_pos, LogBytesPerHeapOop); |
|
2556 |
__ add(from, src_pos, src); // src_addr |
|
2557 |
__ add(to, dst_pos, dst); // dst_addr |
|
2558 |
__ mr(count, length); // length |
|
2559 |
||
2560 |
Register sco_temp = R6_ARG4; // This register is free now. |
|
2561 |
assert_different_registers(from, to, count, sco_temp, |
|
2562 |
dst_klass, src_klass); |
|
2563 |
||
2564 |
// Generate the type check. |
|
2565 |
int sco_offset = in_bytes(Klass::super_check_offset_offset()); |
|
2566 |
__ lwz(sco_temp, sco_offset, dst_klass); |
|
2567 |
generate_type_check(src_klass, sco_temp, dst_klass, |
|
2568 |
temp, L_disjoint_plain_copy); |
|
2569 |
||
2570 |
// Fetch destination element klass from the ObjArrayKlass header. |
|
2571 |
int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset()); |
|
2572 |
||
2573 |
// The checkcast_copy loop needs two extra arguments: |
|
2574 |
__ ld(R7_ARG5, ek_offset, dst_klass); // dest elem klass |
|
2575 |
__ lwz(R6_ARG4, sco_offset, R7_ARG5); // sco of elem klass |
|
2576 |
__ b(entry_checkcast_arraycopy); |
|
2577 |
} |
|
2578 |
||
2579 |
__ bind(L_disjoint_plain_copy); |
|
2580 |
__ b(entry_disjoint_oop_arraycopy); |
|
2581 |
||
2582 |
__ bind(L_failed); |
|
2583 |
__ li(R3_RET, -1); // return -1 |
|
2584 |
__ blr(); |
|
2585 |
return start; |
|
2586 |
} |
|
2587 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2588 |
// Arguments for generated stub: |
37275 | 2589 |
// R3_ARG1 - source byte array address |
2590 |
// R4_ARG2 - destination byte array address |
|
2591 |
// R5_ARG3 - round key array |
|
2592 |
address generate_aescrypt_encryptBlock() { |
|
2593 |
assert(UseAES, "need AES instructions and misaligned SSE support"); |
|
2594 |
StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock"); |
|
2595 |
||
2596 |
address start = __ function_entry(); |
|
2597 |
||
2598 |
Label L_doLast; |
|
2599 |
||
2600 |
Register from = R3_ARG1; // source array address |
|
2601 |
Register to = R4_ARG2; // destination array address |
|
2602 |
Register key = R5_ARG3; // round key array |
|
2603 |
||
2604 |
Register keylen = R8; |
|
2605 |
Register temp = R9; |
|
2606 |
Register keypos = R10; |
|
2607 |
Register fifteen = R12; |
|
2608 |
||
2609 |
VectorRegister vRet = VR0; |
|
2610 |
||
2611 |
VectorRegister vKey1 = VR1; |
|
2612 |
VectorRegister vKey2 = VR2; |
|
2613 |
VectorRegister vKey3 = VR3; |
|
2614 |
VectorRegister vKey4 = VR4; |
|
2615 |
||
2616 |
VectorRegister fromPerm = VR5; |
|
2617 |
VectorRegister keyPerm = VR6; |
|
2618 |
VectorRegister toPerm = VR7; |
|
2619 |
VectorRegister fSplt = VR8; |
|
2620 |
||
2621 |
VectorRegister vTmp1 = VR9; |
|
2622 |
VectorRegister vTmp2 = VR10; |
|
2623 |
VectorRegister vTmp3 = VR11; |
|
2624 |
VectorRegister vTmp4 = VR12; |
|
2625 |
||
2626 |
__ li (fifteen, 15); |
|
2627 |
||
2628 |
// load unaligned from[0-15] to vsRet |
|
2629 |
__ lvx (vRet, from); |
|
2630 |
__ lvx (vTmp1, fifteen, from); |
|
2631 |
__ lvsl (fromPerm, from); |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2632 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2633 |
__ vspltisb (fSplt, 0x0f); |
37275 | 2634 |
__ vxor (fromPerm, fromPerm, fSplt); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2635 |
#endif |
37275 | 2636 |
__ vperm (vRet, vRet, vTmp1, fromPerm); |
2637 |
||
2638 |
// load keylen (44 or 52 or 60) |
|
2639 |
__ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key); |
|
2640 |
||
2641 |
// to load keys |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2642 |
__ load_perm (keyPerm, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2643 |
#ifdef VM_LITTLE_ENDIAN |
37275 | 2644 |
__ vspltisb (vTmp2, -16); |
2645 |
__ vrld (keyPerm, keyPerm, vTmp2); |
|
2646 |
__ vrld (keyPerm, keyPerm, vTmp2); |
|
46789
1bf8c1e8b79a
8185975: PPC64: Fix vsldoi interface according to the ISA
mdoerr
parents:
46625
diff
changeset
|
2647 |
__ vsldoi (keyPerm, keyPerm, keyPerm, 8); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2648 |
#endif |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2649 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2650 |
// load the 1st round key to vTmp1 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2651 |
__ lvx (vTmp1, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2652 |
__ li (keypos, 16); |
37275 | 2653 |
__ lvx (vKey1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2654 |
__ vec_perm (vTmp1, vKey1, keyPerm); |
37275 | 2655 |
|
2656 |
// 1st round |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2657 |
__ vxor (vRet, vRet, vTmp1); |
37275 | 2658 |
|
2659 |
// load the 2nd round key to vKey1 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2660 |
__ li (keypos, 32); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2661 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2662 |
__ vec_perm (vKey1, vKey2, keyPerm); |
37275 | 2663 |
|
2664 |
// load the 3rd round key to vKey2 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2665 |
__ li (keypos, 48); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2666 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2667 |
__ vec_perm (vKey2, vKey3, keyPerm); |
37275 | 2668 |
|
2669 |
// load the 4th round key to vKey3 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2670 |
__ li (keypos, 64); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2671 |
__ lvx (vKey4, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2672 |
__ vec_perm (vKey3, vKey4, keyPerm); |
37275 | 2673 |
|
2674 |
// load the 5th round key to vKey4 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2675 |
__ li (keypos, 80); |
37275 | 2676 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2677 |
__ vec_perm (vKey4, vTmp1, keyPerm); |
37275 | 2678 |
|
2679 |
// 2nd - 5th rounds |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2680 |
__ vcipher (vRet, vRet, vKey1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2681 |
__ vcipher (vRet, vRet, vKey2); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2682 |
__ vcipher (vRet, vRet, vKey3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2683 |
__ vcipher (vRet, vRet, vKey4); |
37275 | 2684 |
|
2685 |
// load the 6th round key to vKey1 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2686 |
__ li (keypos, 96); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2687 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2688 |
__ vec_perm (vKey1, vTmp1, vKey2, keyPerm); |
37275 | 2689 |
|
2690 |
// load the 7th round key to vKey2 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2691 |
__ li (keypos, 112); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2692 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2693 |
__ vec_perm (vKey2, vKey3, keyPerm); |
37275 | 2694 |
|
2695 |
// load the 8th round key to vKey3 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2696 |
__ li (keypos, 128); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2697 |
__ lvx (vKey4, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2698 |
__ vec_perm (vKey3, vKey4, keyPerm); |
37275 | 2699 |
|
2700 |
// load the 9th round key to vKey4 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2701 |
__ li (keypos, 144); |
37275 | 2702 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2703 |
__ vec_perm (vKey4, vTmp1, keyPerm); |
37275 | 2704 |
|
2705 |
// 6th - 9th rounds |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2706 |
__ vcipher (vRet, vRet, vKey1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2707 |
__ vcipher (vRet, vRet, vKey2); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2708 |
__ vcipher (vRet, vRet, vKey3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2709 |
__ vcipher (vRet, vRet, vKey4); |
37275 | 2710 |
|
2711 |
// load the 10th round key to vKey1 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2712 |
__ li (keypos, 160); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2713 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2714 |
__ vec_perm (vKey1, vTmp1, vKey2, keyPerm); |
37275 | 2715 |
|
2716 |
// load the 11th round key to vKey2 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2717 |
__ li (keypos, 176); |
37275 | 2718 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2719 |
__ vec_perm (vKey2, vTmp1, keyPerm); |
37275 | 2720 |
|
2721 |
// if all round keys are loaded, skip next 4 rounds |
|
2722 |
__ cmpwi (CCR0, keylen, 44); |
|
2723 |
__ beq (CCR0, L_doLast); |
|
2724 |
||
2725 |
// 10th - 11th rounds |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2726 |
__ vcipher (vRet, vRet, vKey1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2727 |
__ vcipher (vRet, vRet, vKey2); |
37275 | 2728 |
|
2729 |
// load the 12th round key to vKey1 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2730 |
__ li (keypos, 192); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2731 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2732 |
__ vec_perm (vKey1, vTmp1, vKey2, keyPerm); |
37275 | 2733 |
|
2734 |
// load the 13th round key to vKey2 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2735 |
__ li (keypos, 208); |
37275 | 2736 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2737 |
__ vec_perm (vKey2, vTmp1, keyPerm); |
37275 | 2738 |
|
2739 |
// if all round keys are loaded, skip next 2 rounds |
|
2740 |
__ cmpwi (CCR0, keylen, 52); |
|
2741 |
__ beq (CCR0, L_doLast); |
|
2742 |
||
2743 |
// 12th - 13th rounds |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2744 |
__ vcipher (vRet, vRet, vKey1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2745 |
__ vcipher (vRet, vRet, vKey2); |
37275 | 2746 |
|
2747 |
// load the 14th round key to vKey1 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2748 |
__ li (keypos, 224); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2749 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2750 |
__ vec_perm (vKey1, vTmp1, vKey2, keyPerm); |
37275 | 2751 |
|
2752 |
// load the 15th round key to vKey2 |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2753 |
__ li (keypos, 240); |
37275 | 2754 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2755 |
__ vec_perm (vKey2, vTmp1, keyPerm); |
37275 | 2756 |
|
2757 |
__ bind(L_doLast); |
|
2758 |
||
2759 |
// last two rounds |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2760 |
__ vcipher (vRet, vRet, vKey1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2761 |
__ vcipherlast (vRet, vRet, vKey2); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2762 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2763 |
// store result (unaligned) |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2764 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2765 |
__ lvsl (toPerm, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2766 |
#else |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2767 |
__ lvsr (toPerm, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2768 |
#endif |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2769 |
__ vspltisb (vTmp3, -1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2770 |
__ vspltisb (vTmp4, 0); |
37275 | 2771 |
__ lvx (vTmp1, to); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2772 |
__ lvx (vTmp2, fifteen, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2773 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2774 |
__ vperm (vTmp3, vTmp3, vTmp4, toPerm); // generate select mask |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2775 |
__ vxor (toPerm, toPerm, fSplt); // swap bytes |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2776 |
#else |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2777 |
__ vperm (vTmp3, vTmp4, vTmp3, toPerm); // generate select mask |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2778 |
#endif |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2779 |
__ vperm (vTmp4, vRet, vRet, toPerm); // rotate data |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2780 |
__ vsel (vTmp2, vTmp4, vTmp2, vTmp3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2781 |
__ vsel (vTmp1, vTmp1, vTmp4, vTmp3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2782 |
__ stvx (vTmp2, fifteen, to); // store this one first (may alias) |
37275 | 2783 |
__ stvx (vTmp1, to); |
2784 |
||
2785 |
__ blr(); |
|
2786 |
return start; |
|
2787 |
} |
|
2788 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2789 |
// Arguments for generated stub: |
37275 | 2790 |
// R3_ARG1 - source byte array address |
2791 |
// R4_ARG2 - destination byte array address |
|
2792 |
// R5_ARG3 - K (key) in little endian int array |
|
2793 |
address generate_aescrypt_decryptBlock() { |
|
2794 |
assert(UseAES, "need AES instructions and misaligned SSE support"); |
|
2795 |
StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock"); |
|
2796 |
||
2797 |
address start = __ function_entry(); |
|
2798 |
||
2799 |
Label L_doLast; |
|
2800 |
Label L_do44; |
|
2801 |
Label L_do52; |
|
2802 |
||
2803 |
Register from = R3_ARG1; // source array address |
|
2804 |
Register to = R4_ARG2; // destination array address |
|
2805 |
Register key = R5_ARG3; // round key array |
|
2806 |
||
2807 |
Register keylen = R8; |
|
2808 |
Register temp = R9; |
|
2809 |
Register keypos = R10; |
|
2810 |
Register fifteen = R12; |
|
2811 |
||
2812 |
VectorRegister vRet = VR0; |
|
2813 |
||
2814 |
VectorRegister vKey1 = VR1; |
|
2815 |
VectorRegister vKey2 = VR2; |
|
2816 |
VectorRegister vKey3 = VR3; |
|
2817 |
VectorRegister vKey4 = VR4; |
|
2818 |
VectorRegister vKey5 = VR5; |
|
2819 |
||
2820 |
VectorRegister fromPerm = VR6; |
|
2821 |
VectorRegister keyPerm = VR7; |
|
2822 |
VectorRegister toPerm = VR8; |
|
2823 |
VectorRegister fSplt = VR9; |
|
2824 |
||
2825 |
VectorRegister vTmp1 = VR10; |
|
2826 |
VectorRegister vTmp2 = VR11; |
|
2827 |
VectorRegister vTmp3 = VR12; |
|
2828 |
VectorRegister vTmp4 = VR13; |
|
2829 |
||
2830 |
__ li (fifteen, 15); |
|
2831 |
||
2832 |
// load unaligned from[0-15] to vsRet |
|
2833 |
__ lvx (vRet, from); |
|
2834 |
__ lvx (vTmp1, fifteen, from); |
|
2835 |
__ lvsl (fromPerm, from); |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2836 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2837 |
__ vspltisb (fSplt, 0x0f); |
37275 | 2838 |
__ vxor (fromPerm, fromPerm, fSplt); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2839 |
#endif |
37275 | 2840 |
__ vperm (vRet, vRet, vTmp1, fromPerm); // align [and byte swap in LE] |
2841 |
||
2842 |
// load keylen (44 or 52 or 60) |
|
2843 |
__ lwz (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key); |
|
2844 |
||
2845 |
// to load keys |
|
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2846 |
__ load_perm (keyPerm, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2847 |
#ifdef VM_LITTLE_ENDIAN |
37275 | 2848 |
__ vxor (vTmp2, vTmp2, vTmp2); |
2849 |
__ vspltisb (vTmp2, -16); |
|
2850 |
__ vrld (keyPerm, keyPerm, vTmp2); |
|
2851 |
__ vrld (keyPerm, keyPerm, vTmp2); |
|
46789
1bf8c1e8b79a
8185975: PPC64: Fix vsldoi interface according to the ISA
mdoerr
parents:
46625
diff
changeset
|
2852 |
__ vsldoi (keyPerm, keyPerm, keyPerm, 8); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2853 |
#endif |
37275 | 2854 |
|
2855 |
__ cmpwi (CCR0, keylen, 44); |
|
2856 |
__ beq (CCR0, L_do44); |
|
2857 |
||
2858 |
__ cmpwi (CCR0, keylen, 52); |
|
2859 |
__ beq (CCR0, L_do52); |
|
2860 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2861 |
// load the 15th round key to vKey1 |
37275 | 2862 |
__ li (keypos, 240); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2863 |
__ lvx (vKey1, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2864 |
__ li (keypos, 224); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2865 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2866 |
__ vec_perm (vKey1, vKey2, vKey1, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2867 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2868 |
// load the 14th round key to vKey2 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2869 |
__ li (keypos, 208); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2870 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2871 |
__ vec_perm (vKey2, vKey3, vKey2, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2872 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2873 |
// load the 13th round key to vKey3 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2874 |
__ li (keypos, 192); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2875 |
__ lvx (vKey4, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2876 |
__ vec_perm (vKey3, vKey4, vKey3, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2877 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2878 |
// load the 12th round key to vKey4 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2879 |
__ li (keypos, 176); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2880 |
__ lvx (vKey5, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2881 |
__ vec_perm (vKey4, vKey5, vKey4, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2882 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2883 |
// load the 11th round key to vKey5 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2884 |
__ li (keypos, 160); |
37275 | 2885 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2886 |
__ vec_perm (vKey5, vTmp1, vKey5, keyPerm); |
37275 | 2887 |
|
2888 |
// 1st - 5th rounds |
|
2889 |
__ vxor (vRet, vRet, vKey1); |
|
2890 |
__ vncipher (vRet, vRet, vKey2); |
|
2891 |
__ vncipher (vRet, vRet, vKey3); |
|
2892 |
__ vncipher (vRet, vRet, vKey4); |
|
2893 |
__ vncipher (vRet, vRet, vKey5); |
|
2894 |
||
2895 |
__ b (L_doLast); |
|
2896 |
||
2897 |
__ bind (L_do52); |
|
2898 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2899 |
// load the 13th round key to vKey1 |
37275 | 2900 |
__ li (keypos, 208); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2901 |
__ lvx (vKey1, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2902 |
__ li (keypos, 192); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2903 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2904 |
__ vec_perm (vKey1, vKey2, vKey1, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2905 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2906 |
// load the 12th round key to vKey2 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2907 |
__ li (keypos, 176); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2908 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2909 |
__ vec_perm (vKey2, vKey3, vKey2, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2910 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2911 |
// load the 11th round key to vKey3 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2912 |
__ li (keypos, 160); |
37275 | 2913 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2914 |
__ vec_perm (vKey3, vTmp1, vKey3, keyPerm); |
37275 | 2915 |
|
2916 |
// 1st - 3rd rounds |
|
2917 |
__ vxor (vRet, vRet, vKey1); |
|
2918 |
__ vncipher (vRet, vRet, vKey2); |
|
2919 |
__ vncipher (vRet, vRet, vKey3); |
|
2920 |
||
2921 |
__ b (L_doLast); |
|
2922 |
||
2923 |
__ bind (L_do44); |
|
2924 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2925 |
// load the 11th round key to vKey1 |
37275 | 2926 |
__ li (keypos, 176); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2927 |
__ lvx (vKey1, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2928 |
__ li (keypos, 160); |
37275 | 2929 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2930 |
__ vec_perm (vKey1, vTmp1, vKey1, keyPerm); |
37275 | 2931 |
|
2932 |
// 1st round |
|
2933 |
__ vxor (vRet, vRet, vKey1); |
|
2934 |
||
2935 |
__ bind (L_doLast); |
|
2936 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2937 |
// load the 10th round key to vKey1 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2938 |
__ li (keypos, 144); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2939 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2940 |
__ vec_perm (vKey1, vKey2, vTmp1, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2941 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2942 |
// load the 9th round key to vKey2 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2943 |
__ li (keypos, 128); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2944 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2945 |
__ vec_perm (vKey2, vKey3, vKey2, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2946 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2947 |
// load the 8th round key to vKey3 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2948 |
__ li (keypos, 112); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2949 |
__ lvx (vKey4, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2950 |
__ vec_perm (vKey3, vKey4, vKey3, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2951 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2952 |
// load the 7th round key to vKey4 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2953 |
__ li (keypos, 96); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2954 |
__ lvx (vKey5, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2955 |
__ vec_perm (vKey4, vKey5, vKey4, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2956 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2957 |
// load the 6th round key to vKey5 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2958 |
__ li (keypos, 80); |
37275 | 2959 |
__ lvx (vTmp1, keypos, key); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2960 |
__ vec_perm (vKey5, vTmp1, vKey5, keyPerm); |
37275 | 2961 |
|
2962 |
// last 10th - 6th rounds |
|
2963 |
__ vncipher (vRet, vRet, vKey1); |
|
2964 |
__ vncipher (vRet, vRet, vKey2); |
|
2965 |
__ vncipher (vRet, vRet, vKey3); |
|
2966 |
__ vncipher (vRet, vRet, vKey4); |
|
2967 |
__ vncipher (vRet, vRet, vKey5); |
|
2968 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2969 |
// load the 5th round key to vKey1 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2970 |
__ li (keypos, 64); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2971 |
__ lvx (vKey2, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2972 |
__ vec_perm (vKey1, vKey2, vTmp1, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2973 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2974 |
// load the 4th round key to vKey2 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2975 |
__ li (keypos, 48); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2976 |
__ lvx (vKey3, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2977 |
__ vec_perm (vKey2, vKey3, vKey2, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2978 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2979 |
// load the 3rd round key to vKey3 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2980 |
__ li (keypos, 32); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2981 |
__ lvx (vKey4, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2982 |
__ vec_perm (vKey3, vKey4, vKey3, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2983 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2984 |
// load the 2nd round key to vKey4 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2985 |
__ li (keypos, 16); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2986 |
__ lvx (vKey5, keypos, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2987 |
__ vec_perm (vKey4, vKey5, vKey4, keyPerm); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2988 |
|
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2989 |
// load the 1st round key to vKey5 |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2990 |
__ lvx (vTmp1, key); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
2991 |
__ vec_perm (vKey5, vTmp1, vKey5, keyPerm); |
37275 | 2992 |
|
2993 |
// last 5th - 1th rounds |
|
2994 |
__ vncipher (vRet, vRet, vKey1); |
|
2995 |
__ vncipher (vRet, vRet, vKey2); |
|
2996 |
__ vncipher (vRet, vRet, vKey3); |
|
2997 |
__ vncipher (vRet, vRet, vKey4); |
|
2998 |
__ vncipherlast (vRet, vRet, vKey5); |
|
2999 |
||
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3000 |
// store result (unaligned) |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3001 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3002 |
__ lvsl (toPerm, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3003 |
#else |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3004 |
__ lvsr (toPerm, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3005 |
#endif |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3006 |
__ vspltisb (vTmp3, -1); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3007 |
__ vspltisb (vTmp4, 0); |
37275 | 3008 |
__ lvx (vTmp1, to); |
47608
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3009 |
__ lvx (vTmp2, fifteen, to); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3010 |
#ifdef VM_LITTLE_ENDIAN |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3011 |
__ vperm (vTmp3, vTmp3, vTmp4, toPerm); // generate select mask |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3012 |
__ vxor (toPerm, toPerm, fSplt); // swap bytes |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3013 |
#else |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3014 |
__ vperm (vTmp3, vTmp4, vTmp3, toPerm); // generate select mask |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3015 |
#endif |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3016 |
__ vperm (vTmp4, vRet, vRet, toPerm); // rotate data |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3017 |
__ vsel (vTmp2, vTmp4, vTmp2, vTmp3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3018 |
__ vsel (vTmp1, vTmp1, vTmp4, vTmp3); |
9d337e48b178
8188868: PPC64: Support AES intrinsics on Big Endian
mdoerr
parents:
47565
diff
changeset
|
3019 |
__ stvx (vTmp2, fifteen, to); // store this one first (may alias) |
37275 | 3020 |
__ stvx (vTmp1, to); |
3021 |
||
3022 |
__ blr(); |
|
3023 |
return start; |
|
3024 |
} |
|
35085 | 3025 |
|
47565 | 3026 |
address generate_sha256_implCompress(bool multi_block, const char *name) { |
3027 |
assert(UseSHA, "need SHA instructions"); |
|
3028 |
StubCodeMark mark(this, "StubRoutines", name); |
|
3029 |
address start = __ function_entry(); |
|
3030 |
||
3031 |
__ sha256 (multi_block); |
|
3032 |
||
3033 |
__ blr(); |
|
3034 |
return start; |
|
3035 |
} |
|
3036 |
||
3037 |
address generate_sha512_implCompress(bool multi_block, const char *name) { |
|
3038 |
assert(UseSHA, "need SHA instructions"); |
|
3039 |
StubCodeMark mark(this, "StubRoutines", name); |
|
3040 |
address start = __ function_entry(); |
|
3041 |
||
3042 |
__ sha512 (multi_block); |
|
3043 |
||
3044 |
__ blr(); |
|
3045 |
return start; |
|
3046 |
} |
|
3047 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3048 |
void generate_arraycopy_stubs() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3049 |
// Note: the disjoint stubs must be generated first, some of |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3050 |
// the conjoint stubs use them. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3051 |
|
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3052 |
address ucm_common_error_exit = generate_unsafecopy_common_error_exit(); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3053 |
UnsafeCopyMemory::set_common_exit_stub_pc(ucm_common_error_exit); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3054 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3055 |
// non-aligned disjoint versions |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3056 |
StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3057 |
StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3058 |
StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3059 |
StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3060 |
StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy", false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3061 |
StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy_uninit", true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3062 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3063 |
// aligned disjoint versions |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3064 |
StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3065 |
StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3066 |
StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3067 |
StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3068 |
StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy", false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3069 |
StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, "oop_disjoint_arraycopy_uninit", true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3070 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3071 |
// non-aligned conjoint versions |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3072 |
StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, "jbyte_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3073 |
StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3074 |
StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, "jint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3075 |
StubRoutines::_jlong_arraycopy = generate_conjoint_long_copy(false, "jlong_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3076 |
StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy(false, "oop_arraycopy", false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3077 |
StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy(false, "oop_arraycopy_uninit", true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3078 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3079 |
// aligned conjoint versions |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3080 |
StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(true, "arrayof_jbyte_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3081 |
StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, "arrayof_jshort_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3082 |
StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, "arrayof_jint_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3083 |
StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, "arrayof_jlong_arraycopy"); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3084 |
StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3085 |
StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", true); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3086 |
|
35085 | 3087 |
// special/generic versions |
3088 |
StubRoutines::_checkcast_arraycopy = generate_checkcast_copy("checkcast_arraycopy", false); |
|
3089 |
StubRoutines::_checkcast_arraycopy_uninit = generate_checkcast_copy("checkcast_arraycopy_uninit", true); |
|
3090 |
||
3091 |
StubRoutines::_unsafe_arraycopy = generate_unsafe_copy("unsafe_arraycopy", |
|
3092 |
STUB_ENTRY(jbyte_arraycopy), |
|
3093 |
STUB_ENTRY(jshort_arraycopy), |
|
3094 |
STUB_ENTRY(jint_arraycopy), |
|
3095 |
STUB_ENTRY(jlong_arraycopy)); |
|
3096 |
StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy", |
|
3097 |
STUB_ENTRY(jbyte_arraycopy), |
|
3098 |
STUB_ENTRY(jshort_arraycopy), |
|
3099 |
STUB_ENTRY(jint_arraycopy), |
|
3100 |
STUB_ENTRY(oop_arraycopy), |
|
3101 |
STUB_ENTRY(oop_disjoint_arraycopy), |
|
3102 |
STUB_ENTRY(jlong_arraycopy), |
|
3103 |
STUB_ENTRY(checkcast_arraycopy)); |
|
3104 |
||
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3105 |
// fill routines |
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3106 |
if (OptimizeFill) { |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3107 |
StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3108 |
StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3109 |
StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3110 |
StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3111 |
StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3112 |
StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill"); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3113 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3114 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3115 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3116 |
// Safefetch stubs. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3117 |
void generate_safefetch(const char* name, int size, address* entry, address* fault_pc, address* continuation_pc) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3118 |
// safefetch signatures: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3119 |
// int SafeFetch32(int* adr, int errValue); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3120 |
// intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3121 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3122 |
// arguments: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3123 |
// R3_ARG1 = adr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3124 |
// R4_ARG2 = errValue |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3125 |
// |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3126 |
// result: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3127 |
// R3_RET = *adr or errValue |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3128 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3129 |
StubCodeMark mark(this, "StubRoutines", name); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3130 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3131 |
// Entry point, pc or function descriptor. |
23211 | 3132 |
*entry = __ function_entry(); |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3133 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3134 |
// Load *adr into R4_ARG2, may fault. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3135 |
*fault_pc = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3136 |
switch (size) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3137 |
case 4: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3138 |
// int32_t, signed extended |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3139 |
__ lwa(R4_ARG2, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3140 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3141 |
case 8: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3142 |
// int64_t |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3143 |
__ ld(R4_ARG2, 0, R3_ARG1); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3144 |
break; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3145 |
default: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3146 |
ShouldNotReachHere(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3147 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3148 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3149 |
// return errValue or *adr |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3150 |
*continuation_pc = __ pc(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3151 |
__ mr(R3_RET, R4_ARG2); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3152 |
__ blr(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3153 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3154 |
|
31773 | 3155 |
// Stub for BigInteger::multiplyToLen() |
3156 |
// |
|
3157 |
// Arguments: |
|
3158 |
// |
|
3159 |
// Input: |
|
3160 |
// R3 - x address |
|
3161 |
// R4 - x length |
|
3162 |
// R5 - y address |
|
3163 |
// R6 - y length |
|
3164 |
// R7 - z address |
|
3165 |
// R8 - z length |
|
3166 |
// |
|
3167 |
address generate_multiplyToLen() { |
|
3168 |
||
3169 |
StubCodeMark mark(this, "StubRoutines", "multiplyToLen"); |
|
3170 |
||
3171 |
address start = __ function_entry(); |
|
3172 |
||
3173 |
const Register x = R3; |
|
3174 |
const Register xlen = R4; |
|
3175 |
const Register y = R5; |
|
3176 |
const Register ylen = R6; |
|
3177 |
const Register z = R7; |
|
3178 |
const Register zlen = R8; |
|
3179 |
||
3180 |
const Register tmp1 = R2; // TOC not used. |
|
3181 |
const Register tmp2 = R9; |
|
3182 |
const Register tmp3 = R10; |
|
3183 |
const Register tmp4 = R11; |
|
3184 |
const Register tmp5 = R12; |
|
3185 |
||
3186 |
// non-volatile regs |
|
3187 |
const Register tmp6 = R31; |
|
3188 |
const Register tmp7 = R30; |
|
3189 |
const Register tmp8 = R29; |
|
3190 |
const Register tmp9 = R28; |
|
3191 |
const Register tmp10 = R27; |
|
3192 |
const Register tmp11 = R26; |
|
3193 |
const Register tmp12 = R25; |
|
3194 |
const Register tmp13 = R24; |
|
3195 |
||
3196 |
BLOCK_COMMENT("Entry:"); |
|
3197 |
||
35541
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3198 |
// C2 does not respect int to long conversion for stub calls. |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3199 |
__ clrldi(xlen, xlen, 32); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3200 |
__ clrldi(ylen, ylen, 32); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3201 |
__ clrldi(zlen, zlen, 32); |
cba047a086d5
8146613: PPC64: C2 does no longer respect int to long conversion for stub calls
mdoerr
parents:
35156
diff
changeset
|
3202 |
|
31773 | 3203 |
// Save non-volatile regs (frameless). |
3204 |
int current_offs = 8; |
|
3205 |
__ std(R24, -current_offs, R1_SP); current_offs += 8; |
|
3206 |
__ std(R25, -current_offs, R1_SP); current_offs += 8; |
|
3207 |
__ std(R26, -current_offs, R1_SP); current_offs += 8; |
|
3208 |
__ std(R27, -current_offs, R1_SP); current_offs += 8; |
|
3209 |
__ std(R28, -current_offs, R1_SP); current_offs += 8; |
|
3210 |
__ std(R29, -current_offs, R1_SP); current_offs += 8; |
|
3211 |
__ std(R30, -current_offs, R1_SP); current_offs += 8; |
|
3212 |
__ std(R31, -current_offs, R1_SP); |
|
3213 |
||
3214 |
__ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5, |
|
3215 |
tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13); |
|
3216 |
||
3217 |
// Restore non-volatile regs. |
|
3218 |
current_offs = 8; |
|
3219 |
__ ld(R24, -current_offs, R1_SP); current_offs += 8; |
|
3220 |
__ ld(R25, -current_offs, R1_SP); current_offs += 8; |
|
3221 |
__ ld(R26, -current_offs, R1_SP); current_offs += 8; |
|
3222 |
__ ld(R27, -current_offs, R1_SP); current_offs += 8; |
|
3223 |
__ ld(R28, -current_offs, R1_SP); current_offs += 8; |
|
3224 |
__ ld(R29, -current_offs, R1_SP); current_offs += 8; |
|
3225 |
__ ld(R30, -current_offs, R1_SP); current_offs += 8; |
|
3226 |
__ ld(R31, -current_offs, R1_SP); |
|
3227 |
||
3228 |
__ blr(); // Return to caller. |
|
3229 |
||
3230 |
return start; |
|
3231 |
} |
|
3232 |
||
47521
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3233 |
/** |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3234 |
* Arguments: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3235 |
* |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3236 |
* Input: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3237 |
* R3_ARG1 - out address |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3238 |
* R4_ARG2 - in address |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3239 |
* R5_ARG3 - offset |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3240 |
* R6_ARG4 - len |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3241 |
* R7_ARG5 - k |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3242 |
* Output: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3243 |
* R3_RET - carry |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3244 |
*/ |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3245 |
address generate_mulAdd() { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3246 |
__ align(CodeEntryAlignment); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3247 |
StubCodeMark mark(this, "StubRoutines", "mulAdd"); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3248 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3249 |
address start = __ function_entry(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3250 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3251 |
// C2 does not sign extend signed parameters to full 64 bits registers: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3252 |
__ rldic (R5_ARG3, R5_ARG3, 2, 32); // always positive |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3253 |
__ clrldi(R6_ARG4, R6_ARG4, 32); // force zero bits on higher word |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3254 |
__ clrldi(R7_ARG5, R7_ARG5, 32); // force zero bits on higher word |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3255 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3256 |
__ muladd(R3_ARG1, R4_ARG2, R5_ARG3, R6_ARG4, R7_ARG5, R8, R9, R10); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3257 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3258 |
// Moves output carry to return register |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3259 |
__ mr (R3_RET, R10); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3260 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3261 |
__ blr(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3262 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3263 |
return start; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3264 |
} |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3265 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3266 |
/** |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3267 |
* Arguments: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3268 |
* |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3269 |
* Input: |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3270 |
* R3_ARG1 - in address |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3271 |
* R4_ARG2 - in length |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3272 |
* R5_ARG3 - out address |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3273 |
* R6_ARG4 - out length |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3274 |
*/ |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3275 |
address generate_squareToLen() { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3276 |
__ align(CodeEntryAlignment); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3277 |
StubCodeMark mark(this, "StubRoutines", "squareToLen"); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3278 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3279 |
address start = __ function_entry(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3280 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3281 |
// args - higher word is cleaned (unsignedly) due to int to long casting |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3282 |
const Register in = R3_ARG1; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3283 |
const Register in_len = R4_ARG2; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3284 |
__ clrldi(in_len, in_len, 32); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3285 |
const Register out = R5_ARG3; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3286 |
const Register out_len = R6_ARG4; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3287 |
__ clrldi(out_len, out_len, 32); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3288 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3289 |
// output |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3290 |
const Register ret = R3_RET; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3291 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3292 |
// temporaries |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3293 |
const Register lplw_s = R7; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3294 |
const Register in_aux = R8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3295 |
const Register out_aux = R9; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3296 |
const Register piece = R10; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3297 |
const Register product = R14; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3298 |
const Register lplw = R15; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3299 |
const Register i_minus1 = R16; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3300 |
const Register carry = R17; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3301 |
const Register offset = R18; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3302 |
const Register off_aux = R19; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3303 |
const Register t = R20; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3304 |
const Register mlen = R21; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3305 |
const Register len = R22; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3306 |
const Register a = R23; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3307 |
const Register b = R24; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3308 |
const Register i = R25; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3309 |
const Register c = R26; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3310 |
const Register cs = R27; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3311 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3312 |
// Labels |
51756 | 3313 |
Label SKIP_LSHIFT, SKIP_DIAGONAL_SUM, SKIP_ADDONE, SKIP_LOOP_SQUARE; |
3314 |
Label LOOP_LSHIFT, LOOP_DIAGONAL_SUM, LOOP_ADDONE, LOOP_SQUARE; |
|
47521
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3315 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3316 |
// Save non-volatile regs (frameless). |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3317 |
int current_offs = -8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3318 |
__ std(R28, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3319 |
__ std(R27, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3320 |
__ std(R26, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3321 |
__ std(R25, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3322 |
__ std(R24, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3323 |
__ std(R23, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3324 |
__ std(R22, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3325 |
__ std(R21, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3326 |
__ std(R20, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3327 |
__ std(R19, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3328 |
__ std(R18, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3329 |
__ std(R17, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3330 |
__ std(R16, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3331 |
__ std(R15, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3332 |
__ std(R14, current_offs, R1_SP); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3333 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3334 |
// Store the squares, right shifted one bit (i.e., divided by 2) |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3335 |
__ subi (out_aux, out, 8); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3336 |
__ subi (in_aux, in, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3337 |
__ cmpwi (CCR0, in_len, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3338 |
// Initialize lplw outside of the loop |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3339 |
__ xorr (lplw, lplw, lplw); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3340 |
__ ble (CCR0, SKIP_LOOP_SQUARE); // in_len <= 0 |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3341 |
__ mtctr (in_len); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3342 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3343 |
__ bind(LOOP_SQUARE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3344 |
__ lwzu (piece, 4, in_aux); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3345 |
__ mulld (product, piece, piece); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3346 |
// shift left 63 bits and only keep the MSB |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3347 |
__ rldic (lplw_s, lplw, 63, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3348 |
__ mr (lplw, product); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3349 |
// shift right 1 bit without sign extension |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3350 |
__ srdi (product, product, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3351 |
// join them to the same register and store it |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3352 |
__ orr (product, lplw_s, product); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3353 |
#ifdef VM_LITTLE_ENDIAN |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3354 |
// Swap low and high words for little endian |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3355 |
__ rldicl (product, product, 32, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3356 |
#endif |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3357 |
__ stdu (product, 8, out_aux); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3358 |
__ bdnz (LOOP_SQUARE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3359 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3360 |
__ bind(SKIP_LOOP_SQUARE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3361 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3362 |
// Add in off-diagonal sums |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3363 |
__ cmpwi (CCR0, in_len, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3364 |
__ ble (CCR0, SKIP_DIAGONAL_SUM); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3365 |
// Avoid CTR usage here in order to use it at mulAdd |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3366 |
__ subi (i_minus1, in_len, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3367 |
__ li (offset, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3368 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3369 |
__ bind(LOOP_DIAGONAL_SUM); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3370 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3371 |
__ sldi (off_aux, out_len, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3372 |
__ sub (off_aux, off_aux, offset); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3373 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3374 |
__ mr (len, i_minus1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3375 |
__ sldi (mlen, i_minus1, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3376 |
__ lwzx (t, in, mlen); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3377 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3378 |
__ muladd (out, in, off_aux, len, t, a, b, carry); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3379 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3380 |
// begin<addOne> |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3381 |
// off_aux = out_len*4 - 4 - mlen - offset*4 - 4; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3382 |
__ addi (mlen, mlen, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3383 |
__ sldi (a, out_len, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3384 |
__ subi (a, a, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3385 |
__ sub (a, a, mlen); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3386 |
__ subi (off_aux, offset, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3387 |
__ sub (off_aux, a, off_aux); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3388 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3389 |
__ lwzx (b, off_aux, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3390 |
__ add (b, b, carry); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3391 |
__ stwx (b, off_aux, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3392 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3393 |
// if (((uint64_t)s >> 32) != 0) { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3394 |
__ srdi_ (a, b, 32); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3395 |
__ beq (CCR0, SKIP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3396 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3397 |
// while (--mlen >= 0) { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3398 |
__ bind(LOOP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3399 |
__ subi (mlen, mlen, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3400 |
__ cmpwi (CCR0, mlen, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3401 |
__ beq (CCR0, SKIP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3402 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3403 |
// if (--offset_aux < 0) { // Carry out of number |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3404 |
__ subi (off_aux, off_aux, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3405 |
__ cmpwi (CCR0, off_aux, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3406 |
__ blt (CCR0, SKIP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3407 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3408 |
// } else { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3409 |
__ lwzx (b, off_aux, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3410 |
__ addi (b, b, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3411 |
__ stwx (b, off_aux, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3412 |
__ cmpwi (CCR0, b, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3413 |
__ bne (CCR0, SKIP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3414 |
__ b (LOOP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3415 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3416 |
__ bind(SKIP_ADDONE); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3417 |
// } } } end<addOne> |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3418 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3419 |
__ addi (offset, offset, 8); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3420 |
__ subi (i_minus1, i_minus1, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3421 |
__ cmpwi (CCR0, i_minus1, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3422 |
__ bge (CCR0, LOOP_DIAGONAL_SUM); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3423 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3424 |
__ bind(SKIP_DIAGONAL_SUM); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3425 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3426 |
// Shift back up and set low bit |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3427 |
// Shifts 1 bit left up to len positions. Assumes no leading zeros |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3428 |
// begin<primitiveLeftShift> |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3429 |
__ cmpwi (CCR0, out_len, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3430 |
__ ble (CCR0, SKIP_LSHIFT); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3431 |
__ li (i, 0); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3432 |
__ lwz (c, 0, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3433 |
__ subi (b, out_len, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3434 |
__ mtctr (b); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3435 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3436 |
__ bind(LOOP_LSHIFT); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3437 |
__ mr (b, c); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3438 |
__ addi (cs, i, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3439 |
__ lwzx (c, out, cs); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3440 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3441 |
__ sldi (b, b, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3442 |
__ srwi (cs, c, 31); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3443 |
__ orr (b, b, cs); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3444 |
__ stwx (b, i, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3445 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3446 |
__ addi (i, i, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3447 |
__ bdnz (LOOP_LSHIFT); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3448 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3449 |
__ sldi (c, out_len, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3450 |
__ subi (c, c, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3451 |
__ lwzx (b, out, c); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3452 |
__ sldi (b, b, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3453 |
__ stwx (b, out, c); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3454 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3455 |
__ bind(SKIP_LSHIFT); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3456 |
// end<primitiveLeftShift> |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3457 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3458 |
// Set low bit |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3459 |
__ sldi (i, in_len, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3460 |
__ subi (i, i, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3461 |
__ lwzx (i, in, i); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3462 |
__ sldi (c, out_len, 2); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3463 |
__ subi (c, c, 4); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3464 |
__ lwzx (b, out, c); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3465 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3466 |
__ andi (i, i, 1); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3467 |
__ orr (i, b, i); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3468 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3469 |
__ stwx (i, out, c); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3470 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3471 |
// Restore non-volatile regs. |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3472 |
current_offs = -8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3473 |
__ ld(R28, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3474 |
__ ld(R27, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3475 |
__ ld(R26, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3476 |
__ ld(R25, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3477 |
__ ld(R24, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3478 |
__ ld(R23, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3479 |
__ ld(R22, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3480 |
__ ld(R21, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3481 |
__ ld(R20, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3482 |
__ ld(R19, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3483 |
__ ld(R18, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3484 |
__ ld(R17, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3485 |
__ ld(R16, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3486 |
__ ld(R15, current_offs, R1_SP); current_offs -= 8; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3487 |
__ ld(R14, current_offs, R1_SP); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3488 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3489 |
__ mr(ret, out); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3490 |
__ blr(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3491 |
|
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3492 |
return start; |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3493 |
} |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3494 |
|
31861 | 3495 |
/** |
3496 |
* Arguments: |
|
3497 |
* |
|
3498 |
* Inputs: |
|
3499 |
* R3_ARG1 - int crc |
|
3500 |
* R4_ARG2 - byte* buf |
|
3501 |
* R5_ARG3 - int length (of buffer) |
|
3502 |
* |
|
3503 |
* scratch: |
|
36303
6241574f5982
8149655: PPC64: Implement CompactString intrinsics
mdoerr
parents:
35594
diff
changeset
|
3504 |
* R2, R6-R12 |
31861 | 3505 |
* |
3506 |
* Ouput: |
|
3507 |
* R3_RET - int crc result |
|
3508 |
*/ |
|
3509 |
// Compute CRC32 function. |
|
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3510 |
address generate_CRC32_updateBytes(bool is_crc32c) { |
31861 | 3511 |
__ align(CodeEntryAlignment); |
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3512 |
StubCodeMark mark(this, "StubRoutines", is_crc32c ? "CRC32C_updateBytes" : "CRC32_updateBytes"); |
31861 | 3513 |
address start = __ function_entry(); // Remember stub start address (is rtn value). |
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3514 |
__ crc32(R3_ARG1, R4_ARG2, R5_ARG3, R2, R6, R7, R8, R9, R10, R11, R12, is_crc32c); |
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3515 |
__ blr(); |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3516 |
return start; |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3517 |
} |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3518 |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3519 |
// Initialization |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3520 |
void generate_initial() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3521 |
// Generates all stubs and initializes the entry points |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3522 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3523 |
// Entry points that exist in all platforms. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3524 |
// Note: This is code that could be shared among different platforms - however the |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3525 |
// benefit seems to be smaller than the disadvantage of having a |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3526 |
// much more complicated generator structure. See also comment in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3527 |
// stubRoutines.hpp. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3528 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3529 |
StubRoutines::_forward_exception_entry = generate_forward_exception(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3530 |
StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3531 |
StubRoutines::_catch_exception_entry = generate_catch_exception(); |
22867 | 3532 |
|
3533 |
// Build this early so it's available for the interpreter. |
|
3534 |
StubRoutines::_throw_StackOverflowError_entry = |
|
3535 |
generate_throw_exception("StackOverflowError throw_exception", |
|
3536 |
CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false); |
|
38931
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
38209
diff
changeset
|
3537 |
StubRoutines::_throw_delayed_StackOverflowError_entry = |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
38209
diff
changeset
|
3538 |
generate_throw_exception("delayed StackOverflowError throw_exception", |
3cf28d630349
8156923: [ppc] Implement "JEP 270: Reserved Stack Areas for Critical Sections".
goetz
parents:
38209
diff
changeset
|
3539 |
CAST_FROM_FN_PTR(address, SharedRuntime::throw_delayed_StackOverflowError), false); |
31861 | 3540 |
|
3541 |
// CRC32 Intrinsics. |
|
3542 |
if (UseCRC32Intrinsics) { |
|
53483
60add902a57a
8217459: [PPC64] Cleanup non-vector version of CRC32
mdoerr
parents:
53408
diff
changeset
|
3543 |
StubRoutines::_crc_table_adr = StubRoutines::generate_crc_constants(REVERSE_CRC32_POLY); |
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3544 |
StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes(false); |
31861 | 3545 |
} |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3546 |
|
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3547 |
// CRC32C Intrinsics. |
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3548 |
if (UseCRC32CIntrinsics) { |
53483
60add902a57a
8217459: [PPC64] Cleanup non-vector version of CRC32
mdoerr
parents:
53408
diff
changeset
|
3549 |
StubRoutines::_crc32c_table_addr = StubRoutines::generate_crc_constants(REVERSE_CRC32C_POLY); |
53408
e17d7ffad9e3
8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
mdoerr
parents:
53281
diff
changeset
|
3550 |
StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(true); |
46317
5f88747fe29e
8175369: [ppc] Provide intrinsic implementation for CRC32C
lucy
parents:
42034
diff
changeset
|
3551 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3552 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3553 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3554 |
void generate_all() { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3555 |
// Generates all stubs and initializes the entry points |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3556 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3557 |
// These entry points require SharedInfo::stack0 to be set up in |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3558 |
// non-core builds |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3559 |
StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3560 |
// Handle IncompatibleClassChangeError in itable stubs. |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3561 |
StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3562 |
StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3563 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3564 |
// support for verify_oop (must happen after universe_init) |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3565 |
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3566 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3567 |
// arraycopy stubs used by compilers |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3568 |
generate_arraycopy_stubs(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3569 |
|
23221 | 3570 |
// Safefetch stubs. |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3571 |
generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3572 |
&StubRoutines::_safefetch32_fault_pc, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3573 |
&StubRoutines::_safefetch32_continuation_pc); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3574 |
generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3575 |
&StubRoutines::_safefetchN_fault_pc, |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3576 |
&StubRoutines::_safefetchN_continuation_pc); |
31773 | 3577 |
|
3578 |
#ifdef COMPILER2 |
|
3579 |
if (UseMultiplyToLenIntrinsic) { |
|
3580 |
StubRoutines::_multiplyToLen = generate_multiplyToLen(); |
|
3581 |
} |
|
3582 |
#endif |
|
35156 | 3583 |
|
47521
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3584 |
if (UseSquareToLenIntrinsic) { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3585 |
StubRoutines::_squareToLen = generate_squareToLen(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3586 |
} |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3587 |
if (UseMulAddIntrinsic) { |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3588 |
StubRoutines::_mulAdd = generate_mulAdd(); |
122833427b36
8185976: PPC64: Implement MulAdd and SquareToLen intrinsics
goetz
parents:
47216
diff
changeset
|
3589 |
} |
35156 | 3590 |
if (UseMontgomeryMultiplyIntrinsic) { |
3591 |
StubRoutines::_montgomeryMultiply |
|
3592 |
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply); |
|
3593 |
} |
|
3594 |
if (UseMontgomerySquareIntrinsic) { |
|
3595 |
StubRoutines::_montgomerySquare |
|
3596 |
= CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_square); |
|
3597 |
} |
|
37275 | 3598 |
|
3599 |
if (UseAESIntrinsics) { |
|
3600 |
StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock(); |
|
3601 |
StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock(); |
|
3602 |
} |
|
3603 |
||
47565 | 3604 |
if (UseSHA256Intrinsics) { |
3605 |
StubRoutines::_sha256_implCompress = generate_sha256_implCompress(false, "sha256_implCompress"); |
|
3606 |
StubRoutines::_sha256_implCompressMB = generate_sha256_implCompress(true, "sha256_implCompressMB"); |
|
3607 |
} |
|
3608 |
if (UseSHA512Intrinsics) { |
|
3609 |
StubRoutines::_sha512_implCompress = generate_sha512_implCompress(false, "sha512_implCompress"); |
|
3610 |
StubRoutines::_sha512_implCompressMB = generate_sha512_implCompress(true, "sha512_implCompressMB"); |
|
3611 |
} |
|
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3612 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3613 |
|
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3614 |
public: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3615 |
StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3616 |
// replace the standard masm with a special one: |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3617 |
_masm = new MacroAssembler(code); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3618 |
if (all) { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3619 |
generate_all(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3620 |
} else { |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3621 |
generate_initial(); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3622 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3623 |
} |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3624 |
}; |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3625 |
|
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3626 |
#define UCM_TABLE_MAX_ENTRIES 8 |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3627 |
void StubGenerator_generate(CodeBuffer* code, bool all) { |
55490
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3628 |
if (UnsafeCopyMemory::_table == NULL) { |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3629 |
UnsafeCopyMemory::create_table(UCM_TABLE_MAX_ENTRIES); |
3f3dc00a69a5
8191278: MappedByteBuffer bulk access memory failures are not handled gracefully
jcm
parents:
53483
diff
changeset
|
3630 |
} |
22824
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3631 |
StubGenerator g(code, all); |
28258dd5cb2e
8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff
changeset
|
3632 |
} |