Skip to content

Commit bda6a81

Browse files
raph-amiardHugoGGuerrier
authored andcommitted
Perf: Add boundaries to get rid of truffle warnings/compilation failures
1 parent 795cb28 commit bda6a81

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

lkql_jit/language/src/main/java/com/adacore/lkql_jit/nodes/expressions/LKQLToBoolean.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.adacore.lkql_jit.runtime.values.LKQLUnit;
1212
import com.adacore.lkql_jit.runtime.values.lists.BaseLKQLList;
1313
import com.adacore.lkql_jit.utils.LKQLTypesHelper;
14+
import com.oracle.truffle.api.CompilerDirectives;
1415
import com.oracle.truffle.api.dsl.Fallback;
1516
import com.oracle.truffle.api.dsl.Specialization;
1617
import com.oracle.truffle.api.nodes.Node;
@@ -49,6 +50,11 @@ protected boolean onLKQLUnit(LKQLUnit unit) {
4950

5051
@Specialization
5152
protected boolean onNode(LangkitSupport.NodeInterface node) {
53+
return checkNode(node);
54+
}
55+
56+
@CompilerDirectives.TruffleBoundary
57+
protected boolean checkNode(LangkitSupport.NodeInterface node) {
5258
return !node.isNone();
5359
}
5460

lkql_jit/language/src/main/java/com/adacore/lkql_jit/runtime/values/LKQLProperty.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class LKQLProperty extends BasicLKQLValue {
3737
// ----- Constructors -----
3838

3939
/** Create a new LKQL property from its name and associated node. */
40+
@CompilerDirectives.TruffleBoundary
4041
public LKQLProperty(final String name, final LangkitSupport.NodeInterface node) {
4142
this.name = name;
4243
this.description = node.getFieldDescription(name);

lkql_jit/language/src/main/java/com/adacore/lkql_jit/runtime/values/lists/BaseLKQLList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ protected BaseLKQLList() {}
4141
*
4242
* @throws InvalidIndexException If the provided index is not in the list bounds.
4343
*/
44+
@CompilerDirectives.TruffleBoundary
4445
public abstract Object get(long i) throws InvalidIndexException;
4546

4647
/** Get the iterator for the list. */
@@ -147,6 +148,7 @@ public boolean isBoolean() {
147148

148149
/** Get the boolean representation of the list. */
149150
@ExportMessage
151+
@CompilerDirectives.TruffleBoundary
150152
public boolean asBoolean() {
151153
try {
152154
this.get(0);

lkql_jit/language/src/main/java/com/adacore/lkql_jit/utils/LKQLTypesHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public static String fromJava(Object obj) {
156156
* @param defaultValue The default value to return.
157157
* @return The string representing the type in the LKQL language.
158158
*/
159+
@CompilerDirectives.TruffleBoundary
159160
public static String fromJava(Object obj, String defaultValue) {
160161
if (LKQLTypeSystemGen.isUnit(obj)) {
161162
return LKQL_UNIT;

0 commit comments

Comments
 (0)