package org.graalvm.compiler.hotspot.stubs;
import org.graalvm.compiler.api.replacements.Snippet;
import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
import org.graalvm.compiler.options.OptionValues;
import org.graalvm.compiler.replacements.nodes.CStringConstant;
import org.graalvm.compiler.word.Word;
import jdk.vm.ci.code.Register;
public class IntegerExactOverflowExceptionStub extends CreateExceptionStub {
public IntegerExactOverflowExceptionStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
super("createIntegerExactOverflowException", options, providers, linkage);
}
@Override
protected Object getConstantParameterValue(int index, String name) {
GraalError.guarantee(index == 0, "unknown parameter %s at index %d", name, index);
return providers.getRegisters().getThreadRegister();
}
@Snippet
private static Object createIntegerExactOverflowException(@ConstantParameter Register threadRegister) {
Word msg = CStringConstant.cstring("integer overflow");
return createException(threadRegister, ArithmeticException.class, msg);
}
}