|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. |
| 2 | + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. |
3 | 3 | * Copyright (c) 2013, Regents of the University of California
|
4 | 4 | *
|
5 | 5 | * All rights reserved.
|
|
38 | 38 | import com.oracle.graal.python.builtins.objects.cext.capi.transitions.CApiTransitions;
|
39 | 39 | import com.oracle.graal.python.builtins.objects.list.PList;
|
40 | 40 | import com.oracle.graal.python.builtins.objects.tuple.PTuple;
|
| 41 | +import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode; |
41 | 42 | import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
|
42 | 43 | import com.oracle.graal.python.runtime.GilNode;
|
43 | 44 | import com.oracle.graal.python.runtime.PythonContext;
|
|
47 | 48 | import com.oracle.truffle.api.dsl.Cached;
|
48 | 49 | import com.oracle.truffle.api.dsl.Fallback;
|
49 | 50 | import com.oracle.truffle.api.dsl.GenerateNodeFactory;
|
| 51 | +import com.oracle.truffle.api.dsl.NodeFactory; |
50 | 52 | import com.oracle.truffle.api.dsl.Specialization;
|
51 | 53 |
|
52 | 54 | @CoreFunctions(defineModule = "gc")
|
53 | 55 | public final class GcModuleBuiltins extends PythonBuiltins {
|
54 | 56 |
|
55 | 57 | @Override
|
56 |
| - protected List<com.oracle.truffle.api.dsl.NodeFactory<? extends PythonBuiltinNode>> getNodeFactories() { |
| 58 | + protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFactories() { |
57 | 59 | return GcModuleBuiltinsFactory.getFactories();
|
58 | 60 | }
|
59 | 61 |
|
@@ -172,11 +174,22 @@ public boolean isTracked(@SuppressWarnings("unused") Object object) {
|
172 | 174 | @GenerateNodeFactory
|
173 | 175 | abstract static class GcGetReferentsNode extends PythonBuiltinNode {
|
174 | 176 | @Specialization
|
175 |
| - static PList getReferents(@SuppressWarnings("unused") Object objects, |
176 |
| - @Cached PythonObjectFactory factory) { |
| 177 | + @TruffleBoundary |
| 178 | + static PList getReferents(@SuppressWarnings("unused") Object objects) { |
177 | 179 | // TODO: this is just a dummy implementation; for native objects, this should actually
|
178 | 180 | // use 'tp_traverse'
|
179 |
| - return factory.createList(); |
| 181 | + return PythonContext.get(null).factory().createList(); |
| 182 | + } |
| 183 | + } |
| 184 | + |
| 185 | + @Builtin(name = "get_referrers", takesVarArgs = true) |
| 186 | + @GenerateNodeFactory |
| 187 | + abstract static class GcGetReferrersNode extends PythonBuiltinNode { |
| 188 | + @Specialization |
| 189 | + @TruffleBoundary |
| 190 | + static PList doGeneric(@SuppressWarnings("unused") Object objects) { |
| 191 | + // dummy implementation |
| 192 | + return PythonContext.get(null).factory().createList(); |
180 | 193 | }
|
181 | 194 | }
|
182 | 195 | }
|
0 commit comments