< prev index next >

src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotProfilingInfo.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import jdk.vm.ci.meta.DeoptimizationReason;
  26 import jdk.vm.ci.meta.JavaMethodProfile;
  27 import jdk.vm.ci.meta.JavaTypeProfile;
  28 import jdk.vm.ci.meta.ProfilingInfo;
  29 import jdk.vm.ci.meta.TriState;
  30 
  31 public final class HotSpotProfilingInfo implements ProfilingInfo, HotSpotProxified {
  32 
  33     // private static final DebugMetric metricInsufficentSpace =
  34     // Debug.metric("InsufficientSpaceForProfilingData");
  35 
  36     private final HotSpotMethodData methodData;
  37     private final HotSpotResolvedJavaMethod method;
  38 
  39     private boolean isMature;
  40     private int position;
  41     private int hintPosition;
  42     private int hintBCI;
  43     private HotSpotMethodDataAccessor dataAccessor;
  44 
  45     private boolean includeNormal;
  46     private boolean includeOSR;
  47 
  48     public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
  49         this.methodData = methodData;
  50         this.method = method;
  51         this.includeNormal = includeNormal;
  52         this.includeOSR = includeOSR;
  53         this.isMature = methodData.isProfileMature();
  54         hintPosition = 0;


 145                 }
 146                 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
 147             }
 148         }
 149 
 150         boolean exceptionPossiblyNotRecorded = false;
 151         if (searchExtraData && methodData.hasExtraData()) {
 152             int currentPosition = methodData.getExtraDataBeginOffset();
 153             HotSpotMethodDataAccessor currentAccessor;
 154             while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
 155                 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
 156                 if (currentBCI == targetBCI) {
 157                     extraDataFound(currentAccessor, currentPosition);
 158                     return;
 159                 }
 160                 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
 161             }
 162 
 163             if (!methodData.isWithin(currentPosition)) {
 164                 exceptionPossiblyNotRecorded = true;
 165                 // metricInsufficentSpace.increment();
 166             }
 167         }
 168 
 169         noDataFound(exceptionPossiblyNotRecorded);
 170     }
 171 
 172     private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
 173         setCurrentData(data, pos);
 174         this.hintPosition = position;
 175         this.hintBCI = bci;
 176     }
 177 
 178     private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
 179         setCurrentData(data, pos);
 180     }
 181 
 182     private void noDataFound(boolean exceptionPossiblyNotRecorded) {
 183         HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
 184         setCurrentData(accessor, -1);
 185     }




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package jdk.vm.ci.hotspot;
  24 
  25 import jdk.vm.ci.meta.DeoptimizationReason;
  26 import jdk.vm.ci.meta.JavaMethodProfile;
  27 import jdk.vm.ci.meta.JavaTypeProfile;
  28 import jdk.vm.ci.meta.ProfilingInfo;
  29 import jdk.vm.ci.meta.TriState;
  30 
  31 public final class HotSpotProfilingInfo implements ProfilingInfo {



  32 
  33     private final HotSpotMethodData methodData;
  34     private final HotSpotResolvedJavaMethod method;
  35 
  36     private boolean isMature;
  37     private int position;
  38     private int hintPosition;
  39     private int hintBCI;
  40     private HotSpotMethodDataAccessor dataAccessor;
  41 
  42     private boolean includeNormal;
  43     private boolean includeOSR;
  44 
  45     public HotSpotProfilingInfo(HotSpotMethodData methodData, HotSpotResolvedJavaMethod method, boolean includeNormal, boolean includeOSR) {
  46         this.methodData = methodData;
  47         this.method = method;
  48         this.includeNormal = includeNormal;
  49         this.includeOSR = includeOSR;
  50         this.isMature = methodData.isProfileMature();
  51         hintPosition = 0;


 142                 }
 143                 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
 144             }
 145         }
 146 
 147         boolean exceptionPossiblyNotRecorded = false;
 148         if (searchExtraData && methodData.hasExtraData()) {
 149             int currentPosition = methodData.getExtraDataBeginOffset();
 150             HotSpotMethodDataAccessor currentAccessor;
 151             while ((currentAccessor = methodData.getExtraData(currentPosition)) != null) {
 152                 int currentBCI = currentAccessor.getBCI(methodData, currentPosition);
 153                 if (currentBCI == targetBCI) {
 154                     extraDataFound(currentAccessor, currentPosition);
 155                     return;
 156                 }
 157                 currentPosition = currentPosition + currentAccessor.getSize(methodData, currentPosition);
 158             }
 159 
 160             if (!methodData.isWithin(currentPosition)) {
 161                 exceptionPossiblyNotRecorded = true;

 162             }
 163         }
 164 
 165         noDataFound(exceptionPossiblyNotRecorded);
 166     }
 167 
 168     private void normalDataFound(HotSpotMethodDataAccessor data, int pos, int bci) {
 169         setCurrentData(data, pos);
 170         this.hintPosition = position;
 171         this.hintBCI = bci;
 172     }
 173 
 174     private void extraDataFound(HotSpotMethodDataAccessor data, int pos) {
 175         setCurrentData(data, pos);
 176     }
 177 
 178     private void noDataFound(boolean exceptionPossiblyNotRecorded) {
 179         HotSpotMethodDataAccessor accessor = HotSpotMethodData.getNoDataAccessor(exceptionPossiblyNotRecorded);
 180         setCurrentData(accessor, -1);
 181     }


< prev index next >