gh-115419: Change default sym to not_null (GH-116562)

This commit is contained in:
Ken Jin 2024-03-13 20:57:48 +08:00 committed by GitHub
parent fcd49b4f47
commit 617aca9e74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 104 additions and 94 deletions

View File

@ -908,7 +908,7 @@ class TestGeneratedAbstractCases(unittest.TestCase):
case OP2: { case OP2: {
_Py_UopsSymbol *out; _Py_UopsSymbol *out;
out = sym_new_unknown(ctx); out = sym_new_not_null(ctx);
if (out == NULL) goto out_of_space; if (out == NULL) goto out_of_space;
stack_pointer[-1] = out; stack_pointer[-1] = out;
break; break;
@ -933,7 +933,7 @@ class TestGeneratedAbstractCases(unittest.TestCase):
output = """ output = """
case OP: { case OP: {
_Py_UopsSymbol *out; _Py_UopsSymbol *out;
out = sym_new_unknown(ctx); out = sym_new_not_null(ctx);
if (out == NULL) goto out_of_space; if (out == NULL) goto out_of_space;
stack_pointer[-1] = out; stack_pointer[-1] = out;
break; break;

View File

@ -449,6 +449,14 @@ dummy_func(void) {
} }
} }
op(_LOAD_ATTR, (owner -- attr, self_or_null if (oparg & 1))) {
(void)owner;
OUT_OF_SPACE_IF_NULL(attr = sym_new_not_null(ctx));
if (oparg & 1) {
OUT_OF_SPACE_IF_NULL(self_or_null = sym_new_unknown(ctx));
}
}
op(_LOAD_ATTR_MODULE, (index/1, owner -- attr, null if (oparg & 1))) { op(_LOAD_ATTR_MODULE, (index/1, owner -- attr, null if (oparg & 1))) {
(void)index; (void)index;
OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx)); OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx));
@ -513,7 +521,6 @@ dummy_func(void) {
OUT_OF_SPACE_IF_NULL(self = sym_new_not_null(ctx)); OUT_OF_SPACE_IF_NULL(self = sym_new_not_null(ctx));
} }
op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) { op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
if (!sym_set_type(callable, &PyFunction_Type)) { if (!sym_set_type(callable, &PyFunction_Type)) {
goto hit_bottom; goto hit_bottom;

View File

@ -80,7 +80,7 @@
case _END_SEND: { case _END_SEND: {
_Py_UopsSymbol *value; _Py_UopsSymbol *value;
value = sym_new_unknown(ctx); value = sym_new_not_null(ctx);
if (value == NULL) goto out_of_space; if (value == NULL) goto out_of_space;
stack_pointer[-2] = value; stack_pointer[-2] = value;
stack_pointer += -1; stack_pointer += -1;
@ -89,7 +89,7 @@
case _UNARY_NEGATIVE: { case _UNARY_NEGATIVE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -97,7 +97,7 @@
case _UNARY_NOT: { case _UNARY_NOT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -205,7 +205,7 @@
case _REPLACE_WITH_TRUE: { case _REPLACE_WITH_TRUE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -213,7 +213,7 @@
case _UNARY_INVERT: { case _UNARY_INVERT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -482,7 +482,7 @@
case _BINARY_SUBSCR: { case _BINARY_SUBSCR: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -491,7 +491,7 @@
case _BINARY_SLICE: { case _BINARY_SLICE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-3] = res; stack_pointer[-3] = res;
stack_pointer += -2; stack_pointer += -2;
@ -505,7 +505,7 @@
case _BINARY_SUBSCR_LIST_INT: { case _BINARY_SUBSCR_LIST_INT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -514,7 +514,7 @@
case _BINARY_SUBSCR_STR_INT: { case _BINARY_SUBSCR_STR_INT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -523,7 +523,7 @@
case _BINARY_SUBSCR_TUPLE_INT: { case _BINARY_SUBSCR_TUPLE_INT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -532,7 +532,7 @@
case _BINARY_SUBSCR_DICT: { case _BINARY_SUBSCR_DICT: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -573,7 +573,7 @@
case _CALL_INTRINSIC_1: { case _CALL_INTRINSIC_1: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -581,7 +581,7 @@
case _CALL_INTRINSIC_2: { case _CALL_INTRINSIC_2: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -608,7 +608,7 @@
case _GET_AITER: { case _GET_AITER: {
_Py_UopsSymbol *iter; _Py_UopsSymbol *iter;
iter = sym_new_unknown(ctx); iter = sym_new_not_null(ctx);
if (iter == NULL) goto out_of_space; if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter; stack_pointer[-1] = iter;
break; break;
@ -616,7 +616,7 @@
case _GET_ANEXT: { case _GET_ANEXT: {
_Py_UopsSymbol *awaitable; _Py_UopsSymbol *awaitable;
awaitable = sym_new_unknown(ctx); awaitable = sym_new_not_null(ctx);
if (awaitable == NULL) goto out_of_space; if (awaitable == NULL) goto out_of_space;
stack_pointer[0] = awaitable; stack_pointer[0] = awaitable;
stack_pointer += 1; stack_pointer += 1;
@ -625,7 +625,7 @@
case _GET_AWAITABLE: { case _GET_AWAITABLE: {
_Py_UopsSymbol *iter; _Py_UopsSymbol *iter;
iter = sym_new_unknown(ctx); iter = sym_new_not_null(ctx);
if (iter == NULL) goto out_of_space; if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter; stack_pointer[-1] = iter;
break; break;
@ -644,7 +644,7 @@
case _LOAD_ASSERTION_ERROR: { case _LOAD_ASSERTION_ERROR: {
_Py_UopsSymbol *value; _Py_UopsSymbol *value;
value = sym_new_unknown(ctx); value = sym_new_not_null(ctx);
if (value == NULL) goto out_of_space; if (value == NULL) goto out_of_space;
stack_pointer[0] = value; stack_pointer[0] = value;
stack_pointer += 1; stack_pointer += 1;
@ -653,7 +653,7 @@
case _LOAD_BUILD_CLASS: { case _LOAD_BUILD_CLASS: {
_Py_UopsSymbol *bc; _Py_UopsSymbol *bc;
bc = sym_new_unknown(ctx); bc = sym_new_not_null(ctx);
if (bc == NULL) goto out_of_space; if (bc == NULL) goto out_of_space;
stack_pointer[0] = bc; stack_pointer[0] = bc;
stack_pointer += 1; stack_pointer += 1;
@ -686,9 +686,9 @@
case _UNPACK_SEQUENCE_TWO_TUPLE: { case _UNPACK_SEQUENCE_TWO_TUPLE: {
_Py_UopsSymbol *val1; _Py_UopsSymbol *val1;
_Py_UopsSymbol *val0; _Py_UopsSymbol *val0;
val1 = sym_new_unknown(ctx); val1 = sym_new_not_null(ctx);
if (val1 == NULL) goto out_of_space; if (val1 == NULL) goto out_of_space;
val0 = sym_new_unknown(ctx); val0 = sym_new_not_null(ctx);
if (val0 == NULL) goto out_of_space; if (val0 == NULL) goto out_of_space;
stack_pointer[-1] = val1; stack_pointer[-1] = val1;
stack_pointer[0] = val0; stack_pointer[0] = val0;
@ -700,7 +700,7 @@
_Py_UopsSymbol **values; _Py_UopsSymbol **values;
values = &stack_pointer[-1]; values = &stack_pointer[-1];
for (int _i = oparg; --_i >= 0;) { for (int _i = oparg; --_i >= 0;) {
values[_i] = sym_new_unknown(ctx); values[_i] = sym_new_not_null(ctx);
if (values[_i] == NULL) goto out_of_space; if (values[_i] == NULL) goto out_of_space;
} }
stack_pointer += -1 + oparg; stack_pointer += -1 + oparg;
@ -711,7 +711,7 @@
_Py_UopsSymbol **values; _Py_UopsSymbol **values;
values = &stack_pointer[-1]; values = &stack_pointer[-1];
for (int _i = oparg; --_i >= 0;) { for (int _i = oparg; --_i >= 0;) {
values[_i] = sym_new_unknown(ctx); values[_i] = sym_new_not_null(ctx);
if (values[_i] == NULL) goto out_of_space; if (values[_i] == NULL) goto out_of_space;
} }
stack_pointer += -1 + oparg; stack_pointer += -1 + oparg;
@ -754,7 +754,7 @@
case _LOAD_LOCALS: { case _LOAD_LOCALS: {
_Py_UopsSymbol *locals; _Py_UopsSymbol *locals;
locals = sym_new_unknown(ctx); locals = sym_new_not_null(ctx);
if (locals == NULL) goto out_of_space; if (locals == NULL) goto out_of_space;
stack_pointer[0] = locals; stack_pointer[0] = locals;
stack_pointer += 1; stack_pointer += 1;
@ -763,7 +763,7 @@
case _LOAD_FROM_DICT_OR_GLOBALS: { case _LOAD_FROM_DICT_OR_GLOBALS: {
_Py_UopsSymbol *v; _Py_UopsSymbol *v;
v = sym_new_unknown(ctx); v = sym_new_not_null(ctx);
if (v == NULL) goto out_of_space; if (v == NULL) goto out_of_space;
stack_pointer[-1] = v; stack_pointer[-1] = v;
break; break;
@ -771,7 +771,7 @@
case _LOAD_NAME: { case _LOAD_NAME: {
_Py_UopsSymbol *v; _Py_UopsSymbol *v;
v = sym_new_unknown(ctx); v = sym_new_not_null(ctx);
if (v == NULL) goto out_of_space; if (v == NULL) goto out_of_space;
stack_pointer[0] = v; stack_pointer[0] = v;
stack_pointer += 1; stack_pointer += 1;
@ -781,7 +781,7 @@
case _LOAD_GLOBAL: { case _LOAD_GLOBAL: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
_Py_UopsSymbol *null = NULL; _Py_UopsSymbol *null = NULL;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
null = sym_new_null(ctx); null = sym_new_null(ctx);
if (null == NULL) goto out_of_space; if (null == NULL) goto out_of_space;
@ -802,7 +802,7 @@
case _LOAD_GLOBAL_MODULE: { case _LOAD_GLOBAL_MODULE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
_Py_UopsSymbol *null = NULL; _Py_UopsSymbol *null = NULL;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
null = sym_new_null(ctx); null = sym_new_null(ctx);
if (null == NULL) goto out_of_space; if (null == NULL) goto out_of_space;
@ -815,7 +815,7 @@
case _LOAD_GLOBAL_BUILTINS: { case _LOAD_GLOBAL_BUILTINS: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
_Py_UopsSymbol *null = NULL; _Py_UopsSymbol *null = NULL;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
null = sym_new_null(ctx); null = sym_new_null(ctx);
if (null == NULL) goto out_of_space; if (null == NULL) goto out_of_space;
@ -839,7 +839,7 @@
case _LOAD_FROM_DICT_OR_DEREF: { case _LOAD_FROM_DICT_OR_DEREF: {
_Py_UopsSymbol *value; _Py_UopsSymbol *value;
value = sym_new_unknown(ctx); value = sym_new_not_null(ctx);
if (value == NULL) goto out_of_space; if (value == NULL) goto out_of_space;
stack_pointer[-1] = value; stack_pointer[-1] = value;
break; break;
@ -847,7 +847,7 @@
case _LOAD_DEREF: { case _LOAD_DEREF: {
_Py_UopsSymbol *value; _Py_UopsSymbol *value;
value = sym_new_unknown(ctx); value = sym_new_not_null(ctx);
if (value == NULL) goto out_of_space; if (value == NULL) goto out_of_space;
stack_pointer[0] = value; stack_pointer[0] = value;
stack_pointer += 1; stack_pointer += 1;
@ -865,7 +865,7 @@
case _BUILD_STRING: { case _BUILD_STRING: {
_Py_UopsSymbol *str; _Py_UopsSymbol *str;
str = sym_new_unknown(ctx); str = sym_new_not_null(ctx);
if (str == NULL) goto out_of_space; if (str == NULL) goto out_of_space;
stack_pointer[-oparg] = str; stack_pointer[-oparg] = str;
stack_pointer += 1 - oparg; stack_pointer += 1 - oparg;
@ -874,7 +874,7 @@
case _BUILD_TUPLE: { case _BUILD_TUPLE: {
_Py_UopsSymbol *tup; _Py_UopsSymbol *tup;
tup = sym_new_unknown(ctx); tup = sym_new_not_null(ctx);
if (tup == NULL) goto out_of_space; if (tup == NULL) goto out_of_space;
stack_pointer[-oparg] = tup; stack_pointer[-oparg] = tup;
stack_pointer += 1 - oparg; stack_pointer += 1 - oparg;
@ -883,7 +883,7 @@
case _BUILD_LIST: { case _BUILD_LIST: {
_Py_UopsSymbol *list; _Py_UopsSymbol *list;
list = sym_new_unknown(ctx); list = sym_new_not_null(ctx);
if (list == NULL) goto out_of_space; if (list == NULL) goto out_of_space;
stack_pointer[-oparg] = list; stack_pointer[-oparg] = list;
stack_pointer += 1 - oparg; stack_pointer += 1 - oparg;
@ -902,7 +902,7 @@
case _BUILD_SET: { case _BUILD_SET: {
_Py_UopsSymbol *set; _Py_UopsSymbol *set;
set = sym_new_unknown(ctx); set = sym_new_not_null(ctx);
if (set == NULL) goto out_of_space; if (set == NULL) goto out_of_space;
stack_pointer[-oparg] = set; stack_pointer[-oparg] = set;
stack_pointer += 1 - oparg; stack_pointer += 1 - oparg;
@ -911,7 +911,7 @@
case _BUILD_MAP: { case _BUILD_MAP: {
_Py_UopsSymbol *map; _Py_UopsSymbol *map;
map = sym_new_unknown(ctx); map = sym_new_not_null(ctx);
if (map == NULL) goto out_of_space; if (map == NULL) goto out_of_space;
stack_pointer[-oparg*2] = map; stack_pointer[-oparg*2] = map;
stack_pointer += 1 - oparg*2; stack_pointer += 1 - oparg*2;
@ -924,7 +924,7 @@
case _BUILD_CONST_KEY_MAP: { case _BUILD_CONST_KEY_MAP: {
_Py_UopsSymbol *map; _Py_UopsSymbol *map;
map = sym_new_unknown(ctx); map = sym_new_not_null(ctx);
if (map == NULL) goto out_of_space; if (map == NULL) goto out_of_space;
stack_pointer[-1 - oparg] = map; stack_pointer[-1 - oparg] = map;
stack_pointer += -oparg; stack_pointer += -oparg;
@ -950,7 +950,7 @@
case _LOAD_SUPER_ATTR_ATTR: { case _LOAD_SUPER_ATTR_ATTR: {
_Py_UopsSymbol *attr; _Py_UopsSymbol *attr;
attr = sym_new_unknown(ctx); attr = sym_new_not_null(ctx);
if (attr == NULL) goto out_of_space; if (attr == NULL) goto out_of_space;
stack_pointer[-3] = attr; stack_pointer[-3] = attr;
stack_pointer += -2; stack_pointer += -2;
@ -960,9 +960,9 @@
case _LOAD_SUPER_ATTR_METHOD: { case _LOAD_SUPER_ATTR_METHOD: {
_Py_UopsSymbol *attr; _Py_UopsSymbol *attr;
_Py_UopsSymbol *self_or_null; _Py_UopsSymbol *self_or_null;
attr = sym_new_unknown(ctx); attr = sym_new_not_null(ctx);
if (attr == NULL) goto out_of_space; if (attr == NULL) goto out_of_space;
self_or_null = sym_new_unknown(ctx); self_or_null = sym_new_not_null(ctx);
if (self_or_null == NULL) goto out_of_space; if (self_or_null == NULL) goto out_of_space;
stack_pointer[-3] = attr; stack_pointer[-3] = attr;
stack_pointer[-2] = self_or_null; stack_pointer[-2] = self_or_null;
@ -971,12 +971,15 @@
} }
case _LOAD_ATTR: { case _LOAD_ATTR: {
_Py_UopsSymbol *owner;
_Py_UopsSymbol *attr; _Py_UopsSymbol *attr;
_Py_UopsSymbol *self_or_null = NULL; _Py_UopsSymbol *self_or_null = NULL;
attr = sym_new_unknown(ctx); owner = stack_pointer[-1];
if (attr == NULL) goto out_of_space; (void)owner;
self_or_null = sym_new_unknown(ctx); OUT_OF_SPACE_IF_NULL(attr = sym_new_not_null(ctx));
if (self_or_null == NULL) goto out_of_space; if (oparg & 1) {
OUT_OF_SPACE_IF_NULL(self_or_null = sym_new_unknown(ctx));
}
stack_pointer[-1] = attr; stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = self_or_null; if (oparg & 1) stack_pointer[0] = self_or_null;
stack_pointer += (oparg & 1); stack_pointer += (oparg & 1);
@ -1222,7 +1225,7 @@
case _CONTAINS_OP_SET: { case _CONTAINS_OP_SET: {
_Py_UopsSymbol *b; _Py_UopsSymbol *b;
b = sym_new_unknown(ctx); b = sym_new_not_null(ctx);
if (b == NULL) goto out_of_space; if (b == NULL) goto out_of_space;
stack_pointer[-2] = b; stack_pointer[-2] = b;
stack_pointer += -1; stack_pointer += -1;
@ -1231,7 +1234,7 @@
case _CONTAINS_OP_DICT: { case _CONTAINS_OP_DICT: {
_Py_UopsSymbol *b; _Py_UopsSymbol *b;
b = sym_new_unknown(ctx); b = sym_new_not_null(ctx);
if (b == NULL) goto out_of_space; if (b == NULL) goto out_of_space;
stack_pointer[-2] = b; stack_pointer[-2] = b;
stack_pointer += -1; stack_pointer += -1;
@ -1241,9 +1244,9 @@
case _CHECK_EG_MATCH: { case _CHECK_EG_MATCH: {
_Py_UopsSymbol *rest; _Py_UopsSymbol *rest;
_Py_UopsSymbol *match; _Py_UopsSymbol *match;
rest = sym_new_unknown(ctx); rest = sym_new_not_null(ctx);
if (rest == NULL) goto out_of_space; if (rest == NULL) goto out_of_space;
match = sym_new_unknown(ctx); match = sym_new_not_null(ctx);
if (match == NULL) goto out_of_space; if (match == NULL) goto out_of_space;
stack_pointer[-2] = rest; stack_pointer[-2] = rest;
stack_pointer[-1] = match; stack_pointer[-1] = match;
@ -1252,7 +1255,7 @@
case _CHECK_EXC_MATCH: { case _CHECK_EXC_MATCH: {
_Py_UopsSymbol *b; _Py_UopsSymbol *b;
b = sym_new_unknown(ctx); b = sym_new_not_null(ctx);
if (b == NULL) goto out_of_space; if (b == NULL) goto out_of_space;
stack_pointer[-1] = b; stack_pointer[-1] = b;
break; break;
@ -1264,7 +1267,7 @@
case _IS_NONE: { case _IS_NONE: {
_Py_UopsSymbol *b; _Py_UopsSymbol *b;
b = sym_new_unknown(ctx); b = sym_new_not_null(ctx);
if (b == NULL) goto out_of_space; if (b == NULL) goto out_of_space;
stack_pointer[-1] = b; stack_pointer[-1] = b;
break; break;
@ -1272,7 +1275,7 @@
case _GET_LEN: { case _GET_LEN: {
_Py_UopsSymbol *len_o; _Py_UopsSymbol *len_o;
len_o = sym_new_unknown(ctx); len_o = sym_new_not_null(ctx);
if (len_o == NULL) goto out_of_space; if (len_o == NULL) goto out_of_space;
stack_pointer[0] = len_o; stack_pointer[0] = len_o;
stack_pointer += 1; stack_pointer += 1;
@ -1281,7 +1284,7 @@
case _MATCH_CLASS: { case _MATCH_CLASS: {
_Py_UopsSymbol *attrs; _Py_UopsSymbol *attrs;
attrs = sym_new_unknown(ctx); attrs = sym_new_not_null(ctx);
if (attrs == NULL) goto out_of_space; if (attrs == NULL) goto out_of_space;
stack_pointer[-3] = attrs; stack_pointer[-3] = attrs;
stack_pointer += -2; stack_pointer += -2;
@ -1290,7 +1293,7 @@
case _MATCH_MAPPING: { case _MATCH_MAPPING: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[0] = res; stack_pointer[0] = res;
stack_pointer += 1; stack_pointer += 1;
@ -1299,7 +1302,7 @@
case _MATCH_SEQUENCE: { case _MATCH_SEQUENCE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[0] = res; stack_pointer[0] = res;
stack_pointer += 1; stack_pointer += 1;
@ -1308,7 +1311,7 @@
case _MATCH_KEYS: { case _MATCH_KEYS: {
_Py_UopsSymbol *values_or_none; _Py_UopsSymbol *values_or_none;
values_or_none = sym_new_unknown(ctx); values_or_none = sym_new_not_null(ctx);
if (values_or_none == NULL) goto out_of_space; if (values_or_none == NULL) goto out_of_space;
stack_pointer[0] = values_or_none; stack_pointer[0] = values_or_none;
stack_pointer += 1; stack_pointer += 1;
@ -1317,7 +1320,7 @@
case _GET_ITER: { case _GET_ITER: {
_Py_UopsSymbol *iter; _Py_UopsSymbol *iter;
iter = sym_new_unknown(ctx); iter = sym_new_not_null(ctx);
if (iter == NULL) goto out_of_space; if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter; stack_pointer[-1] = iter;
break; break;
@ -1325,7 +1328,7 @@
case _GET_YIELD_FROM_ITER: { case _GET_YIELD_FROM_ITER: {
_Py_UopsSymbol *iter; _Py_UopsSymbol *iter;
iter = sym_new_unknown(ctx); iter = sym_new_not_null(ctx);
if (iter == NULL) goto out_of_space; if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter; stack_pointer[-1] = iter;
break; break;
@ -1335,7 +1338,7 @@
case _FOR_ITER_TIER_TWO: { case _FOR_ITER_TIER_TWO: {
_Py_UopsSymbol *next; _Py_UopsSymbol *next;
next = sym_new_unknown(ctx); next = sym_new_not_null(ctx);
if (next == NULL) goto out_of_space; if (next == NULL) goto out_of_space;
stack_pointer[0] = next; stack_pointer[0] = next;
stack_pointer += 1; stack_pointer += 1;
@ -1356,7 +1359,7 @@
case _ITER_NEXT_LIST: { case _ITER_NEXT_LIST: {
_Py_UopsSymbol *next; _Py_UopsSymbol *next;
next = sym_new_unknown(ctx); next = sym_new_not_null(ctx);
if (next == NULL) goto out_of_space; if (next == NULL) goto out_of_space;
stack_pointer[0] = next; stack_pointer[0] = next;
stack_pointer += 1; stack_pointer += 1;
@ -1375,7 +1378,7 @@
case _ITER_NEXT_TUPLE: { case _ITER_NEXT_TUPLE: {
_Py_UopsSymbol *next; _Py_UopsSymbol *next;
next = sym_new_unknown(ctx); next = sym_new_not_null(ctx);
if (next == NULL) goto out_of_space; if (next == NULL) goto out_of_space;
stack_pointer[0] = next; stack_pointer[0] = next;
stack_pointer += 1; stack_pointer += 1;
@ -1408,9 +1411,9 @@
case _BEFORE_ASYNC_WITH: { case _BEFORE_ASYNC_WITH: {
_Py_UopsSymbol *exit; _Py_UopsSymbol *exit;
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
exit = sym_new_unknown(ctx); exit = sym_new_not_null(ctx);
if (exit == NULL) goto out_of_space; if (exit == NULL) goto out_of_space;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = exit; stack_pointer[-1] = exit;
stack_pointer[0] = res; stack_pointer[0] = res;
@ -1421,9 +1424,9 @@
case _BEFORE_WITH: { case _BEFORE_WITH: {
_Py_UopsSymbol *exit; _Py_UopsSymbol *exit;
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
exit = sym_new_unknown(ctx); exit = sym_new_not_null(ctx);
if (exit == NULL) goto out_of_space; if (exit == NULL) goto out_of_space;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = exit; stack_pointer[-1] = exit;
stack_pointer[0] = res; stack_pointer[0] = res;
@ -1433,7 +1436,7 @@
case _WITH_EXCEPT_START: { case _WITH_EXCEPT_START: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[0] = res; stack_pointer[0] = res;
stack_pointer += 1; stack_pointer += 1;
@ -1443,9 +1446,9 @@
case _PUSH_EXC_INFO: { case _PUSH_EXC_INFO: {
_Py_UopsSymbol *prev_exc; _Py_UopsSymbol *prev_exc;
_Py_UopsSymbol *new_exc; _Py_UopsSymbol *new_exc;
prev_exc = sym_new_unknown(ctx); prev_exc = sym_new_not_null(ctx);
if (prev_exc == NULL) goto out_of_space; if (prev_exc == NULL) goto out_of_space;
new_exc = sym_new_unknown(ctx); new_exc = sym_new_not_null(ctx);
if (new_exc == NULL) goto out_of_space; if (new_exc == NULL) goto out_of_space;
stack_pointer[-1] = prev_exc; stack_pointer[-1] = prev_exc;
stack_pointer[0] = new_exc; stack_pointer[0] = new_exc;
@ -1493,7 +1496,7 @@
case _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES: { case _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES: {
_Py_UopsSymbol *attr; _Py_UopsSymbol *attr;
attr = sym_new_unknown(ctx); attr = sym_new_not_null(ctx);
if (attr == NULL) goto out_of_space; if (attr == NULL) goto out_of_space;
stack_pointer[-1] = attr; stack_pointer[-1] = attr;
break; break;
@ -1501,7 +1504,7 @@
case _LOAD_ATTR_NONDESCRIPTOR_NO_DICT: { case _LOAD_ATTR_NONDESCRIPTOR_NO_DICT: {
_Py_UopsSymbol *attr; _Py_UopsSymbol *attr;
attr = sym_new_unknown(ctx); attr = sym_new_not_null(ctx);
if (attr == NULL) goto out_of_space; if (attr == NULL) goto out_of_space;
stack_pointer[-1] = attr; stack_pointer[-1] = attr;
break; break;
@ -1632,7 +1635,7 @@
case _CALL_TYPE_1: { case _CALL_TYPE_1: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-3] = res; stack_pointer[-3] = res;
stack_pointer += -2; stack_pointer += -2;
@ -1641,7 +1644,7 @@
case _CALL_STR_1: { case _CALL_STR_1: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-3] = res; stack_pointer[-3] = res;
stack_pointer += -2; stack_pointer += -2;
@ -1650,7 +1653,7 @@
case _CALL_TUPLE_1: { case _CALL_TUPLE_1: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-3] = res; stack_pointer[-3] = res;
stack_pointer += -2; stack_pointer += -2;
@ -1666,7 +1669,7 @@
case _CALL_BUILTIN_CLASS: { case _CALL_BUILTIN_CLASS: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1675,7 +1678,7 @@
case _CALL_BUILTIN_O: { case _CALL_BUILTIN_O: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1684,7 +1687,7 @@
case _CALL_BUILTIN_FAST: { case _CALL_BUILTIN_FAST: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1693,7 +1696,7 @@
case _CALL_BUILTIN_FAST_WITH_KEYWORDS: { case _CALL_BUILTIN_FAST_WITH_KEYWORDS: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1702,7 +1705,7 @@
case _CALL_LEN: { case _CALL_LEN: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1711,7 +1714,7 @@
case _CALL_ISINSTANCE: { case _CALL_ISINSTANCE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1720,7 +1723,7 @@
case _CALL_METHOD_DESCRIPTOR_O: { case _CALL_METHOD_DESCRIPTOR_O: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1729,7 +1732,7 @@
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: { case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1738,7 +1741,7 @@
case _CALL_METHOD_DESCRIPTOR_NOARGS: { case _CALL_METHOD_DESCRIPTOR_NOARGS: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1747,7 +1750,7 @@
case _CALL_METHOD_DESCRIPTOR_FAST: { case _CALL_METHOD_DESCRIPTOR_FAST: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res; stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg; stack_pointer += -1 - oparg;
@ -1764,7 +1767,7 @@
case _MAKE_FUNCTION: { case _MAKE_FUNCTION: {
_Py_UopsSymbol *func; _Py_UopsSymbol *func;
func = sym_new_unknown(ctx); func = sym_new_not_null(ctx);
if (func == NULL) goto out_of_space; if (func == NULL) goto out_of_space;
stack_pointer[-1] = func; stack_pointer[-1] = func;
break; break;
@ -1772,7 +1775,7 @@
case _SET_FUNCTION_ATTRIBUTE: { case _SET_FUNCTION_ATTRIBUTE: {
_Py_UopsSymbol *func; _Py_UopsSymbol *func;
func = sym_new_unknown(ctx); func = sym_new_not_null(ctx);
if (func == NULL) goto out_of_space; if (func == NULL) goto out_of_space;
stack_pointer[-2] = func; stack_pointer[-2] = func;
stack_pointer += -1; stack_pointer += -1;
@ -1781,7 +1784,7 @@
case _BUILD_SLICE: { case _BUILD_SLICE: {
_Py_UopsSymbol *slice; _Py_UopsSymbol *slice;
slice = sym_new_unknown(ctx); slice = sym_new_not_null(ctx);
if (slice == NULL) goto out_of_space; if (slice == NULL) goto out_of_space;
stack_pointer[-2 - ((oparg == 3) ? 1 : 0)] = slice; stack_pointer[-2 - ((oparg == 3) ? 1 : 0)] = slice;
stack_pointer += -1 - ((oparg == 3) ? 1 : 0); stack_pointer += -1 - ((oparg == 3) ? 1 : 0);
@ -1790,7 +1793,7 @@
case _CONVERT_VALUE: { case _CONVERT_VALUE: {
_Py_UopsSymbol *result; _Py_UopsSymbol *result;
result = sym_new_unknown(ctx); result = sym_new_not_null(ctx);
if (result == NULL) goto out_of_space; if (result == NULL) goto out_of_space;
stack_pointer[-1] = result; stack_pointer[-1] = result;
break; break;
@ -1798,7 +1801,7 @@
case _FORMAT_SIMPLE: { case _FORMAT_SIMPLE: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-1] = res; stack_pointer[-1] = res;
break; break;
@ -1806,7 +1809,7 @@
case _FORMAT_WITH_SPEC: { case _FORMAT_WITH_SPEC: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -1826,7 +1829,7 @@
case _BINARY_OP: { case _BINARY_OP: {
_Py_UopsSymbol *res; _Py_UopsSymbol *res;
res = sym_new_unknown(ctx); res = sym_new_not_null(ctx);
if (res == NULL) goto out_of_space; if (res == NULL) goto out_of_space;
stack_pointer[-2] = res; stack_pointer[-2] = res;
stack_pointer += -1; stack_pointer += -1;
@ -1953,7 +1956,7 @@
case _POP_TOP_LOAD_CONST_INLINE_BORROW: { case _POP_TOP_LOAD_CONST_INLINE_BORROW: {
_Py_UopsSymbol *value; _Py_UopsSymbol *value;
value = sym_new_unknown(ctx); value = sym_new_not_null(ctx);
if (value == NULL) goto out_of_space; if (value == NULL) goto out_of_space;
stack_pointer[-1] = value; stack_pointer[-1] = value;
break; break;

View File

@ -83,14 +83,14 @@ def emit_default(out: CWriter, uop: Uop) -> None:
if var.name != "unused" and not var.peek: if var.name != "unused" and not var.peek:
if var.is_array(): if var.is_array():
out.emit(f"for (int _i = {var.size}; --_i >= 0;) {{\n") out.emit(f"for (int _i = {var.size}; --_i >= 0;) {{\n")
out.emit(f"{var.name}[_i] = sym_new_unknown(ctx);\n") out.emit(f"{var.name}[_i] = sym_new_not_null(ctx);\n")
out.emit(f"if ({var.name}[_i] == NULL) goto out_of_space;\n") out.emit(f"if ({var.name}[_i] == NULL) goto out_of_space;\n")
out.emit("}\n") out.emit("}\n")
elif var.name == "null": elif var.name == "null":
out.emit(f"{var.name} = sym_new_null(ctx);\n") out.emit(f"{var.name} = sym_new_null(ctx);\n")
out.emit(f"if ({var.name} == NULL) goto out_of_space;\n") out.emit(f"if ({var.name} == NULL) goto out_of_space;\n")
else: else:
out.emit(f"{var.name} = sym_new_unknown(ctx);\n") out.emit(f"{var.name} = sym_new_not_null(ctx);\n")
out.emit(f"if ({var.name} == NULL) goto out_of_space;\n") out.emit(f"if ({var.name} == NULL) goto out_of_space;\n")