private fun <T> processExtremes( forX: org.graalvm.compiler.core.common.type.Stamp, forY: org.graalvm.compiler.core.common.type.Stamp, op: BiFunction<Long, Long, T> ): T { val xStamp: org.graalvm.compiler.core.common.type.IntegerStamp = forX as org.graalvm.compiler.core.common.type.IntegerStamp val yStamp: org.graalvm.compiler.core.common.type.IntegerStamp = forY as org.graalvm.compiler.core.common.type.IntegerStamp val kind: jdk.vm.ci.meta.JavaKind = getStackKind() assert(kind == jdk.vm.ci.meta.JavaKind.Int || kind == jdk.vm.ci.meta.JavaKind.Long) val xExtremes: LongArray = getUnsignedExtremes(xStamp) val yExtremes: LongArray = getUnsignedExtremes(yStamp) var min = Long.MAX_VALUE var max = Long.MIN_VALUE for (a in xExtremes) { for (b in yExtremes) { val result: Long = if (kind == jdk.vm.ci.meta.JavaKind.Int) multiplyHighUnsigned( a.toInt(), b.toInt() ) else multiplyHighUnsigned(a, b) min = Math.min(min, result) max = Math.max(max, result) } } return op.apply(min, max) }
Determines the minimum and maximum result of this node for the given inputs and returns the result of the given BiFunction on the minimum and maximum values . Note that the minima and maxima are calculated using signed min/max functions , while the values themselves are unsigned .