reg_args_count provides a faster way of determining how many stack and
register arguments a method takes.

Signed-off-by: Eduard - Gabriel Munteanu <eduard.munte...@linux360.ro>
---
 arch/x86/args.c     |    2 ++
 include/jit/args.h  |    5 ++++-
 include/vm/method.h |    1 +
 jit/args.c          |   11 -----------
 4 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/x86/args.c b/arch/x86/args.c
index bb1bfe9..6fe22b8 100644
--- a/arch/x86/args.c
+++ b/arch/x86/args.c
@@ -127,6 +127,8 @@ int args_map_init(struct vm_method *method)
                map->stack_index = stack_count++;
        }
 
+       method->reg_args_count = gpr_count;
+
        return 0;
 }
 
diff --git a/include/jit/args.h b/include/jit/args.h
index 8e9bceb..12d31dc 100644
--- a/include/jit/args.h
+++ b/include/jit/args.h
@@ -29,7 +29,10 @@ static inline int get_stack_args_count(struct vm_method 
*method)
        return method->args_count;
 }
 #else
-extern int get_stack_args_count(struct vm_method *method);
+static inline int get_stack_args_count(struct vm_method *method)
+{
+       return method->args_count - method->reg_args_count;
+}
 #endif /* CONFIG_ARGS_MAP */
 
 #endif
diff --git a/include/vm/method.h b/include/vm/method.h
index ebb1abe..90a4fef 100644
--- a/include/vm/method.h
+++ b/include/vm/method.h
@@ -38,6 +38,7 @@ struct vm_method {
        int args_count;
 #ifdef CONFIG_ARGS_MAP
        struct vm_args_map *args_map;
+       int reg_args_count;
 #endif
 
        struct cafebabe_code_attribute code_attribute;
diff --git a/jit/args.c b/jit/args.c
index f054c5c..3761cf2 100644
--- a/jit/args.c
+++ b/jit/args.c
@@ -35,17 +35,6 @@
 #include "vm/stack.h"
 
 #ifdef CONFIG_ARGS_MAP
-int get_stack_args_count(struct vm_method *method)
-{
-       int i, count = 0;
-
-       for (i = 0; i < method->args_count; i++)
-               if (method->args_map[i].reg == MACH_REG_UNASSIGNED)
-                       count++;
-
-       return count;
-}
-
 static inline void set_expr_arg_reg(struct expression *expr,
                                    struct vm_method *method,
                                    int index)
-- 
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