8050860: Cleanup TypeTuple and TypeFunc

Declared fields TypeFunc::_domain, TypeFunc::_range, TypeTuple::_cnt and TypeTuple::_fields private, changed direct accesses to fields to use accessor methods.

Reviewed-by: kvn, vlivanov
This commit is contained in:
Zoltan Majo 2014-07-24 09:15:38 +02:00 committed by Albert Noll
parent cabec1ca5e
commit 1d44fa46f0
4 changed files with 17 additions and 15 deletions

View file

@ -688,7 +688,7 @@ Node *CallNode::match( const ProjNode *proj, const Matcher *match ) {
return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj); return new MachProjNode(this,proj->_con,RegMask::Empty,MachProjNode::unmatched_proj);
case TypeFunc::Parms+1: // For LONG & DOUBLE returns case TypeFunc::Parms+1: // For LONG & DOUBLE returns
assert(tf()->_range->field_at(TypeFunc::Parms+1) == Type::HALF, ""); assert(tf()->range()->field_at(TypeFunc::Parms+1) == Type::HALF, "");
// 2nd half of doubles and longs // 2nd half of doubles and longs
return new MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad); return new MachProjNode(this,proj->_con, RegMask::Empty, (uint)OptoReg::Bad);

View file

@ -2084,9 +2084,9 @@ Node* GraphKit::just_allocated_object(Node* current_control) {
void GraphKit::round_double_arguments(ciMethod* dest_method) { void GraphKit::round_double_arguments(ciMethod* dest_method) {
// (Note: TypeFunc::make has a cache that makes this fast.) // (Note: TypeFunc::make has a cache that makes this fast.)
const TypeFunc* tf = TypeFunc::make(dest_method); const TypeFunc* tf = TypeFunc::make(dest_method);
int nargs = tf->_domain->_cnt - TypeFunc::Parms; int nargs = tf->domain()->cnt() - TypeFunc::Parms;
for (int j = 0; j < nargs; j++) { for (int j = 0; j < nargs; j++) {
const Type *targ = tf->_domain->field_at(j + TypeFunc::Parms); const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms);
if( targ->basic_type() == T_DOUBLE ) { if( targ->basic_type() == T_DOUBLE ) {
// If any parameters are doubles, they must be rounded before // If any parameters are doubles, they must be rounded before
// the call, dstore_rounding does gvn.transform // the call, dstore_rounding does gvn.transform
@ -2188,10 +2188,10 @@ void GraphKit::record_profiled_arguments_for_speculation(ciMethod* dest_method,
return; return;
} }
const TypeFunc* tf = TypeFunc::make(dest_method); const TypeFunc* tf = TypeFunc::make(dest_method);
int nargs = tf->_domain->_cnt - TypeFunc::Parms; int nargs = tf->domain()->cnt() - TypeFunc::Parms;
int skip = Bytecodes::has_receiver(bc) ? 1 : 0; int skip = Bytecodes::has_receiver(bc) ? 1 : 0;
for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) { for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) {
const Type *targ = tf->_domain->field_at(j + TypeFunc::Parms); const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms);
if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) { if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) {
bool maybe_null = true; bool maybe_null = true;
ciKlass* better_type = NULL; ciKlass* better_type = NULL;

View file

@ -5087,11 +5087,11 @@ int TypeFunc::hash(void) const {
// Dump Function Type // Dump Function Type
#ifndef PRODUCT #ifndef PRODUCT
void TypeFunc::dump2( Dict &d, uint depth, outputStream *st ) const { void TypeFunc::dump2( Dict &d, uint depth, outputStream *st ) const {
if( _range->_cnt <= Parms ) if( _range->cnt() <= Parms )
st->print("void"); st->print("void");
else { else {
uint i; uint i;
for (i = Parms; i < _range->_cnt-1; i++) { for (i = Parms; i < _range->cnt()-1; i++) {
_range->field_at(i)->dump2(d,depth,st); _range->field_at(i)->dump2(d,depth,st);
st->print("/"); st->print("/");
} }
@ -5104,9 +5104,9 @@ void TypeFunc::dump2( Dict &d, uint depth, outputStream *st ) const {
return; return;
} }
d.Insert((void*)this,(void*)this); // Stop recursion d.Insert((void*)this,(void*)this); // Stop recursion
if (Parms < _domain->_cnt) if (Parms < _domain->cnt())
_domain->field_at(Parms)->dump2(d,depth-1,st); _domain->field_at(Parms)->dump2(d,depth-1,st);
for (uint i = Parms+1; i < _domain->_cnt; i++) { for (uint i = Parms+1; i < _domain->cnt(); i++) {
st->print(", "); st->print(", ");
_domain->field_at(i)->dump2(d,depth-1,st); _domain->field_at(i)->dump2(d,depth-1,st);
} }

View file

@ -609,16 +609,16 @@ public:
// signature types. // signature types.
class TypeTuple : public Type { class TypeTuple : public Type {
TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { } TypeTuple( uint cnt, const Type **fields ) : Type(Tuple), _cnt(cnt), _fields(fields) { }
const uint _cnt; // Count of fields
const Type ** const _fields; // Array of field types
public: public:
virtual bool eq( const Type *t ) const; virtual bool eq( const Type *t ) const;
virtual int hash() const; // Type specific hashing virtual int hash() const; // Type specific hashing
virtual bool singleton(void) const; // TRUE if type is a singleton virtual bool singleton(void) const; // TRUE if type is a singleton
virtual bool empty(void) const; // TRUE if type is vacuous virtual bool empty(void) const; // TRUE if type is vacuous
public:
const uint _cnt; // Count of fields
const Type ** const _fields; // Array of field types
// Accessors: // Accessors:
uint cnt() const { return _cnt; } uint cnt() const { return _cnt; }
const Type* field_at(uint i) const { const Type* field_at(uint i) const {
@ -1447,6 +1447,10 @@ class TypeFunc : public Type {
virtual int hash() const; // Type specific hashing virtual int hash() const; // Type specific hashing
virtual bool singleton(void) const; // TRUE if type is a singleton virtual bool singleton(void) const; // TRUE if type is a singleton
virtual bool empty(void) const; // TRUE if type is vacuous virtual bool empty(void) const; // TRUE if type is vacuous
const TypeTuple* const _domain; // Domain of inputs
const TypeTuple* const _range; // Range of results
public: public:
// Constants are shared among ADLC and VM // Constants are shared among ADLC and VM
enum { Control = AdlcVMDeps::Control, enum { Control = AdlcVMDeps::Control,
@ -1457,8 +1461,6 @@ public:
Parms = AdlcVMDeps::Parms Parms = AdlcVMDeps::Parms
}; };
const TypeTuple* const _domain; // Domain of inputs
const TypeTuple* const _range; // Range of results
// Accessors: // Accessors:
const TypeTuple* domain() const { return _domain; } const TypeTuple* domain() const { return _domain; }