Skip to content

Commit f424807

Browse files
fangererqunaibit
authored andcommitted
Disable bulking of decref notification (temporarily)
1 parent 36e952e commit f424807

File tree

2 files changed

+9
-3
lines changed
  • graalpython
    • com.oracle.graal.python.cext/src
    • com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/transitions

2 files changed

+9
-3
lines changed

graalpython/com.oracle.graal.python.cext/src/object.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2664,14 +2664,17 @@ PyTruffle_SET_SIZE(PyVarObject *a, Py_ssize_t b)
26642664
}
26652665
}
26662666

2667-
#define DEFERRED_NOTIFY_SIZE 16
2667+
#define DEFERRED_NOTIFY_SIZE 1
2668+
#if DEFERRED_NOTIFY_SIZE > 1
26682669
static PyObject *deferred_notify_ops[DEFERRED_NOTIFY_SIZE];
26692670
static int deferred_notify_cur = 0;
2671+
#endif
26702672

26712673
static inline void
26722674
_decref_notify(const PyObject *op, const Py_ssize_t updated_refcnt)
26732675
{
26742676
if (points_to_py_handle_space(op) && updated_refcnt <= MANAGED_REFCNT) {
2677+
#if DEFERRED_NOTIFY_SIZE > 1
26752678
if (PyTruffle_Debug_CAPI() && updated_refcnt < MANAGED_REFCNT) {
26762679
Py_FatalError("Refcount of native stub fell below MANAGED_REFCNT");
26772680
}
@@ -2681,6 +2684,9 @@ _decref_notify(const PyObject *op, const Py_ssize_t updated_refcnt)
26812684
deferred_notify_cur = 0;
26822685
GraalPyTruffle_BulkNotifyRefCount(deferred_notify_ops, DEFERRED_NOTIFY_SIZE);
26832686
}
2687+
#else
2688+
GraalPyTruffle_BulkNotifyRefCount(&op, 1);
2689+
#endif
26842690
}
26852691
}
26862692

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,11 +1839,11 @@ static PythonNativeWrapper doGeneric(Node inliningTarget, long pointer, boolean
18391839
int idx = readI32Node.read(HandlePointerConverter.pointerToStub(pointer), CFields.GraalPyObject__handle_table_index);
18401840
PythonObjectReference reference = nativeStubLookupGet(nativeContext, pointer, idx);
18411841
PythonNativeWrapper wrapper;
1842-
if (reference == null) {
1842+
if (strict && reference == null) {
18431843
CompilerDirectives.transferToInterpreterAndInvalidate();
18441844
throw CompilerDirectives.shouldNotReachHere("reference was freed: " + Long.toHexString(pointer));
18451845
}
1846-
wrapper = reference.get();
1846+
wrapper = reference == null ? null : reference.get();
18471847
if (strict && wrapper == null) {
18481848
CompilerDirectives.transferToInterpreterAndInvalidate();
18491849
throw CompilerDirectives.shouldNotReachHere("reference was collected: " + Long.toHexString(pointer));

0 commit comments

Comments
 (0)