dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Just In Time compiler (l


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] [SCM] DotGNU Portable.NET Just In Time compiler (libjit) branch, master, updated. 31659e71e173d7a678837ab90a7b28d8bb86c5f3
Date: Sun, 24 Jan 2010 09:48:12 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "DotGNU Portable.NET Just In Time compiler (libjit)".

The branch, master has been updated
       via  31659e71e173d7a678837ab90a7b28d8bb86c5f3 (commit)
      from  f6a09759b7deb46f1d5f83561e5e75a65b9a44b3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/libjit.git/commit/?id=31659e71e173d7a678837ab90a7b28d8bb86c5f3

commit 31659e71e173d7a678837ab90a7b28d8bb86c5f3
Author: Klaus Treichel <address@hidden>
Date:   Sun Jan 24 10:47:51 2010 +0100

    Fix accesses to possibly freed memory.

diff --git a/ChangeLog b/ChangeLog
index fa13da9..3cb6dde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-24  Klaus Treichel  <address@hidden>
+
+       * jit/jit-insn.c (jit_insn_branch_if, jit_insn_branch_if_not): Fix
+       accesses to possibly freed memory.
+
 2009-12-09  Aleksey Demakov  <address@hidden>
 
        * jit/jit-block.c (_jit_block_record_label): bail out on previously
diff --git a/jit/jit-insn.c b/jit/jit-insn.c
index de82973..b1dd2e2 100644
--- a/jit/jit-insn.c
+++ b/jit/jit-insn.c
@@ -3576,6 +3576,7 @@ int jit_insn_branch_if
        jit_block_t block;
        jit_type_t type;
        int opcode;
+       jit_value_t value1;
        jit_value_t value2;
 
        /* Bail out if the parameters are invalid */
@@ -3684,19 +3685,24 @@ int jit_insn_branch_if
                                case JIT_OP_NFGE_INV:   opcode = 
JIT_OP_BR_NFGE_INV; break;
                        }
                        /* Add a new branch instruction */
+                       /* Save the values from the previous insn because *prev 
might
+                          become invalid if the call to _jit_block_add_insn 
triggers
+                          a reallocation of the insns array. */
+                       value1 = prev->value1;
+                       value2 = prev->value2;
                        insn = 
_jit_block_add_insn(func->builder->current_block);
                        if(!insn)
                        {
                                return 0;
                        }
 
-                       jit_value_ref(func, prev->value1);
-                       jit_value_ref(func, prev->value2);
+                       jit_value_ref(func, value1);
+                       jit_value_ref(func, value2);
                        insn->opcode = (short)opcode;
                        insn->flags = JIT_INSN_DEST_IS_LABEL;
                        insn->dest = (jit_value_t)(*label);
-                       insn->value1 = prev->value1;
-                       insn->value2 = prev->value2;
+                       insn->value1 = value1;
+                       insn->value2 = value2;
                        goto add_block;
                }
        }
@@ -3788,6 +3794,7 @@ int jit_insn_branch_if_not
        jit_block_t block;
        jit_type_t type;
        int opcode;
+       jit_value_t value1;
        jit_value_t value2;
 
        /* Bail out if the parameters are invalid */
@@ -3897,19 +3904,24 @@ int jit_insn_branch_if_not
                        }
 
                        /* Add a new branch instruction */
+                       /* Save the values from the previous insn because *prev 
might
+                          become invalid if the call to _jit_block_add_insn 
triggers
+                          a reallocation of the insns array. */
+                       value1 = prev->value1;
+                       value2 = prev->value2;
                        insn = 
_jit_block_add_insn(func->builder->current_block);
                        if(!insn)
                        {
                                return 0;
                        }
 
-                       jit_value_ref(func, prev->value1);
-                       jit_value_ref(func, prev->value2);
+                       jit_value_ref(func, value1);
+                       jit_value_ref(func, value2);
                        insn->opcode = (short)opcode;
                        insn->flags = JIT_INSN_DEST_IS_LABEL;
                        insn->dest = (jit_value_t)(*label);
-                       insn->value1 = prev->value1;
-                       insn->value2 = prev->value2;
+                       insn->value1 = value1;
+                       insn->value2 = value2;
                        goto add_block;
                }
        }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    5 +++++
 jit/jit-insn.c |   28 ++++++++++++++++++++--------
 2 files changed, 25 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
DotGNU Portable.NET Just In Time compiler (libjit)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]