comparison src/share/vm/ci/ciMethodData.hpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c 606acabe7b5c
children 7848fc12602b
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
29 #include "ci/ciKlass.hpp" 29 #include "ci/ciKlass.hpp"
30 #include "ci/ciObject.hpp" 30 #include "ci/ciObject.hpp"
31 #include "ci/ciUtilities.hpp" 31 #include "ci/ciUtilities.hpp"
32 #include "oops/methodData.hpp" 32 #include "oops/methodData.hpp"
33 #include "oops/oop.inline.hpp" 33 #include "oops/oop.inline.hpp"
34 #include "runtime/deoptimization.hpp"
34 35
35 class ciBitData; 36 class ciBitData;
36 class ciCounterData; 37 class ciCounterData;
37 class ciJumpData; 38 class ciJumpData;
38 class ciReceiverTypeData; 39 class ciReceiverTypeData;
42 class ciMultiBranchData; 43 class ciMultiBranchData;
43 class ciArgInfoData; 44 class ciArgInfoData;
44 class ciCallTypeData; 45 class ciCallTypeData;
45 class ciVirtualCallTypeData; 46 class ciVirtualCallTypeData;
46 class ciParametersTypeData; 47 class ciParametersTypeData;
48 class ciSpeculativeTrapData;;
47 49
48 typedef ProfileData ciProfileData; 50 typedef ProfileData ciProfileData;
49 51
50 class ciBitData : public BitData { 52 class ciBitData : public BitData {
51 public: 53 public:
171 bool return_maybe_null() const { 173 bool return_maybe_null() const {
172 return ret()->maybe_null(); 174 return ret()->maybe_null();
173 } 175 }
174 176
175 #ifndef PRODUCT 177 #ifndef PRODUCT
176 void print_data_on(outputStream* st) const; 178 void print_data_on(outputStream* st, const char* extra) const;
177 #endif 179 #endif
178 }; 180 };
179 181
180 class ciReceiverTypeData : public ReceiverTypeData { 182 class ciReceiverTypeData : public ReceiverTypeData {
181 public: 183 public:
198 virtual void translate_from(const ProfileData* data) { 200 virtual void translate_from(const ProfileData* data) {
199 translate_receiver_data_from(data); 201 translate_receiver_data_from(data);
200 } 202 }
201 void translate_receiver_data_from(const ProfileData* data); 203 void translate_receiver_data_from(const ProfileData* data);
202 #ifndef PRODUCT 204 #ifndef PRODUCT
203 void print_data_on(outputStream* st) const; 205 void print_data_on(outputStream* st, const char* extra) const;
204 void print_receiver_data_on(outputStream* st) const; 206 void print_receiver_data_on(outputStream* st) const;
205 #endif 207 #endif
206 }; 208 };
207 209
208 class ciVirtualCallData : public VirtualCallData { 210 class ciVirtualCallData : public VirtualCallData {
223 // Copy & translate from oop based VirtualCallData 225 // Copy & translate from oop based VirtualCallData
224 virtual void translate_from(const ProfileData* data) { 226 virtual void translate_from(const ProfileData* data) {
225 rtd_super()->translate_receiver_data_from(data); 227 rtd_super()->translate_receiver_data_from(data);
226 } 228 }
227 #ifndef PRODUCT 229 #ifndef PRODUCT
228 void print_data_on(outputStream* st) const; 230 void print_data_on(outputStream* st, const char* extra) const;
229 #endif 231 #endif
230 }; 232 };
231 233
232 class ciVirtualCallTypeData : public VirtualCallTypeData { 234 class ciVirtualCallTypeData : public VirtualCallTypeData {
233 private: 235 private:
285 bool return_maybe_null() const { 287 bool return_maybe_null() const {
286 return ret()->maybe_null(); 288 return ret()->maybe_null();
287 } 289 }
288 290
289 #ifndef PRODUCT 291 #ifndef PRODUCT
290 void print_data_on(outputStream* st) const; 292 void print_data_on(outputStream* st, const char* extra) const;
291 #endif 293 #endif
292 }; 294 };
293 295
294 296
295 class ciRetData : public RetData { 297 class ciRetData : public RetData {
334 bool parameter_maybe_null(int i) const { 336 bool parameter_maybe_null(int i) const {
335 return parameters()->maybe_null(i); 337 return parameters()->maybe_null(i);
336 } 338 }
337 339
338 #ifndef PRODUCT 340 #ifndef PRODUCT
339 void print_data_on(outputStream* st) const; 341 void print_data_on(outputStream* st, const char* extra) const;
342 #endif
343 };
344
345 class ciSpeculativeTrapData : public SpeculativeTrapData {
346 public:
347 ciSpeculativeTrapData(DataLayout* layout) : SpeculativeTrapData(layout) {}
348
349 virtual void translate_from(const ProfileData* data);
350
351 ciMethod* method() const {
352 return (ciMethod*)intptr_at(method_offset);
353 }
354
355 void set_method(ciMethod* m) {
356 set_intptr_at(method_offset, (intptr_t)m);
357 }
358
359 #ifndef PRODUCT
360 void print_data_on(outputStream* st, const char* extra) const;
340 #endif 361 #endif
341 }; 362 };
342 363
343 // ciMethodData 364 // ciMethodData
344 // 365 //
434 // What is the index of the first data entry? 455 // What is the index of the first data entry?
435 int first_di() { return 0; } 456 int first_di() { return 0; }
436 457
437 ciArgInfoData *arg_info() const; 458 ciArgInfoData *arg_info() const;
438 459
460 address data_base() const {
461 return (address) _data;
462 }
463 DataLayout* limit_data_position() const {
464 return (DataLayout*)((address)data_base() + _data_size);
465 }
466
467 void load_extra_data();
468 ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
469
439 public: 470 public:
440 bool is_method_data() const { return true; } 471 bool is_method_data() const { return true; }
441 472
442 bool is_empty() { return _state == empty_state; } 473 bool is_empty() { return _state == empty_state; }
443 bool is_mature() { return _state == mature_state; } 474 bool is_mature() { return _state == mature_state; }
445 int creation_mileage() { return _orig.creation_mileage(); } 476 int creation_mileage() { return _orig.creation_mileage(); }
446 int current_mileage() { return _current_mileage; } 477 int current_mileage() { return _current_mileage; }
447 478
448 int invocation_count() { return _invocation_counter; } 479 int invocation_count() { return _invocation_counter; }
449 int backedge_count() { return _backedge_counter; } 480 int backedge_count() { return _backedge_counter; }
481
482 #if INCLUDE_RTM_OPT
483 // return cached value
484 int rtm_state() {
485 if (is_empty()) {
486 return NoRTM;
487 } else {
488 return get_MethodData()->rtm_state();
489 }
490 }
491 #endif
492
450 // Transfer information about the method to MethodData*. 493 // Transfer information about the method to MethodData*.
451 // would_profile means we would like to profile this method, 494 // would_profile means we would like to profile this method,
452 // meaning it's not trivial. 495 // meaning it's not trivial.
453 void set_would_profile(bool p); 496 void set_would_profile(bool p);
454 // Also set the numer of loops and blocks in the method. 497 // Also set the numer of loops and blocks in the method.
473 // Walk through the data in order. 516 // Walk through the data in order.
474 ciProfileData* first_data() { return data_at(first_di()); } 517 ciProfileData* first_data() { return data_at(first_di()); }
475 ciProfileData* next_data(ciProfileData* current); 518 ciProfileData* next_data(ciProfileData* current);
476 bool is_valid(ciProfileData* current) { return current != NULL; } 519 bool is_valid(ciProfileData* current) { return current != NULL; }
477 520
478 // Get the data at an arbitrary bci, or NULL if there is none. 521 DataLayout* extra_data_base() const { return limit_data_position(); }
479 ciProfileData* bci_to_data(int bci); 522
480 ciProfileData* bci_to_extra_data(int bci, bool create_if_missing); 523 // Get the data at an arbitrary bci, or NULL if there is none. If m
524 // is not NULL look for a SpeculativeTrapData if any first.
525 ciProfileData* bci_to_data(int bci, ciMethod* m = NULL);
481 526
482 uint overflow_trap_count() const { 527 uint overflow_trap_count() const {
483 return _orig.overflow_trap_count(); 528 return _orig.overflow_trap_count();
484 } 529 }
485 uint overflow_recompile_count() const { 530 uint overflow_recompile_count() const {
494 uint trap_reason_limit() const { return _orig.trap_reason_limit(); } 539 uint trap_reason_limit() const { return _orig.trap_reason_limit(); }
495 uint trap_count_limit() const { return _orig.trap_count_limit(); } 540 uint trap_count_limit() const { return _orig.trap_count_limit(); }
496 541
497 // Helpful query functions that decode trap_state. 542 // Helpful query functions that decode trap_state.
498 int has_trap_at(ciProfileData* data, int reason); 543 int has_trap_at(ciProfileData* data, int reason);
499 int has_trap_at(int bci, int reason) { 544 int has_trap_at(int bci, ciMethod* m, int reason) {
500 return has_trap_at(bci_to_data(bci), reason); 545 assert((m != NULL) == Deoptimization::reason_is_speculate(reason), "inconsistent method/reason");
546 return has_trap_at(bci_to_data(bci, m), reason);
501 } 547 }
502 int trap_recompiled_at(ciProfileData* data); 548 int trap_recompiled_at(ciProfileData* data);
503 int trap_recompiled_at(int bci) { 549 int trap_recompiled_at(int bci, ciMethod* m) {
504 return trap_recompiled_at(bci_to_data(bci)); 550 return trap_recompiled_at(bci_to_data(bci, m));
505 } 551 }
506 552
507 void clear_escape_info(); 553 void clear_escape_info();
508 bool has_escape_info(); 554 bool has_escape_info();
509 void update_escape_info(); 555 void update_escape_info();