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 5462 : 8026251: New type profiling points: parameters to methods
Summary: x86 interpreter and c1 type profiling for parameters on method entries
Reviewed-by:


  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:


 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");


 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 };
 282 
 283 class ciMultiBranchData : public MultiBranchData {
 284 public:
 285   ciMultiBranchData(DataLayout* layout) : MultiBranchData(layout) {};
 286 };
 287 
 288 class ciArgInfoData : public ArgInfoData {
 289 public:
 290   ciArgInfoData(DataLayout* layout) : ArgInfoData(layout) {};
 291 };
 292 



















 293 // ciMethodData
 294 //
 295 // This class represents a MethodData* in the HotSpot virtual
 296 // machine.
 297 
 298 class ciMethodData : public ciMetadata {
 299   CI_PACKAGE_ACCESS
 300   friend class ciReplay;
 301 
 302 private:
 303   // Size in bytes
 304   int _data_size;
 305   int _extra_data_size;
 306 
 307   // Data entries
 308   intptr_t* _data;
 309 
 310   // Cached hint for data_before()
 311   int _hint_di;
 312 


 318   u_char _saw_free_extra_data;
 319 
 320   // Support for interprocedural escape analysis
 321   intx              _eflags;          // flags on escape information
 322   intx              _arg_local;       // bit set of non-escaping arguments
 323   intx              _arg_stack;       // bit set of stack-allocatable arguments
 324   intx              _arg_returned;    // bit set of returned arguments
 325 
 326   // Maturity of the oop when the snapshot is taken.
 327   int _current_mileage;
 328 
 329   // These counters hold the age of MDO in tiered. In tiered we can have the same method
 330   // running at different compilation levels concurrently. So, in order to precisely measure
 331   // its maturity we need separate counters.
 332   int _invocation_counter;
 333   int _backedge_counter;
 334 
 335   // Coherent snapshot of original header.
 336   MethodData _orig;
 337 




 338   ciMethodData(MethodData* md);
 339   ciMethodData();
 340 
 341   // Accessors
 342   int data_size() const { return _data_size; }
 343   int extra_data_size() const { return _extra_data_size; }
 344   intptr_t * data() const { return _data; }
 345 
 346   MethodData* get_MethodData() const {
 347     return (MethodData*)_metadata;
 348   }
 349 
 350   const char* type_string()                      { return "ciMethodData"; }
 351 
 352   void print_impl(outputStream* st);
 353 
 354   DataLayout* data_layout_at(int data_index) const {
 355     assert(data_index % sizeof(intptr_t) == 0, "unaligned");
 356     return (DataLayout*) (((address)_data) + data_index);
 357   }


 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);


 449     return trap_recompiled_at(bci_to_data(bci));
 450   }
 451 
 452   void clear_escape_info();
 453   bool has_escape_info();
 454   void update_escape_info();
 455 
 456   void set_eflag(MethodData::EscapeFlag f);
 457   void clear_eflag(MethodData::EscapeFlag f);
 458   bool eflag_set(MethodData::EscapeFlag f) const;
 459 
 460   void set_arg_local(int i);
 461   void set_arg_stack(int i);
 462   void set_arg_returned(int i);
 463   void set_arg_modified(int arg, uint val);
 464 
 465   bool is_arg_local(int i) const;
 466   bool is_arg_stack(int i) const;
 467   bool is_arg_returned(int i) const;
 468   uint arg_modified(int arg) const;




 469 
 470   // Code generation helper
 471   ByteSize offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data);
 472   int      byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
 473 
 474 #ifndef PRODUCT
 475   // printing support for method data
 476   void print();
 477   void print_data_on(outputStream* st);
 478 #endif
 479   void dump_replay_data(outputStream* out);
 480 };
 481 
 482 #endif // 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 class ciParametersTypeData;
  47 
  48 typedef ProfileData ciProfileData;
  49 
  50 class ciBitData : public BitData {
  51 public:
  52   ciBitData(DataLayout* layout) : BitData(layout) {};
  53 };
  54 
  55 class ciCounterData : public CounterData {
  56 public:
  57   ciCounterData(DataLayout* layout) : CounterData(layout) {};
  58 };
  59 
  60 class ciJumpData : public JumpData {
  61 public:
  62   ciJumpData(DataLayout* layout) : JumpData(layout) {};
  63 };
  64 
  65 class ciTypeEntries {
  66 protected:


 108 class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries {
 109 public:
 110   void translate_type_data_from(const ReturnTypeEntry* ret);
 111 
 112   ciKlass* valid_type() const {
 113     return valid_ciklass(type());
 114   }
 115 
 116 #ifndef PRODUCT
 117   void print_data_on(outputStream* st) const;
 118 #endif
 119 };
 120 
 121 class ciCallTypeData : public CallTypeData {
 122 public:
 123   ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
 124 
 125   ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }
 126   ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); }
 127 
 128   void translate_from(const ProfileData* data) {
 129     if (has_arguments()) {
 130       args()->translate_type_data_from(data->as_CallTypeData()->args());
 131     }
 132     if (has_return()) {
 133       ret()->translate_type_data_from(data->as_CallTypeData()->ret());
 134     }
 135   }
 136 
 137   intptr_t argument_type(int i) const {
 138     assert(has_arguments(), "no arg type profiling data");
 139     return args()->type(i);
 140   }
 141 
 142   ciKlass* valid_argument_type(int i) const {
 143     assert(has_arguments(), "no arg type profiling data");
 144     return args()->valid_type(i);
 145   }
 146 
 147   intptr_t return_type() const {
 148     assert(has_return(), "no ret type profiling data");


 274 class ciBranchData : public BranchData {
 275 public:
 276   ciBranchData(DataLayout* layout) : BranchData(layout) {};
 277 };
 278 
 279 class ciArrayData : public ArrayData {
 280 public:
 281   ciArrayData(DataLayout* layout) : ArrayData(layout) {};
 282 };
 283 
 284 class ciMultiBranchData : public MultiBranchData {
 285 public:
 286   ciMultiBranchData(DataLayout* layout) : MultiBranchData(layout) {};
 287 };
 288 
 289 class ciArgInfoData : public ArgInfoData {
 290 public:
 291   ciArgInfoData(DataLayout* layout) : ArgInfoData(layout) {};
 292 };
 293 
 294 class ciParametersTypeData : public ParametersTypeData {
 295 public:
 296   ciParametersTypeData(DataLayout* layout) : ParametersTypeData(layout) {}
 297 
 298   virtual void translate_from(const ProfileData* data) {
 299     parameters()->translate_type_data_from(data->as_ParametersTypeData()->parameters());
 300   }
 301 
 302   ciTypeStackSlotEntries* parameters() const { return (ciTypeStackSlotEntries*)ParametersTypeData::parameters(); }
 303 
 304   ciKlass* valid_parameter_type(int i) const {
 305     return parameters()->valid_type(i);
 306   }
 307 
 308 #ifndef PRODUCT
 309   void print_data_on(outputStream* st) const;
 310 #endif
 311 };
 312 
 313 // ciMethodData
 314 //
 315 // This class represents a MethodData* in the HotSpot virtual
 316 // machine.
 317 
 318 class ciMethodData : public ciMetadata {
 319   CI_PACKAGE_ACCESS
 320   friend class ciReplay;
 321 
 322 private:
 323   // Size in bytes
 324   int _data_size;
 325   int _extra_data_size;
 326 
 327   // Data entries
 328   intptr_t* _data;
 329 
 330   // Cached hint for data_before()
 331   int _hint_di;
 332 


 338   u_char _saw_free_extra_data;
 339 
 340   // Support for interprocedural escape analysis
 341   intx              _eflags;          // flags on escape information
 342   intx              _arg_local;       // bit set of non-escaping arguments
 343   intx              _arg_stack;       // bit set of stack-allocatable arguments
 344   intx              _arg_returned;    // bit set of returned arguments
 345 
 346   // Maturity of the oop when the snapshot is taken.
 347   int _current_mileage;
 348 
 349   // These counters hold the age of MDO in tiered. In tiered we can have the same method
 350   // running at different compilation levels concurrently. So, in order to precisely measure
 351   // its maturity we need separate counters.
 352   int _invocation_counter;
 353   int _backedge_counter;
 354 
 355   // Coherent snapshot of original header.
 356   MethodData _orig;
 357 
 358   // Dedicated area dedicated to parameters. Null if no parameter
 359   // profiling for this method.
 360   DataLayout* _parameters;
 361 
 362   ciMethodData(MethodData* md);
 363   ciMethodData();
 364 
 365   // Accessors
 366   int data_size() const { return _data_size; }
 367   int extra_data_size() const { return _extra_data_size; }
 368   intptr_t * data() const { return _data; }
 369 
 370   MethodData* get_MethodData() const {
 371     return (MethodData*)_metadata;
 372   }
 373 
 374   const char* type_string()                      { return "ciMethodData"; }
 375 
 376   void print_impl(outputStream* st);
 377 
 378   DataLayout* data_layout_at(int data_index) const {
 379     assert(data_index % sizeof(intptr_t) == 0, "unaligned");
 380     return (DataLayout*) (((address)_data) + data_index);
 381   }


 410   bool is_method_data() const { return true; }
 411 
 412   bool is_empty()  { return _state == empty_state; }
 413   bool is_mature() { return _state == mature_state; }
 414 
 415   int creation_mileage() { return _orig.creation_mileage(); }
 416   int current_mileage()  { return _current_mileage; }
 417 
 418   int invocation_count() { return _invocation_counter; }
 419   int backedge_count()   { return _backedge_counter;   }
 420   // Transfer information about the method to MethodData*.
 421   // would_profile means we would like to profile this method,
 422   // meaning it's not trivial.
 423   void set_would_profile(bool p);
 424   // Also set the numer of loops and blocks in the method.
 425   // Again, this is used to determine if a method is trivial.
 426   void set_compilation_stats(short loops, short blocks);
 427   // If the compiler finds a profiled type that is known statically
 428   // for sure, set it in the MethodData
 429   void set_argument_type(int bci, int i, ciKlass* k);
 430   void set_parameter_type(int i, ciKlass* k);
 431   void set_return_type(int bci, ciKlass* k);
 432 
 433   void load_data();
 434 
 435   // Convert a dp (data pointer) to a di (data index).
 436   int dp_to_di(address dp) {
 437     return dp - ((address)_data);
 438   }
 439 
 440   // Get the data at an arbitrary (sort of) data index.
 441   ciProfileData* data_at(int data_index);
 442 
 443   // Walk through the data in order.
 444   ciProfileData* first_data() { return data_at(first_di()); }
 445   ciProfileData* next_data(ciProfileData* current);
 446   bool is_valid(ciProfileData* current) { return current != NULL; }
 447 
 448   // Get the data at an arbitrary bci, or NULL if there is none.
 449   ciProfileData* bci_to_data(int bci);
 450   ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);


 474     return trap_recompiled_at(bci_to_data(bci));
 475   }
 476 
 477   void clear_escape_info();
 478   bool has_escape_info();
 479   void update_escape_info();
 480 
 481   void set_eflag(MethodData::EscapeFlag f);
 482   void clear_eflag(MethodData::EscapeFlag f);
 483   bool eflag_set(MethodData::EscapeFlag f) const;
 484 
 485   void set_arg_local(int i);
 486   void set_arg_stack(int i);
 487   void set_arg_returned(int i);
 488   void set_arg_modified(int arg, uint val);
 489 
 490   bool is_arg_local(int i) const;
 491   bool is_arg_stack(int i) const;
 492   bool is_arg_returned(int i) const;
 493   uint arg_modified(int arg) const;
 494 
 495   ciParametersTypeData* parameters_type_data() const {
 496     return _parameters != NULL ? new ciParametersTypeData(_parameters) : NULL;
 497   }
 498 
 499   // Code generation helper
 500   ByteSize offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data);
 501   int      byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
 502 
 503 #ifndef PRODUCT
 504   // printing support for method data
 505   void print();
 506   void print_data_on(outputStream* st);
 507 #endif
 508   void dump_replay_data(outputStream* out);
 509 };
 510 
 511 #endif // SHARE_VM_CI_CIMETHODDATA_HPP
src/share/vm/ci/ciMethodData.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File