Skip to content

Commit 1d613fb

Browse files
committed
Migrate ObSizeNode to new context ref API
1 parent 1106f8d commit 1d613fb

File tree

1 file changed

+5
-7
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+5
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CExtNodes.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,8 +3168,7 @@ static Assumption getHandleValidAssumption(PythonNativeWrapper nativeWrapper) {
31683168
* any PyVarObject usually returns the number of contained elements.
31693169
*/
31703170
@GenerateUncached
3171-
@ImportStatic(PythonOptions.class)
3172-
abstract static class ObSizeNode extends Node {
3171+
abstract static class ObSizeNode extends PNodeWithContext {
31733172

31743173
public abstract long execute(Object object);
31753174

@@ -3185,20 +3184,19 @@ long doLong(@SuppressWarnings("unused") long object) {
31853184
int size = 0;
31863185
while (t != 0) {
31873186
++size;
3188-
t >>>= PythonContext.get(this).getCApiContext().getPyLongBitsInDigit();
3187+
t >>>= getContext().getCApiContext().getPyLongBitsInDigit();
31893188
}
31903189
return size * sign;
31913190
}
31923191

31933192
@Specialization
31943193
long doPInt(PInt object) {
3195-
return ((PInt.bitLength(object.abs()) - 1) / PythonContext.get(this).getCApiContext().getPyLongBitsInDigit() + 1) * (object.isNegative() ? -1 : 1);
3194+
return ((PInt.bitLength(object.abs()) - 1) / getContext().getCApiContext().getPyLongBitsInDigit() + 1) * (object.isNegative() ? -1 : 1);
31963195
}
31973196

31983197
@Specialization
3199-
static long doPythonNativeVoidPtr(@SuppressWarnings("unused") PythonNativeVoidPtr object,
3200-
@Shared("context") @CachedContext(PythonLanguage.class) PythonContext context) {
3201-
return ((Long.SIZE - 1) / context.getCApiContext().getPyLongBitsInDigit() + 1);
3198+
long doPythonNativeVoidPtr(@SuppressWarnings("unused") PythonNativeVoidPtr object) {
3199+
return ((Long.SIZE - 1) / getContext().getCApiContext().getPyLongBitsInDigit() + 1);
32023200
}
32033201

32043202
@Specialization(guards = "isFallback(object)")

0 commit comments

Comments
 (0)