Skip to content

Commit 533a2d3

Browse files
Xin LiuVladimir Kozlov
Xin Liu
authored and
Vladimir Kozlov
committed
8258961: move some fields of SafePointNode from public to protected
Reviewed-by: thartmann, kvn
1 parent 6b4732f commit 533a2d3

File tree

5 files changed

+45
-42
lines changed

5 files changed

+45
-42
lines changed

src/hotspot/share/gc/shared/c2/barrierSetC2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* si
693693
Node* n = kit->gvn().transform(ac);
694694
if (n == ac) {
695695
const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
696-
ac->_adr_type = TypeRawPtr::BOTTOM;
696+
ac->set_adr_type(TypeRawPtr::BOTTOM);
697697
kit->set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type);
698698
} else {
699699
kit->set_all_memory(n);

src/hotspot/share/opto/callnode.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -632,6 +632,12 @@ void JVMState::set_map_deep(SafePointNode* map) {
632632
}
633633
}
634634

635+
// unlike set_map(), this is two-way setting.
636+
void JVMState::bind_map(SafePointNode* map) {
637+
set_map(map);
638+
_map->set_jvms(this);
639+
}
640+
635641
// Adapt offsets in in-array after adding or removing an edge.
636642
// Prerequisite is that the JVMState is used by only one node.
637643
void JVMState::adapt_position(int delta) {

src/hotspot/share/opto/callnode.hpp

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@
3838

3939
// Optimization - Graph Style
4040

41-
class Chaitin;
4241
class NamedCounter;
4342
class MultiNode;
4443
class SafePointNode;
@@ -52,13 +51,9 @@ class CallLeafNoFPNode;
5251
class CallNativeNode;
5352
class AllocateNode;
5453
class AllocateArrayNode;
55-
class BoxLockNode;
56-
class LockNode;
57-
class UnlockNode;
58-
class JVMState;
59-
class State;
60-
class StartNode;
61-
class MachCallNode;
54+
class AbstractLockNode;
55+
class LockNode;
56+
class UnlockNode;
6257
class FastLockNode;
6358

6459
//------------------------------StartNode--------------------------------------
@@ -294,7 +289,8 @@ class JVMState : public ResourceObj {
294289
void set_offsets(uint off) {
295290
_locoff = _stkoff = _monoff = _scloff = _endoff = off;
296291
}
297-
void set_map(SafePointNode *map) { _map = map; }
292+
void set_map(SafePointNode* map) { _map = map; }
293+
void bind_map(SafePointNode* map); // set_map() and set_jvms() for the SafePointNode
298294
void set_sp(uint sp) { _sp = sp; }
299295
// _reexecute is initialized to "undefined" for a new bci
300296
void set_bci(int bci) {if(_bci != bci)_reexecute=Reexecute_Undefined; _bci = bci; }
@@ -323,9 +319,26 @@ class JVMState : public ResourceObj {
323319
// potential code sharing) only - conceptually it is independent of
324320
// the Node semantics.
325321
class SafePointNode : public MultiNode {
322+
friend JVMState;
323+
friend class GraphKit;
324+
friend class VMStructs;
325+
326326
virtual bool cmp( const Node &n ) const;
327327
virtual uint size_of() const; // Size is bigger
328328

329+
protected:
330+
JVMState* const _jvms; // Pointer to list of JVM State objects
331+
// Many calls take *all* of memory as input,
332+
// but some produce a limited subset of that memory as output.
333+
// The adr_type reports the call's behavior as a store, not a load.
334+
const TypePtr* _adr_type; // What type of memory does this node produce?
335+
ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
336+
bool _has_ea_local_in_scope; // NoEscape or ArgEscape objects in JVM States
337+
338+
void set_jvms(JVMState* s) {
339+
assert(s != nullptr, "assign NULL value to _jvms");
340+
*(JVMState**)&_jvms = s; // override const attribute in the accessor
341+
}
329342
public:
330343
SafePointNode(uint edges, JVMState* jvms,
331344
// A plain safepoint advertises no memory effects (NULL):
@@ -338,20 +351,7 @@ class SafePointNode : public MultiNode {
338351
init_class_id(Class_SafePoint);
339352
}
340353

341-
JVMState* const _jvms; // Pointer to list of JVM State objects
342-
const TypePtr* _adr_type; // What type of memory does this node produce?
343-
ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
344-
bool _has_ea_local_in_scope; // NoEscape or ArgEscape objects in JVM States
345-
346-
// Many calls take *all* of memory as input,
347-
// but some produce a limited subset of that memory as output.
348-
// The adr_type reports the call's behavior as a store, not a load.
349-
350-
virtual JVMState* jvms() const { return _jvms; }
351-
void set_jvms(JVMState* s) {
352-
*(JVMState**)&_jvms = s; // override const attribute in the accessor
353-
}
354-
354+
JVMState* jvms() const { return _jvms; }
355355
private:
356356
void verify_input(JVMState* jvms, uint idx) const {
357357
assert(verify_jvms(jvms), "jvms must match");
@@ -474,8 +474,9 @@ class SafePointNode : public MultiNode {
474474
virtual int Opcode() const;
475475
virtual bool pinned() const { return true; }
476476
virtual const Type* Value(PhaseGVN* phase) const;
477-
virtual const Type *bottom_type() const { return Type::CONTROL; }
478-
virtual const TypePtr *adr_type() const { return _adr_type; }
477+
virtual const Type* bottom_type() const { return Type::CONTROL; }
478+
virtual const TypePtr* adr_type() const { return _adr_type; }
479+
void set_adr_type(const TypePtr* adr_type) { _adr_type = adr_type; }
479480
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
480481
virtual Node* Identity(PhaseGVN* phase);
481482
virtual uint ideal_reg() const { return 0; }
@@ -579,8 +580,8 @@ class CallNode : public SafePointNode {
579580
CallGenerator* _generator; // corresponding CallGenerator for some late inline calls
580581
const char* _name; // Printable name, if _method is NULL
581582

582-
CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
583-
: SafePointNode(tf->domain()->cnt(), NULL, adr_type),
583+
CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type, JVMState* jvms = nullptr)
584+
: SafePointNode(tf->domain()->cnt(), jvms, adr_type),
584585
_tf(tf),
585586
_entry_point(addr),
586587
_cnt(COUNT_UNKNOWN),
@@ -787,8 +788,8 @@ class CallRuntimeNode : public CallNode {
787788
virtual uint size_of() const; // Size is bigger
788789
public:
789790
CallRuntimeNode(const TypeFunc* tf, address addr, const char* name,
790-
const TypePtr* adr_type)
791-
: CallNode(tf, addr, adr_type)
791+
const TypePtr* adr_type, JVMState* jvms = nullptr)
792+
: CallNode(tf, addr, adr_type, jvms)
792793
{
793794
init_class_id(Class_CallRuntime);
794795
_name = name;

src/hotspot/share/opto/generateOptoStub.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -165,11 +165,10 @@ void GraphKit::gen_stub(address C_function,
165165

166166
//-----------------------------
167167
// Make the call node.
168-
CallRuntimeNode *call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM);
168+
CallRuntimeNode* call = new CallRuntimeNode(c_sig, C_function, name, TypePtr::BOTTOM, new (C) JVMState(0));
169169
//-----------------------------
170170

171171
// Fix-up the debug info for the call.
172-
call->set_jvms(new (C) JVMState(0));
173172
call->jvms()->set_bci(0);
174173
call->jvms()->set_offsets(cnt);
175174

src/hotspot/share/opto/parse1.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -815,7 +815,7 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
815815
int arg_size = tf->domain()->cnt();
816816
int max_size = MAX2(arg_size, (int)tf->range()->cnt());
817817
JVMState* jvms = new (this) JVMState(max_size - TypeFunc::Parms);
818-
SafePointNode* map = new SafePointNode(max_size, NULL);
818+
SafePointNode* map = new SafePointNode(max_size, jvms);
819819
record_for_igvn(map);
820820
assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size");
821821
Node_Notes* old_nn = default_node_notes();
@@ -839,7 +839,6 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
839839
}
840840
assert(jvms->argoff() == TypeFunc::Parms, "parser gets arguments here");
841841
set_default_node_notes(old_nn);
842-
map->set_jvms(jvms);
843842
jvms->set_map(map);
844843
return jvms;
845844
}
@@ -1074,8 +1073,7 @@ void Parse::do_exits() {
10741073
// The exiting JVM state is otherwise a copy of the calling JVMS.
10751074
JVMState* caller = kit.jvms();
10761075
JVMState* ex_jvms = caller->clone_shallow(C);
1077-
ex_jvms->set_map(kit.clone_map());
1078-
ex_jvms->map()->set_jvms(ex_jvms);
1076+
ex_jvms->bind_map(kit.clone_map());
10791077
ex_jvms->set_bci( InvocationEntryBci);
10801078
kit.set_jvms(ex_jvms);
10811079
if (do_synch) {
@@ -1094,8 +1092,7 @@ void Parse::do_exits() {
10941092
ex_map = kit.make_exception_state(ex_oop);
10951093
assert(ex_jvms->same_calls_as(ex_map->jvms()), "sanity");
10961094
// Pop the last vestige of this method:
1097-
ex_map->set_jvms(caller->clone_shallow(C));
1098-
ex_map->jvms()->set_map(ex_map);
1095+
caller->clone_shallow(C)->bind_map(ex_map);
10991096
_exits.push_exception_state(ex_map);
11001097
}
11011098
assert(_exits.map() == normal_map, "keep the same return state");

0 commit comments

Comments
 (0)