author | shade |
Tue, 01 May 2018 19:13:31 +0200 | |
changeset 49938 | 2c2a722a2c0c |
parent 49906 | 4bb58f644e4e |
child 49950 | 7b916885654d |
permissions | -rw-r--r-- |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
1 |
/* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
4 |
* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
8 |
* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
13 |
* accompanied this code). |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
14 |
* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
18 |
* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
21 |
* questions. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
22 |
* |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
23 |
*/ |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
24 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
26 |
#include "asm/macroAssembler.inline.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
27 |
#include "gc/g1/g1BarrierSet.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
28 |
#include "gc/g1/g1BarrierSetAssembler.hpp" |
49938
2c2a722a2c0c
8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents:
49906
diff
changeset
|
29 |
#include "gc/g1/g1ThreadLocalData.hpp" |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
30 |
#include "gc/g1/g1CardTable.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
31 |
#include "gc/g1/heapRegion.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
32 |
#include "interpreter/interp_masm.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
33 |
#include "runtime/sharedRuntime.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
34 |
#include "runtime/thread.hpp" |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
35 |
#include "utilities/macros.hpp" |
49906 | 36 |
#ifdef COMPILER1 |
37 |
#include "c1/c1_LIRAssembler.hpp" |
|
38 |
#include "c1/c1_MacroAssembler.hpp" |
|
39 |
#include "gc/g1/c1/g1BarrierSetC1.hpp" |
|
40 |
#endif |
|
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
41 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
42 |
#define __ masm-> |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
43 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
44 |
#ifdef PRODUCT |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
45 |
#define BLOCK_COMMENT(str) /* nothing */ |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
46 |
#else |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
47 |
#define BLOCK_COMMENT(str) __ block_comment(str) |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
48 |
#endif |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
49 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
50 |
#define BIND(label) bind(label); BLOCK_COMMENT(#label ":") |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
51 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
52 |
void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
53 |
Register addr, Register count, int callee_saved_regs) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
54 |
bool dest_uninitialized = (decorators & AS_DEST_NOT_INITIALIZED) != 0; |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
55 |
if (!dest_uninitialized) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
56 |
assert( addr->encoding() < callee_saved_regs, "addr must be saved"); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
57 |
assert(count->encoding() < callee_saved_regs, "count must be saved"); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
58 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
59 |
BLOCK_COMMENT("PreBarrier"); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
60 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
61 |
#ifdef AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
62 |
callee_saved_regs = align_up(callee_saved_regs, 2); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
63 |
for (int i = 0; i < callee_saved_regs; i += 2) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
64 |
__ raw_push(as_Register(i), as_Register(i+1)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
65 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
66 |
#else |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
67 |
RegisterSet saved_regs = RegisterSet(R0, as_Register(callee_saved_regs-1)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
68 |
__ push(saved_regs | R9ifScratched); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
69 |
#endif // AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
70 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
71 |
if (addr != R0) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
72 |
assert_different_registers(count, R0); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
73 |
__ mov(R0, addr); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
74 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
75 |
#ifdef AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
76 |
__ zero_extend(R1, count, 32); // G1BarrierSet::write_ref_array_pre_*_entry takes size_t |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
77 |
#else |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
78 |
if (count != R1) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
79 |
__ mov(R1, count); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
80 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
81 |
#endif // AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
82 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
83 |
if (UseCompressedOops) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
84 |
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_narrow_oop_entry)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
85 |
} else { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
86 |
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_pre_oop_entry)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
87 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
88 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
89 |
#ifdef AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
90 |
for (int i = callee_saved_regs - 2; i >= 0; i -= 2) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
91 |
__ raw_pop(as_Register(i), as_Register(i+1)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
92 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
93 |
#else |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
94 |
__ pop(saved_regs | R9ifScratched); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
95 |
#endif // AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
96 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
97 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
98 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
99 |
void G1BarrierSetAssembler::gen_write_ref_array_post_barrier(MacroAssembler* masm, DecoratorSet decorators, |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
100 |
Register addr, Register count, Register tmp) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
101 |
|
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
102 |
BLOCK_COMMENT("G1PostBarrier"); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
103 |
if (addr != R0) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
104 |
assert_different_registers(count, R0); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
105 |
__ mov(R0, addr); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
106 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
107 |
#ifdef AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
108 |
__ zero_extend(R1, count, 32); // G1BarrierSet::write_ref_array_post_entry takes size_t |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
109 |
#else |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
110 |
if (count != R1) { |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
111 |
__ mov(R1, count); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
112 |
} |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
113 |
#if R9_IS_SCRATCHED |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
114 |
// Safer to save R9 here since callers may have been written |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
115 |
// assuming R9 survives. This is suboptimal but is not in |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
116 |
// general worth optimizing for the few platforms where R9 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
117 |
// is scratched. Note that the optimization might not be to |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
118 |
// difficult for this particular call site. |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
119 |
__ push(R9); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
120 |
#endif // !R9_IS_SCRATCHED |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
121 |
#endif // !AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
122 |
__ call(CAST_FROM_FN_PTR(address, G1BarrierSet::write_ref_array_post_entry)); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
123 |
#ifndef AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
124 |
#if R9_IS_SCRATCHED |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
125 |
__ pop(R9); |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
126 |
#endif // !R9_IS_SCRATCHED |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
127 |
#endif // !AARCH64 |
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
diff
changeset
|
128 |
} |
49906 | 129 |
|
130 |
#ifdef COMPILER1 |
|
131 |
||
132 |
#undef __ |
|
133 |
#define __ ce->masm()-> |
|
134 |
||
135 |
void G1BarrierSetAssembler::gen_pre_barrier_stub(LIR_Assembler* ce, G1PreBarrierStub* stub) { |
|
136 |
G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1(); |
|
137 |
// At this point we know that marking is in progress. |
|
138 |
// If do_load() is true then we have to emit the |
|
139 |
// load of the previous value; otherwise it has already |
|
140 |
// been loaded into _pre_val. |
|
141 |
||
142 |
__ bind(*stub->entry()); |
|
143 |
assert(stub->pre_val()->is_register(), "Precondition."); |
|
144 |
||
145 |
Register pre_val_reg = stub->pre_val()->as_register(); |
|
146 |
||
147 |
if (stub->do_load()) { |
|
148 |
ce->mem2reg(stub->addr(), stub->pre_val(), T_OBJECT, stub->patch_code(), stub->info(), false /*wide*/, false /*unaligned*/); |
|
149 |
} |
|
150 |
||
151 |
__ cbz(pre_val_reg, *stub->continuation()); |
|
152 |
ce->verify_reserved_argument_area_size(1); |
|
153 |
__ str(pre_val_reg, Address(SP)); |
|
154 |
__ call(bs->pre_barrier_c1_runtime_code_blob()->code_begin(), relocInfo::runtime_call_type); |
|
155 |
||
156 |
__ b(*stub->continuation()); |
|
157 |
} |
|
158 |
||
159 |
void G1BarrierSetAssembler::gen_post_barrier_stub(LIR_Assembler* ce, G1PostBarrierStub* stub) { |
|
160 |
G1BarrierSetC1* bs = (G1BarrierSetC1*)BarrierSet::barrier_set()->barrier_set_c1(); |
|
161 |
__ bind(*stub->entry()); |
|
162 |
assert(stub->addr()->is_register(), "Precondition."); |
|
163 |
assert(stub->new_val()->is_register(), "Precondition."); |
|
164 |
Register new_val_reg = stub->new_val()->as_register(); |
|
165 |
__ cbz(new_val_reg, *stub->continuation()); |
|
166 |
ce->verify_reserved_argument_area_size(1); |
|
167 |
__ str(stub->addr()->as_pointer_register(), Address(SP)); |
|
168 |
__ call(bs->post_barrier_c1_runtime_code_blob()->code_begin(), relocInfo::runtime_call_type); |
|
169 |
__ b(*stub->continuation()); |
|
170 |
} |
|
171 |
||
172 |
#undef __ |
|
173 |
#define __ sasm-> |
|
174 |
||
175 |
void G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub(StubAssembler* sasm) { |
|
176 |
// Input: |
|
177 |
// - pre_val pushed on the stack |
|
178 |
||
49938
2c2a722a2c0c
8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents:
49906
diff
changeset
|
179 |
__ set_info("g1_pre_barrier_slow_id", false); |
49906 | 180 |
|
181 |
// save at least the registers that need saving if the runtime is called |
|
182 |
#ifdef AARCH64 |
|
183 |
__ raw_push(R0, R1); |
|
184 |
__ raw_push(R2, R3); |
|
185 |
const int nb_saved_regs = 4; |
|
186 |
#else // AARCH64 |
|
187 |
const RegisterSet saved_regs = RegisterSet(R0,R3) | RegisterSet(R12) | RegisterSet(LR); |
|
188 |
const int nb_saved_regs = 6; |
|
189 |
assert(nb_saved_regs == saved_regs.size(), "fix nb_saved_regs"); |
|
190 |
__ push(saved_regs); |
|
191 |
#endif // AARCH64 |
|
192 |
||
193 |
const Register r_pre_val_0 = R0; // must be R0, to be ready for the runtime call |
|
194 |
const Register r_index_1 = R1; |
|
195 |
const Register r_buffer_2 = R2; |
|
196 |
||
197 |
Address queue_active(Rthread, in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset())); |
|
198 |
Address queue_index(Rthread, in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset())); |
|
199 |
Address buffer(Rthread, in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset())); |
|
200 |
||
201 |
Label done; |
|
202 |
Label runtime; |
|
203 |
||
204 |
// Is marking still active? |
|
205 |
assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption"); |
|
206 |
__ ldrb(R1, queue_active); |
|
207 |
__ cbz(R1, done); |
|
208 |
||
209 |
__ ldr(r_index_1, queue_index); |
|
210 |
__ ldr(r_pre_val_0, Address(SP, nb_saved_regs*wordSize)); |
|
211 |
__ ldr(r_buffer_2, buffer); |
|
212 |
||
213 |
__ subs(r_index_1, r_index_1, wordSize); |
|
214 |
__ b(runtime, lt); |
|
215 |
||
216 |
__ str(r_index_1, queue_index); |
|
217 |
__ str(r_pre_val_0, Address(r_buffer_2, r_index_1)); |
|
218 |
||
219 |
__ bind(done); |
|
220 |
||
221 |
#ifdef AARCH64 |
|
222 |
__ raw_pop(R2, R3); |
|
223 |
__ raw_pop(R0, R1); |
|
224 |
#else // AARCH64 |
|
225 |
__ pop(saved_regs); |
|
226 |
#endif // AARCH64 |
|
227 |
||
228 |
__ ret(); |
|
229 |
||
230 |
__ bind(runtime); |
|
231 |
||
232 |
__ save_live_registers(); |
|
233 |
||
234 |
assert(r_pre_val_0 == c_rarg0, "pre_val should be in R0"); |
|
235 |
__ mov(c_rarg1, Rthread); |
|
236 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), c_rarg0, c_rarg1); |
|
237 |
||
238 |
__ restore_live_registers_without_return(); |
|
239 |
||
240 |
__ b(done); |
|
241 |
} |
|
242 |
||
243 |
void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) { |
|
244 |
// Input: |
|
245 |
// - store_addr, pushed on the stack |
|
246 |
||
49938
2c2a722a2c0c
8202379: ARM32 is broken after JDK-8201543 (Modularize C1 GC barriers)
shade
parents:
49906
diff
changeset
|
247 |
__ set_info("g1_post_barrier_slow_id", false); |
49906 | 248 |
|
249 |
Label done; |
|
250 |
Label recheck; |
|
251 |
Label runtime; |
|
252 |
||
253 |
Address queue_index(Rthread, in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset())); |
|
254 |
Address buffer(Rthread, in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())); |
|
255 |
||
256 |
AddressLiteral cardtable(ci_card_table_address_as<address>(), relocInfo::none); |
|
257 |
||
258 |
// save at least the registers that need saving if the runtime is called |
|
259 |
#ifdef AARCH64 |
|
260 |
__ raw_push(R0, R1); |
|
261 |
__ raw_push(R2, R3); |
|
262 |
const int nb_saved_regs = 4; |
|
263 |
#else // AARCH64 |
|
264 |
const RegisterSet saved_regs = RegisterSet(R0,R3) | RegisterSet(R12) | RegisterSet(LR); |
|
265 |
const int nb_saved_regs = 6; |
|
266 |
assert(nb_saved_regs == saved_regs.size(), "fix nb_saved_regs"); |
|
267 |
__ push(saved_regs); |
|
268 |
#endif // AARCH64 |
|
269 |
||
270 |
const Register r_card_addr_0 = R0; // must be R0 for the slow case |
|
271 |
const Register r_obj_0 = R0; |
|
272 |
const Register r_card_base_1 = R1; |
|
273 |
const Register r_tmp2 = R2; |
|
274 |
const Register r_index_2 = R2; |
|
275 |
const Register r_buffer_3 = R3; |
|
276 |
const Register tmp1 = Rtemp; |
|
277 |
||
278 |
__ ldr(r_obj_0, Address(SP, nb_saved_regs*wordSize)); |
|
279 |
// Note: there is a comment in x86 code about not using |
|
280 |
// ExternalAddress / lea, due to relocation not working |
|
281 |
// properly for that address. Should be OK for arm, where we |
|
282 |
// explicitly specify that 'cardtable' has a relocInfo::none |
|
283 |
// type. |
|
284 |
__ lea(r_card_base_1, cardtable); |
|
285 |
__ add(r_card_addr_0, r_card_base_1, AsmOperand(r_obj_0, lsr, CardTable::card_shift)); |
|
286 |
||
287 |
// first quick check without barrier |
|
288 |
__ ldrb(r_tmp2, Address(r_card_addr_0)); |
|
289 |
||
290 |
__ cmp(r_tmp2, (int)G1CardTable::g1_young_card_val()); |
|
291 |
__ b(recheck, ne); |
|
292 |
||
293 |
__ bind(done); |
|
294 |
||
295 |
#ifdef AARCH64 |
|
296 |
__ raw_pop(R2, R3); |
|
297 |
__ raw_pop(R0, R1); |
|
298 |
#else // AARCH64 |
|
299 |
__ pop(saved_regs); |
|
300 |
#endif // AARCH64 |
|
301 |
||
302 |
__ ret(); |
|
303 |
||
304 |
__ bind(recheck); |
|
305 |
||
306 |
__ membar(MacroAssembler::Membar_mask_bits(MacroAssembler::StoreLoad), tmp1); |
|
307 |
||
308 |
// reload card state after the barrier that ensures the stored oop was visible |
|
309 |
__ ldrb(r_tmp2, Address(r_card_addr_0)); |
|
310 |
||
311 |
assert(CardTable::dirty_card_val() == 0, "adjust this code"); |
|
312 |
__ cbz(r_tmp2, done); |
|
313 |
||
314 |
// storing region crossing non-NULL, card is clean. |
|
315 |
// dirty card and log. |
|
316 |
||
317 |
assert(0 == (int)CardTable::dirty_card_val(), "adjust this code"); |
|
318 |
if ((ci_card_table_address_as<intptr_t>() & 0xff) == 0) { |
|
319 |
// Card table is aligned so the lowest byte of the table address base is zero. |
|
320 |
__ strb(r_card_base_1, Address(r_card_addr_0)); |
|
321 |
} else { |
|
322 |
__ strb(__ zero_register(r_tmp2), Address(r_card_addr_0)); |
|
323 |
} |
|
324 |
||
325 |
__ ldr(r_index_2, queue_index); |
|
326 |
__ ldr(r_buffer_3, buffer); |
|
327 |
||
328 |
__ subs(r_index_2, r_index_2, wordSize); |
|
329 |
__ b(runtime, lt); // go to runtime if now negative |
|
330 |
||
331 |
__ str(r_index_2, queue_index); |
|
332 |
||
333 |
__ str(r_card_addr_0, Address(r_buffer_3, r_index_2)); |
|
334 |
||
335 |
__ b(done); |
|
336 |
||
337 |
__ bind(runtime); |
|
338 |
||
339 |
__ save_live_registers(); |
|
340 |
||
341 |
assert(r_card_addr_0 == c_rarg0, "card_addr should be in R0"); |
|
342 |
__ mov(c_rarg1, Rthread); |
|
343 |
__ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), c_rarg0, c_rarg1); |
|
344 |
||
345 |
__ restore_live_registers_without_return(); |
|
346 |
||
347 |
__ b(done); |
|
348 |
} |
|
349 |
||
350 |
#undef __ |
|
351 |
||
352 |
#endif // COMPILER1 |