Skip to content

Commit f52e5d7

Browse files
committed
Replace PInteropSetAttributeNode and PInteropDeleteAttributeNode with PyObjectSetAttr
1 parent 65b8753 commit f52e5d7

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
import com.oracle.graal.python.lib.PyMappingCheckNode;
111111
import com.oracle.graal.python.lib.PyObjectGetIter;
112112
import com.oracle.graal.python.lib.PyObjectLookupAttr;
113+
import com.oracle.graal.python.lib.PyObjectSetAttr;
113114
import com.oracle.graal.python.lib.PySequenceCheckNode;
114115
import com.oracle.graal.python.lib.PySequenceDelItemNode;
115116
import com.oracle.graal.python.lib.PySequenceGetItemNode;
@@ -231,13 +232,13 @@ public final void clearNativeWrapper() {
231232
public void writeMember(String key, Object value,
232233
@Bind("$node") Node inliningTarget,
233234
@Shared("js2ts") @Cached TruffleString.FromJavaStringNode fromJavaStringNode,
234-
@Cached PInteropSetAttributeNode setAttributeNode,
235+
@Cached PyObjectSetAttr setAttributeNode,
235236
// GR-44020: make shared:
236237
@Exclusive @Cached IsBuiltinObjectProfile attrErrorProfile,
237238
@Exclusive @Cached GilNode gil) throws UnsupportedMessageException, UnknownIdentifierException {
238239
boolean mustRelease = gil.acquire();
239240
try {
240-
setAttributeNode.execute(this, fromJavaStringNode.execute(key, TS_ENCODING), value);
241+
setAttributeNode.execute(null, inliningTarget, this, fromJavaStringNode.execute(key, TS_ENCODING), value);
241242
} catch (PException e) {
242243
e.expectAttributeError(inliningTarget, attrErrorProfile);
243244
// TODO(fa) not accurate; distinguish between read-only and non-existing
@@ -748,13 +749,14 @@ public Object getMembers(boolean includeInternal,
748749
@ExportMessage
749750
public void removeMember(String member,
750751
@Bind("$node") Node inliningTarget,
751-
@Cached PInteropDeleteAttributeNode deleteAttributeNode,
752+
@Cached PyObjectSetAttr deleteAttributeNode,
753+
@Shared("js2ts") @Cached TruffleString.FromJavaStringNode fromJavaStringNode,
752754
// GR-44020: make shared:
753755
@Exclusive @Cached IsBuiltinObjectProfile attrErrorProfile,
754756
@Exclusive @Cached GilNode gil) throws UnsupportedMessageException, UnknownIdentifierException {
755757
boolean mustRelease = gil.acquire();
756758
try {
757-
deleteAttributeNode.execute(this, member);
759+
deleteAttributeNode.delete(null, inliningTarget, this, fromJavaStringNode.execute(member, TS_ENCODING));
758760
} catch (PException e) {
759761
e.expectAttributeError(inliningTarget, attrErrorProfile);
760762
// TODO(fa) not accurate; distinguish between read-only and non-existing

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/lib/PyObjectSetAttr.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ public final void deleteCached(Frame frame, Object receiver, TruffleString name)
9696
execute(frame, null, receiver, name, null);
9797
}
9898

99+
public final void delete(Frame frame, Node inliningTarget, Object receiver, TruffleString name) {
100+
execute(frame, inliningTarget, receiver, name, null);
101+
}
102+
99103
@Specialization(guards = {"name == cachedName", "value != null"}, limit = "1")
100104
static void setFixedAttr(Frame frame, Node inliningTarget, Object self, @SuppressWarnings("unused") TruffleString name, Object value,
101105
@SuppressWarnings("unused") @Cached("name") TruffleString cachedName,

0 commit comments

Comments
 (0)