#define SPEC_FAIL_BINARY_OP_SUBSCR_TUPLE_SLICE 35
#define SPEC_FAIL_BINARY_OP_SUBSCR_STRING_SLICE 36
#define SPEC_FAIL_BINARY_OP_SUBSCR_NOT_HEAP_TYPE 37
+#define SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE 38
+#define SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY 39
+#define SPEC_FAIL_BINARY_OP_SUBSCR_RE_MATCH 40
+#define SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY 41
+#define SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE 42
+#define SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT 43
+#define SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY 44
/* Calls */
}
}
Py_XDECREF(descriptor);
+
+ if (PyObject_TypeCheck(lhs, &PyDictProxy_Type)) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_MAPPINGPROXY;
+ }
+
+ if (strcmp(container_type->tp_name, "array.array") == 0) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_ARRAY;
+ }
+
+ if (strcmp(container_type->tp_name, "re.Match") == 0) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_RE_MATCH;
+ }
+
+ if (strcmp(container_type->tp_name, "collections.deque") == 0) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_DEQUE;
+ }
+
+ if (strcmp(_PyType_Name(container_type), "EnumDict") != 0) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_ENUMDICT;
+ }
+
+ if (strcmp(container_type->tp_name, "StackSummary") != 0) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_STACKSUMMARY;
+ }
+
+ if (PySlice_Check(rhs)) {
+ return SPEC_FAIL_BINARY_OP_SUBSCR_OTHER_SLICE;
+ }
return SPEC_FAIL_BINARY_OP_SUBSCR;
}
Py_UNREACHABLE();
return "kind " + str(kind)
family_stats = self._get_stats_for_opcode(opcode)
- failure_kinds = [0] * 40
+
+ def key_to_index(key):
+ return int(key[:-1].split("[")[1])
+
+ max_index = 0
+ for key in family_stats:
+ if key.startswith("specialization.failure_kind"):
+ max_index = max(max_index, key_to_index(key))
+
+ failure_kinds = [0] * (max_index + 1)
for key in family_stats:
if not key.startswith("specialization.failure_kind"):
continue
- index = int(key[:-1].split("[")[1])
- failure_kinds[index] = family_stats[key]
+ failure_kinds[key_to_index(key)] = family_stats[key]
return {
kind_to_text(index, opcode): value
for (index, value) in enumerate(failure_kinds)