Skip to content

Commit b43155e

Browse files
committed
[GR-40387] ObjectHashMap: fix a deopt on SVM.
PullRequest: graalpython/2397
2 parents 6c8249a + 6660972 commit b43155e

File tree

1 file changed

+2
-83
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common

1 file changed

+2
-83
lines changed

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

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -417,87 +417,6 @@ private boolean needsResize() {
417417
return usedIndices + bucketsCntQuarter > getBucketsCount();
418418
}
419419

420-
public static class GetProfiles extends Node {
421-
final ConditionProfile foundNullKey;
422-
final ConditionProfile foundSameHashKey;
423-
final ConditionProfile foundEqKey;
424-
final ConditionProfile collisionFoundEqKey;
425-
final ConditionProfile collisionFoundNoValue;
426-
@Child PyObjectRichCompareBool.EqNode eqNode;
427-
428-
public GetProfiles(boolean cached, PyObjectRichCompareBool.EqNode eqNode) {
429-
if (cached) {
430-
foundNullKey = ConditionProfile.createCountingProfile();
431-
foundSameHashKey = ConditionProfile.createCountingProfile();
432-
foundEqKey = ConditionProfile.createCountingProfile();
433-
collisionFoundEqKey = ConditionProfile.createCountingProfile();
434-
collisionFoundNoValue = ConditionProfile.createCountingProfile();
435-
} else {
436-
foundNullKey = ConditionProfile.getUncached();
437-
foundSameHashKey = ConditionProfile.getUncached();
438-
foundEqKey = ConditionProfile.getUncached();
439-
collisionFoundEqKey = ConditionProfile.getUncached();
440-
collisionFoundNoValue = ConditionProfile.getUncached();
441-
}
442-
this.eqNode = eqNode;
443-
}
444-
445-
public static GetProfiles create() {
446-
return new GetProfiles(true, PyObjectRichCompareBool.EqNode.create());
447-
}
448-
449-
private static final GetProfiles UNCACHED = new GetProfiles(false, PyObjectRichCompareBool.EqNode.getUncached());
450-
451-
public static GetProfiles getUncached() {
452-
return UNCACHED;
453-
}
454-
}
455-
456-
public static final class PutProfiles extends GetProfiles {
457-
final BranchProfile rehash1Profile;
458-
final BranchProfile rehash2Profile;
459-
460-
public PutProfiles(boolean cached, PyObjectRichCompareBool.EqNode eqNode) {
461-
super(cached, eqNode);
462-
if (cached) {
463-
rehash1Profile = BranchProfile.create();
464-
rehash2Profile = BranchProfile.create();
465-
} else {
466-
rehash1Profile = BranchProfile.getUncached();
467-
rehash2Profile = BranchProfile.getUncached();
468-
}
469-
}
470-
471-
public static PutProfiles create() {
472-
return new PutProfiles(true, PyObjectRichCompareBool.EqNode.create());
473-
}
474-
475-
private static final PutProfiles UNCACHED = new PutProfiles(false, PyObjectRichCompareBool.EqNode.getUncached());
476-
477-
public static PutProfiles getUncached() {
478-
return UNCACHED;
479-
}
480-
}
481-
482-
public static final class RemoveProfiles extends GetProfiles {
483-
final BranchProfile compactProfile;
484-
485-
public RemoveProfiles(boolean cached, PyObjectRichCompareBool.EqNode eqNode) {
486-
super(cached, eqNode);
487-
compactProfile = cached ? BranchProfile.create() : BranchProfile.getUncached();
488-
}
489-
490-
public static RemoveProfiles create() {
491-
return new RemoveProfiles(true, PyObjectRichCompareBool.EqNode.create());
492-
}
493-
494-
private static final RemoveProfiles UNCACHED = new RemoveProfiles(false, PyObjectRichCompareBool.EqNode.getUncached());
495-
496-
public static RemoveProfiles getUncached() {
497-
return UNCACHED;
498-
}
499-
}
500-
501420
public int size() {
502421
return size;
503422
}
@@ -617,7 +536,7 @@ public static void doPut(ThreadState state, ObjectHashMap map, Object key, long
617536
int searchLimit = map.getBucketsCount() + PERTURB_SHIFTS_COUT;
618537
int i = 0;
619538
try {
620-
for (; CompilerDirectives.injectBranchProbability(0, i < searchLimit); i++) {
539+
for (; i < searchLimit; i++) {
621540
perturb >>>= PERTURB_SHIFT;
622541
compactIndex = map.nextIndex(compactIndex, perturb);
623542
index = map.indices[compactIndex];
@@ -749,7 +668,7 @@ public static void doRemove(ThreadState state, ObjectHashMap map, Object key, lo
749668
int searchLimit = map.getBucketsCount() + PERTURB_SHIFTS_COUT;
750669
int i = 0;
751670
try {
752-
for (; CompilerDirectives.injectBranchProbability(0, i < searchLimit); i++) {
671+
for (; i < searchLimit; i++) {
753672
perturb >>>= PERTURB_SHIFT;
754673
compactIndex = map.nextIndex(compactIndex, perturb);
755674
index = map.indices[compactIndex];

0 commit comments

Comments
 (0)