From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22432 invoked by alias); 16 Sep 2002 22:35:27 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22425 invoked from network); 16 Sep 2002 22:35:27 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 16 Sep 2002 22:35:27 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id g8GMZQJ11286; Mon, 16 Sep 2002 15:35:26 -0700 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb-patches@sources.redhat.com Subject: [RFA] convert blocks to dictionaries, phase 1, jv-lang.c Cc: per@bothner.com, green@redhat.com From: David Carlton Date: Mon, 16 Sep 2002 15:35:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-09/txt/msg00327.txt.bz2 This patch does phase 1 of converting blocks to dictionaries in the file jv-lang.c. It depends on the patches in . 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 * 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);