本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.forShort方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.forShort方法的具体用法?Java JavaConstant.forShort怎么用?Java JavaConstant.forShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.JavaConstant
的用法示例。
在下文中一共展示了JavaConstant.forShort方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: zapValueForKind
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
long dead = 0xDEADDEADDEADDEADL;
switch ((SPARCKind) kind) {
case BYTE:
return JavaConstant.forByte((byte) dead);
case HWORD:
return JavaConstant.forShort((short) dead);
case WORD:
return JavaConstant.forInt((int) dead);
case XWORD:
return JavaConstant.forLong(dead);
case SINGLE:
case V32_BYTE:
case V32_HWORD:
return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
case DOUBLE:
case V64_BYTE:
case V64_HWORD:
case V64_WORD:
return JavaConstant.forDouble(Double.longBitsToDouble(dead));
default:
throw new IllegalArgumentException(kind.toString());
}
}
示例2: zero
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
/**
* Returns the zero value for a given numeric kind.
*/
public static JavaConstant zero(JavaKind kind) {
switch (kind) {
case Boolean:
return JavaConstant.FALSE;
case Byte:
return JavaConstant.forByte((byte) 0);
case Char:
return JavaConstant.forChar((char) 0);
case Double:
return JavaConstant.DOUBLE_0;
case Float:
return JavaConstant.FLOAT_0;
case Int:
return JavaConstant.INT_0;
case Long:
return JavaConstant.LONG_0;
case Short:
return JavaConstant.forShort((short) 0);
default:
throw new IllegalArgumentException(kind.toString());
}
}
示例3: one
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
/**
* Returns the one value for a given numeric kind.
*/
public static JavaConstant one(JavaKind kind) {
switch (kind) {
case Boolean:
return JavaConstant.TRUE;
case Byte:
return JavaConstant.forByte((byte) 1);
case Char:
return JavaConstant.forChar((char) 1);
case Double:
return JavaConstant.DOUBLE_1;
case Float:
return JavaConstant.FLOAT_1;
case Int:
return JavaConstant.INT_1;
case Long:
return JavaConstant.LONG_1;
case Short:
return JavaConstant.forShort((short) 1);
default:
throw new IllegalArgumentException(kind.toString());
}
}
示例4: deserialize
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public SerializableConstant deserialize(ByteBuffer buffer) {
switch (getBits()) {
case 1:
return JavaConstant.forBoolean(buffer.get() != 0);
case 8:
return JavaConstant.forByte(buffer.get());
case 16:
return JavaConstant.forShort(buffer.getShort());
case 32:
return JavaConstant.forInt(buffer.getInt());
case 64:
return JavaConstant.forLong(buffer.getLong());
default:
throw GraalError.shouldNotReachHere();
}
}
示例5: asConstant
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant asConstant() {
if (lowerBound == upperBound) {
switch (getBits()) {
case 1:
return JavaConstant.forBoolean(lowerBound != 0);
case 8:
return JavaConstant.forByte((byte) lowerBound);
case 16:
return JavaConstant.forShort((short) lowerBound);
case 32:
return JavaConstant.forInt((int) lowerBound);
case 64:
return JavaConstant.forLong(lowerBound);
}
}
return null;
}
示例6: zapValueForKind
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
long dead = 0xDEADDEADDEADDEADL;
switch ((AArch64Kind) kind) {
case BYTE:
return JavaConstant.forByte((byte) dead);
case WORD:
return JavaConstant.forShort((short) dead);
case DWORD:
return JavaConstant.forInt((int) dead);
case QWORD:
return JavaConstant.forLong(dead);
case SINGLE:
return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
case DOUBLE:
return JavaConstant.forDouble(Double.longBitsToDouble(dead));
default:
throw GraalError.shouldNotReachHere();
}
}
示例7: zapValueForKind
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
protected JavaConstant zapValueForKind(PlatformKind kind) {
long dead = 0xDEADDEADDEADDEADL;
switch ((AMD64Kind) kind) {
case BYTE:
return JavaConstant.forByte((byte) dead);
case WORD:
return JavaConstant.forShort((short) dead);
case DWORD:
return JavaConstant.forInt((int) dead);
case QWORD:
return JavaConstant.forLong(dead);
case SINGLE:
return JavaConstant.forFloat(Float.intBitsToFloat((int) dead));
default:
// we don't support vector types, so just zap with double for all of them
return JavaConstant.forDouble(Double.longBitsToDouble(dead));
}
}
示例8: canonicalizeBoxing
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public static FloatingNode canonicalizeBoxing(BoxNode box, MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection) {
ValueNode value = box.getValue();
if (value.isConstant()) {
JavaConstant sourceConstant = value.asJavaConstant();
if (sourceConstant.getJavaKind() != box.getBoxingKind() && sourceConstant.getJavaKind().isNumericInteger()) {
switch (box.getBoxingKind()) {
case Boolean:
sourceConstant = JavaConstant.forBoolean(sourceConstant.asLong() != 0L);
break;
case Byte:
sourceConstant = JavaConstant.forByte((byte) sourceConstant.asLong());
break;
case Char:
sourceConstant = JavaConstant.forChar((char) sourceConstant.asLong());
break;
case Short:
sourceConstant = JavaConstant.forShort((short) sourceConstant.asLong());
break;
}
}
JavaConstant boxedConstant = constantReflection.boxPrimitive(sourceConstant);
if (boxedConstant != null && sourceConstant.getJavaKind() == box.getBoxingKind()) {
return ConstantNode.forConstant(boxedConstant, metaAccess, box.graph());
}
}
return null;
}
示例9: readPrimitiveConstant
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant readPrimitiveConstant(JavaKind kind, Constant baseConstant, long initialDisplacement, int bits) {
try {
long rawValue = readRawValue(baseConstant, initialDisplacement, kind, bits);
switch (kind) {
case Boolean:
return JavaConstant.forBoolean(rawValue != 0);
case Byte:
return JavaConstant.forByte((byte) rawValue);
case Char:
return JavaConstant.forChar((char) rawValue);
case Short:
return JavaConstant.forShort((short) rawValue);
case Int:
return JavaConstant.forInt((int) rawValue);
case Long:
return JavaConstant.forLong(rawValue);
case Float:
return JavaConstant.forFloat(Float.intBitsToFloat((int) rawValue));
case Double:
return JavaConstant.forDouble(Double.longBitsToDouble(rawValue));
default:
throw new IllegalArgumentException("Unsupported kind: " + kind);
}
} catch (NullPointerException e) {
return null;
}
}
示例10: isEmbeddableDataProvider
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@DataProvider(name = "isEmbeddableDataProvider")
public static Object[][] isEmbeddableDataProvider() {
return new Object[][]{{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), true},
{JavaConstant.forByte(DUMMY_CLASS_INSTANCE.byteField), true},
{JavaConstant.forShort(DUMMY_CLASS_INSTANCE.shortField), true},
{JavaConstant.forInt(DUMMY_CLASS_INSTANCE.intField), true},
{JavaConstant.forLong(DUMMY_CLASS_INSTANCE.longField), true},
{JavaConstant.forChar(DUMMY_CLASS_INSTANCE.charField), true},
{JavaConstant.forFloat(DUMMY_CLASS_INSTANCE.floatField), true},
{JavaConstant.forDouble(DUMMY_CLASS_INSTANCE.doubleField), true},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), true},
{JavaConstant.NULL_POINTER, true}, {null, true}};
}