The sole purpose of this change is to make the output more readable if we
can; on i386 at least, this high byte is always 0 and it just makes it
harder to read the traces.

Signed-off-by: Vegard Nossum <vegard.nos...@gmail.com>
---
 jit/tree-printer.c           |   21 ++++++++++++++++++---
 test/jit/tree-printer-test.c |    2 +-
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/jit/tree-printer.c b/jit/tree-printer.c
index 8aac180..df61e88 100644
--- a/jit/tree-printer.c
+++ b/jit/tree-printer.c
@@ -360,9 +360,24 @@ static int print_local_expr(int lvl, struct string *str,
 static int print_temporary_expr(int lvl, struct string *str,
                                struct expression *expr)
 {
-       return str_append(str, "[temporary %s 0x%lx (high), 0x%lx (low)]",
-                         type_names[expr->vm_type], expr->tmp_high,
-                         expr->tmp_low);
+       int err;
+
+       err = str_append(str, "[temporary %s ", type_names[expr->vm_type]);
+       if (err)
+               goto out;
+
+       if (expr->tmp_high) {
+               err = str_append(str, "0x%lx (high), ", expr->tmp_high);
+               if (err)
+                       goto out;
+       }
+
+       err = str_append(str, "0x%lx (low)]", expr->tmp_low);
+       if (err)
+               goto out;
+
+out:
+       return err;
 }
 
 static int print_mimic_stack_slot_expr(int lvl, struct string *str,
diff --git a/test/jit/tree-printer-test.c b/test/jit/tree-printer-test.c
index bd0ba74..ca096e7 100644
--- a/test/jit/tree-printer-test.c
+++ b/test/jit/tree-printer-test.c
@@ -274,7 +274,7 @@ void assert_printed_temporary_expr(struct string *expected, 
enum vm_type type, s
 void test_should_print_temporary_expression(void)
 {
        assert_printed_temporary_expr(str_aprintf(
-               "[temporary int 0x0 (high), 0x12345678 (low)]"),
+               "[temporary int 0x12345678 (low)]"),
                J_INT, NULL, (struct var_info *)0x12345678);
        assert_printed_temporary_expr(str_aprintf(
                "[temporary boolean 0x85215975 (high), 0x87654321 (low)]"),
-- 
1.6.0.6


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to