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 6953 : 8057038: Speculative traps not robust when compilation and class unloading are concurrent
Summary: speculative traps can be removed from MDO while being copied by compiler
Reviewed-by:


 393   intx              _eflags;          // flags on escape information
 394   intx              _arg_local;       // bit set of non-escaping arguments
 395   intx              _arg_stack;       // bit set of stack-allocatable arguments
 396   intx              _arg_returned;    // bit set of returned arguments
 397 
 398   // Maturity of the oop when the snapshot is taken.
 399   int _current_mileage;
 400 
 401   // These counters hold the age of MDO in tiered. In tiered we can have the same method
 402   // running at different compilation levels concurrently. So, in order to precisely measure
 403   // its maturity we need separate counters.
 404   int _invocation_counter;
 405   int _backedge_counter;
 406 
 407   // Coherent snapshot of original header.
 408   MethodData _orig;
 409 
 410   // Area dedicated to parameters. NULL if no parameter profiling for
 411   // this method.
 412   DataLayout* _parameters;



 413 
 414   ciMethodData(MethodData* md);
 415   ciMethodData();
 416 
 417   // Accessors
 418   int data_size() const { return _data_size; }
 419   int extra_data_size() const { return _extra_data_size; }
 420   intptr_t * data() const { return _data; }
 421 
 422   MethodData* get_MethodData() const {
 423     return (MethodData*)_metadata;
 424   }
 425 
 426   const char* type_string()                      { return "ciMethodData"; }
 427 
 428   void print_impl(outputStream* st);
 429 
 430   DataLayout* data_layout_at(int data_index) const {
 431     assert(data_index % sizeof(intptr_t) == 0, "unaligned");
 432     return (DataLayout*) (((address)_data) + data_index);


 444   }
 445   ciProfileData* data_before(int bci) {
 446     // avoid SEGV on this edge case
 447     if (data_size() == 0)
 448       return NULL;
 449     int hint = hint_di();
 450     if (data_layout_at(hint)->bci() <= bci)
 451       return data_at(hint);
 452     return first_data();
 453   }
 454 
 455 
 456   // What is the index of the first data entry?
 457   int first_di() { return 0; }
 458 
 459   ciArgInfoData *arg_info() const;
 460 
 461   address data_base() const {
 462     return (address) _data;
 463   }
 464   DataLayout* limit_data_position() const {
 465     return (DataLayout*)((address)data_base() + _data_size);
 466   }
 467 
 468   void load_extra_data();
 469   ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
 470 
 471   void dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k);
 472   template<class T> void dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data);
 473   template<class T> void dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* call_type_data);
 474   void dump_replay_data_extra_data_helper(outputStream* out, int round, int& count);
 475 
 476 public:
 477   bool is_method_data() const { return true; }
 478 
 479   bool is_empty()  { return _state == empty_state; }
 480   bool is_mature() { return _state == mature_state; }
 481 
 482   int creation_mileage() { return _orig.creation_mileage(); }
 483   int current_mileage()  { return _current_mileage; }
 484 
 485   int invocation_count() { return _invocation_counter; }
 486   int backedge_count()   { return _backedge_counter;   }


 507   // for sure, set it in the MethodData
 508   void set_argument_type(int bci, int i, ciKlass* k);
 509   void set_parameter_type(int i, ciKlass* k);
 510   void set_return_type(int bci, ciKlass* k);
 511 
 512   void load_data();
 513 
 514   // Convert a dp (data pointer) to a di (data index).
 515   int dp_to_di(address dp) {
 516     return dp - ((address)_data);
 517   }
 518 
 519   // Get the data at an arbitrary (sort of) data index.
 520   ciProfileData* data_at(int data_index);
 521 
 522   // Walk through the data in order.
 523   ciProfileData* first_data() { return data_at(first_di()); }
 524   ciProfileData* next_data(ciProfileData* current);
 525   bool is_valid(ciProfileData* current) { return current != NULL; }
 526 
 527   DataLayout* extra_data_base() const { return limit_data_position(); }


 528 
 529   // Get the data at an arbitrary bci, or NULL if there is none. If m
 530   // is not NULL look for a SpeculativeTrapData if any first.
 531   ciProfileData* bci_to_data(int bci, ciMethod* m = NULL);
 532 
 533   uint overflow_trap_count() const {
 534     return _orig.overflow_trap_count();
 535   }
 536   uint overflow_recompile_count() const {
 537     return _orig.overflow_recompile_count();
 538   }
 539   uint decompile_count() const {
 540     return _orig.decompile_count();
 541   }
 542   uint trap_count(int reason) const {
 543     return _orig.trap_count(reason);
 544   }
 545   uint trap_reason_limit() const { return _orig.trap_reason_limit(); }
 546   uint trap_count_limit()  const { return _orig.trap_count_limit(); }
 547 




 393   intx              _eflags;          // flags on escape information
 394   intx              _arg_local;       // bit set of non-escaping arguments
 395   intx              _arg_stack;       // bit set of stack-allocatable arguments
 396   intx              _arg_returned;    // bit set of returned arguments
 397 
 398   // Maturity of the oop when the snapshot is taken.
 399   int _current_mileage;
 400 
 401   // These counters hold the age of MDO in tiered. In tiered we can have the same method
 402   // running at different compilation levels concurrently. So, in order to precisely measure
 403   // its maturity we need separate counters.
 404   int _invocation_counter;
 405   int _backedge_counter;
 406 
 407   // Coherent snapshot of original header.
 408   MethodData _orig;
 409 
 410   // Area dedicated to parameters. NULL if no parameter profiling for
 411   // this method.
 412   DataLayout* _parameters;
 413   int parameters_size() const {
 414     return _parameters == NULL ? 0 : parameters_type_data()->size_in_bytes();
 415   }
 416 
 417   ciMethodData(MethodData* md);
 418   ciMethodData();
 419 
 420   // Accessors
 421   int data_size() const { return _data_size; }
 422   int extra_data_size() const { return _extra_data_size; }
 423   intptr_t * data() const { return _data; }
 424 
 425   MethodData* get_MethodData() const {
 426     return (MethodData*)_metadata;
 427   }
 428 
 429   const char* type_string()                      { return "ciMethodData"; }
 430 
 431   void print_impl(outputStream* st);
 432 
 433   DataLayout* data_layout_at(int data_index) const {
 434     assert(data_index % sizeof(intptr_t) == 0, "unaligned");
 435     return (DataLayout*) (((address)_data) + data_index);


 447   }
 448   ciProfileData* data_before(int bci) {
 449     // avoid SEGV on this edge case
 450     if (data_size() == 0)
 451       return NULL;
 452     int hint = hint_di();
 453     if (data_layout_at(hint)->bci() <= bci)
 454       return data_at(hint);
 455     return first_data();
 456   }
 457 
 458 
 459   // What is the index of the first data entry?
 460   int first_di() { return 0; }
 461 
 462   ciArgInfoData *arg_info() const;
 463 
 464   address data_base() const {
 465     return (address) _data;
 466   }



 467 
 468   void load_extra_data();
 469   ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
 470 
 471   void dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k);
 472   template<class T> void dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data);
 473   template<class T> void dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* call_type_data);
 474   void dump_replay_data_extra_data_helper(outputStream* out, int round, int& count);
 475 
 476 public:
 477   bool is_method_data() const { return true; }
 478 
 479   bool is_empty()  { return _state == empty_state; }
 480   bool is_mature() { return _state == mature_state; }
 481 
 482   int creation_mileage() { return _orig.creation_mileage(); }
 483   int current_mileage()  { return _current_mileage; }
 484 
 485   int invocation_count() { return _invocation_counter; }
 486   int backedge_count()   { return _backedge_counter;   }


 507   // for sure, set it in the MethodData
 508   void set_argument_type(int bci, int i, ciKlass* k);
 509   void set_parameter_type(int i, ciKlass* k);
 510   void set_return_type(int bci, ciKlass* k);
 511 
 512   void load_data();
 513 
 514   // Convert a dp (data pointer) to a di (data index).
 515   int dp_to_di(address dp) {
 516     return dp - ((address)_data);
 517   }
 518 
 519   // Get the data at an arbitrary (sort of) data index.
 520   ciProfileData* data_at(int data_index);
 521 
 522   // Walk through the data in order.
 523   ciProfileData* first_data() { return data_at(first_di()); }
 524   ciProfileData* next_data(ciProfileData* current);
 525   bool is_valid(ciProfileData* current) { return current != NULL; }
 526 
 527   DataLayout* extra_data_base() const  { return data_layout_at(data_size()); }
 528   DataLayout* args_data_limit() const  { return data_layout_at(data_size() + extra_data_size() -
 529                                                                parameters_size()); }
 530 
 531   // Get the data at an arbitrary bci, or NULL if there is none. If m
 532   // is not NULL look for a SpeculativeTrapData if any first.
 533   ciProfileData* bci_to_data(int bci, ciMethod* m = NULL);
 534 
 535   uint overflow_trap_count() const {
 536     return _orig.overflow_trap_count();
 537   }
 538   uint overflow_recompile_count() const {
 539     return _orig.overflow_recompile_count();
 540   }
 541   uint decompile_count() const {
 542     return _orig.decompile_count();
 543   }
 544   uint trap_count(int reason) const {
 545     return _orig.trap_count(reason);
 546   }
 547   uint trap_reason_limit() const { return _orig.trap_reason_limit(); }
 548   uint trap_count_limit()  const { return _orig.trap_count_limit(); }
 549 


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