[PATCH] jit: fix method_real_argument_count()
When method's argument was [D then 'c' value was incorrectly decremented. Use parse_method_args() to avoid code redundancy. Signed-off-by: Tomek Grabiec --- jit/invoke-bc.c | 15 ++- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index e65de6c..80c414d 100644 --- a/jit/invoke-bc.c +++ b/jit/invoke-bc.c @@ -53,17 +53,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; - char * a = invoke_target->type; + const char * a = invoke_target->type; + enum vm_type vmtype; - /* FIXME: Make more robust, verify correctness. */ - while (*(a++) != ')') { - if (*a == 'J' || *a == 'D') + /* FIXME: Make more robust. */ + while ((a = parse_method_args(a, &vmtype))) + if (vmtype == J_LONG || vmtype == J_DOUBLE) c--; - if (*a == 'L') { - while (*(++a) != ';') - ; - } - } + return c; } -- 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
[PATCH] jit: fix method_real_argument_count()
Signatures with 'J' after 'Lclass;' were incorrectly parsed Signed-off-by: Tomek Grabiec --- jit/invoke-bc.c |3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index 3a4b2da..628ebf3 100644 --- a/jit/invoke-bc.c +++ b/jit/invoke-bc.c @@ -59,8 +59,7 @@ static unsigned int method_real_argument_count(struct vm_method *invoke_target) if (*a == 'J' || *a == 'D') c--; if (*a == 'L') { - ++a; - while (*(a++) != ';') + while (*(++a) != ';') ; } } -- 1.6.0.6 -- Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
Re: [PATCH] jit: fix method_real_argument_count
On Tue, 2009-06-30 at 19:55 +0200, Vegard Nossum wrote: > We're scanning the method signature to determine the number of "real" > arguments to pass for an "invoke" opcode. We use the function > method_real_argument_count() for this. But it doesn't skip class names, > so if there is an uppercase J or D in the class name (of the argument > type), we count one argument less than we should and push one argument > less on the stack. > > Cc: Arthur HUILLET > Signed-off-by: Vegard Nossum Applied, thanks! -- ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel
[PATCH] jit: fix method_real_argument_count
We're scanning the method signature to determine the number of "real" arguments to pass for an "invoke" opcode. We use the function method_real_argument_count() for this. But it doesn't skip class names, so if there is an uppercase J or D in the class name (of the argument type), we count one argument less than we should and push one argument less on the stack. Cc: Arthur HUILLET Signed-off-by: Vegard Nossum --- jit/invoke-bc.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/jit/invoke-bc.c b/jit/invoke-bc.c index aa08109..c4b308a 100644 --- a/jit/invoke-bc.c +++ b/jit/invoke-bc.c @@ -51,9 +51,16 @@ static unsigned int method_real_argument_count(struct vm_method *invoke_target) { unsigned int c = invoke_target->args_count; char * a = invoke_target->type; + + /* FIXME: Make more robust, verify correctness. */ while (*(a++) != ')') { if (*a == 'J' || *a == 'D') c--; + if (*a == 'L') { + ++a; + while (*(a++) != ';') + ; + } } return c; } -- 1.6.0.4 -- ___ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel