@@ -193,49 +193,6 @@ STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, uint expected, ui
193193#endif
194194}
195195
196- // If it's possible to call a function without allocating new argument array,
197- // this function returns true, together with pointers to 2 subarrays to be used
198- // as arguments. Otherwise, it returns false. It is expected that this function
199- // will be accompanied by another, mp_obj_fun_prepare_full_args(), which will
200- // instead take pointer to full-length out-array, and will fill it in. Rationale
201- // being that a caller can try this function and if it succeeds, the function call
202- // can be made without allocating extra memory. Otherwise, caller can allocate memory
203- // and try "full" function. These functions are expected to be refactoring of
204- // code in fun_bc_call() and eventually replace it.
205- bool mp_obj_fun_prepare_simple_args (mp_obj_t self_in , uint n_args , uint n_kw , const mp_obj_t * args ,
206- uint * out_args1_len , const mp_obj_t * * out_args1 , uint * out_args2_len , const mp_obj_t * * out_args2 ) {
207- mp_obj_fun_bc_t * self = self_in ;
208- DEBUG_printf ("mp_obj_fun_prepare_simple_args: given: %d pos, %d kw, expected: %d pos (%d default)\n" ,
209- n_args , n_kw , self -> n_pos_args , self -> n_def_args );
210-
211- assert (n_kw == 0 );
212- assert (self -> n_kwonly_args == 0 );
213- assert (self -> takes_var_args == 0 );
214- assert (self -> takes_kw_args == 0 );
215-
216- mp_obj_t * extra_args = self -> extra_args + self -> n_def_args ;
217- uint n_extra_args = 0 ;
218-
219- if (n_args > self -> n_pos_args ) {
220- goto arg_error ;
221- } else {
222- if (n_args >= self -> n_pos_args - self -> n_def_args ) {
223- extra_args -= self -> n_pos_args - n_args ;
224- n_extra_args += self -> n_pos_args - n_args ;
225- } else {
226- fun_pos_args_mismatch (self , self -> n_pos_args - self -> n_def_args , n_args );
227- }
228- }
229- * out_args1 = args ;
230- * out_args1_len = n_args ;
231- * out_args2 = extra_args ;
232- * out_args2_len = n_extra_args ;
233- return true;
234-
235- arg_error :
236- fun_pos_args_mismatch (self , self -> n_pos_args , n_args );
237- }
238-
239196// With this macro you can tune the maximum number of function state bytes
240197// that will be allocated on the stack. Any function that needs more
241198// than this will use the heap.
0 commit comments