annotate src/cpu/ppc/vm/stubGenerator_ppc.cpp @ 17800:c4178a748df9

8033117: PPC64: Adapt to 8002074: Support for AES on SPARC Summary: Implement missing function Matcher::pass_original_key_for_aes() in ppc64 ad file. Reviewed-by: kvn
author goetz
date Wed, 29 Jan 2014 12:22:13 +0100
parents c668f307a4c0
children e5e8aa897002
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1 /*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
3 * Copyright 2012, 2013 SAP AG. All rights reserved.
ec28f9c041ff 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.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
5 *
ec28f9c041ff 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
ec28f9c041ff 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
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
8 * published by the Free Software Foundation.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
9 *
ec28f9c041ff 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
ec28f9c041ff 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
ec28f9c041ff 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
ec28f9c041ff 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
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
14 * accompanied this code).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
15 *
ec28f9c041ff 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
ec28f9c041ff 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,
ec28f9c041ff 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.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
19 *
ec28f9c041ff 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
ec28f9c041ff 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
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
22 * questions.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
23 *
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
24 */
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
25
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
26 #include "precompiled.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
27 #include "asm/assembler.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
28 #include "asm/macroAssembler.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
29 #include "interpreter/interpreter.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
30 #include "nativeInst_ppc.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
31 #include "oops/instanceOop.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
32 #include "oops/method.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
33 #include "oops/objArrayKlass.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
34 #include "oops/oop.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
35 #include "prims/methodHandles.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
36 #include "runtime/frame.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
37 #include "runtime/handles.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
38 #include "runtime/sharedRuntime.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
39 #include "runtime/stubCodeGenerator.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
40 #include "runtime/stubRoutines.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
41 #include "utilities/top.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
42 #ifdef TARGET_OS_FAMILY_aix
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
43 # include "thread_aix.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
44 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
45 #ifdef TARGET_OS_FAMILY_linux
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
46 # include "thread_linux.inline.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
47 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
48 #ifdef COMPILER2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
49 #include "opto/runtime.hpp"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
50 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
51
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
52 #define __ _masm->
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
53
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
54 #ifdef PRODUCT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
55 #define BLOCK_COMMENT(str) // nothing
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
56 #else
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
57 #define BLOCK_COMMENT(str) __ block_comment(str)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
58 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
59
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
60 class StubGenerator: public StubCodeGenerator {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
61 private:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
62
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
63 // Call stubs are used to call Java from C
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
64 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
65 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
66 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
67 // R3 - call wrapper address : address
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
68 // R4 - result : intptr_t*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
69 // R5 - result type : BasicType
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
70 // R6 - method : Method
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
71 // R7 - frame mgr entry point : address
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
72 // R8 - parameter block : intptr_t*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
73 // R9 - parameter count in words : int
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
74 // R10 - thread : Thread*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
75 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
76 address generate_call_stub(address& return_address) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
77 // Setup a new c frame, copy java arguments, call frame manager or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
78 // native_entry, and process result.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
79
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
80 StubCodeMark mark(this, "StubRoutines", "call_stub");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
81
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
82 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
83
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
84 // some sanity checks
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
85 assert((sizeof(frame::abi_48) % 16) == 0, "unaligned");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
86 assert((sizeof(frame::abi_112) % 16) == 0, "unaligned");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
87 assert((sizeof(frame::spill_nonvolatiles) % 16) == 0, "unaligned");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
88 assert((sizeof(frame::parent_ijava_frame_abi) % 16) == 0, "unaligned");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
89 assert((sizeof(frame::entry_frame_locals) % 16) == 0, "unaligned");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
90
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
91 Register r_arg_call_wrapper_addr = R3;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
92 Register r_arg_result_addr = R4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
93 Register r_arg_result_type = R5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
94 Register r_arg_method = R6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
95 Register r_arg_entry = R7;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
96 Register r_arg_thread = R10;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
97
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
98 Register r_temp = R24;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
99 Register r_top_of_arguments_addr = R25;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
100 Register r_entryframe_fp = R26;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
101
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
102 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
103 // Stack on entry to call_stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
104 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
105 // F1 [C_FRAME]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
106 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
107
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
108 Register r_arg_argument_addr = R8;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
109 Register r_arg_argument_count = R9;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
110 Register r_frame_alignment_in_bytes = R27;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
111 Register r_argument_addr = R28;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
112 Register r_argumentcopy_addr = R29;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
113 Register r_argument_size_in_bytes = R30;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
114 Register r_frame_size = R23;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
115
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
116 Label arguments_copied;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
117
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
118 // Save LR/CR to caller's C_FRAME.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
119 __ save_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
120
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
121 // Zero extend arg_argument_count.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
122 __ clrldi(r_arg_argument_count, r_arg_argument_count, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
123
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
124 // Save non-volatiles GPRs to ENTRY_FRAME (not yet pushed, but it's safe).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
125 __ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
126
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
127 // Keep copy of our frame pointer (caller's SP).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
128 __ mr(r_entryframe_fp, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
129
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
130 BLOCK_COMMENT("Push ENTRY_FRAME including arguments");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
131 // Push ENTRY_FRAME including arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
132 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
133 // F0 [TOP_IJAVA_FRAME_ABI]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
134 // alignment (optional)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
135 // [outgoing Java arguments]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
136 // [ENTRY_FRAME_LOCALS]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
137 // F1 [C_FRAME]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
138 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
139
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
140 // calculate frame size
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
141
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
142 // unaligned size of arguments
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
143 __ sldi(r_argument_size_in_bytes,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
144 r_arg_argument_count, Interpreter::logStackElementSize);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
145 // arguments alignment (max 1 slot)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
146 // FIXME: use round_to() here
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
147 __ andi_(r_frame_alignment_in_bytes, r_arg_argument_count, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
148 __ sldi(r_frame_alignment_in_bytes,
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
149 r_frame_alignment_in_bytes, Interpreter::logStackElementSize);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
150
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
151 // size = unaligned size of arguments + top abi's size
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
152 __ addi(r_frame_size, r_argument_size_in_bytes,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
153 frame::top_ijava_frame_abi_size);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
154 // size += arguments alignment
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
155 __ add(r_frame_size,
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
156 r_frame_size, r_frame_alignment_in_bytes);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
157 // size += size of call_stub locals
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
158 __ addi(r_frame_size,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
159 r_frame_size, frame::entry_frame_locals_size);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
160
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
161 // push ENTRY_FRAME
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
162 __ push_frame(r_frame_size, r_temp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
163
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
164 // initialize call_stub locals (step 1)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
165 __ std(r_arg_call_wrapper_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
166 _entry_frame_locals_neg(call_wrapper_address), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
167 __ std(r_arg_result_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
168 _entry_frame_locals_neg(result_address), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
169 __ std(r_arg_result_type,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
170 _entry_frame_locals_neg(result_type), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
171 // we will save arguments_tos_address later
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
172
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
173
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
174 BLOCK_COMMENT("Copy Java arguments");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
175 // copy Java arguments
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
176
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
177 // Calculate top_of_arguments_addr which will be R17_tos (not prepushed) later.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
178 // FIXME: why not simply use SP+frame::top_ijava_frame_size?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
179 __ addi(r_top_of_arguments_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
180 R1_SP, frame::top_ijava_frame_abi_size);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
181 __ add(r_top_of_arguments_addr,
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
182 r_top_of_arguments_addr, r_frame_alignment_in_bytes);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
183
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
184 // any arguments to copy?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
185 __ cmpdi(CCR0, r_arg_argument_count, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
186 __ beq(CCR0, arguments_copied);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
187
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
188 // prepare loop and copy arguments in reverse order
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
189 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
190 // init CTR with arg_argument_count
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
191 __ mtctr(r_arg_argument_count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
192
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
193 // let r_argumentcopy_addr point to last outgoing Java arguments P
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
194 __ mr(r_argumentcopy_addr, r_top_of_arguments_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
195
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
196 // let r_argument_addr point to last incoming java argument
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
197 __ add(r_argument_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
198 r_arg_argument_addr, r_argument_size_in_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
199 __ addi(r_argument_addr, r_argument_addr, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
200
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
201 // now loop while CTR > 0 and copy arguments
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
202 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
203 Label next_argument;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
204 __ bind(next_argument);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
205
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
206 __ ld(r_temp, 0, r_argument_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
207 // argument_addr--;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
208 __ addi(r_argument_addr, r_argument_addr, -BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
209 __ std(r_temp, 0, r_argumentcopy_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
210 // argumentcopy_addr++;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
211 __ addi(r_argumentcopy_addr, r_argumentcopy_addr, BytesPerWord);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
212
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
213 __ bdnz(next_argument);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
214 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
215 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
216
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
217 // Arguments copied, continue.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
218 __ bind(arguments_copied);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
219 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
220
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
221 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
222 BLOCK_COMMENT("Call frame manager or native entry.");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
223 // Call frame manager or native entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
224 Register r_new_arg_entry = R14_state;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
225 assert_different_registers(r_new_arg_entry, r_top_of_arguments_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
226 r_arg_method, r_arg_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
227
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
228 __ mr(r_new_arg_entry, r_arg_entry);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
229
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
230 // Register state on entry to frame manager / native entry:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
231 //
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
232 // tos - intptr_t* sender tos (prepushed) Lesp = (SP) + copied_arguments_offset - 8
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
233 // R19_method - Method
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
234 // R16_thread - JavaThread*
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
235
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
236 // Tos must point to last argument - element_size.
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
237 const Register tos = R17_tos;
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
238 __ addi(tos, r_top_of_arguments_addr, -Interpreter::stackElementSize);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
239
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
240 // initialize call_stub locals (step 2)
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
241 // now save tos as arguments_tos_address
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
242 __ std(tos, _entry_frame_locals_neg(arguments_tos_address), r_entryframe_fp);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
243
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
244 // load argument registers for call
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
245 __ mr(R19_method, r_arg_method);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
246 __ mr(R16_thread, r_arg_thread);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
247 assert(tos != r_arg_method, "trashed r_arg_method");
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
248 assert(tos != r_arg_thread && R19_method != r_arg_thread, "trashed r_arg_thread");
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
249
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
250 // Set R15_prev_state to 0 for simplifying checks in callee.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
251 __ li(R15_prev_state, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
252
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
253 // Stack on entry to frame manager / native entry:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
254 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
255 // F0 [TOP_IJAVA_FRAME_ABI]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
256 // alignment (optional)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
257 // [outgoing Java arguments]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
258 // [ENTRY_FRAME_LOCALS]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
259 // F1 [C_FRAME]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
260 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
261 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
262
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
263 // global toc register
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
264 __ load_const(R29, MacroAssembler::global_toc(), R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
265
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
266 // Load narrow oop base.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
267 __ reinit_heapbase(R30, R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
268
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
269 // Remember the senderSP so we interpreter can pop c2i arguments off of the stack
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
270 // when called via a c2i.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
271
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
272 // Pass initial_caller_sp to framemanager.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
273 __ mr(R21_tmp1, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
274
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
275 // Do a light-weight C-call here, r_new_arg_entry holds the address
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
276 // of the interpreter entry point (frame manager or native entry)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
277 // and save runtime-value of LR in return_address.
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
278 assert(r_new_arg_entry != tos && r_new_arg_entry != R19_method && r_new_arg_entry != R16_thread,
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
279 "trashed r_new_arg_entry");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
280 return_address = __ call_stub(r_new_arg_entry);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
281 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
282
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
283 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
284 BLOCK_COMMENT("Returned from frame manager or native entry.");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
285 // Returned from frame manager or native entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
286 // Now pop frame, process result, and return to caller.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
287
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
288 // Stack on exit from frame manager / native entry:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
289 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
290 // F0 [ABI]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
291 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
292 // [ENTRY_FRAME_LOCALS]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
293 // F1 [C_FRAME]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
294 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
295 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
296 // Just pop the topmost frame ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
297 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
298
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
299 Label ret_is_object;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
300 Label ret_is_long;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
301 Label ret_is_float;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
302 Label ret_is_double;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
303
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
304 Register r_entryframe_fp = R30;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
305 Register r_lr = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
306 Register r_cr = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
307
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
308 // Reload some volatile registers which we've spilled before the call
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
309 // to frame manager / native entry.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
310 // Access all locals via frame pointer, because we know nothing about
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
311 // the topmost frame's size.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
312 __ ld(r_entryframe_fp, _abi(callers_sp), R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
313 assert_different_registers(r_entryframe_fp, R3_RET, r_arg_result_addr, r_arg_result_type, r_cr, r_lr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
314 __ ld(r_arg_result_addr,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
315 _entry_frame_locals_neg(result_address), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
316 __ ld(r_arg_result_type,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
317 _entry_frame_locals_neg(result_type), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
318 __ ld(r_cr, _abi(cr), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
319 __ ld(r_lr, _abi(lr), r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
320
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
321 // pop frame and restore non-volatiles, LR and CR
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
322 __ mr(R1_SP, r_entryframe_fp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
323 __ mtcr(r_cr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
324 __ mtlr(r_lr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
325
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
326 // Store result depending on type. Everything that is not
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
327 // T_OBJECT, T_LONG, T_FLOAT, or T_DOUBLE is treated as T_INT.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
328 __ cmpwi(CCR0, r_arg_result_type, T_OBJECT);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
329 __ cmpwi(CCR1, r_arg_result_type, T_LONG);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
330 __ cmpwi(CCR5, r_arg_result_type, T_FLOAT);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
331 __ cmpwi(CCR6, r_arg_result_type, T_DOUBLE);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
332
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
333 // restore non-volatile registers
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
334 __ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
335
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
336
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
337 // Stack on exit from call_stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
338 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
339 // 0 [C_FRAME]
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
340 // ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
341 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
342 // no call_stub frames left.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
343
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
344 // All non-volatiles have been restored at this point!!
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
345 assert(R3_RET == R3, "R3_RET should be R3");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
346
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
347 __ beq(CCR0, ret_is_object);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
348 __ beq(CCR1, ret_is_long);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
349 __ beq(CCR5, ret_is_float);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
350 __ beq(CCR6, ret_is_double);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
351
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
352 // default:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
353 __ stw(R3_RET, 0, r_arg_result_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
354 __ blr(); // return to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
355
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
356 // case T_OBJECT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
357 __ bind(ret_is_object);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
358 __ std(R3_RET, 0, r_arg_result_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
359 __ blr(); // return to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
360
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
361 // case T_LONG:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
362 __ bind(ret_is_long);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
363 __ std(R3_RET, 0, r_arg_result_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
364 __ blr(); // return to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
365
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
366 // case T_FLOAT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
367 __ bind(ret_is_float);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
368 __ stfs(F1_RET, 0, r_arg_result_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
369 __ blr(); // return to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
370
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
371 // case T_DOUBLE:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
372 __ bind(ret_is_double);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
373 __ stfd(F1_RET, 0, r_arg_result_addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
374 __ blr(); // return to caller
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
375 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
376
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
377 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
378 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
379
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
380 // Return point for a Java call if there's an exception thrown in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
381 // Java code. The exception is caught and transformed into a
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
382 // pending exception stored in JavaThread that can be tested from
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
383 // within the VM.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
384 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
385 address generate_catch_exception() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
386 StubCodeMark mark(this, "StubRoutines", "catch_exception");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
387
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
388 address start = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
389
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
390 // Registers alive
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
391 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
392 // R16_thread
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
393 // R3_ARG1 - address of pending exception
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
394 // R4_ARG2 - return address in call stub
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
395
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
396 const Register exception_file = R21_tmp1;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
397 const Register exception_line = R22_tmp2;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
398
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
399 __ load_const(exception_file, (void*)__FILE__);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
400 __ load_const(exception_line, (void*)__LINE__);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
401
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
402 __ std(R3_ARG1, thread_(pending_exception));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
403 // store into `char *'
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
404 __ std(exception_file, thread_(exception_file));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
405 // store into `int'
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
406 __ stw(exception_line, thread_(exception_line));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
407
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
408 // complete return to VM
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
409 assert(StubRoutines::_call_stub_return_address != NULL, "must have been generated before");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
410
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
411 __ mtlr(R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
412 // continue in call stub
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
413 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
414
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
415 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
416 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
417
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
418 // Continuation point for runtime calls returning with a pending
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
419 // exception. The pending exception check happened in the runtime
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
420 // or native call stub. The pending exception in Thread is
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
421 // converted into a Java-level exception.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
422 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
423 address generate_forward_exception() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
424 StubCodeMark mark(this, "StubRoutines", "forward_exception");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
425 address start = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
426
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
427 #if !defined(PRODUCT)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
428 if (VerifyOops) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
429 // Get pending exception oop.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
430 __ ld(R3_ARG1,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
431 in_bytes(Thread::pending_exception_offset()),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
432 R16_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
433 // Make sure that this code is only executed if there is a pending exception.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
434 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
435 Label L;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
436 __ cmpdi(CCR0, R3_ARG1, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
437 __ bne(CCR0, L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
438 __ stop("StubRoutines::forward exception: no pending exception (1)");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
439 __ bind(L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
440 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
441 __ verify_oop(R3_ARG1, "StubRoutines::forward exception: not an oop");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
442 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
443 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
444
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
445 // Save LR/CR and copy exception pc (LR) into R4_ARG2.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
446 __ save_LR_CR(R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
447 __ push_frame_abi112(0, R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
448 // Find exception handler.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
449 __ call_VM_leaf(CAST_FROM_FN_PTR(address,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
450 SharedRuntime::exception_handler_for_return_address),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
451 R16_thread,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
452 R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
453 // Copy handler's address.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
454 __ mtctr(R3_RET);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
455 __ pop_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
456 __ restore_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
457
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
458 // Set up the arguments for the exception handler:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
459 // - R3_ARG1: exception oop
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
460 // - R4_ARG2: exception pc.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
461
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
462 // Load pending exception oop.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
463 __ ld(R3_ARG1,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
464 in_bytes(Thread::pending_exception_offset()),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
465 R16_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
466
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
467 // The exception pc is the return address in the caller.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
468 // Must load it into R4_ARG2.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
469 __ mflr(R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
470
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
471 #ifdef ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
472 // Make sure exception is set.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
473 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
474 Label L;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
475 __ cmpdi(CCR0, R3_ARG1, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
476 __ bne(CCR0, L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
477 __ stop("StubRoutines::forward exception: no pending exception (2)");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
478 __ bind(L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
479 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
480 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
481
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
482 // Clear the pending exception.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
483 __ li(R0, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
484 __ std(R0,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
485 in_bytes(Thread::pending_exception_offset()),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
486 R16_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
487 // Jump to exception handler.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
488 __ bctr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
489
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
490 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
491 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
492
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
493 #undef __
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
494 #define __ masm->
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
495 // Continuation point for throwing of implicit exceptions that are
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
496 // not handled in the current activation. Fabricates an exception
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
497 // oop and initiates normal exception dispatching in this
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
498 // frame. Only callee-saved registers are preserved (through the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
499 // normal register window / RegisterMap handling). If the compiler
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
500 // needs all registers to be preserved between the fault point and
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
501 // the exception handler then it must assume responsibility for that
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
502 // in AbstractCompiler::continuation_for_implicit_null_exception or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
503 // continuation_for_implicit_division_by_zero_exception. All other
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
504 // implicit exceptions (e.g., NullPointerException or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
505 // AbstractMethodError on entry) are either at call sites or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
506 // otherwise assume that stack unwinding will be initiated, so
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
507 // caller saved registers were assumed volatile in the compiler.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
508 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
509 // Note that we generate only this stub into a RuntimeStub, because
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
510 // it needs to be properly traversed and ignored during GC, so we
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
511 // change the meaning of the "__" macro within this method.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
512 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
513 // Note: the routine set_pc_not_at_call_for_caller in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
514 // SharedRuntime.cpp requires that this code be generated into a
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
515 // RuntimeStub.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
516 address generate_throw_exception(const char* name, address runtime_entry, bool restore_saved_exception_pc,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
517 Register arg1 = noreg, Register arg2 = noreg) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
518 CodeBuffer code(name, 1024 DEBUG_ONLY(+ 512), 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
519 MacroAssembler* masm = new MacroAssembler(&code);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
520
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
521 OopMapSet* oop_maps = new OopMapSet();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
522 int frame_size_in_bytes = frame::abi_112_size;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
523 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
524
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
525 StubCodeMark mark(this, "StubRoutines", "throw_exception");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
526
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
527 address start = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
528
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
529 __ save_LR_CR(R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
530
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
531 // Push a frame.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
532 __ push_frame_abi112(0, R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
533
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
534 address frame_complete_pc = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
535
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
536 if (restore_saved_exception_pc) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
537 __ unimplemented("StubGenerator::throw_exception with restore_saved_exception_pc", 74);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
538 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
539
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
540 // Note that we always have a runtime stub frame on the top of
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
541 // stack by this point. Remember the offset of the instruction
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
542 // whose address will be moved to R11_scratch1.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
543 address gc_map_pc = __ get_PC_trash_LR(R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
544
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
545 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
546
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
547 __ mr(R3_ARG1, R16_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
548 if (arg1 != noreg) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
549 __ mr(R4_ARG2, arg1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
550 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
551 if (arg2 != noreg) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
552 __ mr(R5_ARG3, arg2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
553 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
554 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, runtime_entry),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
555 relocInfo::none);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
556
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
557 // Set an oopmap for the call site.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
558 oop_maps->add_gc_map((int)(gc_map_pc - start), map);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
559
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
560 __ reset_last_Java_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
561
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
562 #ifdef ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
563 // Make sure that this code is only executed if there is a pending
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
564 // exception.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
565 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
566 Label L;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
567 __ ld(R0,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
568 in_bytes(Thread::pending_exception_offset()),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
569 R16_thread);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
570 __ cmpdi(CCR0, R0, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
571 __ bne(CCR0, L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
572 __ stop("StubRoutines::throw_exception: no pending exception");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
573 __ bind(L);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
574 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
575 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
576
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
577 // Pop frame.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
578 __ pop_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
579
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
580 __ restore_LR_CR(R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
581
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
582 __ load_const(R11_scratch1, StubRoutines::forward_exception_entry());
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
583 __ mtctr(R11_scratch1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
584 __ bctr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
585
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
586 // Create runtime stub with OopMap.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
587 RuntimeStub* stub =
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
588 RuntimeStub::new_runtime_stub(name, &code,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
589 /*frame_complete=*/ (int)(frame_complete_pc - start),
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
590 frame_size_in_bytes/wordSize,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
591 oop_maps,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
592 false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
593 return stub->entry_point();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
594 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
595 #undef __
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
596 #define __ _masm->
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
597
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
598 // Generate G1 pre-write barrier for array.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
599 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
600 // Input:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
601 // from - register containing src address (only needed for spilling)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
602 // to - register containing starting address
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
603 // count - register containing element count
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
604 // tmp - scratch register
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
605 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
606 // Kills:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
607 // nothing
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
608 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
609 void gen_write_ref_array_pre_barrier(Register from, Register to, Register count, bool dest_uninitialized, Register Rtmp1) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
610 BarrierSet* const bs = Universe::heap()->barrier_set();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
611 switch (bs->kind()) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
612 case BarrierSet::G1SATBCT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
613 case BarrierSet::G1SATBCTLogging:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
614 // With G1, don't generate the call if we statically know that the target in uninitialized
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
615 if (!dest_uninitialized) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
616 const int spill_slots = 4 * wordSize;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
617 const int frame_size = frame::abi_112_size + spill_slots;
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
618 Label filtered;
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
619
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
620 // Is marking active?
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
621 if (in_bytes(PtrQueue::byte_width_of_active()) == 4) {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
622 __ lwz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
623 } else {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
624 guarantee(in_bytes(PtrQueue::byte_width_of_active()) == 1, "Assumption");
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
625 __ lbz(Rtmp1, in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()), R16_thread);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
626 }
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
627 __ cmpdi(CCR0, Rtmp1, 0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
628 __ beq(CCR0, filtered);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
629
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
630 __ save_LR_CR(R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
631 __ push_frame_abi112(spill_slots, R0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
632 __ std(from, frame_size - 1 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
633 __ std(to, frame_size - 2 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
634 __ std(count, frame_size - 3 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
635
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
636 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre), to, count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
637
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
638 __ ld(from, frame_size - 1 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
639 __ ld(to, frame_size - 2 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
640 __ ld(count, frame_size - 3 * wordSize, R1_SP);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
641 __ pop_frame();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
642 __ restore_LR_CR(R0);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
643
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
644 __ bind(filtered);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
645 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
646 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
647 case BarrierSet::CardTableModRef:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
648 case BarrierSet::CardTableExtension:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
649 case BarrierSet::ModRef:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
650 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
651 default:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
652 ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
653 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
654 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
655
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
656 // Generate CMS/G1 post-write barrier for array.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
657 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
658 // Input:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
659 // addr - register containing starting address
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
660 // count - register containing element count
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
661 // tmp - scratch register
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
662 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
663 // The input registers and R0 are overwritten.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
664 //
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
665 void gen_write_ref_array_post_barrier(Register addr, Register count, Register tmp, bool branchToEnd) {
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
666 BarrierSet* const bs = Universe::heap()->barrier_set();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
667
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
668 switch (bs->kind()) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
669 case BarrierSet::G1SATBCT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
670 case BarrierSet::G1SATBCTLogging:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
671 {
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
672 if (branchToEnd) {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
673 __ save_LR_CR(R0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
674 // We need this frame only to spill LR.
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
675 __ push_frame_abi112(0, R0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
676 __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post), addr, count);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
677 __ pop_frame();
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
678 __ restore_LR_CR(R0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
679 } else {
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
680 // Tail call: fake call from stub caller by branching without linking.
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
681 address entry_point = (address)CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
682 __ mr_if_needed(R3_ARG1, addr);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
683 __ mr_if_needed(R4_ARG2, count);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
684 __ load_const(R11, entry_point, R0);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
685 __ call_c_and_return_to_caller(R11);
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
686 }
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
687 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
688 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
689 case BarrierSet::CardTableModRef:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
690 case BarrierSet::CardTableExtension:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
691 {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
692 Label Lskip_loop, Lstore_loop;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
693 if (UseConcMarkSweepGC) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
694 // TODO PPC port: contribute optimization / requires shared changes
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
695 __ release();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
696 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
697
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
698 CardTableModRefBS* const ct = (CardTableModRefBS*)bs;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
699 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
700 assert_different_registers(addr, count, tmp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
701
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
702 __ sldi(count, count, LogBytesPerHeapOop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
703 __ addi(count, count, -BytesPerHeapOop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
704 __ add(count, addr, count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
705 // Use two shifts to clear out those low order two bits! (Cannot opt. into 1.)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
706 __ srdi(addr, addr, CardTableModRefBS::card_shift);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
707 __ srdi(count, count, CardTableModRefBS::card_shift);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
708 __ subf(count, addr, count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
709 assert_different_registers(R0, addr, count, tmp);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
710 __ load_const(tmp, (address)ct->byte_map_base);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
711 __ addic_(count, count, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
712 __ beq(CCR0, Lskip_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
713 __ li(R0, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
714 __ mtctr(count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
715 // Byte store loop
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
716 __ bind(Lstore_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
717 __ stbx(R0, tmp, addr);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
718 __ addi(addr, addr, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
719 __ bdnz(Lstore_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
720 __ bind(Lskip_loop);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
721
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
722 if (!branchToEnd) __ blr();
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
723 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
724 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
725 case BarrierSet::ModRef:
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
726 if (!branchToEnd) __ blr();
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
727 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
728 default:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
729 ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
730 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
731 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
732
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
733 // Support for void zero_words_aligned8(HeapWord* to, size_t count)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
734 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
735 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
736 // to:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
737 // count:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
738 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
739 // Destroys:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
740 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
741 address generate_zero_words_aligned8() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
742 StubCodeMark mark(this, "StubRoutines", "zero_words_aligned8");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
743
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
744 // Implemented as in ClearArray.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
745 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
746
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
747 Register base_ptr_reg = R3_ARG1; // tohw (needs to be 8b aligned)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
748 Register cnt_dwords_reg = R4_ARG2; // count (in dwords)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
749 Register tmp1_reg = R5_ARG3;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
750 Register tmp2_reg = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
751 Register zero_reg = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
752
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
753 // Procedure for large arrays (uses data cache block zero instruction).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
754 Label dwloop, fast, fastloop, restloop, lastdword, done;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
755 int cl_size=VM_Version::get_cache_line_size(), cl_dwords=cl_size>>3, cl_dwordaddr_bits=exact_log2(cl_dwords);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
756 int min_dcbz=2; // Needs to be positive, apply dcbz only to at least min_dcbz cache lines.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
757
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
758 // Clear up to 128byte boundary if long enough, dword_cnt=(16-(base>>3))%16.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
759 __ dcbtst(base_ptr_reg); // Indicate write access to first cache line ...
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
760 __ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if number of dwords is even.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
761 __ srdi_(tmp1_reg, cnt_dwords_reg, 1); // number of double dwords
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
762 __ load_const_optimized(zero_reg, 0L); // Use as zero register.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
763
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
764 __ cmpdi(CCR1, tmp2_reg, 0); // cnt_dwords even?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
765 __ beq(CCR0, lastdword); // size <= 1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
766 __ mtctr(tmp1_reg); // Speculatively preload counter for rest loop (>0).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
767 __ cmpdi(CCR0, cnt_dwords_reg, (min_dcbz+1)*cl_dwords-1); // Big enough to ensure >=min_dcbz cache lines are included?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
768 __ neg(tmp1_reg, base_ptr_reg); // bit 0..58: bogus, bit 57..60: (16-(base>>3))%16, bit 61..63: 000
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
769
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
770 __ blt(CCR0, restloop); // Too small. (<31=(2*cl_dwords)-1 is sufficient, but bigger performs better.)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
771 __ rldicl_(tmp1_reg, tmp1_reg, 64-3, 64-cl_dwordaddr_bits); // Extract number of dwords to 128byte boundary=(16-(base>>3))%16.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
772
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
773 __ beq(CCR0, fast); // already 128byte aligned
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
774 __ mtctr(tmp1_reg); // Set ctr to hit 128byte boundary (0<ctr<cnt).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
775 __ subf(cnt_dwords_reg, tmp1_reg, cnt_dwords_reg); // rest (>0 since size>=256-8)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
776
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
777 // Clear in first cache line dword-by-dword if not already 128byte aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
778 __ bind(dwloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
779 __ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
780 __ addi(base_ptr_reg, base_ptr_reg, 8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
781 __ bdnz(dwloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
782
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
783 // clear 128byte blocks
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
784 __ bind(fast);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
785 __ srdi(tmp1_reg, cnt_dwords_reg, cl_dwordaddr_bits); // loop count for 128byte loop (>0 since size>=256-8)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
786 __ andi(tmp2_reg, cnt_dwords_reg, 1); // to check if rest even
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
787
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
788 __ mtctr(tmp1_reg); // load counter
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
789 __ cmpdi(CCR1, tmp2_reg, 0); // rest even?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
790 __ rldicl_(tmp1_reg, cnt_dwords_reg, 63, 65-cl_dwordaddr_bits); // rest in double dwords
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
791
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
792 __ bind(fastloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
793 __ dcbz(base_ptr_reg); // Clear 128byte aligned block.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
794 __ addi(base_ptr_reg, base_ptr_reg, cl_size);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
795 __ bdnz(fastloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
796
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
797 //__ dcbtst(base_ptr_reg); // Indicate write access to last cache line.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
798 __ beq(CCR0, lastdword); // rest<=1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
799 __ mtctr(tmp1_reg); // load counter
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
800
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
801 // Clear rest.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
802 __ bind(restloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
803 __ std(zero_reg, 0, base_ptr_reg); // Clear 8byte aligned block.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
804 __ std(zero_reg, 8, base_ptr_reg); // Clear 8byte aligned block.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
805 __ addi(base_ptr_reg, base_ptr_reg, 16);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
806 __ bdnz(restloop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
807
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
808 __ bind(lastdword);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
809 __ beq(CCR1, done);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
810 __ std(zero_reg, 0, base_ptr_reg);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
811 __ bind(done);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
812 __ blr(); // return
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
813
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
814 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
815 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
816
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
817 // The following routine generates a subroutine to throw an asynchronous
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
818 // UnknownError when an unsafe access gets a fault that could not be
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
819 // reasonably prevented by the programmer. (Example: SIGBUS/OBJERR.)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
820 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
821 address generate_handler_for_unsafe_access() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
822 StubCodeMark mark(this, "StubRoutines", "handler_for_unsafe_access");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
823 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
824 __ unimplemented("StubRoutines::handler_for_unsafe_access", 93);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
825 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
826 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
827
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
828 #if !defined(PRODUCT)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
829 // Wrapper which calls oopDesc::is_oop_or_null()
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
830 // Only called by MacroAssembler::verify_oop
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
831 static void verify_oop_helper(const char* message, oop o) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
832 if (!o->is_oop_or_null()) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
833 fatal(message);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
834 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
835 ++ StubRoutines::_verify_oop_count;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
836 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
837 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
838
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
839 // Return address of code to be called from code generated by
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
840 // MacroAssembler::verify_oop.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
841 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
842 // Don't generate, rather use C++ code.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
843 address generate_verify_oop() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
844 StubCodeMark mark(this, "StubRoutines", "verify_oop");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
845
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
846 // this is actually a `FunctionDescriptor*'.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
847 address start = 0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
848
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
849 #if !defined(PRODUCT)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
850 start = CAST_FROM_FN_PTR(address, verify_oop_helper);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
851 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
852
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
853 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
854 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
855
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
856 // Fairer handling of safepoints for native methods.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
857 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
858 // Generate code which reads from the polling page. This special handling is needed as the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
859 // linux-ppc64 kernel before 2.6.6 doesn't set si_addr on some segfaults in 64bit mode
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
860 // (cf. http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.6), especially when we try
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
861 // to read from the safepoint polling page.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
862 address generate_load_from_poll() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
863 StubCodeMark mark(this, "StubRoutines", "generate_load_from_poll");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
864 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
865 __ unimplemented("StubRoutines::verify_oop", 95); // TODO PPC port
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
866 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
867 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
868
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
869 // -XX:+OptimizeFill : convert fill/copy loops into intrinsic
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
870 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
871 // The code is implemented(ported from sparc) as we believe it benefits JVM98, however
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
872 // tracing(-XX:+TraceOptimizeFill) shows the intrinsic replacement doesn't happen at all!
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
873 //
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
874 // Source code in function is_range_check_if() shows that OptimizeFill relaxed the condition
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
875 // for turning on loop predication optimization, and hence the behavior of "array range check"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
876 // and "loop invariant check" could be influenced, which potentially boosted JVM98.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
877 //
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
878 // Generate stub for disjoint short fill. If "aligned" is true, the
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
879 // "to" address is assumed to be heapword aligned.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
880 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
881 // Arguments for generated stub:
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
882 // to: R3_ARG1
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
883 // value: R4_ARG2
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
884 // count: R5_ARG3 treated as signed
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
885 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
886 address generate_fill(BasicType t, bool aligned, const char* name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
887 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
888 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
889
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
890 const Register to = R3_ARG1; // source array address
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
891 const Register value = R4_ARG2; // fill value
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
892 const Register count = R5_ARG3; // elements count
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
893 const Register temp = R6_ARG4; // temp register
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
894
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
895 //assert_clean_int(count, O3); // Make sure 'count' is clean int.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
896
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
897 Label L_exit, L_skip_align1, L_skip_align2, L_fill_byte;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
898 Label L_fill_2_bytes, L_fill_4_bytes, L_fill_elements, L_fill_32_bytes;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
899
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
900 int shift = -1;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
901 switch (t) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
902 case T_BYTE:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
903 shift = 2;
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
904 // Clone bytes (zero extend not needed because store instructions below ignore high order bytes).
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
905 __ rldimi(value, value, 8, 48); // 8 bit -> 16 bit
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
906 __ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
907 __ blt(CCR0, L_fill_elements);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
908 __ rldimi(value, value, 16, 32); // 16 bit -> 32 bit
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
909 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
910 case T_SHORT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
911 shift = 1;
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
912 // Clone bytes (zero extend not needed because store instructions below ignore high order bytes).
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
913 __ rldimi(value, value, 16, 32); // 16 bit -> 32 bit
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
914 __ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
915 __ blt(CCR0, L_fill_elements);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
916 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
917 case T_INT:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
918 shift = 0;
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
919 __ cmpdi(CCR0, count, 2<<shift); // Short arrays (< 8 bytes) fill by element.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
920 __ blt(CCR0, L_fill_4_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
921 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
922 default: ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
923 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
924
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
925 if (!aligned && (t == T_BYTE || t == T_SHORT)) {
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
926 // Align source address at 4 bytes address boundary.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
927 if (t == T_BYTE) {
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
928 // One byte misalignment happens only for byte arrays.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
929 __ andi_(temp, to, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
930 __ beq(CCR0, L_skip_align1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
931 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
932 __ addi(to, to, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
933 __ addi(count, count, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
934 __ bind(L_skip_align1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
935 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
936 // Two bytes misalignment happens only for byte and short (char) arrays.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
937 __ andi_(temp, to, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
938 __ beq(CCR0, L_skip_align2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
939 __ sth(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
940 __ addi(to, to, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
941 __ addi(count, count, -(1 << (shift - 1)));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
942 __ bind(L_skip_align2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
943 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
944
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
945 if (!aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
946 // Align to 8 bytes, we know we are 4 byte aligned to start.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
947 __ andi_(temp, to, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
948 __ beq(CCR0, L_fill_32_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
949 __ stw(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
950 __ addi(to, to, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
951 __ addi(count, count, -(1 << shift));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
952 __ bind(L_fill_32_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
953 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
954
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
955 __ li(temp, 8<<shift); // Prepare for 32 byte loop.
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
956 // Clone bytes int->long as above.
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
957 __ rldimi(value, value, 32, 0); // 32 bit -> 64 bit
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
958
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
959 Label L_check_fill_8_bytes;
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
960 // Fill 32-byte chunks.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
961 __ subf_(count, temp, count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
962 __ blt(CCR0, L_check_fill_8_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
963
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
964 Label L_fill_32_bytes_loop;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
965 __ align(32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
966 __ bind(L_fill_32_bytes_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
967
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
968 __ std(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
969 __ std(value, 8, to);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
970 __ subf_(count, temp, count); // Update count.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
971 __ std(value, 16, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
972 __ std(value, 24, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
973
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
974 __ addi(to, to, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
975 __ bge(CCR0, L_fill_32_bytes_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
976
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
977 __ bind(L_check_fill_8_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
978 __ add_(count, temp, count);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
979 __ beq(CCR0, L_exit);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
980 __ addic_(count, count, -(2 << shift));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
981 __ blt(CCR0, L_fill_4_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
982
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
983 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
984 // Length is too short, just fill 8 bytes at a time.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
985 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
986 Label L_fill_8_bytes_loop;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
987 __ bind(L_fill_8_bytes_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
988 __ std(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
989 __ addic_(count, count, -(2 << shift));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
990 __ addi(to, to, 8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
991 __ bge(CCR0, L_fill_8_bytes_loop);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
992
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
993 // Fill trailing 4 bytes.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
994 __ bind(L_fill_4_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
995 __ andi_(temp, count, 1<<shift);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
996 __ beq(CCR0, L_fill_2_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
997
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
998 __ stw(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
999 if (t == T_BYTE || t == T_SHORT) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1000 __ addi(to, to, 4);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1001 // Fill trailing 2 bytes.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1002 __ bind(L_fill_2_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1003 __ andi_(temp, count, 1<<(shift-1));
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1004 __ beq(CCR0, L_fill_byte);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1005 __ sth(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1006 if (t == T_BYTE) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1007 __ addi(to, to, 2);
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1008 // Fill trailing byte.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1009 __ bind(L_fill_byte);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1010 __ andi_(count, count, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1011 __ beq(CCR0, L_exit);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1012 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1013 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1014 __ bind(L_fill_byte);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1015 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1016 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1017 __ bind(L_fill_2_bytes);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1018 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1019 __ bind(L_exit);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1020 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1021
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1022 // Handle copies less than 8 bytes. Int is handled elsewhere.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1023 if (t == T_BYTE) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1024 __ bind(L_fill_elements);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1025 Label L_fill_2, L_fill_4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1026 __ andi_(temp, count, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1027 __ beq(CCR0, L_fill_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1028 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1029 __ addi(to, to, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1030 __ bind(L_fill_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1031 __ andi_(temp, count, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1032 __ beq(CCR0, L_fill_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1033 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1034 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1035 __ addi(to, to, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1036 __ bind(L_fill_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1037 __ andi_(temp, count, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1038 __ beq(CCR0, L_exit);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1039 __ stb(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1040 __ stb(value, 1, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1041 __ stb(value, 2, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1042 __ stb(value, 3, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1043 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1044 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1045
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1046 if (t == T_SHORT) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1047 Label L_fill_2;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1048 __ bind(L_fill_elements);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1049 __ andi_(temp, count, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1050 __ beq(CCR0, L_fill_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1051 __ sth(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1052 __ addi(to, to, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1053 __ bind(L_fill_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1054 __ andi_(temp, count, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1055 __ beq(CCR0, L_exit);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1056 __ sth(value, 0, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1057 __ sth(value, 2, to);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1058 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1059 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1060 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1061 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1062
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1063
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1064 // Generate overlap test for array copy stubs.
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1065 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1066 // Input:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1067 // R3_ARG1 - from
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1068 // R4_ARG2 - to
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1069 // R5_ARG3 - element count
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1070 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1071 void array_overlap_test(address no_overlap_target, int log2_elem_size) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1072 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1073 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1074
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1075 Label l_overlap;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1076 #ifdef ASSERT
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1077 __ srdi_(tmp2, R5_ARG3, 31);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1078 __ asm_assert_eq("missing zero extend", 0xAFFE);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1079 #endif
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1080
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1081 __ subf(tmp1, R3_ARG1, R4_ARG2); // distance in bytes
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1082 __ sldi(tmp2, R5_ARG3, log2_elem_size); // size in bytes
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1083 __ cmpld(CCR0, R3_ARG1, R4_ARG2); // Use unsigned comparison!
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1084 __ cmpld(CCR1, tmp1, tmp2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1085 __ crand(/*CCR0 lt*/0, /*CCR1 lt*/4+0, /*CCR0 lt*/0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1086 __ blt(CCR0, l_overlap); // Src before dst and distance smaller than size.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1087
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1088 // need to copy forwards
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1089 if (__ is_within_range_of_b(no_overlap_target, __ pc())) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1090 __ b(no_overlap_target);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1091 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1092 __ load_const(tmp1, no_overlap_target, tmp2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1093 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1094 __ bctr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1095 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1096
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1097 __ bind(l_overlap);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1098 // need to copy backwards
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1099 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1100
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1101 // The guideline in the implementations of generate_disjoint_xxx_copy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1102 // (xxx=byte,short,int,long,oop) is to copy as many elements as possible with
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1103 // single instructions, but to avoid alignment interrupts (see subsequent
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1104 // comment). Furthermore, we try to minimize misaligned access, even
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1105 // though they cause no alignment interrupt.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1106 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1107 // In Big-Endian mode, the PowerPC architecture requires implementations to
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1108 // handle automatically misaligned integer halfword and word accesses,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1109 // word-aligned integer doubleword accesses, and word-aligned floating-point
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1110 // accesses. Other accesses may or may not generate an Alignment interrupt
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1111 // depending on the implementation.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1112 // Alignment interrupt handling may require on the order of hundreds of cycles,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1113 // so every effort should be made to avoid misaligned memory values.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1114 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1115 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1116 // Generate stub for disjoint byte copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1117 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1118 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1119 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1120 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1121 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1122 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1123 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1124 address generate_disjoint_byte_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1125 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1126 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1127
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1128 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1129 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1130 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1131 Register tmp4 = R9_ARG7;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1132
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1133
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1134 Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1135 // Don't try anything fancy if arrays don't have many elements.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1136 __ li(tmp3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1137 __ cmpwi(CCR0, R5_ARG3, 17);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1138 __ ble(CCR0, l_6); // copy 4 at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1139
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1140 if (!aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1141 __ xorr(tmp1, R3_ARG1, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1142 __ andi_(tmp1, tmp1, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1143 __ bne(CCR0, l_6); // If arrays don't have the same alignment mod 4, do 4 element copy.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1144
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1145 // Copy elements if necessary to align to 4 bytes.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1146 __ neg(tmp1, R3_ARG1); // Compute distance to alignment boundary.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1147 __ andi_(tmp1, tmp1, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1148 __ beq(CCR0, l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1149
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1150 __ subf(R5_ARG3, tmp1, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1151 __ bind(l_9);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1152 __ lbz(tmp2, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1153 __ addic_(tmp1, tmp1, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1154 __ stb(tmp2, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1155 __ addi(R3_ARG1, R3_ARG1, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1156 __ addi(R4_ARG2, R4_ARG2, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1157 __ bne(CCR0, l_9);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1158
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1159 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1160 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1161
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1162 // copy 8 elements at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1163 __ xorr(tmp2, R3_ARG1, R4_ARG2); // skip if src & dest have differing alignment mod 8
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1164 __ andi_(tmp1, tmp2, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1165 __ bne(CCR0, l_7); // not same alignment -> to or from is aligned -> copy 8
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1166
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1167 // copy a 2-element word if necessary to align to 8 bytes
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1168 __ andi_(R0, R3_ARG1, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1169 __ beq(CCR0, l_7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1170
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1171 __ lwzx(tmp2, R3_ARG1, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1172 __ addi(R5_ARG3, R5_ARG3, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1173 __ stwx(tmp2, R4_ARG2, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1174 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1175 __ addi(R3_ARG1, R3_ARG1, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1176 __ addi(R4_ARG2, R4_ARG2, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1177 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1178 __ bind(l_7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1179
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1180 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1181 __ cmpwi(CCR0, R5_ARG3, 31);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1182 __ ble(CCR0, l_6); // copy 2 at a time if less than 32 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1183
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1184 __ srdi(tmp1, R5_ARG3, 5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1185 __ andi_(R5_ARG3, R5_ARG3, 31);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1186 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1187
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1188 __ bind(l_8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1189 // Use unrolled version for mass copying (copy 32 elements a time)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1190 // Load feeding store gets zero latency on Power6, however not on Power5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1191 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1192 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1193 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1194 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1195 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1196 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1197 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1198 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1199 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1200 __ addi(R3_ARG1, R3_ARG1, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1201 __ addi(R4_ARG2, R4_ARG2, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1202 __ bdnz(l_8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1203 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1204
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1205 __ bind(l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1206
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1207 // copy 4 elements at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1208 __ cmpwi(CCR0, R5_ARG3, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1209 __ blt(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1210 __ srdi(tmp1, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1211 __ mtctr(tmp1); // is > 0
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1212 __ andi_(R5_ARG3, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1213
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1214 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1215 __ addi(R3_ARG1, R3_ARG1, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1216 __ addi(R4_ARG2, R4_ARG2, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1217 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1218 __ lwzu(tmp2, 4, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1219 __ stwu(tmp2, 4, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1220 __ bdnz(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1221 __ addi(R3_ARG1, R3_ARG1, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1222 __ addi(R4_ARG2, R4_ARG2, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1223 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1224
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1225 // do single element copy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1226 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1227 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1228 __ beq(CCR0, l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1229
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1230 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1231 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1232 __ addi(R3_ARG1, R3_ARG1, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1233 __ addi(R4_ARG2, R4_ARG2, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1234
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1235 __ bind(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1236 __ lbzu(tmp2, 1, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1237 __ stbu(tmp2, 1, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1238 __ bdnz(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1239 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1240
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1241 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1242 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1243
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1244 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1245 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1246
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1247 // Generate stub for conjoint byte copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1248 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1249 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1250 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1251 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1252 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1253 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1254 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1255 address generate_conjoint_byte_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1256 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1257 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1258
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1259 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1260 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1261 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1262
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1263 address nooverlap_target = aligned ?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1264 ((FunctionDescriptor*)StubRoutines::arrayof_jbyte_disjoint_arraycopy())->entry() :
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1265 ((FunctionDescriptor*)StubRoutines::jbyte_disjoint_arraycopy())->entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1266
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1267 array_overlap_test(nooverlap_target, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1268 // Do reverse copy. We assume the case of actual overlap is rare enough
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1269 // that we don't have to optimize it.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1270 Label l_1, l_2;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1271
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1272 __ b(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1273 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1274 __ stbx(tmp1, R4_ARG2, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1275 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1276 __ addic_(R5_ARG3, R5_ARG3, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1277 __ lbzx(tmp1, R3_ARG1, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1278 __ bge(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1279
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1280 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1281
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1282 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1283 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1284
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1285 // Generate stub for disjoint short copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1286 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1287 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1288 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1289 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1290 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1291 // elm.count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1292 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1293 // Strategy for aligned==true:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1294 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1295 // If length <= 9:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1296 // 1. copy 2 elements at a time (l_6)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1297 // 2. copy last element if original element count was odd (l_1)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1298 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1299 // If length > 9:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1300 // 1. copy 4 elements at a time until less than 4 elements are left (l_7)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1301 // 2. copy 2 elements at a time until less than 2 elements are left (l_6)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1302 // 3. copy last element if one was left in step 2. (l_1)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1303 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1304 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1305 // Strategy for aligned==false:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1306 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1307 // If length <= 9: same as aligned==true case, but NOTE: load/stores
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1308 // can be unaligned (see comment below)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1309 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1310 // If length > 9:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1311 // 1. continue with step 6. if the alignment of from and to mod 4
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1312 // is different.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1313 // 2. align from and to to 4 bytes by copying 1 element if necessary
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1314 // 3. at l_2 from and to are 4 byte aligned; continue with
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1315 // 5. if they cannot be aligned to 8 bytes because they have
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1316 // got different alignment mod 8.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1317 // 4. at this point we know that both, from and to, have the same
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1318 // alignment mod 8, now copy one element if necessary to get
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1319 // 8 byte alignment of from and to.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1320 // 5. copy 4 elements at a time until less than 4 elements are
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1321 // left; depending on step 3. all load/stores are aligned or
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1322 // either all loads or all stores are unaligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1323 // 6. copy 2 elements at a time until less than 2 elements are
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1324 // left (l_6); arriving here from step 1., there is a chance
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1325 // that all accesses are unaligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1326 // 7. copy last element if one was left in step 6. (l_1)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1327 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1328 // There are unaligned data accesses using integer load/store
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1329 // instructions in this stub. POWER allows such accesses.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1330 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1331 // According to the manuals (PowerISA_V2.06_PUBLIC, Book II,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1332 // Chapter 2: Effect of Operand Placement on Performance) unaligned
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1333 // integer load/stores have good performance. Only unaligned
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1334 // floating point load/stores can have poor performance.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1335 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1336 // TODO:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1337 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1338 // 1. check if aligning the backbranch target of loops is beneficial
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1339 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1340 address generate_disjoint_short_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1341 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1342
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1343 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1344 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1345 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1346 Register tmp4 = R9_ARG7;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1347
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1348 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1349
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1350 Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1351 // don't try anything fancy if arrays don't have many elements
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1352 __ li(tmp3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1353 __ cmpwi(CCR0, R5_ARG3, 9);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1354 __ ble(CCR0, l_6); // copy 2 at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1355
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1356 if (!aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1357 __ xorr(tmp1, R3_ARG1, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1358 __ andi_(tmp1, tmp1, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1359 __ bne(CCR0, l_6); // if arrays don't have the same alignment mod 4, do 2 element copy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1360
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1361 // At this point it is guaranteed that both, from and to have the same alignment mod 4.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1362
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1363 // Copy 1 element if necessary to align to 4 bytes.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1364 __ andi_(tmp1, R3_ARG1, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1365 __ beq(CCR0, l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1366
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1367 __ lhz(tmp2, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1368 __ addi(R3_ARG1, R3_ARG1, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1369 __ sth(tmp2, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1370 __ addi(R4_ARG2, R4_ARG2, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1371 __ addi(R5_ARG3, R5_ARG3, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1372 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1373
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1374 // At this point the positions of both, from and to, are at least 4 byte aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1375
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1376 // Copy 4 elements at a time.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1377 // Align to 8 bytes, but only if both, from and to, have same alignment mod 8.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1378 __ xorr(tmp2, R3_ARG1, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1379 __ andi_(tmp1, tmp2, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1380 __ bne(CCR0, l_7); // not same alignment mod 8 -> copy 4, either from or to will be unaligned
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1381
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1382 // Copy a 2-element word if necessary to align to 8 bytes.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1383 __ andi_(R0, R3_ARG1, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1384 __ beq(CCR0, l_7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1385
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1386 __ lwzx(tmp2, R3_ARG1, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1387 __ addi(R5_ARG3, R5_ARG3, -2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1388 __ stwx(tmp2, R4_ARG2, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1389 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1390 __ addi(R3_ARG1, R3_ARG1, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1391 __ addi(R4_ARG2, R4_ARG2, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1392 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1393 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1394
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1395 __ bind(l_7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1396
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1397 // Copy 4 elements at a time; either the loads or the stores can
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1398 // be unaligned if aligned == false.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1399
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1400 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1401 __ cmpwi(CCR0, R5_ARG3, 15);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1402 __ ble(CCR0, l_6); // copy 2 at a time if less than 16 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1403
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1404 __ srdi(tmp1, R5_ARG3, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1405 __ andi_(R5_ARG3, R5_ARG3, 15);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1406 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1407
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1408 __ bind(l_8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1409 // Use unrolled version for mass copying (copy 16 elements a time).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1410 // Load feeding store gets zero latency on Power6, however not on Power5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1411 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1412 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1413 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1414 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1415 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1416 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1417 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1418 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1419 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1420 __ addi(R3_ARG1, R3_ARG1, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1421 __ addi(R4_ARG2, R4_ARG2, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1422 __ bdnz(l_8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1423 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1424 __ bind(l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1425
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1426 // copy 2 elements at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1427 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1428 __ cmpwi(CCR0, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1429 __ blt(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1430 __ srdi(tmp1, R5_ARG3, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1431 __ andi_(R5_ARG3, R5_ARG3, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1432
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1433 __ addi(R3_ARG1, R3_ARG1, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1434 __ addi(R4_ARG2, R4_ARG2, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1435 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1436
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1437 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1438 __ lwzu(tmp2, 4, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1439 __ stwu(tmp2, 4, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1440 __ bdnz(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1441
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1442 __ addi(R3_ARG1, R3_ARG1, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1443 __ addi(R4_ARG2, R4_ARG2, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1444 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1445
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1446 // do single element copy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1447 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1448 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1449 __ beq(CCR0, l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1450
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1451 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1452 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1453 __ addi(R3_ARG1, R3_ARG1, -2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1454 __ addi(R4_ARG2, R4_ARG2, -2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1455
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1456 __ bind(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1457 __ lhzu(tmp2, 2, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1458 __ sthu(tmp2, 2, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1459 __ bdnz(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1460 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1461 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1462 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1463
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1464 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1465 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1466
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1467 // Generate stub for conjoint short copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1468 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1469 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1470 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1471 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1472 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1473 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1474 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1475 address generate_conjoint_short_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1476 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1477 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1478
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1479 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1480 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1481 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1482
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1483 address nooverlap_target = aligned ?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1484 ((FunctionDescriptor*)StubRoutines::arrayof_jshort_disjoint_arraycopy())->entry() :
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1485 ((FunctionDescriptor*)StubRoutines::jshort_disjoint_arraycopy())->entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1486
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1487 array_overlap_test(nooverlap_target, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1488
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1489 Label l_1, l_2;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1490 __ sldi(tmp1, R5_ARG3, 1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1491 __ b(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1492 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1493 __ sthx(tmp2, R4_ARG2, tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1494 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1495 __ addic_(tmp1, tmp1, -2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1496 __ lhzx(tmp2, R3_ARG1, tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1497 __ bge(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1498
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1499 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1500
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1501 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1502 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1503
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1504 // Generate core code for disjoint int copy (and oop copy on 32-bit). If "aligned"
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1505 // is true, the "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1506 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1507 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1508 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1509 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1510 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1511 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1512 void generate_disjoint_int_copy_core(bool aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1513 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1514 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1515 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1516 Register tmp4 = R0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1517
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1518 Label l_1, l_2, l_3, l_4, l_5, l_6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1519 // for short arrays, just do single element copy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1520 __ li(tmp3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1521 __ cmpwi(CCR0, R5_ARG3, 5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1522 __ ble(CCR0, l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1523
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1524 if (!aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1525 // check if arrays have same alignment mod 8.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1526 __ xorr(tmp1, R3_ARG1, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1527 __ andi_(R0, tmp1, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1528 // Not the same alignment, but ld and std just need to be 4 byte aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1529 __ bne(CCR0, l_4); // to OR from is 8 byte aligned -> copy 2 at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1530
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1531 // copy 1 element to align to and from on an 8 byte boundary
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1532 __ andi_(R0, R3_ARG1, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1533 __ beq(CCR0, l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1534
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1535 __ lwzx(tmp2, R3_ARG1, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1536 __ addi(R5_ARG3, R5_ARG3, -1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1537 __ stwx(tmp2, R4_ARG2, tmp3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1538 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1539 __ addi(R3_ARG1, R3_ARG1, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1540 __ addi(R4_ARG2, R4_ARG2, 4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1541 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1542 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1543 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1544
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1545 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1546 __ cmpwi(CCR0, R5_ARG3, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1547 __ ble(CCR0, l_2); // copy 1 at a time if less than 8 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1548
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1549 __ srdi(tmp1, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1550 __ andi_(R5_ARG3, R5_ARG3, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1551 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1552
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1553 __ bind(l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1554 // Use unrolled version for mass copying (copy 8 elements a time).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1555 // Load feeding store gets zero latency on power6, however not on power 5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1556 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1557 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1558 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1559 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1560 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1561 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1562 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1563 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1564 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1565 __ addi(R3_ARG1, R3_ARG1, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1566 __ addi(R4_ARG2, R4_ARG2, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1567 __ bdnz(l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1568 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1569
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1570 // copy 1 element at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1571 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1572 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1573 __ beq(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1574
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1575 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1576 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1577 __ addi(R3_ARG1, R3_ARG1, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1578 __ addi(R4_ARG2, R4_ARG2, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1579
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1580 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1581 __ lwzu(tmp2, 4, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1582 __ stwu(tmp2, 4, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1583 __ bdnz(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1584 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1585
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1586 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1587 return;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1588 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1589
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1590 // Generate stub for disjoint int copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1591 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1592 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1593 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1594 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1595 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1596 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1597 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1598 address generate_disjoint_int_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1599 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1600 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1601 generate_disjoint_int_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1602 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1603 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1604 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1605
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1606 // Generate core code for conjoint int copy (and oop copy on
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1607 // 32-bit). If "aligned" is true, the "from" and "to" addresses
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1608 // are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1609 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1610 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1611 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1612 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1613 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1614 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1615 void generate_conjoint_int_copy_core(bool aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1616 // Do reverse copy. We assume the case of actual overlap is rare enough
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1617 // that we don't have to optimize it.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1618
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1619 Label l_1, l_2, l_3, l_4, l_5, l_6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1620
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1621 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1622 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1623 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1624 Register tmp4 = R0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1625
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1626 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1627 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1628 __ beq(CCR0, l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1629
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1630 __ sldi(R5_ARG3, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1631 __ add(R3_ARG1, R3_ARG1, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1632 __ add(R4_ARG2, R4_ARG2, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1633 __ srdi(R5_ARG3, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1634
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1635 __ cmpwi(CCR0, R5_ARG3, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1636 __ ble(CCR0, l_5); // copy 1 at a time if less than 8 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1637
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1638 __ srdi(tmp1, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1639 __ andi(R5_ARG3, R5_ARG3, 7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1640 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1641
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1642 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1643 // Use unrolled version for mass copying (copy 4 elements a time).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1644 // Load feeding store gets zero latency on Power6, however not on Power5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1645 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1646 __ addi(R3_ARG1, R3_ARG1, -32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1647 __ addi(R4_ARG2, R4_ARG2, -32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1648 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1649 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1650 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1651 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1652 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1653 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1654 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1655 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1656 __ bdnz(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1657
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1658 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1659 __ beq(CCR0, l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1660
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1661 __ bind(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1662 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1663 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1664 __ lwz(R0, -4, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1665 __ stw(R0, -4, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1666 __ addi(R3_ARG1, R3_ARG1, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1667 __ addi(R4_ARG2, R4_ARG2, -4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1668 __ bdnz(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1669
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1670 __ bind(l_6);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1671 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1672 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1673
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1674 // Generate stub for conjoint int copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1675 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1676 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1677 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1678 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1679 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1680 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1681 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1682 address generate_conjoint_int_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1683 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1684 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1685
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1686 address nooverlap_target = aligned ?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1687 ((FunctionDescriptor*)StubRoutines::arrayof_jint_disjoint_arraycopy())->entry() :
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1688 ((FunctionDescriptor*)StubRoutines::jint_disjoint_arraycopy())->entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1689
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1690 array_overlap_test(nooverlap_target, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1691
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1692 generate_conjoint_int_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1693
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1694 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1695
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1696 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1697 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1698
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1699 // Generate core code for disjoint long copy (and oop copy on
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1700 // 64-bit). If "aligned" is true, the "from" and "to" addresses
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1701 // are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1702 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1703 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1704 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1705 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1706 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1707 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1708 void generate_disjoint_long_copy_core(bool aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1709 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1710 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1711 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1712 Register tmp4 = R0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1713
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1714 Label l_1, l_2, l_3, l_4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1715
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1716 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1717 __ cmpwi(CCR0, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1718 __ ble(CCR0, l_3); // copy 1 at a time if less than 4 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1719
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1720 __ srdi(tmp1, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1721 __ andi_(R5_ARG3, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1722 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1723
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1724 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1725 // Use unrolled version for mass copying (copy 4 elements a time).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1726 // Load feeding store gets zero latency on Power6, however not on Power5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1727 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1728 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1729 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1730 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1731 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1732 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1733 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1734 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1735 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1736 __ addi(R3_ARG1, R3_ARG1, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1737 __ addi(R4_ARG2, R4_ARG2, 32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1738 __ bdnz(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1739 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1740
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1741 // copy 1 element at a time
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1742 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1743 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1744 __ beq(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1745
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1746 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1747 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1748 __ addi(R3_ARG1, R3_ARG1, -8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1749 __ addi(R4_ARG2, R4_ARG2, -8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1750
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1751 __ bind(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1752 __ ldu(R0, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1753 __ stdu(R0, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1754 __ bdnz(l_2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1755
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1756 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1757 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1758 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1759
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1760 // Generate stub for disjoint long copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1761 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1762 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1763 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1764 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1765 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1766 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1767 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1768 address generate_disjoint_long_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1769 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1770 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1771 generate_disjoint_long_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1772 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1773
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1774 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1775 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1776
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1777 // Generate core code for conjoint long copy (and oop copy on
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1778 // 64-bit). If "aligned" is true, the "from" and "to" addresses
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1779 // are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1780 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1781 // Arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1782 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1783 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1784 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1785 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1786 void generate_conjoint_long_copy_core(bool aligned) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1787 Register tmp1 = R6_ARG4;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1788 Register tmp2 = R7_ARG5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1789 Register tmp3 = R8_ARG6;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1790 Register tmp4 = R0;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1791
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1792 Label l_1, l_2, l_3, l_4, l_5;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1793
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1794 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1795 __ beq(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1796
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1797 { // FasterArrayCopy
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1798 __ sldi(R5_ARG3, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1799 __ add(R3_ARG1, R3_ARG1, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1800 __ add(R4_ARG2, R4_ARG2, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1801 __ srdi(R5_ARG3, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1802
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1803 __ cmpwi(CCR0, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1804 __ ble(CCR0, l_5); // copy 1 at a time if less than 4 elements remain
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1805
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1806 __ srdi(tmp1, R5_ARG3, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1807 __ andi(R5_ARG3, R5_ARG3, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1808 __ mtctr(tmp1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1809
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1810 __ bind(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1811 // Use unrolled version for mass copying (copy 4 elements a time).
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1812 // Load feeding store gets zero latency on Power6, however not on Power5.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1813 // Therefore, the following sequence is made for the good of both.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1814 __ addi(R3_ARG1, R3_ARG1, -32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1815 __ addi(R4_ARG2, R4_ARG2, -32);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1816 __ ld(tmp4, 24, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1817 __ ld(tmp3, 16, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1818 __ ld(tmp2, 8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1819 __ ld(tmp1, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1820 __ std(tmp4, 24, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1821 __ std(tmp3, 16, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1822 __ std(tmp2, 8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1823 __ std(tmp1, 0, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1824 __ bdnz(l_4);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1825
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1826 __ cmpwi(CCR0, R5_ARG3, 0);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1827 __ beq(CCR0, l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1828
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1829 __ bind(l_5);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1830 __ mtctr(R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1831 __ bind(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1832 __ ld(R0, -8, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1833 __ std(R0, -8, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1834 __ addi(R3_ARG1, R3_ARG1, -8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1835 __ addi(R4_ARG2, R4_ARG2, -8);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1836 __ bdnz(l_3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1837
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1838 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1839 __ bind(l_1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1840 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1841
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1842 // Generate stub for conjoint long copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1843 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1844 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1845 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1846 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1847 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1848 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1849 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1850 address generate_conjoint_long_copy(bool aligned, const char * name) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1851 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1852 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1853
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1854 address nooverlap_target = aligned ?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1855 ((FunctionDescriptor*)StubRoutines::arrayof_jlong_disjoint_arraycopy())->entry() :
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1856 ((FunctionDescriptor*)StubRoutines::jlong_disjoint_arraycopy())->entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1857
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1858 array_overlap_test(nooverlap_target, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1859 generate_conjoint_long_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1860
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1861 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1862
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1863 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1864 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1865
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1866 // Generate stub for conjoint oop copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1867 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1868 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1869 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1870 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1871 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1872 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1873 // dest_uninitialized: G1 support
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1874 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1875 address generate_conjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1876 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1877
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1878 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1879
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1880 address nooverlap_target = aligned ?
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1881 ((FunctionDescriptor*)StubRoutines::arrayof_oop_disjoint_arraycopy())->entry() :
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1882 ((FunctionDescriptor*)StubRoutines::oop_disjoint_arraycopy())->entry();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1883
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1884 gen_write_ref_array_pre_barrier(R3_ARG1, R4_ARG2, R5_ARG3, dest_uninitialized, R9_ARG7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1885
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1886 // Save arguments.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1887 __ mr(R9_ARG7, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1888 __ mr(R10_ARG8, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1889
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1890 if (UseCompressedOops) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1891 array_overlap_test(nooverlap_target, 2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1892 generate_conjoint_int_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1893 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1894 array_overlap_test(nooverlap_target, 3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1895 generate_conjoint_long_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1896 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1897
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1898 gen_write_ref_array_post_barrier(R9_ARG7, R10_ARG8, R11_scratch1, /*branchToEnd*/ false);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1899 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1900 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1901
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1902 // Generate stub for disjoint oop copy. If "aligned" is true, the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1903 // "from" and "to" addresses are assumed to be heapword aligned.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1904 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1905 // Arguments for generated stub:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1906 // from: R3_ARG1
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1907 // to: R4_ARG2
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1908 // count: R5_ARG3 treated as signed
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1909 // dest_uninitialized: G1 support
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1910 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1911 address generate_disjoint_oop_copy(bool aligned, const char * name, bool dest_uninitialized) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1912 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1913 address start = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1914
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1915 gen_write_ref_array_pre_barrier(R3_ARG1, R4_ARG2, R5_ARG3, dest_uninitialized, R9_ARG7);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1916
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1917 // save some arguments, disjoint_long_copy_core destroys them.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1918 // needed for post barrier
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1919 __ mr(R9_ARG7, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1920 __ mr(R10_ARG8, R5_ARG3);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1921
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1922 if (UseCompressedOops) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1923 generate_disjoint_int_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1924 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1925 generate_disjoint_long_copy_core(aligned);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1926 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1927
14445
67fa91961822 8029940: PPC64 (part 122): C2 compiler port
goetz
parents: 14408
diff changeset
1928 gen_write_ref_array_post_barrier(R9_ARG7, R10_ARG8, R11_scratch1, /*branchToEnd*/ false);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1929
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1930 return start;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1931 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1932
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1933 void generate_arraycopy_stubs() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1934 // Note: the disjoint stubs must be generated first, some of
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1935 // the conjoint stubs use them.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1936
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1937 // non-aligned disjoint versions
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1938 StubRoutines::_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1939 StubRoutines::_jshort_disjoint_arraycopy = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1940 StubRoutines::_jint_disjoint_arraycopy = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1941 StubRoutines::_jlong_disjoint_arraycopy = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1942 StubRoutines::_oop_disjoint_arraycopy = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy", false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1943 StubRoutines::_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy_uninit", true);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1944
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1945 // aligned disjoint versions
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1946 StubRoutines::_arrayof_jbyte_disjoint_arraycopy = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1947 StubRoutines::_arrayof_jshort_disjoint_arraycopy = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1948 StubRoutines::_arrayof_jint_disjoint_arraycopy = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1949 StubRoutines::_arrayof_jlong_disjoint_arraycopy = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1950 StubRoutines::_arrayof_oop_disjoint_arraycopy = generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy", false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1951 StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, "oop_disjoint_arraycopy_uninit", true);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1952
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1953 // non-aligned conjoint versions
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1954 StubRoutines::_jbyte_arraycopy = generate_conjoint_byte_copy(false, "jbyte_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1955 StubRoutines::_jshort_arraycopy = generate_conjoint_short_copy(false, "jshort_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1956 StubRoutines::_jint_arraycopy = generate_conjoint_int_copy(false, "jint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1957 StubRoutines::_jlong_arraycopy = generate_conjoint_long_copy(false, "jlong_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1958 StubRoutines::_oop_arraycopy = generate_conjoint_oop_copy(false, "oop_arraycopy", false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1959 StubRoutines::_oop_arraycopy_uninit = generate_conjoint_oop_copy(false, "oop_arraycopy_uninit", true);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1960
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1961 // aligned conjoint versions
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1962 StubRoutines::_arrayof_jbyte_arraycopy = generate_conjoint_byte_copy(true, "arrayof_jbyte_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1963 StubRoutines::_arrayof_jshort_arraycopy = generate_conjoint_short_copy(true, "arrayof_jshort_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1964 StubRoutines::_arrayof_jint_arraycopy = generate_conjoint_int_copy(true, "arrayof_jint_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1965 StubRoutines::_arrayof_jlong_arraycopy = generate_conjoint_long_copy(true, "arrayof_jlong_arraycopy");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1966 StubRoutines::_arrayof_oop_arraycopy = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1967 StubRoutines::_arrayof_oop_arraycopy_uninit = generate_conjoint_oop_copy(true, "arrayof_oop_arraycopy", true);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1968
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1969 // fill routines
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1970 StubRoutines::_jbyte_fill = generate_fill(T_BYTE, false, "jbyte_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1971 StubRoutines::_jshort_fill = generate_fill(T_SHORT, false, "jshort_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1972 StubRoutines::_jint_fill = generate_fill(T_INT, false, "jint_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1973 StubRoutines::_arrayof_jbyte_fill = generate_fill(T_BYTE, true, "arrayof_jbyte_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1974 StubRoutines::_arrayof_jshort_fill = generate_fill(T_SHORT, true, "arrayof_jshort_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1975 StubRoutines::_arrayof_jint_fill = generate_fill(T_INT, true, "arrayof_jint_fill");
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1976 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1977
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1978 // Safefetch stubs.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1979 void generate_safefetch(const char* name, int size, address* entry, address* fault_pc, address* continuation_pc) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1980 // safefetch signatures:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1981 // int SafeFetch32(int* adr, int errValue);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1982 // intptr_t SafeFetchN (intptr_t* adr, intptr_t errValue);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1983 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1984 // arguments:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1985 // R3_ARG1 = adr
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1986 // R4_ARG2 = errValue
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1987 //
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1988 // result:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1989 // R3_RET = *adr or errValue
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1990
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1991 StubCodeMark mark(this, "StubRoutines", name);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1992
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1993 // Entry point, pc or function descriptor.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1994 *entry = __ emit_fd();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1995
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1996 // Load *adr into R4_ARG2, may fault.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1997 *fault_pc = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1998 switch (size) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
1999 case 4:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2000 // int32_t, signed extended
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2001 __ lwa(R4_ARG2, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2002 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2003 case 8:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2004 // int64_t
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2005 __ ld(R4_ARG2, 0, R3_ARG1);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2006 break;
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2007 default:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2008 ShouldNotReachHere();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2009 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2010
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2011 // return errValue or *adr
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2012 *continuation_pc = __ pc();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2013 __ mr(R3_RET, R4_ARG2);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2014 __ blr();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2015 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2016
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2017 // Initialization
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2018 void generate_initial() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2019 // Generates all stubs and initializes the entry points
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2020
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2021 // Entry points that exist in all platforms.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2022 // Note: This is code that could be shared among different platforms - however the
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2023 // benefit seems to be smaller than the disadvantage of having a
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2024 // much more complicated generator structure. See also comment in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2025 // stubRoutines.hpp.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2026
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2027 StubRoutines::_forward_exception_entry = generate_forward_exception();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2028 StubRoutines::_call_stub_entry = generate_call_stub(StubRoutines::_call_stub_return_address);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2029 StubRoutines::_catch_exception_entry = generate_catch_exception();
17793
c668f307a4c0 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 14445
diff changeset
2030
c668f307a4c0 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 14445
diff changeset
2031 // Build this early so it's available for the interpreter.
c668f307a4c0 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 14445
diff changeset
2032 StubRoutines::_throw_StackOverflowError_entry =
c668f307a4c0 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 14445
diff changeset
2033 generate_throw_exception("StackOverflowError throw_exception",
c668f307a4c0 8031319: PPC64: Some fixes in ppc and aix coding.
goetz
parents: 14445
diff changeset
2034 CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2035 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2036
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2037 void generate_all() {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2038 // Generates all stubs and initializes the entry points
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2039
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2040 // These entry points require SharedInfo::stack0 to be set up in
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2041 // non-core builds
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2042 StubRoutines::_throw_AbstractMethodError_entry = generate_throw_exception("AbstractMethodError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError), false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2043 // Handle IncompatibleClassChangeError in itable stubs.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2044 StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError), false);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2045 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);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2046
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2047 StubRoutines::_handler_for_unsafe_access_entry = generate_handler_for_unsafe_access();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2048
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2049 // support for verify_oop (must happen after universe_init)
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2050 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2051
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2052 // arraycopy stubs used by compilers
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2053 generate_arraycopy_stubs();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2054
17800
c4178a748df9 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 17793
diff changeset
2055 if (UseAESIntrinsics) {
c4178a748df9 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 17793
diff changeset
2056 guarantee(!UseAESIntrinsics, "not yet implemented.");
c4178a748df9 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 17793
diff changeset
2057 }
c4178a748df9 8033117: PPC64: Adapt to 8002074: Support for AES on SPARC
goetz
parents: 17793
diff changeset
2058
14408
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2059 // PPC uses stubs for safefetch.
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2060 generate_safefetch("SafeFetch32", sizeof(int), &StubRoutines::_safefetch32_entry,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2061 &StubRoutines::_safefetch32_fault_pc,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2062 &StubRoutines::_safefetch32_continuation_pc);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2063 generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2064 &StubRoutines::_safefetchN_fault_pc,
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2065 &StubRoutines::_safefetchN_continuation_pc);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2066 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2067
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2068 public:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2069 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2070 // replace the standard masm with a special one:
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2071 _masm = new MacroAssembler(code);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2072 if (all) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2073 generate_all();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2074 } else {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2075 generate_initial();
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2076 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2077 }
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2078 };
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2079
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2080 void StubGenerator_generate(CodeBuffer* code, bool all) {
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2081 StubGenerator g(code, all);
ec28f9c041ff 8019972: PPC64 (part 9): platform files for interpreter only VM.
goetz
parents:
diff changeset
2082 }