Skip to content

Commit e24b62d

Browse files
committed
Make @TruffleBoundary more local.
1 parent 67f6056 commit e24b62d

File tree

1 file changed

+15
-10
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list

1 file changed

+15
-10
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/list/ListBuiltins.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -547,18 +547,9 @@ public PNone insertLongIndex(PList list, long index, Object value,
547547
}
548548

549549
@Specialization
550-
@TruffleBoundary
551550
public PNone insertPIntIndex(PList list, PInt index, Object value,
552551
@Cached("createListInsertNode()") ListInsertNode insertNode) {
553-
int where = 0;
554-
BigInteger bigIndex = index.getValue();
555-
if (bigIndex.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) == -1) {
556-
where = 0;
557-
} else if (bigIndex.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
558-
where = Integer.MAX_VALUE;
559-
} else {
560-
where = bigIndex.intValue();
561-
}
552+
int where = normalizePIntForIndex(index);
562553
where = normalizeIndex(where, list.len());
563554
return insertNode.execute(list, where, value);
564555
}
@@ -574,6 +565,20 @@ public PNone insert(PList list, Object i, Object value,
574565
return insertNode.execute(list, indexValue, value);
575566
}
576567

568+
@TruffleBoundary
569+
private static int normalizePIntForIndex(PInt index) {
570+
int where = 0;
571+
BigInteger bigIndex = index.getValue();
572+
if (bigIndex.compareTo(BigInteger.valueOf(Integer.MIN_VALUE)) == -1) {
573+
where = 0;
574+
} else if (bigIndex.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
575+
where = Integer.MAX_VALUE;
576+
} else {
577+
where = bigIndex.intValue();
578+
}
579+
return where;
580+
}
581+
577582
private static int normalizeIndex(int index, int len) {
578583
int idx = index;
579584
if (idx < 0) {

0 commit comments

Comments
 (0)