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.hotspot.replacements.HotSpotReplacementsUtil;
import org.graalvm.compiler.hotspot.word.KlassPointer;
import jdk.vm.ci.code.Register;
public class ArrayStoreExceptionStub extends CreateExceptionStub {
public ArrayStoreExceptionStub(HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
super("createArrayStoreException", providers, linkage);
}
@Override
protected Object getConstantParameterValue(int index, String name) {
GraalError.guarantee(index == 1, "unknown parameter %s at index %d", name, index);
return providers.getRegisters().getThreadRegister();
}
@Snippet
private static Object createArrayStoreException(Object object, @ConstantParameter Register threadRegister) {
KlassPointer klass = HotSpotReplacementsUtil.loadHub(object);
return createException(threadRegister, ArrayStoreException.class, klass);
}
}