Skip to content

Commit 1c614c4

Browse files
committed
[GR-67702] No warning at usages of nodes annotated with @GenerateInline(false)
* That annotation means the intention is for that node to not be inlineable.
1 parent 81472e8 commit 1c614c4

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

truffle/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This changelog summarizes major changes between Truffle versions relevant to lan
55
## Version 26.0
66
* GR-65048: Introduced `InternalResource.OS.UNSUPPORTED` and `InternalResource.CPUArchitecture.UNSUPPORTED` to represent unsupported platforms. Execution on unsupported platforms must be explicitly enabled using the system property `-Dpolyglot.engine.allowUnsupportedPlatform=true`. If this property is not set, calls to `OS.getCurrent()` or `CPUArchitecture.getCurrent()` will throw an `IllegalStateException` when running on an unsupported platform. `InternalResource` implementations should handle the unsupported platform and describe possible steps in the error message on how to proceed.
77
* GR-66839: Deprecate `Location#isFinal()` as it always returns false.
8+
* GR-67702: If a node is annotated with `@GenerateInline(false)` it is no longer warned at usages inside an inlined node, that is `@GenerateInline(false)` is considered a conscious decision to make that node not inlined.
89

910
## Version 25.0
1011
* GR-31495 Added ability to specify language and instrument specific options using `Source.Builder.option(String, String)`. Languages may describe available source options by implementing `TruffleLanguage.getSourceOptionDescriptors()` and `TruffleInstrument.getSourceOptionDescriptors()` respectively.

truffle/src/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/GenerateInlineTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,8 @@ public abstract static class ErrorNotInlinableNode extends Node {
17961796

17971797
@Specialization()
17981798
Object doInt(int arg,
1799-
@ExpectError("The cached node type does not support object inlining. Add @GenerateInline on the node type or disable inline using @Cached(inline=false) to resolve this.") @Cached(inline = true) NoInliningNode simpleNode) {
1799+
@ExpectError("The cached node type does not support object inlining. " +
1800+
"Add @GenerateInline or @GenerateInline(false) on the node type or disable inlining using @Cached(inline=false) to resolve this.") @Cached(inline = true) NoInliningNode simpleNode) {
18001801
return "";
18011802
}
18021803

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

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3761,13 +3761,15 @@ private void parseCached(CacheExpression cache, SpecializationData specializatio
37613761
if (declaresInline) {
37623762
cache.addError(cachedAnnotation, getAnnotationValue(cachedAnnotation, "inline"),
37633763
"The cached node type does not support object inlining." + //
3764-
" Add @%s on the node type or disable inline using @%s(inline=false) to resolve this.",
3764+
" Add @%s or @%s(false) on the node type or disable inlining using @%s(inline=false) to resolve this.",
3765+
getSimpleName(types.GenerateInline),
37653766
getSimpleName(types.GenerateInline),
37663767
getSimpleName(types.Cached));
3767-
} else if (node.isGenerateInline()) {
3768+
} else if (node.isGenerateInline() && !isGenerateInlineFalse(cache)) {
37683769
cache.addSuppressableWarning(TruffleSuppressedWarnings.INLINING_RECOMMENDATION,
37693770
"The cached node type does not support object inlining." + //
3770-
" Add @%s on the node type or disable inline using @%s(inline=false) to resolve this.",
3771+
" Add @%s or @%s(false) on the node type or disable inlining using @%s(inline=false) to resolve this.",
3772+
getSimpleName(types.GenerateInline),
37713773
getSimpleName(types.GenerateInline),
37723774
getSimpleName(types.Cached));
37733775
inline = false;
@@ -4162,6 +4164,20 @@ private boolean forceInlineByDefault(CacheExpression cache) {
41624164
return false;
41634165
}
41644166

4167+
private boolean isGenerateInlineFalse(CacheExpression cache) {
4168+
TypeElement parameterType = ElementUtils.castTypeElement(cache.getParameter().getType());
4169+
if (parameterType == null) {
4170+
return false;
4171+
}
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+
}
4177+
}
4178+
return false;
4179+
}
4180+
41654181
private static boolean hasInlineMethod(CacheExpression cache) {
41664182
TypeMirror type = cache.getParameter().getType();
41674183
TypeElement parameterType = ElementUtils.castTypeElement(type);

0 commit comments

Comments
 (0)