Ignore:
Timestamp:
Aug 26, 2011, 3:33:01 PM (8 years ago)
Author:
vla24
Message:

Symbol Table: Refactored code. Split HashTable? implementation into 3 classes according to grouping strategies.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/symtab/pbgs_log_symbol_table.h

    r1387 r1391  
    66 * Log grouping strategy.
    77 *
     8 * Log group sorting             f(L) = ceil (log(L))
     9 *
    810 */
    911
     
    2628#define USE_FUNCTION_TEMPLATES
    2729#include "stringpool.h"
    28 #include "bitstream_hash_table.h"
     30#include "bitstream_log_hash_table.h"
    2931#include "ls_symbol_table_compare.h"
    3032#include "ls_symbol_table_util.h"
     
    5759    inline int Lookup_or_Insert_Name_16(char* name, int hashvalue, int length);
    5860
    59     // Symbol length [17,32]
    60     inline int Lookup_or_Insert_Name_32(char* name, int hashvalue, int length);
    61 
    62     // Symbol length > 32
     61    // Symbol length > 16
    6362    inline int Lookup_or_Insert_Name(char* name, int hashvalue, int L);
    6463
     
    6867private:
    6968    StringPool <4096,100> m_pool;
    70     BitStreamHashTable m_hashTable[TOTAL_GROUPS];
     69    BitStreamLogHashTable m_hashTable[TOTAL_GROUPS];
    7170    int m_globalNameCount;
    7271};
     
    223222}
    224223
    225 // Use this function for 17 <= L <= 32
    226 inline int PBGSLogSymbolTable::Lookup_or_Insert_Name_32(char* name, int hashvalue, int L)
    227 {
    228     int GID = 0;
    229 
    230     //Lookup
    231     GID = m_hashTable[LAST_GROUP].Lookup_Name_32(name, hashvalue, L);
    232 
    233     //Insert
    234     if (!GID) //symbol not found
    235     {
    236         char* c = m_pool.Insert(name, L);
    237         GID = m_globalNameCount;
    238 
    239         m_hashTable[LAST_GROUP].Insert_Name(c, hashvalue, m_globalNameCount, L);
    240         m_globalNameCount++;
    241     }
    242 #if DEBUG_PBGS
    243     delim = name[L];
    244     name[L] = '\0';
    245     cout << "Lookup or Insert: " << name << " | lgth: " << L << " | bucket: " << LAST_BUCKET << endl;
    246     name[L] = delim;
    247 #endif
    248 
    249     return GID;
    250 }
    251 
    252 // Use this function for L > 32
     224// Use this function for L > 16
    253225inline int PBGSLogSymbolTable::Lookup_or_Insert_Name(char* name, int hashvalue, int L)
    254226{
     
    260232
    261233    //Lookup
    262     GID = m_hashTable[LAST_GROUP].Lookup_Name(name, hashvalue,L);
     234    GID = m_hashTable[LAST_GROUP].Lookup_Name_17(name, hashvalue,L);
    263235
    264236    //Insert
Note: See TracChangeset for help on using the changeset viewer.