Skip to content

Commit f8bf654

Browse files
committed
BuiltinConstructors uses new createValueIdentityProfile()
1 parent b11b6f0 commit f8bf654

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,19 +1656,11 @@ private void checkExcessArgs(Object type, Object[] varargs, PKeyword[] kwargs) {
16561656
}
16571657
if (profileNew == null) {
16581658
CompilerDirectives.transferToInterpreterAndInvalidate();
1659-
if (getLanguage().singleContextAssumption.isValid()) {
1660-
profileNew = ValueProfile.createIdentityProfile();
1661-
} else {
1662-
profileNew = ValueProfile.createClassProfile();
1663-
}
1659+
profileNew = createValueIdentityProfile();
16641660
}
16651661
if (profileInit == null) {
16661662
CompilerDirectives.transferToInterpreterAndInvalidate();
1667-
if (getLanguage().singleContextAssumption.isValid()) {
1668-
profileInit = ValueProfile.createIdentityProfile();
1669-
} else {
1670-
profileInit = ValueProfile.createClassProfile();
1671-
}
1663+
profileInit = createValueIdentityProfile();
16721664
}
16731665
if (profileNewFactory == null) {
16741666
CompilerDirectives.transferToInterpreterAndInvalidate();

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/PNodeWithContext.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
5151
import com.oracle.truffle.api.dsl.ImportStatic;
5252
import com.oracle.truffle.api.nodes.Node;
53+
import com.oracle.truffle.api.profiles.ValueProfile;
5354

5455
@ImportStatic({PGuards.class, PythonOptions.class, SpecialMethodNames.class, SpecialAttributeNames.class, SpecialMethodSlot.class, BuiltinNames.class})
5556
public abstract class PNodeWithContext extends Node {
@@ -83,4 +84,8 @@ public final PythonContext getContext() {
8384
public final boolean isSingleContext() {
8485
return getLanguage().isSingleContext();
8586
}
87+
88+
public ValueProfile createValueIdentityProfile() {
89+
return getLanguage().isSingleContext() ? ValueProfile.createIdentityProfile() : ValueProfile.createClassProfile();
90+
}
8691
}

0 commit comments

Comments
 (0)