Skip to content

Commit 6d897ae

Browse files
committed
[GR-26362] Remove exported message PInt#hash, implement EconomicMapStorage#xor.
PullRequest: graalpython/1301
2 parents 827e455 + 296485e commit 6d897ae

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/EconomicMapStorage.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,15 @@ static HashingStorage diffGeneric(EconomicMapStorage self, HashingStorage other,
587587
}
588588
}
589589

590+
@ExportMessage
591+
public HashingStorage xor(HashingStorage other,
592+
@CachedLibrary("this") HashingStorageLibrary selfLib,
593+
@CachedLibrary(limit = "2") HashingStorageLibrary otherLib) {
594+
HashingStorage a = selfLib.diff(this, other);
595+
HashingStorage b = otherLib.diff(other, this);
596+
return selfLib.union(a, b);
597+
}
598+
590599
@Override
591600
@ExportMessage
592601
public HashingStorageIterable<Object> keys() {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/HashingStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public HashingStorage union(HashingStorage other,
560560
}
561561

562562
@ExportMessage
563-
public HashingStorage diff(HashingStorage other,
563+
public HashingStorage diffWithState(HashingStorage other, @SuppressWarnings("unused") ThreadState state,
564564
@CachedLibrary("this") HashingStorageLibrary libSelf,
565565
@Exclusive @Cached DiffInjectNode diffNode) {
566566
HashingStorage newStore = EconomicMapStorage.create();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/ints/PInt.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import com.oracle.truffle.api.library.CachedLibrary;
5656
import com.oracle.truffle.api.library.ExportLibrary;
5757
import com.oracle.truffle.api.library.ExportMessage;
58+
import com.oracle.truffle.api.library.ExportMessage.Ignore;
5859
import com.oracle.truffle.api.object.Shape;
5960

6061
@ExportLibrary(InteropLibrary.class)
@@ -563,7 +564,8 @@ public BigInteger add(PInt other) {
563564
return add(other.value);
564565
}
565566

566-
@ExportMessage
567+
// We cannot export it as a message, because it can be overridden!
568+
@Ignore
567569
public long hash() {
568570
return hashBigInteger(value);
569571
}

0 commit comments

Comments
 (0)