mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8031752: Failed speculative optimizations should be reattempted when root of compilation is different
Support for speculative traps that keep track of the root of the compilation in which a trap occurs. Reviewed-by: kvn, twisti
This commit is contained in:
parent
532b570e81
commit
493557fc90
16 changed files with 772 additions and 164 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "ci/ciUtilities.hpp"
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
|
||||
class ciBitData;
|
||||
class ciCounterData;
|
||||
|
@ -44,6 +45,7 @@ class ciArgInfoData;
|
|||
class ciCallTypeData;
|
||||
class ciVirtualCallTypeData;
|
||||
class ciParametersTypeData;
|
||||
class ciSpeculativeTrapData;;
|
||||
|
||||
typedef ProfileData ciProfileData;
|
||||
|
||||
|
@ -173,7 +175,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -200,7 +202,7 @@ public:
|
|||
}
|
||||
void translate_receiver_data_from(const ProfileData* data);
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
void print_receiver_data_on(outputStream* st) const;
|
||||
#endif
|
||||
};
|
||||
|
@ -225,7 +227,7 @@ public:
|
|||
rtd_super()->translate_receiver_data_from(data);
|
||||
}
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -287,7 +289,7 @@ public:
|
|||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -336,7 +338,26 @@ public:
|
|||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ciSpeculativeTrapData : public SpeculativeTrapData {
|
||||
public:
|
||||
ciSpeculativeTrapData(DataLayout* layout) : SpeculativeTrapData(layout) {}
|
||||
|
||||
virtual void translate_from(const ProfileData* data);
|
||||
|
||||
ciMethod* method() const {
|
||||
return (ciMethod*)intptr_at(method_offset);
|
||||
}
|
||||
|
||||
void set_method(ciMethod* m) {
|
||||
set_intptr_at(method_offset, (intptr_t)m);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void print_data_on(outputStream* st, const char* extra) const;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -436,6 +457,16 @@ private:
|
|||
|
||||
ciArgInfoData *arg_info() const;
|
||||
|
||||
address data_base() const {
|
||||
return (address) _data;
|
||||
}
|
||||
DataLayout* limit_data_position() const {
|
||||
return (DataLayout*)((address)data_base() + _data_size);
|
||||
}
|
||||
|
||||
void load_extra_data();
|
||||
ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
|
||||
|
||||
public:
|
||||
bool is_method_data() const { return true; }
|
||||
|
||||
|
@ -475,9 +506,11 @@ public:
|
|||
ciProfileData* next_data(ciProfileData* current);
|
||||
bool is_valid(ciProfileData* current) { return current != NULL; }
|
||||
|
||||
// Get the data at an arbitrary bci, or NULL if there is none.
|
||||
ciProfileData* bci_to_data(int bci);
|
||||
ciProfileData* bci_to_extra_data(int bci, bool create_if_missing);
|
||||
DataLayout* extra_data_base() const { return limit_data_position(); }
|
||||
|
||||
// Get the data at an arbitrary bci, or NULL if there is none. If m
|
||||
// is not NULL look for a SpeculativeTrapData if any first.
|
||||
ciProfileData* bci_to_data(int bci, ciMethod* m = NULL);
|
||||
|
||||
uint overflow_trap_count() const {
|
||||
return _orig.overflow_trap_count();
|
||||
|
@ -496,12 +529,13 @@ public:
|
|||
|
||||
// Helpful query functions that decode trap_state.
|
||||
int has_trap_at(ciProfileData* data, int reason);
|
||||
int has_trap_at(int bci, int reason) {
|
||||
return has_trap_at(bci_to_data(bci), reason);
|
||||
int has_trap_at(int bci, ciMethod* m, int reason) {
|
||||
assert((m != NULL) == Deoptimization::reason_is_speculate(reason), "inconsistent method/reason");
|
||||
return has_trap_at(bci_to_data(bci, m), reason);
|
||||
}
|
||||
int trap_recompiled_at(ciProfileData* data);
|
||||
int trap_recompiled_at(int bci) {
|
||||
return trap_recompiled_at(bci_to_data(bci));
|
||||
int trap_recompiled_at(int bci, ciMethod* m) {
|
||||
return trap_recompiled_at(bci_to_data(bci, m));
|
||||
}
|
||||
|
||||
void clear_escape_info();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue