private static JavaType asJavaType(
     Class<?> type, MetaAccessProvider metaAccess, CodeCacheProvider codeCache) {
   if (WordBase.class.isAssignableFrom(type)) {
     return metaAccess.lookupJavaType(codeCache.getTarget().wordJavaKind.toJavaClass());
   } else {
     return metaAccess.lookupJavaType(type);
   }
 }
Пример #2
0
 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);
 }
 /**
  * Gets a {@link Classfile} created by parsing the class file bytes for {@code c}.
  *
  * @throws NoClassDefFoundError if the class file cannot be found
  */
 private synchronized Classfile getClassfile(Class<?> c) {
   assert !c.isPrimitive() && !c.isArray() : c;
   Classfile classfile = classfiles.get(c);
   if (classfile == null) {
     try {
       ResolvedJavaType type = metaAccess.lookupJavaType(c);
       InputStream in = getClassfileAsStream(c);
       if (in != null) {
         DataInputStream stream = new DataInputStream(in);
         classfile = new Classfile(type, stream, this);
         classfiles.put(c, classfile);
         return classfile;
       }
       throw new NoClassDefFoundError(c.getName());
     } catch (IOException e) {
       throw (NoClassDefFoundError) new NoClassDefFoundError(c.getName()).initCause(e);
     }
   }
   return classfile;
 }