40
40
*/
41
41
package com .oracle .graal .python .builtins .objects .superobject ;
42
42
43
+ import static com .oracle .graal .python .nodes .SpecialAttributeNames .__SELF_CLASS__ ;
44
+ import static com .oracle .graal .python .nodes .SpecialAttributeNames .__SELF__ ;
45
+ import static com .oracle .graal .python .nodes .SpecialAttributeNames .__THISCLASS__ ;
46
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__GETATTRIBUTE__ ;
47
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__GET__ ;
48
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__INIT__ ;
49
+ import static com .oracle .graal .python .nodes .SpecialMethodNames .__REPR__ ;
50
+
43
51
import java .util .List ;
44
52
45
- import com .oracle .graal .python .PythonLanguage ;
46
53
import com .oracle .graal .python .builtins .Builtin ;
47
54
import com .oracle .graal .python .builtins .CoreFunctions ;
48
55
import com .oracle .graal .python .builtins .PythonBuiltinClassType ;
69
76
import com .oracle .graal .python .builtins .objects .type .TypeNodes .IsSameTypeNode ;
70
77
import com .oracle .graal .python .builtins .objects .type .TypeNodesFactory .IsSameTypeNodeGen ;
71
78
import com .oracle .graal .python .nodes .ErrorMessages ;
79
+ import com .oracle .graal .python .nodes .PNodeWithContext ;
72
80
import com .oracle .graal .python .nodes .SpecialAttributeNames ;
73
81
import com .oracle .graal .python .nodes .argument .ReadIndexedArgumentNode ;
74
82
import com .oracle .graal .python .nodes .attributes .LookupInheritedSlotNode ;
89
97
import com .oracle .graal .python .runtime .exception .PException ;
90
98
import com .oracle .graal .python .runtime .exception .PythonErrorType ;
91
99
import com .oracle .graal .python .util .PythonUtils ;
92
- import com .oracle .truffle .api .Assumption ;
93
100
import com .oracle .truffle .api .CompilerDirectives ;
94
101
import com .oracle .truffle .api .dsl .Cached ;
95
102
import com .oracle .truffle .api .dsl .Fallback ;
98
105
import com .oracle .truffle .api .dsl .Specialization ;
99
106
import com .oracle .truffle .api .frame .VirtualFrame ;
100
107
import com .oracle .truffle .api .library .CachedLibrary ;
101
- import com .oracle .truffle .api .nodes .Node ;
102
108
import com .oracle .truffle .api .profiles .ConditionProfile ;
103
109
104
- import static com .oracle .graal .python .nodes .SpecialAttributeNames .__SELF_CLASS__ ;
105
- import static com .oracle .graal .python .nodes .SpecialAttributeNames .__SELF__ ;
106
- import static com .oracle .graal .python .nodes .SpecialAttributeNames .__THISCLASS__ ;
107
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__GETATTRIBUTE__ ;
108
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__GET__ ;
109
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__INIT__ ;
110
- import static com .oracle .graal .python .nodes .SpecialMethodNames .__REPR__ ;
111
-
112
110
@ CoreFunctions (extendClasses = PythonBuiltinClassType .Super )
113
111
public final class SuperBuiltins extends PythonBuiltins {
114
112
@ Override
115
113
protected List <? extends NodeFactory <? extends PythonBuiltinBaseNode >> getNodeFactories () {
116
114
return SuperBuiltinsFactory .getFactories ();
117
115
}
118
116
119
- abstract static class GetTypeNode extends Node {
120
- final Assumption singleContextAssumption () {
121
- return PythonLanguage .get (this ).singleContextAssumption ;
122
- }
117
+ abstract static class GetTypeNode extends PNodeWithContext {
123
118
124
119
abstract Object execute (SuperObject self );
125
120
126
- @ Specialization (guards = " self == cachedSelf" , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption ()" }, limit = "1" )
121
+ @ Specialization (guards = { "isSingleContext()" , " self == cachedSelf"} , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" }, limit = "1" )
127
122
static Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
128
123
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
129
124
@ Cached ("self.getType()" ) Object type ) {
@@ -136,14 +131,11 @@ static Object uncached(SuperObject self) {
136
131
}
137
132
}
138
133
139
- abstract static class GetObjectTypeNode extends Node {
140
- final Assumption singleContextAssumption () {
141
- return PythonLanguage .get (this ).singleContextAssumption ;
142
- }
134
+ abstract static class GetObjectTypeNode extends PNodeWithContext {
143
135
144
136
abstract Object execute (SuperObject self );
145
137
146
- @ Specialization (guards = " self == cachedSelf" , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption ()" }, limit = "1" )
138
+ @ Specialization (guards = { "isSingleContext()" , " self == cachedSelf"} , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" }, limit = "1" )
147
139
static Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
148
140
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
149
141
@ Cached ("self.getObjectType()" ) Object type ) {
@@ -156,14 +148,11 @@ static Object uncached(SuperObject self) {
156
148
}
157
149
}
158
150
159
- abstract static class GetObjectNode extends Node {
160
- final Assumption singleContextAssumption () {
161
- return PythonLanguage .get (this ).singleContextAssumption ;
162
- }
151
+ abstract static class GetObjectNode extends PNodeWithContext {
163
152
164
153
abstract Object execute (SuperObject self );
165
154
166
- @ Specialization (guards = " self == cachedSelf" , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" , "singleContextAssumption ()" }, limit = "1" )
155
+ @ Specialization (guards = { "isSingleContext()" , " self == cachedSelf"} , assumptions = {"cachedSelf.getNeverReinitializedAssumption()" }, limit = "1" )
167
156
static Object cached (@ SuppressWarnings ("unused" ) SuperObject self ,
168
157
@ SuppressWarnings ("unused" ) @ Cached ("self" ) SuperObject cachedSelf ,
169
158
@ Cached ("self.getObject()" ) Object object ) {
0 commit comments