public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-jankratochvil-entryval: cmt
@ 2011-07-15  7:56 jkratoch
  0 siblings, 0 replies; only message in thread
From: jkratoch @ 2011-07-15  7:56 UTC (permalink / raw)
  To: archer-commits

The branch, archer-jankratochvil-entryval has been updated
       via  a402d7e45e916a264d49335834646a24d0c922c6 (commit)
       via  df99cde933a1f7c4eaf0183a7a86917f5e8916d9 (commit)
      from  4798be10a061a69a99d80a6b57994659ce3acf86 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a402d7e45e916a264d49335834646a24d0c922c6
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Jul 15 08:25:47 2011 +0200

    cmt

commit df99cde933a1f7c4eaf0183a7a86917f5e8916d9
Author: Jan Kratochvil <jan.kratochvil@redhat.com>
Date:   Fri Jul 15 08:23:49 2011 +0200

    simplify

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

Summary of changes:
 gdb/dwarf2loc.c |   73 ++++++++++++++++++++++--------------------------------
 1 files changed, 30 insertions(+), 43 deletions(-)

First 500 lines of diff:
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 6abae25..55af753 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -419,6 +419,20 @@ addr_to_tail_call_list_complete_func (struct gdbarch *gdbarch, CORE_ADDR addr)
   return sym;
 }
 
+DEF_VEC_I (CORE_ADDR);
+
+static void
+free_call_sitep_vecp (void *arg)
+{
+  VEC (CORE_ADDR) **vecp = arg;
+
+  if (*vecp)
+    {
+      VEC_free (CORE_ADDR, *vecp);
+      *vecp = NULL;
+    }
+}
+
 /* Verify function with entry point exact address ADDR can never call itself
    via its tail calls (incl. transitively).  Throw error if it can call itself
    via tail calls.  */
@@ -429,14 +443,8 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
   struct obstack addr_obstack;
   htab_t addr_hash;
   struct cleanup *old_chain;
-  struct todo
-    {
-      CORE_ADDR addr;
-      struct todo *next;
-    }
-  /* Breadth-first search may find the possible loop faster.  */
-  *todo_list = NULL, **todo_tail = &todo_list;
   CORE_ADDR addr;
+  VEC (CORE_ADDR) *todo = NULL;
 
   obstack_init (&addr_obstack);
   old_chain = make_cleanup_obstack_free (&addr_obstack);   
@@ -445,19 +453,23 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
 				    NULL);
   make_cleanup_htab_delete (addr_hash);
 
-  addr = verify_addr;
-  for (;;)
+  make_cleanup (free_call_sitep_vecp, &todo);
+
+  VEC_safe_push (CORE_ADDR, todo, verify_addr);
+  while (!VEC_empty (CORE_ADDR, todo))
     {
       struct symbol *func_sym;
       struct call_site *call_site;
 
+      addr = VEC_pop (CORE_ADDR, todo);
+
       func_sym = addr_to_tail_call_list_complete_func (gdbarch, addr);
 
       for (call_site = TYPE_TAIL_CALL_LIST (SYMBOL_TYPE (func_sym));
 	   call_site; call_site = call_site->tail_call_next)
 	{
 	  CORE_ADDR target_addr;
-	  CORE_ADDR **slot;
+	  void **slot;
 
 	  /* CALLER_FRAME is not available for tail-call jumped frames.  */
 	  target_addr = call_site_to_target_addr (call_site,
@@ -475,48 +487,23 @@ func_verify_no_selftailcall (struct gdbarch *gdbarch, CORE_ADDR verify_addr)
 			   paddress (gdbarch, verify_addr));
 	    }
 
-	  slot = (CORE_ADDR **) htab_find_slot (addr_hash, &target_addr,
-						INSERT);
+	  slot = htab_find_slot (addr_hash, &target_addr, INSERT);
 	  if (*slot == NULL)
 	    {
-	      struct todo *todo;
+	      CORE_ADDR *addrp;
 
-	      todo = obstack_alloc (&addr_obstack, sizeof (*todo));
-	      todo->addr = target_addr;
-	      todo->next = NULL;
-	      *todo_tail = todo;
-	      todo_tail = &todo->next;
+	      addrp = obstack_alloc (&addr_obstack, sizeof (CORE_ADDR));
+	      *addrp = target_addr;
+	      *slot = &addrp;
 
-	      *slot = &todo->addr;
+	      VEC_safe_push (CORE_ADDR, todo, target_addr);
 	    }
 	}
-
-      /* Next iteration.  */
-      if (!todo_list)
-	break;
-      addr = todo_list->addr;
-      todo_list = todo_list->next;
-      if (!todo_list)
-	todo_tail = &todo_list;
     }
 
   do_cleanups (old_chain);
 }
 
-DEF_VEC_I (CORE_ADDR);
-
-static void
-free_call_sitep_vecp (void *arg)
-{
-  VEC (CORE_ADDR) **vecp = arg;
-
-  if (*vecp)
-    {
-      VEC_free (CORE_ADDR, *vecp);
-      *vecp = NULL;
-    }
-}
-
 static void
 tailcall_dump_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
@@ -615,8 +602,8 @@ chain_candidate (struct gdbarch *gdbarch, struct call_site_chain **resultp,
 }
 
 /* Create and return call_site_chain for CALLER_PC and CALLEE_PC.  All the
-   assumed frames between them use GDBARCH.  Any exceptions are normally
-   thrown.  */
+   assumed frames between them use GDBARCH.  Any unreliability results in
+   thrown NOT_FOUND_ERROR.  */
 
 static struct call_site_chain *
 call_site_find_chain_1 (struct gdbarch *gdbarch, CORE_ADDR caller_pc,


hooks/post-receive
--
Repository for Project Archer.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-15  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-15  7:56 [SCM] archer-jankratochvil-entryval: cmt jkratoch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).