本文整理汇总了Java中jdk.vm.ci.meta.MetaAccessProvider.lookupJavaType方法的典型用法代码示例。如果您正苦于以下问题:Java MetaAccessProvider.lookupJavaType方法的具体用法?Java MetaAccessProvider.lookupJavaType怎么用?Java MetaAccessProvider.lookupJavaType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.vm.ci.meta.MetaAccessProvider
的用法示例。
在下文中一共展示了MetaAccessProvider.lookupJavaType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: javaType
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
switch (getBits()) {
case 1:
return metaAccess.lookupJavaType(Boolean.TYPE);
case 8:
return metaAccess.lookupJavaType(Byte.TYPE);
case 16:
return metaAccess.lookupJavaType(Short.TYPE);
case 32:
return metaAccess.lookupJavaType(Integer.TYPE);
case 64:
return metaAccess.lookupJavaType(Long.TYPE);
default:
throw GraalError.shouldNotReachHere();
}
}
示例2: checkInjectedArgument
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
protected boolean checkInjectedArgument(GraphBuilderContext b, ValueNode arg, ResolvedJavaMethod foldAnnotatedMethod) {
if (arg.isNullConstant()) {
return true;
}
MetaAccessProvider metaAccess = b.getMetaAccess();
ResolvedJavaMethod executeMethod = metaAccess.lookupJavaMethod(getExecuteMethod());
ResolvedJavaType thisClass = metaAccess.lookupJavaType(getClass());
ResolvedJavaMethod thisExecuteMethod = thisClass.resolveConcreteMethod(executeMethod, thisClass);
if (b.getMethod().equals(thisExecuteMethod)) {
// The "execute" method of this plugin is itself being compiled. In (only) this context,
// the injected argument of the call to the @Fold annotated method will be non-null.
return true;
}
throw new AssertionError("must pass null to injected argument of " + foldAnnotatedMethod.format("%H.%n(%p)") + ", not " + arg);
}
示例3: javaType
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
switch (getBits()) {
case 32:
return metaAccess.lookupJavaType(Float.TYPE);
case 64:
return metaAccess.lookupJavaType(Double.TYPE);
default:
throw GraalError.shouldNotReachHere();
}
}
示例4: forConstant
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
public static Stamp forConstant(JavaConstant value, MetaAccessProvider metaAccess) {
if (value.getJavaKind() == JavaKind.Object) {
ResolvedJavaType type = value.isNull() ? null : metaAccess.lookupJavaType(value);
return new ObjectStamp(type, value.isNonNull(), value.isNonNull(), value.isNull());
} else {
return forConstant(value);
}
}
示例5: javaType
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
if (type != null) {
return type;
}
return metaAccess.lookupJavaType(Object.class);
}
示例6: WordTypes
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
public WordTypes(MetaAccessProvider metaAccess, JavaKind wordKind) {
this.wordKind = wordKind;
this.wordBaseType = metaAccess.lookupJavaType(WordBase.class);
this.wordImplType = metaAccess.lookupJavaType(Word.class);
this.wordFactoryType = metaAccess.lookupJavaType(WordFactory.class);
this.objectAccessType = metaAccess.lookupJavaType(ObjectAccess.class);
this.barrieredAccessType = metaAccess.lookupJavaType(BarrieredAccess.class);
Word.ensureInitialized();
this.wordImplType.initialize();
}
示例7: typeOrNull
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
public static ResolvedJavaType typeOrNull(Stamp stamp, MetaAccessProvider metaAccess) {
if (stamp instanceof AbstractObjectStamp && stamp.hasValues()) {
AbstractObjectStamp abstractObjectStamp = (AbstractObjectStamp) stamp;
ResolvedJavaType type = abstractObjectStamp.type();
if (type == null) {
return metaAccess.lookupJavaType(Object.class);
} else {
return type;
}
}
return null;
}
示例8: asJavaType
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
private static JavaType asJavaType(Class<?> type, MetaAccessProvider metaAccess, WordTypes wordTypes) {
ResolvedJavaType javaType = metaAccess.lookupJavaType(type);
if (wordTypes.isWord(javaType)) {
javaType = metaAccess.lookupJavaType(wordTypes.getWordKind().toJavaClass());
}
return javaType;
}
示例9: getSignature
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public Signature getSignature() {
ForeignCallDescriptor d = linkage.getDescriptor();
MetaAccessProvider metaAccess = providers.getMetaAccess();
Class<?>[] arguments = d.getArgumentTypes();
ResolvedJavaType[] parameters = new ResolvedJavaType[arguments.length];
for (int i = 0; i < arguments.length; i++) {
parameters[i] = metaAccess.lookupJavaType(arguments[i]);
}
return new HotSpotSignature(jvmciRuntime, metaAccess.lookupJavaType(d.getResultType()), parameters);
}
示例10: HotSpotWordTypes
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
public HotSpotWordTypes(MetaAccessProvider metaAccess, JavaKind wordKind) {
super(metaAccess, wordKind);
this.metaspacePointerType = metaAccess.lookupJavaType(MetaspacePointer.class);
this.klassPointerType = metaAccess.lookupJavaType(KlassPointer.class);
this.methodPointerType = metaAccess.lookupJavaType(MethodPointer.class);
this.methodCountersPointerType = metaAccess.lookupJavaType(MethodCountersPointer.class);
}
示例11: isTrustedInterface
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
private static boolean isTrustedInterface(ResolvedJavaType declaringClass, MetaAccessProvider metaAccess) {
for (Class<?> trustedCls : FORBIDDEN_INSTANCE_OF_CHECKS) {
ResolvedJavaType trusted = metaAccess.lookupJavaType(trustedCls);
if (trusted.equals(declaringClass)) {
return true;
}
}
return false;
}
示例12: javaType
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public ResolvedJavaType javaType(MetaAccessProvider metaAccess) {
return metaAccess.lookupJavaType(Void.TYPE);
}
示例13: constant
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
@Override
public Stamp constant(Constant c, MetaAccessProvider meta) {
JavaConstant jc = (JavaConstant) c;
ResolvedJavaType constType = jc.isNull() ? null : meta.lookupJavaType(jc);
return copyWith(constType, jc.isNonNull(), jc.isNonNull(), jc.isNull());
}
示例14: getClassConstantReplacement
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
private ValueNode getClassConstantReplacement(StructuredGraph graph, PhaseContext context, JavaConstant constant) {
if (constant instanceof HotSpotObjectConstant) {
ConstantReflectionProvider constantReflection = context.getConstantReflection();
ResolvedJavaType type = constantReflection.asJavaType(constant);
if (type != null) {
MetaAccessProvider metaAccess = context.getMetaAccess();
Stamp stamp = StampFactory.objectNonNull(TypeReference.createExactTrusted(metaAccess.lookupJavaType(Class.class)));
if (type instanceof HotSpotResolvedObjectType) {
ConstantNode klass = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), ((HotSpotResolvedObjectType) type).klass(), metaAccess, graph);
ValueNode getClass = graph.unique(new HubGetClassNode(metaAccess, klass));
if (((HotSpotObjectConstant) constant).isCompressed()) {
return HotSpotCompressionNode.compress(getClass, oopEncoding);
} else {
return getClass;
}
} else {
/*
* Primitive classes are more difficult since they don't have a corresponding
* Klass* so get them from Class.TYPE for the java box type.
*/
HotSpotResolvedPrimitiveType primitive = (HotSpotResolvedPrimitiveType) type;
ResolvedJavaType boxingClass = metaAccess.lookupJavaType(primitive.getJavaKind().toBoxedJavaClass());
ConstantNode clazz = ConstantNode.forConstant(context.getConstantReflection().asJavaClass(boxingClass), metaAccess, graph);
HotSpotResolvedJavaField[] a = (HotSpotResolvedJavaField[]) boxingClass.getStaticFields();
HotSpotResolvedJavaField typeField = null;
for (HotSpotResolvedJavaField f : a) {
if (f.getName().equals("TYPE")) {
typeField = f;
break;
}
}
if (typeField == null) {
throw new GraalError("Can't find TYPE field in class");
}
if (oopEncoding != null) {
stamp = HotSpotNarrowOopStamp.compressed((AbstractObjectStamp) stamp, oopEncoding);
}
AddressNode address = graph.unique(new OffsetAddressNode(clazz, ConstantNode.forLong(typeField.offset(), graph)));
ValueNode read = graph.unique(new FloatingReadNode(address, FINAL_LOCATION, null, stamp));
if (oopEncoding == null || ((HotSpotObjectConstant) constant).isCompressed()) {
return read;
} else {
return HotSpotCompressionNode.uncompress(read, oopEncoding);
}
}
}
}
return null;
}
示例15: checkRead
import jdk.vm.ci.meta.MetaAccessProvider; //导入方法依赖的package包/类
private boolean checkRead(JavaKind kind, long displacement, HotSpotResolvedObjectType type, Object object) {
if (type.isArray()) {
ResolvedJavaType componentType = type.getComponentType();
JavaKind componentKind = componentType.getJavaKind();
final int headerSize = getArrayBaseOffset(componentKind);
int sizeOfElement = getArrayIndexScale(componentKind);
int length = Array.getLength(object);
long arrayEnd = headerSize + (sizeOfElement * length);
boolean aligned = ((displacement - headerSize) % sizeOfElement) == 0;
if (displacement < 0 || displacement > (arrayEnd - sizeOfElement) || (kind == JavaKind.Object && !aligned)) {
int index = (int) ((displacement - headerSize) / sizeOfElement);
throw new IllegalArgumentException("Unsafe array access: reading element of kind " + kind +
" at offset " + displacement + " (index ~ " + index + ") in " +
type.toJavaName() + " object of length " + length);
}
} else if (kind != JavaKind.Object) {
long size;
if (object instanceof Class) {
if (oopSizeOffset == 0) {
oopSizeOffset = computeOopSizeOffset(runtime);
}
int wordSize = runtime.getHostJVMCIBackend().getCodeCache().getTarget().wordSize;
size = UNSAFE.getInt(object, oopSizeOffset) * wordSize;
} else {
size = Math.abs(type.instanceSize());
}
int bytesToRead = kind.getByteCount();
if (displacement + bytesToRead > size || displacement < 0) {
throw new IllegalArgumentException("Unsafe access: reading " + bytesToRead + " bytes at offset " + displacement + " in " +
type.toJavaName() + " object of size " + size);
}
} else {
ResolvedJavaField field = type.findInstanceFieldWithOffset(displacement, JavaKind.Object);
if (field == null && object instanceof Class) {
// Read of a static field
MetaAccessProvider metaAccess = runtime.getHostJVMCIBackend().getMetaAccess();
HotSpotResolvedObjectTypeImpl staticFieldsHolder = (HotSpotResolvedObjectTypeImpl) metaAccess.lookupJavaType((Class<?>) object);
field = staticFieldsHolder.findStaticFieldWithOffset(displacement, JavaKind.Object);
}
if (field == null) {
throw new IllegalArgumentException("Unsafe object access: field not found for read of kind Object" +
" at offset " + displacement + " in " + type.toJavaName() + " object");
}
if (field.getJavaKind() != JavaKind.Object) {
throw new IllegalArgumentException("Unsafe object access: field " + field.format("%H.%n:%T") + " not of expected kind Object" +
" at offset " + displacement + " in " + type.toJavaName() + " object");
}
}
return true;
}