Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8258961: move some fields of SafePointNode from public to protected #1899

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hotspot/share/opto/callnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,10 @@ void JVMState::set_map_deep(SafePointNode* map) {
p->set_map(map);
}
}
void JVMState::bind_map(SafePointNode* map) {
set_map(map);
_map->set_jvms(this);
}

// Adapt offsets in in-array after adding or removing an edge.
// Prerequisite is that the JVMState is used by only one node.
Expand Down
26 changes: 15 additions & 11 deletions src/hotspot/share/opto/callnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ class JVMState : public ResourceObj {
void set_offsets(uint off) {
_locoff = _stkoff = _monoff = _scloff = _endoff = off;
}
void set_map(SafePointNode *map) { _map = map; }
void set_map(SafePointNode* map) { _map = map; }
// set_map() and set_jvms() for the map.
void bind_map(SafePointNode* map);
void set_sp(uint sp) { _sp = sp; }
// _reexecute is initialized to "undefined" for a new bci
void set_bci(int bci) {if(_bci != bci)_reexecute=Reexecute_Undefined; _bci = bci; }
Expand Down Expand Up @@ -323,9 +325,16 @@ class JVMState : public ResourceObj {
// potential code sharing) only - conceptually it is independent of
// the Node semantics.
class SafePointNode : public MultiNode {
friend class GraphKit;
friend class JVMState;
virtual bool cmp( const Node &n ) const;
virtual uint size_of() const; // Size is bigger

protected:
JVMState* _jvms; // Pointer to list of JVM State objects
void set_jvms(JVMState* s) {
_jvms = s; // override const attribute in the accessor
navyxliu marked this conversation as resolved.
Show resolved Hide resolved
}
public:
SafePointNode(uint edges, JVMState* jvms,
// A plain safepoint advertises no memory effects (NULL):
Expand All @@ -338,7 +347,6 @@ class SafePointNode : public MultiNode {
init_class_id(Class_SafePoint);
}

JVMState* const _jvms; // Pointer to list of JVM State objects
const TypePtr* _adr_type; // What type of memory does this node produce?
ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
bool _has_ea_local_in_scope; // NoEscape or ArgEscape objects in JVM States
Expand All @@ -347,11 +355,7 @@ class SafePointNode : public MultiNode {
// but some produce a limited subset of that memory as output.
// The adr_type reports the call's behavior as a store, not a load.

virtual JVMState* jvms() const { return _jvms; }
void set_jvms(JVMState* s) {
*(JVMState**)&_jvms = s; // override const attribute in the accessor
}

JVMState* jvms() const { return _jvms; }
private:
void verify_input(JVMState* jvms, uint idx) const {
assert(verify_jvms(jvms), "jvms must match");
Expand Down Expand Up @@ -579,8 +583,8 @@ class CallNode : public SafePointNode {
CallGenerator* _generator; // corresponding CallGenerator for some late inline calls
const char* _name; // Printable name, if _method is NULL

CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type)
: SafePointNode(tf->domain()->cnt(), NULL, adr_type),
CallNode(const TypeFunc* tf, address addr, const TypePtr* adr_type, JVMState* jvms = nullptr)
: SafePointNode(tf->domain()->cnt(), jvms, adr_type),
_tf(tf),
_entry_point(addr),
_cnt(COUNT_UNKNOWN),
Expand Down Expand Up @@ -787,8 +791,8 @@ class CallRuntimeNode : public CallNode {
virtual uint size_of() const; // Size is bigger
public:
CallRuntimeNode(const TypeFunc* tf, address addr, const char* name,
const TypePtr* adr_type)
: CallNode(tf, addr, adr_type)
const TypePtr* adr_type, JVMState* jvms = nullptr)
: CallNode(tf, addr, adr_type, jvms)
{
init_class_id(Class_CallRuntime);
_name = name;
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/opto/generateOptoStub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,10 @@ void GraphKit::gen_stub(address C_function,

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

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

Expand Down
9 changes: 3 additions & 6 deletions src/hotspot/share/opto/parse1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
int arg_size = tf->domain()->cnt();
int max_size = MAX2(arg_size, (int)tf->range()->cnt());
JVMState* jvms = new (this) JVMState(max_size - TypeFunc::Parms);
SafePointNode* map = new SafePointNode(max_size, NULL);
SafePointNode* map = new SafePointNode(max_size, jvms);
record_for_igvn(map);
assert(arg_size == TypeFunc::Parms + (is_osr_compilation() ? 1 : method()->arg_size()), "correct arg_size");
Node_Notes* old_nn = default_node_notes();
Expand All @@ -839,7 +839,6 @@ JVMState* Compile::build_start_state(StartNode* start, const TypeFunc* tf) {
}
assert(jvms->argoff() == TypeFunc::Parms, "parser gets arguments here");
set_default_node_notes(old_nn);
map->set_jvms(jvms);
jvms->set_map(map);
return jvms;
}
Expand Down Expand Up @@ -1074,8 +1073,7 @@ void Parse::do_exits() {
// The exiting JVM state is otherwise a copy of the calling JVMS.
JVMState* caller = kit.jvms();
JVMState* ex_jvms = caller->clone_shallow(C);
ex_jvms->set_map(kit.clone_map());
ex_jvms->map()->set_jvms(ex_jvms);
ex_jvms->bind_map(kit.clone_map());
ex_jvms->set_bci( InvocationEntryBci);
kit.set_jvms(ex_jvms);
if (do_synch) {
Expand All @@ -1094,8 +1092,7 @@ void Parse::do_exits() {
ex_map = kit.make_exception_state(ex_oop);
assert(ex_jvms->same_calls_as(ex_map->jvms()), "sanity");
// Pop the last vestige of this method:
ex_map->set_jvms(caller->clone_shallow(C));
ex_map->jvms()->set_map(ex_map);
caller->clone_shallow(C)->bind_map(ex_map);
_exits.push_exception_state(ex_map);
}
assert(_exits.map() == normal_map, "keep the same return state");
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/runtime/vmStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,6 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
c2_nonstatic_field(JVMState, _method, ciMethod*) \
c2_nonstatic_field(JVMState, _map, SafePointNode*) \
\
c2_nonstatic_field(SafePointNode, _jvms, JVMState* const) \
\
navyxliu marked this conversation as resolved.
Show resolved Hide resolved
c2_nonstatic_field(MachSafePointNode, _jvms, JVMState*) \
c2_nonstatic_field(MachSafePointNode, _jvmadj, uint) \
\
Expand Down