< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotCounterOp.java

Print this page
rev 52509 : [mq]: graal2

*** 25,34 **** --- 25,36 ---- package org.graalvm.compiler.hotspot; import static jdk.vm.ci.code.ValueUtil.isRegister; import static org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant; import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant; + import static org.graalvm.compiler.nodes.debug.DynamicCounterNode.MAX_INCREMENT; + import static org.graalvm.compiler.nodes.debug.DynamicCounterNode.MIN_INCREMENT; import java.util.Arrays; import jdk.internal.vm.compiler.collections.EconomicMap; import org.graalvm.compiler.asm.Assembler;
*** 67,76 **** --- 69,93 ---- this.names = names; this.groups = groups; this.increments = increments; this.thread = registers.getThreadRegister(); this.config = config; + checkIncrements(); + } + + private boolean checkIncrements() { + for (int i = 0; i < increments.length; i++) { + Value increment = increments[i]; + if (isJavaConstant(increment)) { + long incValue = asLong(asJavaConstant(increment)); + if (incValue < MIN_INCREMENT || incValue > MAX_INCREMENT) { + String message = String.format("Benchmark counter %s:%s has increment out of range [%d .. %d]: %d", groups[i], names[i], MIN_INCREMENT, MAX_INCREMENT, incValue); + assert false : message; + } + } + } + return true; } protected static int getDisplacementForLongIndex(TargetDescription target, long index) { long finalDisp = index * target.arch.getPlatformKind(JavaKind.Long).getSizeInBytes(); if (!NumUtil.isInt(finalDisp)) {
< prev index next >