|
12 | 12 | import com.oracle.truffle.api.dsl.GenerateCached;
|
13 | 13 | import com.oracle.truffle.api.dsl.GenerateInline;
|
14 | 14 | import com.oracle.truffle.api.dsl.NeverDefault;
|
| 15 | +import com.oracle.truffle.api.dsl.NonIdempotent; |
15 | 16 | import com.oracle.truffle.api.nodes.Node;
|
16 | 17 | import com.oracle.truffle.api.profiles.InlinedConditionProfile;
|
17 | 18 | import org.truffleruby.cext.ValueWrapper;
|
@@ -52,20 +53,24 @@ static void keepCreatingList(Node node, ValueWrapper object,
|
52 | 53 | }
|
53 | 54 | }
|
54 | 55 |
|
55 |
| - @Specialization(guards = { "stack.hasKeptObjects()", "!stack.hasSingleKeptObject()" }) |
| 56 | + @Specialization(guards = { |
| 57 | + "stack.isPreservedObjectListInitialized()", |
| 58 | + "stack.hasKeptObjects()", |
| 59 | + "!stack.hasSingleKeptObject()" }) |
56 | 60 | @TruffleBoundary
|
57 | 61 | static void keepAddingToList(Node node, ValueWrapper object,
|
58 | 62 | @Bind("getStack(node)") ExtensionCallStack stack) {
|
59 |
| - stack.current.preservedObjects.add(object); |
| 63 | + stack.current.preservedObjectList.add(object); |
60 | 64 | }
|
61 | 65 |
|
62 | 66 | @TruffleBoundary
|
63 | 67 | private static void createKeptList(ValueWrapper object, ExtensionCallStack stack) {
|
64 |
| - stack.current.preservedObjects = new ArrayList<>(); |
65 |
| - stack.current.preservedObjects.add(stack.current.preservedObject); |
66 |
| - stack.current.preservedObjects.add(object); |
| 68 | + stack.current.preservedObjectList = new ArrayList<>(); |
| 69 | + stack.current.preservedObjectList.add(stack.current.preservedObject); |
| 70 | + stack.current.preservedObjectList.add(object); |
67 | 71 | }
|
68 | 72 |
|
| 73 | + @NonIdempotent |
69 | 74 | protected static ExtensionCallStack getStack(Node node) {
|
70 | 75 | return getLanguage(node).getCurrentThread().getCurrentFiber().extensionCallStack;
|
71 | 76 | }
|
|
0 commit comments