comparison jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/CompilationResult.java @ 22739:f41ed1d87d68

8143730 [JVMCI] infopoint recording is too restrictive
author Doug Simon <doug.simon@oracle.com>
date Wed, 25 Nov 2015 20:41:26 +0100
parents a93a36e7b419
children 22110ef74a40
comparison
equal deleted inserted replaced
22738:eb6d572dfa61 22739:f41ed1d87d68
778 778
779 /** 779 /**
780 * Records a custom infopoint in the code section. 780 * Records a custom infopoint in the code section.
781 * 781 *
782 * Compiler implementations can use this method to record non-standard infopoints, which are not 782 * Compiler implementations can use this method to record non-standard infopoints, which are not
783 * handled by the dedicated methods like {@link #recordCall}. 783 * handled by dedicated methods like {@link #recordCall}.
784 * 784 *
785 * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint} 785 * @param infopoint the infopoint to record, usually a derived class from {@link Infopoint}
786 */ 786 */
787 public void addInfopoint(Infopoint infopoint) { 787 public void addInfopoint(Infopoint infopoint) {
788 // The infopoints list must always be sorted
789 if (!infopoints.isEmpty()) {
790 Infopoint previousInfopoint = infopoints.get(infopoints.size() - 1);
791 if (previousInfopoint.pcOffset > infopoint.pcOffset) {
792 // This re-sorting should be very rare
793 Collections.sort(infopoints);
794 previousInfopoint = infopoints.get(infopoints.size() - 1);
795 }
796 if (previousInfopoint.pcOffset == infopoint.pcOffset) {
797 if (infopoint.reason.canBeOmitted()) {
798 return;
799 }
800 if (previousInfopoint.reason.canBeOmitted()) {
801 Infopoint removed = infopoints.remove(infopoints.size() - 1);
802 assert removed == previousInfopoint;
803 } else {
804 throw new RuntimeException("Infopoints that can not be omited should have distinct PCs");
805 }
806 }
807 }
808 infopoints.add(infopoint); 788 infopoints.add(infopoint);
809 } 789 }
810 790
811 /** 791 /**
812 * Records an instruction mark within this method. 792 * Records an instruction mark within this method.