37
38 public ResolvedJavaMethod getRootMethod() {
39 return rootMethod;
40 }
41
42 public static MethodMetricsRootScopeInfo create(ResolvedJavaMethod rootMethod) {
43 return new MethodMetricsRootScopeInfo(rootMethod);
44 }
45
46 /**
47 * Creates and returns a {@link org.graalvm.compiler.debug.Debug.Scope scope} iff there is no
48 * existing {@linkplain org.graalvm.compiler.debug.internal.DebugScope.ExtraInfo extraInfo}
49 * object of type {@link MethodMetricsRootScopeInfo} present in the current {@link DebugScope
50 * scope}.
51 *
52 * @param method
53 * @return a new {@link org.graalvm.compiler.debug.Debug.Scope scope} or {@code null} iff there
54 * is already an existing one on the scope
55 */
56 public static Debug.Scope createRootScopeIfAbsent(ResolvedJavaMethod method) {
57 /*
58 * if the current compilation is not triggered from JVMCI we need a valid context root
59 * method for method metrics
60 */
61 return DebugScope.getInstance().getExtraInfo() instanceof MethodMetricsRootScopeInfo ? null : Debug.methodMetricsScope("GraalCompilerRoot", MethodMetricsRootScopeInfo.create(method), true);
62 }
63
64 }
|
37
38 public ResolvedJavaMethod getRootMethod() {
39 return rootMethod;
40 }
41
42 public static MethodMetricsRootScopeInfo create(ResolvedJavaMethod rootMethod) {
43 return new MethodMetricsRootScopeInfo(rootMethod);
44 }
45
46 /**
47 * Creates and returns a {@link org.graalvm.compiler.debug.Debug.Scope scope} iff there is no
48 * existing {@linkplain org.graalvm.compiler.debug.internal.DebugScope.ExtraInfo extraInfo}
49 * object of type {@link MethodMetricsRootScopeInfo} present in the current {@link DebugScope
50 * scope}.
51 *
52 * @param method
53 * @return a new {@link org.graalvm.compiler.debug.Debug.Scope scope} or {@code null} iff there
54 * is already an existing one on the scope
55 */
56 public static Debug.Scope createRootScopeIfAbsent(ResolvedJavaMethod method) {
57 if (Debug.isEnabled()) {
58 /*
59 * if the current compilation is not triggered from JVMCI we need a valid context root
60 * method for method metrics
61 */
62 return DebugScope.getInstance().getExtraInfo() instanceof MethodMetricsRootScopeInfo ? null
63 : Debug.methodMetricsScope("GraalCompilerRoot", MethodMetricsRootScopeInfo.create(method), true);
64 } else {
65 return null;
66 }
67 }
68
69 }
|