Skip to content

Commit 6d673d6

Browse files
committed
make PythonObjectFactory final
1 parent 35bfe46 commit 6d673d6

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/object/PythonObjectFactory.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,28 +126,15 @@
126126
import com.oracle.truffle.api.object.DynamicObject;
127127
import com.oracle.truffle.api.object.Shape;
128128

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;
138131

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() {
148133
}
149134

150-
public abstract PythonCore getCore();
135+
public static PythonObjectFactory create() {
136+
return new PythonObjectFactory();
137+
}
151138

152139
private PythonClass lookupClass(PythonBuiltinClassType type) {
153140
return getCore().lookupType(type);
@@ -158,6 +145,19 @@ public final <T> T trace(T allocatedObject) {
158145
return allocatedObject;
159146
}
160147

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+
161161
/*
162162
* Python objects
163163
*/

0 commit comments

Comments
 (0)