Skip to content

Commit 31a01dd

Browse files
committed
Profile the type of the lookup result in LookupSpecialBaseNode
1 parent 80a88bb commit 31a01dd

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/call/special/LookupSpecialBaseNode.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,21 @@
5252
import com.oracle.truffle.api.CompilerDirectives;
5353
import com.oracle.truffle.api.frame.VirtualFrame;
5454
import com.oracle.truffle.api.nodes.Node;
55+
import com.oracle.truffle.api.profiles.ValueProfile;
5556

5657
public abstract class LookupSpecialBaseNode extends Node {
5758
@Child LookupInMROBaseNode lookupNode; // this should be initialized by the subclass
5859
private final boolean ignoreDescriptorException;
5960
@Child private LookupInheritedAttributeNode lookupGet;
6061
@Child private CallNode callGet;
62+
private final ValueProfile lookupResProfile = ValueProfile.createClassProfile();
6163

6264
LookupSpecialBaseNode(boolean ignoreDescriptorException) {
6365
this.ignoreDescriptorException = ignoreDescriptorException;
6466
}
6567

6668
public final Object execute(VirtualFrame frame, Object type, Object receiver) {
67-
Object descriptor = lookupNode.execute(type);
69+
Object descriptor = lookupResProfile.profile(lookupNode.execute(type));
6870
if (descriptor == PNone.NO_VALUE || descriptor instanceof PBuiltinFunction || descriptor instanceof PFunction || descriptor instanceof BuiltinMethodDescriptor) {
6971
// Return unbound to avoid constructing the bound object
7072
return descriptor;

0 commit comments

Comments
 (0)