Skip to content

Commit e2ae03e

Browse files
committed
py/emitnative: Add more DEBUG_printf statements.
Signed-off-by: Damien George <[email protected]>
1 parent c1882e4 commit e2ae03e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

py/emitnative.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,7 @@ static void emit_native_load_attr(emit_t *emit, qstr qst) {
14591459
}
14601460

14611461
static void emit_native_load_method(emit_t *emit, qstr qst, bool is_super) {
1462+
DEBUG_printf("load_method(%s, %d)\n", qstr_str(qst), is_super);
14621463
if (is_super) {
14631464
emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_2, 3); // arg2 = dest ptr
14641465
emit_get_stack_pointer_to_reg_for_push(emit, REG_ARG_2, 2); // arg2 = dest ptr
@@ -2149,6 +2150,7 @@ static void emit_native_setup_with(emit_t *emit, mp_uint_t label) {
21492150
}
21502151

21512152
static void emit_native_setup_block(emit_t *emit, mp_uint_t label, int kind) {
2153+
DEBUG_printf("setup_block(%d, %d)\n", (int)label, kind);
21522154
if (kind == MP_EMIT_SETUP_BLOCK_WITH) {
21532155
emit_native_setup_with(emit, label);
21542156
} else {
@@ -2233,6 +2235,8 @@ static void emit_native_end_finally(emit_t *emit) {
22332235
// if exc == None: pass
22342236
// else: raise exc
22352237
// the check if exc is None is done in the MP_F_NATIVE_RAISE stub
2238+
DEBUG_printf("end_finally\n");
2239+
22362240
emit_native_pre(emit);
22372241
ASM_MOV_REG_LOCAL(emit->as, REG_ARG_1, LOCAL_IDX_EXC_VAL(emit));
22382242
emit_call(emit, MP_F_NATIVE_RAISE);
@@ -2257,6 +2261,8 @@ static void emit_native_get_iter(emit_t *emit, bool use_stack) {
22572261
// perhaps the difficult one, as we want to rewrite for loops using native code
22582262
// in cases where we iterate over a Python object, can we use normal runtime calls?
22592263

2264+
DEBUG_printf("get_iter(%d)\n", use_stack);
2265+
22602266
vtype_kind_t vtype;
22612267
emit_pre_pop_reg(emit, &vtype, REG_ARG_1);
22622268
assert(vtype == VTYPE_PYOBJ);
@@ -2838,6 +2844,7 @@ static void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_u
28382844
}
28392845

28402846
static void emit_native_call_method(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) {
2847+
DEBUG_printf("call_method(%d, %d, %d)\n", n_positional, n_keyword, star_flags);
28412848
if (star_flags) {
28422849
emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 3); // pointer to args
28432850
emit_call_with_2_imm_args(emit, MP_F_CALL_METHOD_N_KW_VAR, 1, REG_ARG_1, n_positional | (n_keyword << 8), REG_ARG_2);
@@ -2904,6 +2911,7 @@ static void emit_native_return_value(emit_t *emit) {
29042911
}
29052912

29062913
static void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
2914+
DEBUG_printf("raise_varargs(%d)\n", n_args);
29072915
(void)n_args;
29082916
assert(n_args == 1);
29092917
vtype_kind_t vtype_exc;
@@ -2919,6 +2927,8 @@ static void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
29192927
static void emit_native_yield(emit_t *emit, int kind) {
29202928
// Note: 1 (yield) or 3 (yield from) labels are reserved for this function, starting at *emit->label_slot
29212929

2930+
DEBUG_printf("yield(%d)\n", kind);
2931+
29222932
if (emit->do_viper_types) {
29232933
mp_raise_NotImplementedError(MP_ERROR_TEXT("native yield"));
29242934
}

0 commit comments

Comments
 (0)