Skip to content

Commit 920b588

Browse files
committed
Have separate weakref checks for managed and native objects
1 parent 39969c5 commit 920b588

File tree

1 file changed

+7
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type

1 file changed

+7
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/type/TypeNodes.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,8 +1275,14 @@ public static boolean executeUncached(Object type) {
12751275
return InstancesOfTypeHaveWeakrefsNodeGen.getUncached().execute(null, type);
12761276
}
12771277

1278+
@Specialization(guards = "!isNativeObject(type)")
1279+
static boolean doManaged(Object type,
1280+
@Cached(inline = false) ReadAttributeFromObjectNode read) {
1281+
return read.execute(type, T___WEAKREF__) != PNone.NO_VALUE;
1282+
}
1283+
12781284
@Specialization
1279-
static boolean doGeneric(Node inliningTarget, Object type,
1285+
static boolean doNative(Node inliningTarget, PythonAbstractNativeObject type,
12801286
@Cached GetWeakListOffsetNode getWeakListOffsetNode) {
12811287
return getWeakListOffsetNode.execute(inliningTarget, type) != 0;
12821288
}

0 commit comments

Comments
 (0)