@@ -1577,31 +1577,29 @@ public abstract static class PrintNode extends PythonBuiltinNode {
1577
1577
@ Specialization
1578
1578
PNone printNoKeywords (VirtualFrame frame , Object [] values , @ SuppressWarnings ("unused" ) PNone sep , @ SuppressWarnings ("unused" ) PNone end , @ SuppressWarnings ("unused" ) PNone file ,
1579
1579
@ SuppressWarnings ("unused" ) PNone flush ,
1580
- @ CachedLibrary (limit = "1" ) PythonObjectLibrary fileLib ,
1581
- @ CachedLibrary (limit = "2" ) PythonObjectLibrary methodLib ,
1580
+ @ CachedLibrary (limit = "3" ) PythonObjectLibrary lib ,
1582
1581
@ CachedLibrary (limit = "3" ) PythonObjectLibrary valueLib ) {
1583
1582
Object stdout = getStdout ();
1584
- return printAllGiven (frame , values , DEFAULT_SEPARATOR , DEFAULT_END , stdout , false , fileLib , methodLib , valueLib );
1583
+ return printAllGiven (frame , values , DEFAULT_SEPARATOR , DEFAULT_END , stdout , false , lib , valueLib );
1585
1584
}
1586
1585
1587
- @ Specialization (guards = {"!isNone(file)" , "!isNoValue(file)" }, limit = "2" )
1586
+ @ Specialization (guards = {"!isNone(file)" , "!isNoValue(file)" })
1588
1587
PNone printAllGiven (VirtualFrame frame , Object [] values , String sep , String end , Object file , boolean flush ,
1589
- @ CachedLibrary ("file" ) PythonObjectLibrary fileLib ,
1590
- @ CachedLibrary (limit = "2" ) PythonObjectLibrary methodLib ,
1588
+ @ CachedLibrary (limit = "3" ) PythonObjectLibrary lib ,
1591
1589
@ CachedLibrary (limit = "3" ) PythonObjectLibrary valueLib ) {
1592
1590
int lastValue = values .length - 1 ;
1593
- Object writeMethod = fileLib .lookupAttributeStrict (file , frame , "write" );
1591
+ Object writeMethod = lib .lookupAttributeStrict (file , frame , "write" );
1594
1592
for (int i = 0 ; i < lastValue ; i ++) {
1595
- methodLib .callObject (writeMethod , frame , valueLib .asPString (values [i ]));
1596
- methodLib .callObject (writeMethod , frame , sep );
1593
+ lib .callObject (writeMethod , frame , valueLib .asPString (values [i ]));
1594
+ lib .callObject (writeMethod , frame , sep );
1597
1595
}
1598
1596
if (lastValue >= 0 ) {
1599
- methodLib .callObject (writeMethod , frame , valueLib .asPString (values [lastValue ]));
1597
+ lib .callObject (writeMethod , frame , valueLib .asPString (values [lastValue ]));
1600
1598
}
1601
- methodLib .callObject (writeMethod , frame , end );
1599
+ lib .callObject (writeMethod , frame , end );
1602
1600
if (flush ) {
1603
- Object flushMethod = fileLib .lookupAttributeStrict (file , frame , "flush" );
1604
- methodLib .callObject (flushMethod , frame );
1601
+ Object flushMethod = lib .lookupAttributeStrict (file , frame , "flush" );
1602
+ lib .callObject (flushMethod , frame );
1605
1603
}
1606
1604
return PNone .NONE ;
1607
1605
}
@@ -1612,8 +1610,7 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
1612
1610
@ Cached CastToJavaStringNode castEnd ,
1613
1611
@ Cached ("createIfTrueNode()" ) CoerceToBooleanNode castFlush ,
1614
1612
@ Cached PRaiseNode raiseNode ,
1615
- @ CachedLibrary (limit = "2" ) PythonObjectLibrary fileLib ,
1616
- @ CachedLibrary (limit = "2" ) PythonObjectLibrary methodLib ,
1613
+ @ CachedLibrary (limit = "4" ) PythonObjectLibrary lib ,
1617
1614
@ CachedLibrary (limit = "3" ) PythonObjectLibrary valueLib ) {
1618
1615
String sep ;
1619
1616
try {
@@ -1641,7 +1638,7 @@ PNone printGeneric(VirtualFrame frame, Object[] values, Object sepIn, Object end
1641
1638
} else {
1642
1639
flush = castFlush .executeBoolean (frame , flushIn );
1643
1640
}
1644
- return printAllGiven (frame , values , sep , end , file , flush , fileLib , methodLib , valueLib );
1641
+ return printAllGiven (frame , values , sep , end , file , flush , lib , valueLib );
1645
1642
}
1646
1643
1647
1644
private Object getStdout () {
0 commit comments