From: David Carlton <carlton@math.stanford.edu>
To: gdb-patches@sources.redhat.com
Cc: per@bothner.com, green@redhat.com
Subject: [RFA] convert blocks to dictionaries, phase 1, jv-lang.c
Date: Mon, 16 Sep 2002 15:35:00 -0000 [thread overview]
Message-ID: <ro17khlh8b5.fsf@jackfruit.Stanford.EDU> (raw)
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);
next reply other threads:[~2002-09-16 22:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-16 15:35 David Carlton [this message]
2002-09-17 7:30 ` Anthony Green
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ro17khlh8b5.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=gdb-patches@sources.redhat.com \
--cc=green@redhat.com \
--cc=per@bothner.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox