Skip to content

Commit cea4aa8

Browse files
steve-stomasstupka
authored andcommitted
Remove PythonUtils.ASSERTIONS_ENABLED: it is not reliable on SVM
1 parent c613134 commit cea4aa8

File tree

4 files changed

+4
-12
lines changed

4 files changed

+4
-12
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/PythonBuiltinClassType.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
import com.oracle.graal.python.builtins.objects.function.BuiltinMethodDescriptor;
6363
import com.oracle.graal.python.builtins.objects.type.SpecialMethodSlot;
6464
import com.oracle.graal.python.runtime.PythonContext;
65-
import com.oracle.graal.python.util.PythonUtils;
6665
import com.oracle.truffle.api.CompilerAsserts;
6766
import com.oracle.truffle.api.CompilerDirectives;
6867
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
@@ -732,7 +731,9 @@ public final Shape getInstanceShape(PythonLanguage lang) {
732731

733732
Empty.base = Exception;
734733

735-
HashSet<String> set = PythonUtils.ASSERTIONS_ENABLED ? new HashSet<>() : null;
734+
boolean assertionsEnabled = false;
735+
assert (assertionsEnabled = true) == true;
736+
HashSet<String> set = assertionsEnabled ? new HashSet<>() : null;
736737
for (PythonBuiltinClassType type : VALUES) {
737738
// check uniqueness
738739
assert set.add("" + type.moduleName + "." + type.name) : type.name();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ private void compact() {
768768
if (collision) {
769769
markCollision(i);
770770
}
771-
} else if (PythonUtils.ASSERTIONS_ENABLED && index == DUMMY_INDEX) {
771+
} else if (index == DUMMY_INDEX) {
772772
dummyCount--;
773773
}
774774
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,11 +1165,6 @@ public byte[] getHashSecret() {
11651165
}
11661166

11671167
public boolean isInitialized() {
1168-
if (PythonUtils.ASSERTIONS_ENABLED && isInitializedNonCompilationFinal != isInitialized) {
1169-
// We cannot use normal assertion, because those are removed in compilation
1170-
CompilerDirectives.transferToInterpreterAndInvalidate();
1171-
throw CompilerDirectives.shouldNotReachHere(String.format("%b != %b", isInitializedNonCompilationFinal, isInitialized));
1172-
}
11731168
return isInitialized;
11741169
}
11751170

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/util/PythonUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,13 @@ public final class PythonUtils {
9999
public static final PCell[] NO_CLOSURE = new PCell[0];
100100
public static final ByteArraySupport arrayAccessor;
101101
public static final ConditionProfile[] DISABLED = new ConditionProfile[]{ConditionProfile.getUncached()};
102-
public static final boolean ASSERTIONS_ENABLED;
103102

104103
static {
105104
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
106105
arrayAccessor = ByteArraySupport.bigEndian();
107106
} else {
108107
arrayAccessor = ByteArraySupport.littleEndian();
109108
}
110-
boolean ae = false;
111-
assert (ae = true) == true;
112-
ASSERTIONS_ENABLED = ae;
113109
}
114110

115111
private PythonUtils() {

0 commit comments

Comments
 (0)