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 5403 : 8023657: New type profiling points: arguments to call
Summary: x86 interpreter and c1 type profiling for arguments at calls
Reviewed-by: kvn, twisti
rev 5404 : 8026054: New type profiling points: type of return values at calls
Summary: x86 interpreter and c1 type profiling for return values at calls
Reviewed-by:
rev 5405 : imported patch kvn


  87   }
  88 
  89 #ifndef PRODUCT
  90   static void print_ciklass(outputStream* st, intptr_t k);
  91 #endif
  92 };
  93 
  94 class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries {
  95 public:
  96   void translate_type_data_from(const TypeStackSlotEntries* args);
  97 
  98   ciKlass* valid_type(int i) const {
  99     return valid_ciklass(type(i));
 100   }
 101 
 102 #ifndef PRODUCT
 103   void print_data_on(outputStream* st) const;
 104 #endif
 105 };
 106 













 107 class ciCallTypeData : public CallTypeData {
 108 public:
 109   ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
 110 
 111   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }

 112 
 113   virtual void translate_from(const ProfileData* data) {

 114     args()->translate_type_data_from(data->as_CallTypeData()->args());
 115   }









 116 
 117   ciKlass* valid_argument_type(int i) const {

 118     return args()->valid_type(i);
 119   }
 120 










 121 #ifndef PRODUCT
 122   void print_data_on(outputStream* st) const;
 123 #endif
 124 };
 125 
 126 class ciReceiverTypeData : public ReceiverTypeData {
 127 public:
 128   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
 129 
 130   void set_receiver(uint row, ciKlass* recv) {
 131     assert((uint)row < row_limit(), "oob");
 132     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
 133                   (intptr_t) recv);
 134   }
 135 
 136   ciKlass* receiver(uint row) const {
 137     assert((uint)row < row_limit(), "oob");
 138     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
 139     assert(recv == NULL || recv->is_klass(), "wrong type");
 140     return recv;


 162     rtd_super()->set_receiver(row, recv);
 163   }
 164 
 165   ciKlass* receiver(uint row) {
 166     return rtd_super()->receiver(row);
 167   }
 168 
 169   // Copy & translate from oop based VirtualCallData
 170   virtual void translate_from(const ProfileData* data) {
 171     rtd_super()->translate_receiver_data_from(data);
 172   }
 173 #ifndef PRODUCT
 174   void print_data_on(outputStream* st) const;
 175 #endif
 176 };
 177 
 178 class ciVirtualCallTypeData : public VirtualCallTypeData {
 179 private:
 180   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
 181   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
 182 
 183 public:
 184   ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {}
 185 
 186   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); }
 187 
 188   void set_receiver(uint row, ciKlass* recv) {
 189     rtd_super()->set_receiver(row, recv);
 190   }
 191 
 192   ciKlass* receiver(uint row) const {
 193     return rtd_super()->receiver(row);
 194   }
 195 



 196   // Copy & translate from oop based VirtualCallData
 197   virtual void translate_from(const ProfileData* data) {
 198     rtd_super()->translate_receiver_data_from(data);

 199     args()->translate_type_data_from(data->as_VirtualCallTypeData()->args());
 200   }









 201 
 202   ciKlass* valid_argument_type(int i) const {

 203     return args()->valid_type(i);
 204   }
 205 










 206 #ifndef PRODUCT
 207   void print_data_on(outputStream* st) const;
 208 #endif
 209 };
 210 
 211 
 212 class ciRetData : public RetData {
 213 public:
 214   ciRetData(DataLayout* layout) : RetData(layout) {};
 215 };
 216 
 217 class ciBranchData : public BranchData {
 218 public:
 219   ciBranchData(DataLayout* layout) : BranchData(layout) {};
 220 };
 221 
 222 class ciArrayData : public ArrayData {
 223 public:
 224   ciArrayData(DataLayout* layout) : ArrayData(layout) {};
 225 };


 330   bool is_method_data() const { return true; }
 331 
 332   bool is_empty()  { return _state == empty_state; }
 333   bool is_mature() { return _state == mature_state; }
 334 
 335   int creation_mileage() { return _orig.creation_mileage(); }
 336   int current_mileage()  { return _current_mileage; }
 337 
 338   int invocation_count() { return _invocation_counter; }
 339   int backedge_count()   { return _backedge_counter;   }
 340   // Transfer information about the method to MethodData*.
 341   // would_profile means we would like to profile this method,
 342   // meaning it's not trivial.
 343   void set_would_profile(bool p);
 344   // Also set the numer of loops and blocks in the method.
 345   // Again, this is used to determine if a method is trivial.
 346   void set_compilation_stats(short loops, short blocks);
 347   // If the compiler finds a profiled type that is known statically
 348   // for sure, set it in the MethodData
 349   void set_argument_type(int bci, int i, ciKlass* k);

 350 
 351   void load_data();
 352 
 353   // Convert a dp (data pointer) to a di (data index).
 354   int dp_to_di(address dp) {
 355     return dp - ((address)_data);
 356   }
 357 
 358   // Get the data at an arbitrary (sort of) data index.
 359   ciProfileData* data_at(int data_index);
 360 
 361   // Walk through the data in order.
 362   ciProfileData* first_data() { return data_at(first_di()); }
 363   ciProfileData* next_data(ciProfileData* current);
 364   bool is_valid(ciProfileData* current) { return current != NULL; }
 365 
 366   // Get the data at an arbitrary bci, or NULL if there is none.
 367   ciProfileData* bci_to_data(int bci);
 368   ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);
 369 




  87   }
  88 
  89 #ifndef PRODUCT
  90   static void print_ciklass(outputStream* st, intptr_t k);
  91 #endif
  92 };
  93 
  94 class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries {
  95 public:
  96   void translate_type_data_from(const TypeStackSlotEntries* args);
  97 
  98   ciKlass* valid_type(int i) const {
  99     return valid_ciklass(type(i));
 100   }
 101 
 102 #ifndef PRODUCT
 103   void print_data_on(outputStream* st) const;
 104 #endif
 105 };
 106 
 107 class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries {
 108 public:
 109   void translate_type_data_from(const ReturnTypeEntry* ret);
 110 
 111   ciKlass* valid_type() const {
 112     return valid_ciklass(type());
 113   }
 114 
 115 #ifndef PRODUCT
 116   void print_data_on(outputStream* st) const;
 117 #endif
 118 };
 119 
 120 class ciCallTypeData : public CallTypeData {
 121 public:
 122   ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
 123 
 124   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }
 125   ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); }
 126 
 127   void translate_type_data_from(const ProfileData* data) {
 128     if (has_arguments()) {
 129       args()->translate_type_data_from(data->as_CallTypeData()->args());
 130     }
 131     if (has_return()) {
 132       ret()->translate_type_data_from(data->as_CallTypeData()->ret());
 133     }
 134   }
 135 
 136   intptr_t argument_type(int i) const {
 137     assert(has_arguments(), "no arg type profiling data");
 138     return args()->type(i);
 139   }
 140 
 141   ciKlass* valid_argument_type(int i) const {
 142     assert(has_arguments(), "no arg type profiling data");
 143     return args()->valid_type(i);
 144   }
 145 
 146   intptr_t return_type() const {
 147     assert(has_return(), "no ret type profiling data");
 148     return ret()->type();
 149   }
 150 
 151   ciKlass* valid_return_type() const {
 152     assert(has_return(), "no ret type profiling data");
 153     return ret()->valid_type();
 154   }
 155 
 156 #ifndef PRODUCT
 157   void print_data_on(outputStream* st) const;
 158 #endif
 159 };
 160 
 161 class ciReceiverTypeData : public ReceiverTypeData {
 162 public:
 163   ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
 164 
 165   void set_receiver(uint row, ciKlass* recv) {
 166     assert((uint)row < row_limit(), "oob");
 167     set_intptr_at(receiver0_offset + row * receiver_type_row_cell_count,
 168                   (intptr_t) recv);
 169   }
 170 
 171   ciKlass* receiver(uint row) const {
 172     assert((uint)row < row_limit(), "oob");
 173     ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
 174     assert(recv == NULL || recv->is_klass(), "wrong type");
 175     return recv;


 197     rtd_super()->set_receiver(row, recv);
 198   }
 199 
 200   ciKlass* receiver(uint row) {
 201     return rtd_super()->receiver(row);
 202   }
 203 
 204   // Copy & translate from oop based VirtualCallData
 205   virtual void translate_from(const ProfileData* data) {
 206     rtd_super()->translate_receiver_data_from(data);
 207   }
 208 #ifndef PRODUCT
 209   void print_data_on(outputStream* st) const;
 210 #endif
 211 };
 212 
 213 class ciVirtualCallTypeData : public VirtualCallTypeData {
 214 private:
 215   // Fake multiple inheritance...  It's a ciReceiverTypeData also.
 216   ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }

 217 public:
 218   ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {}
 219 


 220   void set_receiver(uint row, ciKlass* recv) {
 221     rtd_super()->set_receiver(row, recv);
 222   }
 223 
 224   ciKlass* receiver(uint row) const {
 225     return rtd_super()->receiver(row);
 226   }
 227 
 228   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); }
 229   ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)VirtualCallTypeData::ret(); }
 230 
 231   // Copy & translate from oop based VirtualCallData
 232   virtual void translate_from(const ProfileData* data) {
 233     rtd_super()->translate_receiver_data_from(data);
 234     if (has_arguments()) {
 235       args()->translate_type_data_from(data->as_VirtualCallTypeData()->args());
 236     }
 237     if (has_return()) {
 238       ret()->translate_type_data_from(data->as_VirtualCallTypeData()->ret());
 239     }
 240   }
 241 
 242   intptr_t argument_type(int i) const {
 243     assert(has_arguments(), "no arg type profiling data");
 244     return args()->type(i);
 245   }
 246 
 247   ciKlass* valid_argument_type(int i) const {
 248     assert(has_arguments(), "no arg type profiling data");
 249     return args()->valid_type(i);
 250   }
 251 
 252   intptr_t return_type() const {
 253     assert(has_return(), "no ret type profiling data");
 254     return ret()->type();
 255   }
 256 
 257   ciKlass* valid_return_type() const {
 258     assert(has_return(), "no ret type profiling data");
 259     return ret()->valid_type();
 260   }
 261 
 262 #ifndef PRODUCT
 263   void print_data_on(outputStream* st) const;
 264 #endif
 265 };
 266 
 267 
 268 class ciRetData : public RetData {
 269 public:
 270   ciRetData(DataLayout* layout) : RetData(layout) {};
 271 };
 272 
 273 class ciBranchData : public BranchData {
 274 public:
 275   ciBranchData(DataLayout* layout) : BranchData(layout) {};
 276 };
 277 
 278 class ciArrayData : public ArrayData {
 279 public:
 280   ciArrayData(DataLayout* layout) : ArrayData(layout) {};
 281 };


 386   bool is_method_data() const { return true; }
 387 
 388   bool is_empty()  { return _state == empty_state; }
 389   bool is_mature() { return _state == mature_state; }
 390 
 391   int creation_mileage() { return _orig.creation_mileage(); }
 392   int current_mileage()  { return _current_mileage; }
 393 
 394   int invocation_count() { return _invocation_counter; }
 395   int backedge_count()   { return _backedge_counter;   }
 396   // Transfer information about the method to MethodData*.
 397   // would_profile means we would like to profile this method,
 398   // meaning it's not trivial.
 399   void set_would_profile(bool p);
 400   // Also set the numer of loops and blocks in the method.
 401   // Again, this is used to determine if a method is trivial.
 402   void set_compilation_stats(short loops, short blocks);
 403   // If the compiler finds a profiled type that is known statically
 404   // for sure, set it in the MethodData
 405   void set_argument_type(int bci, int i, ciKlass* k);
 406   void set_return_type(int bci, ciKlass* k);
 407 
 408   void load_data();
 409 
 410   // Convert a dp (data pointer) to a di (data index).
 411   int dp_to_di(address dp) {
 412     return dp - ((address)_data);
 413   }
 414 
 415   // Get the data at an arbitrary (sort of) data index.
 416   ciProfileData* data_at(int data_index);
 417 
 418   // Walk through the data in order.
 419   ciProfileData* first_data() { return data_at(first_di()); }
 420   ciProfileData* next_data(ciProfileData* current);
 421   bool is_valid(ciProfileData* current) { return current != NULL; }
 422 
 423   // Get the data at an arbitrary bci, or NULL if there is none.
 424   ciProfileData* bci_to_data(int bci);
 425   ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);
 426 


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