It returns the type for expression which should be pushed on
mimic stack. Types: byte, boolean, char, short should be
converted to int.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 include/jit/expression.h |    9 +++++++++
 jit/expression.c         |    9 ++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/include/jit/expression.h b/include/jit/expression.h
index 605ee60..e2ae00f 100644
--- a/include/jit/expression.h
+++ b/include/jit/expression.h
@@ -379,6 +379,15 @@ unsigned long nr_args(struct expression *);
 int expr_nr_kids(struct expression *);
 int expr_is_pure(struct expression *);
 
+static inline enum vm_type mimic_stack_type(enum vm_type type)
+{
+       if (type == J_CHAR || type == J_BYTE ||
+           type == J_SHORT || type == J_BOOLEAN)
+               return J_INT;
+
+       return type;
+}
+
 static inline int is_invoke_expr(struct expression *expr)
 {
        enum expression_type type = expr_type(expr);
diff --git a/jit/expression.c b/jit/expression.c
index 78f3256..ff61275 100644
--- a/jit/expression.c
+++ b/jit/expression.c
@@ -426,13 +426,8 @@ struct expression *instance_field_expr(enum vm_type 
vm_type,
 static struct expression *
 __invoke_expr(enum expression_type expr_type, enum vm_type vm_type, struct 
vm_method *target_method)
 {
-       struct expression *expr;
-
-       if (vm_type == J_CHAR || vm_type == J_BYTE ||
-           vm_type == J_SHORT || vm_type == J_BOOLEAN)
-               vm_type = J_INT;
-
-       expr = alloc_expression(expr_type, vm_type);
+       struct expression *expr = alloc_expression(expr_type,
+                                                  mimic_stack_type(vm_type));
 
        if (expr)
                expr->target_method = target_method;
-- 
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