Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] convert blocks to dictionaries, phase 1, jv-lang.c
@ 2002-09-16 15:35 David Carlton
  2002-09-17  7:30 ` Anthony Green
  0 siblings, 1 reply; 2+ messages in thread
From: David Carlton @ 2002-09-16 15:35 UTC (permalink / raw)
  To: gdb-patches; +Cc: per, green

This patch does phase 1 of converting blocks to dictionaries in the
file jv-lang.c.  It depends on the patches in
<http://sources.redhat.com/ml/gdb-patches/2002-09/msg00325.html>.

I've run it through the testsuite, but I don't think that the
testsuite really exercises this part of the code at all.  What this
code should be doing is two things:

1) Make sure that the blocks that jv-lang.c creates itself (as opposed
   to blocks created through buildsym.c) have a BLOCK_DICT member
   that's initialized correctly.

2) Make sure that all the code to add symbols to those blocks are
   added via DICT_TEMP_add_block_symbol.  (This should take care of
   resizing the block when necessary.)

David Carlton
carlton@math.stanford.edu

2002-09-16  David Carlton  <carlton@math.stanford.edu>

	* jv-lang.c (get_java_class_symtab): Initialize the BLOCK_DICT of
	the static and global blocks.
	(add_class_symtab_symbol): Add symbol via
	DICT_TEMP_add_block_symbol.
	Delete variable class_symtab_space.

Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.12
diff -u -p -r1.12 jv-lang.c
--- jv-lang.c	11 Jul 2002 20:46:19 -0000	1.12
+++ jv-lang.c	16 Sep 2002 21:00:04 -0000
@@ -85,8 +85,6 @@ static struct symtab *class_symtab = NUL
 
 /* Maximum number of class in class_symtab before relocation is needed. */
 
-static int class_symtab_space;
-
 static struct symtab *
 get_java_class_symtab (void)
 {
@@ -111,15 +109,14 @@ get_java_class_symtab (void)
       BLOCK_END (bl) = 0;
       BLOCK_FUNCTION (bl) = NULL;
       BLOCK_SUPERBLOCK (bl) = NULL;
+      BLOCK_DICT (bl) = DICT_TEMP_create_block (bl);
       BLOCK_GCC_COMPILED (bl) = 0;
       BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl;
 
       /* Allocate GLOBAL_BLOCK.  This has to be relocatable. */
-      class_symtab_space = 128;
-      bl = xmmalloc (objfile->md,
-		     sizeof (struct block)
-		     + ((class_symtab_space - 1) * sizeof (struct symbol *)));
+      bl = xmmalloc (objfile->md, sizeof (struct block));
       *bl = *BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+      BLOCK_DICT (bl) = DICT_TEMP_create_block_expandable (bl);
       BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;
       class_symtab->free_ptr = (char *) bl;
     }
@@ -132,19 +129,8 @@ add_class_symtab_symbol (struct symbol *
   struct symtab *symtab = get_java_class_symtab ();
   struct blockvector *bv = BLOCKVECTOR (symtab);
   struct block *bl = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-  if (BLOCK_NSYMS (bl) >= class_symtab_space)
-    {
-      /* Need to re-allocate. */
-      class_symtab_space *= 2;
-      bl = xmrealloc (symtab->objfile->md, bl,
-		      sizeof (struct block)
-		      + ((class_symtab_space - 1) * sizeof (struct symbol *)));
-      class_symtab->free_ptr = (char *) bl;
-      BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl;
-    }
-
-  BLOCK_SYM (bl, BLOCK_NSYMS (bl)) = sym;
-  BLOCK_NSYMS (bl) = BLOCK_NSYMS (bl) + 1;
+  BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)
+    = DICT_TEMP_add_block_symbol (BLOCK_DICT (bl), sym);
 }
 
 static struct symbol *add_class_symbol (struct type *type, CORE_ADDR addr);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA] convert blocks to dictionaries, phase 1, jv-lang.c
  2002-09-16 15:35 [RFA] convert blocks to dictionaries, phase 1, jv-lang.c David Carlton
@ 2002-09-17  7:30 ` Anthony Green
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Green @ 2002-09-17  7:30 UTC (permalink / raw)
  To: David Carlton; +Cc: gdb-patches, per

On Mon, 2002-09-16 at 15:35, David Carlton wrote:
> This patch does phase 1 of converting blocks to dictionaries in the
> file jv-lang.c.  It depends on the patches in
> <http://sources.redhat.com/ml/gdb-patches/2002-09/msg00325.html>.

Look fine to me.

Thanks,

AG



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-17 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-16 15:35 [RFA] convert blocks to dictionaries, phase 1, jv-lang.c David Carlton
2002-09-17  7:30 ` Anthony Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox