]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
Emit the check for null only if the value to check is nint constant != 0 in
authorKlaus Treichel <ktreichel@web.de>
Sun, 4 May 2008 16:53:08 +0000 (16:53 +0000)
committerKlaus Treichel <ktreichel@web.de>
Sun, 4 May 2008 16:53:08 +0000 (16:53 +0000)
jit_insn_check_null.

ChangeLog
jit/jit-insn.c

index e57dfda3872e091ca8b7c4c504fcfb6c2aeab48c..7dae313a45bdf31d499f8da5dbcc53fc15b27000 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
        register inhibited regardless if the value was already in the
        register or not.
 
+       * jit/jit-insn.c (jit_insn_check_null): Emit the check only if the
+       value to check is no nint constant != 0.
+
 2008-04-22  Aleksey Demakov  <ademakov@gmail.com>
 
        * configure.in: update to modern autoconf, rename to configure.ac.
index b9c47b79baa438c7e1ea11366e1bdd16de5ce6fd..7ad8f3332fab2e62d2f9ac46cc404c59493800b5 100644 (file)
@@ -1850,6 +1850,11 @@ int jit_insn_check_null(jit_function_t func, jit_value_t value)
        {
                return 0;
        }
+       /* Do the check only if the value is no not Null constant */
+       if(value->is_nint_constant && (value->address != 0))
+       {
+               return 1;
+       }
        func->builder->may_throw = 1;
        return create_unary_note(func, JIT_OP_CHECK_NULL, value);
 }