|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. |
| 2 | + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. |
3 | 3 | * Copyright (c) 2013, Regents of the University of California |
4 | 4 | * |
5 | 5 | * All rights reserved. |
|
124 | 124 | import com.oracle.graal.python.runtime.sequence.storage.LongSequenceStorage; |
125 | 125 | import com.oracle.graal.python.runtime.sequence.storage.MroSequenceStorage; |
126 | 126 | import com.oracle.graal.python.runtime.sequence.storage.NativeByteSequenceStorage; |
| 127 | +import com.oracle.graal.python.runtime.sequence.storage.NativeIntSequenceStorage; |
127 | 128 | import com.oracle.graal.python.runtime.sequence.storage.NativeObjectSequenceStorage; |
| 129 | +import com.oracle.graal.python.runtime.sequence.storage.NativePrimitiveSequenceStorage; |
128 | 130 | import com.oracle.graal.python.runtime.sequence.storage.NativeSequenceStorage; |
129 | 131 | import com.oracle.graal.python.runtime.sequence.storage.ObjectSequenceStorage; |
130 | 132 | import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage; |
131 | 133 | import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage.StorageType; |
132 | 134 | import com.oracle.graal.python.runtime.sequence.storage.SequenceStorageFactory; |
133 | 135 | import com.oracle.graal.python.runtime.sequence.storage.SequenceStoreException; |
134 | | -import com.oracle.graal.python.runtime.sequence.storage.NativePrimitiveSequenceStorage; |
135 | | -import com.oracle.graal.python.runtime.sequence.storage.NativeIntSequenceStorage; |
136 | 136 | import com.oracle.graal.python.util.BiFunction; |
137 | 137 | import com.oracle.graal.python.util.OverflowException; |
138 | 138 | import com.oracle.graal.python.util.PythonUtils; |
|
167 | 167 | import com.oracle.truffle.api.profiles.InlinedExactClassProfile; |
168 | 168 | import com.oracle.truffle.api.profiles.InlinedLoopConditionProfile; |
169 | 169 | import com.oracle.truffle.api.strings.TruffleString; |
| 170 | + |
170 | 171 | import sun.misc.Unsafe; |
171 | 172 |
|
172 | 173 | public abstract class SequenceStorageNodes { |
@@ -3492,12 +3493,14 @@ public abstract static class SetNativeLenNode extends Node { |
3492 | 3493 | static void doShrink(NativeObjectSequenceStorage s, int len, |
3493 | 3494 | @Bind("this") Node inliningTarget, |
3494 | 3495 | @Cached CStructAccess.ReadPointerNode readNode, |
| 3496 | + @Cached CStructAccess.WritePointerNode writeNode, |
3495 | 3497 | @Cached CExtNodes.XDecRefPointerNode decRefPointerNode) { |
3496 | 3498 | if (len < s.length()) { |
3497 | 3499 | // When shrinking, we need to decref the items that are now past the end |
3498 | 3500 | for (int i = len; i < s.length(); i++) { |
3499 | 3501 | Object elementPointer = readNode.readArrayElement(s.getPtr(), i); |
3500 | 3502 | decRefPointerNode.execute(inliningTarget, elementPointer); |
| 3503 | + writeNode.writeArrayElement(s.getPtr(), i, 0L); |
3501 | 3504 | } |
3502 | 3505 | } |
3503 | 3506 | s.setNewLength(len); |
|
0 commit comments