Skip to content

Commit 005bbd0

Browse files
committed
Revert "Avoid JNI upcall for ctx_Dup"
This reverts commit 95898f3.
1 parent 34b4c6a commit 005bbd0

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

graalpython/com.oracle.graal.python.jni/src/hpy_jni.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,7 @@ static void ctx_Close_jni(HPyContext *ctx, HPy h) {
251251
}
252252

253253
static HPy ctx_Dup_jni(HPyContext *ctx, HPy h) {
254-
jobject hpyContext = CONTEXT_INSTANCE(ctx);
255-
if (unclosedHandleTop > 0) {
256-
jobjectArray hpy_handles = (jobjectArray)(*jniEnv)->GetObjectField(jniEnv, hpyContext, jniField_hpyHandleTable);
257-
if (hpy_handles == NULL) {
258-
LOGS("hpy handle table is NULL")
259-
return HPy_NULL;
260-
}
261-
262-
uint64_t recycled = toBits(unclosedHandles[--unclosedHandleTop]);
263-
assert(recycled < INT32_MAX);
264-
uint64_t h_bits = toBits(h);
265-
assert(h_bits < INT32_MAX);
266-
jobject element = (*jniEnv)->GetObjectArrayElement(jniEnv, hpy_handles, (jsize)h_bits);
267-
(*jniEnv)->SetObjectArrayElement(jniEnv, hpy_handles, (jsize)recycled, element);
268-
dup_data_pointer(ctx, h_bits, recycled);
269-
return toPtr(boxHandle(recycled));
270-
}
271-
return DO_UPCALL_HPY(hpyContext, Dup, HPY_UP(h));
254+
return DO_UPCALL_HPY(CONTEXT_INSTANCE(ctx), Dup, HPY_UP(h));
272255
}
273256

274257
static int ctx_NumberCheck_jni(HPyContext *ctx, HPy obj) {

graalpython/com.oracle.graal.python.jni/src/hpy_native_cache.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,4 @@ load_global_native_data_pointer(HPyContext *ctx, uint64_t g_bits, uint64_t h_bit
9797
space[HANDLE_DATAPTR_INDEX(h_bits)] = g_data_ptr;
9898
}
9999

100-
/*
101-
* Duplicates the native data pointer of an handle in the native cache.
102-
*/
103-
static inline void
104-
dup_data_pointer(HPyContext *ctx, uint64_t h_from, uint64_t h_to) {
105-
void** space = (void**)ctx->_private;
106-
space[HANDLE_DATAPTR_INDEX(h_to)] = space[HANDLE_DATAPTR_INDEX(h_from)];
107-
LOG("%llu %llu %p", h_from, h_to, space[HANDLE_DATAPTR_INDEX(h_from)])
108-
}
109-
110100
#endif /* SRC_HPY_NATIVE_CACHE_H_ */

0 commit comments

Comments
 (0)