Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- include/vm/method.h | 2 ++ jit/invoke-bc.c | 14 ++++++-------- vm/method.c | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/include/vm/method.h b/include/vm/method.h index ebb1abe..3a6bac5 100644 --- a/include/vm/method.h +++ b/include/vm/method.h @@ -52,6 +52,8 @@ struct vm_method { int vm_method_init(struct vm_method *vmm, struct vm_class *vmc, unsigned int method_index); +unsigned int vm_method_java_argument_count(struct vm_method *vmm); + static inline bool vm_method_is_public(struct vm_method *vmm) { return vmm->method->access_flags & CAFEBABE_METHOD_ACC_PUBLIC; diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index 80c414d..0113378 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 = vm_method_java_argument_count(invoke_target); - 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/method.c b/vm/method.c index 095c1de..074a62a 100644 --- a/vm/method.c +++ b/vm/method.c @@ -174,3 +174,18 @@ int vm_method_prepare_jit(struct vm_method *vmm) return 0; } + +unsigned int vm_method_java_argument_count(struct vm_method *vmm) +{ + unsigned int count; + enum vm_type type; + const char *a; + + count = 0; + a = vmm->type; + + while ((a = parse_method_args(a, &type))) + 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