This fixes problems encountered with passing arguments in case of JNI.
Signed-off-by: Eduard - Gabriel Munteanu <[email protected]>
---
arch/x86/args.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/x86/args.c b/arch/x86/args.c
index c52f3cd..5b5a740 100644
--- a/arch/x86/args.c
+++ b/arch/x86/args.c
@@ -42,15 +42,19 @@ int args_init(unsigned long *state,
char *type;
for (type = method->type; *type != ')'; type++) {
- if (*type == 'I' || *type == 'L') {
- method->args_count--;
+ if (*type == 'I' || *type == 'L' || *type == 'J')
method->reg_args_count++;
- }
if (method->reg_args_count == 6)
break;
}
+ if (vm_method_is_jni(method))
+ method->reg_args_count += 2;
+
+ method->reg_args_count = min(method->reg_args_count, 6);
+ method->args_count -= method->reg_args_count;
+
*state = 1;
return 0;
@@ -69,7 +73,9 @@ int args_set(unsigned long *state,
return 0;
}
- assert((value_expr->vm_type == J_INT || value_expr->vm_type == J_LONG));
+ assert((value_expr->vm_type == J_INT ||
+ value_expr->vm_type == J_LONG ||
+ value_expr->vm_type == J_REFERENCE));
reg = (6 - method->reg_args_count) + (*state)++ - method->args_count;
expr->arg_private = (void *) reg;
--
1.6.0.6
------------------------------------------------------------------------------
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel