author | kbarrett |
Fri, 15 Jun 2018 16:53:58 -0400 | |
changeset 50599 | ecc2af326b5f |
parent 50162 | f9fe56417050 |
child 50728 | 9375184cec98 |
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" |
|
30 |
||
31 |
#define __ masm-> |
|
32 |
||
33 |
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
34 |
Register base, RegisterOrConstant ind_or_offs, Register val, |
|
35 |
Register tmp1, Register tmp2, Register tmp3, bool needs_frame) { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
36 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
37 |
bool in_native = (decorators & IN_NATIVE) != 0; |
49748 | 38 |
bool not_null = (decorators & OOP_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
39 |
assert(in_heap || in_native, "where?"); |
49748 | 40 |
assert_different_registers(base, val, tmp1, tmp2, R0); |
41 |
||
42 |
switch (type) { |
|
43 |
case T_ARRAY: |
|
44 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
45 |
if (UseCompressedOops && in_heap) { |
49748 | 46 |
Register co = tmp1; |
47 |
if (val == noreg) { |
|
48 |
__ li(co, 0); |
|
49 |
} else { |
|
50 |
co = not_null ? __ encode_heap_oop_not_null(tmp1, val) : __ encode_heap_oop(tmp1, val); |
|
51 |
} |
|
52 |
__ stw(co, ind_or_offs, base, tmp2); |
|
53 |
} else { |
|
54 |
if (val == noreg) { |
|
55 |
val = tmp1; |
|
56 |
__ li(val, 0); |
|
57 |
} |
|
58 |
__ std(val, ind_or_offs, base, tmp2); |
|
59 |
} |
|
60 |
break; |
|
61 |
} |
|
62 |
default: Unimplemented(); |
|
63 |
} |
|
64 |
} |
|
65 |
||
66 |
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, |
|
67 |
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
|
68 |
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
|
69 |
bool in_heap = (decorators & IN_HEAP) != 0; |
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
70 |
bool in_native = (decorators & IN_NATIVE) != 0; |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
71 |
bool not_null = (decorators & OOP_NOT_NULL) != 0; |
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
72 |
assert(in_heap || in_native, "where?"); |
49748 | 73 |
assert_different_registers(ind_or_offs.register_or_noreg(), dst, R0); |
74 |
||
75 |
switch (type) { |
|
76 |
case T_ARRAY: |
|
77 |
case T_OBJECT: { |
|
50599
ecc2af326b5f
8204939: Change Access nomenclature: root to native
kbarrett
parents:
50162
diff
changeset
|
78 |
if (UseCompressedOops && in_heap) { |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
79 |
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
|
80 |
__ lwz(dst, ind_or_offs, base); |
49748 | 81 |
__ cmpwi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
82 |
__ beq(CCR0, *L_handle_null); |
49748 | 83 |
__ 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
|
84 |
} 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
|
85 |
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
|
86 |
__ 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
|
87 |
__ 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
|
88 |
} else { // Any oop. |
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
89 |
__ lwz(dst, ind_or_offs, base); |
49748 | 90 |
__ decode_heap_oop(dst); |
91 |
} |
|
92 |
} else { |
|
93 |
__ 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
|
94 |
if (L_handle_null != NULL) { |
49748 | 95 |
__ cmpdi(CCR0, dst, 0); |
50162
f9fe56417050
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC
mdoerr
parents:
49748
diff
changeset
|
96 |
__ beq(CCR0, *L_handle_null); |
49748 | 97 |
} |
98 |
} |
|
99 |
break; |
|
100 |
} |
|
101 |
default: Unimplemented(); |
|
102 |
} |
|
103 |
} |
|
104 |
||
105 |
void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, |
|
106 |
Register tmp1, Register tmp2, bool needs_frame) { |
|
107 |
Label done; |
|
108 |
__ cmpdi(CCR0, value, 0); |
|
109 |
__ beq(CCR0, done); // Use NULL as-is. |
|
110 |
||
111 |
__ clrrdi(tmp1, value, JNIHandles::weak_tag_size); |
|
112 |
__ ld(value, 0, tmp1); // Resolve (untagged) jobject. |
|
113 |
||
114 |
__ verify_oop(value); |
|
115 |
__ bind(done); |
|
116 |
} |