src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/type.cpp

Print this page




  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciMethodData.hpp"
  27 #include "ci/ciTypeFlow.hpp"
  28 #include "classfile/symbolTable.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "compiler/compileLog.hpp"
  31 #include "libadt/dict.hpp"
  32 #include "memory/gcLocker.hpp"
  33 #include "memory/oopFactory.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "oops/instanceKlass.hpp"
  36 #include "oops/instanceMirrorKlass.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "oops/typeArrayKlass.hpp"
  39 #include "opto/matcher.hpp"
  40 #include "opto/node.hpp"
  41 #include "opto/opcodes.hpp"
  42 #include "opto/type.hpp"
  43 


  44 // Portions of code courtesy of Clifford Click
  45 
  46 // Optimization - Graph Style
  47 
  48 // Dictionary of types shared among compilations.
  49 Dict* Type::_shared_type_dict = NULL;
  50 
  51 // Array which maps compiler types to Basic Types
  52 Type::TypeInfo Type::_type_info[Type::lastype] = {
  53   { Bad,             T_ILLEGAL,    "bad",           false, Node::NotAMachineReg, relocInfo::none          },  // Bad
  54   { Control,         T_ILLEGAL,    "control",       false, 0,                    relocInfo::none          },  // Control
  55   { Bottom,          T_VOID,       "top",           false, 0,                    relocInfo::none          },  // Top
  56   { Bad,             T_INT,        "int:",          false, Op_RegI,              relocInfo::none          },  // Int
  57   { Bad,             T_LONG,       "long:",         false, Op_RegL,              relocInfo::none          },  // Long
  58   { Half,            T_VOID,       "half",          false, 0,                    relocInfo::none          },  // Half
  59   { Bad,             T_NARROWOOP,  "narrowoop:",    false, Op_RegN,              relocInfo::none          },  // NarrowOop
  60   { Bad,             T_NARROWKLASS,"narrowklass:",  false, Op_RegN,              relocInfo::none          },  // NarrowKlass
  61   { Bad,             T_ILLEGAL,    "tuple:",        false, Node::NotAMachineReg, relocInfo::none          },  // Tuple
  62   { Bad,             T_ARRAY,      "array:",        false, Node::NotAMachineReg, relocInfo::none          },  // Array
  63 


 825   return new Type(_type_info[_base].dual_type);
 826 }
 827 
 828 //------------------------------has_memory-------------------------------------
 829 bool Type::has_memory() const {
 830   Type::TYPES tx = base();
 831   if (tx == Memory) return true;
 832   if (tx == Tuple) {
 833     const TypeTuple *t = is_tuple();
 834     for (uint i=0; i < t->cnt(); i++) {
 835       tx = t->field_at(i)->base();
 836       if (tx == Memory)  return true;
 837     }
 838   }
 839   return false;
 840 }
 841 
 842 #ifndef PRODUCT
 843 //------------------------------dump2------------------------------------------
 844 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
 845   st->print(_type_info[_base].msg);
 846 }
 847 
 848 //------------------------------dump-------------------------------------------
 849 void Type::dump_on(outputStream *st) const {
 850   ResourceMark rm;
 851   Dict d(cmpkey,hashkey);       // Stop recursive type dumping
 852   dump2(d,1, st);
 853   if (is_ptr_to_narrowoop()) {
 854     st->print(" [narrow]");
 855   } else if (is_ptr_to_narrowklass()) {
 856     st->print(" [narrowklass]");
 857   }
 858 }
 859 #endif
 860 
 861 //------------------------------singleton--------------------------------------
 862 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
 863 // constants (Ldi nodes).  Singletons are integer, float or double constants.
 864 bool Type::singleton(void) const {
 865   return _base == Top || _base == Half;




  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciMethodData.hpp"
  27 #include "ci/ciTypeFlow.hpp"
  28 #include "classfile/symbolTable.hpp"
  29 #include "classfile/systemDictionary.hpp"
  30 #include "compiler/compileLog.hpp"
  31 #include "libadt/dict.hpp"
  32 #include "memory/gcLocker.hpp"
  33 #include "memory/oopFactory.hpp"
  34 #include "memory/resourceArea.hpp"
  35 #include "oops/instanceKlass.hpp"
  36 #include "oops/instanceMirrorKlass.hpp"
  37 #include "oops/objArrayKlass.hpp"
  38 #include "oops/typeArrayKlass.hpp"
  39 #include "opto/matcher.hpp"
  40 #include "opto/node.hpp"
  41 #include "opto/opcodes.hpp"
  42 #include "opto/type.hpp"
  43 
  44 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  45 
  46 // Portions of code courtesy of Clifford Click
  47 
  48 // Optimization - Graph Style
  49 
  50 // Dictionary of types shared among compilations.
  51 Dict* Type::_shared_type_dict = NULL;
  52 
  53 // Array which maps compiler types to Basic Types
  54 Type::TypeInfo Type::_type_info[Type::lastype] = {
  55   { Bad,             T_ILLEGAL,    "bad",           false, Node::NotAMachineReg, relocInfo::none          },  // Bad
  56   { Control,         T_ILLEGAL,    "control",       false, 0,                    relocInfo::none          },  // Control
  57   { Bottom,          T_VOID,       "top",           false, 0,                    relocInfo::none          },  // Top
  58   { Bad,             T_INT,        "int:",          false, Op_RegI,              relocInfo::none          },  // Int
  59   { Bad,             T_LONG,       "long:",         false, Op_RegL,              relocInfo::none          },  // Long
  60   { Half,            T_VOID,       "half",          false, 0,                    relocInfo::none          },  // Half
  61   { Bad,             T_NARROWOOP,  "narrowoop:",    false, Op_RegN,              relocInfo::none          },  // NarrowOop
  62   { Bad,             T_NARROWKLASS,"narrowklass:",  false, Op_RegN,              relocInfo::none          },  // NarrowKlass
  63   { Bad,             T_ILLEGAL,    "tuple:",        false, Node::NotAMachineReg, relocInfo::none          },  // Tuple
  64   { Bad,             T_ARRAY,      "array:",        false, Node::NotAMachineReg, relocInfo::none          },  // Array
  65 


 827   return new Type(_type_info[_base].dual_type);
 828 }
 829 
 830 //------------------------------has_memory-------------------------------------
 831 bool Type::has_memory() const {
 832   Type::TYPES tx = base();
 833   if (tx == Memory) return true;
 834   if (tx == Tuple) {
 835     const TypeTuple *t = is_tuple();
 836     for (uint i=0; i < t->cnt(); i++) {
 837       tx = t->field_at(i)->base();
 838       if (tx == Memory)  return true;
 839     }
 840   }
 841   return false;
 842 }
 843 
 844 #ifndef PRODUCT
 845 //------------------------------dump2------------------------------------------
 846 void Type::dump2( Dict &d, uint depth, outputStream *st ) const {
 847   st->print_raw(_type_info[_base].msg);
 848 }
 849 
 850 //------------------------------dump-------------------------------------------
 851 void Type::dump_on(outputStream *st) const {
 852   ResourceMark rm;
 853   Dict d(cmpkey,hashkey);       // Stop recursive type dumping
 854   dump2(d,1, st);
 855   if (is_ptr_to_narrowoop()) {
 856     st->print(" [narrow]");
 857   } else if (is_ptr_to_narrowklass()) {
 858     st->print(" [narrowklass]");
 859   }
 860 }
 861 #endif
 862 
 863 //------------------------------singleton--------------------------------------
 864 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
 865 // constants (Ldi nodes).  Singletons are integer, float or double constants.
 866 bool Type::singleton(void) const {
 867   return _base == Top || _base == Half;


src/share/vm/opto/type.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File