Changeset 1993 for trunk/symbol_table


Ignore:
Timestamp:
Mar 31, 2012, 8:38:26 PM (7 years ago)
Author:
ksherdy
Message:

Updated.

Location:
trunk/symbol_table
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/hash_strms.py

    r1969 r1993  
    44
    55def Gen_hash_streams(basis_bits, hash):
    6     hash.h0 = basis_bits.bit_2 ^ basis_bits.bit_3 ^ basis_bits.bit_4 ^ basis_bits.bit_5
    7     hash.h1 = basis_bits.bit_0 ^ basis_bits.bit_1 ^ basis_bits.bit_6 ^ basis_bits.bit_7
     6    hash.h0 = basis_bits.bit_3 ^ basis_bits.bit_5 ^ basis_bits.bit_7
     7    hash.h1 = basis_bits.bit_3 ^ basis_bits.bit_4 ^ basis_bits.bit_6
    88
    99def Main(basis_bits, hash):
  • trunk/symbol_table/main_template.cpp

    r1982 r1993  
    3434#include "../lib/s2p.hpp"
    3535#include "../lib/perflib/perfsec.h"
     36#include "../lib/bitblock_scan.hpp"
    3637#include "marker_strms.hpp"     // GENERATED HEADER
    3738#include "hash_strms.hpp"       // GENERATED HEADER
     
    5960
    6061// Target symbol type must inherit from AoS_symbol
    61 typedef struct symbol: public AoS_symbol
     62class Symbol: public AoS_symbol
    6263{
    63     string parameter_1;
    64     string parameter_2;
    65     bool parameter_3;
    66 } symbol;
     64public:
     65    bool parameter_1;
     66};
    6767
    6868int main(int argc, char * argv[]) {
     
    131131
    132132    // Symbol Table
    133     const uint32_t SYMBOL_COUNT = SEGMENT_SIZE;
    134     symbol symbol_ary[SYMBOL_COUNT];
     133    const uint32_t SYMBOL_COUNT = LOOKBACK_SIZE + SEGMENT_SIZE;
     134    Symbol * symbol_ary[SYMBOL_COUNT];
     135
     136    // TODO - DESTROY
     137    for(int i =0;i<SYMBOL_COUNT;i++) {
     138        symbol_ary[i] = new Symbol();
     139    }
     140
     141
    135142    id_symbol_table<fast_pool_allocator<1024> > symbol_table;
    136143
     
    163170
    164171      PERF_SEC_START(parser_timer);
    165       symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, SEGMENT_BLOCKS, symbol_ary, SYMBOL_COUNT);
     172      symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, SEGMENT_BLOCKS, (AoS_symbol **) symbol_ary/*, SYMBOL_COUNT*/);
    166173      PERF_SEC_END(parser_timer, SEGMENT_SIZE);
    167174
     
    179186      is.read ((char *)(raw_buffer), SEGMENT_SIZE);
    180187      chars_avail = is.gcount();
     188
     189      // test
     190      uint32_t blk_base = 0;
     191      uint32_t idx = 0;
     192      for(blk=0;blk<SEGMENT_BLOCKS + LOOKBACK_BLOCKS;blk++) {
     193          blk_base = blk * BLOCK_SIZE;
     194          ForwardScanner<BitBlock, scanword_t> fscanner(&starts[blk]);
     195          fscanner.scan_to_next();
     196          while(!fscanner.is_done()) {
     197              idx = LOOKBACK_SIZE + blk_base + fscanner.get_pos();
     198              cout <<"[" << idx << "]" << "=" << "(" << symbol_ary[idx]->gid << "," << symbol_ary[idx]->lgth << ")" << endl;
     199              fscanner.scan_to_next();
     200          }
     201      }
    181202    }
    182203
     
    222243
    223244    //PERF_SEC_START(parser_timer);
    224     symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, blk, symbol_ary, SYMBOL_COUNT);
     245    symbol_table.resolve(raw_buffer, groups, starts, ends_gte_17, h0, h1, blk, (AoS_symbol **) symbol_ary/*, SYMBOL_COUNT*/);
    225246    //PERF_SEC_END(parser_timer, chars_avail+1);
     247
     248    // test
     249    uint32_t blk_base = 0;
     250    uint32_t idx = 0;
     251    for(blk=0;blk<segment_size + LOOKBACK_BLOCKS;blk++) {
     252        blk_base = blk * BLOCK_SIZE;
     253        ForwardScanner<BitBlock, scanword_t> fscanner(&starts[blk]);
     254        fscanner.scan_to_next();
     255        while(!fscanner.is_done()) {
     256            idx = LOOKBACK_SIZE + blk_base + fscanner.get_pos();
     257            cout <<"[" << idx << "]" << "=" << "(" << symbol_ary[idx]->gid << "," << symbol_ary[idx]->lgth << ")" << endl;
     258            fscanner.scan_to_next();
     259        }
     260    }
    226261
    227262    PERF_SEC_DUMP(parser_timer);
Note: See TracChangeset for help on using the changeset viewer.