Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/cpu/s390/gc/shared/barrierSetAssembler_s390.cpp
41153 views
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
#include "oops/compressedOops.hpp"
31
#include "runtime/jniHandles.hpp"
32
33
#define __ masm->
34
35
void BarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
36
Register dst, Register count, bool do_return) {
37
if (do_return) { __ z_br(Z_R14); }
38
}
39
40
void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
41
const Address& addr, Register dst, Register tmp1, Register tmp2, Label *L_handle_null) {
42
bool in_heap = (decorators & IN_HEAP) != 0;
43
bool in_native = (decorators & IN_NATIVE) != 0;
44
bool not_null = (decorators & IS_NOT_NULL) != 0;
45
assert(in_heap || in_native, "where?");
46
47
switch (type) {
48
case T_ARRAY:
49
case T_OBJECT: {
50
if (UseCompressedOops && in_heap) {
51
__ z_llgf(dst, addr);
52
if (L_handle_null != NULL) { // Label provided.
53
__ compareU32_and_branch(dst, (intptr_t)0, Assembler::bcondEqual, *L_handle_null);
54
__ oop_decoder(dst, dst, false);
55
} else {
56
__ oop_decoder(dst, dst, !not_null);
57
}
58
} else {
59
__ z_lg(dst, addr);
60
if (L_handle_null != NULL) {
61
__ compareU64_and_branch(dst, (intptr_t)0, Assembler::bcondEqual, *L_handle_null);
62
}
63
}
64
break;
65
}
66
default: Unimplemented();
67
}
68
}
69
70
void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
71
const Address& addr, Register val, Register tmp1, Register tmp2, Register tmp3) {
72
bool in_heap = (decorators & IN_HEAP) != 0;
73
bool in_native = (decorators & IN_NATIVE) != 0;
74
bool not_null = (decorators & IS_NOT_NULL) != 0;
75
assert(in_heap || in_native, "where?");
76
assert_different_registers(val, tmp1, tmp2);
77
78
switch (type) {
79
case T_ARRAY:
80
case T_OBJECT: {
81
if (UseCompressedOops && in_heap) {
82
if (val == noreg) {
83
__ clear_mem(addr, 4);
84
} else if (CompressedOops::mode() == CompressedOops::UnscaledNarrowOop) {
85
__ z_st(val, addr);
86
} else {
87
Register tmp = (tmp1 != Z_R1) ? tmp1 : tmp2; // Avoid tmp == Z_R1 (see oop_encoder).
88
__ oop_encoder(tmp, val, !not_null);
89
__ z_st(tmp, addr);
90
}
91
} else {
92
if (val == noreg) {
93
__ clear_mem(addr, 8);
94
} else {
95
__ z_stg(val, addr);
96
}
97
}
98
break;
99
}
100
default: Unimplemented();
101
}
102
}
103
104
void BarrierSetAssembler::resolve_jobject(MacroAssembler* masm, Register value, Register tmp1, Register tmp2) {
105
NearLabel Ldone;
106
__ z_ltgr(tmp1, value);
107
__ z_bre(Ldone); // Use NULL result as-is.
108
109
__ z_nill(value, ~JNIHandles::weak_tag_mask);
110
__ z_lg(value, 0, value); // Resolve (untagged) jobject.
111
112
__ verify_oop(value, FILE_AND_LINE);
113
__ bind(Ldone);
114
}
115
116
void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
117
Register obj, Register tmp, Label& slowpath) {
118
__ z_nill(obj, ~JNIHandles::weak_tag_mask);
119
__ z_lg(obj, 0, obj); // Resolve (untagged) jobject.
120
}
121
122