< prev index next >
src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
Print this page
*** 51,63 ****
/**
* Reference to the C++ MethodData object.
*/
final long metaspaceMethodData;
! @SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method;
! public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
this.metaspaceMethodData = metaspaceMethodData;
this.method = method;
}
/**
--- 51,63 ----
/**
* Reference to the C++ MethodData object.
*/
final long metaspaceMethodData;
! private final HotSpotResolvedJavaMethodImpl method;
! HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) {
this.metaspaceMethodData = metaspaceMethodData;
this.method = method;
}
/**
*** 105,114 ****
--- 105,126 ----
HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess();
int reasonIndex = metaAccess.convertDeoptReason(reason);
return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF;
}
+ public int getDecompileCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataDecompiles);
+ }
+
+ public int getOverflowRecompileCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowRecompiles);
+ }
+
+ public int getOverflowTrapsCount() {
+ return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowTraps);
+ }
+
public HotSpotMethodDataAccessor getNormalData(int position) {
if (position >= normalDataSize()) {
return null;
}
*** 212,221 ****
--- 224,239 ----
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
String nl = String.format("%n");
String nlIndent = String.format("%n%38s", "");
+ sb.append("Raw method data for ");
+ sb.append(method.format("%H.%n(%p)"));
+ sb.append(":");
+ sb.append(nl);
+ sb.append(String.format("nof_decompiles(%d) nof_overflow_recompile(%d) nof_overflow_traps(%d)%n",
+ getDecompileCount(), getOverflowRecompileCount(), getOverflowTrapsCount()));
if (hasNormalData()) {
int pos = 0;
HotSpotMethodDataAccessor data;
while ((data = getNormalData(pos)) != null) {
if (pos != 0) {
*** 425,434 ****
--- 443,456 ----
return new RawItemProfile<>(entries, types, counts, totalCount);
}
protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position);
+ public int getNonprofiledCount(HotSpotMethodData data, int position) {
+ return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
+ }
+
private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) {
if (profile.entries <= 0 || profile.totalCount <= 0) {
return null;
}
*** 460,470 ****
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos);
TriState nullSeen = getNullSeen(data, pos);
TriState exceptionSeen = getExceptionSeen(data, pos);
sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
! getTypesNotRecordedExecutionCount(data, pos), profile.entries));
for (int i = 0; i < profile.entries; i++) {
long count = profile.counts[i];
sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
}
return sb;
--- 482,492 ----
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos);
TriState nullSeen = getNullSeen(data, pos);
TriState exceptionSeen = getExceptionSeen(data, pos);
sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen,
! getNonprofiledCount(data, pos), profile.entries));
for (int i = 0; i < profile.entries; i++) {
long count = profile.counts[i];
sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount));
}
return sb;
*** 488,498 ****
return -1;
}
@Override
protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
! return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET);
}
}
static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
--- 510,520 ----
return -1;
}
@Override
protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) {
! return getNonprofiledCount(data, position);
}
}
static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth);
static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
*** 786,796 ****
return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
}
@Override
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
! return null;
}
}
public void setCompiledIRSize(int size) {
UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size);
--- 808,819 ----
return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position);
}
@Override
public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) {
! sb.append("unknown profile data with tag: " + tag);
! return sb;
}
}
public void setCompiledIRSize(int size) {
UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size);
*** 820,833 ****
};
private static boolean checkAccessorTags() {
int expectedTag = 0;
for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) {
! if (expectedTag ==0 ) {
assert accessor == null;
} else {
! assert accessor.tag == expectedTag: expectedTag + " != " + accessor.tag + " " + accessor;
}
expectedTag++;
}
return true;
}
--- 843,856 ----
};
private static boolean checkAccessorTags() {
int expectedTag = 0;
for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) {
! if (expectedTag == 0) {
assert accessor == null;
} else {
! assert accessor.tag == expectedTag : expectedTag + " != " + accessor.tag + " " + accessor;
}
expectedTag++;
}
return true;
}
< prev index next >