本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.forChar方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.forChar方法的具体用法?Java JavaConstant.forChar怎么用?Java JavaConstant.forChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.JavaConstant
的用法示例。
在下文中一共展示了JavaConstant.forChar方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
}
示例2: 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());
}
}
示例3: 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;
}
示例4: 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;
}
}
示例5: 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}};
}