本文整理汇总了Java中jdk.vm.ci.meta.JavaConstant.forBoxedPrimitive方法的典型用法代码示例。如果您正苦于以下问题:Java JavaConstant.forBoxedPrimitive方法的具体用法?Java JavaConstant.forBoxedPrimitive怎么用?Java JavaConstant.forBoxedPrimitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.JavaConstant
的用法示例。
在下文中一共展示了JavaConstant.forBoxedPrimitive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readArrayElement
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant readArrayElement(JavaConstant array, int index) {
if (array == null || array.getJavaKind() != JavaKind.Object || array.isNull()) {
return null;
}
Object a = ((HotSpotObjectConstantImpl) array).object();
if (!a.getClass().isArray() || index < 0 || index >= Array.getLength(a)) {
return null;
}
if (a instanceof Object[]) {
Object element = ((Object[]) a)[index];
return HotSpotObjectConstantImpl.forObject(element);
} else {
return JavaConstant.forBoxedPrimitive(Array.get(a, index));
}
}
示例2: KindData
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
KindData(JavaKind kind, Object testObject) {
this.kind = kind;
try {
Class<?> c = testObject.getClass();
instanceField = c.getDeclaredField(kind.getJavaName() + "Field");
staticField = c.getDeclaredField(kind.getJavaName() + "StaticField");
instanceField.setAccessible(true);
staticField.setAccessible(true);
instanceFieldOffset = UNSAFE.objectFieldOffset(instanceField);
staticFieldOffset = UNSAFE.staticFieldOffset(staticField);
instanceFieldValue = JavaConstant.forBoxedPrimitive(instanceField.get(testObject));
staticFieldValue = JavaConstant.forBoxedPrimitive(staticField.get(null));
} catch (Exception e) {
throw new Error("TESTBUG for kind " + kind, e);
}
}
示例3: generate
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public void generate(LIRGeneratorTool gen) {
FrameMapBuilder frameMapBuilder = gen.getResult().getFrameMapBuilder();
// create slots
PrimitiveConstant constantValue = JavaConstant.forBoxedPrimitive(primitive);
VirtualStackSlot s1 = frameMapBuilder.allocateSpillSlot(LIRKind.fromJavaKind(gen.target().arch, constantValue.getJavaKind()));
// move stuff around
gen.emitMoveConstant(s1, constantValue);
gen.emitBlackhole(s1);
setResult(gen.emitMove(s1));
}
示例4: forBoxed
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant forBoxed(JavaKind kind, Object value) {
if (kind == JavaKind.Object) {
return forObject(value);
} else {
return JavaConstant.forBoxedPrimitive(value);
}
}
示例5: forBoxedValue
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
public static JavaConstant forBoxedValue(JavaKind kind, Object value) {
if (kind == JavaKind.Object) {
return HotSpotObjectConstantImpl.forObject(value);
} else {
return JavaConstant.forBoxedPrimitive(value);
}
}
示例6: unboxPrimitive
import jdk.vm.ci.meta.JavaConstant; //导入方法依赖的package包/类
@Override
public JavaConstant unboxPrimitive(JavaConstant source) {
if (source == null || !source.getJavaKind().isObject()) {
return null;
}
if (source.isNull()) {
return null;
}
return JavaConstant.forBoxedPrimitive(((HotSpotObjectConstantImpl) source).object());
}