Skip to content

Commit cdfd591

Browse files
committed
Use NodeCodeGenerator.isSpecializedNode for checking whether is a node is specialized.
1 parent 2f55d17 commit cdfd591

File tree

1 file changed

+12
-14
lines changed
  • truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser

1 file changed

+12
-14
lines changed

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/parser/NodeParser.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ private void verifyRecommendationWarnings(NodeData node, boolean recommendInline
608608

609609
if (recommendInline && !node.isGenerateInline() && mode == ParseMode.DEFAULT && node.isGenerateCached()) {
610610

611-
AnnotationMirror annotation = getGenerateInlineAnnotation(node.getTemplateType());
611+
AnnotationMirror annotation = getGenerateInlineAnnotation(node.getTemplateType().asType());
612612
if (annotation == null) {
613613

614614
NodeSizeEstimate estimate = computeInlinedSizeEstimate(FlatNodeGenFactory.createInlinedFields(node));
@@ -948,7 +948,7 @@ private boolean initializeInlinable(DSLExpressionResolver resolver, NodeData nod
948948
VariableElement instanceField = getNodeFirstInstanceField(node.getTemplateType());
949949
if (instanceField != null) {
950950
if (emitErrors) {
951-
node.addError(getGenerateInlineAnnotation(node.getTemplateType()), null, "Failed to generate code for @%s: The node must not declare any instance variables. " +
951+
node.addError(getGenerateInlineAnnotation(node.getTemplateType().asType()), null, "Failed to generate code for @%s: The node must not declare any instance variables. " +
952952
"Found instance variable %s.%s. Remove instance variable to resolve this.",
953953
getSimpleName(types.GenerateInline),
954954
getSimpleName(instanceField.getEnclosingElement().asType()), instanceField.getSimpleName().toString());
@@ -1018,16 +1018,16 @@ public static boolean isGenerateUncached(TypeElement templateType) {
10181018
}
10191019

10201020
static boolean isGenerateInline(TypeElement templateType) {
1021-
AnnotationMirror annotation = getGenerateInlineAnnotation(templateType);
1021+
AnnotationMirror annotation = getGenerateInlineAnnotation(templateType.asType());
10221022
Boolean value = Boolean.FALSE;
10231023
if (annotation != null) {
10241024
value = ElementUtils.getAnnotationValue(Boolean.class, annotation, "value");
10251025
}
10261026
return value;
10271027
}
10281028

1029-
static AnnotationMirror getGenerateInlineAnnotation(TypeElement templateType) {
1030-
return findGenerateAnnotation(templateType.asType(), ProcessorContext.getInstance().getTypes().GenerateInline);
1029+
static AnnotationMirror getGenerateInlineAnnotation(TypeMirror type) {
1030+
return findGenerateAnnotation(type, ProcessorContext.getInstance().getTypes().GenerateInline);
10311031
}
10321032

10331033
public static AnnotationMirror findGenerateAnnotation(TypeMirror nodeType, DeclaredType annotationType) {
@@ -4155,7 +4155,7 @@ private boolean forceInlineByDefault(CacheExpression cache) {
41554155
return hasInlineMethod(cache);
41564156
}
41574157
if (ElementUtils.isAssignable(parameterType.asType(), types.Node)) {
4158-
AnnotationMirror inlineAnnotation = getGenerateInlineAnnotation(parameterType);
4158+
AnnotationMirror inlineAnnotation = getGenerateInlineAnnotation(parameterType.asType());
41594159
if (inlineAnnotation != null) {
41604160
return getAnnotationValue(Boolean.class, inlineAnnotation, "value") &&
41614161
getAnnotationValue(Boolean.class, inlineAnnotation, "inlineByDefault");
@@ -4164,16 +4164,14 @@ private boolean forceInlineByDefault(CacheExpression cache) {
41644164
return false;
41654165
}
41664166

4167-
private boolean isGenerateInlineFalse(CacheExpression cache) {
4168-
TypeElement parameterType = ElementUtils.castTypeElement(cache.getParameter().getType());
4169-
if (parameterType == null) {
4167+
private static boolean isGenerateInlineFalse(CacheExpression cache) {
4168+
TypeMirror type = cache.getParameter().getType();
4169+
if (!NodeCodeGenerator.isSpecializedNode(type)) {
41704170
return false;
41714171
}
4172-
if (ElementUtils.isAssignable(parameterType.asType(), types.Node)) {
4173-
AnnotationMirror inlineAnnotation = getGenerateInlineAnnotation(parameterType);
4174-
if (inlineAnnotation != null && getAnnotationValue(Boolean.class, inlineAnnotation, "value") == false) {
4175-
return true;
4176-
}
4172+
AnnotationMirror inlineAnnotation = getGenerateInlineAnnotation(type);
4173+
if (inlineAnnotation != null && getAnnotationValue(Boolean.class, inlineAnnotation, "value") == false) {
4174+
return true;
41774175
}
41784176
return false;
41794177
}

0 commit comments

Comments
 (0)