Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- include/vm/system.h | 10 ++++++++++ vm/jni-interface.c | 47 +++++++++++++++++++++++++---------------------- 2 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/include/vm/system.h b/include/vm/system.h index 2ce6012..bfe3112 100644 --- a/include/vm/system.h +++ b/include/vm/system.h @@ -78,4 +78,14 @@ static inline double uint64_to_double(uint32_t lowv, uint32_t highv) return a.fv; } +static inline uint32_t high_64(uint64_t val) +{ + return (val >> 32) & ~(uint32_t)0; +} + +static inline uint32_t low_64(uint64_t val) +{ + return val & ~(uint32_t)0; +} + #endif diff --git a/vm/jni-interface.c b/vm/jni-interface.c index 29d8061..8033ec4 100644 --- a/vm/jni-interface.c +++ b/vm/jni-interface.c @@ -820,30 +820,33 @@ DECLARE_NEW_XXX_ARRAY(long, T_LONG); DECLARE_NEW_XXX_ARRAY(int, T_INT); DECLARE_NEW_XXX_ARRAY(short, T_SHORT); -static void pack_args(struct vm_method *vmm, unsigned long *packed_args, - uint64_t *args) +static inline void pack_args(struct vm_method *vmm, unsigned long *packed_args, + uint64_t *args) { -#ifdef CONFIG_X86_32 - enum vm_type type; - const char *type_str; - int packed_idx; - int idx; - - type_str = vmm->type; - packed_idx = 0; - idx = 0; - - while ((type_str = parse_method_args(type_str, &type, NULL))) { - if (type != J_LONG && type != J_DOUBLE) { - double_to_uint64(args[idx++], - (uint32_t*) &packed_args[packed_idx], - (uint32_t*) &packed_args[packed_idx + 1]); - packed_idx += 2; - } else { - packed_args[packed_idx++] = args[idx++] & ~0ul; + if (BITS_PER_LONG == 32) { + enum vm_type type; + const char *type_str; + int packed_idx; + int idx; + + type_str = vmm->type; + packed_idx = 0; + idx = 0; + + while ((type_str = parse_method_args(type_str, &type, NULL))) { + if (type != J_LONG && type != J_DOUBLE) { + packed_args[packed_idx++] = low_64(args[idx]); + packed_args[packed_idx++] = high_64(args[idx++]); + } else { + packed_args[packed_idx++] = args[idx++] & ~0ul; + } } + } else { + int count; + + count = count_java_arguments(vmm->type); + memcpy(packed_args, args, sizeof(uint64_t) * count); } -#endif } static jobject -- 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