public ResolvedJavaMethod lookupJavaConstructor(Constructor<?> reflectionConstructor) {
   try {
     Class<?> holder = reflectionConstructor.getDeclaringClass();
     final int slot = reflectionConstructorSlot.getInt(reflectionConstructor);
     final long metaspaceMethod = runtime.getCompilerToVM().getMetaspaceMethod(holder, slot);
     return HotSpotResolvedJavaMethod.fromMetaspace(metaspaceMethod);
   } catch (IllegalArgumentException | IllegalAccessException e) {
     throw new GraalInternalError(e);
   }
 }
Exemple #2
0
    private static RawItemProfile<ResolvedJavaMethod> getRawMethodProfile(
        HotSpotMethodData data, int position) {
      int profileWidth = config.methodProfileWidth;

      ResolvedJavaMethod[] methods = new ResolvedJavaMethod[profileWidth];
      long[] counts = new long[profileWidth];
      long totalCount = 0;
      int entries = 0;

      for (int i = 0; i < profileWidth; i++) {
        long method = data.readWord(position, getMethodOffset(i));
        if (method != 0) {
          methods[entries] = HotSpotResolvedJavaMethod.fromMetaspace(method);
          long count = data.readUnsignedInt(position, getMethodCountOffset(i));
          totalCount += count;
          counts[entries] = count;

          entries++;
        }
      }

      totalCount += getMethodsNotRecordedExecutionCount(data, position);
      return new RawItemProfile<>(entries, methods, counts, totalCount);
    }