117
117
import com .oracle .truffle .api .TruffleLanguage .ContextReference ;
118
118
import com .oracle .truffle .api .dsl .Cached ;
119
119
import com .oracle .truffle .api .dsl .Fallback ;
120
- import com .oracle .truffle .api .dsl .ImportStatic ;
121
120
import com .oracle .truffle .api .dsl .Specialization ;
122
121
import com .oracle .truffle .api .dsl .TypeSystemReference ;
123
122
import com .oracle .truffle .api .frame .VirtualFrame ;
@@ -1640,20 +1639,19 @@ static MaterializePrimitiveNode[] createMaterializeNodes(int length) {
1640
1639
* Special helper nodes that materializes any primitive that would leak the wrapper if the
1641
1640
* reference is owned by managed code only.
1642
1641
*/
1643
- @ ImportStatic (CApiGuards .class )
1644
1642
@ TypeSystemReference (PythonTypes .class )
1645
1643
abstract static class MaterializePrimitiveNode extends Node {
1646
1644
1647
1645
public abstract Object execute (PythonObjectFactory factory , Object object );
1648
1646
1649
1647
// NOTE: Booleans don't need to be materialized because they are singletons.
1650
1648
1651
- @ Specialization ( guards = "!isSmallInteger(i)" )
1649
+ @ Specialization
1652
1650
static PInt doInteger (PythonObjectFactory factory , int i ) {
1653
1651
return factory .createInt (i );
1654
1652
}
1655
1653
1656
- @ Specialization (guards = "!isSmallLong(l)" , replaces = "doInteger" )
1654
+ @ Specialization (replaces = "doInteger" )
1657
1655
static PInt doLong (PythonObjectFactory factory , long l ) {
1658
1656
return factory .createInt (l );
1659
1657
}
@@ -1674,13 +1672,7 @@ static Object doObject(@SuppressWarnings("unused") PythonObjectFactory factory,
1674
1672
}
1675
1673
1676
1674
static boolean needsMaterialization (Object object ) {
1677
- if (object instanceof Integer ) {
1678
- return !CApiGuards .isSmallInteger ((Integer ) object );
1679
- }
1680
- if (object instanceof Long ) {
1681
- return !CApiGuards .isSmallLong ((Long ) object );
1682
- }
1683
- return PGuards .isDouble (object ) || object instanceof String ;
1675
+ return object instanceof Integer || object instanceof Long || PGuards .isDouble (object ) || object instanceof String ;
1684
1676
}
1685
1677
}
1686
1678
0 commit comments