|
40 | 40 | */
|
41 | 41 | package com.oracle.graal.python.builtins.objects.memoryview;
|
42 | 42 |
|
43 |
| -import static com.oracle.graal.python.builtins.PythonBuiltinClassType.BufferError; |
44 | 43 | import static com.oracle.graal.python.builtins.PythonBuiltinClassType.IndexError;
|
45 | 44 | import static com.oracle.graal.python.builtins.PythonBuiltinClassType.NotImplementedError;
|
46 | 45 | import static com.oracle.graal.python.builtins.PythonBuiltinClassType.OverflowError;
|
@@ -727,34 +726,20 @@ public abstract static class ReleaseNode extends PNodeWithContext {
|
727 | 726 | @Specialization(guards = "self.getReference() == null")
|
728 | 727 | static void releaseSimple(PMemoryView self,
|
729 | 728 | @Shared("raise") @Cached PRaiseNode raiseNode) {
|
730 |
| - checkExports(raiseNode, self); |
| 729 | + self.checkExports(raiseNode); |
731 | 730 | self.setReleased();
|
732 | 731 | }
|
733 | 732 |
|
734 | 733 | @Specialization(guards = {"self.getReference() != null"})
|
735 | 734 | static void releaseNative(PMemoryView self,
|
736 | 735 | @Cached ReleaseBufferNode releaseNode,
|
737 | 736 | @Shared("raise") @Cached PRaiseNode raiseNode) {
|
738 |
| - checkExports(raiseNode, self); |
739 |
| - if (checkShouldReleaseBuffer(self)) { |
| 737 | + self.checkExports(raiseNode); |
| 738 | + if (self.checkShouldReleaseBuffer()) { |
740 | 739 | releaseNode.execute(self.getLifecycleManager());
|
741 | 740 | }
|
742 | 741 | self.setReleased();
|
743 | 742 | }
|
744 |
| - |
745 |
| - private static boolean checkShouldReleaseBuffer(PMemoryView self) { |
746 |
| - if (self.getReference() != null) { |
747 |
| - return self.getReference().getLifecycleManager().decrementExports() == 0; |
748 |
| - } |
749 |
| - return false; |
750 |
| - } |
751 |
| - |
752 |
| - private static void checkExports(PRaiseNode node, PMemoryView self) { |
753 |
| - long exports = self.getExports().get(); |
754 |
| - if (exports > 0) { |
755 |
| - throw node.raise(BufferError, ErrorMessages.MEMORYVIEW_HAS_D_EXPORTED_BUFFERS, exports); |
756 |
| - } |
757 |
| - } |
758 | 743 | }
|
759 | 744 |
|
760 | 745 | @GenerateUncached
|
|
0 commit comments