51
51
import com .oracle .graal .python .runtime .exception .PException ;
52
52
import com .oracle .graal .python .runtime .sequence .PSequence ;
53
53
import com .oracle .graal .python .runtime .sequence .storage .ObjectSequenceStorage ;
54
+ import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
54
55
import com .oracle .truffle .api .dsl .Cached ;
55
56
import com .oracle .truffle .api .dsl .Fallback ;
56
57
import com .oracle .truffle .api .dsl .ImportStatic ;
@@ -63,6 +64,7 @@ public abstract class JoinInternalNode extends PBaseNode {
63
64
public abstract String execute (Object self , Object iterable , PythonClass iterableClass );
64
65
65
66
@ Specialization
67
+ @ TruffleBoundary
66
68
protected String join (String string , String arg , @ SuppressWarnings ("unused" ) PythonClass iterableClass ) {
67
69
if (arg .isEmpty ()) {
68
70
return "" ;
@@ -81,6 +83,7 @@ protected String join(String string, String arg, @SuppressWarnings("unused") Pyt
81
83
}
82
84
83
85
@ Specialization (guards = {"cannotBeOverridden(iterableClass)" , "isObjectStorage(list)" })
86
+ @ TruffleBoundary
84
87
protected String join (String string , PList list , @ SuppressWarnings ("unused" ) PythonClass iterableClass ) {
85
88
if (list .len () == 0 ) {
86
89
return "" ;
@@ -100,6 +103,7 @@ protected String join(String string, PList list, @SuppressWarnings("unused") Pyt
100
103
}
101
104
102
105
@ Specialization (guards = "cannotBeOverridden(iterableClass)" )
106
+ @ TruffleBoundary
103
107
protected String join (String string , PCharArray array , @ SuppressWarnings ("unused" ) PythonClass iterableClass ) {
104
108
if (array .len () == 0 ) {
105
109
return "" ;
@@ -118,6 +122,7 @@ protected String join(String string, PCharArray array, @SuppressWarnings("unused
118
122
}
119
123
120
124
@ Specialization (guards = "cannotBeOverridden(iterableClass)" )
125
+ @ TruffleBoundary
121
126
protected String join (String string , PSequence seq , @ SuppressWarnings ("unused" ) PythonClass iterableClass ) {
122
127
if (seq .len () == 0 ) {
123
128
return "" ;
@@ -145,6 +150,7 @@ private String checkItem(Object item, int pos) {
145
150
}
146
151
147
152
@ Specialization
153
+ @ TruffleBoundary
148
154
protected String join (String string , PythonObject iterable , @ SuppressWarnings ("unused" ) PythonClass iterableClass ,
149
155
@ Cached ("create()" ) GetIteratorNode getIterator ,
150
156
@ Cached ("create()" ) GetNextNode next ,
0 commit comments