author | mdoerr |
Tue, 30 Jul 2019 17:54:53 +0200 | |
changeset 57594 | 61c2e3e7315d |
parent 54780 | f8d182aedc92 |
child 59014 | 36fde8064316 |
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" |
|
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54352
diff
changeset
|
30 |
#include "oops/compressedOops.hpp" |
54352
e0603b4537c3
8221726: Multiple build failures after JDK-8221698 (Remove redundant includes from popular header files)
shade
parents:
50728
diff
changeset
|
31 |
#include "runtime/jniHandles.hpp" |
49748 | 32 |
|
33 |
#define __ masm-> |
|
34 |
||
35 |
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
36 |
Register base, RegisterOrConstant ind_or_offs, Register val, |
|
37 |
Register tmp1, Register tmp2, Register tmp3, bool needs_frame) { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
38 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
39 |
bool in_native = (decorators & IN_NATIVE) != 0; |
50728 | 40 |
bool not_null = (decorators & IS_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
41 |
assert(in_heap || in_native, "where?"); |
49748 | 42 |
assert_different_registers(base, val, tmp1, tmp2, R0); |
43 |
||
44 |
switch (type) { |
|
45 |
case T_ARRAY: |
|
46 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
47 |
if (UseCompressedOops && in_heap) { |
49748 | 48 |
Register co = tmp1; |
49 |
if (val == noreg) { |
|
50 |
__ li(co, 0); |
|
51 |
} else { |
|
52 |
co = not_null ? __ encode_heap_oop_not_null(tmp1, val) : __ encode_heap_oop(tmp1, val); |
|
53 |
} |
|
54 |
__ stw(co, ind_or_offs, base, tmp2); |
|
55 |
} else { |
|
56 |
if (val == noreg) { |
|
57 |
val = tmp1; |
|
58 |
__ li(val, 0); |
|
59 |
} |
|
60 |
__ std(val, ind_or_offs, base, tmp2); |
|
61 |
} |
|
62 |
break; |
|
63 |
} |
|
64 |
default: Unimplemented(); |
|
65 |
} |
|
66 |
} |
|
67 |
||
68 |
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
69 |
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
|
70 |
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
|
71 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
72 |
bool in_native = (decorators & IN_NATIVE) != 0; |
50728 | 73 |
bool not_null = (decorators & IS_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
74 |
assert(in_heap || in_native, "where?"); |
49748 | 75 |
assert_different_registers(ind_or_offs.register_or_noreg(), dst, R0); |
76 |
||
77 |
switch (type) { |
|
78 |
case T_ARRAY: |
|
79 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
80 |
if (UseCompressedOops && in_heap) { |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
81 |
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
|
82 |
__ lwz(dst, ind_or_offs, base); |
49748 | 83 |
__ cmpwi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
84 |
__ beq(CCR0, *L_handle_null); |
49748 | 85 |
__ 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
|
86 |
} else if (not_null) { // Guaranteed to be not null. |
54780
f8d182aedc92
8223136: Move compressed oops functions to CompressedOops class
stefank
parents:
54352
diff
changeset
|
87 |
Register narrowOop = (tmp1 != noreg && CompressedOops::base_disjoint()) ? tmp1 : dst; |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
88 |
__ 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
|
89 |
__ 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
|
90 |
} else { // Any oop. |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
91 |
__ lwz(dst, ind_or_offs, base); |
49748 | 92 |
__ decode_heap_oop(dst); |
93 |
} |
|
94 |
} else { |
|
95 |
__ 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
|
96 |
if (L_handle_null != NULL) { |
49748 | 97 |
__ cmpdi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
98 |
__ beq(CCR0, *L_handle_null); |
49748 | 99 |
} |
100 |
} |
|
101 |
break; |
|
102 |
} |
|
103 |
default: Unimplemented(); |
|
104 |
} |
|
105 |
} |
|
106 |
||
107 |
void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, |
|
108 |
Register tmp1, Register tmp2, bool needs_frame) { |
|
109 |
Label done; |
|
110 |
__ cmpdi(CCR0, value, 0); |
|
111 |
__ beq(CCR0, done); // Use NULL as-is. |
|
112 |
||
113 |
__ clrrdi(tmp1, value, JNIHandles::weak_tag_size); |
|
114 |
__ ld(value, 0, tmp1); // Resolve (untagged) jobject. |
|
115 |
||
116 |
__ verify_oop(value); |
|
117 |
__ bind(done); |
|
118 |
} |
|
57594 | 119 |
|
120 |
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register dst, Register jni_env, |
|
121 |
Register obj, Register tmp, Label& slowpath) { |
|
122 |
__ clrrdi(dst, obj, JNIHandles::weak_tag_size); |
|
123 |
__ ld(dst, 0, dst); // Resolve (untagged) jobject. |
|
124 |
} |