本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.forLong方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.forLong方法的具体用法?Java JavaConstant.forLong怎么用?Java JavaConstant.forLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.JavaConstant
的用法示例。
在下文中一共展示了JavaConstant.forLong方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
示例3: 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;
}
示例4: 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();
}
}
示例5: 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));
}
}
示例6: readConstant
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
static final ClassfileConstant readConstant(DataInputStream stream) throws IOException {
byte tag = stream.readByte();
switch (tag) {
case ClassfileConstant.CONSTANT_Class:
return new ClassfileConstant.ClassRef(stream);
case ClassfileConstant.CONSTANT_Fieldref:
return new ClassfileConstant.FieldRef(stream);
case ClassfileConstant.CONSTANT_Methodref:
return new ClassfileConstant.MethodRef(stream);
case ClassfileConstant.CONSTANT_InterfaceMethodref:
return new ClassfileConstant.InterfaceMethodRef(stream);
case ClassfileConstant.CONSTANT_String:
return new ClassfileConstant.StringRef(stream);
case ClassfileConstant.CONSTANT_Integer:
return new ClassfileConstant.Primitive(tag, JavaConstant.forInt(stream.readInt()));
case ClassfileConstant.CONSTANT_Float:
return new ClassfileConstant.Primitive(tag, JavaConstant.forFloat(stream.readFloat()));
case ClassfileConstant.CONSTANT_Long:
return new ClassfileConstant.Primitive(tag, JavaConstant.forLong(stream.readLong()));
case ClassfileConstant.CONSTANT_Double:
return new ClassfileConstant.Primitive(tag, JavaConstant.forDouble(stream.readDouble()));
case ClassfileConstant.CONSTANT_NameAndType:
return new ClassfileConstant.NameAndType(stream);
case ClassfileConstant.CONSTANT_Utf8:
return new ClassfileConstant.Utf8(stream.readUTF());
case ClassfileConstant.CONSTANT_MethodHandle:
skipFully(stream, 3); // reference_kind, reference_index
return new ClassfileConstant.Unsupported(tag, "CONSTANT_MethodHandle_info");
case ClassfileConstant.CONSTANT_MethodType:
skipFully(stream, 2); // descriptor_index
return new ClassfileConstant.Unsupported(tag, "CONSTANT_MethodType_info");
case ClassfileConstant.CONSTANT_InvokeDynamic:
skipFully(stream, 4); // bootstrap_method_attr_index, name_and_type_index
return new ClassfileConstant.Unsupported(tag, "CONSTANT_InvokeDynamic_info");
default:
throw new GraalError("Invalid constant pool tag: " + tag);
}
}
示例7: min32
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
private static void min32(CompareNode enode, ValueNode v) {
Stamp s = v.stamp();
if (s instanceof IntegerStamp) {
int bits = ((IntegerStamp) s).getBits();
if (bits != 32 && bits != 64) {
if (bits <= 32) {
bits = 32;
} else {
bits = 64;
}
ValueNode replacement;
if (v instanceof ConstantNode) {
JavaConstant newConst;
if (bits == 32) {
newConst = JavaConstant.forInt(v.asJavaConstant().asInt());
} else if (bits == 64) {
newConst = JavaConstant.forLong(v.asJavaConstant().asLong());
} else {
throw GraalError.shouldNotReachHere();
}
long mask = CodeUtil.mask(bits);
replacement = v.graph().addOrUnique(new ConstantNode(newConst, IntegerStamp.stampForMask(bits, newConst.asLong() & mask, newConst.asLong() & mask)));
} else {
replacement = v.graph().addOrUnique(new SignExtendNode(v, bits));
}
v.replaceAtUsages(replacement, x -> x == enode);
}
}
}
示例8: emitNarrow
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public Value emitNarrow(Value inputVal, int bits) {
if (inputVal.getPlatformKind() == AArch64Kind.QWORD && bits <= 32) {
LIRKind resultKind = getResultLirKind(bits, inputVal);
long mask = NumUtil.getNbitNumberLong(bits);
Value maskValue = new ConstantValue(resultKind, JavaConstant.forLong(mask));
return emitBinary(resultKind, AArch64ArithmeticOp.AND, true, inputVal, maskValue);
} else {
return inputVal;
}
}
示例9: testLong
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void testLong() {
long[] a = new long[]{Long.MIN_VALUE, Long.MIN_VALUE + 1, -1, 0, 1, Long.MAX_VALUE - 1, Long.MAX_VALUE};
for (long i : a) {
ConstantNode node = ConstantNode.forLong(i, graph);
JavaConstant expected = JavaConstant.forLong(-i);
assertEquals(expected, ArithmeticOpTable.forStamp(node.stamp()).getNeg().foldConstant(node.asConstant()));
}
}
示例10: 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;
}
}
示例11: 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}};
}
示例12: testConstLong
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Test
public void testConstLong() {
DebugInfoCompiler compiler = (asm, values) -> {
values[0] = JavaConstant.forLong(42);
values[1] = Value.ILLEGAL;
return null;
};
testLongOnStack(compiler);
testLongInLocal(compiler);
}