Signed-off-by: Saeed Siam <[EMAIL PROTECTED]>
---
 jit/tree-printer.c           |   14 ++++++++++++++
 test/jit/tree-printer-test.c |   26 ++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/jit/tree-printer.c b/jit/tree-printer.c
index 624ea3b..06ae207 100644
--- a/jit/tree-printer.c
+++ b/jit/tree-printer.c
@@ -228,6 +228,18 @@ static int print_array_check_stmt(int lvl, struct string 
*str,
        return print_expr_stmt(lvl, str, "ARRAY_CHECK", stmt);
 }
 
+static int print_monitor_enter_stmt(int lvl, struct string *str,
+                                   struct statement *stmt)
+{
+       return print_expr_stmt(lvl, str, "MONITOR_ENTER", stmt);
+}
+
+static int print_monitor_exit_stmt(int lvl, struct string *str,
+                                   struct statement *stmt)
+{
+       return print_expr_stmt(lvl, str, "MONITOR_EXIT", stmt);
+}
+
 typedef int (*print_stmt_fn) (int, struct string * str, struct statement *);
 
 static print_stmt_fn stmt_printers[] = {
@@ -239,6 +251,8 @@ static print_stmt_fn stmt_printers[] = {
        [STMT_EXPRESSION] = print_expression_stmt,
        [STMT_NULL_CHECK] = print_null_check_stmt,
        [STMT_ARRAY_CHECK] = print_array_check_stmt,
+       [STMT_MONITOR_ENTER] = print_monitor_enter_stmt,
+       [STMT_MONITOR_EXIT] = print_monitor_exit_stmt,
 };
 
 static int print_stmt(int lvl, struct tree_node *root, struct string *str)
diff --git a/test/jit/tree-printer-test.c b/test/jit/tree-printer-test.c
index dca1dec..6d63f18 100644
--- a/test/jit/tree-printer-test.c
+++ b/test/jit/tree-printer-test.c
@@ -140,6 +140,32 @@ void test_should_print_arraycheck_statement(void)
        assert_print_stmt("ARRAY_CHECK:\n  expression: [local int 0]\n", stmt);
 }
 
+void test_should_print_monitorenter_statement(void)
+{
+       struct expression *expr;
+       struct statement *stmt;
+
+       expr = local_expr(J_INT, 0);
+
+       stmt = alloc_statement(STMT_MONITOR_ENTER);
+       stmt->expression = &expr->node;
+
+       assert_print_stmt("MONITOR_ENTER:\n  expression: [local int 0]\n", 
stmt);
+}
+
+void test_should_print_monitorexit_statement(void)
+{
+       struct expression *expr;
+       struct statement *stmt;
+
+       expr = local_expr(J_INT, 0);
+
+       stmt = alloc_statement(STMT_MONITOR_EXIT);
+       stmt->expression = &expr->node;
+
+       assert_print_stmt("MONITOR_EXIT:\n  expression: [local int 0]\n", stmt);
+}
+
 static void assert_print_expr(const char *expected, struct expression *expr)
 {
        assert_tree_print(expected, &expr->node);
-- 
1.5.4.4


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jatovm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to