Skip to content
Permalink
Browse files
8258961: move some fields of SafePointNode from public to protected
Reviewed-by: thartmann, kvn
  • Loading branch information
Xin Liu authored and Vladimir Kozlov committed Jan 18, 2021
1 parent 6b4732f commit 533a2d398bd4df46b6b73f01a54622c8fb4a2545
@@ -693,7 +693,7 @@ void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* si
Node* n = kit->gvn().transform(ac);
if (n == ac) {
const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM;
ac->_adr_type = TypeRawPtr::BOTTOM;
ac->set_adr_type(TypeRawPtr::BOTTOM);
kit->set_predefined_output_for_runtime_call(ac, ac->in(TypeFunc::Memory), raw_adr_type);
} else {
kit->set_all_memory(n);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -632,6 +632,12 @@ void JVMState::set_map_deep(SafePointNode* map) {
}
}

// unlike set_map(), this is two-way setting.
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.
void JVMState::adapt_position(int delta) {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@

// Optimization - Graph Style

class Chaitin;
class NamedCounter;
class MultiNode;
class SafePointNode;
@@ -52,13 +51,9 @@ class CallLeafNoFPNode;
class CallNativeNode;
class AllocateNode;
class AllocateArrayNode;
class BoxLockNode;
class LockNode;
class UnlockNode;
class JVMState;
class State;
class StartNode;
class MachCallNode;
class AbstractLockNode;
class LockNode;
class UnlockNode;
class FastLockNode;

//------------------------------StartNode--------------------------------------
@@ -294,7 +289,8 @@ 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; }
void bind_map(SafePointNode* map); // set_map() and set_jvms() for the SafePointNode
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; }
@@ -323,9 +319,26 @@ class JVMState : public ResourceObj {
// potential code sharing) only - conceptually it is independent of
// the Node semantics.
class SafePointNode : public MultiNode {
friend JVMState;
friend class GraphKit;
friend class VMStructs;

virtual bool cmp( const Node &n ) const;
virtual uint size_of() const; // Size is bigger

protected:
JVMState* const _jvms; // Pointer to list of JVM State objects
// Many calls take *all* of memory as input,
// 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.
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

void set_jvms(JVMState* s) {
assert(s != nullptr, "assign NULL value to _jvms");
*(JVMState**)&_jvms = s; // override const attribute in the accessor
}
public:
SafePointNode(uint edges, JVMState* jvms,
// A plain safepoint advertises no memory effects (NULL):
@@ -338,20 +351,7 @@ 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

// Many calls take *all* of memory as input,
// 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");
@@ -474,8 +474,9 @@ class SafePointNode : public MultiNode {
virtual int Opcode() const;
virtual bool pinned() const { return true; }
virtual const Type* Value(PhaseGVN* phase) const;
virtual const Type *bottom_type() const { return Type::CONTROL; }
virtual const TypePtr *adr_type() const { return _adr_type; }
virtual const Type* bottom_type() const { return Type::CONTROL; }
virtual const TypePtr* adr_type() const { return _adr_type; }
void set_adr_type(const TypePtr* adr_type) { _adr_type = adr_type; }
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual Node* Identity(PhaseGVN* phase);
virtual uint ideal_reg() const { return 0; }
@@ -579,8 +580,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),
@@ -787,8 +788,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;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -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);

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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) {
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();
@@ -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;
}
@@ -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) {
@@ -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");

1 comment on commit 533a2d3

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 533a2d3 Jan 18, 2021

Please sign in to comment.