Skip to content

Commit 54facbb

Browse files
committed
make methods static where possible
1 parent 1ba71ed commit 54facbb

17 files changed

+68
-67
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextBytesBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int fallback(Object obj) {
149149
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject, PyObject}, call = Ignored)
150150
abstract static class PyTruffleBytes_Concat extends CApiBinaryBuiltinNode {
151151
@Specialization
152-
Object concat(PBytes original, Object newPart,
152+
static Object concat(PBytes original, Object newPart,
153153
@Cached BytesBuiltins.AddNode addNode) {
154154
return addNode.execute(null, original, newPart);
155155
}
@@ -163,7 +163,7 @@ Object fallback(Object original, @SuppressWarnings("unused") Object newPart) {
163163
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject, PyObject}, call = Direct)
164164
abstract static class _PyBytes_Join extends CApiBinaryBuiltinNode {
165165
@Specialization
166-
Object join(PBytes original, Object newPart,
166+
static Object join(PBytes original, Object newPart,
167167
@Cached BytesBuiltins.JoinNode joinNode) {
168168
return joinNode.execute(null, original, newPart);
169169
}
@@ -177,7 +177,7 @@ Object fallback(Object original, @SuppressWarnings("unused") Object newPart) {
177177
@CApiBuiltin(ret = PyObjectTransfer, args = {ConstCharPtrAsTruffleString, PyObject}, call = Ignored)
178178
abstract static class PyTruffleBytes_FromFormat extends CApiBinaryBuiltinNode {
179179
@Specialization
180-
Object fromFormat(TruffleString fmt, Object args,
180+
static Object fromFormat(TruffleString fmt, Object args,
181181
@Cached ModNode modeNode,
182182
@Cached EncodeNode encodeNode) {
183183
Object formated = modeNode.execute(null, fmt, args);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextCEvalBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ abstract static class PyEval_SaveThread extends CApiNullaryBuiltinNode {
9393
private static final TruffleLogger LOGGER = CApiContext.getLogger(PyEval_SaveThread.class);
9494

9595
@Specialization
96-
Object save(@Cached GilNode gil) {
96+
static Object save(@Cached GilNode gil) {
9797
PythonContext context = PythonContext.get(gil);
9898
PThreadState threadState = PThreadState.getThreadState(PythonLanguage.get(gil), context);
9999
LOGGER.fine("C extension releases GIL");
@@ -107,7 +107,7 @@ abstract static class PyEval_RestoreThread extends CApiUnaryBuiltinNode {
107107
private static final TruffleLogger LOGGER = CApiContext.getLogger(PyEval_RestoreThread.class);
108108

109109
@Specialization
110-
Object restore(@SuppressWarnings("unused") Object ptr,
110+
static Object restore(@SuppressWarnings("unused") Object ptr,
111111
@Cached GilNode gil) {
112112
PythonContext context = PythonContext.get(gil);
113113
PThreadState threadState = PThreadState.getThreadState(PythonLanguage.get(gil), context);
@@ -130,7 +130,7 @@ Object release(
130130
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject, PyObject, PyObject, Pointer, Pointer, Pointer, PyObject, PyObject}, call = Ignored)
131131
abstract static class _PyTruffleEval_EvalCodeEx extends CApi8BuiltinNode {
132132
@Specialization
133-
Object doGeneric(PCode code, Object globals, Object locals,
133+
static Object doGeneric(PCode code, Object globals, Object locals,
134134
Object argumentArrayPtr, Object kwsPtr, Object defaultValueArrayPtr,
135135
Object kwdefaultsWrapper, Object closureObj,
136136
@CachedLibrary(limit = "2") InteropLibrary ptrLib,

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextCodeBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public final class PythonCextCodeBuiltins {
6868
abstract static class PyCode_New extends CApi15BuiltinNode {
6969
@Specialization
7070
@TruffleBoundary
71-
public Object codeNew(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, Object code, Object consts,
71+
public static Object codeNew(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, Object code, Object consts,
7272
Object names, Object varnames, Object freevars, Object cellvars, Object filename, Object name, int firstlineno, Object lnotab,
7373
@Cached CallNode callNode) {
7474
/*
@@ -89,7 +89,7 @@ public Object codeNew(int argcount, int kwonlyargcount, int nlocals, int stacksi
8989
abstract static class PyCode_NewWithPosOnlyArgs extends CApi16BuiltinNode {
9090
@Specialization
9191
@TruffleBoundary
92-
public Object codeNew(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, Object code, Object consts,
92+
public static Object codeNew(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, Object code, Object consts,
9393
Object names, Object varnames, Object freevars, Object cellvars, Object filename, Object name, int firstlineno, Object lnotab,
9494
@Cached CallNode callNode) {
9595
/*

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextDictBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected boolean isDictSubtype(Node inliningTarget, Object obj, InlinedGetClass
189189
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject, PyObject, PyObject}, call = Direct)
190190
abstract static class _PyDict_Pop extends CApiTernaryBuiltinNode {
191191
@Specialization
192-
Object pop(PDict dict, Object key, Object defaultValue,
192+
static Object pop(PDict dict, Object key, Object defaultValue,
193193
@Cached PopNode popNode) {
194194
return popNode.execute(null, dict, key, defaultValue);
195195
}
@@ -335,7 +335,7 @@ public int fallback(Object dict, Object key, Object value, Object givenHash) {
335335
@CApiBuiltin(ret = PyObjectBorrowed, args = {PyObject, PyObject, PyObject}, call = Direct)
336336
abstract static class PyDict_SetDefault extends CApiTernaryBuiltinNode {
337337
@Specialization
338-
Object setItem(PDict dict, Object key, Object value,
338+
static Object setItem(PDict dict, Object key, Object value,
339339
@Cached DictBuiltins.SetDefaultNode setItemNode) {
340340
return setItemNode.execute(null, dict, key, value);
341341
}
@@ -393,7 +393,7 @@ public int fallback(Object dict, @SuppressWarnings("unused") Object key) {
393393
@CApiBuiltin(ret = Void, args = {PyObject}, call = Direct)
394394
abstract static class PyDict_Clear extends CApiUnaryBuiltinNode {
395395
@Specialization
396-
Object keys(PDict dict,
396+
static Object keys(PDict dict,
397397
@Cached ClearNode clearNode) {
398398
return clearNode.execute(null, dict);
399399
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextHashBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ abstract static class PyTruffle_HashConstant extends CApiUnaryBuiltinNode {
9191

9292
@Specialization
9393
@TruffleBoundary
94-
long doI(int idx) {
94+
static long doI(int idx) {
9595
switch (idx) {
9696
case 0:
9797
return PyObjectHashNode.getUncached().execute(null, Double.POSITIVE_INFINITY);
@@ -127,7 +127,7 @@ abstract static class _PyTruffle_HashBytes extends CApiUnaryBuiltinNode {
127127

128128
@Specialization
129129
@TruffleBoundary
130-
long doI(Object value,
130+
static long doI(Object value,
131131
@Cached PyObjectHashNode hashNode) {
132132
return hashNode.execute(null, value);
133133
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextImportBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class PythonCextImportBuiltins {
7373
@CApiBuiltin(name = "PyImport_ImportModuleNoBlock", ret = PyObjectTransfer, args = {ConstCharPtrAsTruffleString}, call = Direct)
7474
abstract static class PyImport_ImportModule extends CApiUnaryBuiltinNode {
7575
@Specialization
76-
Object imp(TruffleString name) {
76+
static Object imp(TruffleString name) {
7777
return AbstractImportNode.importModule(name, T_IMPORT_ALL);
7878
}
7979
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextIterBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ PSequenceIterator call(Object seq) {
6565
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject, PyObject}, call = Direct)
6666
abstract static class PyCallIter_New extends CApiBinaryBuiltinNode {
6767
@Specialization
68-
Object getItem(Object it, Object sentinel,
68+
static Object getItem(Object it, Object sentinel,
6969
@Cached IterNode iterNode) {
7070
return iterNode.execute(null, it, sentinel);
7171
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextLongBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected boolean isPIntSubtype(Object obj, GetClassNode getClassNode, IsSubtype
185185
abstract static class PyLong_FromDouble extends CApiUnaryBuiltinNode {
186186

187187
@Specialization
188-
Object fromDouble(double d,
188+
static Object fromDouble(double d,
189189
@Cached IntNode intNode) {
190190
return intNode.execute(null, d);
191191
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextMemoryViewBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Object get(Object obj, int buffertype, byte orderByte,
119119
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject}, call = Direct)
120120
abstract static class PyMemoryView_FromObject extends CApiUnaryBuiltinNode {
121121
@Specialization
122-
Object wrap(Object object,
122+
static Object wrap(Object object,
123123
@Cached PyMemoryViewFromObject memoryViewNode) {
124124
return memoryViewNode.execute(null, object);
125125
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/cext/PythonCextModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Object run(TruffleString name,
152152
@CApiBuiltin(ret = PyObjectTransfer, args = {PyObject}, call = Direct)
153153
abstract static class PyModule_GetNameObject extends CApiUnaryBuiltinNode {
154154
@Specialization
155-
Object getName(Object o,
155+
static Object getName(Object o,
156156
@Cached PyObjectLookupAttr lookupAttrNode) {
157157
return lookupAttrNode.execute(null, o, T___NAME__);
158158
}

0 commit comments

Comments
 (0)