Skip to content

Commit c6d5235

Browse files
committed
Address review comments
1 parent 401eedb commit c6d5235

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ private WriteAttributeToObjectNode ensureWriteNode() {
597597
@Builtin(name = __DELATTR__, minNumOfPositionalArgs = 2)
598598
@GenerateNodeFactory
599599
public abstract static class DelattrNode extends PythonBinaryBuiltinNode {
600-
@Child GetClassNode getDescClassNode;
600+
@Child private GetClassNode getDescClassNode;
601601

602602
@Specialization
603603
protected PNone doIt(VirtualFrame frame, Object object, Object keyObj,

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ public void deleteDict(Object receiver) throws UnsupportedMessageException {
129129
throw UnsupportedMessageException.create();
130130
}
131131

132-
// Temporary class getter before equals gets converted to a node
133-
private Object getPythonClass(Object receiver) {
134-
return getDefaultNodes().getGetClassNode().execute(receiver);
135-
}
136-
137132
/**
138133
* @return true if the receiver of a Python type.<br>
139134
* <br>
@@ -461,8 +456,8 @@ public boolean equalsWithState(Object receiver, Object other, PythonObjectLibrar
461456

462457
boolean checkedReverseOp = false;
463458

464-
Object leftClass = getPythonClass(receiver);
465-
Object rightClass = otherLibrary.getPythonClass(other);
459+
Object leftClass = getDefaultNodes().getGetClassNode().execute(receiver);
460+
Object rightClass = otherLibrary.getDefaultNodes().getGetClassNode().execute(other);
466461
int result;
467462
boolean isSameType = getDefaultNodes().getIsSameTypeNode().execute(leftClass, rightClass);
468463
if (!isSameType && getDefaultNodes().getIsSubtypeNode().execute(rightClass, leftClass)) {
@@ -1071,8 +1066,9 @@ public Object getDelegatedValue(Object receiver) {
10711066
* @param type the class to be checked against
10721067
*/
10731068
public boolean typeCheck(Object receiver, Object type) {
1074-
return getDefaultNodes().getIsSameTypeNode().execute(getPythonClass(receiver), type) ||
1075-
getDefaultNodes().getIsSubtypeNode().execute(getPythonClass(receiver), type);
1069+
Object clazz = getDefaultNodes().getGetClassNode().execute(receiver);
1070+
return getDefaultNodes().getIsSameTypeNode().execute(clazz, type) ||
1071+
getDefaultNodes().getIsSubtypeNode().execute(clazz, type);
10761072
}
10771073

10781074
/**

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/thread/LockBuiltins.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,20 @@ boolean isLocked(PLock self) {
252252
@GenerateNodeFactory
253253
abstract static class ReprLockNode extends PythonUnaryBuiltinNode {
254254
@Specialization
255-
String repr(PLock self,
256-
@Cached GetClassNode getClassNode,
257-
@Cached GetNameNode getNameNode) {
255+
@TruffleBoundary
256+
String repr(PLock self) {
258257
return PythonUtils.format("<%s %s object at %s>",
259258
(self.locked()) ? "locked" : "unlocked",
260-
getNameNode.execute(getClassNode.execute(self)),
259+
GetNameNode.getUncached().execute(GetClassNode.getUncached().execute(self)),
261260
self.hashCode());
262261
}
263262

264263
@Specialization
265-
String repr(PRLock self,
266-
@Cached GetClassNode getClassNode,
267-
@Cached GetNameNode getNameNode) {
264+
@TruffleBoundary
265+
String repr(PRLock self) {
268266
return PythonUtils.format("<%s %s object owner=%d count=%d at %s>",
269267
(self.locked()) ? "locked" : "unlocked",
270-
getNameNode.execute(getClassNode.execute(self)),
268+
GetNameNode.getUncached().execute(GetClassNode.getUncached().execute(self)),
271269
self.getOwnerId(),
272270
self.getCount(),
273271
self.hashCode());

0 commit comments

Comments
 (0)