Skip to content

Commit 86f8813

Browse files
committed
Remove PythonObject#getStorage()
1 parent dd83060 commit 86f8813

File tree

6 files changed

+10
-15
lines changed

6 files changed

+10
-15
lines changed

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
@@ -235,7 +235,7 @@ static Object moduleFunction(Object methodDefPtr, PythonModule mod, TruffleStrin
235235
@Cached ObjectBuiltins.SetattrNode setattrNode,
236236
@Cached ReadAttributeFromDynamicObjectNode readAttrNode,
237237
@Cached CFunctionNewExMethodNode cFunctionNewExMethodNode) {
238-
Object modName = readAttrNode.execute(mod.getStorage(), T___NAME__, null);
238+
Object modName = readAttrNode.execute(mod, T___NAME__, null);
239239
assert modName != null : "module name is missing!";
240240
Object func = cFunctionNewExMethodNode.execute(inliningTarget, methodDefPtr, name, cfunc, flags, wrapper, mod, modName, doc);
241241
setattrNode.execute(null, mod, name, func);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ static Object doTpDict(PythonManagedClass object, Object value,
853853
if (existing != null) {
854854
dict.setDictStorage(existing.getDictStorage());
855855
} else {
856-
dict.setDictStorage(new DynamicObjectStorage(object.getStorage()));
856+
dict.setDictStorage(new DynamicObjectStorage(object));
857857
}
858858
setDict.execute(inliningTarget, object, dict);
859859
} else {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ctypes/CDataBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ static Object reduce(VirtualFrame frame, CDataObject self,
175175
Object clazz = getClassNode.execute(inliningTarget, self);
176176
Object[] t2 = new Object[]{clazz, factory.createTuple(t1)};
177177
PythonModule ctypes = PythonContext.get(inliningTarget).lookupBuiltinModule(T__CTYPES);
178-
Object unpickle = readAttrNode.execute(ctypes.getStorage(), T_UNPICKLE, null);
178+
Object unpickle = readAttrNode.execute(ctypes, T_UNPICKLE, null);
179179
if (unpickle == null) {
180180
CompilerDirectives.transferToInterpreterAndInvalidate();
181181
throw PRaiseNode.raiseUncached(inliningTarget, NotImplementedError, toTruffleStringUncached("unpickle isn't supported yet."));

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/ToNativeTypeNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void initializeType(PythonClassNativeWrapper obj, Object mem, boolean hea
321321
if (!(dict instanceof StgDictObject)) {
322322
HashingStorage dictStorage = dict.getDictStorage();
323323
if (!(dictStorage instanceof DynamicObjectStorage)) {
324-
HashingStorage storage = new DynamicObjectStorage(clazz.getStorage());
324+
HashingStorage storage = new DynamicObjectStorage(clazz);
325325
dict.setDictStorage(storage);
326326
if (dictStorage != null) {
327327
// copy all mappings to the new storage

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/object/PythonObject.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
4545
import com.oracle.truffle.api.dsl.NeverDefault;
4646
import com.oracle.truffle.api.nodes.Node;
47-
import com.oracle.truffle.api.object.DynamicObject;
4847
import com.oracle.truffle.api.object.DynamicObjectLibrary;
4948
import com.oracle.truffle.api.object.Shape;
5049
import com.oracle.truffle.api.strings.TruffleString;
@@ -106,14 +105,10 @@ public Object getInitialPythonClass() {
106105
return initialPythonClass;
107106
}
108107

109-
public final DynamicObject getStorage() {
110-
return this;
111-
}
112-
113108
@SuppressWarnings("deprecation")
114109
@TruffleBoundary
115110
public final Object getAttribute(Object key) {
116-
return DynamicObjectLibrary.getUncached().getOrDefault(getStorage(), assertNoJavaString(key), PNone.NO_VALUE);
111+
return DynamicObjectLibrary.getUncached().getOrDefault(this, assertNoJavaString(key), PNone.NO_VALUE);
117112
}
118113

119114
@SuppressWarnings("deprecation")
@@ -122,15 +117,15 @@ public void setAttribute(Object nameObj, Object value) {
122117
Object name = assertNoJavaString(nameObj);
123118
assert name instanceof TruffleString : name.getClass().getSimpleName();
124119
CompilerAsserts.neverPartOfCompilation();
125-
DynamicObjectLibrary.getUncached().put(getStorage(), name, assertNoJavaString(value));
120+
DynamicObjectLibrary.getUncached().put(this, name, assertNoJavaString(value));
126121
}
127122

128123
@SuppressWarnings("deprecation")
129124
@TruffleBoundary
130125
public List<TruffleString> getAttributeNames() {
131126
ArrayList<TruffleString> keyList = new ArrayList<>();
132-
for (Object o : getStorage().getShape().getKeyList()) {
133-
if (o instanceof TruffleString && DynamicObjectLibrary.getUncached().getOrDefault(getStorage(), o, PNone.NO_VALUE) != PNone.NO_VALUE) {
127+
for (Object o : getShape().getKeyList()) {
128+
if (o instanceof TruffleString && DynamicObjectLibrary.getUncached().getOrDefault(this, o, PNone.NO_VALUE) != PNone.NO_VALUE) {
134129
keyList.add((TruffleString) o);
135130
}
136131
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,11 +853,11 @@ public final PDict createDictFromMapGeneric(LinkedHashMap<Object, Object> map) {
853853
}
854854

855855
public final PDict createDictFixedStorage(PythonObject pythonObject, MroSequenceStorage mroSequenceStorage) {
856-
return createDict(new DynamicObjectStorage(pythonObject.getStorage(), mroSequenceStorage));
856+
return createDict(new DynamicObjectStorage(pythonObject, mroSequenceStorage));
857857
}
858858

859859
public final PDict createDictFixedStorage(PythonObject pythonObject) {
860-
return createDict(new DynamicObjectStorage(pythonObject.getStorage()));
860+
return createDict(new DynamicObjectStorage(pythonObject));
861861
}
862862

863863
public final PDict createDict(Object cls, HashingStorage storage) {

0 commit comments

Comments
 (0)