当前位置: 首页>>代码示例>>Java>>正文


Java ResolvedJavaMethod.format方法代码示例

本文整理汇总了Java中jdk.vm.ci.meta.ResolvedJavaMethod.format方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvedJavaMethod.format方法的具体用法?Java ResolvedJavaMethod.format怎么用?Java ResolvedJavaMethod.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.vm.ci.meta.ResolvedJavaMethod的用法示例。


在下文中一共展示了ResolvedJavaMethod.format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkForRequestedCrash

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
/**
 * Checks whether the {@link GraalCompilerOptions#CrashAt} option indicates that the compilation
 * of {@code graph} should result in an exception.
 *
 * @param graph a graph currently being compiled
 * @throws RuntimeException if the value of {@link GraalCompilerOptions#CrashAt} matches
 *             {@code graph.method()} or {@code graph.name}
 */
private static void checkForRequestedCrash(StructuredGraph graph) {
    String methodPattern = GraalCompilerOptions.CrashAt.getValue(graph.getOptions());
    if (methodPattern != null) {
        String crashLabel = null;
        if (graph.name != null && graph.name.contains(methodPattern)) {
            crashLabel = graph.name;
        }
        if (crashLabel == null) {
            ResolvedJavaMethod method = graph.method();
            MethodFilter[] filters = MethodFilter.parse(methodPattern);
            for (MethodFilter filter : filters) {
                if (filter.matches(method)) {
                    crashLabel = method.format("%H.%n(%p)");
                }
            }
        }
        if (crashLabel != null) {
            throw new RuntimeException("Forced crash after compiling " + crashLabel);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:GraalCompiler.java

示例2: notifyNotInlined

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
public void notifyNotInlined(GraphBuilderContext b, ResolvedJavaMethod method, Invoke invoke) {
    if (b.parsingIntrinsic()) {
        IntrinsicContext intrinsic = b.getIntrinsic();
        if (!intrinsic.isCallToOriginal(method)) {
            if (hasGeneratedInvocationPluginAnnotation(method)) {
                throw new GraalError("%s should have been handled by a %s", method.format("%H.%n(%p)"), GeneratedInvocationPlugin.class.getSimpleName());
            }
            if (hasGenericInvocationPluginAnnotation(method)) {
                throw new GraalError("%s should have been handled by %s", method.format("%H.%n(%p)"), WordOperationPlugin.class.getSimpleName());
            }

            throw new GraalError("All non-recursive calls in the intrinsic %s must be inlined or intrinsified: found call to %s",
                            intrinsic.getIntrinsicMethod().format("%H.%n(%p)"), method.format("%h.%n(%p)"));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:ReplacementsImpl.java

示例3: checkInjectedArgument

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:GeneratedInvocationPlugin.java

示例4: generate

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
public void generate(NodeLIRBuilderTool gen) {
    String whereString;
    if (stateBefore() != null) {
        String nl = CodeUtil.NEW_LINE;
        StringBuilder sb = new StringBuilder("in compiled code associated with frame state:");
        FrameState fs = stateBefore();
        while (fs != null) {
            Bytecode.appendLocation(sb.append(nl).append("\t"), fs.getCode(), fs.bci);
            fs = fs.outerFrameState();
        }
        whereString = sb.toString();
    } else {
        ResolvedJavaMethod method = graph().method();
        whereString = "in compiled code for " + (method == null ? graph().toString() : method.format("%H.%n(%p)"));
    }

    LIRKind wordKind = gen.getLIRGeneratorTool().getLIRKind(StampFactory.pointer());
    Value whereArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(whereString));
    Value formatArg = gen.getLIRGeneratorTool().emitConstant(wordKind, new CStringConstant(format));

    ForeignCallLinkage linkage = gen.getLIRGeneratorTool().getForeignCalls().lookupForeignCall(VM_ERROR);
    gen.getLIRGeneratorTool().emitForeignCall(linkage, null, whereArg, formatArg, gen.operand(value));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:VMErrorNode.java

示例5: verifyFormatCall

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
/**
 * Checks that a given call is not to {@link String#format(String, Object...)} or
 * {@link String#format(java.util.Locale, String, Object...)}.
 */
private static void verifyFormatCall(StructuredGraph callerGraph, ResolvedJavaMethod verifiedCallee, ResolvedJavaType stringType, ResolvedJavaMethod callee, int bci, int argIdx,
                int varArgsElementIndex) {
    if (callee.getDeclaringClass().equals(stringType) && callee.getSignature().getReturnType(callee.getDeclaringClass()).equals(stringType)) {
        StackTraceElement e = callerGraph.method().asStackTraceElement(bci);
        if (varArgsElementIndex >= 0) {
            throw new VerificationError(
                            "In %s: element %d of parameter %d of call to %s is a call to String.format() which is redundant (%s does formatting) and forces unnecessary eager evaluation.",
                            e, varArgsElementIndex, argIdx, verifiedCallee.format("%H.%n(%p)"), verifiedCallee.format("%h.%n"));
        } else {
            throw new VerificationError("In %s: parameter %d of call to %s is a call to String.format() which is redundant (%s does formatting) and forces unnecessary eager evaluation.", e,
                            argIdx,
                            verifiedCallee.format("%H.%n(%p)"), verifiedCallee.format("%h.%n"));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:VerifyDebugUsage.java

示例6: verify

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
    final ResolvedJavaType bailoutType = context.getMetaAccess().lookupJavaType(BailoutException.class);
    ResolvedJavaMethod caller = graph.method();
    String holderQualified = caller.format("%H");
    String holderUnqualified = caller.format("%h");
    String packageName = holderQualified.substring(0, holderQualified.length() - holderUnqualified.length() - 1);
    if (!matchesPrefix(packageName)) {
        for (MethodCallTargetNode t : graph.getNodes(MethodCallTargetNode.TYPE)) {
            ResolvedJavaMethod callee = t.targetMethod();
            if (callee.getDeclaringClass().equals(bailoutType)) {
                // we only allow the getter
                if (!callee.getName().equals("isPermanent")) {
                    throw new VerificationError("Call to %s at callsite %s is prohibited. Consider using %s for permanent bailouts or %s for retryables.", callee.format("%H.%n(%p)"),
                                    caller.format("%H.%n(%p)"), PermanentBailoutException.class.getName(),
                                    RetryableBailoutException.class.getName());
                }
            }
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:VerifyBailoutUsage.java

示例7: verifyVirtualizableEffectArguments

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
private static void verifyVirtualizableEffectArguments(ResolvedJavaType constantNodeType, ResolvedJavaMethod caller, ResolvedJavaMethod callee, int bciCaller,
                NodeInputList<? extends Node> arguments, int startIdx) {
    /*
     * Virtualizable.virtualize should never apply effects on the graph during the execution of
     * the call as the handling of loops during pea might be speculative and does not hold. We
     * should only allow nodes changing the graph that do no harm like constants.
     */
    int i = 0;
    for (Node arg : arguments) {
        if (i >= startIdx) {
            Stamp argStamp = ((ValueNode) arg).stamp();
            if (argStamp instanceof ObjectStamp) {
                ObjectStamp objectStamp = (ObjectStamp) argStamp;
                ResolvedJavaType argStampType = objectStamp.type();
                if (!(argStampType.equals(constantNodeType))) {
                    StackTraceElement e = caller.asStackTraceElement(bciCaller);
                    throw new VerificationError("%s:Parameter %d in call to %s (which has effects on the graph) is not a " +
                                    "constant and thus not safe to apply during speculative virtualization.", e, i, callee.format("%H.%n(%p)"));
                }
            }
        }
        i++;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:VerifyVirtualizableUsage.java

示例8: getCompilationUnitName

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
protected static <T extends CompilationResult> String getCompilationUnitName(StructuredGraph graph, T compilationResult) {
    if (compilationResult != null && compilationResult.getName() != null) {
        return compilationResult.getName();
    }
    ResolvedJavaMethod method = graph.method();
    if (method == null) {
        return "<unknown>";
    }
    return method.format("%H.%n(%p)");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:11,代码来源:GraalCompiler.java

示例9: methodName

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
private static String methodName(ResolvedJavaMethod method, Invoke invoke) {
    if (invoke != null && invoke.stateAfter() != null) {
        return methodName(invoke.stateAfter(), invoke.bci()) + ": " + method.format("%H.%n(%p):%r") + " (" + method.getCodeSize() + " bytes)";
    } else {
        return method.format("%H.%n(%p):%r") + " (" + method.getCodeSize() + " bytes)";
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:InliningUtil.java

示例10: toString

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
public String toString() {
    if (isRoot()) {
        return "<root>";
    }
    CallTargetNode callTarget = callee.invoke().callTarget();
    if (callTarget instanceof MethodCallTargetNode) {
        ResolvedJavaMethod calleeMethod = ((MethodCallTargetNode) callTarget).targetMethod();
        return calleeMethod.format("Invoke#%H.%n(%p)");
    } else {
        return "Invoke#" + callTarget.targetName();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:MethodInvocation.java

示例11: raiseInvalidFrameStateError

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
protected void raiseInvalidFrameStateError(FrameState state) throws GraalGraphError {
    // This is a hard error since an incorrect state could crash hotspot
    NodeSourcePosition sourcePosition = state.getNodeSourcePosition();
    List<String> context = new ArrayList<>();
    ResolvedJavaMethod replacementMethodWithProblematicSideEffect = null;
    if (sourcePosition != null) {
        NodeSourcePosition pos = sourcePosition;
        while (pos != null) {
            StringBuilder sb = new StringBuilder("parsing ");
            ResolvedJavaMethod method = pos.getMethod();
            MetaUtil.appendLocation(sb, method, pos.getBCI());
            if (method.getAnnotation(MethodSubstitution.class) != null ||
                            method.getAnnotation(Snippet.class) != null) {
                replacementMethodWithProblematicSideEffect = method;
            }
            context.add(sb.toString());
            pos = pos.getCaller();
        }
    }
    String message = "Invalid frame state " + state;
    if (replacementMethodWithProblematicSideEffect != null) {
        message += " associated with a side effect in " + replacementMethodWithProblematicSideEffect.format("%H.%n(%p)") + " at a position that cannot be deoptimized to";
    }
    GraalGraphError error = new GraalGraphError(message);
    for (String c : context) {
        error.addContext(c);
    }
    throw error;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:HotSpotDebugInfoBuilder.java

示例12: phaseFulfillsSizeContract

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
public static void phaseFulfillsSizeContract(StructuredGraph graph, int codeSizeBefore, int codeSizeAfter, PhaseSizeContract contract) {
    sizeVerificationCount.increment(graph.getDebug());
    final double codeSizeIncrease = contract.codeSizeIncrease();
    final double graphSizeDelta = codeSizeBefore * DELTA;
    if (deltaCompare(codeSizeAfter, codeSizeBefore * codeSizeIncrease, graphSizeDelta) > 0) {
        ResolvedJavaMethod method = graph.method();
        double increase = (double) codeSizeAfter / (double) codeSizeBefore;
        throw new VerificationError("Phase %s expects to increase code size by at most a factor of %.2f but an increase of %.2f was seen (code size before: %d, after: %d)%s",
                        contract.contractorName(), codeSizeIncrease, increase, codeSizeBefore, codeSizeAfter,
                        method != null ? " when compiling method " + method.format("%H.%n(%p)") + "." : ".");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:NodeCostUtil.java

示例13: verifyStringConcat

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
/**
 * Checks that a given call is not to {@link StringBuffer#toString()} or
 * {@link StringBuilder#toString()}.
 */
private static void verifyStringConcat(StructuredGraph callerGraph, ResolvedJavaMethod verifiedCallee, int bci, int argIdx, int varArgsElementIndex, ResolvedJavaMethod callee) {
    if (callee.getDeclaringClass().getName().equals("Ljava/lang/StringBuilder;") || callee.getDeclaringClass().getName().equals("Ljava/lang/StringBuffer;")) {
        StackTraceElement e = callerGraph.method().asStackTraceElement(bci);
        if (varArgsElementIndex >= 0) {
            throw new VerificationError(
                            "In %s: element %d of parameter %d of call to %s appears to be a String concatenation expression.%n", e, varArgsElementIndex, argIdx,
                            verifiedCallee.format("%H.%n(%p)"));
        } else {
            throw new VerificationError(
                            "In %s: parameter %d of call to %s appears to be a String concatenation expression.", e, argIdx, verifiedCallee.format("%H.%n(%p)"));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:VerifyDebugUsage.java

示例14: verifyToStringCall

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
/**
 * Checks that a given call is not to {@link Object#toString()}.
 */
private static void verifyToStringCall(StructuredGraph callerGraph, ResolvedJavaMethod verifiedCallee, ResolvedJavaType stringType, ResolvedJavaMethod callee, int bci, int argIdx,
                int varArgsElementIndex) {
    if (callee.getSignature().getParameterCount(false) == 0 && callee.getSignature().getReturnType(callee.getDeclaringClass()).equals(stringType)) {
        StackTraceElement e = callerGraph.method().asStackTraceElement(bci);
        if (varArgsElementIndex >= 0) {
            throw new VerificationError(
                            "In %s: element %d of parameter %d of call to %s is a call to toString() which is redundant (the callee will do it) and forces unnecessary eager evaluation.",
                            e, varArgsElementIndex, argIdx, verifiedCallee.format("%H.%n(%p)"));
        } else {
            throw new VerificationError("In %s: parameter %d of call to %s is a call to toString() which is redundant (the callee will do it) and forces unnecessary eager evaluation.", e, argIdx,
                            verifiedCallee.format("%H.%n(%p)"));
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:VerifyDebugUsage.java

示例15: verify

import jdk.vm.ci.meta.ResolvedJavaMethod; //导入方法依赖的package包/类
@Override
protected boolean verify(StructuredGraph graph, PhaseContext context) {
    final ResolvedJavaType[] bailoutType = new ResolvedJavaType[FORBIDDEN_INSTANCE_OF_CHECKS.length];
    for (int i = 0; i < FORBIDDEN_INSTANCE_OF_CHECKS.length; i++) {
        bailoutType[i] = context.getMetaAccess().lookupJavaType(FORBIDDEN_INSTANCE_OF_CHECKS[i]);
    }
    ResolvedJavaMethod method = graph.method();
    ResolvedJavaType declaringClass = method.getDeclaringClass();
    if (!isTrustedInterface(declaringClass, context.getMetaAccess())) {

        for (InstanceOfNode io : graph.getNodes().filter(InstanceOfNode.class)) {
            ResolvedJavaType type = io.type().getType();
            for (ResolvedJavaType forbiddenType : bailoutType) {
                if (forbiddenType.equals(type)) {
                    String name = forbiddenType.getUnqualifiedName();
                    // strip outer class
                    ResolvedJavaType enclosingType = forbiddenType.getEnclosingType();
                    if (enclosingType != null) {
                        name = name.substring(enclosingType.getUnqualifiedName().length() + "$".length());
                    }
                    throw new VerificationError("Using `op instanceof %s` is not allowed. Use `%s.is%s(op)` instead. (in %s)", name, name, name, method.format("%H.%n(%p)"));
                }
            }
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:VerifyInstanceOfUsage.java


注:本文中的jdk.vm.ci.meta.ResolvedJavaMethod.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。