When method is a JNI method, then we add a pointer to JNI environemnt
as the first argument. If method is also static, we put class's object
refrence as second argument. All those arguments must be treated same
as any other arguments, so they should receive indices 0 and 1
respectively.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 jit/args.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/jit/args.c b/jit/args.c
index 5c6ddaa..a6cc721 100644
--- a/jit/args.c
+++ b/jit/args.c
@@ -84,6 +84,7 @@ struct expression *convert_args(struct stack *mimic_stack,
                                struct vm_method *method)
 {
        struct expression *args_list = NULL;
+       unsigned long nr_args_total;
        unsigned long i;
 
        if (nr_args == 0) {
@@ -91,6 +92,8 @@ struct expression *convert_args(struct stack *mimic_stack,
                goto out;
        }
 
+       nr_args_total = nr_args;
+
        if (vm_method_is_jni(method)) {
                if (vm_method_is_static(method))
                        --nr_args;
@@ -105,7 +108,7 @@ struct expression *convert_args(struct stack *mimic_stack,
        for (i = 0; i < nr_args; i++) {
                struct expression *expr = stack_pop(mimic_stack);
                args_list = insert_arg(args_list, expr,
-                                      method, nr_args - i - 1);
+                                      method, nr_args_total - i - 1);
        }
 
        if (vm_method_is_jni(method)) {
@@ -122,9 +125,8 @@ struct expression *convert_args(struct stack *mimic_stack,
                                return NULL;
                        }
 
-                       /* FIXME: Set index correctly */
                        args_list = insert_arg(args_list, class_expr,
-                                              method, 0);
+                                              method, 1);
                }
 
                jni_env_expr = value_expr(J_REFERENCE,
@@ -134,7 +136,6 @@ struct expression *convert_args(struct stack *mimic_stack,
                        return NULL;
                }
 
-               /* FIXME: Set index correctly */
                args_list = insert_arg(args_list, jni_env_expr, method, 0);
        }
 
-- 
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

Reply via email to