Skip to content

Commit 181a547

Browse files
committed
[GR-40036] The SVM neverPartOfCompilation() check seems not precise enough so need to use TruffleBoundary instead
1 parent 431df38 commit 181a547

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/org/truffleruby/language/library/RubyStringLibrary.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*/
1010
package org.truffleruby.language.library;
1111

12-
import com.oracle.truffle.api.CompilerAsserts;
1312
import com.oracle.truffle.api.CompilerDirectives;
1413
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
14+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
1515
import com.oracle.truffle.api.strings.AbstractTruffleString;
1616
import com.oracle.truffle.api.strings.TruffleString;
1717
import org.truffleruby.core.encoding.RubyEncoding;
@@ -202,22 +202,22 @@ static final class Uncached extends RubyStringLibrary {
202202

203203
static final Uncached INSTANCE = new Uncached();
204204

205+
@TruffleBoundary
205206
@Override
206207
public boolean seen(Object object) {
207-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
208208
assert object instanceof RubyString || object instanceof ImmutableRubyString;
209209
return true;
210210
}
211211

212+
@TruffleBoundary
212213
@Override
213214
public boolean isRubyString(Object object) {
214-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
215215
return object instanceof RubyString || object instanceof ImmutableRubyString;
216216
}
217217

218+
@TruffleBoundary
218219
@Override
219220
public AbstractTruffleString getTString(Object object) {
220-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
221221
if (object instanceof RubyString) {
222222
return ((RubyString) object).tstring;
223223
} else if (object instanceof ImmutableRubyString) {
@@ -227,15 +227,15 @@ public AbstractTruffleString getTString(Object object) {
227227
}
228228
}
229229

230+
@TruffleBoundary
230231
@Override
231232
public RubyEncoding profileEncoding(RubyEncoding encoding) {
232-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
233233
return encoding;
234234
}
235235

236+
@TruffleBoundary
236237
@Override
237238
public RubyEncoding getEncoding(Object object) {
238-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
239239
if (object instanceof RubyString) {
240240
return ((RubyString) object).getEncodingUncached();
241241
} else if (object instanceof ImmutableRubyString) {
@@ -245,9 +245,9 @@ public RubyEncoding getEncoding(Object object) {
245245
}
246246
}
247247

248+
@TruffleBoundary
248249
@Override
249250
public int byteLength(Object object) {
250-
CompilerAsserts.neverPartOfCompilation("Only behind @TruffleBoundary");
251251
return getTString(object).byteLength(getTEncoding(object));
252252
}
253253
}

0 commit comments

Comments
 (0)