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 5411 : 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:


 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:


 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   DataLayout* _parameters;
 359 
 360   ciMethodData(MethodData* md);
 361   ciMethodData();
 362 
 363   // Accessors
 364   int data_size() const { return _data_size; }
 365   int extra_data_size() const { return _extra_data_size; }
 366   intptr_t * data() const { return _data; }
 367 
 368   MethodData* get_MethodData() const {
 369     return (MethodData*)_metadata;
 370   }
 371 
 372   const char* type_string()                      { return "ciMethodData"; }
 373 
 374   void print_impl(outputStream* st);
 375 
 376   DataLayout* data_layout_at(int data_index) const {
 377     assert(data_index % sizeof(intptr_t) == 0, "unaligned");
 378     return (DataLayout*) (((address)_data) + data_index);
 379   }


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


 472     return trap_recompiled_at(bci_to_data(bci));
 473   }
 474 
 475   void clear_escape_info();
 476   bool has_escape_info();
 477   void update_escape_info();
 478 
 479   void set_eflag(MethodData::EscapeFlag f);
 480   void clear_eflag(MethodData::EscapeFlag f);
 481   bool eflag_set(MethodData::EscapeFlag f) const;
 482 
 483   void set_arg_local(int i);
 484   void set_arg_stack(int i);
 485   void set_arg_returned(int i);
 486   void set_arg_modified(int arg, uint val);
 487 
 488   bool is_arg_local(int i) const;
 489   bool is_arg_stack(int i) const;
 490   bool is_arg_returned(int i) const;
 491   uint arg_modified(int arg) const;
 492 
 493   ciParametersTypeData* parameters_type_data() const {
 494     return _parameters != NULL ? new ciParametersTypeData(_parameters) : NULL;
 495   }
 496 
 497   // Code generation helper
 498   ByteSize offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data);
 499   int      byte_offset_of_slot(ciProfileData* data, ByteSize slot_offset_in_data) { return in_bytes(offset_of_slot(data, slot_offset_in_data)); }
 500 
 501 #ifndef PRODUCT
 502   // printing support for method data
 503   void print();
 504   void print_data_on(outputStream* st);
 505 #endif
 506   void dump_replay_data(outputStream* out);
 507 };
 508 
 509 #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