Skip to content

Commit 89f94b5

Browse files
committed
py: Rename mp_exc_stack to mp_exc_stack_t.
1 parent d7592a1 commit 89f94b5

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

py/bc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ typedef struct _mp_exc_stack {
1414
// We might only have 2 interesting cases here: SETUP_EXCEPT & SETUP_FINALLY,
1515
// consider storing it in bit 1 of val_sp. TODO: SETUP_WITH?
1616
byte opcode;
17-
} mp_exc_stack;
17+
} mp_exc_stack_t;
1818

1919
mp_vm_return_kind_t mp_execute_byte_code(const byte *code, const mp_obj_t *args, uint n_args, const mp_obj_t *args2, uint n_args2, mp_obj_t *ret);
20-
mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out, mp_exc_stack *exc_stack, mp_exc_stack **exc_sp_in_out, volatile mp_obj_t inject_exc);
20+
mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out, mp_obj_t *fastn, mp_obj_t **sp_in_out, mp_exc_stack_t *exc_stack, mp_exc_stack_t **exc_sp_in_out, volatile mp_obj_t inject_exc);
2121
void mp_byte_code_print(const byte *code, int len);
2222

2323
// Helper macros to access pointer with least significant bit holding a flag

py/objgenerator.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ typedef struct _mp_obj_gen_instance_t {
5858
const byte *ip;
5959
mp_obj_t *sp;
6060
// bit 0 is saved currently_in_except_block value
61-
mp_exc_stack *exc_sp;
61+
mp_exc_stack_t *exc_sp;
6262
uint n_state;
6363
// Variable-length
6464
mp_obj_t state[0];
6565
// Variable-length, never accessed by name, only as (void*)(state + n_state)
66-
mp_exc_stack exc_state[0];
66+
mp_exc_stack_t exc_state[0];
6767
} mp_obj_gen_instance_t;
6868

6969
void gen_instance_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
@@ -88,7 +88,7 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_
8888
*self->sp = send_value;
8989
}
9090
mp_vm_return_kind_t ret_kind = mp_execute_byte_code_2(self->code_info, &self->ip,
91-
&self->state[self->n_state - 1], &self->sp, (mp_exc_stack*)(self->state + self->n_state),
91+
&self->state[self->n_state - 1], &self->sp, (mp_exc_stack_t*)(self->state + self->n_state),
9292
&self->exc_sp, throw_value);
9393

9494
switch (ret_kind) {
@@ -226,12 +226,12 @@ mp_obj_t mp_obj_new_gen_instance(const byte *bytecode, int n_args, const mp_obj_
226226
assert(bytecode[0] == 0);
227227
bytecode += 1;
228228

229-
mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack));
229+
mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t));
230230
o->base.type = &mp_type_gen_instance;
231231
o->code_info = bytecode;
232232
o->ip = bytecode;
233233
o->sp = &o->state[0] - 1; // sp points to top of stack, which starts off 1 below the state
234-
o->exc_sp = (mp_exc_stack*)(o->state + n_state) - 1;
234+
o->exc_sp = (mp_exc_stack_t*)(o->state + n_state) - 1;
235235
o->n_state = n_state;
236236

237237
// copy args to end of state array, in reverse (that's how mp_execute_byte_code_2 needs it)

py/vm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ mp_vm_return_kind_t mp_execute_byte_code(const byte *code, const mp_obj_t *args,
7979
mp_obj_t *sp = &state[0] - 1;
8080

8181
// allocate state for exceptions
82-
mp_exc_stack exc_state[4];
83-
mp_exc_stack *exc_stack = &exc_state[0];
82+
mp_exc_stack_t exc_state[4];
83+
mp_exc_stack_t *exc_stack = &exc_state[0];
8484
if (n_exc_stack > 4) {
85-
exc_stack = m_new(mp_exc_stack, n_exc_stack);
85+
exc_stack = m_new(mp_exc_stack_t, n_exc_stack);
8686
}
87-
mp_exc_stack *exc_sp = &exc_stack[0] - 1;
87+
mp_exc_stack_t *exc_sp = &exc_stack[0] - 1;
8888

8989
// init args
9090
for (uint i = 0; i < n_args; i++) {
@@ -130,7 +130,7 @@ mp_vm_return_kind_t mp_execute_byte_code(const byte *code, const mp_obj_t *args,
130130
// MP_VM_RETURN_EXCEPTION, exception in fastn[0]
131131
mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **ip_in_out,
132132
mp_obj_t *fastn, mp_obj_t **sp_in_out,
133-
mp_exc_stack *exc_stack, mp_exc_stack **exc_sp_in_out,
133+
mp_exc_stack_t *exc_stack, mp_exc_stack_t **exc_sp_in_out,
134134
volatile mp_obj_t inject_exc) {
135135
// careful: be sure to declare volatile any variables read in the exception handler (written is ok, I think)
136136

@@ -142,7 +142,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
142142
nlr_buf_t nlr;
143143

144144
volatile bool currently_in_except_block = MP_TAGPTR_TAG(*exc_sp_in_out); // 0 or 1, to detect nested exceptions
145-
mp_exc_stack *volatile exc_sp = MP_TAGPTR_PTR(*exc_sp_in_out); // stack grows up, exc_sp points to top of stack
145+
mp_exc_stack_t *volatile exc_sp = MP_TAGPTR_PTR(*exc_sp_in_out); // stack grows up, exc_sp points to top of stack
146146
const byte *volatile save_ip = ip; // this is so we can access ip in the exception handler without making ip volatile (which means the compiler can't keep it in a register in the main loop)
147147

148148
// outer exception handling loop
@@ -702,7 +702,7 @@ mp_vm_return_kind_t mp_execute_byte_code_2(const byte *code_info, const byte **i
702702
if (unum == 0) {
703703
// search for the inner-most previous exception, to reraise it
704704
obj1 = MP_OBJ_NULL;
705-
for (mp_exc_stack *e = exc_sp; e >= exc_stack; e--) {
705+
for (mp_exc_stack_t *e = exc_sp; e >= exc_stack; e--) {
706706
if (e->prev_exc != MP_OBJ_NULL) {
707707
obj1 = e->prev_exc;
708708
break;

0 commit comments

Comments
 (0)