src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File open Sdiff src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java

Print this page




 561             int profileWidth = config.methodProfileWidth;
 562 
 563             ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
 564             long[] counts = new long[profileWidth];
 565             long totalCount = 0;
 566             int entries = 0;
 567 
 568             for (int i = 0; i < profileWidth; i++) {
 569                 HotSpotResolvedJavaMethod method = data.readMethod(position, getMethodOffset(i));
 570                 if (method != null) {
 571                     methods[entries] = method;
 572                     long count = data.readUnsignedInt(position, getMethodCountOffset(i));
 573                     totalCount += count;
 574                     counts[entries] = count;
 575 
 576                     entries++;
 577                 }
 578             }
 579 
 580             totalCount += getMethodsNotRecordedExecutionCount(data, position);







 581             return new RawItemProfile<>(entries, methods, counts, totalCount);
 582         }
 583 
 584         private JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
 585             if (profile.entries <= 0 || profile.totalCount <= 0) {
 586                 return null;
 587             }
 588 
 589             ProfiledMethod[] pmethods = new ProfiledMethod[profile.entries];
 590             double totalProbability = 0.0;
 591             for (int i = 0; i < profile.entries; i++) {
 592                 double p = profile.counts[i];
 593                 p = p / profile.totalCount;
 594                 totalProbability += p;
 595                 pmethods[i] = new ProfiledMethod(profile.items[i], p);
 596             }
 597 
 598             Arrays.sort(pmethods);
 599 
 600             double notRecordedMethodProbability = profile.entries < config.methodProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));




 561             int profileWidth = config.methodProfileWidth;
 562 
 563             ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
 564             long[] counts = new long[profileWidth];
 565             long totalCount = 0;
 566             int entries = 0;
 567 
 568             for (int i = 0; i < profileWidth; i++) {
 569                 HotSpotResolvedJavaMethod method = data.readMethod(position, getMethodOffset(i));
 570                 if (method != null) {
 571                     methods[entries] = method;
 572                     long count = data.readUnsignedInt(position, getMethodCountOffset(i));
 573                     totalCount += count;
 574                     counts[entries] = count;
 575 
 576                     entries++;
 577                 }
 578             }
 579 
 580             totalCount += getMethodsNotRecordedExecutionCount(data, position);
 581 
 582             // Fixup the case of C1's inability to optimize profiling of a statically bindable call site.
 583             // If it's a monomorphic call site, attribute all the counts to the first type (if any is recorded).
 584             if (entries == 1) {
 585                 counts[0] = totalCount;
 586             }
 587 
 588             return new RawItemProfile<>(entries, methods, counts, totalCount);
 589         }
 590 
 591         private JavaMethodProfile createMethodProfile(RawItemProfile<ResolvedJavaMethod> profile) {
 592             if (profile.entries <= 0 || profile.totalCount <= 0) {
 593                 return null;
 594             }
 595 
 596             ProfiledMethod[] pmethods = new ProfiledMethod[profile.entries];
 597             double totalProbability = 0.0;
 598             for (int i = 0; i < profile.entries; i++) {
 599                 double p = profile.counts[i];
 600                 p = p / profile.totalCount;
 601                 totalProbability += p;
 602                 pmethods[i] = new ProfiledMethod(profile.items[i], p);
 603             }
 604 
 605             Arrays.sort(pmethods);
 606 
 607             double notRecordedMethodProbability = profile.entries < config.methodProfileWidth ? 0.0 : Math.min(1.0, Math.max(0.0, 1.0 - totalProbability));


src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File