Skip to content

Commit 4de7622

Browse files
committed
Revert changes in HPy cleaner root node
1 parent e19a74f commit 4de7622

File tree

1 file changed

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

1 file changed

+5
-26
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/hpy/GraalHPyContext.java

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ private static final class HPyNativeSpaceCleanerRootNode extends PRootNode {
980980
private static final TruffleLogger LOGGER = PythonLanguage.getLogger(GraalHPyContext.HPyNativeSpaceCleanerRootNode.class);
981981

982982
@Child private PCallHPyFunction callBulkFree;
983-
@Child private InteropLibrary interopLibrary;
984983

985984
HPyNativeSpaceCleanerRootNode(PythonContext context) {
986985
super(context.getLanguage());
@@ -1019,32 +1018,12 @@ public Object execute(VirtualFrame frame) {
10191018
middleTime = System.currentTimeMillis();
10201019
}
10211020

1022-
if (PythonLanguage.get(this).getEngineOption(PythonOptions.HPyBackend) == HPyBackendMode.NFI) {
1023-
NativeSpaceArrayWrapper nativeSpaceArrayWrapper = new NativeSpaceArrayWrapper(handleReferences);
1024-
if (callBulkFree == null) {
1025-
CompilerDirectives.transferToInterpreterAndInvalidate();
1026-
callBulkFree = insert(PCallHPyFunctionNodeGen.create());
1027-
}
1028-
callBulkFree.call(context, GraalHPyNativeSymbol.GRAAL_HPY_BULK_FREE, nativeSpaceArrayWrapper, nativeSpaceArrayWrapper.getArraySize());
1029-
} else {
1030-
if (interopLibrary == null) {
1031-
CompilerDirectives.transferToInterpreterAndInvalidate();
1032-
interopLibrary = insert(InteropLibrary.getFactory().createDispatched(3));
1033-
}
1034-
1035-
for (GraalHPyHandleReference ref : handleReferences) {
1036-
long nativeSpace = (long) ref.getNativeSpace();
1037-
Object destroyFunc = ref.getDestroyFunc();
1038-
if (destroyFunc != null) {
1039-
try {
1040-
interopLibrary.execute(destroyFunc, nativeSpace);
1041-
} catch (UnsupportedMessageException | UnsupportedTypeException | ArityException e) {
1042-
throw CompilerDirectives.shouldNotReachHere();
1043-
}
1044-
}
1045-
unsafe.freeMemory(nativeSpace);
1046-
}
1021+
NativeSpaceArrayWrapper nativeSpaceArrayWrapper = new NativeSpaceArrayWrapper(handleReferences);
1022+
if (callBulkFree == null) {
1023+
CompilerDirectives.transferToInterpreterAndInvalidate();
1024+
callBulkFree = insert(PCallHPyFunctionNodeGen.create());
10471025
}
1026+
callBulkFree.call(context, GraalHPyNativeSymbol.GRAAL_HPY_BULK_FREE, nativeSpaceArrayWrapper, nativeSpaceArrayWrapper.getArraySize());
10481027

10491028
if (loggable) {
10501029
final long countDuration = middleTime - startTime;

0 commit comments

Comments
 (0)