Mercurial > hg > graal-jvmci-8
diff src/share/vm/ci/ciMethodData.hpp @ 12882:ce0cc25bc5e2
8026054: New type profiling points: type of return values at calls
Summary: x86 interpreter and c1 type profiling for return values at calls
Reviewed-by: kvn, twisti
author | roland |
---|---|
date | Sat, 12 Oct 2013 12:12:59 +0200 |
parents | d13d7aba8c12 |
children | 5ccbab1c69f3 |
line wrap: on
line diff
--- a/src/share/vm/ci/ciMethodData.hpp Fri Oct 11 19:51:31 2013 -0700 +++ b/src/share/vm/ci/ciMethodData.hpp Sat Oct 12 12:12:59 2013 +0200 @@ -104,20 +104,55 @@ #endif }; +class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries { +public: + void translate_type_data_from(const ReturnTypeEntry* ret); + + ciKlass* valid_type() const { + return valid_ciklass(type()); + } + +#ifndef PRODUCT + void print_data_on(outputStream* st) const; +#endif +}; + class ciCallTypeData : public CallTypeData { public: ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {} ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); } + ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); } - virtual void translate_from(const ProfileData* data) { - args()->translate_type_data_from(data->as_CallTypeData()->args()); + void translate_type_data_from(const ProfileData* data) { + if (has_arguments()) { + args()->translate_type_data_from(data->as_CallTypeData()->args()); + } + if (has_return()) { + ret()->translate_type_data_from(data->as_CallTypeData()->ret()); + } + } + + intptr_t argument_type(int i) const { + assert(has_arguments(), "no arg type profiling data"); + return args()->type(i); } ciKlass* valid_argument_type(int i) const { + assert(has_arguments(), "no arg type profiling data"); return args()->valid_type(i); } + intptr_t return_type() const { + assert(has_return(), "no ret type profiling data"); + return ret()->type(); + } + + ciKlass* valid_return_type() const { + assert(has_return(), "no ret type profiling data"); + return ret()->valid_type(); + } + #ifndef PRODUCT void print_data_on(outputStream* st) const; #endif @@ -179,12 +214,9 @@ private: // Fake multiple inheritance... It's a ciReceiverTypeData also. ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; } - public: ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {} - ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); } - void set_receiver(uint row, ciKlass* recv) { rtd_super()->set_receiver(row, recv); } @@ -193,16 +225,40 @@ return rtd_super()->receiver(row); } + ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); } + ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)VirtualCallTypeData::ret(); } + // Copy & translate from oop based VirtualCallData virtual void translate_from(const ProfileData* data) { rtd_super()->translate_receiver_data_from(data); - args()->translate_type_data_from(data->as_VirtualCallTypeData()->args()); + if (has_arguments()) { + args()->translate_type_data_from(data->as_VirtualCallTypeData()->args()); + } + if (has_return()) { + ret()->translate_type_data_from(data->as_VirtualCallTypeData()->ret()); + } + } + + intptr_t argument_type(int i) const { + assert(has_arguments(), "no arg type profiling data"); + return args()->type(i); } ciKlass* valid_argument_type(int i) const { + assert(has_arguments(), "no arg type profiling data"); return args()->valid_type(i); } + intptr_t return_type() const { + assert(has_return(), "no ret type profiling data"); + return ret()->type(); + } + + ciKlass* valid_return_type() const { + assert(has_return(), "no ret type profiling data"); + return ret()->valid_type(); + } + #ifndef PRODUCT void print_data_on(outputStream* st) const; #endif @@ -347,6 +403,7 @@ // If the compiler finds a profiled type that is known statically // for sure, set it in the MethodData void set_argument_type(int bci, int i, ciKlass* k); + void set_return_type(int bci, ciKlass* k); void load_data();