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 <arthur.huil...@free.fr>
Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 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

Reply via email to