本文整理匯總了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);
}
}
}
示例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)"));
}
}
}
示例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);
}
示例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));
}
示例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"));
}
}
}
示例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;
}
示例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++;
}
}
示例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)");
}
示例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)";
}
}
示例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();
}
}
示例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;
}
示例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)") + "." : ".");
}
}
示例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)"));
}
}
}
示例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)"));
}
}
}
示例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;
}