[SOLVED]what is sequence of calls to .make_new

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

[SOLVED]what is sequence of calls to .make_new

Post by jickster » Wed Oct 25, 2017 2:52 pm

I'm getting stuck trying to figure out sequence of C-code for when

Code: Select all

make_new
C-code is called for pyb.LED

What's the sequence?

Let's say I have this .py

Code: Select all

ledObj = pyb.LED(1)
Last edited by jickster on Wed Nov 01, 2017 5:58 pm, edited 2 times in total.

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: what is sequence of calls to .make_new

Post by stijn » Thu Oct 26, 2017 8:27 am

pyb.LED has different implementations depending on the port so that varies a bit but in general the call stack up to the call of the function pointed to by make_new (i.e. call to self->make_new(self, n_args, n_kw, args) in objtype.c) is the same and looks like this when creating a new obj from the REPL:

Code: Select all

type_call(void * self_in=0x0f8aeca8, unsigned int n_args=0, unsigned int n_kw=0, void * const * args=0x003ef30c) Line 883
mp_call_function_n_kw(void * fun_in=0x0f8aeca8, unsigned int n_args=0, unsigned int n_kw=0, void * const * args=0x003ef30c) Line 626 
mp_call_method_n_kw(unsigned int n_args=0, unsigned int n_kw=0, void * const * args=0x003ef304) Line 642 
mp_execute_bytecode(_mp_code_state_t * code_state=0x003ef2f0, void * volatile inject_exc=0x00000000) Line 1014 
fun_bc_call(void * self_in=0x005b63a0, unsigned int n_args=0, unsigned int n_kw=0, void * const * args=0x00000000) Line 267
mp_call_function_n_kw(void * fun_in=0x005b63a0, unsigned int n_args=0, unsigned int n_kw=0, void * const * args=0x00000000) Line 626 
mp_call_function_0(void * fun=0x005b63a0) Line 600 
execute_from_lexer(int source_kind=2, const void * source=0x003ef8b0, mp_parse_input_kind_t input_kind=MP_PARSE_SINGLE_INPUT, bool is_repl=true) Line 156
do_repl() Line 270 
main_(int argc=1, char * * argv=0x0051bb20) Line 633 

Post Reply