36 import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod; 37 import jdk.vm.ci.meta.JavaTypeProfile; 38 import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; 39 import jdk.vm.ci.meta.ResolvedJavaMethod; 40 import jdk.vm.ci.meta.ResolvedJavaType; 41 import jdk.vm.ci.meta.TriState; 42 43 /** 44 * Access to a HotSpot {@code MethodData} structure (defined in methodData.hpp). 45 */ 46 final class HotSpotMethodData { 47 48 static final HotSpotVMConfig config = config(); 49 static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.FALSE); 50 static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.UNKNOWN); 51 52 /** 53 * Reference to the C++ MethodData object. 54 */ 55 final long metaspaceMethodData; 56 @SuppressWarnings("unused") private final HotSpotResolvedJavaMethodImpl method; 57 58 public HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) { 59 this.metaspaceMethodData = metaspaceMethodData; 60 this.method = method; 61 } 62 63 /** 64 * @return value of the MethodData::_data_size field 65 */ 66 private int normalDataSize() { 67 return UNSAFE.getInt(metaspaceMethodData + config.methodDataDataSize); 68 } 69 70 /** 71 * Returns the size of the extra data records. This method does the same calculation as 72 * MethodData::extra_data_size(). 73 * 74 * @return size of extra data records 75 */ 76 private int extraDataSize() { 77 final int extraDataBase = config.methodDataOopDataOffset + normalDataSize(); 78 final int extraDataLimit = UNSAFE.getInt(metaspaceMethodData + config.methodDataSize); 90 public int getExtraDataBeginOffset() { 91 return normalDataSize(); 92 } 93 94 public boolean isWithin(int position) { 95 return position >= 0 && position < normalDataSize() + extraDataSize(); 96 } 97 98 public int getDeoptimizationCount(DeoptimizationReason reason) { 99 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); 100 int reasonIndex = metaAccess.convertDeoptReason(reason); 101 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; 102 } 103 104 public int getOSRDeoptimizationCount(DeoptimizationReason reason) { 105 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); 106 int reasonIndex = metaAccess.convertDeoptReason(reason); 107 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; 108 } 109 110 public HotSpotMethodDataAccessor getNormalData(int position) { 111 if (position >= normalDataSize()) { 112 return null; 113 } 114 115 return getData(position); 116 } 117 118 public HotSpotMethodDataAccessor getExtraData(int position) { 119 if (position >= normalDataSize() + extraDataSize()) { 120 return null; 121 } 122 HotSpotMethodDataAccessor data = getData(position); 123 if (data != null) { 124 return data; 125 } 126 return data; 127 } 128 129 public static HotSpotMethodDataAccessor getNoDataAccessor(boolean exceptionPossiblyNotRecorded) { 197 return config.dataLayoutHeaderSize + cellsToBytes(cells); 198 } 199 200 private static int cellsToBytes(int cells) { 201 return cells * config.dataLayoutCellSize; 202 } 203 204 /** 205 * Returns whether profiling ran long enough that the profile information is mature. Other 206 * informational data will still be valid even if the profile isn't mature. 207 */ 208 public boolean isProfileMature() { 209 return runtime().getCompilerToVM().isMature(metaspaceMethodData); 210 } 211 212 @Override 213 public String toString() { 214 StringBuilder sb = new StringBuilder(); 215 String nl = String.format("%n"); 216 String nlIndent = String.format("%n%38s", ""); 217 if (hasNormalData()) { 218 int pos = 0; 219 HotSpotMethodDataAccessor data; 220 while ((data = getNormalData(pos)) != null) { 221 if (pos != 0) { 222 sb.append(nl); 223 } 224 int bci = data.getBCI(this, pos); 225 sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); 226 sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); 227 pos = pos + data.getSize(this, pos); 228 } 229 } 230 231 if (hasExtraData()) { 232 int pos = getExtraDataBeginOffset(); 233 HotSpotMethodDataAccessor data; 234 while ((data = getExtraData(pos)) != null) { 235 if (pos == getExtraDataBeginOffset()) { 236 sb.append(nl).append("--- Extra data:"); 410 for (int j = 0; j < entries; j++) { 411 if (types[j].equals(klass)) { 412 totalCount += count; 413 counts[j] += count; 414 continue outer; 415 } 416 } 417 types[entries] = klass; 418 totalCount += count; 419 counts[entries] = count; 420 entries++; 421 } 422 } 423 424 totalCount += getTypesNotRecordedExecutionCount(data, position); 425 return new RawItemProfile<>(entries, types, counts, totalCount); 426 } 427 428 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position); 429 430 private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) { 431 if (profile.entries <= 0 || profile.totalCount <= 0) { 432 return null; 433 } 434 435 ProfiledType[] ptypes = new ProfiledType[profile.entries]; 436 double totalProbability = 0.0; 437 for (int i = 0; i < profile.entries; i++) { 438 double p = profile.counts[i]; 439 p = p / profile.totalCount; 440 totalProbability += p; 441 ptypes[i] = new ProfiledType(profile.items[i], p); 442 } 443 444 Arrays.sort(ptypes); 445 446 double notRecordedTypeProbability = profile.entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability)); 447 assert notRecordedTypeProbability == 0 || profile.entries == config.typeProfileWidth; 448 return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes); 449 } 450 451 private static int getTypeOffset(int row) { 452 return TYPE_DATA_FIRST_TYPE_OFFSET + row * TYPE_DATA_ROW_SIZE; 453 } 454 455 protected static int getTypeCountOffset(int row) { 456 return TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE; 457 } 458 459 @Override 460 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { 461 RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos); 462 TriState nullSeen = getNullSeen(data, pos); 463 TriState exceptionSeen = getExceptionSeen(data, pos); 464 sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen, 465 getTypesNotRecordedExecutionCount(data, pos), profile.entries)); 466 for (int i = 0; i < profile.entries; i++) { 467 long count = profile.counts[i]; 468 sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount)); 469 } 470 return sb; 471 } 472 } 473 474 static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 475 476 static class ReceiverTypeData extends AbstractTypeData { 477 478 ReceiverTypeData(HotSpotVMConfig config, int tag) { 479 super(config, tag, TYPE_CHECK_DATA_SIZE); 480 } 481 482 protected ReceiverTypeData(HotSpotVMConfig config, int tag, int staticSize) { 483 super(config, tag, staticSize); 484 } 485 486 @Override 487 public int getExecutionCount(HotSpotMethodData data, int position) { 488 return -1; 489 } 490 491 @Override 492 protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) { 493 return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET); 494 } 495 } 496 497 static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth); 498 static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 499 static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 500 501 static class VirtualCallData extends ReceiverTypeData { 502 503 VirtualCallData(HotSpotVMConfig config, int tag) { 504 super(config, tag, VIRTUAL_CALL_DATA_SIZE); 505 } 506 507 protected VirtualCallData(HotSpotVMConfig config, int tag, int staticSize) { 508 super(config, tag, staticSize); 509 } 510 511 @Override 512 public int getExecutionCount(HotSpotMethodData data, int position) { 513 final int typeProfileWidth = config.typeProfileWidth; 771 static class ArgInfoData extends ArrayData { 772 773 ArgInfoData(HotSpotVMConfig config, int tag) { 774 super(config, tag, ARG_INFO_DATA_SIZE); 775 } 776 } 777 778 static class UnknownProfileData extends HotSpotMethodDataAccessor { 779 UnknownProfileData(HotSpotVMConfig config, int tag) { 780 super(config, tag, 0); 781 } 782 783 @Override 784 protected int getDynamicSize(HotSpotMethodData data, int position) { 785 assert staticSize == 0; 786 return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position); 787 } 788 789 @Override 790 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { 791 return null; 792 } 793 } 794 795 public void setCompiledIRSize(int size) { 796 UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size); 797 } 798 799 public int getCompiledIRSize() { 800 return UNSAFE.getInt(metaspaceMethodData + config.methodDataIRSizeOffset); 801 } 802 803 // sorted by tag 804 // @formatter:off 805 static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { 806 null, 807 new BitData(config, config.dataLayoutBitDataTag), 808 new CounterData(config, config.dataLayoutCounterDataTag), 809 new JumpData(config, config.dataLayoutJumpDataTag), 810 new ReceiverTypeData(config, config.dataLayoutReceiverTypeDataTag), 811 new VirtualCallData(config, config.dataLayoutVirtualCallDataTag), 812 new RetData(config, config.dataLayoutRetDataTag), 813 new BranchData(config, config.dataLayoutBranchDataTag), 814 new MultiBranchData(config, config.dataLayoutMultiBranchDataTag), 815 new ArgInfoData(config, config.dataLayoutArgInfoDataTag), 816 new UnknownProfileData(config, config.dataLayoutCallTypeDataTag), 817 new VirtualCallTypeData(config, config.dataLayoutVirtualCallTypeDataTag), 818 new UnknownProfileData(config, config.dataLayoutParametersTypeDataTag), 819 new UnknownProfileData(config, config.dataLayoutSpeculativeTrapDataTag), 820 }; 821 822 private static boolean checkAccessorTags() { 823 int expectedTag = 0; 824 for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) { 825 if (expectedTag ==0 ) { 826 assert accessor == null; 827 } else { 828 assert accessor.tag == expectedTag: expectedTag + " != " + accessor.tag + " " + accessor; 829 } 830 expectedTag++; 831 } 832 return true; 833 } 834 835 static { 836 assert checkAccessorTags(); 837 } 838 // @formatter:on 839 } | 36 import jdk.vm.ci.meta.JavaMethodProfile.ProfiledMethod; 37 import jdk.vm.ci.meta.JavaTypeProfile; 38 import jdk.vm.ci.meta.JavaTypeProfile.ProfiledType; 39 import jdk.vm.ci.meta.ResolvedJavaMethod; 40 import jdk.vm.ci.meta.ResolvedJavaType; 41 import jdk.vm.ci.meta.TriState; 42 43 /** 44 * Access to a HotSpot {@code MethodData} structure (defined in methodData.hpp). 45 */ 46 final class HotSpotMethodData { 47 48 static final HotSpotVMConfig config = config(); 49 static final HotSpotMethodDataAccessor NO_DATA_NO_EXCEPTION_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.FALSE); 50 static final HotSpotMethodDataAccessor NO_DATA_EXCEPTION_POSSIBLY_NOT_RECORDED_ACCESSOR = new NoMethodData(config, config.dataLayoutNoTag, TriState.UNKNOWN); 51 52 /** 53 * Reference to the C++ MethodData object. 54 */ 55 final long metaspaceMethodData; 56 private final HotSpotResolvedJavaMethodImpl method; 57 58 HotSpotMethodData(long metaspaceMethodData, HotSpotResolvedJavaMethodImpl method) { 59 this.metaspaceMethodData = metaspaceMethodData; 60 this.method = method; 61 } 62 63 /** 64 * @return value of the MethodData::_data_size field 65 */ 66 private int normalDataSize() { 67 return UNSAFE.getInt(metaspaceMethodData + config.methodDataDataSize); 68 } 69 70 /** 71 * Returns the size of the extra data records. This method does the same calculation as 72 * MethodData::extra_data_size(). 73 * 74 * @return size of extra data records 75 */ 76 private int extraDataSize() { 77 final int extraDataBase = config.methodDataOopDataOffset + normalDataSize(); 78 final int extraDataLimit = UNSAFE.getInt(metaspaceMethodData + config.methodDataSize); 90 public int getExtraDataBeginOffset() { 91 return normalDataSize(); 92 } 93 94 public boolean isWithin(int position) { 95 return position >= 0 && position < normalDataSize() + extraDataSize(); 96 } 97 98 public int getDeoptimizationCount(DeoptimizationReason reason) { 99 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); 100 int reasonIndex = metaAccess.convertDeoptReason(reason); 101 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + reasonIndex) & 0xFF; 102 } 103 104 public int getOSRDeoptimizationCount(DeoptimizationReason reason) { 105 HotSpotMetaAccessProvider metaAccess = (HotSpotMetaAccessProvider) runtime().getHostJVMCIBackend().getMetaAccess(); 106 int reasonIndex = metaAccess.convertDeoptReason(reason); 107 return UNSAFE.getByte(metaspaceMethodData + config.methodDataOopTrapHistoryOffset + config.deoptReasonOSROffset + reasonIndex) & 0xFF; 108 } 109 110 public int getDecompileCount() { 111 return UNSAFE.getInt(metaspaceMethodData + config.methodDataDecompiles); 112 } 113 114 public int getOverflowRecompileCount() { 115 return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowRecompiles); 116 } 117 118 public int getOverflowTrapsCount() { 119 return UNSAFE.getInt(metaspaceMethodData + config.methodDataOverflowTraps); 120 } 121 122 public HotSpotMethodDataAccessor getNormalData(int position) { 123 if (position >= normalDataSize()) { 124 return null; 125 } 126 127 return getData(position); 128 } 129 130 public HotSpotMethodDataAccessor getExtraData(int position) { 131 if (position >= normalDataSize() + extraDataSize()) { 132 return null; 133 } 134 HotSpotMethodDataAccessor data = getData(position); 135 if (data != null) { 136 return data; 137 } 138 return data; 139 } 140 141 public static HotSpotMethodDataAccessor getNoDataAccessor(boolean exceptionPossiblyNotRecorded) { 209 return config.dataLayoutHeaderSize + cellsToBytes(cells); 210 } 211 212 private static int cellsToBytes(int cells) { 213 return cells * config.dataLayoutCellSize; 214 } 215 216 /** 217 * Returns whether profiling ran long enough that the profile information is mature. Other 218 * informational data will still be valid even if the profile isn't mature. 219 */ 220 public boolean isProfileMature() { 221 return runtime().getCompilerToVM().isMature(metaspaceMethodData); 222 } 223 224 @Override 225 public String toString() { 226 StringBuilder sb = new StringBuilder(); 227 String nl = String.format("%n"); 228 String nlIndent = String.format("%n%38s", ""); 229 sb.append("Raw method data for "); 230 sb.append(method.format("%H.%n(%p)")); 231 sb.append(":"); 232 sb.append(nl); 233 sb.append(String.format("nof_decompiles(%d) nof_overflow_recompile(%d) nof_overflow_traps(%d)%n", 234 getDecompileCount(), getOverflowRecompileCount(), getOverflowTrapsCount())); 235 if (hasNormalData()) { 236 int pos = 0; 237 HotSpotMethodDataAccessor data; 238 while ((data = getNormalData(pos)) != null) { 239 if (pos != 0) { 240 sb.append(nl); 241 } 242 int bci = data.getBCI(this, pos); 243 sb.append(String.format("%-6d bci: %-6d%-20s", pos, bci, data.getClass().getSimpleName())); 244 sb.append(data.appendTo(new StringBuilder(), this, pos).toString().replace(nl, nlIndent)); 245 pos = pos + data.getSize(this, pos); 246 } 247 } 248 249 if (hasExtraData()) { 250 int pos = getExtraDataBeginOffset(); 251 HotSpotMethodDataAccessor data; 252 while ((data = getExtraData(pos)) != null) { 253 if (pos == getExtraDataBeginOffset()) { 254 sb.append(nl).append("--- Extra data:"); 428 for (int j = 0; j < entries; j++) { 429 if (types[j].equals(klass)) { 430 totalCount += count; 431 counts[j] += count; 432 continue outer; 433 } 434 } 435 types[entries] = klass; 436 totalCount += count; 437 counts[entries] = count; 438 entries++; 439 } 440 } 441 442 totalCount += getTypesNotRecordedExecutionCount(data, position); 443 return new RawItemProfile<>(entries, types, counts, totalCount); 444 } 445 446 protected abstract long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position); 447 448 public int getNonprofiledCount(HotSpotMethodData data, int position) { 449 return data.readUnsignedIntAsSignedInt(position, NONPROFILED_COUNT_OFFSET); 450 } 451 452 private JavaTypeProfile createTypeProfile(TriState nullSeen, RawItemProfile<ResolvedJavaType> profile) { 453 if (profile.entries <= 0 || profile.totalCount <= 0) { 454 return null; 455 } 456 457 ProfiledType[] ptypes = new ProfiledType[profile.entries]; 458 double totalProbability = 0.0; 459 for (int i = 0; i < profile.entries; i++) { 460 double p = profile.counts[i]; 461 p = p / profile.totalCount; 462 totalProbability += p; 463 ptypes[i] = new ProfiledType(profile.items[i], p); 464 } 465 466 Arrays.sort(ptypes); 467 468 double notRecordedTypeProbability = profile.entries < config.typeProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability)); 469 assert notRecordedTypeProbability == 0 || profile.entries == config.typeProfileWidth; 470 return new JavaTypeProfile(nullSeen, notRecordedTypeProbability, ptypes); 471 } 472 473 private static int getTypeOffset(int row) { 474 return TYPE_DATA_FIRST_TYPE_OFFSET + row * TYPE_DATA_ROW_SIZE; 475 } 476 477 protected static int getTypeCountOffset(int row) { 478 return TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + row * TYPE_DATA_ROW_SIZE; 479 } 480 481 @Override 482 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { 483 RawItemProfile<ResolvedJavaType> profile = getRawTypeProfile(data, pos); 484 TriState nullSeen = getNullSeen(data, pos); 485 TriState exceptionSeen = getExceptionSeen(data, pos); 486 sb.append(format("count(%d) null_seen(%s) exception_seen(%s) nonprofiled_count(%d) entries(%d)", getCounterValue(data, pos), nullSeen, exceptionSeen, 487 getNonprofiledCount(data, pos), profile.entries)); 488 for (int i = 0; i < profile.entries; i++) { 489 long count = profile.counts[i]; 490 sb.append(format("%n %s (%d, %4.2f)", profile.items[i].toJavaName(), count, (double) count / profile.totalCount)); 491 } 492 return sb; 493 } 494 } 495 496 static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 497 498 static class ReceiverTypeData extends AbstractTypeData { 499 500 ReceiverTypeData(HotSpotVMConfig config, int tag) { 501 super(config, tag, TYPE_CHECK_DATA_SIZE); 502 } 503 504 protected ReceiverTypeData(HotSpotVMConfig config, int tag, int staticSize) { 505 super(config, tag, staticSize); 506 } 507 508 @Override 509 public int getExecutionCount(HotSpotMethodData data, int position) { 510 return -1; 511 } 512 513 @Override 514 protected long getTypesNotRecordedExecutionCount(HotSpotMethodData data, int position) { 515 return getNonprofiledCount(data, position); 516 } 517 } 518 519 static final int VIRTUAL_CALL_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * (config.typeProfileWidth + config.methodProfileWidth); 520 static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 521 static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth; 522 523 static class VirtualCallData extends ReceiverTypeData { 524 525 VirtualCallData(HotSpotVMConfig config, int tag) { 526 super(config, tag, VIRTUAL_CALL_DATA_SIZE); 527 } 528 529 protected VirtualCallData(HotSpotVMConfig config, int tag, int staticSize) { 530 super(config, tag, staticSize); 531 } 532 533 @Override 534 public int getExecutionCount(HotSpotMethodData data, int position) { 535 final int typeProfileWidth = config.typeProfileWidth; 793 static class ArgInfoData extends ArrayData { 794 795 ArgInfoData(HotSpotVMConfig config, int tag) { 796 super(config, tag, ARG_INFO_DATA_SIZE); 797 } 798 } 799 800 static class UnknownProfileData extends HotSpotMethodDataAccessor { 801 UnknownProfileData(HotSpotVMConfig config, int tag) { 802 super(config, tag, 0); 803 } 804 805 @Override 806 protected int getDynamicSize(HotSpotMethodData data, int position) { 807 assert staticSize == 0; 808 return HotSpotJVMCIRuntime.runtime().compilerToVm.methodDataProfileDataSize(data.metaspaceMethodData, position); 809 } 810 811 @Override 812 public StringBuilder appendTo(StringBuilder sb, HotSpotMethodData data, int pos) { 813 sb.append("unknown profile data with tag: " + tag); 814 return sb; 815 } 816 } 817 818 public void setCompiledIRSize(int size) { 819 UNSAFE.putInt(metaspaceMethodData + config.methodDataIRSizeOffset, size); 820 } 821 822 public int getCompiledIRSize() { 823 return UNSAFE.getInt(metaspaceMethodData + config.methodDataIRSizeOffset); 824 } 825 826 // sorted by tag 827 // @formatter:off 828 static final HotSpotMethodDataAccessor[] PROFILE_DATA_ACCESSORS = { 829 null, 830 new BitData(config, config.dataLayoutBitDataTag), 831 new CounterData(config, config.dataLayoutCounterDataTag), 832 new JumpData(config, config.dataLayoutJumpDataTag), 833 new ReceiverTypeData(config, config.dataLayoutReceiverTypeDataTag), 834 new VirtualCallData(config, config.dataLayoutVirtualCallDataTag), 835 new RetData(config, config.dataLayoutRetDataTag), 836 new BranchData(config, config.dataLayoutBranchDataTag), 837 new MultiBranchData(config, config.dataLayoutMultiBranchDataTag), 838 new ArgInfoData(config, config.dataLayoutArgInfoDataTag), 839 new UnknownProfileData(config, config.dataLayoutCallTypeDataTag), 840 new VirtualCallTypeData(config, config.dataLayoutVirtualCallTypeDataTag), 841 new UnknownProfileData(config, config.dataLayoutParametersTypeDataTag), 842 new UnknownProfileData(config, config.dataLayoutSpeculativeTrapDataTag), 843 }; 844 845 private static boolean checkAccessorTags() { 846 int expectedTag = 0; 847 for (HotSpotMethodDataAccessor accessor : PROFILE_DATA_ACCESSORS) { 848 if (expectedTag == 0) { 849 assert accessor == null; 850 } else { 851 assert accessor.tag == expectedTag : expectedTag + " != " + accessor.tag + " " + accessor; 852 } 853 expectedTag++; 854 } 855 return true; 856 } 857 858 static { 859 assert checkAccessorTags(); 860 } 861 // @formatter:on 862 } |