Returns the count of java arguments that are passed to method. Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- include/vm/types.h | 1 + jit/invoke-bc.c | 14 ++++++-------- vm/types.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/include/vm/types.h b/include/vm/types.h index cf2bc03..d45916a 100644 --- a/include/vm/types.h +++ b/include/vm/types.h @@ -43,6 +43,7 @@ int vmtype_to_bytecode_type(enum vm_type); int get_vmtype_size(enum vm_type); const char *get_vm_type_name(enum vm_type); const char *parse_method_args(const char *, enum vm_type *, char **); +unsigned int count_java_arguments(const char *); static inline bool vm_type_is_float(enum vm_type type) { diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index 80c414d..947f522 100644 --- a/jit/invoke-bc.c +++ b/jit/invoke-bc.c @@ -52,16 +52,14 @@ int convert_return(struct parse_context *ctx) static unsigned int method_real_argument_count(struct vm_method *invoke_target) { - unsigned int c = invoke_target->args_count; - const char * a = invoke_target->type; - enum vm_type vmtype; + int argc; - /* FIXME: Make more robust. */ - while ((a = parse_method_args(a, &vmtype))) - if (vmtype == J_LONG || vmtype == J_DOUBLE) - c--; + argc = count_java_arguments(invoke_target->type); - return c; + if (!vm_method_is_static(invoke_target)) + argc++; + + return argc; } static int convert_and_add_args(struct parse_context *ctx, diff --git a/vm/types.c b/vm/types.c index 2ff98de..644790c 100644 --- a/vm/types.c +++ b/vm/types.c @@ -214,3 +214,16 @@ const char *parse_method_args(const char *type_str, enum vm_type *vmtype, return type_str; } + +unsigned int count_java_arguments(const char *type) +{ + unsigned int count; + enum vm_type vmtype; + + count = 0; + + while ((type = parse_method_args(type, &vmtype, NULL))) + count ++; + + return count; +} -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel