cpython/Python/tier2_redundancy_eliminator...

1756 lines
51 KiB
C
Raw Normal View History

// This file is generated by Tools/cases_generator/tier2_abstract_generator.py
// from:
// Python/tier2_redundancy_eliminator_bytecodes.c
// Do not edit!
case _NOP: {
break;
}
case _RESUME_CHECK: {
break;
}
/* _INSTRUMENTED_RESUME is not a viable micro-op for tier 2 */
case _LOAD_FAST_CHECK: {
_Py_UOpsSymType *value;
value = GETLOCAL(oparg);
// We guarantee this will error - just bail and don't optimize it.
if (sym_is_null(value)) {
goto out_of_space;
}
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_FAST: {
_Py_UOpsSymType *value;
value = GETLOCAL(oparg);
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_FAST_AND_CLEAR: {
_Py_UOpsSymType *value;
value = GETLOCAL(oparg);
_Py_UOpsSymType *temp;
OUT_OF_SPACE_IF_NULL(temp = sym_new_null(ctx));
GETLOCAL(oparg) = temp;
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_CONST: {
_Py_UOpsSymType *value;
// There should be no LOAD_CONST. It should be all
// replaced by peephole_opt.
Py_UNREACHABLE();
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _STORE_FAST: {
_Py_UOpsSymType *value;
value = stack_pointer[-1];
GETLOCAL(oparg) = value;
stack_pointer += -1;
break;
}
case _POP_TOP: {
stack_pointer += -1;
break;
}
case _PUSH_NULL: {
_Py_UOpsSymType *res;
res = sym_new_null(ctx);
if (res == NULL) {
goto out_of_space;
};
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _END_SEND: {
_Py_UOpsSymType *value;
value = sym_new_unknown(ctx);
if (value == NULL) goto out_of_space;
stack_pointer[-2] = value;
stack_pointer += -1;
break;
}
case _UNARY_NEGATIVE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _UNARY_NOT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL_BOOL: {
break;
}
case _TO_BOOL_INT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL_LIST: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL_NONE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL_STR: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _TO_BOOL_ALWAYS_TRUE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _UNARY_INVERT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _GUARD_BOTH_INT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (sym_matches_type(left, &PyLong_Type) &&
sym_matches_type(right, &PyLong_Type)) {
REPLACE_OP(this_instr, _NOP, 0, 0);
}
sym_set_type(left, &PyLong_Type);
sym_set_type(right, &PyLong_Type);
break;
}
case _BINARY_OP_MULTIPLY_INT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyLong_CheckExact(get_const(left)));
assert(PyLong_CheckExact(get_const(right)));
PyObject *temp = _PyLong_Multiply((PyLongObject *)get_const(left),
(PyLongObject *)get_const(right));
if (temp == NULL) {
goto error;
}
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyLong_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_OP_ADD_INT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyLong_CheckExact(get_const(left)));
assert(PyLong_CheckExact(get_const(right)));
PyObject *temp = _PyLong_Add((PyLongObject *)get_const(left),
(PyLongObject *)get_const(right));
if (temp == NULL) {
goto error;
}
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyLong_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_OP_SUBTRACT_INT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyLong_CheckExact(get_const(left)));
assert(PyLong_CheckExact(get_const(right)));
PyObject *temp = _PyLong_Subtract((PyLongObject *)get_const(left),
(PyLongObject *)get_const(right));
if (temp == NULL) {
goto error;
}
OUT_OF_SPACE_IF_NULL(res = sym_new_const(ctx, temp));
// TODO gh-115506:
// replace opcode with constant propagated one and add tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyLong_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _GUARD_BOTH_FLOAT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (sym_matches_type(left, &PyFloat_Type) &&
sym_matches_type(right, &PyFloat_Type)) {
REPLACE_OP(this_instr, _NOP, 0 ,0);
}
sym_set_type(left, &PyFloat_Type);
sym_set_type(right, &PyFloat_Type);
break;
}
case _BINARY_OP_MULTIPLY_FLOAT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyFloat_CheckExact(get_const(left)));
assert(PyFloat_CheckExact(get_const(right)));
PyObject *temp = PyFloat_FromDouble(
PyFloat_AS_DOUBLE(get_const(left)) *
PyFloat_AS_DOUBLE(get_const(right)));
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyFloat_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_OP_ADD_FLOAT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyFloat_CheckExact(get_const(left)));
assert(PyFloat_CheckExact(get_const(right)));
PyObject *temp = PyFloat_FromDouble(
PyFloat_AS_DOUBLE(get_const(left)) +
PyFloat_AS_DOUBLE(get_const(right)));
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyFloat_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_OP_SUBTRACT_FLOAT: {
_Py_UOpsSymType *right;
_Py_UOpsSymType *left;
_Py_UOpsSymType *res;
right = stack_pointer[-1];
left = stack_pointer[-2];
if (is_const(left) && is_const(right)) {
assert(PyFloat_CheckExact(get_const(left)));
assert(PyFloat_CheckExact(get_const(right)));
PyObject *temp = PyFloat_FromDouble(
PyFloat_AS_DOUBLE(get_const(left)) -
PyFloat_AS_DOUBLE(get_const(right)));
if (temp == NULL) {
goto error;
}
res = sym_new_const(ctx, temp);
// TODO gh-115506:
// replace opcode with constant propagated one and update tests!
}
else {
OUT_OF_SPACE_IF_NULL(res = sym_new_known_type(ctx, &PyFloat_Type));
}
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _GUARD_BOTH_UNICODE: {
break;
}
case _BINARY_OP_ADD_UNICODE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_SUBSCR: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_SLICE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-3] = res;
stack_pointer += -2;
break;
}
case _STORE_SLICE: {
stack_pointer += -4;
break;
}
case _BINARY_SUBSCR_LIST_INT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_SUBSCR_STR_INT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_SUBSCR_TUPLE_INT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _BINARY_SUBSCR_DICT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
/* _BINARY_SUBSCR_GETITEM is not a viable micro-op for tier 2 */
case _LIST_APPEND: {
stack_pointer += -1;
break;
}
case _SET_ADD: {
stack_pointer += -1;
break;
}
case _STORE_SUBSCR: {
stack_pointer += -3;
break;
}
case _STORE_SUBSCR_LIST_INT: {
stack_pointer += -3;
break;
}
case _STORE_SUBSCR_DICT: {
stack_pointer += -3;
break;
}
case _DELETE_SUBSCR: {
stack_pointer += -2;
break;
}
case _CALL_INTRINSIC_1: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _CALL_INTRINSIC_2: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _POP_FRAME: {
_Py_UOpsSymType *retval;
_Py_UOpsSymType *res;
retval = stack_pointer[-1];
stack_pointer += -1;
ctx->frame->stack_pointer = stack_pointer;
ctx_frame_pop(ctx);
stack_pointer = ctx->frame->stack_pointer;
res = retval;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
/* _INSTRUMENTED_RETURN_VALUE is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_RETURN_CONST is not a viable micro-op for tier 2 */
case _GET_AITER: {
_Py_UOpsSymType *iter;
iter = sym_new_unknown(ctx);
if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter;
break;
}
case _GET_ANEXT: {
_Py_UOpsSymType *awaitable;
awaitable = sym_new_unknown(ctx);
if (awaitable == NULL) goto out_of_space;
stack_pointer[0] = awaitable;
stack_pointer += 1;
break;
}
case _GET_AWAITABLE: {
_Py_UOpsSymType *iter;
iter = sym_new_unknown(ctx);
if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter;
break;
}
/* _SEND is not a viable micro-op for tier 2 */
/* _SEND_GEN is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_YIELD_VALUE is not a viable micro-op for tier 2 */
case _POP_EXCEPT: {
stack_pointer += -1;
break;
}
case _LOAD_ASSERTION_ERROR: {
_Py_UOpsSymType *value;
value = sym_new_unknown(ctx);
if (value == NULL) goto out_of_space;
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_BUILD_CLASS: {
_Py_UOpsSymType *bc;
bc = sym_new_unknown(ctx);
if (bc == NULL) goto out_of_space;
stack_pointer[0] = bc;
stack_pointer += 1;
break;
}
case _STORE_NAME: {
stack_pointer += -1;
break;
}
case _DELETE_NAME: {
break;
}
case _UNPACK_SEQUENCE: {
_Py_UOpsSymType *seq;
_Py_UOpsSymType **values;
seq = stack_pointer[-1];
values = &stack_pointer[-1];
/* This has to be done manually */
(void)seq;
for (int i = 0; i < oparg; i++) {
OUT_OF_SPACE_IF_NULL(values[i] = sym_new_unknown(ctx));
}
stack_pointer += -1 + oparg;
break;
}
case _UNPACK_SEQUENCE_TWO_TUPLE: {
_Py_UOpsSymType **values;
values = &stack_pointer[-1];
for (int _i = oparg; --_i >= 0;) {
values[_i] = sym_new_unknown(ctx);
if (values[_i] == NULL) goto out_of_space;
}
stack_pointer += -1 + oparg;
break;
}
case _UNPACK_SEQUENCE_TUPLE: {
_Py_UOpsSymType **values;
values = &stack_pointer[-1];
for (int _i = oparg; --_i >= 0;) {
values[_i] = sym_new_unknown(ctx);
if (values[_i] == NULL) goto out_of_space;
}
stack_pointer += -1 + oparg;
break;
}
case _UNPACK_SEQUENCE_LIST: {
_Py_UOpsSymType **values;
values = &stack_pointer[-1];
for (int _i = oparg; --_i >= 0;) {
values[_i] = sym_new_unknown(ctx);
if (values[_i] == NULL) goto out_of_space;
}
stack_pointer += -1 + oparg;
break;
}
case _UNPACK_EX: {
_Py_UOpsSymType *seq;
_Py_UOpsSymType **values;
seq = stack_pointer[-1];
values = &stack_pointer[-1];
/* This has to be done manually */
(void)seq;
int totalargs = (oparg & 0xFF) + (oparg >> 8) + 1;
for (int i = 0; i < totalargs; i++) {
OUT_OF_SPACE_IF_NULL(values[i] = sym_new_unknown(ctx));
}
stack_pointer += (oparg >> 8) + (oparg & 0xFF);
break;
}
case _STORE_ATTR: {
stack_pointer += -2;
break;
}
case _DELETE_ATTR: {
stack_pointer += -1;
break;
}
case _STORE_GLOBAL: {
stack_pointer += -1;
break;
}
case _DELETE_GLOBAL: {
break;
}
case _LOAD_LOCALS: {
_Py_UOpsSymType *locals;
locals = sym_new_unknown(ctx);
if (locals == NULL) goto out_of_space;
stack_pointer[0] = locals;
stack_pointer += 1;
break;
}
case _LOAD_FROM_DICT_OR_GLOBALS: {
_Py_UOpsSymType *v;
v = sym_new_unknown(ctx);
if (v == NULL) goto out_of_space;
stack_pointer[-1] = v;
break;
}
case _LOAD_NAME: {
_Py_UOpsSymType *v;
v = sym_new_unknown(ctx);
if (v == NULL) goto out_of_space;
stack_pointer[0] = v;
stack_pointer += 1;
break;
}
case _LOAD_GLOBAL: {
_Py_UOpsSymType *res;
_Py_UOpsSymType *null = NULL;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
null = sym_new_null(ctx);
if (null == NULL) goto out_of_space;
stack_pointer[0] = res;
if (oparg & 1) stack_pointer[1] = null;
stack_pointer += 1 + (oparg & 1);
break;
}
case _GUARD_GLOBALS_VERSION: {
break;
}
case _GUARD_BUILTINS_VERSION: {
break;
}
case _LOAD_GLOBAL_MODULE: {
_Py_UOpsSymType *res;
_Py_UOpsSymType *null = NULL;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
null = sym_new_null(ctx);
if (null == NULL) goto out_of_space;
stack_pointer[0] = res;
if (oparg & 1) stack_pointer[1] = null;
stack_pointer += 1 + (oparg & 1);
break;
}
case _LOAD_GLOBAL_BUILTINS: {
_Py_UOpsSymType *res;
_Py_UOpsSymType *null = NULL;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
null = sym_new_null(ctx);
if (null == NULL) goto out_of_space;
stack_pointer[0] = res;
if (oparg & 1) stack_pointer[1] = null;
stack_pointer += 1 + (oparg & 1);
break;
}
case _DELETE_FAST: {
break;
}
case _MAKE_CELL: {
break;
}
case _DELETE_DEREF: {
break;
}
case _LOAD_FROM_DICT_OR_DEREF: {
_Py_UOpsSymType *value;
value = sym_new_unknown(ctx);
if (value == NULL) goto out_of_space;
stack_pointer[-1] = value;
break;
}
case _LOAD_DEREF: {
_Py_UOpsSymType *value;
value = sym_new_unknown(ctx);
if (value == NULL) goto out_of_space;
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _STORE_DEREF: {
stack_pointer += -1;
break;
}
case _COPY_FREE_VARS: {
break;
}
case _BUILD_STRING: {
_Py_UOpsSymType *str;
str = sym_new_unknown(ctx);
if (str == NULL) goto out_of_space;
stack_pointer[-oparg] = str;
stack_pointer += 1 - oparg;
break;
}
case _BUILD_TUPLE: {
_Py_UOpsSymType *tup;
tup = sym_new_unknown(ctx);
if (tup == NULL) goto out_of_space;
stack_pointer[-oparg] = tup;
stack_pointer += 1 - oparg;
break;
}
case _BUILD_LIST: {
_Py_UOpsSymType *list;
list = sym_new_unknown(ctx);
if (list == NULL) goto out_of_space;
stack_pointer[-oparg] = list;
stack_pointer += 1 - oparg;
break;
}
case _LIST_EXTEND: {
stack_pointer += -1;
break;
}
case _SET_UPDATE: {
stack_pointer += -1;
break;
}
case _BUILD_SET: {
_Py_UOpsSymType *set;
set = sym_new_unknown(ctx);
if (set == NULL) goto out_of_space;
stack_pointer[-oparg] = set;
stack_pointer += 1 - oparg;
break;
}
case _BUILD_MAP: {
_Py_UOpsSymType *map;
map = sym_new_unknown(ctx);
if (map == NULL) goto out_of_space;
stack_pointer[-oparg*2] = map;
stack_pointer += 1 - oparg*2;
break;
}
case _SETUP_ANNOTATIONS: {
break;
}
case _BUILD_CONST_KEY_MAP: {
_Py_UOpsSymType *map;
map = sym_new_unknown(ctx);
if (map == NULL) goto out_of_space;
stack_pointer[-1 - oparg] = map;
stack_pointer += -oparg;
break;
}
case _DICT_UPDATE: {
stack_pointer += -1;
break;
}
case _DICT_MERGE: {
stack_pointer += -1;
break;
}
case _MAP_ADD: {
stack_pointer += -2;
break;
}
/* _INSTRUMENTED_LOAD_SUPER_ATTR is not a viable micro-op for tier 2 */
case _LOAD_SUPER_ATTR_ATTR: {
_Py_UOpsSymType *attr;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
stack_pointer[-3] = attr;
stack_pointer += -2 + ((0) ? 1 : 0);
break;
}
case _LOAD_SUPER_ATTR_METHOD: {
_Py_UOpsSymType *attr;
_Py_UOpsSymType *self_or_null;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
self_or_null = sym_new_unknown(ctx);
if (self_or_null == NULL) goto out_of_space;
stack_pointer[-3] = attr;
stack_pointer[-2] = self_or_null;
stack_pointer += -1;
break;
}
case _LOAD_ATTR: {
_Py_UOpsSymType *attr;
_Py_UOpsSymType *self_or_null = NULL;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
self_or_null = sym_new_unknown(ctx);
if (self_or_null == NULL) goto out_of_space;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = self_or_null;
stack_pointer += (oparg & 1);
break;
}
case _GUARD_TYPE_VERSION: {
break;
}
case _CHECK_MANAGED_OBJECT_HAS_VALUES: {
break;
}
case _LOAD_ATTR_INSTANCE_VALUE: {
_Py_UOpsSymType *owner;
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = null;
stack_pointer += (oparg & 1);
break;
}
case _CHECK_ATTR_MODULE: {
break;
}
case _LOAD_ATTR_MODULE: {
_Py_UOpsSymType *owner;
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = null;
stack_pointer += (oparg & 1);
break;
}
case _CHECK_ATTR_WITH_HINT: {
break;
}
case _LOAD_ATTR_WITH_HINT: {
_Py_UOpsSymType *owner;
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t hint = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)hint;
(void)owner;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = null;
stack_pointer += (oparg & 1);
break;
}
case _LOAD_ATTR_SLOT: {
_Py_UOpsSymType *owner;
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
uint16_t index = (uint16_t)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)index;
(void)owner;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = null;
stack_pointer += (oparg & 1);
break;
}
case _CHECK_ATTR_CLASS: {
break;
}
case _LOAD_ATTR_CLASS: {
_Py_UOpsSymType *owner;
_Py_UOpsSymType *attr;
_Py_UOpsSymType *null = NULL;
owner = stack_pointer[-1];
PyObject *descr = (PyObject *)this_instr->operand;
_LOAD_ATTR_NOT_NULL
(void)descr;
(void)owner;
stack_pointer[-1] = attr;
if (oparg & 1) stack_pointer[0] = null;
stack_pointer += (oparg & 1);
break;
}
/* _LOAD_ATTR_PROPERTY is not a viable micro-op for tier 2 */
/* _LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN is not a viable micro-op for tier 2 */
case _GUARD_DORV_VALUES: {
break;
}
case _STORE_ATTR_INSTANCE_VALUE: {
stack_pointer += -2;
break;
}
/* _STORE_ATTR_WITH_HINT is not a viable micro-op for tier 2 */
case _STORE_ATTR_SLOT: {
stack_pointer += -2;
break;
}
case _COMPARE_OP: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _COMPARE_OP_FLOAT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _COMPARE_OP_INT: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _COMPARE_OP_STR: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _IS_OP: {
_Py_UOpsSymType *b;
b = sym_new_unknown(ctx);
if (b == NULL) goto out_of_space;
stack_pointer[-2] = b;
stack_pointer += -1;
break;
}
case _CONTAINS_OP: {
_Py_UOpsSymType *b;
b = sym_new_unknown(ctx);
if (b == NULL) goto out_of_space;
stack_pointer[-2] = b;
stack_pointer += -1;
break;
}
case _CHECK_EG_MATCH: {
_Py_UOpsSymType *rest;
_Py_UOpsSymType *match;
rest = sym_new_unknown(ctx);
if (rest == NULL) goto out_of_space;
match = sym_new_unknown(ctx);
if (match == NULL) goto out_of_space;
stack_pointer[-2] = rest;
stack_pointer[-1] = match;
break;
}
case _CHECK_EXC_MATCH: {
_Py_UOpsSymType *b;
b = sym_new_unknown(ctx);
if (b == NULL) goto out_of_space;
stack_pointer[-1] = b;
break;
}
/* _POP_JUMP_IF_FALSE is not a viable micro-op for tier 2 */
/* _POP_JUMP_IF_TRUE is not a viable micro-op for tier 2 */
case _IS_NONE: {
_Py_UOpsSymType *b;
b = sym_new_unknown(ctx);
if (b == NULL) goto out_of_space;
stack_pointer[-1] = b;
break;
}
case _GET_LEN: {
_Py_UOpsSymType *len_o;
len_o = sym_new_unknown(ctx);
if (len_o == NULL) goto out_of_space;
stack_pointer[0] = len_o;
stack_pointer += 1;
break;
}
case _MATCH_CLASS: {
_Py_UOpsSymType *attrs;
attrs = sym_new_unknown(ctx);
if (attrs == NULL) goto out_of_space;
stack_pointer[-3] = attrs;
stack_pointer += -2;
break;
}
case _MATCH_MAPPING: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _MATCH_SEQUENCE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _MATCH_KEYS: {
_Py_UOpsSymType *values_or_none;
values_or_none = sym_new_unknown(ctx);
if (values_or_none == NULL) goto out_of_space;
stack_pointer[0] = values_or_none;
stack_pointer += 1;
break;
}
case _GET_ITER: {
_Py_UOpsSymType *iter;
iter = sym_new_unknown(ctx);
if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter;
break;
}
case _GET_YIELD_FROM_ITER: {
_Py_UOpsSymType *iter;
iter = sym_new_unknown(ctx);
if (iter == NULL) goto out_of_space;
stack_pointer[-1] = iter;
break;
}
/* _FOR_ITER is not a viable micro-op for tier 2 */
case _FOR_ITER_TIER_TWO: {
_Py_UOpsSymType *next;
next = sym_new_unknown(ctx);
if (next == NULL) goto out_of_space;
stack_pointer[0] = next;
stack_pointer += 1;
break;
}
/* _INSTRUMENTED_FOR_ITER is not a viable micro-op for tier 2 */
case _ITER_CHECK_LIST: {
break;
}
/* _ITER_JUMP_LIST is not a viable micro-op for tier 2 */
case _GUARD_NOT_EXHAUSTED_LIST: {
break;
}
case _ITER_NEXT_LIST: {
_Py_UOpsSymType *next;
next = sym_new_unknown(ctx);
if (next == NULL) goto out_of_space;
stack_pointer[0] = next;
stack_pointer += 1;
break;
}
case _ITER_CHECK_TUPLE: {
break;
}
/* _ITER_JUMP_TUPLE is not a viable micro-op for tier 2 */
case _GUARD_NOT_EXHAUSTED_TUPLE: {
break;
}
case _ITER_NEXT_TUPLE: {
_Py_UOpsSymType *next;
next = sym_new_unknown(ctx);
if (next == NULL) goto out_of_space;
stack_pointer[0] = next;
stack_pointer += 1;
break;
}
case _ITER_CHECK_RANGE: {
break;
}
/* _ITER_JUMP_RANGE is not a viable micro-op for tier 2 */
case _GUARD_NOT_EXHAUSTED_RANGE: {
break;
}
case _ITER_NEXT_RANGE: {
_Py_UOpsSymType *iter;
_Py_UOpsSymType *next;
iter = stack_pointer[-1];
OUT_OF_SPACE_IF_NULL(next = sym_new_known_type(ctx, &PyLong_Type));
(void)iter;
stack_pointer[0] = next;
stack_pointer += 1;
break;
}
/* _FOR_ITER_GEN is not a viable micro-op for tier 2 */
case _BEFORE_ASYNC_WITH: {
_Py_UOpsSymType *exit;
_Py_UOpsSymType *res;
exit = sym_new_unknown(ctx);
if (exit == NULL) goto out_of_space;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = exit;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _BEFORE_WITH: {
_Py_UOpsSymType *exit;
_Py_UOpsSymType *res;
exit = sym_new_unknown(ctx);
if (exit == NULL) goto out_of_space;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = exit;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _WITH_EXCEPT_START: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[0] = res;
stack_pointer += 1;
break;
}
case _PUSH_EXC_INFO: {
_Py_UOpsSymType *prev_exc;
_Py_UOpsSymType *new_exc;
prev_exc = sym_new_unknown(ctx);
if (prev_exc == NULL) goto out_of_space;
new_exc = sym_new_unknown(ctx);
if (new_exc == NULL) goto out_of_space;
stack_pointer[-1] = prev_exc;
stack_pointer[0] = new_exc;
stack_pointer += 1;
break;
}
case _GUARD_DORV_VALUES_INST_ATTR_FROM_DICT: {
break;
}
case _GUARD_KEYS_VERSION: {
break;
}
case _LOAD_ATTR_METHOD_WITH_VALUES: {
_Py_UOpsSymType *attr;
_Py_UOpsSymType *self = NULL;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
self = sym_new_unknown(ctx);
if (self == NULL) goto out_of_space;
stack_pointer[-1] = attr;
if (1) stack_pointer[0] = self;
stack_pointer += ((1) ? 1 : 0);
break;
}
case _LOAD_ATTR_METHOD_NO_DICT: {
_Py_UOpsSymType *attr;
_Py_UOpsSymType *self = NULL;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
self = sym_new_unknown(ctx);
if (self == NULL) goto out_of_space;
stack_pointer[-1] = attr;
if (1) stack_pointer[0] = self;
stack_pointer += ((1) ? 1 : 0);
break;
}
case _LOAD_ATTR_NONDESCRIPTOR_WITH_VALUES: {
_Py_UOpsSymType *attr;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
stack_pointer[-1] = attr;
stack_pointer += ((0) ? 1 : 0);
break;
}
case _LOAD_ATTR_NONDESCRIPTOR_NO_DICT: {
_Py_UOpsSymType *attr;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
stack_pointer[-1] = attr;
stack_pointer += ((0) ? 1 : 0);
break;
}
case _CHECK_ATTR_METHOD_LAZY_DICT: {
break;
}
case _LOAD_ATTR_METHOD_LAZY_DICT: {
_Py_UOpsSymType *attr;
_Py_UOpsSymType *self = NULL;
attr = sym_new_unknown(ctx);
if (attr == NULL) goto out_of_space;
self = sym_new_unknown(ctx);
if (self == NULL) goto out_of_space;
stack_pointer[-1] = attr;
if (1) stack_pointer[0] = self;
stack_pointer += ((1) ? 1 : 0);
break;
}
/* _INSTRUMENTED_CALL is not a viable micro-op for tier 2 */
/* _CALL is not a viable micro-op for tier 2 */
case _CHECK_CALL_BOUND_METHOD_EXACT_ARGS: {
_Py_UOpsSymType *null;
_Py_UOpsSymType *callable;
null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
sym_set_null(null);
sym_set_type(callable, &PyMethod_Type);
break;
}
case _INIT_CALL_BOUND_METHOD_EXACT_ARGS: {
_Py_UOpsSymType *func;
_Py_UOpsSymType *self;
func = sym_new_unknown(ctx);
if (func == NULL) goto out_of_space;
self = sym_new_unknown(ctx);
if (self == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = func;
stack_pointer[-1 - oparg] = self;
break;
}
case _CHECK_PEP_523: {
break;
}
case _CHECK_FUNCTION_EXACT_ARGS: {
_Py_UOpsSymType *self_or_null;
_Py_UOpsSymType *callable;
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
uint32_t func_version = (uint32_t)this_instr->operand;
sym_set_type(callable, &PyFunction_Type);
(void)self_or_null;
(void)func_version;
break;
}
case _CHECK_STACK_SPACE: {
break;
}
case _INIT_CALL_PY_EXACT_ARGS: {
_Py_UOpsSymType **args;
_Py_UOpsSymType *self_or_null;
_Py_UOpsSymType *callable;
_Py_UOpsAbstractFrame *new_frame;
args = &stack_pointer[-oparg];
self_or_null = stack_pointer[-1 - oparg];
callable = stack_pointer[-2 - oparg];
int argcount = oparg;
(void)callable;
PyFunctionObject *func = (PyFunctionObject *)(this_instr + 2)->operand;
if (func == NULL) {
goto error;
}
PyCodeObject *co = (PyCodeObject *)func->func_code;
assert(self_or_null != NULL);
assert(args != NULL);
if (sym_is_not_null(self_or_null)) {
// Bound method fiddling, same as _INIT_CALL_PY_EXACT_ARGS in VM
args--;
argcount++;
}
_Py_UOpsSymType **localsplus_start = ctx->n_consumed;
int n_locals_already_filled = 0;
// Can determine statically, so we interleave the new locals
// and make the current stack the new locals.
// This also sets up for true call inlining.
if (sym_is_known(self_or_null)) {
localsplus_start = args;
n_locals_already_filled = argcount;
}
OUT_OF_SPACE_IF_NULL(new_frame =
ctx_frame_new(ctx, co, localsplus_start, n_locals_already_filled, 0));
stack_pointer[-2 - oparg] = (_Py_UOpsSymType *)new_frame;
stack_pointer += -1 - oparg;
break;
}
case _PUSH_FRAME: {
_Py_UOpsAbstractFrame *new_frame;
new_frame = (_Py_UOpsAbstractFrame *)stack_pointer[-1];
stack_pointer += -1;
ctx->frame->stack_pointer = stack_pointer;
ctx->frame = new_frame;
ctx->curr_frame_depth++;
stack_pointer = new_frame->stack_pointer;
stack_pointer += ((0) ? 1 : 0);
break;
}
/* _CALL_PY_WITH_DEFAULTS is not a viable micro-op for tier 2 */
case _CALL_TYPE_1: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_STR_1: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_TUPLE_1: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
/* _CALL_ALLOC_AND_ENTER_INIT is not a viable micro-op for tier 2 */
case _EXIT_INIT_CHECK: {
stack_pointer += -1;
break;
}
case _CALL_BUILTIN_CLASS: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_BUILTIN_O: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_BUILTIN_FAST: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_BUILTIN_FAST_WITH_KEYWORDS: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_LEN: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_ISINSTANCE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_METHOD_DESCRIPTOR_O: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_METHOD_DESCRIPTOR_NOARGS: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
case _CALL_METHOD_DESCRIPTOR_FAST: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2 - oparg] = res;
stack_pointer += -1 - oparg;
break;
}
/* _INSTRUMENTED_CALL_KW is not a viable micro-op for tier 2 */
/* _CALL_KW is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_CALL_FUNCTION_EX is not a viable micro-op for tier 2 */
/* _CALL_FUNCTION_EX is not a viable micro-op for tier 2 */
case _MAKE_FUNCTION: {
_Py_UOpsSymType *func;
func = sym_new_unknown(ctx);
if (func == NULL) goto out_of_space;
stack_pointer[-1] = func;
break;
}
case _SET_FUNCTION_ATTRIBUTE: {
_Py_UOpsSymType *func;
func = sym_new_unknown(ctx);
if (func == NULL) goto out_of_space;
stack_pointer[-2] = func;
stack_pointer += -1;
break;
}
case _BUILD_SLICE: {
_Py_UOpsSymType *slice;
slice = sym_new_unknown(ctx);
if (slice == NULL) goto out_of_space;
stack_pointer[-2 - ((oparg == 3) ? 1 : 0)] = slice;
stack_pointer += -1 - ((oparg == 3) ? 1 : 0);
break;
}
case _CONVERT_VALUE: {
_Py_UOpsSymType *result;
result = sym_new_unknown(ctx);
if (result == NULL) goto out_of_space;
stack_pointer[-1] = result;
break;
}
case _FORMAT_SIMPLE: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-1] = res;
break;
}
case _FORMAT_WITH_SPEC: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _COPY: {
_Py_UOpsSymType *bottom;
_Py_UOpsSymType *top;
bottom = stack_pointer[-1 - (oparg-1)];
assert(oparg > 0);
top = bottom;
stack_pointer[0] = top;
stack_pointer += 1;
break;
}
case _BINARY_OP: {
_Py_UOpsSymType *res;
res = sym_new_unknown(ctx);
if (res == NULL) goto out_of_space;
stack_pointer[-2] = res;
stack_pointer += -1;
break;
}
case _SWAP: {
_Py_UOpsSymType *top;
_Py_UOpsSymType *bottom;
top = stack_pointer[-1];
bottom = stack_pointer[-2 - (oparg-2)];
stack_pointer[-2 - (oparg-2)] = top;
stack_pointer[-1] = bottom;
break;
}
/* _INSTRUMENTED_INSTRUCTION is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_JUMP_FORWARD is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_JUMP_BACKWARD is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_POP_JUMP_IF_TRUE is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_POP_JUMP_IF_FALSE is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_POP_JUMP_IF_NONE is not a viable micro-op for tier 2 */
/* _INSTRUMENTED_POP_JUMP_IF_NOT_NONE is not a viable micro-op for tier 2 */
case _GUARD_IS_TRUE_POP: {
stack_pointer += -1;
break;
}
case _GUARD_IS_FALSE_POP: {
stack_pointer += -1;
break;
}
case _GUARD_IS_NONE_POP: {
stack_pointer += -1;
break;
}
case _GUARD_IS_NOT_NONE_POP: {
stack_pointer += -1;
break;
}
case _JUMP_TO_TOP: {
break;
}
case _SET_IP: {
break;
}
case _SAVE_RETURN_OFFSET: {
break;
}
case _EXIT_TRACE: {
break;
}
case _CHECK_VALIDITY: {
break;
}
case _LOAD_CONST_INLINE: {
_Py_UOpsSymType *value;
PyObject *ptr = (PyObject *)this_instr->operand;
OUT_OF_SPACE_IF_NULL(value = sym_new_const(ctx, ptr));
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_CONST_INLINE_BORROW: {
_Py_UOpsSymType *value;
PyObject *ptr = (PyObject *)this_instr->operand;
OUT_OF_SPACE_IF_NULL(value = sym_new_const(ctx, ptr));
stack_pointer[0] = value;
stack_pointer += 1;
break;
}
case _LOAD_CONST_INLINE_WITH_NULL: {
_Py_UOpsSymType *value;
_Py_UOpsSymType *null;
PyObject *ptr = (PyObject *)this_instr->operand;
OUT_OF_SPACE_IF_NULL(value = sym_new_const(ctx, ptr));
OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx));
stack_pointer[0] = value;
stack_pointer[1] = null;
stack_pointer += 2;
break;
}
case _LOAD_CONST_INLINE_BORROW_WITH_NULL: {
_Py_UOpsSymType *value;
_Py_UOpsSymType *null;
PyObject *ptr = (PyObject *)this_instr->operand;
OUT_OF_SPACE_IF_NULL(value = sym_new_const(ctx, ptr));
OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx));
stack_pointer[0] = value;
stack_pointer[1] = null;
stack_pointer += 2;
break;
}
case _CHECK_GLOBALS: {
break;
}
case _CHECK_BUILTINS: {
break;
}
case _INTERNAL_INCREMENT_OPT_COUNTER: {
stack_pointer += -1;
break;
}
case _COLD_EXIT: {
break;
}
case _START_EXECUTOR: {
break;
}
case _FATAL_ERROR: {
break;
}
case _CHECK_VALIDITY_AND_SET_IP: {
break;
}