|
99 | 99 | import java.util.HashSet;
|
100 | 100 |
|
101 | 101 | import com.oracle.graal.python.PythonLanguage;
|
| 102 | +import com.oracle.graal.python.builtins.modules.WeakRefModuleBuiltins; |
102 | 103 | import com.oracle.graal.python.builtins.objects.function.BuiltinMethodDescriptor;
|
103 | 104 | import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
|
104 | 105 | import com.oracle.graal.python.runtime.PythonContext;
|
@@ -499,6 +500,7 @@ private static class Flags {
|
499 | 500 | // initialized in static constructor
|
500 | 501 | @CompilationFinal private PythonBuiltinClassType type;
|
501 | 502 | @CompilationFinal private PythonBuiltinClassType base;
|
| 503 | + @CompilationFinal private int weaklistoffset; |
502 | 504 |
|
503 | 505 | /**
|
504 | 506 | * @see #redefinesSlot(SpecialMethodSlot)
|
@@ -540,6 +542,7 @@ private static class Flags {
|
540 | 542 | this.isBuiltinWithDict = flags.isBuiltinWithDict;
|
541 | 543 | this.isException = flags == Flags.EXCEPTION;
|
542 | 544 | this.methodsFlags = methodsFlags;
|
| 545 | + this.weaklistoffset = -1; |
543 | 546 | }
|
544 | 547 |
|
545 | 548 | PythonBuiltinClassType(String name, String module) {
|
@@ -610,6 +613,10 @@ public long getMethodsFlags() {
|
610 | 613 | return methodsFlags;
|
611 | 614 | }
|
612 | 615 |
|
| 616 | + public int getWeaklistoffset() { |
| 617 | + return weaklistoffset; |
| 618 | + } |
| 619 | + |
613 | 620 | /**
|
614 | 621 | * Returns {@code true} if this method slot is redefined in Python code during initialization.
|
615 | 622 | * Values of such slots cannot be cached in {@link #specialMethodSlots}, because they are not
|
@@ -860,6 +867,8 @@ public final Shape getInstanceShape(PythonLanguage lang) {
|
860 | 867 | if (type.type == null && type.base != null) {
|
861 | 868 | type.type = type.base.type;
|
862 | 869 | }
|
| 870 | + |
| 871 | + type.weaklistoffset = WeakRefModuleBuiltins.getBuiltinTypeWeaklistoffset(type); |
863 | 872 | }
|
864 | 873 |
|
865 | 874 | // Finally, we set all remaining types to PythonClass.
|
|
0 commit comments