src/share/vm/ci/ciMethodData.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/ci

src/share/vm/ci/ciMethodData.hpp

Print this page
rev 5240 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by:


  24 
  25 #ifndef SHARE_VM_CI_CIMETHODDATA_HPP
  26 #define SHARE_VM_CI_CIMETHODDATA_HPP
  27 
  28 #include "ci/ciClassList.hpp"
  29 #include "ci/ciKlass.hpp"
  30 #include "ci/ciObject.hpp"
  31 #include "ci/ciUtilities.hpp"
  32 #include "oops/methodData.hpp"
  33 #include "oops/oop.inline.hpp"
  34 
  35 class ciBitData;
  36 class ciCounterData;
  37 class ciJumpData;
  38 class ciReceiverTypeData;
  39 class ciRetData;
  40 class ciBranchData;
  41 class ciArrayData;
  42 class ciMultiBranchData;
  43 class ciArgInfoData;


  44 
  45 typedef ProfileData ciProfileData;
  46 
  47 class ciBitData : public BitData {
  48 public:
  49   ciBitData(DataLayout* layout) : BitData(layout) {};
  50 };
  51 
  52 class ciCounterData : public CounterData {
  53 public:
  54   ciCounterData(DataLayout* layout) : CounterData(layout) {};
  55 };
  56 
  57 class ciJumpData : public JumpData {
  58 public:
  59   ciJumpData(DataLayout* layout) : JumpData(layout) {};
  60 };
  61 


























































  62 class ciReceiverTypeData : public ReceiverTypeData {
  63 public:
  64   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
  65 
  66   void set_receiver(uint row, ciKlass* recv) {
  67     assert((uint)row < row_limit(), "oob");
  68     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
  69                   (intptr_t) recv);
  70   }
  71 
  72   ciKlass* receiver(uint row) {
  73     assert((uint)row < row_limit(), "oob");
  74     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
  75     assert(recv == NULL || recv->is_klass(), "wrong type");
  76     return recv;
  77   }
  78 
  79   // Copy & translate from oop based ReceiverTypeData
  80   virtual void translate_from(ProfileData* data) {
  81     translate_receiver_data_from(data);
  82   }
  83   void translate_receiver_data_from(ProfileData* data);
  84 #ifndef PRODUCT
  85   void print_data_on(outputStream* st);
  86   void print_receiver_data_on(outputStream* st);
  87 #endif
  88 };
  89 
  90 class ciVirtualCallData : public VirtualCallData {
  91   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
  92   ciReceiverTypeData* rtd_super() { return (ciReceiverTypeData*) this; }
  93 
  94 public:
  95   ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {};
  96 
  97   void set_receiver(uint row, ciKlass* recv) {
  98     rtd_super()->set_receiver(row, recv);
  99   }
 100 
 101   ciKlass* receiver(uint row) {
 102     return rtd_super()->receiver(row);
 103   }
 104 
 105   // Copy & translate from oop based VirtualCallData
 106   virtual void translate_from(ProfileData* data) {
 107     rtd_super()->translate_receiver_data_from(data);
 108   }
 109 #ifndef PRODUCT
 110   void print_data_on(outputStream* st);

































 111 #endif
 112 };
 113 
 114 
 115 class ciRetData : public RetData {
 116 public:
 117   ciRetData(DataLayout* layout) : RetData(layout) {};
 118 };
 119 
 120 class ciBranchData : public BranchData {
 121 public:
 122   ciBranchData(DataLayout* layout) : BranchData(layout) {};
 123 };
 124 
 125 class ciArrayData : public ArrayData {
 126 public:
 127   ciArrayData(DataLayout* layout) : ArrayData(layout) {};
 128 };
 129 
 130 class ciMultiBranchData : public MultiBranchData {


 232 public:
 233   bool is_method_data() const { return true; }
 234 
 235   void set_mature() { _state = mature_state; }
 236 
 237   bool is_empty()  { return _state == empty_state; }
 238   bool is_mature() { return _state == mature_state; }
 239 
 240   int creation_mileage() { return _orig.creation_mileage(); }
 241   int current_mileage()  { return _current_mileage; }
 242 
 243   int invocation_count() { return _invocation_counter; }
 244   int backedge_count()   { return _backedge_counter;   }
 245   // Transfer information about the method to MethodData*.
 246   // would_profile means we would like to profile this method,
 247   // meaning it's not trivial.
 248   void set_would_profile(bool p);
 249   // Also set the numer of loops and blocks in the method.
 250   // Again, this is used to determine if a method is trivial.
 251   void set_compilation_stats(short loops, short blocks);



 252 
 253   void load_data();
 254 
 255   // Convert a dp (data pointer) to a di (data index).
 256   int dp_to_di(address dp) {
 257     return dp - ((address)_data);
 258   }
 259 
 260   // Get the data at an arbitrary (sort of) data index.
 261   ciProfileData* data_at(int data_index);
 262 
 263   // Walk through the data in order.
 264   ciProfileData* first_data() { return data_at(first_di()); }
 265   ciProfileData* next_data(ciProfileData* current);
 266   bool is_valid(ciProfileData* current) { return current != NULL; }
 267 
 268   // Get the data at an arbitrary bci, or NULL if there is none.
 269   ciProfileData* bci_to_data(int bci);
 270   ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);
 271 




  24 
  25 #ifndef SHARE_VM_CI_CIMETHODDATA_HPP
  26 #define SHARE_VM_CI_CIMETHODDATA_HPP
  27 
  28 #include "ci/ciClassList.hpp"
  29 #include "ci/ciKlass.hpp"
  30 #include "ci/ciObject.hpp"
  31 #include "ci/ciUtilities.hpp"
  32 #include "oops/methodData.hpp"
  33 #include "oops/oop.inline.hpp"
  34 
  35 class ciBitData;
  36 class ciCounterData;
  37 class ciJumpData;
  38 class ciReceiverTypeData;
  39 class ciRetData;
  40 class ciBranchData;
  41 class ciArrayData;
  42 class ciMultiBranchData;
  43 class ciArgInfoData;
  44 class ciCallTypeData;
  45 class ciVirtualCallTypeData;
  46 
  47 typedef ProfileData ciProfileData;
  48 
  49 class ciBitData : public BitData {
  50 public:
  51   ciBitData(DataLayout* layout) : BitData(layout) {};
  52 };
  53 
  54 class ciCounterData : public CounterData {
  55 public:
  56   ciCounterData(DataLayout* layout) : CounterData(layout) {};
  57 };
  58 
  59 class ciJumpData : public JumpData {
  60 public:
  61   ciJumpData(DataLayout* layout) : JumpData(layout) {};
  62 };
  63 
  64 class ciTypeEntries {
  65 protected:
  66   static intptr_t translate_klass(intptr_t k) {
  67     Klass* v = TypeEntries::valid_klass(k);
  68     if (v != NULL) {
  69       ciKlass* klass = CURRENT_ENV->get_klass(v);
  70       return TypeEntries::with_status((intptr_t)klass, k);
  71     }
  72     return TypeEntries::with_status(0, k);
  73   }
  74 
  75 public:
  76   static ciKlass* valid_ciklass(intptr_t k) {
  77     if (!TypeEntries::is_type_none(k) &&
  78         !TypeEntries::is_type_unknown(k)) {
  79       return (ciKlass*)TypeEntries::klass_part(k);
  80     } else {
  81       return NULL;
  82     }
  83   }
  84 
  85 #ifndef PRODUCT
  86   static void print_ciklass(outputStream* st, intptr_t k);
  87 #endif
  88 };
  89 
  90 class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries {
  91 public:
  92   void translate_type_data_from(const TypeStackSlotEntries* args);
  93 
  94   ciKlass* valid_type(int i) const {
  95     return valid_ciklass(type(i));
  96   }
  97 
  98 #ifndef PRODUCT
  99   void print_data_on(outputStream* st) const;
 100 #endif
 101 };
 102 
 103 class ciCallTypeData : public CallTypeData {
 104 public:
 105   ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
 106 
 107   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }
 108 
 109   virtual void translate_from(const ProfileData* data) {
 110     args()->translate_type_data_from(data->as_CallTypeData()->args());
 111   }
 112 
 113   ciKlass* valid_argument_type(int i) const {
 114     return args()->valid_type(i);
 115   }
 116 
 117 #ifndef PRODUCT
 118   void print_data_on(outputStream* st) const;
 119 #endif
 120 };
 121 
 122 class ciReceiverTypeData : public ReceiverTypeData {
 123 public:
 124   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
 125 
 126   void set_receiver(uint row, ciKlass* recv) {
 127     assert((uint)row < row_limit(), "oob");
 128     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
 129                   (intptr_t) recv);
 130   }
 131 
 132   ciKlass* receiver(uint row) const {
 133     assert((uint)row < row_limit(), "oob");
 134     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
 135     assert(recv == NULL || recv->is_klass(), "wrong type");
 136     return recv;
 137   }
 138 
 139   // Copy & translate from oop based ReceiverTypeData
 140   virtual void translate_from(const ProfileData* data) {
 141     translate_receiver_data_from(data);
 142   }
 143   void translate_receiver_data_from(const ProfileData* data);
 144 #ifndef PRODUCT
 145   void print_data_on(outputStream* st) const;
 146   void print_receiver_data_on(outputStream* st) const;
 147 #endif
 148 };
 149 
 150 class ciVirtualCallData : public VirtualCallData {
 151   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
 152   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
 153 
 154 public:
 155   ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {};
 156 
 157   void set_receiver(uint row, ciKlass* recv) {
 158     rtd_super()->set_receiver(row, recv);
 159   }
 160 
 161   ciKlass* receiver(uint row) {
 162     return rtd_super()->receiver(row);
 163   }
 164 
 165   // Copy & translate from oop based VirtualCallData
 166   virtual void translate_from(const ProfileData* data) {
 167     rtd_super()->translate_receiver_data_from(data);
 168   }
 169 #ifndef PRODUCT
 170   void print_data_on(outputStream* st) const;
 171 #endif
 172 };
 173 
 174 class ciVirtualCallTypeData : public VirtualCallTypeData {
 175 private:
 176   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
 177   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
 178 
 179 public:
 180   ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {}
 181 
 182   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); }
 183 
 184   void set_receiver(uint row, ciKlass* recv) {
 185     rtd_super()->set_receiver(row, recv);
 186   }
 187 
 188   ciKlass* receiver(uint row) const {
 189     return rtd_super()->receiver(row);
 190   }
 191 
 192   // Copy & translate from oop based VirtualCallData
 193   virtual void translate_from(const ProfileData* data) {
 194     rtd_super()->translate_receiver_data_from(data);
 195     args()->translate_type_data_from(data->as_VirtualCallTypeData()->args());
 196   }
 197 
 198   ciKlass* valid_argument_type(int i) const {
 199     return args()->valid_type(i);
 200   }
 201 
 202 #ifndef PRODUCT
 203   void print_data_on(outputStream* st) const;
 204 #endif
 205 };
 206 
 207 
 208 class ciRetData : public RetData {
 209 public:
 210   ciRetData(DataLayout* layout) : RetData(layout) {};
 211 };
 212 
 213 class ciBranchData : public BranchData {
 214 public:
 215   ciBranchData(DataLayout* layout) : BranchData(layout) {};
 216 };
 217 
 218 class ciArrayData : public ArrayData {
 219 public:
 220   ciArrayData(DataLayout* layout) : ArrayData(layout) {};
 221 };
 222 
 223 class ciMultiBranchData : public MultiBranchData {


 325 public:
 326   bool is_method_data() const { return true; }
 327 
 328   void set_mature() { _state = mature_state; }
 329 
 330   bool is_empty()  { return _state == empty_state; }
 331   bool is_mature() { return _state == mature_state; }
 332 
 333   int creation_mileage() { return _orig.creation_mileage(); }
 334   int current_mileage()  { return _current_mileage; }
 335 
 336   int invocation_count() { return _invocation_counter; }
 337   int backedge_count()   { return _backedge_counter;   }
 338   // Transfer information about the method to MethodData*.
 339   // would_profile means we would like to profile this method,
 340   // meaning it's not trivial.
 341   void set_would_profile(bool p);
 342   // Also set the numer of loops and blocks in the method.
 343   // Again, this is used to determine if a method is trivial.
 344   void set_compilation_stats(short loops, short blocks);
 345   // If the compiler finds a profiled type is known statically for
 346   // sure, set it in the MethodData
 347   void set_argument_type(int bci, int i, ciKlass* k);
 348 
 349   void load_data();
 350 
 351   // Convert a dp (data pointer) to a di (data index).
 352   int dp_to_di(address dp) {
 353     return dp - ((address)_data);
 354   }
 355 
 356   // Get the data at an arbitrary (sort of) data index.
 357   ciProfileData* data_at(int data_index);
 358 
 359   // Walk through the data in order.
 360   ciProfileData* first_data() { return data_at(first_di()); }
 361   ciProfileData* next_data(ciProfileData* current);
 362   bool is_valid(ciProfileData* current) { return current != NULL; }
 363 
 364   // Get the data at an arbitrary bci, or NULL if there is none.
 365   ciProfileData* bci_to_data(int bci);
 366   ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);
 367 


src/share/vm/ci/ciMethodData.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File