Skip to content

Commit c5b8263

Browse files
cosminbascalukasstadler
authored andcommitted
profile for the delete attribute case
1 parent a0f9ff9 commit c5b8263

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/attributes/LookupAttributeInMRONode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.oracle.truffle.api.object.Location;
5252
import com.oracle.truffle.api.object.Property;
5353
import com.oracle.truffle.api.object.Shape;
54+
import com.oracle.truffle.api.profiles.ConditionProfile;
5455

5556
public abstract class LookupAttributeInMRONode extends PBaseNode {
5657

@@ -127,11 +128,12 @@ protected Object lookupConstantMROCached(@SuppressWarnings("unused") PythonClass
127128
@Cached("cachedKlass.getLookupStableAssumption()") @SuppressWarnings("unused") Assumption lookupStable,
128129
@Cached("create()") ReadAttributeFromObjectNode readAttrNode,
129130
@Cached("findClassInMRO(cachedKlass)") PythonClass cachedAttrKlass,
131+
@Cached("createBinaryProfile()") ConditionProfile attributeDeletedProfile,
130132
@Cached("cachedAttrKlass.getStorage().getShape()") @SuppressWarnings("unused") Shape cachedShape,
131133
@Cached("getLocationOrNull(cachedShape)") @SuppressWarnings("unused") Location loc,
132134
@Cached("loc.getFinalAssumption()") @SuppressWarnings("unused") Assumption finalAssumption) {
133135
Object value = readAttrNode.execute(cachedAttrKlass, key);
134-
if (value == PNone.NO_VALUE) {
136+
if (attributeDeletedProfile.profile(value == PNone.NO_VALUE)) {
135137
// in case the attribute was deleted
136138
throw new IllegalStateException();
137139
}

0 commit comments

Comments
 (0)