Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.cpp
38922 views
1
/*
2
* Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved.
3
*
4
* This code is free software; you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 2 only, as
6
* published by the Free Software Foundation.
7
*
8
* This code is distributed in the hope that it will be useful, but WITHOUT
9
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11
* version 2 for more details (a copy is included in the LICENSE file that
12
* accompanied this code).
13
*
14
* You should have received a copy of the GNU General Public License version
15
* 2 along with this work; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*
18
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19
* or visit www.oracle.com if you need additional information or have any
20
* questions.
21
*
22
*/
23
24
#include "precompiled.hpp"
25
#include "gc_implementation/shenandoah/shenandoahBarrierSet.hpp"
26
#include "gc_implementation/shenandoah/shenandoahRuntime.hpp"
27
#include "gc_implementation/shenandoah/c2/shenandoahBarrierSetC2.hpp"
28
#include "gc_implementation/shenandoah/c2/shenandoahSupport.hpp"
29
#include "opto/type.hpp"
30
#include "runtime/thread.hpp"
31
32
ShenandoahBarrierSetC2* ShenandoahBarrierSetC2::bsc2() {
33
return ShenandoahBarrierSet::barrier_set()->bsc2();
34
}
35
36
bool ShenandoahBarrierSetC2::is_shenandoah_lrb_call(Node* call) {
37
if (!call->is_CallLeaf()) {
38
return false;
39
}
40
41
address entry_point = call->as_CallLeaf()->entry_point();
42
return (entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier)) ||
43
(entry_point == CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_narrow));
44
}
45
46
bool ShenandoahBarrierSetC2::is_shenandoah_state_load(Node* n) {
47
if (!n->is_Load()) return false;
48
const int state_offset = in_bytes(JavaThread::gc_state_offset());
49
return n->in(2)->is_AddP() && n->in(2)->in(2)->Opcode() == Op_ThreadLocal
50
&& n->in(2)->in(3)->is_Con()
51
&& n->in(2)->in(3)->bottom_type()->is_intptr_t()->get_con() == state_offset;
52
}
53
54
const TypeFunc* ShenandoahBarrierSetC2::shenandoah_load_reference_barrier_Type() {
55
const Type **fields = TypeTuple::fields(2);
56
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
57
fields[TypeFunc::Parms+1] = TypeRawPtr::BOTTOM; // original load address
58
59
const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
60
61
// create result type (range)
62
fields = TypeTuple::fields(1);
63
fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL;
64
const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
65
66
return TypeFunc::make(domain, range);
67
}
68
69
Node* ShenandoahBarrierSetC2::step_over_gc_barrier(Node* c) {
70
if (c->Opcode() == Op_ShenandoahLoadReferenceBarrier) {
71
return c->in(ShenandoahLoadReferenceBarrierNode::ValueIn);
72
}
73
return c;
74
}
75
76
Node* ShenandoahBarrierSetC2::load_reference_barrier(GraphKit* kit, Node* n) const {
77
if (ShenandoahLoadRefBarrier) {
78
return kit->gvn().transform(new (kit->C) ShenandoahLoadReferenceBarrierNode(NULL, n));
79
} else {
80
return n;
81
}
82
}
83
84