Skip to content

Commit 487d647

Browse files
committed
Address review feedback and warnings
1 parent 0a1a1f0 commit 487d647

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/OperatorModuleBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public boolean compare(Object left, Object right,
209209

210210
// Comparison that's safe against timing attacks
211211
@TruffleBoundary
212-
private boolean tscmp(String leftIn, String right) {
212+
private static boolean tscmp(String leftIn, String right) {
213213
String left = leftIn;
214214
int result = 0;
215215
if (left.length() != right.length()) {
@@ -223,7 +223,7 @@ private boolean tscmp(String leftIn, String right) {
223223
}
224224

225225
@TruffleBoundary
226-
private boolean tscmp(byte[] leftIn, byte[] right) {
226+
private static boolean tscmp(byte[] leftIn, byte[] right) {
227227
byte[] left = leftIn;
228228
int result = 0;
229229
if (left.length != right.length) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/generator/DictConcatNode.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ protected DictConcatNode(ExpressionNode... mappablesNodes) {
7070
@Specialization
7171
public Object concat(VirtualFrame frame,
7272
@Cached ConditionProfile hasFrame,
73-
@CachedLibrary(limit = "2") HashingStorageLibrary firstlib,
74-
@CachedLibrary(limit = "1") HashingStorageLibrary otherlib) {
73+
@CachedLibrary(limit = "3") HashingStorageLibrary hlib) {
7574
// TODO support mappings in general
7675
PDict first = null;
7776
PDict other;
@@ -80,19 +79,19 @@ public Object concat(VirtualFrame frame,
8079
first = expectDict(n.execute(frame));
8180
} else {
8281
other = expectDict(n.execute(frame));
83-
addAllToDict(frame, first, other, hasFrame, firstlib, otherlib);
82+
addAllToDict(frame, first, other, hasFrame, hlib);
8483
}
8584
}
8685
return first;
8786
}
8887

8988
private static void addAllToDict(VirtualFrame frame, PDict dict, PDict other, ConditionProfile hasFrame,
90-
HashingStorageLibrary firstlib, HashingStorageLibrary otherlib) {
89+
HashingStorageLibrary hlib) {
9190
HashingStorage dictStorage = dict.getDictStorage();
9291
HashingStorage otherStorage = other.getDictStorage();
93-
for (Object key : otherlib.keys(otherStorage)) {
94-
Object value = otherlib.getItemWithFrame(otherStorage, key, hasFrame, frame);
95-
dictStorage = firstlib.setItemWithFrame(dictStorage, key, value, hasFrame, frame);
92+
for (Object key : hlib.keys(otherStorage)) {
93+
Object value = hlib.getItemWithFrame(otherStorage, key, hasFrame, frame);
94+
dictStorage = hlib.setItemWithFrame(dictStorage, key, value, hasFrame, frame);
9695
}
9796
dict.setDictStorage(dictStorage);
9897
}
@@ -107,11 +106,7 @@ private PDict expectDict(Object first) {
107106
protected final PRaiseNode getRaiseNode() {
108107
if (raiseNode == null) {
109108
CompilerDirectives.transferToInterpreterAndInvalidate();
110-
if (isAdoptable()) {
111-
raiseNode = insert(PRaiseNode.create());
112-
} else {
113-
raiseNode = PRaiseNode.getUncached();
114-
}
109+
raiseNode = insert(PRaiseNode.create());
115110
}
116111
return raiseNode;
117112
}

0 commit comments

Comments
 (0)