From c71edaed73e7c000747b58da8d9c8c807b519d07 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Sep 2016 23:05:51 +1000 Subject: [PATCH] py/objfun: Remove unnecessary check for viper fun with 5 or more args. The native emitter/compiler restricts viper functions to 4 args, so there is no need for an extra check in the dynamic dispatch. --- py/objfun.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/py/objfun.c b/py/objfun.c index 3fd25fb224..fd51dd589d 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -409,17 +409,15 @@ STATIC mp_obj_t fun_viper_call(mp_obj_t self_in, size_t n_args, size_t n_kw, con ret = ((viper_fun_2_t)fun)(mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8)); } else if (n_args == 3) { ret = ((viper_fun_3_t)fun)(mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8), mp_convert_obj_to_native(args[2], self->type_sig >> 12)); - } else if (n_args == 4) { + } else { + // compiler allows at most 4 arguments + assert(n_args == 4); ret = ((viper_fun_4_t)fun)( mp_convert_obj_to_native(args[0], self->type_sig >> 4), mp_convert_obj_to_native(args[1], self->type_sig >> 8), mp_convert_obj_to_native(args[2], self->type_sig >> 12), mp_convert_obj_to_native(args[3], self->type_sig >> 16) ); - } else { - // TODO 5 or more arguments not supported for viper call - assert(0); - ret = 0; } return mp_convert_native_to_obj(ret, self->type_sig);