本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.forBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.forBoolean方法的具体用法?Java JavaConstant.forBoolean怎么用?Java JavaConstant.forBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.JavaConstant
的用法示例。
在下文中一共展示了JavaConstant.forBoolean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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;
}
示例3: asJavaTypeDataProvider
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@DataProvider(name = "asJavaTypeDataProvider")
public static Object[][] asJavaTypeDataProvider() {
return new Object[][]{
{CONSTANT_REFLECTION_PROVIDER.forObject(DummyClass.class),
"jdk.vm.ci.hotspot.test.DummyClass"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean.class), "boolean"},
{CONSTANT_REFLECTION_PROVIDER.forObject(byte.class), "byte"},
{CONSTANT_REFLECTION_PROVIDER.forObject(short.class), "short"},
{CONSTANT_REFLECTION_PROVIDER.forObject(char.class), "char"},
{CONSTANT_REFLECTION_PROVIDER.forObject(int.class), "int"},
{CONSTANT_REFLECTION_PROVIDER.forObject(long.class), "long"},
{CONSTANT_REFLECTION_PROVIDER.forObject(float.class), "float"},
{CONSTANT_REFLECTION_PROVIDER.forObject(double.class), "double"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object.class), "java.lang.Object"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[].class), "boolean[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(boolean[][].class), "boolean[][]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[].class), "java.lang.Object[]"},
{CONSTANT_REFLECTION_PROVIDER.forObject(Object[][].class), "java.lang.Object[][]"},
{JavaConstant.forBoolean(DUMMY_CLASS_INSTANCE.booleanField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.objectField), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayWithValues), null},
{CONSTANT_REFLECTION_PROVIDER.forObject(DUMMY_CLASS_INSTANCE.booleanArrayArrayWithValues), null},
{JavaConstant.NULL_POINTER, null}, {null, null}};
}
示例4: 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;
}
示例5: 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;
}
}
示例6: 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}};
}