126
126
import com .oracle .truffle .api .object .DynamicObject ;
127
127
import com .oracle .truffle .api .object .Shape ;
128
128
129
- public abstract class PythonObjectFactory extends Node {
130
- public static PythonObjectFactory create () {
131
- return new PythonObjectFactory () {
132
- @ CompilationFinal private ContextReference <PythonContext > contextRef ;
133
-
134
- @ Override
135
- public NodeCost getCost () {
136
- return contextRef == null ? NodeCost .UNINITIALIZED : NodeCost .MONOMORPHIC ;
137
- }
129
+ public final class PythonObjectFactory extends Node {
130
+ @ CompilationFinal private ContextReference <PythonContext > contextRef ;
138
131
139
- @ Override
140
- public PythonCore getCore () {
141
- if (contextRef == null ) {
142
- CompilerDirectives .transferToInterpreterAndInvalidate ();
143
- contextRef = PythonLanguage .getContextRef ();
144
- }
145
- return contextRef .get ().getCore ();
146
- }
147
- };
132
+ private PythonObjectFactory () {
148
133
}
149
134
150
- public abstract PythonCore getCore ();
135
+ public static PythonObjectFactory create () {
136
+ return new PythonObjectFactory ();
137
+ }
151
138
152
139
private PythonClass lookupClass (PythonBuiltinClassType type ) {
153
140
return getCore ().lookupType (type );
@@ -158,6 +145,19 @@ public final <T> T trace(T allocatedObject) {
158
145
return allocatedObject ;
159
146
}
160
147
148
+ @ Override
149
+ public NodeCost getCost () {
150
+ return contextRef == null ? NodeCost .UNINITIALIZED : NodeCost .MONOMORPHIC ;
151
+ }
152
+
153
+ public PythonCore getCore () {
154
+ if (contextRef == null ) {
155
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
156
+ contextRef = PythonLanguage .getContextRef ();
157
+ }
158
+ return contextRef .get ().getCore ();
159
+ }
160
+
161
161
/*
162
162
* Python objects
163
163
*/
0 commit comments