author | shade |
Mon, 01 Apr 2019 10:04:22 +0200 | |
changeset 54352 | e0603b4537c3 |
parent 50728 | 9375184cec98 |
child 54780 | f8d182aedc92 |
permissions | -rw-r--r-- |
49748 | 1 |
/* |
2 |
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* Copyright (c) 2018, SAP SE. All rights reserved. |
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
* |
|
6 |
* This code is free software; you can redistribute it and/or modify it |
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
|
8 |
* published by the Free Software Foundation. |
|
9 |
* |
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
* accompanied this code). |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License version |
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
* |
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
* or visit www.oracle.com if you need additional information or have any |
|
22 |
* questions. |
|
23 |
* |
|
24 |
*/ |
|
25 |
||
26 |
#include "precompiled.hpp" |
|
27 |
#include "asm/macroAssembler.inline.hpp" |
|
28 |
#include "gc/shared/barrierSetAssembler.hpp" |
|
29 |
#include "interpreter/interp_masm.hpp" |
|
54352
e0603b4537c3
8221726: Multiple build failures after JDK-8221698 (Remove redundant includes from popular header files)
shade
parents:
50728
diff
changeset
|
30 |
#include "runtime/jniHandles.hpp" |
49748 | 31 |
|
32 |
#define __ masm-> |
|
33 |
||
34 |
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
35 |
Register base, RegisterOrConstant ind_or_offs, Register val, |
|
36 |
Register tmp1, Register tmp2, Register tmp3, bool needs_frame) { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
37 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
38 |
bool in_native = (decorators & IN_NATIVE) != 0; |
50728 | 39 |
bool not_null = (decorators & IS_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
40 |
assert(in_heap || in_native, "where?"); |
49748 | 41 |
assert_different_registers(base, val, tmp1, tmp2, R0); |
42 |
||
43 |
switch (type) { |
|
44 |
case T_ARRAY: |
|
45 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
46 |
if (UseCompressedOops && in_heap) { |
49748 | 47 |
Register co = tmp1; |
48 |
if (val == noreg) { |
|
49 |
__ li(co, 0); |
|
50 |
} else { |
|
51 |
co = not_null ? __ encode_heap_oop_not_null(tmp1, val) : __ encode_heap_oop(tmp1, val); |
|
52 |
} |
|
53 |
__ stw(co, ind_or_offs, base, tmp2); |
|
54 |
} else { |
|
55 |
if (val == noreg) { |
|
56 |
val = tmp1; |
|
57 |
__ li(val, 0); |
|
58 |
} |
|
59 |
__ std(val, ind_or_offs, base, tmp2); |
|
60 |
} |
|
61 |
break; |
|
62 |
} |
|
63 |
default: Unimplemented(); |
|
64 |
} |
|
65 |
} |
|
66 |
||
67 |
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
68 |
Register base, RegisterOrConstant ind_or_offs, Register dst, |
|
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
69 |
Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) { |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
70 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
71 |
bool in_native = (decorators & IN_NATIVE) != 0; |
50728 | 72 |
bool not_null = (decorators & IS_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
73 |
assert(in_heap || in_native, "where?"); |
49748 | 74 |
assert_different_registers(ind_or_offs.register_or_noreg(), dst, R0); |
75 |
||
76 |
switch (type) { |
|
77 |
case T_ARRAY: |
|
78 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
79 |
if (UseCompressedOops && in_heap) { |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
80 |
if (L_handle_null != NULL) { // Label provided. |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
81 |
__ lwz(dst, ind_or_offs, base); |
49748 | 82 |
__ cmpwi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
83 |
__ beq(CCR0, *L_handle_null); |
49748 | 84 |
__ decode_heap_oop_not_null(dst); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
85 |
} else if (not_null) { // Guaranteed to be not null. |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
86 |
Register narrowOop = (tmp1 != noreg && Universe::narrow_oop_base_disjoint()) ? tmp1 : dst; |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
87 |
__ lwz(narrowOop, ind_or_offs, base); |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
88 |
__ decode_heap_oop_not_null(dst, narrowOop); |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
89 |
} else { // Any oop. |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
90 |
__ lwz(dst, ind_or_offs, base); |
49748 | 91 |
__ decode_heap_oop(dst); |
92 |
} |
|
93 |
} else { |
|
94 |
__ ld(dst, ind_or_offs, base); |
|
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
95 |
if (L_handle_null != NULL) { |
49748 | 96 |
__ cmpdi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
97 |
__ beq(CCR0, *L_handle_null); |
49748 | 98 |
} |
99 |
} |
|
100 |
break; |
|
101 |
} |
|
102 |
default: Unimplemented(); |
|
103 |
} |
|
104 |
} |
|
105 |
||
106 |
void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, |
|
107 |
Register tmp1, Register tmp2, bool needs_frame) { |
|
108 |
Label done; |
|
109 |
__ cmpdi(CCR0, value, 0); |
|
110 |
__ beq(CCR0, done); // Use NULL as-is. |
|
111 |
||
112 |
__ clrrdi(tmp1, value, JNIHandles::weak_tag_size); |
|
113 |
__ ld(value, 0, tmp1); // Resolve (untagged) jobject. |
|
114 |
||
115 |
__ verify_oop(value); |
|
116 |
__ bind(done); |
|
117 |
} |